plk / biber

Backend processor for BibLaTeX
Artistic License 2.0
339 stars 38 forks source link

Don't convert \textunderscore to _ #180

Closed logological closed 7 years ago

logological commented 7 years ago

Biber converts all instances of \textunderscore in BibTeX fields to _, which causes problems downstream. Example:

\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}

I don't know why Biber does this conversion, but quite possibly it shouldn't. (Plain BibTeX itself doesn't, and so the above document compiles fine with backend=bibtex.)

plk commented 7 years ago

Biber always decodes as many macros as it can into UTF-8 equivalents so that sorting works properly - sometimes this isn't quite right and the whole conversion system is tunable by the user but I think that this perhaps should be a default exception. Fixed in biber DEV 2.8 (you'll need biblatex DEV 3.8 to use this).