I'll will give you a more basic approach without additional tools like JabRef.
In my opinion, these tools are fine and can make life a lot easier, but you should have a basic knowledge of what is going on under the hood.
Another example is latexmk
which takes care of the multiple runs of different programs needed for the finished document. But you should know how to do it by hand, to be able to solve problems on your own.
1. Choose your tool
bibtex
is the older method for automatically creating bibliographies in LaTeX.
If you are a beginner and have no existing code base that is using bibtex, you should use biblatex
with its backend biber
.
This has several advantages:
native support of unicode, which besides the simpler entering of the characters results in correct sorting for words containing non-ascii characters.
formatting of the bibliography is done using LaTeX-commands, not with an own idiom as it is with bibtex.
you can have multiple databases for your entries and multiple formats. Biber understands not just the bibtex .bib files but
- BIBTEX — BIBTEX data files
- endnotexml — Endnote XML export format, version C Endnote X1
- ris — Research Information Systems format
- zoterordfxml — Zotero RDF XML format, version 2.0.9
2. Create the database: a *.bib file
Bibfiles have the following structure:
each entry starts with an @
followed by the entrytype, e.g. article
.
Then in curly braces the key, which is used to cite the entry, after that key={value},
-pairs with the data for your entry. Each entry-type has mandatory and optional fields. Mandatory arguments for @article
are author
, year
or date
, title
and journal
. There are many different entry types and you should always choose the fitting one. See the biblatex docs.
An example:
@article{key,
author={Doe, John and Doe, Jane},
title={A super interesting Article},
year={2015},
Journal={Journal of unreproducible Results},
}
3. The .tex-file
To use biblatex, you have to add it to your preamble and tell it which database to use.
You can then cite entries with \cite{key}
, \cite
also takes a page number or a range as optional argument: \cite[15]{key}
.
The bibliography is created where you put the \printbibliography
command.
A complete example, assuming you saved your database in references.bib
looks like this:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{references.bib}
\begin{document}
See~\cite{key}.
\printbibliography
\end{document}
4. Compile the document
For the finished document, you need to run your latex compiler and biber:
E.g. using lualatex:
lualatex document.tex
biber document.bcf
lualatex document.tex
lualatex document.tex
In the first run, biblatex writes the needed citations to a file called document.bcf
, this file is read by biber which produces a file called document.bbl
which is then read in by biblatex again to produce your bibliography. The last run is needed to resolve crossreferences or changes in page numbers which might occure because the keys are exchanged with the citations.
Result:
biblatex
.biblatex
+biber
vs.natbib
+bibtex
, see bibtex vs. biber and biblatex vs. natbib..bib
file, see Convert from a textplain reference to bibtex.