0

I have the impression that if one defines a macro inside the definition of another one, then #1 and so on indicate the outer macro's arguments, while ##1 indicates those of the inner one. Is that right? Could one theoretically go furher, i.e. define a macro inside the definition of a macro defines inside the definition of a third one, thus using ###1 for the innermost macro's argument? If so, how many levels of nesting would be allowed?

5
  • Not quite: with each nesting level you have to double the number of #. So for the third level: ####1, for the fourth ########1 and so on
    – cgnieder
    Aug 10, 2014 at 21:59
  • The comment and the question linked in the duplicate tag leave me with just one last question: Is there a limit to the nunber of nested definitions or could one give definitions with a theoretically unkimited nesting number?
    – MickG
    Aug 11, 2014 at 8:01
  • Not that I would know. I never needed more than three levels
    – cgnieder
    Aug 11, 2014 at 8:36
  • @MickG you will use up input stack for nested definitions (whether or not you use ###) the limit is setable in texmf.cnf and defaults to 5000 in texlive 2014 Aug 11, 2014 at 15:15
  • see also tex.stackexchange.com/questions/71632/… Aug 11, 2014 at 15:19

0

Browse other questions tagged .