# Using .bib files for bibliographies

When using references in my document, I'm used to having a central .bib file from which I pull all my references (using \bibliography{path/to/bibfile}) and then let the journal's .bst file do the formatting. When I'm ready to send it to the publishers, I'll manually paste in the contents of the .bbl file, which is now also styled correctly.

This has served me well so far. Now, one journal's style files forces bibliographies to be entered only between \begin{thebibliography}...\end{...}. If I do what I have been doing previously, I get the error:

Something's wrong--perhaps a missing \item


and this is the output in the .bbl file:

\begin{thebibliography}{0}
\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi

\end{thebibliography}


What's going on here? Is there some option I can avail of to get back to my old behavior?

Here's an MWE (or non-MWE):

### 1: .tex file

\documentclass{gji}
\begin{document}
Lorem Ipsum \cite{test}
\bibliographystyle{gji}
\bibliography{test}
\end{document}


### 2: .bib file

@article{test,
author  = {F. Bar},
title   = {Lorem Ipsum},
journal = {J. Dolor Sit Am.},
volume  = {1},
pages   = {1--10},
year    = {2012},
}


Use the .cls and .bst files from the link above. My standard compilation routine is pdflatex-bibtex-pdflatex-pdflatex

-
The output in the .bbl file is only this much? There are no bibitem entries?! –  Noble P. Abraham Sep 8 '12 at 2:08
@NobleP.Abraham Yes, that's part of the problem... –  user18486 Sep 8 '12 at 2:44
See this from the file gji_extraguide.pdf in the linked zip. For the above examples to function properly, either the gji bibliography style must be used with BibTeX, or the thebibliography environment must be formatted accordingly –  Noble P. Abraham Sep 8 '12 at 2:54
@NobleP.Abraham I've added a minimal example –  user18486 Sep 8 '12 at 2:54
your MWE compiles with no problem for me... –  henrique Sep 20 '12 at 20:51

Use the \cite command to add references.

\documentclass{gji}
\begin{document}
Lorem Ipsum \cite{test}
\bibliographystyle{gji}
\bibliography{test}
\end{document}


In any method of compilation i.e. latex-bibtex-latex-latex-dvips-ps2pdf or pdflatex-bibtex-pdflatex-pdflatex the output is produced.

The resulting .bbl file is here

\begin{thebibliography}{1}
\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi

\bibitem[Bar(2012)]{test}
Bar, F., 2012.
\newblock Lorem ipsum, {\it J. Dolor Sit Am.\/}, {\bf 1}, 1--10.

\end{thebibliography}


If desired output is not obtained, try deleting .log,.blg,.aux,.bbl files before compiling again.

-
uhh... that's in my MWE. This is the same thing. –  user18486 Sep 8 '12 at 3:01
Oh you edited it. Then it should be working, now –  Noble P. Abraham Sep 8 '12 at 3:03
This is the example that doesn't work and gives the error... does it compile for you? –  user18486 Sep 8 '12 at 3:04
@ksr I tried the minimal example in your question with the linked gji.cls and gji.bst and it worked fine. Your empty .bbl looks as if bibtex failed for some reason, so you should check the log-file of bibtex (.blg). –  Ulrike Fischer Sep 8 '12 at 8:23
Ok, I'm accepting this because 2 users have confirmed it works, so the issue must be on my end... I'll poke at it further. Thanks to both for the help :) –  user18486 Sep 8 '12 at 14:28
show 4 more comments