LaTeX: Bibliographies and Citation

Citations are references to books, articles, web pages, or other published items with sufficient details to identify them uniquely. LaTeX makes citing references quite simple, easy and organized that freshmen can have no more excuses for plagiarism. There are two ways for texing the bibliography, either using "thebibliography" environment or using bibtex.

Despite the fact that some people believe this method is easier than using bibtex, it's not. Nevertheless, here we provide an overview of using thebibliography environment, and shortly we provide justifications for prefering the bibtex over this one. Using thebibliography environment is quite simple as shown below. The {10} is the maximum number of items that will come in the list, and for each item the \bibitem command is used providing a unique keyword to be used later on for reference.

\begin{thebibliography}{10} \bibitem{latexGuide} Kopka Helmut, W. Daly Patrick, \emph{Guide to \LaTeX}, $4^{th}$ Edition. Available at \texttt{}. \bibitem{latexMath} Graetzer George, \emph{Math Into \LaTeX}, Birkhäuser Boston; 3 edition (June 22, 2000). \end{thebibliography}

The next step you would like to accomplish is actually citing one of the references on your list. This can be done using the \cite command and providing the corresponding keyword that has already been assigned to the bibitem.

''Luckily, many text editors include the ability to switch end-of-line codes; some even do so automatically''\cite{latexMath}

You might think that thebibliography is the best you have ever dreamed of, actually there's much more that BiBTeX can offer you:

  1. You can write your bibliography in one separate file and reuse it with every LaTeX document. Most probably you have almost the same resources for mutual papers, so why rewrite the bibliography each and every time ?
  2. Manually formatting the list of references is really bad practice, you should follow one consistent citation format (like the MLA format) for all of your references. This is quite easily achieved using BiBTeX which we will explore right on the next page. You might want to use the default formatting, or if you are submitting a paper to a conference, it is as easy as including the style sheet.
  3. BiBTeX is not only to be used with LaTeX, but can also be used to produce HTML output, using bib2xhtml or with a variety of other applications that provide a UI for editing your .bib (Bibliographic Information File) like Jabref
  4. Included too many sources on your list, but did not use them all? This is not a problem with BiBTeX because it only shows the resources which have been referenced using the \cite command, in addition to other resources which have not been explicitly referenced but have been enforced to display using the \nocite command.

On the next couple of pages, we will provide some examples for using BiBTeX. If thebibliography is enough for you and you do not want to go on with the rest of the tutorial, here is thebibliography.tex and thebibliography.pdf

To start using BiBTeX all you need to is:

  1. Show LaTeX your bibliography style sheet(.bst) and your database file (.bib) just before the \end{document}. If you do not have a style sheet, you might ommit the corresponding line, or use \bibliographystyle{plain}.

    Here you can download the sample bibliography style sheets prsty.bst, h-elsevier2.bst and h-physrev3.bst

    \begin{document} .... \bibliographystyle{h-physrev3.bst} \bibliography{foo} \end{document}

  2. Write your database file, for this tutorial we use foo.bib Here's an excerpt from the file.

    @MANUAL{ProvaUserManual, TITLE = "PROVA a Language for Rule-based Java Scripting, Data and Computation Integration, and Agent Programming", AUTHOR = "Alex Kozlenkov", ORGANIZATION = "City University", ADDRESS = "London", NOTE = "User's Guide, Version 1.8", MONTH = "May", YEAR = "2005", }

  3. Write your LaTeX File and use \cite{keyword} to cite a reference from your database file named 'keyword' and \nocite{keyword} to enforce the display of a non-referenced reference named \keyword.

GO: When compiling the document you need to LaTeX the file, then BibTeX it, then LaTeX it twice. When you do this BibTeX finds all the papers you have cited using the \cite{...} command in your LaTeX document and makes an auxiliary file with the extension .bbl which contains the bibliography information the papers cited in your document, and numbers them all in order of appearance.

latex document bibtex document latex document latex document

The bibliographic Information FIle is like a database of your resources, written in a way that is both better readable by humans and easier and better formatted by LaTeX.

Any entry in the .bib file follows more or less the same format as follows:

@<ENTRY TYPE>{<UNIQUE IDENTIFIER FOR THE ENTRY>, .... < a list of comma separated name-value pairs of entry fields> .... }

The entry type can be one of article, book, manual or many others. As previously mentioned, the unique identifier is the keyword that can be used later to reference this specific resource within your document. The list of attributes includes information about the title, author, publisher and almost every other attribute you can think of.

For an almost complete list of entry types and fields, please check the corresponding Wikipedia entry

BiBTeX is an efficient and portable way to handle your references. In a short while you will hopefully have one or more database files that you will be using for all your documents and publications. In addition most of the world-wide conferences would require you to use it to submit your papers, and there are also those online bibliography databases where you find BiBTeX versions of publications and then it's only a matter of copy-paste.

The only thing left to notice is with websites. In quite some cases, websites have such long URLs than makes it difficult to fit on the rest of the line. LaTeX will not break the line for you, it leaves you the freedom to choose where you want to break the address using the \allowbreak command. Any spaces after the command will be discarded, so you can have this <http://www.\allowbreak>

For your own convenience here is the foo.bib and bibliography.pdf.

The next tutorial, will show you how to embed snippets of your code into your documentations in a professional fashion, that makes it more easily referenced and presented.