[texhax] Composing two commands one inside another

Pavel Minev Penev pavpen at berkeley.edu
Thu Aug 12 17:57:36 CEST 2004


On Wed, Aug 11, 2004 at 11:17:58PM +0200, Rodolfo Medina wrote:
> >> (Sorry for my ignorance!)
> >
> >I'm sure you're not ignorant, but your explanation is distincly unclear!
> 
> I'll try to be more precise.
> I use plain TeX, with eplain macros for cross references.
> Suppose I say
> 
> \definexref{label}{mouse, cat, }{}
> 
> and, some lines below,
> 
> \refn{label}
> 
> . This expands to:
> 
> mouse, cat,
[...]
> Right. But if I define instead
> 
> \edef\b#1, #2, {Hallo, #1, #2, !}
> 
> and then I say
> 
> \b{\refn{label}}
     ^^^^^^^^^^^^
          |
          +------------+
                       |
You are suplying only this one argument to a macro that takes two which
are separated by a comma and followed by one.  Therefore:

> I get an error message:
> 
> ! Paragraph ended before \b was complete.

> I'd need to know a correct way to "put \refn into \b"
> so to obtain the same expansion I get putting \refn into \a with
> "\a{\refn{label}}".
> The idea is that \b should collect the expansion of \refn{label}
> and go ahead with its own expansion:
> the value assumed by the one-argument function \refn
> should be argument for the two-argument function \b. I also tried with:
> \edef\c#1{\expandafter\b{\refn{#1}}}
> 
> and then I said
> 
> \c{label}
> 
> but still got an error message:
> 
> ! Argument of \b has an extra }.

If you are using \edef, you shold try

	\edef\c#1{\noexpand\b \refn{#1}}

Also

	\expandafter\b \refn{label}

should work, as well.

If you are using Plain TeX, you may find _The TeX Book_ useful.

!,
-- 
Pav  http://www.larouchepub.com/eirtoc/2004/eirtoc_3125.html
  ,., http://en.wikipedia.org/wiki/Frankfurt_School
,``:'', http://www.bilderberg.org/ccf.htm
{o ! o} http://en.wikipedia.org/wiki/Fabian_Society
] -+- [ http://bss.sfsu.edu/fischer/IR%20360/Readings/Readings.htm
 \ ! /  http://www.againsttcpa.com/   http://swpat.ffii.org/   My type: Dvorak.
  `-'http://en.wikipedia.org/wiki/List_of_U.S._foreign_interventions_since_1945
`shell$ gpg --keyserver x-hkp://search.keyserver.net:11371 --recv-key 164C028F`



More information about the texhax mailing list