A fragile LaTeX command is (link)

a command that expands into illegal TeX code during the save process.

Does ConTeXt "suffer" from fragile commands, or are all commands there robust?

  • 2
    In ConTeXt you have \unexpanded\def to create unexpandable macros (and may be higher level ways to define things use this). About LaTeX, all the up to date instalation provide eTeX which has that built in the internals (\protected\def is the original name, redefined in ConTeXt), so the concept of fragile commands will eventually die. Of course it's possible that one makes a mistake and defines something wrong, but the system already has a way to cope and solve the issues of “fragile” commands. – Manuel Jun 16 '17 at 18:12
  • 1
    Yes, I'm not saying it's over. I meant that now the system has a way to solve this, future LaTeX versions (LaTeX3 in particular) won't have the concept of fragile commands as we know now. LaTeX2e (current) was developed quite some time ago. ConTeXt is more recent and was built with no “fragile” in mind in the sense of LaTeX; it's possible for some wrong code to slip in an expansion, but the answer is not “you should protect it” but “the macro is not correctly defined”. I cannot explain more since I'm not using the correct words to explain this :) – Manuel Jun 16 '17 at 18:27
  • 1
    Ah, and to answer your question: no, not all commands are “robust”, if by that you mean that they don't throw an error in an expansion context. E.g., the macro \foo defined with \def\foo{\def\baz{}} will create an error if used inside \edef\x{\foo} but the “answer” to that error is that you defined the command wrong, you have no “\protect” command. – Manuel Jun 16 '17 at 18:29
  • 1
    Why would you want to to put a \footnote inside a section{Title\footnote{Note}} command as the footnote would appear in both the ToC and the body. memoir does provide a `\section[toc-title][header-title]{body-title} where you (robustly) footnote the body-title without getting footnotes in other undesirable places – Peter Wilson Jun 16 '17 at 18:48
  • 4
    @Manuel: I agree. But the reason that ConTeXt doesn't have "fragile" commands is not because it is more recent (ConTeXt stated in mid-90's; LaTeX2e is similar timeframe). Rather, in ConTeXt Hans is happy to redefine existing macros (sometimes even at the cost of breaking backward compatibility). For example, almost all of MkIV macros have been rewritten from scratch in the last 5-8 years to take advantage of LuaTex. But LaTeX2e kernel is frozen and even fixing "incorrectly defined macros" is considered bad. – Aditya Jun 16 '17 at 19:30

No. Almost all user-level commands in ConTeXt are "robust".

  • 1
    Why only almost? – Evan Aad Jun 16 '17 at 19:45
  • 2
    Because I am replying based on my experience. I haven't gone and checked each and every command :-) – Aditya Jun 16 '17 at 22:38
  • 2
    This is also an effect of major parts of ConTeXt being implemented in Lua. A \directlua is always fully expandable. – Henri Menke Jun 17 '17 at 0:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.