2

I have some bibliography entries whose titles contain underscores, which I am entering as \textunderscore. These compile fine when using plain BibTeX, or when using Biblatex and BibTeX as the backend, but not when using Biblatex with Biber as the backend:

\documentclass{article}
\usepackage[
  %backend=bibtex, % this works
  backend=biber,  % this doesn't
]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{pramanick2017jucsenlp,
  author       = {Aniket Pramanick and Dipankar Das},
  title        = {{JU}{\textunderscore}{CSE}{\textunderscore}{NLP} at
                  {SemEval}-2017 {Task} 7: Employing Rules to Detect and
                  Interpret {English} Puns},
  booktitle    = {Proceedings of the 11th International Workshop on Semantic
                  Evaluation (SemEval-2017)},
  year         = {2017},
}
\end{filecontents}

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

Result of running pdflatex:

! Missing $ inserted.
<inserted text> 
                $
l.23 \end
         {document}

Am I doing something wrong or is this a bug in Biblatex and/or Biber? I am using TeX Live 2017 with Biblatex 3.7 and Biber 2.7.

4
  • I would count this as a bug. As a work-around you can use e.g. \bibunderscore in the bib or some other name that biber doesn't know and then in the document \let\bibunderscore\textunderscore. Aug 16, 2017 at 9:32
  • 1
    Biber's Unicode converter turns \textunderscore into _. And that comes out problematic. You can complain at github.com/plk/biber/issues
    – moewe
    Aug 16, 2017 at 10:18
  • @moewe Done: github.com/plk/biber/issues/180
    – Psychonaut
    Aug 16, 2017 at 11:27
  • 2
    Fixed in biber 2.8 DEV.
    – PLK
    Aug 16, 2017 at 13:17

2 Answers 2

0

You can also enter inline math mode and use:

title        = {{JU}{${\_}$}{CSE}{${\_}$}{NLP} at
0

If I can take the liberty of turning the comments by Ulrike Fischer, moewe, and PLK into an answer, the behaviour reported in my question was a bug (or at least a questionable design decision) in Biber. It has now been fixed in the development version. It is likely that future stable releases of Biber will gracefully handle instances of \textunderscore in bibliography entries.

For those stuck with a misbehaving version of Biber, the problem can be worked around in various ways:

  1. In the .tex document, define a macro that expands to \textunderscore, and then use that macro instead of \textunderscore in the .bib file.

  2. In the .tex document, \include the underscore package. Then in the .bib file, use _ instead of \textunderscore.

  3. In the .bib file, use $\_$ instead of \textunderscore. (This has the disadvantage of switching to your math font, though it's unlikely that the underscore looks significantly different in it.)

  4. Use BibTeX instead of Biber. (This is the only option that doesn't require changing your .bib file. However, it will work only if the file uses BibTeX-compatible syntax, and if your use of Biblatex doesn't rely on Biber-specific features.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .