# Latex Bibliography Style Alpha Url

## Bibtex4Word - User Guide

Contents:Quick Start - Citing References - BibTeX Styles = Installing New Styles = Sort Order = Style Flags = Paragraph Formatting - Setting Defaults - Saving A Database

## Quick Start

1. Prepare a bibtex database file containing your references using JabRef or another reference manager.
2. Open the document in Word that you want to add citations to.
3. Press  and navigate to your bibtex database file.
4. To add a citation, position the cursor at the appropriate place in your document and press . In the dialogue box that appears type one or more BibTeX keys separated by commas. Alternatively, you can right-click an entry in JabRef, select "Copy Bibtex key" and then paste it into the dialogue box. As the bibliography does not yet exist, the citation will be displayed as "[<bibtexkey>]"; this will be updated in the next step.
5. Position the cursor where you would like your bibliography to be (usually at the end of your document but definitely not adjacent to a citation)  and press  to create it.

## Citing References

To cite a reference, position the cursor at the appropriate place in the text and press . You can now type one or more BibTeX keys separated by commas. Initially, the citation will be displayed as its BibTeX key, but this will change to the citation label when you press  to create the bibliography. You can display the BibTeX keys at any time by pressing the  button.

### Non-citing entries

If you precede a Bibtex key with "/" then the reference will be included in the bibliography but not cited in the text. If all the citations in a list are non-citing then the surrounding brackets will be omitted and the string will be invisible unless the button is pressed.

### Searching for references

Bibtex4Word includes a primitive search facility which allows you to find entries in the BibTeX database that contain specific words. Searches begin with a @ or else x@ where x is one of a, b, t or j. The BibTeX entries found by some example searches are shown in the table below. If only a small number of matches are found, they will be listed explicitly for you to select, if a large number are found you will be asked to confirm that you want to include them all.

Search StringBibTeX entries found
@ Smith HotAll entries containing both Smith and Hot in any order.
Searching is case insensitive and not restricted to whole words so Hot, hot and HOT are all equivalent and schott will also be found.
a@ SmithAll entries with Smith in the author field
a@ Smith t@ HotAll entries with Smith in the author field and Hot in the title.
t@ Hot Cold a@ SmithAll entries with Smith in the author field and Hot in the title and Cold in the title. Thus a field specifier a@ or t@ remains in force until another field specifier is encountered.
b@ Hot @ ColdAll entries with Hot in the booktitle and Cold in any field.

## Bibligraphy Style

The formatting of the bibliography and the way in which citations are indicated in the text of your document are controlled by two things: (a) your choice of BibTeX style and (b) your selection of style flags: these are explained in detail below.

### Recommended style settings

The following three settings are the ones I use most often. They are written in the form "style/flags" where the flags are specific to Bibtex4Word and affect how the citations and bibliography appear. You will probably have to install the styles into MikTeX before you can use them (see below).

