Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong colon spacing in eprint formatting when using french babel #16

Open
cebamps opened this issue Mar 1, 2017 · 8 comments
Open

Wrong colon spacing in eprint formatting when using french babel #16

cebamps opened this issue Mar 1, 2017 · 8 comments
Assignees
Labels

Comments

@cebamps
Copy link

cebamps commented Mar 1, 2017

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}
@josephwright josephwright self-assigned this Mar 1, 2017
@josephwright
Copy link
Owner

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
Copy link
Owner

josephwright commented Sep 21, 2019

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'.

@moewew
Copy link
Contributor

moewew commented Sep 22, 2019

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.

@josephwright josephwright reopened this Sep 22, 2019
@josephwright
Copy link
Owner

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

@moewew
Copy link
Contributor

moewew commented Sep 22, 2019

Tracked at plk/biblatex#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
Copy link
Contributor

moewew commented Jan 1, 2020

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

@josephwright Given the issues mentioned in plk/biblatex#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.

@josephwright
Copy link
Owner

@moewew Agreed: this needs action 'elsewhere'

@moewew
Copy link
Contributor

moewew commented Jan 2, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants