0

I'm writing about common BibTeX errors. One example is using the unicode – in the pages field, such as:

   Pages          = {790–799},

from this question: How to solve this bibliography error?

I want to use this problem as an exercise in my document ("why doesn't this compile?"), so I would like to ensure the unicode character compiles as a unicode character.

I'm currently using

\documentclass[preview,margin=5cm]{standalone}

\usepackage[utf8]{inputenc}

\begin{document}

\begin{verbatim}
@INPROCEEDINGS{tem_1,
  Author         = {Comelli, P, Ferragina, P, Granieri, M.N, and Stabile, F},
  Title          = {Optical recognition of motor vehicle license plates},
  Year           = {1995},
  Volume         = {44},
  Series         = {4},
  Month          = {November},
  Pages          = {790–799},
  Publisher      = {Vehicular Technology, IEEE Transactions}
}
\end{verbatim}


\end{document}

(fixing the mismatched brackets {4) in the original example), but this compiles to:

enter image description here

I then use \includegraphics{...} to embed this in the main document. But the answer to why doesn't this compile? is not going to be the one I want.

Question: Is it possible to get the unicode – to compile in verbatim mode?

  • 2
    In this case you can use \usepackage[T1]{fontenc}. But in general: if you want unicode, use an unicode engine (xelatex,lualatex) and unicode fonts. – Ulrike Fischer Oct 8 '18 at 10:26
  • Since you are writing about common errors, let me mention another few things on top of the dash and the incorrect name format that have already been mentioned in the linked answer. Of course the details depend on the bibliography style you use, but series = {4}, seems wrong for an @inproceeding. month = {November}, is also normally not a good idea, month = nov, is preferred (if supported by the style; with biblatex date = {1995-11}, would be even better). A @inproceedings should normally have a booktitle. The publisher also looks weird. – moewe Oct 8 '18 at 11:16
  • ieeexplore.ieee.org/document/467963 suggests this should be an @article – moewe Oct 8 '18 at 11:17
2

Remember to add

\usepackage[T1]{fontenc}

then the system makes better assumptions about the chars in the given font.

Or use a unicode aware engine (see Ulrikes comment)

2

You can compare the output:

\documentclass{article}

\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc} % not needed for recent versions of LaTeX

\begin{document}

\begin{verbatim}
@INPROCEEDINGS{tem_1,
  Author         = {Comelli, P, Ferragina, P, Granieri, M.N, and Stabile, F},
  Title          = {Optical recognition of motor vehicle license plates},
  Year           = {1995},
  Volume         = {44},
  Series         = {4},
  Month          = {November},
  Pages          = {790–799},
  Publisher      = {Vehicular Technology, IEEE Transactions}
}
@INPROCEEDINGS{tem_noendash,
  Author         = {Comelli, P, Ferragina, P, Granieri, M.N, and Stabile, F},
  Title          = {Optical recognition of motor vehicle license plates},
  Year           = {1995},
  Volume         = {44},
  Series         = {4},
  Month          = {November},
  Pages          = {790-799},
  Publisher      = {Vehicular Technology, IEEE Transactions}
}
\end{verbatim}

\end{document}

In the second item there is a standard hyphen (U+002D) and the output is exactly the same visually, the only difference is that copying from the top item will give an en-dash (U+2013).

On the other hand the bib file should have a hyphen, for BibTeX doing its work as planned.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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