[texhax] Nested macro definition problem

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Apr 23 17:12:20 CEST 2010


On Fri, Apr 23, 2010 at 11:58:23AM -0300, José Romildo Malaquias wrote:

> Basically I need to define the macros:
> 
>   \def\ma{%
>     \def\mb{%
>       \def\mc###1{%
>         \textbf{###1}}}}
> 
> in a LaTeX document, but pdflatex finds the following error:
> 
>   ! Illegal parameter number in definition of \ma.
>   <to be read again> 
>                      1
>   l.5     \def\mc###1
>                      {%

\def\ma{% #1 #2
  \def\mb{% ##1 ##2
    \def\mc####1{% ####2
      \textbf{####1}%
      \def\md{% ########1 ########2
        ...
      }%
    }%
  }%
}

The number of # is not linear regarding the nesting depth, but
exponential.

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list