## LaTeX forum ⇒ General ⇒ BibTeX & "undefined control sequence"

LaTeX specific issues not fitting into one of the other forums of this category.
meklenborg
Posts: 18
Joined: Tue Mar 20, 2007 7:42 pm

### BibTeX & "undefined control sequence"

Hi

I've been working with LaTeX since January, so I'm pretty new to this. I've been trying to create a .bib file and make it work with my .tex document. I've basically copied all the procedures, so I believe the input to be right. Even so, it comes out incorrectly. I run LaTeX, BibTeX, and then LaTeX twice. Sometimes I get the error message that it is an udefined control sequence, other times I get the DVI file with my references as ?. I'm not able to see the pattern in these two responses, and in any case, it is no good having references typed out as question marks. I use the stylesheet Chicago. Anyone who knows what I'm doing wrong?

Chrsitine

pumpkinegan
Posts: 91
Joined: Thu May 03, 2007 10:29 pm
If the tex and bib files are setup correctly, then running LaTeX followed by BibTeX will produce a bbl file (in the same directory as the tex and bib files). It is from the bbl file that LaTeX will insert the references into the document.

Open the bbl file with a text editor. If it looks meaningful, then compiling the document again with LaTeX should give a dvi with references. If the bbl file contains nonsense (or is not created at all), then we will have to try other things.

Patrick.

otoomet
Posts: 15
Joined: Sun Apr 01, 2007 9:39 am
How does your document look like? How does your bib-file look like? Which program exactly gives error messages -- latex or bibtex? Bibtex errors are usually easy to track down.

meklenborg
Posts: 18
Joined: Tue Mar 20, 2007 7:42 pm
When I open the bib-file, this is what I get (I've narrowed it down to one reference in order to try and solve the problem):

\begin{thebibliography}{}

\newblock Paris: Colin.

\end{thebibliography}

I get the error message from Latex. This reads:

LaTeX Warning: Citation 'a' on page 1 undefined on input line 17.

<bibtest.bbl
! undefined control sequence.
<argument> \protect \citeauthoryear

I should perhaps add that my LaTeX babel is tuned at French.

Does this at all make any sense?

Christine

pumpkinegan
Posts: 91
Joined: Thu May 03, 2007 10:29 pm
It appears that you have put bbl material in the bib file. Hence using BibTeX is not appropriate.

I would recommend having a look at the attachment. There is a tex file with some text and an article and a book have been referenced using the \cite command with the reference label. At the end of the tex file, there is the reference section:
\bibliographystyle{chicago}
\bibliography{SampleBib}
The first command selects the Chicago bibliography style (which uses chicago.bst). The second command directs chicago.bst to the bib file SampleBib. Note how a bib file should be formatted (with the @article and @book)

First compile the document with LaTeX. Then running BibTeX will generate a bbl file in the style of chicago.bst. Now compile with LaTeX. This should fix the problem. (Note: you will need French babel for your document.)

Patrick.
Attachments
SampleBibTeX.zip

meklenborg
Posts: 18
Joined: Tue Mar 20, 2007 7:42 pm
I really don't understand what is wrong. I get exactly the same error report with your files as with mine. As far as I can see, they are tagged in the same way. Thank you so much for trying to help me, though.

Could it be a problem related to the fact that I use WinEdt?

C

pumpkinegan
Posts: 91
Joined: Thu May 03, 2007 10:29 pm
I have had no success with chicago.bst either. The problem is not related to WinEdt, and I suspect it is more a fault of chicago.bst (which I have not used before).

Would you consider the natbib package and plainnat.bst as an alternative? From my previous post, just replace:
\bibliographystyle{plainnat}
\bibliography{SampleBib}

You should see something like the attached dvi.

Patrick.
Attachments
SampleArticle_DVI.zip

meklenborg
Posts: 18
Joined: Tue Mar 20, 2007 7:42 pm
I really appreciate you trying to help me, and I'm really sorry to say that this didn't work either. That is, there is no error message from LaTeX (which is an improvement), but I don't get any list, and all I get at the insertion points is question marks.

Could it be I lack some of the programs needed? I have WinEdt (thus LaTeX), MikTeX and Ghostscript - but not Ghostview nor WMF2EPS.

Christine
(still quite eager to make it work)

pumpkinegan
Posts: 91
Joined: Thu May 03, 2007 10:29 pm
When you open the sample article tex file with WinEdt, it is advisable to set it as the main file (there should be an icon with a small green cross on the WinEdt interface). Sometimes BibTeX will not find the file to BibTeX unless WinEdt has a main file set.

After doing this, compile with LaTeX. Then run BibTeX. A bbl file should be generated. Open the bbl file, and it should contain:

\begin{thebibliography}{2}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}[1]{\texttt{#1}}
\expandafter\ifx\csname urlstyle\endcsname\relax
\providecommand{\doi}[1]{doi: #1}\else
\providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi

\bibitem[{Surname}(2007{\natexlab{a}})]{article_label}
Firstname~I. {Surname}.
\newblock Title of article.
\newblock \emph{Journal of Publication}, 1:\penalty0 1--2, May
2007{\natexlab{a}}.

\bibitem[{Surname}(2007{\natexlab{b}})]{book_label}
Firstname~I. {Surname}.
\newblock \emph{Title of Book}.
\newblock Publishing House, Address of Publishing House, 1 edition,
2007{\natexlab{b}}.

\end{thebibliography}

The fact that you are not getting an error, but just getting question marks at the \cite points suggests that the bbl file is not right. Is there a bbl file?
Now compile with LaTeX, and then compile again. The dvi should look like my previous post.

Patrick.

Notes:
1. WinEdt is just a nice text editor. MiKTeX is your flavor of LaTeX.
2. If you compile with texify.exe (instead of latex.exe) BibTeX will be run automatically, and the resulting dvi will open in YAP. WinEdt has a TeXify icon beside the LaTeX icon (the brownish lion).
Last edited by pumpkinegan on Mon May 14, 2007 10:33 pm, edited 1 time in total.

meklenborg
Posts: 18
Joined: Tue Mar 20, 2007 7:42 pm
Thank you!

Setting it as the main document really helped, but I'm still unable to change the bibliography settings. It works with {plain}, but the other packages seem to produce error codes. I load them through MikTeX, but that doesn't help. As far as I've understood this, I don't have to define the packages in the preamble?

C