chicago.sty
offers a number of citation commands which may output a link to the bibliography if hyperref
is used. As long as no page number is given, hyperlink formatting is as expected (cf. last column). However, if a page number is to be displayed, citeN
and shortciteN
do include it in the hyperlink, whereas the other commands don't.
How could these commands be redefined to let their optional parameter always be formatted as a hyperlink?*
\documentclass{article}
\usepackage{chicago}
\usepackage{filecontents}
\usepackage[colorlinks=true,citecolor=red]{hyperref}
\begin{filecontents*}{references.bib}
@book{ref,
author = {Donald E. Knuth},
title = {The TeXbook},
publisher = {Addison-Wesley},
year = {1986}
}
\end{filecontents*}
\begin{document}
\begin{tabular}{llll}
& cite & \cite[p.\,1]{ref} & \cite{ref} \\
& citeNP & \citeNP[p.\,1]{ref} & \citeNP{ref} \\
& citeA & \citeA[p.\,1]{ref} & \citeA{ref} \\
& citeANP & \citeANP[p.\,1]{ref} & \citeANP{ref} \\
$\rightarrow$ & citeN & \citeN[p.\,1]{ref} & \citeN{ref} \\
& shortcite & \shortcite[p.\,1]{ref} & \shortcite{ref} \\
& shortciteNP & \shortciteNP[p.\,1]{ref} & \shortciteNP{ref} \\
& shortciteA & \shortciteA[p.\,1]{ref} & \shortciteA{ref} \\
& shortciteANP & \shortciteANP[p.\,1]{ref} & \shortciteANP{ref}\\
$\rightarrow$ & shortciteN & \shortciteN[p.\,1]{ref} & \shortciteN{ref} \\
& citeyear & \citeyear[p.\,1]{ref} & \citeyear{ref} \\
& citeyearNP & \citeyearNP[p.\,1]{ref} & \citeyearNP{ref} \\
\end{tabular}
\bibliographystyle{chicago}
\bibliography{references}
\end{document}
*Changing citeN
and shortciteN
to not apply hyperlink formatting to their optional parameter is not an option. It would lead to the rather unpleasant result that while the parentheses are hyperlinks (which they should be, for the sake of consistency with each command's version without optional page parameter), something inside the parentheses, namely the optional parameter, is not a hyperlink.
Best Answer
First of all I want to recommend to avoid the old package
chicago
instead usebiblatex
The package
hyperref
has a small support for the packagechicago
. It redefines some internal commands ofchicago.sty
to get the correct hyperlink. The internal definition is:Based on this modification I took the original definition of
\citeyearNP
and\citeyear
and modified them after the scheme ofhyperref
:The original definition of
chicago.sty
:Modified version:
With this redefinition you will get:
Here the complete code. Of course the other cite commands must be redefined too. But I think that it can be done easily by you.