abbrvnat/ndusch
is a good general purpose numeric style with labels of the form [1]. I like it because it includes DOI references which I find useful. The "n" flag forces numeric labels, the "du" flags mean that DOI and URL links will be turned into hyperlinks, the "sc" flags mean that where multiple documents are cited at the same place in the text, their numeric references will be sorted and compressed (e.g. [5-9] instead of [5,6,7,8,9]) and, finally, the "h" flag means that each citation in the text is a hyperlink to the appropriate point in the bibliography. The style abbrvnat may be replaced by plainnat in order to show the full first names of authors instead of just their initials or by unsrtnat which, as well as showing full first names, lists the bibliography in the order references are cited in the text instead of sorting it alphabetically by author.
IEEEtranSA/ush
creates short mnemonics for the labels of the form [ABC01] which indicates the initial letters of the authors' surnames and the last two digits of the publication year. I like these because they are compact but yet remind me of the paper being cited. Unfortunately, this style does not support DOI fields although URL fields appear as hyperlinks. As in the previous example, the "sh" flags mean that multiple citations are sorted into the correct order and that each citation in the text is a hyperlink to the appropriate point in the bibliography. Substituting alpha for IEEEtranSA gives a slightly less verbose bibliography entry.
agsm/(l2ysh
is an example of the "Harvard" bibliography style with citations of the form (Smith et al. 2001); this style is widely used in medicine and other sciences. Here the flag "(" specifies the use of parentheses rather than square brackets, the "l" flag supresses the label from appearing in the bibliography and the "2y" flag determines the date format (i.e. follow the author's name by a space and then the year of publication). With this style, long author lists will be abbreviated in the text as "et al." but you can force the inclusion of all the author names by specifying the "a" flag in addition. This style displays URL fields but cannot turn them into hyperlinks: if DOI/URL hyperlinks are important to you, you can use plainnat/(l2ydush but I think the bibliography formatting is a bit less pretty.

### BibTeX Style

The formatting of the bibliography and the way in which citations are indicated in the text of your document are controlled by the "bibtex style". Thus, for example the same citation in styles "IEEEtran" and "alpha" would appear in the bibliography as:

• [1]   A. Anon, B. B. Butt, and C. Chet, "Marmalade Making," Jam Monthly, vol. 2, no. 1, pp. 27-33, Jan. 2001.
• [ABC01]    Anne Anon, Bill B. Butt, and Chas Chet. Marmalade Making. Jam Monthly, 2(1):27-33, January 2001.

where the differences include the use of first names, the quoting of the title and the way in which the volume and issue numbers are shown. The initial portion of the entry, enclosed in [...] is the "label" and will appear in the text whenever the reference is cited. Most styles have numeric labels as with the first example above while a few, known as alpha styles, have labels constructed from the authors' names and the year of publication as in the second example; this provides a useful mnemonic in the text. Some disciplines prefer "Harvard" styles which include the author's name and publication year in the citation.

To choose the style, press the button and then type in the name of the style you want to use. There are several hundred different styles available in MiKTeX and it can be difficult to choose between them. A good guide is available from Reed College and an extensive list has been put together by Ken Turner. Most journals have their own ready-made style which formats the references exactly as their editors' prefer.

The Bibtex4Word package includes a Word document "StyleTable.doc" which lists a number of Bibtex styles. By following the instructions in this document you can create your own style table that includes any styles you wish.

#### Installing New Styles

Only a few styles are initially installed in MiKTeX, so if you want a specific style, you will have to install it first as follows:

1. Open the MiKTeX package manager (Programs->MiKTeX x.y->Browse Packages)
2. Type "xxx.bst" in the "Filename:" box where "xxx" is the style you want to install and click "Filter".
3. If the package has not yet been installed, the column headed "Installed on" will be blank; right click the package and select "Install".
4. You may need to change the server from which to download by selecting Repository->Change Repository: select "Packages shall be installed from the Internet", click "next" and then select a server from a nearby country.

You can set MikTeX so that any missing style files will be installed automatically as required. This sounds like a good idea, but I do not recommend it for two reasons: (a) BibTex4Word will appear to freeze while the new style is installed with no explanation of what is going on and (b) if the server that you have chosen is broken, which happens quite often, BibTeX4Word will freeze forever.

### Sort Order

One of the ways in which styles differ is the order in which the cited references are listed in the bibliography. References may be ordered by any combination of: A=author, C=citation order within your document, D=publication date, K=BibTeX key, L=citation label used within the text of your document and T=document title. The priority order of these criteria used for some common styles is given below:

 AC plainnat, abbrvnat ADC jbact ADTC aaai-named, abbrv, acm, agsm, amsplain, annotation, apa, chicago, IEEEtrans, is-abbrv, is-plain, named, phrmp, plain, siam [and many more] C IEEEtran, is-unsrt, nar, nature, phjcp, unsrt, unsrtnat DATC plainyr K abstract LDATC alpha, annotate, IEEtranSA

The Bibtex4Word package includes a Word document "SortOrder.doc" which allows you to determine the bibliography sort order for any Bibtex styles. Instructions for doing so are included in the document itself.

### Style Flags

The selected style can be modified by the inclusion of one or more style flags following the bibtex style e.g. BIBSTYLE=alpha/n. You can have as many style flags as you want following the "/" character. The table below lists the available style flags; some flags are preceded by an optional integer, n, whose meaning is explained in the table; if n is omitted it is taken to equal 1 unless otherwise specified. Specific styles to which an option applies are shown in brackets.

The following flags affect how references appear in the bibliography:

 a Use full instead of abbreviated author names in label [chicago, named, plainnat, agsm] d Convert DOI references into hyperlinks [plainnat] nf Insert a line feed in the bibliography after any label that is more than n characters long. l [lower case "L"] Omit the labels from the bibliography entries (normally needed for Harvard style bibliographies). If this option appears not to work, you may need to turn off "hidden text"; to turn off hidden text select Tools>>Options>>View (Word 2003) of Office-Button>>Word-Options>>Display (Word 2007) and make sure that both "Hidden Text" and "All" are unchecked. nm n gives number of cross-references (instead of the normal 2) needed to trigger insertion of the parent entry into the bibliography  [default n=999]. n Force the reference list to be numbered even if the bibtex style normally uses labels based on author names. nu Convert URLs into hyperlinks [plainnat, ieeetran]n is the sum of the following options: 1=convert to hyperlinks [default], 2=do not insert discretionary hyphens after each "/" character, 4=replace the url with the text "" ] Omit the square brackets from the bibliography label. ) Use parentheses instead of square brackets in the bibliography. . Omit the square brackets from the bibliography and follow the label with a "." instead. n~ Put n non-breaking spaces after the bibliography label in place of a tab. n& Select the form of "and" in the author list for harvard styles [agsm]. 0 = "&" [default], 1="and", 2="et", 3="en", 4="und".

