[Tex/LaTex] Biblatex and listings incompatibility…

biblatexlistingslyx

Does someone know why biblatex and listings are incompatible and if there is a way to fix it?

I have a Lyx document and whenever I insert program listings I get errors like:

 al trabajo de \citet{Fernandez2007}.
                                           Más adelante se describe la
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

or like

 \printbibliography\newpage
                             {}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

This happens only when I add the use of package listings.

I am including biblatex like this:

\usepackage[natbib=true,style=alphabetic-verb,sorting=nty,hyperref,backend=bibtex8]{biblatex}

Any help will be very much appreciated.

Bests,

B.

Edit (more details): Since I've been asked an example, I actually don't have one. Because all I have to do is adding:

\usepackage{listings}

to my Latex preamble (I am using Lyx) to get these errors. I have not even inserted source code listings yet.

If I insert a source code listing using Lyx menu I will have the same problem since Lyx currently uses listings package and it will automatically insert listings package in the preamble.

This is really strange, because I don't see why when I insert listings that would undefine \citet or other commands. I just upgraded from Lyx 1.6.8 to Lyx 2.0.0 to see if this fixed something, but no. I also updated the MikTex packages but it does not fix anything.

Best Answer

This minimal example, following your description, shows that it can be compiled without that error message complaining about \citet being undefined:

\documentclass{article}
\usepackage[natbib=true,style=alphabetic-verb,sorting=nty,hyperref,backend=bibtex8]{biblatex}
\begin{document}
al trabajo de \citet{Fernandez2007}.
\end{document}

However, I can confirm, that the error

! Undefined control sequence.
l.4 al trabajo de \citet
                        {Fernandez2007}.

would occur if no options to biblatex are used, i.e. if I just write \usepackage{biblatex}. This doesn't depend on the listings package.

Related Question