6

I often want to pass some arguments into a macro definition that defines an inner macro with parameters. For example

\def\outmac #1,#2.{%
    \def\argone{#1}
    \def\argtwo{#2}
    \def\inmac #1,#2.{Parameters are 1:#1 and 2:#2,
        while outer parameters are 1:\argone, 2:\argtwo.}
}

So I can say \outmac a,b.\inmac c,d. to get

Parameters are 1:c and 2:d, while outer parameters are 1:a, 2:b.

. In other words: A call to \outmac should defines the way \inmac behaves.

Regards

Ingo

0

1 Answer 1

6
\def\outmac #1,#2.{%
    \def\inmac ##1,##2.{Parameters are 1:##1 and 2:##2,
        while outer parameters are 1:#1, 2:#2.}%
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .