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?

MickG
  • 5,426
  • 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 '14 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 '14 at 08:01
  • Not that I would know. I never needed more than three levels – cgnieder Aug 11 '14 at 08: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 – David Carlisle Aug 11 '14 at 15:15
  • see also http://tex.stackexchange.com/questions/71632/why-do-paramaters-of-renewcommand-need-to-double-up-the-within-a-foreach/71633#71633 – David Carlisle Aug 11 '14 at 15:19

0 Answers0