# Why do I get “! Undefined control sequence” in bbl from very simple example?

I am getting a very unexpected error message from a simple bibliography example.

I have a .tex and a .bib files:

test.tex:

\documentclass[letterpaper]{article}

\begin{document}

This is a citation: \cite{pearl88probabilistic}.

\bibliographystyle{named}
\bibliography{b}
\end{document}


b.bib:

@BOOK{pearl88probabilistic,
AUTHOR = {J. Pearl},
YEAR = {1988},
title = {Probabilistic reasoning in intelligent systems: networks of plausible inference},
PUBLISHER = {Morgan Kaufmann, San Mateo (Calif.)},
}


Then I run (using MikTeX 2.9 on Windows):

pdflatex test
bibtex test
pdflatex test


and get an error:

("C:\dir\test.bbl"
! Undefined control sequence.
<argument> \protect \citeauthoryear
{Pearl}{1988}
l.3 ...horyear{Pearl}{1988}]{pearl88probabilistic}


Using latex instead of pdflatex, or using a different bibtex entry, produces the same error.

Here's the offending line in test.bbl:

\bibitem[\protect\citeauthoryear{Pearl}{1988}]{pearl88probabilistic}


Why am I getting this error message, given that the .tex and .bib inputs seem fine?

Here's the full (but cleaned up) trace of what I did (I replaced my user's directory by "dir"):

C:\dir>pdflatex test
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
entering extended mode

LaTeX2e <2011/06/27>
Babel <v3.8m> (...)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"))
No file test.aux.

LaTeX Warning: Citation pearl88probabilistic' on page 1 undefined on input lin
e 6.

No file test.bbl.
[1{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}]
("C:\dir\test.aux")

LaTeX Warning: There were undefined references.

)<C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmbx10.pfb>
<C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 22197 bytes).
Transcript written on test.log.

C:\dir>bibtex test
This is BibTeX, Version 0.99d (MiKTeX 2.9)
The top-level auxiliary file: test.aux
The style file: named.bst
Database file #1: bib.bib

C:\dir>pdflatex test
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
entering extended mode

("C:\dir\test.tex"
LaTeX2e <2011/06/27>
Babel <v3.8m> (...)("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"))
("C:\dir\test.aux")

LaTeX Warning: Citation pearl88probabilistic' on page 1 undefined on input lin
e 6.

("C:\dir\test.bbl"
! Undefined control sequence.
<argument> \protect \citeauthoryear
{Pearl}{1988}
l.3 ...horyear{Pearl}{1988}]{pearl88probabilistic}

• Seems to be an issue with the named biblio style. Try the solution from here: tex.stackexchange.com/a/106875/117534 – Troy Mar 29 '17 at 1:35
• Why not consider using the natbib package instead? Also, welcome to TeX.SE! – Troy Mar 29 '17 at 1:36
• Thanks! Other styles produce the same error, but I will look into those solutions. – user118967 Mar 29 '17 at 1:49
• Ok, I checked and this is not because of named. I will look into natbib, but I would love to understand why this error is happening in such a simple example. – user118967 Mar 29 '17 at 2:11
• It absolutely is because of named. The style itself says you need to define commands like \citeauthoryear in order to use it. – jon Mar 29 '17 at 2:16

The hint is found in named.bst, which contains near the top of the file:

% The LaTeX style has to have the following (or similar)
%     \let\@internalcite\cite
%     \def\cite{\def\citeauthoryear##1##2{##1, ##2}\@internalcite}
%     \def\shortcite{\def\citeauthoryear##1{##2}\@internalcite}
%     \def\@biblabel#1{\def\citeauthoryear##1##2{##1, ##2}[#1]\hfill}
% which makes \shortcite the macro for short citations.


\documentclass[letterpaper]{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
%
@BOOK{pearl88probabilistic,
AUTHOR = {J. Pearl},
YEAR = {1988},
title = {Probabilistic reasoning in intelligent systems: networks of plausible inference},
PUBLISHER = {Morgan Kaufmann, San Mateo (Calif.)},
}
\end{filecontents*}

\makeatletter
\let\@internalcite\cite
\def\cite{\def\citeauthoryear##1##2{##1, ##2}\@internalcite}
\def\shortcite{\def\citeauthoryear##1{##2}\@internalcite}
\def\@biblabel#1{\def\citeauthoryear##1##2{##1, ##2}[#1]\hfill}
\makeatother

\begin{document}

This is a citation: \cite{pearl88probabilistic}.

\bibliographystyle{named}
\bibliography{\jobname}
\end{document}


If I don't follow the advice, I get your error. If I define the commands as suggested, I do not.

• Note also that the header of named.bst, which references LaTeX 2.09(!!) also states There are undoubtably bugs in this style. I'd be inclined to find something a little more modern to use if creating a new project in 2017.... – jon Mar 29 '17 at 2:22
• Thanks. The reason I thought 'named' was not the problem is that there was a second problem with another package that generated problems even with plain and alpha. By "more modern", what do you mean? natlib? – user118967 Mar 29 '17 at 4:19
• Yes, natbib or biblatex are the two most popular LaTeX packages for bibliographies, which means, among other things, people will have experience debugging them if need be and have an interest in doing so. But nearly every package or bst will be more modern than one designed for LaTeX 2.09. – jon Mar 29 '17 at 4:31
• Sad but true, embedding the bibliography inside the .tex solves this problem. – Avio Feb 7 '18 at 13:50

In line with @Troy's suggestion, something like this?

\documentclass[letterpaper]{article}

\usepackage{natbib}
\bibliographystyle{named}

\begin{document}

This is a citation: \citet{pearl88probabilistic}.

\bibliography{b}
\end{document}

• \usepackage{natbib} \bibliographystyle{named} – Md Amiruzzaman Feb 13 at 2:43