LATEX and BIBTEX by Example

Terry Sergeant1

A postscript version of this manual is available.



This manual provides some introductory information about how to use LATEX and BIBTEX. It is assumed that the user of this manual has access to a LATEX ``compiler'' and knows how to create files with a text editor.

The manual has three main parts: An introduction, a discussion of major themes, and some supplementary concepts. The introduction provides an overview of LATEX, gives a list of other resources, and ends with a classical ``Hello World'' document.

Part III discusses a number of environments and concepts that I use on a regular basis. I unapologetically have omitted many details in favor of providing the ``big picture''.

The supplements discussed in part III gives hints on spell-checking LATEX documents and explains how LATEX is useful in handling large documents. It also discusses how to generate bibliographies using BIBTEX and a method for putting LATEX documents on the web.

Please feel free to contact me if you have errors to report or other questions. For additional resources you can refer to section 2 entitled Other Resources. For a short list of web pages and books.


What and Why

LATEX is typesetting software that provides high quality output. It is especially well-suited for those who write technical articles and/or those who need to use mathematical notation in writing. As discussed in section 8, LATEX is also well suited for creating and handling large documents.

All LATEXdocuments are simple text files that contain commands and text. The commands tell LATEX how to render your writing. These facts have several consequences:

A natural question at this point in the discussion would be ``Why would someone, in this modern era, use a non-WYSIWYG type-setting system? Especially one that requires you compile (and debug) your document before you can see what it is going to look like?'' If you happen to be one of my students the question is answer simply: ``Because I said you have to use it.'' For anyone else reading this document, let me outline some strengths of LATEX:

Other Resources

Anyone who is serious about wanting to use LATEX on a regular basis will find this document woefully inadequate. There are numerous books and websites that contain information beyond the scope of this short introduction.


There is no shortage of books on the topic and certainly you might want to consider browsing around an on-line store like to see a variety of books. However, if you are going to have only one book on LATEX I would recommend without reservation the official User's Guide written by Lamport:
Lamport, Leslie, LATEX: A Document Preparation System, 2nd edition, Addison-Wesley, 1994.

After you have been using LATEX for several years and find yourself wanting to accomplish tasks that are not covered by the User's Guide, you may want to consider getting:

Goossens, Mittelbach, Samarin, The LATEX Companion, Addison-Wesley, 1994.

For true LATEX nerds, you may find that you would like to learn how to use the underlying TEX commands upon which LATEX is based. Although this book is not for the faint of heart, it is the canonical text on the subject (written by the creater of TEX):

Knuth, D., The TEXbook, Addison-Wesley, 1986.

Web Sites

For every book on the topic of LATEX there are probably two or three web sites that have tutorials or references. As with the book list above I will exercise restraint and show only a few for you to consider.

There is a site a NASA that contains a fairly complete reference of LATEX commands. I might emphasis the word reference because the site does not contain a tutorial component.

The University of Cambridge Department of Engineering maintains a site that provides some useful information that is more complete and provides some nice examples. I would recommend looking at the site when this document has ceased to be helpful.

There is an interesting site maintained by Scott Peckham that contains a rather expansive list of tutorials, manuals and user's guides for a variety of topics. The LATEX portion of the site is at:

Hello World

In the programming world it has become a sacred tradition that the first program you write when learning a new language is a simple program the prints the words ``Hello World!'' to the screen. In keeping with that time-honored tradition, we will write a simple LATEX document that will produce the same output. Without further ado, here it is:

``Hello World'' Source

This is what the Hello World document would look like. The output of the document would be simply a page with the words ``Hello World'' and with a page number centered in the bottom margin.

The source for this example is available at helloworld.tex.
% helloworld.tex
% This is the Hello World program.
Hello World            % the actual text to be output
There are several noteworthy observations to be made from this simple example.

There remains one rather important topic related to this ``Hello World'' document: How does one go from saving that text in a file to producing the nicely formatted output?

Compiling ``Hello World''

The details of compiling are necessarily installation-specific. These instructions apply to those who who are using a RedHat-based Linux distribution.

LATEX assumes that your source file has a name that ends with .tex. For this example, lets assume that we've saved those commands in a file named helloworld.tex. Further, let us assume that the operating system prompt is this: prompt$>$. To compile, view, and print the document you would enter the following commands5:

