4

I've got several .bib entries like this:

@article{Guinet:Torp,
  author={Louis Guinet},
  title={Les toponymes normands \guillemotleft Torp(s)\guillemotright, \guillemotleft Torpt\guillemotright, \guillemotleft Tourp(s)\guillemotright, \guillemotleft Tour(s)\guillemotright},
  journal={Annales de Normandie},
  volume=30,
  number=2,
  pages="193--197",
  year=1980,
}

but biblatex (or maybe biber) converts them to math mode in the .bbl file:

      \field{title}{{Les toponymes normands {$\guillemotleft$}Torp(s){$\guillemotright$}, {$\guillemotleft$}Torpt{$\guillemotright$}, {$\guillemotleft$}Tourp(s){$\guillemotright$}, {$\guillemotleft$}Tour(s){$\guillemotright$}}}

This is invalid and results in the wrong characters coming out. How do I fix this?

MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[backend=biber]{biblatex}
\bibliography{place_names}
\begin{document}
\cite{Guinet:Torp}
\printbibliography
\end{document}

which gives:

LaTeX Warning: Command \guillemotleft invalid in math mode on input line 7. LaTeX Warning: Command \guillemotright invalid in math mode on input line 7. ! Undefined control sequence. ...{$\guillemotright $}, \guillemotlef \t {T}orpt{$\guillemotrigh...

It used to work on earlier versions of TexLive (I am now using what comes with Ubuntu 16).

KeithB
  • 451
  • 1
    Can you show us a full MWE? The conversion depends on the encoding as well as inputenc. – moewe Jul 22 '17 at 10:25
  • I will file a bug report over at the Biber bugtracker. For the time being try and use inputenc, e.g. \usepackage[utf8]{inputenc}. (Make sure your file is encoded in UTF-8.) – moewe Jul 22 '17 at 10:38
  • Thanks - which file has to be utf8? (I've got lots of very large legacy .bib files, and I cannot change them.) – KeithB Jul 22 '17 at 10:40
  • The .tex file should be enough, if your files are ASCII anyway that is fully compatible with UTF-8. So you can say they are UTF-8 without changing anything. If you have non-ASCII chars, more care is needed. – moewe Jul 22 '17 at 10:40
  • See https://github.com/plk/biber/issues/175 – moewe Jul 22 '17 at 10:41
  • The use of \usepackage[utf8]{inputenc} fixes my MWE, but not the real case. I have characters like "{=\i}" (i with macron) in my .bib file, and these give errors like: ! Package inputenc Error: Unicode char ̄ (U+304) (inputenc) not set up for use with LaTeX. – KeithB Jul 22 '17 at 11:04
  • Yes, that is a problem, Biber does not translate {\=\i} (in fact any combinations with \i) very well. – moewe Jul 22 '17 at 11:15
  • You may be able to fix the \i with a variant of PLK's answer to https://tex.stackexchange.com/q/251261/35864 – moewe Jul 22 '17 at 11:18
  • It looks like biber --output-safechars fixes the =\i problem, but brings back the \guillemot problem. So I can have one working or the other, but not both. I will try =i. – KeithB Jul 22 '17 at 11:37
  • Yes it will, you will have to use a variant of the mapping in PLK's answer. You could search for {\=\i} and replace it by ī, then things would work out OK. – moewe Jul 22 '17 at 11:41

2 Answers2

3

PLK has fixed the issue (https://github.com/plk/biber/issues/175) in the development version Biber 2.8. \guillemots are not converted into math mode any more.

Another possible fix is to use UTF-8 encoding where the guillemots are converted into their respective Unicode chars.

\documentclass{article}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage[style=authoryear]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Guinet:Torp,
  author={Louis Guinet},
  title={Les toponymes normands \guillemotleft Torp(s)\guillemotright, \guillemotleft Torpt\guillemotright, \guillemotleft Tourp(s)\guillemotright, \guillemotleft Tour(s)\guillemotright},
  journal={Annales de Normandie},
  volume=30,
  number=2,
  pages="193--197",
  year=1980,
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
Les toponymes normands \guillemotleft Torp(s)\guillemotright, \guillemotleft Torpt\guillemotright, \guillemotleft Tourp(s)\guillemotright, \guillemotleft Tour(s)\guillemotright

\cite{Guinet:Torp}
\printbibliography
\end{document}

But we established in the comments that that causes trouble with your īs, see Input encoding error after upgrading from Biber 1.9 to Biber 2.1.

You can fix the ī issue with

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite]{
      \step[fieldsource=title,
            match=\regexp{\x{0131}\x{0304}},
            replace=\regexp{ī}]
    }
  }
}
moewe
  • 175,683
0

These work correctly even in the mode of mathematics with even Version 2.7 (beta) of Biber:

\usepackage{csquotes}

followed by

\flqq

instead of \guillemotleft

and

\frqq

instead of \guillemotright

moewe
  • 175,683