xdanaux / fontawesome-latex

LaTeX mappings for Font Awesome, the icons font
307 stars 36 forks source link

Package overwrites definition of \faHourglass and \faHourglass no longer works #3

Closed cfr42 closed 8 years ago

cfr42 commented 8 years ago

Ref.: http://tex.stackexchange.com/questions/309780/hourglass-in-fontawesome-package

The following code fails with the error because the use of \faHourglass does not match its definition.

\documentclass{article}
\usepackage{fontawesome}
\begin{document}
\faHourglass
\end{document}

Writing \faHourglass3 compiles correctly.

The problem is due to the following lines from fontawesomesymbols-generic.tex:

\def\faHourglass1{\faicon{hourglass-1}}\expandafter\def\csname faicon@hourglass-1\endcsname{\faicon{hourglass-start}}
\def\faHourglass2{\faicon{hourglass-2}}\expandafter\def\csname faicon@hourglass-2\endcsname{\faicon{hourglass-half}}
\def\faHourglass3{\faicon{hourglass-3}}\expandafter\def\csname faicon@hourglass-3\endcsname{\faicon{hourglass-end}}

Because these lines come after the definition of \faHourglass

\def\faHourglass{\faicon{hourglass}}

each one overwrites the previous definition. The result is that \faHourglass must be immediately followed by a 3 and will produce the symbol corresponding to hourglass-end.

TeX macros cannot include numerals in their names so an alternative approach is required here. The same problem applies to all other cases where names are defined with numbers e.g. the battery symbols etc.

xdanaux commented 8 years ago

Thanks for bringing this to my attention, and thanks to egreg for the solution!