# Hyperref and fullname (citations on captions)

I am using fullname.sty but it seems that, if I activate hyperref, it complains on all \cite commands that are used inside a \caption with this message:

Illegal parameter number in definition of \reserved@a.

I tried reading related threads but wasn't able to find a reason why this does not work.

• \protect seems to help. Still debuging if it is enough. – Alberto Jul 17 '15 at 19:00
• I don't know about fullname.sty, but probably it redefines \cite so that it loses its robustness. Load fixltx2e (it's not required if you have a very recently updated TeX distribution) and do \MakeRobust{\cite} after loading fullname.sty. Where is it possible to find fullname.sty? – egreg Jul 17 '15 at 19:09
• the fullname.sty name in my question is a link :-) and yes, it redefines it. Will check how MakeRobust works. thanks. – Alberto Jul 17 '15 at 19:11
• I see. Yes, it redefines \cite. But I'd be wary of loading a package unmaintained since 1992, probably made for LaTeX 2.09. As far as I can see, it does (badly) what you can get with natbib. – egreg Jul 17 '15 at 19:13
• Indeed. I am probably changing to natbib. I can get a similar result. MakeRobust failed to work. – Alberto Jul 17 '15 at 19:14

The fullname package is very old: its release date is March 1992, which means it was written for LaTeX 2.09.

It redefines \cite making it lose its robustness. It's possible to robustify it, but a trick is needed, because \MakeRobust is fooled by the fact that normally \cite is robust.

However, when the trick is used, LaTeX fails with “TeX capacity exceeded”.

You can work around the issue by using \protect when \cite is in a moving argument. My advice is to use a more recent and robust citation package such as natbib or biblatex.

Here's a minimal example:

\documentclass{article}
\usepackage{fullname}
\usepackage{hyperref}

\begin{document}

\cite{huang2011short}

\shortcite{huang2011short}

\namecite{huang2011short}

\begin{figure}[htp]
X
\caption{\protect\cite{huang2011short}}
\end{figure}

\bibliographystyle{fullname}
\bibliography{enet}

\end{document}


(The .bib file is one I used for another answer.)

You could also do

\documentclass{article}
\usepackage{fullname}
\usepackage{etoolbox}
\robustify{\cite}
\usepackage{hyperref}


so \protect is not necessary any more. But, again, this is like trying to repair your great-grand-father's bike you found in the basement. Nice hobby, but just that.

• And there is yet another detail. That part between the rectangular brackets should not be there :-) – Alberto Jul 17 '15 at 20:03
• @Alberto Another reason for using natbib or biblatex. – egreg Jul 17 '15 at 20:03