Using bibtex

Below is an example that I got from the Bibtex Site.


First create a file called bibtex_example.txt with the following (or download it here):

\documentclass[11pt]{article}
\usepackage{cite}

\begin{document}

\title{My Article}
\author{Nobody Jr.}
\date{Today}
\maketitle

Blablabla said Nobody ~\cite{Nobody06}.

\bibliography{mybib}{}
\bibliographystyle{plain}
\end{document}

Create the bibtex file and call it mybib.bib with the following (or download it here):

@misc{ Nobody06,
       author = "Nobody Jr",
       title = "My Article",
       year = "2006" }

Now run the following commands

latex bibtex_example
bibtex bibtex_example
latex bibtex_example
latex bibtex_example
dvipdf bibtex_example

Yes, you have to run the latex command twice. At the end, you should now have a pdf file.


Here's an example with the output I got.

$ ll
total 16
-rw-r--r--  1 maryh  staff  236 Sep 30 10:08 bibtex_example.tex
-rw-r--r--  1 maryh  staff   97 Sep 30 10:08 mybib.bib

$ latex bibtex_example
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./bibtex_example.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2016/texmf-dist/tex/latex/cite/cite.sty)
No file bibtex_example.aux.

LaTeX Warning: Citation `Nobody06' on page 1 undefined on input line 11.

No file bibtex_example.bbl.
[1] (./bibtex_example.aux)

LaTeX Warning: There were undefined references.

 )
Output written on bibtex_example.dvi (1 page, 468 bytes).
Transcript written on bibtex_example.log.

$ bibtex bibtex_example
This is BibTeX, Version 0.99d (TeX Live 2016)
The top-level auxiliary file: bibtex_example.aux
The style file: plain.bst
Database file #1: mybib.bib

$ latex bibtex_example
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./bibtex_example.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2016/texmf-dist/tex/latex/cite/cite.sty)
(./bibtex_example.aux)

LaTeX Warning: Citation `Nobody06' on page 1 undefined on input line 11.

(./bibtex_example.bbl) [1] (./bibtex_example.aux)

LaTeX Warning: There were undefined references.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

 )
Output written on bibtex_example.dvi (1 page, 592 bytes).
Transcript written on bibtex_example.log.

$ latex bibtex_example
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./bibtex_example.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2016/texmf-dist/tex/latex/cite/cite.sty)
(./bibtex_example.aux) (./bibtex_example.bbl) [1] (./bibtex_example.aux) )
Output written on bibtex_example.dvi (1 page, 548 bytes).
Transcript written on bibtex_example.log.

$ ll
total 56
-rw-r--r--  1 maryh  staff    83 Sep 30 14:39 bibtex_example.aux
-rw-r--r--  1 maryh  staff   109 Sep 30 14:39 bibtex_example.bbl
-rw-r--r--  1 maryh  staff   860 Sep 30 14:39 bibtex_example.blg
-rw-r--r--  1 maryh  staff   548 Sep 30 14:39 bibtex_example.dvi
-rw-r--r--  1 maryh  staff  2599 Sep 30 14:39 bibtex_example.log
-rw-r--r--  1 maryh  staff   236 Sep 30 10:08 bibtex_example.tex
-rw-r--r--  1 maryh  staff    97 Sep 30 10:08 mybib.bib

Last step is to create a pdf file from the dvi file.

$ dvipdf bibtex_example
$ ll
total 80
-rw-r--r--  1 maryh  staff     83 Sep 30 14:39 bibtex_example.aux
-rw-r--r--  1 maryh  staff    109 Sep 30 14:39 bibtex_example.bbl
-rw-r--r--  1 maryh  staff    860 Sep 30 14:39 bibtex_example.blg
-rw-r--r--  1 maryh  staff    548 Sep 30 14:39 bibtex_example.dvi
-rw-r--r--  1 maryh  staff   2599 Sep 30 14:39 bibtex_example.log
-rw-r--r--  1 maryh  staff  12019 Sep 30 14:40 bibtex_example.pdf
-rw-r--r--  1 maryh  staff    236 Sep 30 10:08 bibtex_example.tex
-rw-r--r--  1 maryh  staff     97 Sep 30 10:08 mybib.bib

Open the pdf file and see how it looks.

My latex and bibtex commands are located in:

~ $ which latex
/Library/TeX/texbin/latex
~ $ which bibtex
/Library/TeX/texbin/bibtex
Mary Heintz
Updated: September 2016