# Why and how does alphalph change the reference of dingbats selected from pifont?

If you want to get a custom alphabet for symbolic footnotes, alphalph is a great package for it. However, it does not seem to play nicely with many other symbol font packages(bbding,pifont, &c.).

The easiest one to demonstrate this with is the dingbats in pifont (since it actually displays some characters, just the wrong characters).

As you can see in the MWE and its display the 4-star is being displayed as a G.

It repeats the G when it is supposed to, which suggests that the problem is not one of incrementing within the multiple generation parts of the code.

MWE:

\documentclass{article}
\usepackage{alphalph}
\usepackage{pifont}
\makeatletter
\newcommand*{\fnsymbolsingle}[1]{%
\ensuremath{%
\ifcase#1%
\or *%
\or \ding{71}
\else
\@ctrerr \fi
}%
}
\makeatother
\newalphalph{\fnsymbolmult}[mult]{\fnsymbolsingle}{}
\renewcommand*{\thefootnote}{%
\fnsymbolmult{\value{footnote}}%
}

\begin{document}
Text\footnote{first}. \ding{71}\footnote{second}.Text\footnote{third}. \ding{71}\footnote{fourth}.
\end{document}


Displays as

Even more interestingly you can have an errorful working example as below that allows the display of a character for which the index is not supposed to be valid at all (i.e., it's negative)!

\documentclass{article}
\usepackage{alphalph}
\usepackage{pifont}
\makeatletter
\newcommand*{\fnsymbolsingle}[1]{%
\ensuremath{%
\ifcase#1%
\or *%
\or \ding{71}
\or \ding{-1}
\else
\@ctrerr \fi
}%
}
\makeatother
\newalphalph{\fnsymbolmult}[mult]{\fnsymbolsingle}{}
\renewcommand*{\thefootnote}{%
\fnsymbolmult{\value{footnote}}%
}

\begin{document}
Text\footnote{first}. \ding{71}\footnote{second}.Text\footnote{third}. \ding{-1}\footnote{fourth}.
\end{document}


Which displays as

Since it displays a character from an alphabet(specifically, Γ), and does so despite throwing errors, it makes me think that what is happening is that somehow some number is being added to the input which is what is throwing off the dingbat count being sent to pifont in the \ding{} command.

Why does this happen and how can it be avoided? Does the solution hold promise for getting \alphalph to interface with other symbol font packages(e.g., bbding)?

• Related/duplicate: tex.stackexchange.com/questions/171177 – egreg Jun 14 '16 at 21:06
• If your purpose is having the asterisk in math mode, mark just it specifically as math. – egreg Jun 14 '16 at 21:07
• @egreg I definitely can tell that that is related given the solution below, but given the way \ensuremath is included by \alphalph in its examples, I actually think this is worthwhile as a separate question. The goal was not having an asterisk in math mode in particular. The goal is everything around it. – mpacer Jun 14 '16 at 21:19

\ding is not designed for math mode, if you use

    \newcommand*{\fnsymbolsingle}[1]{%
\ensuremath{%
\ifcase#1%
\or *%
\or \mbox{\ding{71}}%
\else
\@ctrerr \fi
}%
}


You get a symbol not a G

The Gamma in your error example is due to the fact that tex recovers from the negative char code by using character 0, and capital Gamma is in position 0 in the classic tex math font encoding.

• I always say that \ensuremath is dangerous! ;-) Just removing it is simpler; if a math mode asterisk is wanted, use $*$. Probably also adding \MakeRobust\ding is better. – egreg Jun 14 '16 at 21:02
• I was just following the example given in the \alphalph documentation (ctan.mackichan.com/macros/latex/contrib/oberdiek/alphalph.pdf, page 3), didn't particularly want anything as this was a simplified version of what i was getting at. – mpacer Jun 14 '16 at 21:16
• @mpacer the alphalph doc is using math commands like \mathsection inside \ensuremath, not \ding which is a text mode command. – David Carlisle Jun 14 '16 at 21:20
• @DavidCarlisle That's why I was hesitant to just get rid of \ensuremath altogether. But the \mbox trick works, and doesn't run into the spacing issues I associate with it. Thanks a bunch! Both you and @egreg. – mpacer Jun 14 '16 at 21:25
• @mpacer the package doc is probably just showing its age, latex used to use math mode for footnote superscripts but stopped many years ago and introduced \textsuperscript and uses text mode commands \textdagger, \textsection etc in its standard footnote command to avoid interference from different math font setup – David Carlisle Jun 14 '16 at 22:06