[Tex/LaTex] hyperref modifies bibliography style of ACL style files

bibliographieshyperref

I need to use the ACL latex style, and I would like to use the hyperref package, but it changes the way bibliography items look like in the pdf. Minimal Working Example is the following:

Alfred V. Aho and Jeffrey D. Ullman. 1972. The Theory of Parsing, Translation and Compiling, volume 1. Prentice-Hall, Englewood Cliffs, NJ.

  • add line \usepackage{hyperref} in the preamble
  • compile, and see how reference syle changed:

[Aho and Ullman1972] Alfred V. Aho and Jeffrey D. Ullman. 1972. The Theory of Parsing, Translation and Compiling, volume 1. Prentice-Hall, Englewood Cliffs, NJ.

I did not find any option for the hyperref package to prevent this change, any idea is welcome

Thanks,
Max

Best Answer

The problem is that acl2012.sty redefines the internal command \@lbibitem in a way that hyperref is not aware of one. As a result, when hyperref is used, what gets printed is the key of the citation.

One work around is as follows. The hyperref redefinition uses a command \@BIBLABEL which is by standard set to the default \@biblabel via a \providecommand*. This is convenient, since \providecommand* will only make the definition provide the command is not already defined. Thus what we can do is define \@BIBLABEL before hyperref is loaded, to produce an empty text. This is achieved by:

\makeatletter
\newcommand{\@BIBLABEL}{\@emptybiblabel}
\newcommand{\@emptybiblabel}[1]{}
\makeatother
\usepackage{hyperref}

i.e. we set \@BIBLABEL to a command \@emptybiblabel, which in turn just ignores its argument. This code is enclosed between \makeatletter / \makeatother because of the symbol @ in the command names.

Putting this together in a cut-down version of the acl2012.tex sample document gives:

\documentclass[11pt]{article}
\usepackage{acl2012}
\usepackage{times}
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{url}

\makeatletter
\newcommand{\@BIBLABEL}{\@emptybiblabel}
\newcommand{\@emptybiblabel}[1]{}
\makeatother
\usepackage{hyperref}

\begin{document}

{\bf Citations}: Citations within the text appear
in parentheses as~\cite{Gusfield:97} or, if the author's name appears in
the text itself, as Gusfield~\shortcite{Gusfield:97}. Append lowercase letters to the year in cases of ambiguities. Treat double authors as in~\cite{Aho:72}, but write as in~\cite{Chandra:81} when more than two authors are involved. Collapse multiple citations as in~\cite{Gusfield:97,Aho:72}. 

\begin{thebibliography}{}

\bibitem[\protect\citename{Aho and Ullman}1972]{Aho:72}
Alfred~V. Aho and Jeffrey~D. Ullman.
\newblock 1972.
\newblock {\em The Theory of Parsing, Translation and Compiling}, volume~1.
\newblock Prentice-{Hall}, Englewood Cliffs, NJ.

\bibitem[\protect\citename{Chandra \bgroup et al.\egroup }1981]{Chandra:81}
Ashok~K. Chandra, Dexter~C. Kozen, and Larry~J. Stockmeyer.
\newblock 1981.
\newblock Alternation.
\newblock {\em Journal of the Association for Computing Machinery},
  28(1):114--133.

\bibitem[\protect\citename{Gusfield}1997]{Gusfield:97}
Dan Gusfield.
\newblock 1997.
\newblock {\em Algorithms on Strings, Trees and Sequences}.
\newblock Cambridge University Press, Cambridge, UK.

\end{thebibliography}

\end{document}

Sample output

In the pdf the links from the citations still lead to the corresponding citations.

Related Question