prompt> latex helloworld
This is TeX, Version 3.14159 (Web2C 7.2)
LaTeX2e <1998/06/01>
Babel <v3.6j> and hyphenation patterns for american, 
french, german, italian, nohyphenation, loaded.
Document Class: article 1998/05/05 v1.3y Standard LaTeX 
document class (/usr/share/texmf/tex/latex/base/size10.clo))
No file helloworld.aux.
[1] (helloworld.aux) )
Output written on helloworld.dvi (1 page, 232 bytes).
Transcript written on helloworld.log.
prompt> xdvi helloworld
prompt> lpr helloworld.dvi

Notice that typing latex helloworld6 generated quite a bit of output to the screen. If there had been errors in the document, those would have been flagged with several option of how to proceed listed. In case you are wondering, yes, that is all I intend to say about dealing with errors.

In addition to producing quite a bit of output to the screen, this first command also caused several files to be created. The file of interest to us right now is one called helloworld.dvi. This is a ``device independent file'' that contains the nicely formatted output. The command xdvi helloworld runs a program that allows you to view the contents of helloworld.dvi. Once you have (presumably) finished viewing the file and are pleased with the output you can print the document with the final command listed: lpr helloworld.dvi. Notice that you print the .dvi file and not the .tex file.

Major Themes

Basic Typesetting Stuff

Typesetting has some major differences from word processing. One difference is that with typesetting you are expected to understand some rather subtle but important conventions of typewritten text. Many of those details are either handled for you by a typical word processor, or they are ignored (to the detriment of the output) by the word processor. Some of these subtle conventions are mentioned in section 4.1. Of course, we all like to have different fonts and sizes of text, some of the common styles are given in section 4.2.

therefore more responsiblity) over how the most difficult concept is le

Picky Details

You may have never noticed that in most books, the opening quotation marks (``) and the closing quotation marks ('') are different. What that means to you is that when you open and close quotation marks you have to use different keys (see example below).

Also, a hyphen that separates words, a hyphen that separates numbers, and a hyphen appearing in mid-sentence are all of different sizes. Again, you will have to make sure these are entered differently.

Not everything in LATEX requires extra attention. For example, LATEX automatically handles inter-word spacing and line breaks. Words following a period are given extra space, for example. This brings up an important topic. If you want to add extra spaces between words, you cannot simply put extra spaces in your source file.7 As far as LATEX is concerned one space is the same as a hundred spaces. Incidently, to start a new paragraph, you will have to have one (or more) blank line(s) in your source document.

The example below illustrates these and other concepts:

The source for this example is available at subtleties.tex.

Typesetting Subtleties

Consider the following source file:
% subtleties.tex
I would like to say: ``Hello World''.  But,
before              I do, let me give a
once-in-a-lifetime pause and instruct you
to look in section~2 on pages 12--45 of your text book---
you will be very glad you did.

Back to the topic in question: H.\ H.\ Henry once
said, ``\LaTeX\ is my \#1 `hero.'\,''

The output of this file would be as follows:
I would like to say: ``Hello World''. But, before I do, let me give a once-in-a-lifetime pause and instruct you to look in section 2 on pages 12-45 of your text book-- you will be very glad you did.

Back to the topic in question: H. H. Henry once said, ``LATEX is my #1 `hero.'''

The tilde (~) is used to produce a non-breaking space. The backslashes after the initials keeps LATEX from putting extra spacing there. This example also shows how to generate the LATEX logo with the \LaTeX command8 The \, is used to produce a small amount of space so that the quotation marks are interpreted correctly. Also notice that LATEX decided where the line breaks should go.


To accomplish emphasizing of text or change text sizes you can use these commands:
Command Product Example
{\bf text} bold-faced text text
{\em text} emphasized9 text: text
{\it text} italicized text text
{\tt text} typewriter text text
{\sc text} small caps text TEXT
{\small text} smaller text text
{\large text} larger text text

Of course, there are other sizes, styles, and fonts, but this is enough to give you the idea.

Math and Such

I have been saying that LATEX is particularly good at rendering mathematical notation. In this section I will discuss ``math mode'' and provide an extensive example. The example will not be accompanied by the extensive commentary that came with the earlier examples. To figure out how you render your own mathematical notation you will need to analyze the example carefully and then use one of the references suggested in section 2.

Before you can start enter mathematical equations it is necessary for you to inform LATEX that you intend to do so. That is, you want to instruct LATEX to enter ``math mode''. There are two main ways to enter math mode:

