[latexrefman-discuss] \protect, Mysterious error about missing closing round bracket
Vincent Belaïche
vincent.belaiche at domain.hid
Fri Feb 5 12:59:22 CET 2016
Two more things:
1) the other example (with `\(...\)' in the section
argument also work fine for me
2) using $...$ instead of \protect\(...\protect\) is an alternative
fix for this sort of problem, shouldn't we mention it ?
Vincent.
> Hello,
>
> In node \protect you have this example:
>
> --8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
> In this example the @code{\caption} command gives a mysterious error
> about an extra curly brace. Fix the problem by preceding each
> @code{\raisebox} command with @code{\protect}.
>
> @example
> \begin at domain.hid@}
> ...
> \caption at domain.hid headquarters of A\raisebox at domain.hid@}@{C@}@}
> \end at domain.hid@}
> @end example
> --8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
>
> However with my LaTeX distro this issue was solved, there is no (no
> longer w.r.t. when this example was provided) such mysterious error.
>
> I know that with time, more and more standard commands are made robust,
> and that is a good thing. So giving an example using only standard
> commands is sooner or later bound to fail.
>
> Any suggestions ?
>
> I propose to change the example to some hand-made stuff like this (the
> silly \MyFragileCmd make é from e and does not change its argument
> otherwise). If you remove the \protect that will break.
>
> --8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
> \documentclass{article}
> \makeatletter
> \newcommand*\MyFragileCmd[1]{%
> \def\@tempa{#1}\def\@tempb{e}\ifx\@tempa\@tempb
> \'e\else #1\fi
> }
> \makeatother
> \begin{document}
> \listoffigures
> \begin{figure}\centering
> \begin{picture}(40,40)
> \put(20,20){\circle{40}}
> \end{picture}
> \caption{Company headquarters of La Capon\protect\MyFragileCmd
> e\protect\MyFragileCmd ale}
> \end{figure}
> \end{document}
> --8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
>
> VBR,
> Vincent
>
More information about the latexrefman
mailing list