I understand well the \apptocmd and related tools of etoolbox package. However, I still not understand what \appto<hook>{<code>} and related do, even reading three time the handbook ?

Should package programmer define hook as a macro without argument (like \myhook) ? In this case, what is the difference with command patched by \apptocmd and related ?

1 Answer 1


The definition of \appto is

% etoolbox.sty, line 891:

The first argument should be a parameterless macro. Why not using \apptocmd? Because it is much less efficient and it may even not succeed if the replacement text has “non standard” tokens (for instance, characters with a different category code than usual).

Apart from this, the only other difference between \appto and \apptocmd is that the latter preserves the status of a \long (parameterless) macro, whereas \appto will always change it to non-\long.

  • so \appto is recommaned for parameterless macro and \apptocmd for other macros?
    – Maïeul
    Commented May 14, 2016 at 21:33
  • @Maïeul Exactly so
    – egreg
    Commented May 14, 2016 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .