Basically every time I start to do something non-trivial and try to remove repetition, I run into problems with non-composability of commands. Why are there so many non-composable commands in (La)TeX?

I don't have a complete list ready, but my most recent run-in is with '\verb' which cannot be used in an argument to another command, although you can use the listings package or fancyvrb to lift some of the restrictions.

  • 1
    Well, short answer: LaTeX is a macro programming language, and macros are, in general, not easy, often impossible, to compose – Bordaigorl Dec 5 '17 at 10:05
  • Then, for simple macros with no problematic side-effects composition is straightforward, but the more complicated ones have complex side-effects that do not compose well, hence the per-macro incompatibilities. If you come up with a list of problematic macros, there is going to be probably a very different explanation for each item! – Bordaigorl Dec 5 '17 at 10:06
  • @Bordaigorl, so IIUC you are saying this is inherent to any macro language? – hkBst Dec 5 '17 at 10:15
  • 1
    \verb (and verbatim and listings) are very special commands that disable all latex syntax, by design they can not be composed with other commands. So they are very bad example for the general nature of your question. Do you want to ask about \verb or do you want to ask about the general nature of nested macro calls? They are very different questions. – David Carlisle Dec 5 '17 at 10:27
  • @DavidCarlisle, both problems seem to present the same to the user. My question is about whether these are design/implementation limitations or whether these problems are actually impossible to avoid with any design. – hkBst Dec 5 '17 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.