----- Original Message ----- From: "Herbert Voss" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, February 22, 2006 3:20 AM
Subject: Re: Automatic formatting of a particular word?


Stephen Harris wrote:


----- Original Message -----
From: "Karsten Heymann"
<[EMAIL PROTECTED]> To:
<[email protected]> Sent: Wednesday,
February 22, 2006 1:06 AM Subject: Re: Automatic formatting of a
particular word?


Hi Stephen,

and put it in macros.tex and load it with \input macros and
use it in LyX with automatic expansion, even if it weren't hardwired
like Uwe's example?

Better do it the LateX way: write a simple sty nyxlogo.sty and put that
\providecommand*{\NyX}{...} in there (look at clsguide.dvi/pdf on how to
do that).

Yours,
Karsten

That does seem simpler. Thanks for the explanation, it led me to
discover texlogos.sty which contains the Metapost and Metafont
logos as well as BibTex so it serves as a model.

%% Displays the BibTeX logo.
%%
\DeclareRobustCommand{\bibtexlogo}{%
     \protect\scalebox{0.75}[1]{B}%
     \protect\scalebox{0.5625}[0.75]{IB}\TeX}

SH: Though the syntax of \DeclareRobustCommand is probably older
than \providecommand?

--------------
HVoss: no, it is quite different.
\section{\bibtexlogo} is possible, because it is a robust macro
and _not_ expanded, when it is going also into the table of contents.

Otherwise it won't work, it moves not as a macro into the *.toc
file, but fully expanded, which often causes errors.

Herbert

---------------------------------------------------------

SH: Thanks for your comment, it clarifies the fragile/robust distinction.

Uwe wrote that the following command is hardcoded in LyX:
[EMAIL PROTECTED]

-------------------------------------
SH: Is that robust because it is hardcoded? Would \DeclareRobustCommand
work better for inclusion in a created document using a style file than \providecommand ? I read this in clsguide.pdf:

-------------------------------------------------------------------------------

"Because LATEX2e supports different encodings, definitions
of commands for producing symbols, accents, composite glyphs,
etc. must be defined using the commands provided for this
purpose and described in LATEX2e Font Selection. This part
of the system is still under development so such tasks
should be undertaken with great caution.

Also, \DeclareRobustCommand should be used for
encoding-independent commands of this type."

--------------------------------------------

"LATEX 2.09 used several commands beginning with \p in
order to provide `protected'commands. For example, \LaTeX
was defined to be \protect\pLaTeX, and \pLaTeX was defined
to produce the LATEX logo. This made \LaTeX robust, even
though \pLaTeX was not. These commands have now been
reimplemented using \DeclareRobustCommand (described in
Section 4.10). If your package redefined one of the
\p-commands then you must remove the redefinition and use
\DeclareRobustCommand to redefine the non-\p command."

-----------------------------------------------------

Best regards,
Stephen



Reply via email to