I need to use the \Writinghand
symbol from the package marvosym.sty
. But, for some reason, loading this package raises an error:
(/usr/local/texlive/2013/texmf-dist/tex/latex/ifsym/ifsym.sty
(/usr/local/texlive/2013/texmf-dist/tex/latex/tools/calc.sty)! LaTeX Error: Command \Sun already defined.
Or name \end… illegal, see p.192 of the manual.
So, here is my general question:
Is there a general procedure to follow when one wants to include only one symbol from a « symbol package » (a package that creates many new symbols)?
Best Answer
No, there is no general procedure. One has to look into the package code and some knowledge of the terminal can be helpful; but one can always open the package file with an editor.
Let's see for
\WritingHand
that the Comprehensive List tells you it is frommarvosym.sty
.First of all, we need to identify how the font is known to LaTeX. In these cases, rather than opening the file in an editor, I use
less
:because
kpsewhich
is the utility that's used internally by the TeX programs to find a file. The first lines in the file areGood. We know how to load the font. The code is not the best possible, because
would be a cleaner call, although they're equivalent. The encoding
U
is “unspecified“ or “unknown”, which means that LaTeX won't try any of its tricks to adapt commands to the current encoding. It is a standard encoding, so there's no need to declare it beforehand. Any time we need a glyph from the font, we can sayin a group. Now we look for
\WritingHand
and we find it on line 80:the second part is just an alias. What's
\mvchr
? It's on line 5but it's again poor LaTeX programming, because
\symbol{#1}
would be better.So we have all the necessary bits in order to accomplish our task:
will work without loading any package. If you plan to use
\WritingHand
in moving arguments (sectional titles or captions, for instance), it may be better to use\DeclareRobustCommand
instead of\newcommand
, otherwise in the.aux
file you would findinstead of a simple
\WritingHand
. Not much of a problem, but possibly annoying.Suppose instead you want to use the glyph
that is available in the STIX font package. Looking at the documentation, we find it at position octal 204 (decimal 132) in the font
stix-extra1
(font table on page 43).As before, we look in
stix.sty
, but we don't findextra
inside it. Turn back to the documentation: on page 2 we find indeedThis seems a problem, but indeed it isn't. We can proceed almost as before, just adding the necessary infrastructure
The same caveat as before for
\DeclareRobustCommand
applies. The family namestixextrai
is arbitrary. Example document:which is how I produced the image above.