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

Zdenek Wagner zdenek.wagner at gmail.com
Mon Sep 22 16:16:58 CEST 2014


2014-09-22 16:10 GMT+02:00 Herbert Voss <Herbert.Voss at fu-berlin.de>:
> Am 22.09.2014 um 15:44 schrieb Vincent Lefevre:
>> 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)
>
> ":" is an active chracter in french. Make it inactive before using it:
>
> \selectlanguage{french}\shorthandoff{:}
> \cite{foo:bar} (foo:bar)

If you do this, the colons will not be typeset correctly in the text.
If only \cite needs inactive colon, the following is bette (after
loading all packages)r:

\let\origcite\cite
\def\cite{\begingroup \catcode`\:12 \mycite}
\def\mycite#1{\engroup \origcite{#1}}

This is just a quick hack...
> ...
>
> Herbert
>
>
>>
>> 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.
>>
>



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the tex-live mailing list