biblatex-phys icon indicating copy to clipboard operation
biblatex-phys copied to clipboard

Wrong colon spacing in eprint formatting when using french babel

Open cebamps opened this issue 7 years ago • 8 comments

In biblatex, \addcolon typesets the colon according to the selected babel language. The issue is that the french colon has some spacing prepended to it, which makes eprint formatting look wrong compared to the spaceless version:

french

I believe the lack of \addspace after \addcolon is meant to mimic the usual formatting of arXiv references (as in REVTeX, i.e., arXiv:1234.5678 with no spaces around the colon)? In any case, the spacing ends up making it look like arxiv :1234.5678. In comparison, the default biblatex styles typeset it in a more conventional way using \addcolon\addspace, which looks like arxiv : 1234.5678 in french and arxiv: 1234.5678 in english.

MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[french]{babel}
\usepackage[style=phys,articletitle=false,eprint=true]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{oldstyle,
 author = {Maldacena, J.}, year = 1997,
 archivePrefix = {arXiv},
 eprint = {hep-th/9711200},
}
@article{newstyle,
 author = {Aad, G. and others}, year = 2012,
 archivePrefix = {arXiv},
 primaryClass = {hep-ex},
 eprint = {1207.7214},
}
\end{filecontents}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

cebamps avatar Mar 01 '17 14:03 cebamps

There are two possible solutions here: add a space (as you say) or force a string colon (still an issue with LuaTeX, I guess).

josephwright avatar Mar 01 '17 20:03 josephwright

I've thought about this, and really it's a problem beyond biblatex-phys: the active colon needs to be disabled within the bibliography. Fixing it 'here' would at best be a hack: in particular, LuaLaTeX is a real issue.

@moewew Any thoughts here? I'm not sure what to say here beyond 'French babel set up is a PITA'.

josephwright avatar Sep 21 '19 19:09 josephwright

Actually it's not only babel-french biblatex's french.lbx is actively PITA-ing too

https://github.com/plk/biblatex/blob/e8229b12c5a366f52a3cf0c6a50e5b68745ad267/tex/latex/biblatex/lbx/french.lbx#L43-L56

I don't think the actively/spacey colon should be disabled elsewhere in the bibliography. I assume that for all other uses people would expect the normal French behaviour.

Something like

\documentclass{article}
\usepackage{csquotes}
\usepackage[french]{babel}
\usepackage[style=phys,articletitle=false,eprint=true]{biblatex}

\makeatletter
\DeclareFieldFormat{eprint:arxiv}{%
  \let\FDP@colonspace\empty
  \csuse{NoAutoSpacing}%
  \ifhyperref
    {\href{https://arxiv.org/\abx@arxivpath/#1}{%
        arXiv\addcolon
        \nolinkurl{#1}%
        \iffieldundef{eprintclass}
          {}
          {\addspace\UrlFont{\mkbibbrackets{\thefield{eprintclass}}}}}}
    {arXiv\addcolon
      \nolinkurl{#1}%
      \iffieldundef{eprintclass}
        {}
        {\addspace\UrlFont{\mkbibbrackets{\thefield{eprintclass}}}}}}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
\nocite{baez/article}
\printbibliography
\end{document}

should hopefully work (unless someone other than babel-french defines \NoAutoSpacing).

I guess we could define a \addunspacedcolon (or something like that) in biblatex that automatically does this and could be used by package authors who definitely know that they don't want the French colon behaviour.

moewew avatar Sep 22 '19 13:09 moewew

@moewew Sounds good: something at the core level would 'feel' right

josephwright avatar Sep 22 '19 16:09 josephwright

Tracked at https://github.com/plk/biblatex/issues/925. I'll be busy for the next two weeks, so I will probably forget about this short-term. Comments for the name and implementation issues are highly appreciated.

moewew avatar Sep 22 '19 17:09 moewew

I removed an earlier post which showed \addcolonnonfrench, since I'm not sure about how to proceed.

@josephwright Given the issues mentioned in https://github.com/plk/biblatex/issues/925 (namely that not only French messes with punctuation spacing but other languages might do so as well and that there is no unified interface to turn off the spacing changes) do you still think that this is something that we should try to implement in biblatex? At the moment I tend towards scrapping the idea of implementing an \addcolon that tries to work against the various language modules that might try to influence colon spacing.

moewew avatar Jan 01 '20 14:01 moewew

@moewew Agreed: this needs action 'elsewhere'

josephwright avatar Jan 02 '20 21:01 josephwright

Thanks for the comment. I backed out of \addcolonnonfrench for now.

I realise that this leaves the issue here with no great solution, but an overall approach that works for all languages seems tricky.

moewew avatar Jan 02 '20 21:01 moewew