[texhax] \protect in LaTeX2e

Morten Høgholm moho01ab at student.cbs.dk
Tue Oct 5 22:27:14 CEST 2004


On Tue, 05 Oct 2004 17:28:07 +0100, Robert Hunt <reh10 at cam.ac.uk> wrote:

> But in any case, my real point is not whether there are alternatives to
> using \protect\nolinebreak, but that an average user is unlikely to
> realise that he needs to \protect the \nolinebreak in the first place;
> and the error message if he doesn't \protect it is less than helpful.

However typing
     ! Argument of \@caption has an extra }.
in Google gives you the FAQ answer as the very first hit.

> Anyway, thanks for the various suggestions...


As eTeX is the base for future LaTeX delevopment, it might be worth  
considering using \protected for stuff like this. Using the definition
     \makeatletter
     \protected\def\nolinebreak{\@testopt\@no at lnbk4}
     \makeatother
works of course.

One has to think carefully which commands should be robust and which not.  
\ref for instance must not be robust (not that it has stopped babel from  
doing it anyway).
-- 
Morten Høgholm



More information about the texhax mailing list