In-Line Math Mode:
This mode is useful if you want to place a small formula or statement within some running text. You mark the beginning and ending of the math mode using a single dollar sign ($).
Offset Math Mode:
Entering this mode will cause the formulas you enter to be set apart from the rest of the text and centered. To mark the beginning and end of this mode use \[ and \], respectively.

Math Example

Enough talk of modes. Here they are up-close and personal. As I said earlier, there won't be any commentary to go along with this example, so you will need to study it carefully to see what is going on.

The source for this example is available at mathdemo.tex.
% mathdemo.tex
Putting a formula like $\log_2 2 = 1$ inside text is 
as easy as $(5-3)$-$\frac{8}{4}$-3.  Of course you can do 
more omplicated things like this excerpt from my 

  \mbox{offset} = 
    \overbrace{\left\lfloor \frac{\mbox{row \#}}{2} 
                \right\rfloor}^{\mbox{which pair}}

\noindent Given the offset, the communication dimension is 
calculated as follows:
  \mbox{commDim} = (p + r \cdot \mbox{offset}) \bmod k

The output produced by the code would be as follows:
Putting a formula like $\log_2 2 = 1$ inside text is as easy as $(5-4)$-$\frac{8}{4}$-3. Of course you can do more omplicated things like this excerpt from my dissertation:

\mbox{offset} =
\overbrace{\left\lfloor \frac{\mbox{row \...

Given the offset, the communication dimension is calculated as follows:

\mbox{commDim} = (p + r \cdot \mbox{offset}) \bmod k

Environments and More

One of the major frustrations to new users of LATEX is that the program seems to have a mind of its own when it comes to formatting your text. Unfortunately, the new user also has a mind of his/her own and the two parties don't always see eye-to-eye.

Let me offer a bit of advice. LATEX was designed by professionals who have a pretty good idea as to how material should be presented. You will do yourself a favor to not ``buck the system'' and simply try to find out how you can best present your material within the provided framework. This will result in getting your documents out the door much more quickly and, over time, you will find that your documents share a common look and feel that will almost certainly make combining pieces of documents a very natural step. Furthermore, unless you have some training in the presentation of documents, your personal preferences would likely communicate the contents of your document less effectively.

LATEX provides a number of ``enviornments'' that are designed for presenting different kinds of materials. You should make extensive use of these niceties and avoid blazing your own trails, at least until you have spent some time working within the system.

Sections and Labels

Often documents are divided into parts, sections, and subsections, that are numbered. LATEX provides some commands that you can use to mark the beginning of various sections and subsections. I would urge you to make liberal use of these commands for several reasons:

For an example document that uses sectioning commands, look at the syllabus example given section 10.

$\star $-Forms

Many of the commands in LATEX have what are called star-forms ($\star $-forms). A $\star $-form is an alternate version of a command that behaves only slightly different than the original. For example, the command \section{My Section} will do the following:

The $\star $-form of the command, \section*{My Section}, will do the same as the original except that it will not number the section. After all, not everyone likes to have their document parts labeled with numbers!


Since sections can be numbered automatically, that generates some concern with regards to how you can refer to a section by number from some other place in the document. The solution is that instead of using an explicit number to reference a section, you use a special internal name that will be translated to a number when LATEX compiles you document. Although the section numbers may change many times as you work on drafts of the document, the internal name you assign to a section will be constant.

There are two steps to get this to work:
  1. When you define a section header, label it (i.e., give it a name) using the \label command. For example:
              \section{My Introduction} \label{intro}
    Incidently, the label does not have to appear immediately after the section title, though it would make sense to do so.
  2. Anytime to want to refer to the section by number you can use the \ref command like this:
    ... and you may recall from my introduction in
    section~\ref{intro} that ...

It should be noted that labels can be used for sections, subsections, etc., as well as inside of enumerate environments and so on. One final word is that when using labels you may need to compiling your two times in order to get the correct labels. Because.


Some material is nicely represented using list formats. There are three main listing environments that are quite similar in usage, but are appropriate in slightly different contexts.
is used to be created bulleted (unnumbered) lists.
is used to create numbered lists.
is used when each item in the list begins with a highlighted word or phrase (like this list).

It should be noted that lists can be nested to several levels. It is possible to override the default numberings for enumerate environment to create a customized outline ...but guess what? That's right, we don't cover that here!

List Examples

Notice that the second list is numbered and has a nested list within it. Here is the source file.

The source for this example is available at listdemo.tex.
% listdemo.tex

  \item This little piggy went to market.
  \item This little piggy stayed home.
  \item This little piggy had roast beef.
  \item This little piggy had none.
  \item This little piggy went wee wee wee wee all 
        the way home.

  \item This little piggy went to market.  And he 
        bought the following items:
    \item Bob the Tomato
    \item Larry the Cucumber
    \item Junior Asparagus
  \item This little piggy stayed home.
  \item This little piggy had roast beef.
  \item This little piggy had none.
  \item This little piggy went wee wee wee wee 
        all the way home.

  \item [opportunistic:] This little piggy went to market.
  \item [lazy:] This little piggy stayed home.
  \item [fat:] This little piggy had roast beef.
  \item [hungry:] This little piggy had none.
  \item [scared:] This little piggy went wee wee wee 
        wee all the way home.

And the output produced goes something like this:

  1. This little piggy went to market. And he bought the following items:
    1. Bob the tomato
    2. Larry the cucumber
    3. Junior asparagus
  2. This little piggy stayed home.
  3. This little piggy had roast beef.
  4. This little piggy had none.
  5. This little piggy went wee wee wee wee all the way home.

This little piggy went to market.
This little piggy stayed home.
This little piggy had roast beef.
This little piggy had none.
This little piggy went wee wee wee wee all the way home.

Tables and Arrays

A surprising variety of material is nicely rendered using tables. If you have not worked with HTML or some similar markup language you will likely have a tendency to underuse tables. If you need anything to be lined up in columns you will likely want to use the tabular or array environment.10

There are two main environments for creating ``tables'' in LATEX: tabular and array. The two environments are basically identical except that array is used in math mode and tabular is used in ``regular'' mode. To decide which one should be used, simply answer this question: ``Does the table contain mostly mathematical entries or mostly non-mathematical entries.'' Most of the discussion below applies to both environments, but I have lazily refered to only the tabular environment.

Although LATEX makes putting borders around tables rather simple, I would urge you not to get too carried away. Many tables look attractive with no lines.11

tabular vs. table vs. tabbing

These three environments have such similar names they can be a bit confusing to newcomers. Here is a brief summary of the three environments.
is used for presenting material in rows and columns (i.e., what most of us would call a table)
is a floating environment (see section 6.4 for more detail) that is used to house material that should not be split and that can be moved around. That is, the contents of the table environment may be a table (i.e., tabular) or it may be something entirely different.
is used to line up several rows of information by setting tab marks (like a typewriter, if you're old enough to have used one). I find this environment to be of limited usefulness, though I have used it.

Tables (and by that I mean entities created with the tabular environment) are defined by specifying the number and type of columns to be in the table. Then the table is filled in row by row with an ampersand (&) separating each column entry and a double backslash (\\) marking the end of the row. Vertical bars (|) in the column definition are used to create vertical lines, and the command \hline after a row entry is used to create horizontal lines.

The types of columns are specified by a single letter and are as follows:

text in column is left justified
text in column is centered
text in column is right justified
text in column is a ``paragraph'' which can span several lines. When using this type of column you must specify the width of the column. For example, p{1.5in}, would create a paragraph-style column that is one and a half inches wide.

Except for the ``paragraph'' columns, LATEX automatically adjusts the width of columns to accommodate the largest entry. Here are some examples:

tabular and array Examples

You may notice that there is quite a bit of mathematical notation in the first table. There also happens to be a good bit of text as well. It was kind of a toss up as to whether to make this tabular or array--I chose tabular.

The source for this example is available at tabulardemo.tex.
% tabulardemo.tex

\newcommand{\numcirc}[1]{ \makebox{\ensuremath{\bigcirc}}
            \hspace{-1.4\circwidth} \raisebox{-1pt}{#1} }
  \begin{tabular}{|llp{2.5in}|} \hline
    Topology    & Size    & Definition \\ \hline
    Ring        & $n$ nodes   & 
                  $\{C^1(1,n) \mbox{ and its inverse} \}$ \\
    Complete Graph& $n$ nodes & 
                    $\{C^i(1,n) \mid 1 \leq i \leq n-1 \}$ \\
    Hypercube   & $k$-dimensional & 
                    $\{(2i-1\; 2i) \mid 1\leq i \leq k \}$ \\
    Star Graph  & $n!$ nodes & 
                     $\{(1\; i) \mid 2\leq i \leq n \}$ \\
    Torus       & $d_1 \times d_2 \times \cdots \times d_k$ & 
          $\bigcup_{j=1}^{k} C^1(1+\sum_{i=1}^{j-1} 
	  d_i,\sum_{i=1}^{j} d_i)$
          and their inverses \\ \hline

  j= \left\{ \begin{array}{ll}
               i+1\: (\bmod\ n) & \mbox{ when } 
	                          p=q \in \mathcal{H} \\
               i-1\: (\bmod\ n) & \mbox{ when } 
	                          p=q \in \mathcal{H}

% Table Generated By \RESEARCH\PHD\FULL-TEX.C on Jul 28 1996
  \centering\begin{tabular}{|c||cc|cc|} \hline 
    \multicolumn{1}{|c||}{Row} & 
    \multicolumn{4}{|c|}{Rotations} \\ \cline{2-5}
    \multicolumn{1}{|c||}{Labels} &  1 & 2 & 2 & 1 \\ 
                                            \hline \hline
    $+$ & $+$ & \numcirc{2} & \numcirc{2} & $+$ \\ \hline
    $-$ & $-$ & \numcirc{2} & \numcirc{2} & $-$ \\ \hline


The last example illustrates a couple of things. First the \numcirc command is not a standard LATEX command. I had to define it myself using the \newcommand command. Secondly, the source for this table was (as suggested by the comment) actually generated by a computer program.12 Here is the output:

Topology Size Definition
Ring $n$ nodes $\{C^1(1,n) \mbox{ and its inverse} \}$
Complete Graph $n$ nodes $\{C^i(1,n) \mid 1 \leq i \leq n-1 \}$
Hypercube $k$-dimensional $\{(2i-1\; 2i) \mid 1\leq i \leq k \}$
Star Graph $n!$ nodes $\{(1\; i) \mid 2\leq i \leq n \}$
Torus $d_1 \times d_2 \times \cdots \times d_k$ $\bigcup_{j=1}^{k} C^1(1+\sum_{i=1}^{j-1} d_i,\sum_{i=1}^{j} d_i)$ and their inverses

j= \left\{ \begin{array}{ll}
i+1\: (\bmod\ n) & \mbox{ whe...
...d\ n) & \mbox{ when } p=q \in \mathcal{H}
\end{array} \right.

Row Rotations
Labels 1 2 2 1
$+$ $+$ \ensuremath{\bigcirc} 2 \ensuremath{\bigcirc} 2 $+$
$-$ $-$ \ensuremath{\bigcirc} 2 \ensuremath{\bigcirc} 2 $-$

Pictures and Floats

It is often confusing to figure out how different software handles the incorporation of graphical images. In LATEX there are several choices, but I will share with you only the method that I have come to know and love. It requires that you use the standard graphics package (which simply involves putting \usepackage{graphics} after the documentclass command and before the \begin{document} command).

Although various LATEX installations support a variety of graphical formats I would urge you, if at all possible, to render all of your diagrams in encapsulated postscript format. There are several advantages in doing so:

Since you will obviously follow my suggestions, I will only demonstrate how to include an incapsulated postscript document.

Most figures and many tables are not designed to be split across pages. This can create ugly looking documents because it can cause there to large gaps in the text. LATEX provides two similar environments that help to alleviate this problem: table13 and figure. These two environments are collectively called ``floats'' because their contents may be moved around so as to make them fit with the text more nicely.

The main difference between the two environments is there default captioning. It should be noted that although I have included the picture below inside the figure environment, there is no rule that says the two must be used together. That is, I can have a floating picture that may be placed on a page different that where it appears in the LATEX (i.e., a floating figure) or I can have a figure that stays put.

Picture and Float Example

The source for this example is available at floatfig.tex. The source for the encapsulated postscript file is also available at 2^4cay.eps.
% floatfig.tex

  \caption{A 4-Dimensional Hypercube Labelled as a 
           Cayley Graph}

On thing to notice about the output below is that LATEX automatically labeled the graphic as figure 1. If we had used the table environment it would have been listed as table 1.
Figure 1: A 4-Dimensional Hypercube Labelled as a Cayley Graph

One final note about using the floating environments. If you use these you will find there are other longer term advantages:


This section simply mentions some environments and details that didn't seem to belong anywhere else. To center text there is an environment called center. Like the other enviroments, you use it you simply to the following:
  Stuff to be centered \\
  goes here.

Notice the use of the double backslash (\\) to produce an end of line prematurely. That brings us to a related topic. How can one add additional spacing to a document when LATEX is so stubborn about handling the spacing itself? There are several commands that allow you to override LATEX's default actions:

\\ As just mentioned, this causes the current line to end immediately.
\vspace{size} This is used to introduce vertical spaces in your document. The size parameter will be something like 1.2in to specify how much space you want.
\hspace{size} You guessed it--this is used to introduce horizontal spaces in your document.
\pagebreak Causes the page to end prematurely.

So as not to be misleading: There are other methods of getting things put exactly where you want them, but there are some fairly simple and useful methods that should keep you happy for a little while.

If you are using a long quotation, there is a quotation enviornment that takes care of the margins for you. Simply put the long quotation between a begin-end pair and you've got it. For you math-types there are theorem-like environments that you will want to look into as well.


Not surprisingly, adding footnotes is quite easy in LATEX. It works like this:
  ... and what I am saying is always true\footnote{except for
  the exceptions, obviously} and should never be doubted ...

LATEX will choose a unique symbol for your footnote and will place the footnote at the bottom of the page appropriately.


Spell Checking

In theory you can use any stand-alone spell checker to spell-check your LATEX source documents for spelling errors. One annoying result of using a non-LATEX-aware spell-checker is that many of the commands will be flagged as spelling errors. There are two ways to deal with this problem:
  1. ignore it (and spend extra time doing so)
  2. add command names to your dictionary

There exists spell-checkers that know how to parse LATEX documents. On systems using Red Hat Linux, there is a program called ispell that does a decent job with LATEX documents. Simply type ispell myfile.tex and then follow the instructions.

Handling Large Documents

Allow me to show you a template for what a large document can look like in LATEX. For this example, let's assume you are writing a research paper and each section is quite long. Your paper is going to have a title, an abstract, a table of contents, a list of tables, a list of figures, several large sections, and a list of references. Your document might look like this:
% big.tex


\title{Super-Big Research Topic  \\ My Life's Journey}
\author{Me\thanks{I would like to thank my dog for
                   his unfailing support in this endeavor}}

What I demonstrate in this paper is \ldots




Notice that your super-big research paper fits on one page! Well, of course, that's not true. The \input commands tell LATEX to paste the contents of the specified file at that point in the document. This allows you to split your document into several source files. Also, if you have a slow computer, you can have it include only one section at a time so that compiling will be faster as you write. Furthermore, many of use who have written long documents know the frustration of have one gigantic source file that is so large you can't find anything!

Some other things to note:

The source for this example is available at big.tex.


Let me begin this section, like I have done several others, by explaining to you why you want to go to the trouble to learn how to use BIBTEX.

For starters you will create a file with a .bib extension that will contain your bibliography entries.14 The entries must be written in a very specific format as you will see. Here is a sample file named demo.bib:

% demo.bib
  AUTHOR  = "Kellogg S. Booth",
  TITLE   = "Lexicographically Least Circular Strings",
  JOURNAL = "Information Processing Letters",
  YEAR    = "1980",
  VOLUME  = "10",
  PAGES   = "240--242")

  AUTHOR  = "George Polya",
  TITLE   = "Notes on Introductory Combinatorics",
  YEAR    = "1983",
  PUBLISHER = "Birkhauser")

  AUTHOR    = "D. E. Culler and R. M. Karp and D. A.  Patterson 
              and A. Sahay and K. E. Schauser and E. Santos and 
	      R. Subramonian and T. von~Eicken",
  TITLE     = "{LogP}: Towards a Realistic Model of Parallel 
  BOOKTITLE = "Proceedings of the 4th {ACM} {SIGPLAN} Symposium 
              on the Principles and Practice of Parallel 
  PAGES     = "1--12",
  YEAR      = "1993")

  AUTHOR    = "J. M. Nash and P. M. Dew and M. E. Dyer and 
              J. R.  Davy",
  TITLE     = "Parallel Algorithm Design on the {WPRAM} 
  INSTITUTION= "School of Computer Science, University of 
  NUMBER     = "94.24",
  YEAR    = "1994")

  AUTHOR    = "R. H. Bisseling and W. F. McColl",
  TITLE     = "Scientific Computing on Bulk Synchronous 
              Parallel Architectures",
  BOOKTITLE = "Technology and Foundations: Information 
              Processing '94",
  EDITOR    = "B. Pehrson and I. Simon",
  PUBLISHER = "Elsevier Science Publishers",
  PAGES     = "509--514",
  YEAR      = "1994")

This file demonstrates several (but not all) of the different forms that BIBTEX knows about. For details about the various forms you'll need to view some of the resources I list in section 2. On thing to note is that after specifying what kind of entry (book, article, etc.) you can specify a name (i.e., a label) for the entry in question. As you will see below, anytime you want to refer to that work in your document you can simply issue the \cite command. By default, LATEX will only include in the bibliography, those entries that you explicitly cite.

The file bibdemo.tex shown below, demonstrates how the .bib file can be used for citing works and for automatically generating a bibliography.

% bibdemo.tex

This paper is about my wonder experiements.  But first, 
I must mention the work of others, which is, of course, 
far inferior to my own.  Booth\cite{booth} gives a nice 
discussion of circular strings.  And Polya\cite{polya} 
waxes eloquent about combinatorics.  Furthermore, Culler 
and others\cite{culler:etal} have much to say as well.

That is all I will mention at this point.


The final two commands specify how the bibliography entries should be ordered and what files should be checked for entries, respectively. Some standard available bibligraphy styles are:

entries are sorted alphabetically and citations are numbered
entries are entered in order of their citations (and citations are numbered)
entries are sorted alphabetically and use authorname and publication year (Ser95) for citations
like plain except uses abbreviations

The source for these examples is available at demo.bib and bibdemo.tex.

Compiling BIBTEX Documents

Before you rush out and try to use BIBTEX on your own you should know that compiling these documents requires some extra steps. Suppose we have the file names used in the examples above (demo.bib for bibliography entries and bibdemo.tex for the LATEX source document). You would compile the document as follows15:
prompt> latex bibdemo
prompt> bibtex bibdemo
prompt> latex bibdemo
prompt> latex bibdemo

Your eyes are not deceiving you. To make sure that all labels are references are correct, you may have to run LATEX three times. Not to worry, however, because you only need the references to read correctly in the final version anyway!

Generating the BIBTEX Logo

As best as I can tell, there is not predefined command that generates the BIBTEX logo. One way to handle that is to create a command yourself. I did it like this:
\newcommand{\BibTeX}{{\sc Bib}\TeX}

The command, as you can see, used the small caps typestyle to produce the BIB portion of the logo and then it simply uses the already existing \TeX command to produce the rest. Now to refer to BIBTEX you simply enter \BibTeX in your source document.

Publishing on the Web

There are several programs available that offer to convert LATEX source to HTML. The package I am familiar with is LATEX2HTML. It should be no surprise to you that this document was written in LATEX and has been made available on my web site by converting to HTML using LATEX2HTML.

LATEX2HTML is available at its official web site:

LATEX2HTML actually provides three major pieces of functionality:

Basic usage is very simple. Just type latex2html mydoc and it will create a directory named mydoc that contains the converted files. There are, of course, many ways to customize the behavior of the program through modifying configuration files and though the command-line options. Some of the command-line options I have found helpful are these:

Option Parameter Description
-t ``title'' gives the web page a title of ``title''
-up_url ``url'' specifies where to take the user (``url'') when they click the ``up'' button
-up_title ``title'' what to call the page found at ``url'' in the -up-url option
-info ``#'' where # is 1 or 0 specifying the the ``info'' section16 should be included or omitted, respectively
-split ``#'' where # is the level (section, subsection, etc. where splitting of the source should stop

For an extensive example of how to use a variety of the LATEX2HTML features as well as overall LATEX usage, compare the source for the Operating Systems course syllabus with the output generated by LATEX2HTML at my website. The URLs are:


It should be noted that the sample output was generated using the default settings. You can compare that with the Operating Systems course syllabus at my web site to see how a similar document can be rendered differently by using some of the command-line options. Incidently, if you want to compile ossyl.tex yourself you will also need to get

Good luck. And as always, have fun!

About this document ...

LATEX and BIBTEX by Example

This document was generated using the LaTeX2HTML translator Version 2008 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds. Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were: latex2html -nonavigation -address 0 -t 'LaTeX and BIBTeX by Example' -up_url ../../ -up_title 'Terry Sergeant's Homepage' -split 1 -dir ../web/latexhelp latexhelp

The translation was initiated by Terry Sergeant on 2012-12-14

Quick Links