>>>>> "Gady" == Gady Kozma <[EMAIL PROTECTED]> writes:

Gady> You caught me here... maybe I should read a LaTeX book
Gady> someday... but then I use LyX to avoid that I guess. But still,
Gady> there is a certain issue of "protect" which is relevant here.
Gady> What does it mean that the label text is "protected"? Should we
Gady> have a "parse_protected" routine? What other uses might such a
Gady> routine have?

\protect is not relevant here, I think, as long as both \label and
\ref do the same thing.

When some text is output in the .aux file, the macros it contains are
expanded (I am not sure why this choice has been made, actually).
However, this is very annoying for some complex macros which behaviour
depends a lot of the context where they are expanded (in particular
with optional arguments). Therefore, there is a macro \protect that
can be put in front of such macros. In normal more, \protect does
nothing. Buit when writing to .aux files, we have \protect==\noexpand,
and \noexpand\macro is expanded to \macro.

Buit there is also a nice trick called \DeclareRobustCommand. Here is
what the source has to say about it:

% \begin{macro}{\declare@robustcommand}
%    This is a package-writers command, which has the same syntax as
%    |\newcommand|, but which declares a protected command.  It does
%    this by having\\
%    |\DeclareRobustCommand\foo|\\ 
%    define |\foo| to be
%    |\protect\foo<space>|,\\
%    and then use |\newcommand\foo<space>|.\\
%    Since the internal command is |\foo<space>|, when it is written
%    to an auxiliary file, it will appear as |\foo|.  
%    
[snip]

Was that clear enough?

JMarc

Reply via email to