# Superscript page numbers with natbib

I'm with an annoying problem with natbib. When the super parameter is used, the citation happily goes superscript but the page or chapter number doesn't.

\documentclass{article}
\usepackage[numbers, square, super]{natbib}
\begin{document}
Some information.\cite[p.~56]{who09}

\begin{thebibliography}{0}
\bibitem{who09} Who J F. Nice Book. 2009.
\end{thebibliography}
\end{document}


The above example shows the page number into normal text instead of superscript. Removing super the page goes into brackets.

-
I've never seen anyone give references in the way you suggest. Can you point to a place where this is used? –  Joseph Wright Apr 12 '12 at 15:56
@joseph, Neither do I. I just want to be consistent in writing free style documents for class. –  Kanvuanza Apr 13 '12 at 2:44

Although this citation style is not common (as Joseph Wright suggested in his comment), you can obtain the desired result with a redefinition of the natbib's internal macro \NAT@citesuper. Here's a working example of such a redefinition:

\documentclass{article}
\usepackage[numbers, square, super]{natbib}

\makeatletter
\renewcommand\NAT@citesuper[3]{\ifNAT@swa
\if*#2*\else#2\NAT@spacechar\fi
\unskip\kern\p@\textsuperscript{\NAT@@open#1\if*#3*\else,\NAT@spacechar#3\fi\NAT@@close}%
\else #1\fi\endgroup}
\makeatother

\begin{document}

Some text\cite[p.~56]{who09} some text\cite{who09}

\begin{thebibliography}{0}
\bibitem{who09} Who J F. Nice Book. 2009.
\end{thebibliography}

\end{document}


-
Thanks, this solves my problem. –  Kanvuanza Apr 13 '12 at 3:03
This has helped me a great deal, works well for \citep, how can the same workaround be applied for \citet, which shows the same behaviour as the initial question.... –  Nicholas Hamilton Apr 14 '13 at 4:43

I cannot comment, so I feel the urge to post this as an answer. While the exact example asked for is (as was repeated) non-common, there is a very common use for this modification: Turning it into subreferences as in [1a], [1b], by adding the corresponding letter into square brackets \cite[a]{foo}, \cite[b]{foo} Also works with Natbib.

I modified Gonzalo's code snippet by looking at it and guessing which parts would be too many. Probably more code could be removed but I have no idea which that could be, and this is the first working example. (I am specifically suspecting anything containing #2 to be irrelevant, but I do not want to continue researching into this, as I have a thesis to hand in soon.)

\makeatletter
\renewcommand\NAT@citesuper[3]{\ifNAT@swa
\if*#2*\else#2\NAT@spacechar\fi
\unskip\kern\p@\textsuperscript{\NAT@@open#1#3\NAT@@close}%
\else #1\fi\endgroup}
\makeatother

-