using bibtex and biblatex: a short guide
author
intro
BibTeX and its offspring BibLaTeX automate most of the work involved in managing references for use in LaTeX files. You need to type each reference only once, and your citations and reference list are automatically formatted consistently, in a style of your choosing.
Your references are stored in a plain text database with a simple format. When you want to cite an item in the database in a LaTeX document, you write \cite{<label>}
(or something similar), where <label>
is the label attached to the item in the database. You put a command in your LaTeX file specifying the style in which you want the references to appear in the bibliography of the document and another command specifying the location of your reference database. You then get your LaTeX editor to process the LaTeX file with pdflatex
or one of its cousins, then bibtex
(for BibTeX) or biber
(for BibLaTeX), and finally with pdflatex
again.
Managing your references in this way has several benefits.
- You need to type each reference only once. Once it is in your database, it can be included in any document you write merely by your typing its label.
- The style of all your citations in any given document will be consistent. If, for example, the style you use causes
\cite{arrow72}
to produce "Arrow (1972)", then you'll never find "Arrow [1972]" in your paper. - If you cite more than one paper by the same author in the same year, the appropriate letters will be appended to the years—you won't need to fiddle around with them and change "Arrow (1972)" to "Arrow (1972a)" when you add a reference to another paper published by Arrow in 1972.
- You never need to fuss with the style of the list of references at the end of your document. All you need to do is to specify the location of your
bibtex
database and the name of the style you wish to use to format your references. Then all the items you cite will be extracted from the database, ordered correctly, and formatted at the end of your document according to the specifications of the style you specify. - Every item you cite will appear in the list of references in your document, and every item in that list will be one you cite (unless you explicitly specify otherwise)—avoiding the need for a manual check.
- If you wish, you can help your readers by including after each item in your list of references a list of the page numbers on which you cite the item.
how to
Here's what you need to do. Click on a section heading to show/hide the section.
- 1. Create a bibliography database
-
Whether you use BibTeX or BibLaTeX to process your document, your references are stored in a BibTeX database, a plain text file that must have the extension
bib
.Format
A BibTeX database file consists of blocks of text, one for each item. Each block specifies the type of the item (article, book, ...), a label by which the item can be referred when cited, and a list of the components of the item — its authors, title, etc.
Here is an example of the format. Hover over (or, on a touch device, tap on) orange text to see explanations. For each item type, the required fields are highlighted. ("Required" doesn't exactly have the meaning you would expect. I discuss it later.)
For standard BibTeX styles a book may have an@
article{article
specifies the type of the item. Many types are available, especially in BibLaTeX. The most commonly-used ones are listed on this page:article
,book
,incollection
(for a chapter in an edited volume),inproceedings
(for an article in conference proceedings),techreport
(for a report, like a "Working paper" or "Technical report", issued by an institution),phdthesis
(andmastersthesis
), andunpublished
. The case of the letters in the name of the type is insignificant; you can writeArticle
orARTICLE
, for example.ahu61author = {This string is a label that you use to refer to the item when you cite it. It can be any string without spaces.,Arrow, Kenneth J. and Leonid Hurwicz and Hirofumi Uzawa}, title = {The list of authors. Note that "and" appears between every pair of authors. (Of course, when the reference is formatted in your document, only the "ands" specified by the bibliography style you choose will appear.) BibTeX interpretsArrow, Kenneth J.
,Kenneth J. Arrow
, andKenneth Joseph Arrow
to refer to an author whose last name is "Arrow" and whose forenames are "Kenneth J." or "Kenneth Joseph". If you want to refer to an item by John Maynard Smith (whose last name was "Maynard Smith"), you need to format the name asMaynard Smith, John
orJohn {Maynard Smith}
. It's not exactly the case that BibTeX takes the string following the last space to be the last name. If that string is preceded by a string or strings that start with lowercase letters, those strings as well as the final string are treated as the last name. For example, if you writeErnesto Guevara de la Serna
, BibTeX interprets "de la Serna" to be the last name, which is wrong—his last name was Guevara de la Serna; you need to writeGuevara de la Serna, Ernesto
. For an "author" that is the name of an organization, like "World Health Organization", you need to enclose the name in braces:author = {{World Health Organization}}
. If you omit the braces, BibTeX will interpret "Organization" as the family name of the author and "World" and "Health" as the forenames, so that you style might format the author as "Organization, World Health" or "Organization, W. H." If your author field ends "and others", the formatted output typically ends with "et al.".Constraint qualifications in maximization problems},Do not surround the title by quotation marks. If the bibliography style you use puts titles in quotation marks, it will do it for you.= {Naval Research Logistics Quarterly}, year =If you are using BibLaTeX, you can alternatively call this fieldjournaljournaltitle
.1961, volume = {8}, number = {2}, pages = {If the value of a field consists only of digits, the braces around it can be omitted.175-191} doi = {You can alternatively enter175--191
. Either way, when BibTeX of BibLaTeX formats your reference it will insert an en-dash between the pages, if that is what your bibliography style specifies (which it should).10.1007/978-3-0348-0439-4_4} url = {This field is supported by BibLaTeX, but not by all BibTeX styles. Some BibTeX styles that support it require each underscore (_) to be escaped (that is, preceded by a backslash (\)). I discuss the use of nonstandard BibTeX fields later.https://onlinelibrary.wiley.com/doi/abs/10.1002/nav.3800080206} } @book{ab94, author = {Charalambos D. Aliprantis and Kim C. Border}, year = {1994}, title = {Infinite Dimensional Analysis},Like the doi field, this field is supported by BibLaTeX but not by all BibTeX styles.= {Springer}, address = {Berlin} }For BibLaTeX, this field is classified as "optional".publishereditor
rather than anauthor
, but not both. For BibLaTeX it can have both.
The item type@incollection{m85, author = {Maskin, Eric S.}, year = {1985}, title = {The theory of implementation in
{N}ashequilibrium: a survey}, booktitle = {Social Goals and Social Organization},The fact that the first letter of "Nash" is enclosed in braces tells BibTeX that if a bibliography style calls for titles to use "sentence capitalization" (only the first letter of the title and the first letter of any proper nouns are capitalized) then the first letter of "Nash" should remain uppercase and not be lowercased.editor= {Leonid Hurwicz and David Schmeidler and Hugo Sonnenschein}, pages = {173-204},For BibLaTeX, this field is classified as "required".= {Cambridge University Press}, address = {Cambridge} } @inproceedings{ah2006, author = {Aggarwal, Gagan and Hartline, Jason D.}, year = {2006}, title = {Knapsack auctions}, booktitle = {Proceedings of the 17th Annual ACM-SIAM Symposium on Discrete Algorithms}, pages = {1083-1092}, publisher = {Association for Computing Machinery}, address = {For BibLaTeX, this field is classified as "optional".publisherNew York} } @phdthesis{Peters2019, author = {Peters, Dominik},Some BibTeX styles (annoyingly) interpret the address field for an inproceedings item to be the location of the conference rather than the city of publication as it is for every other item type. In fact, all the standard styles do so, but fortunately most other styles do not.= {University of Oxford}, title = {Fair division of the commons}, year = {2019} }For BibLaTeX, you can alternatively call this field "institution".schoolmastersthesis
is similar. BibLaTeX has a more general item type,@thesis
, with a requiredtype
field that can be set to "PhD", "Masters", or whatever you want.
Notes@techreport{arrow48, author = {Arrow, Kenneth J.}, title = {The possibility of a universal social welfare function}, institution = {RAND Corporation}, year = {1948}, number = {P-41}, type = {Report} } @
online{Wikipedia2024, author = {Wikipedia}, year = {2024},This type is supported by BibLaTeX, but by only a few BibTeX styles. However, every BibTeX style file specifies a default type, which is used for types that it does not explicitly support. For most BibTeX styles, this default type ismisc
, for which the standard fields aretitle
,author
,year
,month
,note
, andhowpublished
. Some BibTeX styles also allow the fieldurl
formisc
items, which is obviously an essential field for a reference to a website. See this page to find BibTeX styles that support either theonline
type or allowurl
as a field for themisc
item type.= {2024-10-3}, title = {BibTeX}, url = {https://en.wikipedia.org/wiki/BibTeX},Supported by BibLaTeX, but not by theurldatemisc
item type of standard BibTeX styles.= {Accessed 2024-10-3} } @unpublished{FudenbergKreps1988, title = {A theory of learning, experimentation, and equilibrium in games}, author = {Fudenberg, Drew and Kreps, David M.},Should be omitted for a style that supports thenoteurldate
field.year= {1988},For BibLaTeX, this field is classified as "required".= {Unpublished paper} }For BibLaTeX, this field is classified as "optional".note- More item types are available — for BibLaTeX, a dizzying number. For BibTeX, see pp. 8–9 of this document and for BibLaTeX see pp. 9–14 of this document.
- For each item type, additional fields are supported. For the
article
type, for example, standard BibTeX supportsmonth
andnote
fields and BibLaTeX supports a whole host of fields. See pp. 9–14 of this document for the fields that BibLaTeX supports for each item type. - The order of the fields for each item is unimportant.
- You can include as many spaces before the field names and around the equals signs as you wish.
- If you are using BibLaTeX, you can replace any
year
field with adate
field, the content of which must be inyyyy-mm-dd
format. - The file can contain references you don't cite. BibTeX will include in the list of references at the end of your paper only the ones that you cite (unless you explicitly tell it otherwise).
Fields standard and nonstandard, required and optional
I refer to the fields supported by the style files that are distributed with BibTeX and BibLaTeX as "standard". The documentation for each system classifies the supported fields as "required" and "optional", but these designations have little meaning. Obviously a field that does not appear in an entry in your BibTeX database cannot appear in a formatted reference (after processing by LaTeX). At worst the formatted reference may look odd, and I suppose the idea is that for a "required" field that is likely to be the case, although I'm not sure it generally is. (The original documentation for BibTeX says that you will get an error message if a required field is missing, although the system I use for testing purposes (TeXstudio with TeX live) reports no error as far as I can see.)
Anyone can create a BibTeX or BibLaTeX style file. (For BibTeX, there are hundreds of such "nonstandard" style files. The ones that users of text2bib report using are listed on this page.) A style designer is free to create whatever item types she likes and support any fields for these types.
In brief,
- the entry in a BibTeX database can include any fields you wish
- only the fields referred to in the style file you specify will be used when you process your document with LaTeX
- if a field referred to in the style file you specify is missing from an entry in your BibTeX database, the formatted reference might look odd (whether the field is standard or nonstandard, required or optional).
How to create a BibTeX database file
Here are some options.
-
Type the database from scratch, using a plain text editor like Notepad++. Remember to save the file with the extension
bib
, nottxt
. - Enter the items into a program specifically designed to edit BibTeX database files, like JabRef.
- Convert references from text format to BibTeX format using text2bib.
- Export references from Google Scholar into BibTeX after choosing BibTeX in the "Bibliography manager" section of your Scholar Preferences. (Note, however, that the accuracy of these references is not high.)
- 2. Decide whether to use BibTeX or BibLaTeX
-
You have two options for extracting the items you cite from your BibTeX database and formatting them: BibTeX (confusingly the same name that's used for the database format) and biber, provided by the BibLaTeX system. Which one should you use?
tl;dr:
-
If you are going to cite mostly journal articles, books, and articles in collected volumes, these items mostly have only the common components, like author, title, and journal name, and you can find a BibTeX style file that you like that supports
doi
s andurl
s (which you will probably want to include in your references at some point, even if you don't do so currently), then BibTeX suffices. But the only real disadvantages of using BibLaTeX instead relate to sharing your BibTeX database file with other people: if you populate this file with fields supported by BibLaTeX but not by any BibTeX style, anyone with whom you share the file will have to use BibLaTeX. - If you are going to cite a lot of sources with components not supported by any BibTeX style files, like books with translators, annotators, and editors as well as authors, and you can find a BibLaTeX style you like (or adjust one to fit your taste) then you are better off using BibLaTeX.
Details:
You want a system that a. supports the item types you cite, b. for each item type, has fields for most of the components of your references (limiting the frequency with which you have to put information in a
note
field), and c. has all the features relating to the structure of your reference list that you need.-
Standard BibTeX supports 13 item types; standard BibLaTeX supports 25. Notably absent from the list for standard BibTeX is the
online
type, for websites. However, every BibTeX style file specifies a default item type that is used for any type in the BibTeX database that it does not handle explicitly. Most styles makemisc
the default type, and as long as this type supports theurl
field — or you add such support yourself — it is probably suitable for a website. If you use BibTeX and have some items that include information not covered by the standard fields, you can put that information in thenote
field. A disadvantage of doing so is that you will have to remember to format that information consistently and it will always appear where the style places thenote
field, typically at the end of the reference.But if you regularly cite a lot of websites, or patents, or multi-volume books — which have their own types in BibLaTeX but not in BibTeX — and you want their formatting in your reference list to be consistent, BibLaTeX is the answer.
-
For most item types, standard BibLaTeX supports many more fields than does standard BibTeX. To give an example, standard BibTeX supports the following fields for an article:
author
,title
,journal
,year
,volume
,number
,pages
,month
,note
. BibLaTeX supportsauthor
,title
,journaltitle
,year/date
,translator
,annotator
,commentator
,subtitle
,titleaddon
,editor
,editora
,editorb
,editorc
,journalsubtitle
,journaltitleaddon
,issuetitle
,issuesubtitle
,issuetitleaddon
,language
,origlanguage
,series
,volume
,number
,eid
,issue
,month
,pages
,version
,note
,issn
,addendum
,pubstate
,doi
,eprint
,eprintclass
,eprinttype
,url
,urldate
.Apart from
doi
,url
, andurldate
, which are supported by some BibTeX styles (and can be added to any style fairly easily), I have never needed any of the other additional fields supported by BibLaTeX. But maybe you do. - BibLaTeX has extensive support for languages other than English, and according to the documentation supports "subdivided bibliographies, multiple bibliographies within one document, ... customisable sorting, multiple bibliographies with different sorting, customisable labels and dynamic data modification". I haven't used any of these features, and indeed am not sure what some of them mean. But if you need them then BibLaTeX is the way to go.
-
If you are going to cite mostly journal articles, books, and articles in collected volumes, these items mostly have only the common components, like author, title, and journal name, and you can find a BibTeX style file that you like that supports
- 3. Choose a style for your citations and bibliography
-
BibTeX
When BibTeX was introduced in the mid-1980s, four "standard" bibliography style files were available (
plain
,unsrt
,alpha
, andabbrv
), none of which of course supporteddoi
s orurl
s. Now hundreds of styles are available. The four originals plus four more that are included in the standard LaTeX distribution are illustrated with examples on this page on the Overleaf site. These styles and a bunch more are illustrated on this page on my text2bib site; on this page you can search for styles according to the fields they support. A much longer list is given on this page on the Paperpile site.Where should you put a style file not included with a standard LaTeX installation?
-
If you are using TeXlive, put a new style file in the directory
\texlive\texmf-local\bibtex\bst
. Then run the TeXlive programtlshell
(which on Windows is inC:\texlive\<year>\bin\windows\tlshell.exe
, where<year>
is the year of your edition). ClickActions
thenRegenerate filename database
. -
If you are using MikTeX, put a new style file in the directory
\localtexmf\bibtex\bst
. Then open MikTeX and chooseSettings
thenGeneral
thenRefresh FNDB
.
Then the program you use for LaTeX (e.g. TeXstudio) will be able to find the style.
What if you cannot find a style that you like?
-
If you find a style that almost suits you, you may be able to fix its deficiencies. The language in which
bst
files are written is specific to these files. The name of the category of languages to which it belongs — postfix stack languages — may seem forbidding, but the language is pretty simple. It is documented in the file "Designing BibTeX styles" by Oren Patashnik (February 8, 1988), which I found here, and in "Tame the BeaST" by Nicolas Markey (October 11, 2009), which I found here. Section 13.8 of "The LaTeX Companion" by Goossens, Mittelbach, and Samarin (1994) discusses how to make small changes in abst
file. - You can alternatively create a new style file from scratch using the custom-bib package. You run TeX on a file, which initiates a long list of questions about the features of the style you would like. You'll probably not be completely clear about your preferred answers to all the questions on your first attempt, but two or three runs should produce a format to your liking.
BibLaTeX
The BibLaTeX manual has links to examples (pp. 75–81), but inconveniently each link points to a pdf file that has to be viewed separately, and there is no search. The list on this page on the Overleaf site is more user-friendly, but illustrates the formatting of only books and articles.
If none of the standard BibLaTeX styles is exactly to your liking, you can select one that is close and then modify it by adding commands to the preamble of your document. Here are some examples.
-
A peculiar feature of the standard BibLaTeX styles is the use of "In:" before journal names in references to journal articles. You probably want to remove it. You can do so by putting
after the\renewbibmacro{in:}{% \ifentrytype{article}{}% {\printtext{\bibstring{in}\intitlepunct}}}
\usepackage{biblatex}
command in the preamble to your document. (If you want to remove "In:" for all entry types, make that\renewbibmacro{in:}{}
.) Another way to do it is use one of the styles in the biblatex-ext package with the optionarticlein=false
. (For more on this point, see this page.) -
BibLaTeX styles support the
urldate
field, but note that the format of this field in the BibTeX database file must beyyyy-mm-dd
. If it is not in this format, it is ignored. -
You might not like the fact that the
urldate
field for a dateyyyy-mm-dd
produces "(visited on mm/dd/yyyy)" in your reference list. For one thing, that date format is ambiguous for many dates, and for another thing you may want to say something other than "visited on".Visited on: To change "visited on" to "accessed" for an
online
item, put
in the preamble of your document.\DefineBibliographyStrings{english}{ urlseen = {accessed} }
Date format: Predefined date formats are listed on p. 56 of the BibLaTeX manual. To change the format of
urldate
to the sensibleyyyy-mm-dd
format, addurldate=iso
as an option in the\usepackage
command that loadsbiblatex
. If, like me, you prefer periods to dashes between the elements of the date, you can add the following code (which also changes "visited on" to "accessed") to the preamble of your document.
Apparently that's not the best way to make such a change, but it works perfectly well for me. (If you know the best way, let me know.)\DeclareFieldFormat{urldate}{% (accessed \thefield{urlyear}\adddot% \thefield{urlmonth}\adddot% \thefield{urlday}\isdot)}
-
The "URL:" and "DOI:" in front to urls and dois in the standard styles seem completely unnecessary (and ugly). You can remove them by putting in the preamble of your document
(I am assuming you are using the\DeclareFieldFormat{url}{\url{#1}} \DeclareFieldFormat{doi}% {\href{https://doi.org/#1}{\texttt{#1}}}
hyperref
package, which defines\href
.) -
If you don't want page ranges to be preceded by "pp.", put in the preamble of your document
If you want to omit the "pp." only for articles, use\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat[article]{pages}{#1}
-
If you have ISSN's in your
bib
file but you don't want them to appear in the references in your document, include in the preamble to the document
(Or delete them from you\AtEveryBibitem{\clearfield{issn}}
bib
file if you are never going to use them.)
-
If you are using TeXlive, put a new style file in the directory
- 4. Create a LaTeX file with references to your bibliography database
-
Your LaTeX file needs to include
- a reference to a label in your BibTeX file whenever you want to cite an item in the file
- a reference to the bibliography style file you want to use, which determines how the references you cite are formatted in the bibliography of your document (and possibly a LaTeX style file associated with the bibliography style)
- a LaTeX command to generate the bibliography at the point in your document where you want it to appear.
I now give examples using BibTeX and BibLaTeX. In both cases I assume that you have a BibTeX database
research.bib
in the directory\home\bib
of your computer that contains the following two entries:@article{ArrowHurwiczUzawa1961NRLQ, author = {Arrow, Kenneth J. and Leonid Hurwicz and Hirofumi Uzawa}, title = {Constraint qualifications in maximization problems}, journal = {Naval Research Logistics Quarterly}, volume = {8}, year = {1961}, pages = {175-191}, doi = {10.1007/978-3-0348-0439-4_4}, } @online{Wikipedia2024, author = {Wikipedia}, year = {2024}, title = {BibTeX}, url = {https://en.wikipedia.org/wiki/BibTeX}, urldate = {2024-10-03}, }
Example using BibTeX
Here is a bare-bones LaTeX file that uses the BibTeX style
plain
, which comes with every standard LaTeX installation. Lines relating to BibTeX are highlighted; hover over (or, on a touch device, tap) orange text to see explanations.\documentclass{article} \begin{document} For details, see
\cite{ArrowHurwiczUzawa1961NRLQ}and \cite{Wikipedia2024}.This command tells LaTeX to insert a citation to the item with labelArrowHurwiczUzawa1961NRLQ
in your BibTeX database file.\bibliographystyle{plain}This command tells BibTeX to use the bibliography style fileplain.bst
.\bibliography{/home/bib/research}\end{document}This command tells BibTeX to insert here a formatted list of the items in your bibliography database file/home/bib/research.bib
that are cited in this document. Notice that the path separator character is a forward slash, even on a system like Windows that uses a different character.After you process this file (details in the next section) you will get this output:
Notice that although the entry in the BibTeX database for the first item includes a
doi
field and the entry for the second item includesurl
andurldate
fields, these fields do not appear in the formatted references. That is because theplain
BibTeX style does not support those fields. The styleplainurl
(available here) does support thedoi
andurl
fields (but not theurldate
field), and produces output that is otherwise similar to the output produced byplain
.Notice also that although the
plain
style does not define anonline
item type, the online item in the BibTeX database file appears in the references. That is becauseplain.bst
, like most BibTeX style files, has a default setting that uses themisc
item type for any type that it does not explicitly support. Of course, that means that only fields supported by themisc
type appear in the reference to theonline
item.(If you know how to run a Perl script, you can use the script
urlbst
on this page to adddoi
andurl
fields and awebpage
item type to any BibTeX style file. If you do so, you might want to replacewebpage
throughout the resulting file withonline
, the name of the item type used by BibLaTeX, so that the file is compatible with BibTeX databases that can be used with either BibTex or BibLaTeX.)None of the BibTeX style files that come with standard LaTeX installations produces citations in
author (year)
format, but many such nonstandard styles exist. Here is an example using themla
style (available here). Like most such styles it requires the LaTeX packagenatbib
, which comes with a standard LaTeX installation. (If you don't have it, you can get it at this page.)\documentclass{article}
\usepackage{natbib}\begin{document} For details, seeThis command loads thenatbib
style, used with many BibTeX style files to produce citations in the Name (year) format.\cite{ArrowHurwiczUzawa1961NRLQ}and \cite{Wikipedia2024}.This command tells LaTeX to insert a citation to the item with labelArrowHurwiczUzawa1961NRLQ
in your BibTeX database file.\bibliographystyle{mla}This command tells BibTeX to use the bibliography style filemla.bst
.\bibliography{/home/bib/research}\end{document}This command tells BibTeX to insert here a formatted list of the items in your bibliography database file/home/bib/research.bib
that you have cited. Notice that the path separator character is a forward slash, even on a system like Windows that uses a different character.After you process this file (details in the next section) you will get this output:
Like the
plain
style file,mla
does not support thedoi
,url
, orurldate
fields and does not define anonline
item type. Among the styles that do so, the one I like best ismjo
, available here. (I created it by editing by hand the output produced by a run ofcustom-bib
(discussed in the previous section).) Likemla
, it requires thenatbib
package. It requires also thehyperref
packages, which, likenatbib
, is probably already on your computer. If it isn't, you can get it here.Here's an example of the use of the
mjo
style. The LaTeX file\documentclass{article}
\usepackage{natbib}This command loads thenatbib
style, used with many BibTeX style files to produce citations in the Name (year) format.\usepackage{color}This command loads thecolor
style, which allows new named colors to be defined.\definecolor{mycolor}{rgb}{0, 0, 0.6}This command defines a color appropriate for URLs (a shade of blue), to avoid the horrible default colors of the hyperref package.\usepackage[colorlinks,urlcolor=blue,% citecolor=mycolor,linkcolor=mycolor]% {hyperref}\begin{document} For details, seeThis command loads thehyperref
package, which automatically makes URLs clickable. The options (colorlinks
etc.) specify reasonable colors for URLs.\cite{ArrowHurwiczUzawa1961NRLQ}and \cite{Wikipedia2024}.This command tells LaTeX to insert a citation to the item with labelArrowHurwiczUzawa1961NRLQ
in your BibTeX database file.\bibliographystyle{mjo}This command tells BibTeX to use the bibliography style filemjo.bst
.\bibliography{/home/bib/research}\end{document}This command tells BibTeX to insert here a formatted list of the items in your bibliography database file/home/bib/research.bib
that you have cited. Notice that the path separator character is a forward slash, even on a system like Windows that uses a different character.produces the output
In this image, the links are not clickable, but in a pdf file they would be.
The citations in this example are produced by the
\cite
command. Here are some variants that you can use.\citet{key}
Jones et al. (1990) \citet*{key}
Jones, Baker, and Smith (1990) \citep{key}
(Jones et al. 1990) \citep*{key}
(Jones, Baker, and Smith 1990) \citep[p.~99]{key}
(Jones et al., 1990, p. 99) \citep[e.g.][]{key}
(e.g. Jones et al., 1990) \citep[e.g.][p.~99]{key}
(e.g. Jones et al., 1990, p. 99) \citeauthor{key}
Jones et al. \citeauthor*{key}
Jones, Baker, and Smith \citeyear{key}
1990 \citeapos{key}
*Jones et al.'s (1990) *Assumes \citeapos is defined in your style or document like this:
\def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}
Example using BibLaTeX
Here is a bare-bones LaTeX file that uses BibLaTeX.
\documentclass{article}
\usepackage{biblatex}This command tells LaTeX to use thebiblatex
package with the default style.\addbibresource{/xy/m/bib/test.bib}\begin{document} For details, seeThis command tells BibLaTeX to get references from the bibliography database file/home/bib/research.bib
. Notice that the path separator character is a forward slash, even on a system like Windows that uses a different character.\cite{ArrowHurwiczUzawa1961NRLQ}and \cite{Wikipedia2024}.This command tells LaTeX to insert a citation to the item with labelArrowHurwiczUzawa1961NRLQ
in your BibTeX database file.\printbibliography\end{document}This command tells BibTeX to insert here a formatted list of the items in your bibliography database file/home/bib/research.bib
mentioned in the\addbibresource
command in the preamble.After processing this file you'll get this output:
Modifying the style as discussed in the previous section leads to the file
\documentclass{article}
\usepackage% [natbib=true,dateabbrev=false,style=authoryear]% {biblatex}This command tells LaTeX to use thebiblatex
package with three options set.\addbibresource{/home/bib/research.bib}This command tells BibLaTeX to use the BibTeX bibliography databaseresearch.bib
in the/home/bib
directory of your computer.\renewbibmacro{in:}{% \ifentrytype{article}% {}% {\printtext{\bibstring{in}\intitlepunct}}% }This command tells BibLaTeX not to put "in" before the journal name in a reference to a journal article but to do in other situations, for example before titles of collected volumes.\DeclareFieldFormat{urldate}{% (accessed \thefield{urlyear}\adddot% \thefield{urlmonth}\adddot% \thefield{urlday}\isdot)% }This command tells BibLaTeX to format theurldate
field like this: (accessed 2024.10.17).\DeclareFieldFormat{doi}{\href{https://doi.org/#1}{\texttt{#1}}}This command tells BibLaTeX how to format thedoi
field.\DeclareFieldFormat{url}{\url{#1}}This command tells BibLaTeX how to format theurl
field.\DeclareFieldFormat[article]{pages}{#1}This command tells LaTeX to simply put the page range for apages
field, without the superfluous "pp.".\AtEveryBibitem{\clearfield{issn}}This command tells BibLaTeX to ignore any ISSN that is in the database.\usepackage{color}This command tells LaTeX to use thecolor
package, to define new named colors.\definecolor{mycolor}{rgb}{0, 0, 0.6}This command tells LaTeX to create the named colormycolor
package.\usepackage[colorlinks,urlcolor=blue,% citecolor=mycolor,linkcolor=mycolor]% {hyperref}\begin{document} For details, seeThis command tells LaTeX to use thehyperref
package with some sensible settings.\citet{ArrowHurwiczUzawa1961NRLQ}and \citet{Wikipedia2024}.This command (note:\citet
, not\cite
) tells LaTeX to insert a citation to the item with labelArrowHurwiczUzawa1961NRLQ
in your BibTeX database file.\printbibliography\end{document}This command tells BibTeX to insert here a formatted list of the items in your bibliography database file/home/bib/research.bib
mentioned in the\addbibresource
command in the preamble.The result of processing this file is
As before, although the links are not clickable in this image, they would be clickable in a pdf file.
BibLaTeX has many other options. The manual is long and dense, but if you want to make a change in the defaults, chances are that someone else has wanted to make the same change, and Googling will lead to a solution. (Thank you, StackExchange.)
- 5. Run LaTeX and BibTeX
-
Finally, you need to process your file with latex, then with bibtex (if you are using a BibTeX style) or biber (if you are using a BibLaTeX style), then one or two more times with latex. Processing your file with latex means running the file through pdflatex or one of its cousins. Doing so creates, among other things, a list of the labels of the items you cite; processing it with bibtex or biber reads this list, finds the items in your database, and writes a bibliography for your document, and processing it with latex again incorporates the bibliography into your document.
The system you use to edit and compile LaTeX files should provide an easy way for you to carry out this sequence of operations.
To set up the sequence of operations in TeXstudio (or verify that it is already set up), go to
Options
,Configure TeXstudio
and then clickBuild
on the left. In theBuild & View
drop-down chooseCompile & View
, in theDefault Compiler
drop-down choosePdfLaTeX
(orXeLaTeX
orLuaLaTeX
if you prefer), and in theDefault Bibliography Tool
drop-down chooseBibTeX
if you are using a BibTeX style file andbiber
if you are using BibLaTeX. ClickOK
. Pressing F5 will now carry out the sequence of steps needed to compile and, after a few seconds, view your document. (If you prefer to fiddle around with a mouse than to press a single key, clickTools
thenBuild & View
.)If in TeXstudio you are playing around with different style files, it's a good idea to delete the auxiliary files between runs (
Tools
,Clean auxiliary files
,OK
(or alt-t, a, Enter)). ("Clean" here is a delicate euphemism for "delete".)