Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In a document written in a given language (in my case French but it may not matter so much) I have a bibliography mixing entries in different languages (in this case French, English and German). I would like to get the punctuation (basically quotation marks and spacing before double punctuation or question marks) right for each entry.

In this simple example:

\documentclass{article}

\usepackage[british,french]{babel}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{A2012,
author = {Author, A},
title = {A ``paper'': written in english?},
journal = {Journal},
year = {2012},
volume = {2},
pages = {70--76},
}
@article{B2012,
author = {Auteur, B},
title = {Un \og article\fg : \'ecrit en fran\c{c}ais ?},
journal = {Journal},
year = {2012},
volume = {2},
pages = {77--79},
}
\end{filecontents}

\begin{document}

\cite{A2012}, \cite{B2012}

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

I obtain

enter image description here

babel has added spacing before the colon and question mark for the english entry. One way to avoid that is to add \NoAutoSpaceBeforeFDP in the preamble. But then the space before the colon is eaten up by babel also in the french entry. I can make sure this does not happen by putting manually an unbreakable space in the bibliographic entry. However, this seems like an inconvenient hack to me.

Is there a systematic way to make sure that the spacing is correct in each entry? (and if possible, to obtain the correct quotation marks without entering them manually as I have done in the example?)

share|improve this question

3 Answers 3

up vote 13 down vote accepted

This is yet another reason to switch to biblatex (here: in combination with csquotes). (And with biblatex-trad there's even a trad-plain style!)

\documentclass{article}

\usepackage[british,french]{babel}
\usepackage[french=guillemets]{csquotes}
\usepackage[style=trad-plain,babel=other]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{A2012,
hyphenation = {british},
author = {Author, A},
title = {A \enquote{paper}: written in english?},
journal = {Journal},
year = {2012},
volume = {2},
pages = {70--76},
}
@article{B2012,
hyphenation = {french},
author = {Auteur, B},
title = {Un \enquote{article}: \'ecrit en fran\c{c}ais?},
journal = {Journal},
year = {2012},
volume = {2},
pages = {77--79},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{A2012}, \cite{B2012}

\printbibliography

\end{document}

enter image description here

share|improve this answer
    
Very nice, I would go for that if it were not for the custom .bst I'm using in this case... –  Corentin Nov 8 '12 at 17:04

use

title = {\foreignlanguage{british}{A ``paper'': written in english?}},

enter image description here

is only a problem if you have an author-title style.

share|improve this answer
3  
With \otherlanguage all following entries in the bibliography will inherit the british language. So it's wrong; the correct command to use is \foreignlanguage –  egreg Nov 6 '12 at 16:01
1  
sigh ... I suppose I will mismatch these two macros for at least the next ten years ... –  Herbert Nov 6 '12 at 16:12
1  
It's easy: otherlanguage is an environment! –  egreg Nov 6 '12 at 16:14

A possible strategy is to use babelbib. However the standard babplain style has a glitch regarding colons, which however also shows with plain in your example: the colon following the volume number is spaced and it shouldn't be.

\documentclass{article}

\usepackage[british,french]{babel}
\usepackage{babelbib}
\renewcommand{\btxauthorcolon}{,}
\providecommand{\btxvolumecolon}{\string:}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{A2012,
author = {Author, A},
title = {A ``paper'': written in english?},
journal = {Journal},
year = {2012},
volume = {2},
pages = {70--76},
language={british},
}
@article{B2012,
author = {Auteur, B},
title = {Un \og article\fg: \'ecrit en fran\c{c}ais ?},
journal = {Journal},
year = {2012},
volume = {2},
pages = {77--79},
language={french},
}
@article{C2012,
author = {Zuteur, B},
title = {Un \og article\fg: \'ecrit en fran\c{c}ais ?},
journal = {Journal},
year = {2012},
volume = {2},
pages = {77--79},
language={french},
}
\end{filecontents}

\begin{document}

\cite{A2012}, \cite{B2012}, \cite{C2012}

\bibliographystyle{mybabplain}
\bibliography{\jobname}

\end{document}

The file mybabplain.bst is just the same as babplain.bst, with a single change: the function format.vol.num.pages (lines 631–650) should be changed to

FUNCTION {format.vol.num.pages}
{ volume field.or.null
  number empty$
    'skip$
    { "(" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        { "\btxvolumecolon {}" * pages n.dashify * }
      if$
    }
  if$
}

The change is just \btxvolumecolon {} to replace :. In the document preamble I've provided a default definition for \btxvolumecolon.

enter image description here

share|improve this answer
    
This is an interesting solution, however, it only works with the babelbib bibliography styles if I understood correctly. In this precise case, I have a custom .bst (in which I have no volume colon by the way) although I chose plain.bst for the example. I'll have a look to see if it is difficult to merge my custom .bst with a babelbib style. –  Corentin Nov 8 '12 at 17:02
    
@Corentin I believe that makebst can output babelbib compatible .bst files. –  egreg Nov 8 '12 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.