[tex-live] clash between babel (french), hyperref and \cite on keys with a colon character

jfbu jfbu at free.fr
Mon Sep 22 17:07:03 CEST 2014

The bug is, I think, more in hyperref. There is a Babel mechanism for labels and references to work, independently of whether the character is a shorthand or not.

References to bib items are correctly generated, but the hyperlinks fail. Here is a patch which appears to fix it.

Warning: this is just a shot in the dark; perhaps this patch is wrong and generate bad things in other contexts. An hyperref expert would be required here.




\patchcmd {\hyper at link@}{\edef \Hy at tempb {#3}}
             {\Hy at safe@activestrue\edef \Hy at tempb {#3}%
              \Hy at safe@activesfalse}{}{}%




\cite{foo:bar} (foo:bar), \cite{bar:foo} (bar:foo)


The following  references work:
 (although : is active, catcode=\the\catcode`\:):

\cite{foo:bar} (foo:bar), \cite{bar:foo} (bar:foo)

\bibitem{foo:bar} Foo bar.
\bibitem{bar:foo} Bar foo.


Le 22 sept. 2014 à 15:44, Vincent Lefevre <vincent at vinc17.net> a écrit :

> There's a clash between babel (french), hyperref and \cite on keys
> with a colon character. This can be seen on:
> ----------------------------------------------------------------------
> \documentclass{article}
> \usepackage[french,english]{babel}
> \usepackage{hyperref}
> \begin{document}
> The following link does not work due to the space before the colon,
> added by babel in French:
> \selectlanguage{french}
> \cite{foo:bar} (foo:bar)
> The following link works:
> \selectlanguage{english}
> \cite{foo:bar} (foo:bar)
> \newpage
> \selectlanguage{english}
> \begin{thebibliography}{1}
> \bibitem{foo:bar} Foo bar.
> \end{thebibliography}
> \end{document}
> ----------------------------------------------------------------------
> This should really be fixed without requiring the user to use some
> workaround. For instance, couldn't babel redefine \cite to locally
> make the behavior like in English?
> This bug is particularly annoying since using colons in bib keys
> seems to be common.
> -- 
> Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the tex-live mailing list