The following flags affect how references are cited in the text of the document:

 c Compress cited references by writing [1-4] instead of [1, 2, 3, 4]. Normally used in combination with the s option. h Make the citations into clickable hyperlinks that take you to the corresponding entry in the bibliography. To return to the text type "Alt+Left Arrow" or use the back button on the "Web" toolbar if it is displayed. s Sort the references in a citation list thereby writing [1,2,3,4] instead of [2,4,1,3]. Often used in combination with the c option. ny year formatting in the label [chicago, named, plainnat, agsm]n: 0="Smith (2000)"; "1=Smith"; 2="Smith 2000"; 3="Smith, 2000"; 4="(2000)"; 5="2000" [ Omit the square brackets surrounding the citation. ( Use parentheses instead of square brackets to surround the citation. ^ Write citation list as superscript like this1,2,3. , Omit spaces after commas in the citation list e.g [1,2,3] rather than [1, 2, 3] ; Use semicolons instead of commas in the citation list.

The following flags affect the system operation:

 b Instead of scanning the citations in the document, use an existing file in the same folder as the document with name ****.bbl where **** is the name of the document. np Set the code page of the bibtex database. If no p flag is given, the ANSI code page of your system locale will be used. If n is omitted, it is taken to be 65001 which corresponds to UTF8 encoding. nt Create a style table. The last table in the document is assumed to contain a list of styles in the first column; the formatted output will be placed in the last column. The first n lines are assumed to contain header information. If the style in the first column omits either the style name or the style flags, then the corresponding values will be taken from the main style specification. nz n is the sum of any combination of: 1=allow undo to reverse changes made to a bibliography (this may result in "insufficient memory" warnings"); 2=always save bibtex database filename as a full path (the default is to save it as a relative path if it is in or below the folder containing your word document) n# Indicate special features of the bibtex style; n is the sum of any combination of: 1=bibitem entries use the natbib format; 2=citeauthoryear command uses the chicago format. The default value depends on the bibtex style selected: 0 for most syles, 1 for abbrvnat, elsarticle-harv, plainnat, unsrtnat; 2 for chicago. + Use bibtex8, the extended version of bibtex instead of the normal version. This flag will be ignored if the BIBEXE environment variable is set.

There are some special "style commands" which can be entered instead of a style.

 //b Open the BibTeX database. The style is not changed. //t Use notepad to open the four temporary files that BibTex4Word uses. These files contain useful information if it becomes necessary to figure out why something is not working. The style is not changed. The files are (a) bibtex4word.aux, a list of the citations found in the document, (b) bibtex4word.blg, a list of error and status messages from BibTeX, (c) bibtex4word.log, a list of error and status messages from BibTex4Word and (d) bibtex4word.bbl, the contents of the bibliography in LaTeX format which BibTex4Word converts into Word and writes to your document.

### Paragraph Formatting

To select the character and paragraph formatting of the bibliography, select the entire first entry (conveniently by double-clicking in the left margin) and apply whatever formatting you wish. Click on  again to rewrite the entire bibliography in your chosen format. It is often convenient to include a hanging indent in the format; Bibtex4Word will, by default, put a Tab character after printing the label.

## Setting a Default Database and Style

### Default Style and BibTeX Database

If you always use the same BibTeX database and the same style, it is annoying to have to define them afresh for each new document. You can define the default values for these as environment variables.

BIBFILE
Defines the default bibtex database (e.g. BIBFILE=C:\data\file.bib)
BIBSTYLE
Defines the default bibtex style, style flags and "magic" characters (e.g. BIBSTYLE=plainnat/ndu @/). The "magic" characters are discussed elsewhere; you will not normally need to change them.
BIBEXE
Defines the bibtex executable program (e.g. BIBEXE=C:\Program Files\MiKTeX 2.8\miktex\bin\bibtex.exe). Setting this environment variable overrides the "+" style flag and is only necessary if you have problems with the call to BibTeX.
BIBTEMP
Defines the folder that Bibtex4Word will use for temporary file (e.g. BIBTEMP=C:\xxx\dirname). It is only necessary to set this explicitly if, for some reason, you don't have a writable system temporary folder defined already.

To define any or all of these environment variables, do the following:

Windows XP: Start>>Settings>>Control Panel>> System>>Advanced>>Enviromental Variables>>User Variables>>New
Windows Vista: ??
Windows 7: Start>>Control Panel>>System and Secutiry>>System>>Advanced System Settings>>Environment Variables>>User Variables>>New

You can shortcircuit several of these steps by right-clicking "My Computer" on the desktop and selecting "Properties".

### Default Paragraph Formatting

Default formatting of the bibliography (font, font size, intenting etc) can be specified by creating a "Word Style"; this is nothing whatsoever to do with a BibTeX style. You can define a default Word Style called Bibtex (Windows XP: Format>Styles and Formatting>New Style) with the style features of your choice. You can define different formatting for different BibTeX styles by defining Bibtex plain, Bibtex alpha etc where the BibTeX style name is separated from the word Bibtex by a space.

## Creating a BibTeX database for the document

If you click , you can create a small BibTeX database containing only the references that are cited in your document. This is useful if you want to send your document to someone else to edit. For obscure Microsoft reasons (or my incompetence as a Visual Basic programmer), the file dialog box has to use one of the standard Word file extensions (I have chosen .MHT) but the file will nevertheless be saved with the correct .BIB extension. A side-effect of this is that you will not be able to see whether or not the file you specify exists already. You will however be warned before overwriting an existing file.

This page is part of the Bibtex4Word documentation. Copyright © 2006-2013 Mike Brookes, Imperial College, London, UK. See the file gfl.html for copying instructions. Please send any comments or suggestions to "mike.brookes" at "imperial.ac.uk".
Updated: $Id: b4w_using.html 2855 2013-03-28 17:18:47Z dmb$
 This module may require a complete rewrite in order to suit its intended audience.You can help rewrite it. Please see the relevant discussion.

For any academic/research writing, incorporating references into a document is an important task. Fortunately, LaTeX has a variety of features that make dealing with references much simpler, including built-in support for citing references. However, a much more powerful and flexible solution is achieved thanks to an auxiliary tool called BibTeX (which comes bundled as standard with LaTeX). Recently, BibTeX has been succeeded by BibLaTeX, a tool configurable within LaTeX syntax.

BibTeX provides for the storage of all references in an external, flat-file database. (BibLaTeX uses this same syntax.) This database can be referenced in any LaTeX document, and citations made to any record that is contained within the file. This is often more convenient than embedding them at the end of every document written; a centralized bibliography source can be linked to as many documents as desired (write once, read many!). Of course, bibliographies can be split over as many files as one wishes, so there can be a file containing sources concerning topic A () and another concerning topic B (). When writing about topic AB, both of these files can be linked into the document (perhaps in addition to sources specific to topic AB).

## Embedded system

If you are writing only one or two documents and aren't planning on writing more on the same subject for a long time, you might not want to waste time creating a database of references you are never going to use. In this case you should consider using the basic and simple bibliography support that is embedded within LaTeX.

LaTeX provides an environment called that you have to use where you want the bibliography; that usually means at the very end of your document, just before the command. Here is a practical example:

\begin{thebibliography}{9}\bibitem{lamport94} Leslie Lamport, \textit{\LaTeX: a document preparation system}, Addison Wesley, Massachusetts, 2nd edition, 1994. \end{thebibliography}

OK, so what is going on here? The first thing to notice is the establishment of the environment. is a keyword that tells LaTeX to recognize everything between the begin and end tags as data for the bibliography. The mandatory argument, which I supplied after the begin statement, is telling LaTeX how wide the item label will be when printed. Note however, that the number itself is not the parameter, but the number of digits is. Therefore, I am effectively telling LaTeX that I will only need reference labels of one character in length, which ultimately means no more than nine references in total. If you want more than nine, then input any two-digit number, such as '56' which allows up to 99 references.

Next is the actual reference entry itself. This is prefixed with the command. The cite_key should be a unique identifier for that particular reference, and is often some sort of mnemonic consisting of any sequence of letters, numbers and punctuation symbols (although not a comma). I often use the surname of the first author, followed by the last two digits of the year (hence lamport94). If that author has produced more than one reference for a given year, then I add letters after, 'a', 'b', etc. But, you should do whatever works for you. Everything after the key is the reference itself. You need to type it as you want it to be presented. I have put the different parts of the reference, such as author, title, etc., on different lines for readability. These linebreaks are ignored by LaTeX. The command formats the title properly in italics.

## Citations

To actually cite a given document is very easy. Go to the point where you want the citation to appear, and use the following: , where the cite_key is that of the bibitem you wish to cite. When LaTeX processes the document, the citation will be cross-referenced with the bibitems and replaced with the appropriate number citation. The advantage here, once again, is that LaTeX looks after the numbering for you. If it were totally manual, then adding or removing a reference would be a real chore, as you would have to re-number all the citations by hand.

Instead of WYSIWYG editors, typesetting systems like \TeX{} or \LaTeX{}\cite{lamport94} can be used.

### Referring more specifically

If you want to refer to a certain page, figure or theorem in a text book, you can use the arguments to the command:

\cite[chapter, p.~215]{citation01}

The argument, "p. 215", will show up inside the same brackets. Note the tilde in [p.~215], which replaces the end-of-sentence spacing with a non-breakable inter-word space. This non-breakable inter-word space is inserted because the end-of-sentence spacing would be too wide, and "p." should not be separated from the page number.

### Multiple citations

When a sequence of multiple citations is needed, you should use a single command. The citations are then separated by commas. Here's an example:

\cite{citation01,citation02,citation03}

The result will then be shown as citations inside the same brackets, depending on the citation style.

### Bibliography styles

There are several different ways to format lists of bibliographic references and the citations to them in the text. These are called citation styles, and consist of two parts: the format of the abbreviated citation (i.e. the marker that is inserted into the text to identify the entry in the list of references) and the format of the corresponding entry in the list of references, which includes full bibliographic details.

Abbreviated citations can be of two main types: numbered or textual. Numbered citations (also known as the Vancouver referencing system) are numbered consecutively in order of appearance in the text, and consist in Arabic numerals in parentheses (1), square brackets [1], superscript1, or a combination thereof[1]. Textual citations (also known as the Harvard referencing system) use the author surname and (usually) the year as the abbreviated form of the citation, which is normally fully (Smith 2008) or partially enclosed in parenthesis, as in Smith (2008). The latter form allows the citation to be integrated in the sentence it supports.

Below you can see three of the styles available with LaTeX:

Here are some more often used styles:

Style NameAuthor Name FormatReference FormatSorting
plainHomer Jay Simpson#ID#by author
unsrtHomer Jay Simpson#ID#as referenced
abbrvH. J. Simpson#ID#by author
alphaHomer Jay SimpsonSim95by author
abstractHomer Jay SimpsonSimpson-1995a
acmSimpson, H. J.#ID#
authordate1Simpson, Homer JaySimpson, 1995
apaciteSimpson, H. J. (1995)Simpson1995
namedHomer Jay SimpsonSimpson 1995

However, keep in mind that you will need to use the natbib package to use most of these.

### No cite

If you only want a reference to appear in the bibliography, but not where it is referenced in the main text, then the command can be used, for example:

Lamport showed in 1995 something... \nocite{lamport95}.

A special version of the command, , includes all entries from the database, whether they are referenced in the document or not.

### Natbib

Citation commandOutput

Goossens et al. (1993)
(Goossens et al., 1993)

Goossens, Mittlebach, and Samarin (1993)
(Goossens, Mittlebach, and Samarin, 1993)

Goossens et al.
Goossens, Mittlebach, and Samarin

1993
(1993)

Goossens et al. 1993
Goossens et al., 1993
(priv. comm.)

Using the standard LaTeX bibliography support, you will see that each reference is numbered and each citation corresponds to the numbers. The numeric style of citation is quite common in scientific writing. In other disciplines, the author-year style, e.g., (Roberts, 2003), such as Harvard is preferred. A discussion about which is best will not occur here, but a possible way to get such an output is by the package. In fact, it can supersede LaTeX's own citation commands, as Natbib allows the user to easily switch between Harvard or numeric.

The first job is to add the following to your preamble in order to get LaTeX to use the Natbib package:

\usepackage[options]{natbib}

Also, you need to change the bibliography style file to be used, so edit the appropriate line at the bottom of the file so that it reads: . Once done, it is basically a matter of altering the existing commands to display the type of citation you want.

StyleSourceDescription
plainnatProvidednatbib-compatible version of plain
abbrvnatProvidednatbib-compatible version of abbrv
unsrtnatProvidednatbib-compatible version of unsrt
IEEEtranNTeX Catalogue entrynatbib-compatible style for IEEE publications
achemsoTeX Catalogue entrynatbib-compatible style for American Chemical Society journals
rscTeX Catalogue entrynatbib-compatible style for Royal Society of Chemistry journals

#### Customization

OptionMeaning
:  :  : Parentheses () (default), square brackets [], curly braces {} or angle brackets <>
: multiple citations are separated by semi-colons (default) or commas
:  : author year style citations (default), numeric citations or superscripted numeric citations
: multiple citations are sorted into the order in which they appear in the references section or also compressing multiple numeric citations where possible
the first citation of any reference will use the starred variant (full author list), subsequent citations will use the abbreviated et al. style
for use with the chapterbib package. redefines \thebibliography to issue \section* instead of \chapter*
keeps all the authors’ names in a citation on one line to fix some hyperref problems - causes overfull hboxes

The main commands simply add a t for 'textual' or p for 'parenthesized', to the basic command. You will also notice how Natbib by default will compress references with three or more authors to the more concise 1st surname et al version. By adding an asterisk (*), you can override this default and list all authors associated with that citation. There are some other specialized commands that Natbib supports, listed in the table here. Keep in mind that for instance does not support and will automatically choose between all authors and et al..

The final area that I wish to cover about Natbib is customizing its citation style. There is a command called that can be used to override the defaults and change certain settings. For example, I have put the following in the preamble:

\bibpunct{(}{)}{;}{a}{,}{,}

The command requires six mandatory parameters.

1. The symbol for the opening bracket.
2. The symbol for the closing bracket.
3. The symbol that appears between multiple citations.
4. This argument takes a letter:
• n - numerical style.
• s - numerical superscript style.
• any other letter - author-year style.
5. The punctuation to appear between the author and the year (in parenthetical case only).
6. The punctuation used between years, in multiple citations when there is a common author. e.g., (Chomsky 1956, 1957). If you want an extra space, then you need .

Some of the options controlled by are also accessible by passing options to the natbib package when it is loaded. These options also allow some other aspect of the bibliography to be controlled, and can be seen in the table (right).

So as you can see, this package is quite flexible, especially as you can easily switch between different citation styles by changing a single parameter. Do have a look at the Natbib manual, it's a short document and you can learn even more about how to use it.

## BibTeX

I have previously introduced the idea of embedding references at the end of the document, and then using the command to cite them within the text. In this tutorial, I want to do a little better than this method, as it's not as flexible as it could be. I will concentrate on using BibTeX.

A BibTeX database is stored as a .bib file. It is a plain text file, and so can be viewed and edited easily. The structure of the file is also quite simple. An example of a BibTeX entry:

Each entry begins with the declaration of the reference type, in the form of . BibTeX knows of practically all types you can think of, common ones are: book, article, and for papers presented at conferences, there is inproceedings. In this example, I have referred to an article within a journal.

After the type, you must have a left curly brace '' to signify the beginning of the reference attributes. The first one follows immediately after the brace, which is the citation key, or the BibTeX key. This key must be unique for all entries in your bibliography. It is this identifier that you will use within your document to cross-reference it to this entry. It is up to you as to how you wish to label each reference, but there is a loose standard in which you use the author's surname, followed by the year of publication. This is the scheme that I use in this tutorial.

Next, it should be clear that what follows are the relevant fields and data for that particular reference. The field names on the left are BibTeX keywords. They are followed by an equals sign (=) where the value for that field is then placed. BibTeX expects you to explicitly label the beginning and end of each value. I personally use quotation marks ("), however, you also have the option of using curly braces ('{', '}'). But as you will soon see, curly braces have other roles, within attributes, so I prefer not to use them for this job as they can get more confusing. A notable exception is when you want to use characters with umlauts (ü, ö, etc), since their notation is in the format , and the quotation mark will close the one opening the field, causing an error in the parsing of the reference. Using in the preamble to the source file can get round this, as the accented characters can just be stored in the file without any need for special markup. This allows a consistent format to be kept throughout the file, avoiding the need to use braces when there are umlauts to consider.

Remember that each attribute must be followed by a comma to delimit one from another. You do not need to add a comma to the last attribute, since the closing brace will tell BibTeX that there are no more attributes for this entry, although you won't get an error if you do.

It can take a while to learn what the reference types are, and what fields each type has available (and which ones are required or optional, etc). So, look at this entry type reference and also this field reference for descriptions of all the fields. It may be worth bookmarking or printing these pages so that they are easily at hand when you need them. Much of the information contained therein is repeated in the following table for your convenience.

articlebookbookletinbookincollectioninproceedings ≈ conferencemanualmastersthesis, phdthesismiscproceedingstech reportunpublished
annote
author+*o++o+o++
booktitle++
chaptero
crossref
editionoooo
editor*ooo
howpublishedoo
institution+
journal+
key
monthoooooooooooo
noteooooooooooo+
numberooooooo
organizationooo
pagesooo
publisher+++oo
school+
seriesooooo
title++++++++o+++
typeoooo
volumeoooooo
year++o+++o+o++o

### Authors

BibTeX can be quite clever with names of authors. It can accept names in forename surname or surname, forename. I personally use the former, but remember that the order you input them (or any data within an entry for that matter) is customizable and so you can get BibTeX to manipulate the input and then output it however you like. If you use the forename surname method, then you must be careful with a few special names, where there are compound surnames, for example "John von Neumann". In this form, BibTeX assumes that the last word is the surname, and everything before is the forename, plus any middle names. You must therefore manually tell BibTeX to keep the 'von' and 'Neumann' together. This is achieved easily using curly braces. So the final result would be "John {von Neumann}". This is easily avoided with the surname, forename, since you have a comma to separate the surname from the forename.

Secondly, there is the issue of how to tell BibTeX when a reference has more than one author. This is very simply done by putting the keyword and in between every author. As we can see from another example:

This book has three authors, and each is separated as described. Of course, when BibTeX processes and outputs this, there will only be an 'and' between the penultimate and last authors, but within the .bib file, it needs the ands so that it can keep track of the individual authors.

### Standard templates

Be careful if you copy the following templates, the % sign is not valid to comment out lines in bibtex files. If you want to comment out a line, you have to put it outside the entry.

@article
An article from a magazine or a journal.
• Optional fields: volume, number, pages, month, note.
@article{Xarticle,author="",title="",journal="",%volume="",%number="",%pages="",year="XXXX",%month="",%note="",}
@book
A published book
• Optional fields: volume/number, series, address, edition, month, note.
@booklet
A bound work without a named publisher or sponsor.
• Optional fields: author, howpublished, address, month, year, note.
@conference
Equal to inproceedings
• Optional fields: editor, volume/number, series, pages, address, month, organization, publisher, note.
@inbook
A section of a book without its own title.
• Optional fields: volume/number, series, type, address, edition, month, note.
@incollection
A section of a book having its own title.
• Optional fields: editor, volume/number, series, type, chapter, pages, address, edition, month, note.
@inproceedings
An article in a conference proceedings.
• Optional fields: editor, volume/number, series, pages, address, month, organization, publisher, note.
@manual
Technical manual
• Optional fields: author, organization, address, edition, month, year, note.
@mastersthesis
Master's thesis
• Optional fields: type (eg. "diploma thesis"), address, month, note.
@misc
Template useful for other kinds of publication
• Optional fields: author, title, howpublished, month, year, note.
@misc{Xmisc,%author="",%title="",%howpublished="",%year="XXXX",%month="",%note="",}
@phdthesis
Ph.D. thesis
• Optional fields: address, month, keywords, note.
@proceedings
The proceedings of a conference.
• Optional fields: editor, volume/number, series, address, month, organization, publisher, note.
@techreport
Technical report from educational, commercial or standardization institution.
• Optional fields: type, number, address, month, note.
@unpublished
An unpublished article, book, thesis, etc.
• Optional fields: month, year.
@unpublished{Xunpublished,author="",title="",%year="",%month="",note="",}

### Non-standard templates

@patent
BibTeX entries can be exported from Google Patents.
(see Cite Patents with Bibtex for an alternative)
@collection
@electronic
@Unpublished
For citing arXiv.org papers in a REVTEX-style article
(see REVTEX Author's guide)

### Preserving case of letters

In the event that BibTeX has been set by the chosen style not to preserve all capitalization within titles, problems can occur, especially if you are referring to proper nouns, or acronyms. To tell BibTeX to keep them, use the good old curly braces around the letter in question, (or letters, if it's an acronym) and all will be well! It is even possible that lower-case letters may need to be preserved - for example if a chemical formula is used in a style that sets a title in all caps or small caps, or if "pH" is to be used in a style that capitalises all first letters.

However, avoid putting the whole title in curly braces, as it will look odd if a different capitalization format is used:

For convenience though, many people simply put double curly braces, which may help when writing scientific articles for different magazines, conferences with different BibTex styles that do sometimes keep and sometimes not keep the capital letters:

As an alternative, try other BibTex styles or modify the existing. The approach of putting only relevant text in curly brackets is the most feasible if using a template under the control of a publisher, such as for journal submissions. Using curly braces around single letters is also to be avoided if possible, as it may mess up the kerning, especially with biblatex,[1] so the first step should generally be to enclose single words in braces.

Below you will find a few additional examples of bibliography entries. The first one covers the case of multiple authors in the Surname, Firstname format, and the second one deals with the incollection case.

@article{AbedonHymanThomas2003,author="Abedon, S. T. and Hyman, P. and Thomas, C.",year="2003",title="Experimental examination of bacteriophage latent-period evolution as a response to bacterial availability",journal="Applied and Environmental Microbiology",volume="69",pages="7499--7506"}@incollection{Abedon1994,author="Abedon, S. T.",title="Lysis and the interaction between free phages and infected cells",pages="397--405",booktitle="Molecular biology of bacteriophage T4",editor="Karam, Jim D. Karam and Drake, John W. and Kreuzer, Kenneth N. and Mosig, Gisela and Hall, Dwight and Eiserling, Frederick A. and Black, Lindsay W. and Kutter, Elizabeth and Carlson, Karin and Miller, Eric S. and Spicer, Eleanor",publisher="ASM Press, Washington DC",year="1994"}

If you have to cite a website you can use @misc, for example:

@misc{website:fermentas-lambda,author="Fermentas Inc.",title="Phage Lambda: description \& restriction map",month="November",year="2008",url="http://www.fermentas.com/techinfo/nucleicacids/maplambda.htm"}

The note field comes in handy if you need to add unstructured information, for example that the corresponding issue of the journal has yet to appear:

@article{blackholes,author="Rabbert Klein",title="Black Holes and Their Relation to Hiding Eggs",journal="Theoretical Easter Physics",publisher="Eggs Ltd.",year="2010",note="(to appear)"}

### Getting current LaTeX document to use your .bib file

At the end of your LaTeX file (that is, after the content, but before ), you need to place the following commands:

\bibliographystyle{plain}\bibliography{sample1,sample2,...,samplen}% Note the lack of whitespace between the commas and the next bib file.

Bibliography styles are files recognized by BibTeX that tell it how to format the information stored in the file when processed for output. And so the first command listed above is declaring which style file to use. The style file in this instance is (which comes as standard with BibTeX). You do not need to add the .bst extension when using this command, as it is assumed. Despite its name, the plain style does a pretty good job (look at the output of this tutorial to see what I mean).

The second command is the one that actually specifies the file you wish to use. The ones I created for this tutorial were called , , . . ., , but once again, you don't include the file extension. At the moment, the file is in the same directory as the LaTeX document too. However, if your .bib file was elsewhere (which makes sense if you intend to maintain a centralized database of references for all your research), you need to specify the path as well, e.g or (if the file is in the parent directory of the document that calls it).

Now that LaTeX and BibTeX know where to look for the appropriate files, actually citing the references is fairly trivial. The is the command you need, making sure that the ref_key corresponds exactly to one of the entries in the .bib file. If you wish to cite more than one reference at the same time, do the following: .

### Why won't LaTeX generate any output?

The addition of BibTeX adds extra complexity for the processing of the source to the desired output. This is largely hidden from the user, but because of all the complexity of the referencing of citations from your source LaTeX file to the database entries in another file, you actually need multiple passes to accomplish the task. This means you have to run LaTeX a number of times. Each pass will perform a particular task until it has managed to resolve all the citation references. Here's what you need to type (into command line):

(Extensions are optional, if you put them note that the bibtex command takes the AUX file as input.)

After the first LaTeX run, you will see errors such as:

LaTeX Warning: Citation `lamport94' on page 1 undefined on input line 21. ... LaTeX Warning: There were undefined references.

The next step is to run bibtex on that same LaTeX source (or more precisely the corresponding AUX file, however not on the actual .bib file) to then define all the references within that document. You should see output like the following:

This is BibTeX, Version 0.99c (Web2C 7.3.1) The top-level auxiliary file: latex_source_code.aux The style file: plain.bst Database file #1: sample.bib

The third step, which is invoking LaTeX for the second time will see more errors like "". Don't be alarmed, it's almost complete. As you can guess, all you have to do is follow its instructions, and run LaTeX for the third time, and the document will be output as expected, without further problems.

If you want a pdf output instead of a dvi output you can use instead of as follows:

(Extensions are optional, if you put them note that the bibtex command takes the AUX file as input.)

Note that if you are editing your source in vim and attempt to use command mode and the current file shortcut (%) to process the document like this:

You will get an error similar to this:

It appears that the file extension is included by default when the current file command (%) is executed. To process your document from within vim, you must explicitly name the file without the file extension for bibtex to work, as is shown below:

1. (without file extension, it looks for the AUX file as mentioned above)

However, it is much easier to install the Vim-LaTeX plugin from here. This allows you to simply type \ll when not in insert mode, and all the appropriate commands are automatically executed to compile the document. Vim-LaTeX even detects how many times it has to run pdflatex, and whether or not it has to run bibtex. This is just one of the many nice features of Vim-LaTeX, you can read the excellent Beginner's Tutorial for more about the many clever shortcuts Vim-LaTeX provides.

Another option exists if you are running Unix/Linux or any other platform where you have make. Then you can simply create a Makefile and use vim's make command or use make in shell. The Makefile would then look like this:

latex_source_code.pdf: latex_source_code.tex latex_source_code.bib pdflatex latex_source_code.tex bibtex latex_source_code.aux pdflatex latex_source_code.tex pdflatex latex_source_code.tex

### Including URLs in bibliography

As you can see, there is no field for URLs. One possibility is to include Internet addresses in field of or field of , , :

Note the usage of command to ensure proper appearance of URLs.

Another way is to use special field and make bibliography style recognise it.

You need to use in the first case or in the second case.

Styles provided by Natbib (see below) handle this field, other styles can be modified using urlbst program. Modifications of three standard styles (plain, abbrv and alpha) are provided with urlbst.

If you need more help about URLs in bibliography, visit FAQ of UK List of TeX.

### Customizing bibliography appearance

One of the main advantages of BibTeX, especially for people who write many research papers, is the ability to customize your bibliography to suit the requirements of a given publication. You will notice how different publications tend to have their own style of formatting references, to which authors must adhere if they want their manuscripts published. In fact, established journals and conference organizers often will have created their own bibliography style (.bst file) for those users of BibTeX, to do all the hard work for you.

It can achieve this because of the nature of the .bib database, where all the information about your references is stored in a structured format, but nothing about style. This is a common theme in LaTeX in general, where it tries as much as possible to keep content and presentation separate.

A bibliography style file () will tell LaTeX how to format each attribute, what order to put them in, what punctuation to use in between particular attributes etc. Unfortunately, creating such a style by hand is not a trivial task. Which is why (also known as custom-bib) is the tool we need.

can be used to automatically generate a .bst file based on your needs. It is very simple, and actually asks you a series of questions about your preferences. Once complete, it will then output the appropriate style file for you to use.

It should be installed with the LaTeX distribution (otherwise, you can download it) and it's very simple to initiate. At the command line, type:

latex makebst

LaTeX will find the relevant file and the questioning process will begin. You will have to answer quite a few (although, note that the default answers are pretty sensible), which means it would be impractical to go through an example in this tutorial. However, it is fairly straight-forward. And if you require further guidance, then there is a comprehensive manual available. I'd recommend experimenting with it and seeing what the results are when applied to a LaTeX document.

If you are using a custom built .bst file, it is important that LaTeX can find it! So, make sure it's in the same directory as the LaTeX source file, unless you are using one of the standard style files (such as plain or plainnat, that come bundled with LaTeX - these will be automatically found in the directories that they are installed. Also, make sure the name of the file you want to use is reflected in the command (but don't include the extension!).

### Localizing bibliography appearance

When writing documents in languages other than English, you may find it desirable to adapt the appearance of your bibliography to the document language. This concerns words such as editors, and, or in as well as a proper typographic layout. The package can be used here. For example, to layout the bibliography in German, add the following to the header:

\usepackage[fixlanguage]{babelbib}\selectbiblanguage{german}

Alternatively, you can layout each bibliography entry according to the language of the cited document:

The language of an entry is specified as an additional field in the BibTeX entry:

@article{mueller08,%...language={german}}

For to take effect, a bibliography style supported by it - one of , , , , , and - must be used:

\bibliographystyle{babplain}\bibliography{sample}

### Showing unused items

Usually LaTeX only displays the entries which are referred to with . It's possible to make uncited entries visible:

\nocite{Name89}% Show Bibliography entry of Name89\nocite{*}% Show all Bib-entries

### Getting bibliographic data

Many online databases provide bibliographic data in BibTeX-Format, making it easy to build your own database. For example, Google Scholar offers the option to return properly formatted output, which can also be turned on in the settings page.

One should be alert to the fact that bibliographic databases are frequently the product of several generations of automatic processing, and so the resulting BibTex code is prone to a variety of minor errors, especially in older entries.