5

I am using biblatex for the first time. When I do quick compile on the document it compiles no problem, after that I run the BibTeX command and it also works. After that I try a quick compile again in order to generate the pdf with the bibliography but I get these type of errors for all the cited sources on my .bib file:

! Undefined control sequence.
<to be read again> \edef \lbx@tempa {{wen-mei}z
                                               w.hwu}
l.90 \end{document}

This is my main LaTeX file

% El documento está pensado para ser impreso en hojas por ambos lados (twoside)
% openright causa que los capítulos empiecen en hoja impar
\documentclass[12pt,letterpaper,twoside,openright]{report}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc} %Uso de tildes si desarrolla en Linux
\usepackage[backend=bibtex]{biblatex}
\addbibresource{mybib_test.bib}
\usepackage{listings}

\begin{document}

\pagenumbering{arabic}
\include{capitulo_01_test}  % 1. Introducción


% ------------ Comienza la bibliografí­a ---------------
\printbibliography
\end{document}

This is the second tex file the one named capitulo_01_test.tex

\cite{brasnett2007} \cite{chapman2007} \cite{duda1972} \cite{kirk2010} \cite{vanginkel2004}. 

When I delete \usepackage{listings} from my main tex file the problem goes away. But why? and I need the listings package.

This is my bibtex file

% This file was created with JabRef 2.6.
% Encoding: UTF-8

@INPROCEEDINGS{brasnett2007,
    author = {P. Brasnett and M. Z. Bober},
    title = {Robust Visual Identifier Using the Trace Transform},
    booktitle = {Visual Information Engineering Conference (VIE 2007)},
    year = {2007},
    pages = {25-27}
}

@BOOK{chapman2007,
  title = {Using OpenMP: Portable Shared Memory Parallel Programming},
  year = {2007},
  author = { Barbara Chapman and Gabriele Jost and Ruud van van der Pas},
  publisher = "The MIT Press",
  address   = "Massachusetts, Estados Unidos"
}

@ARTICLE{duda1972,
  author = {Richard O. Duda and Peter E. Hart},
  title = {Use of the Hough Transformation to Detect Lines and Curves in Pictures},
  journal = {Communications of the ACM},
  year = {1972},
  volume  = "15",
  number  = "1",
  pages   = "11--15"
}

@BOOK{kirk2010,
  title = {Programming Massively Parallel Processors: A Hands-on Approach},
  year = {2010},
  author = {David B. Kirk and {Wen-mei} W. Hwu},
  publisher = "Morgan Kaufmann",
  address   = "Massachusetts, Estados Unidos"
}

@TECHREPORT{vanginkel2004,
  author = {Michael van Ginkel and Cris L. Luengo Hendriks and Lucas J. van Vliet},
  title = {A short introduction to the Radon and Hough transforms and how they relate to each other},
  institution = {Quantitative Imaging Group, Delft University of Technology},
  year = {2004},
  address  = {Delft, Holanda},
}

I heard it could be the "-" between Wen-mei for example but I changed it several times and it didn't work.

When I was just using bibtex I didn't have this problem.

Note (Edit): I edited the question to follow cfr's suggestion and I figured out that if I delete the \usepackage{listings} part on my main .tex file the compilation has no problem. Any idea why?

  • 1
    Please eliminate unneeded parts of your code to produce a minimal example which produces the problem. This is easy (if a bit tedious) - you just remove bits and see if you still get the error. If not, you put them back. If so, you leave them out. Since you suspect a particular part of your code already, you can try eliminating everything else as a short-cut and see if you still get the error. If not, you have to go back to the long method. If so, you save a lot of time. – cfr Sep 22 '14 at 21:10
  • What does 'Quick Compile' exactly do? Is it 'PdfLaTeX + Bib(la)tex + PdfLaTeX (x2) + View Pdf'? Or do you mean 'F2' or 'F6'? – U.Martinez-Corral Sep 22 '14 at 21:10
  • I edited the question following your suggestion cfr. – Atirag Sep 22 '14 at 21:52
  • @U.Martinez-Corral Quick Compile is configured as PdfLatex + View Pdf. So I do Quick Comiple->Bibtex->Quick Compile(here I get the error)->Quick compile – Atirag Sep 22 '14 at 22:02
8

It's a bug in listings that leaves behind it a wrong \lccode for ~. I couldn't find the reason why the bug appears only when Spanish is the language, but the problem is surely in that bad setting.

You solve your issue by adding

\lccode`~=0

after

\usepackage{listings}

In other words, the preamble should be

\documentclass[12pt,letterpaper,twoside,openright]{report}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc} %Uso de tildes si desarrolla en Linux
\usepackage[backend=bibtex]{biblatex}
\addbibresource{mybib_test.bib}
\usepackage{listings}
\lccode`~=0

The wrong code in listings.sty is the definition of \lst@CCPut

884 \def\lst@CCPut#1#2{%
885     \ifnum#2=\z@
886         \expandafter\@gobbletwo
887     \else
888         \lccode`\~=#2\lccode`\/=#2\lowercase{\lst@CCPut@~{#1/}}%
889     \fi
890     \lst@CCPut#1}

where line 888 should be

\begingroup\lccode`\~=#2\lccode`\/=#2\lowercase{\endgroup\lst@CCPut@~{#1/}}%

There's also another wrong setting left behind by listings that should be corrected; in \lst@RestoreCatcodes the wrong assignment

\lccode`\/=`\/

is performed, which should be removed or countermanded by

\lccode`\/=0

just like the one for ~.

  • Great egreg! Thank you! It worked. Will that affect my ~ symbols inside my document though? – Atirag Sep 22 '14 at 22:14
  • @Atirag No. I suggest also to issue the es-notilde option, after spanish, to babel (I don't think you need to use ~n and ~N, do you?) – egreg Sep 22 '14 at 22:25

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.