22

I just started using LaTeX, so I have a very vague idea how to operate it. I am now trying to make a bibliography. From what I understood, I need a .bib document, which I then will insert with \bibliography{}.

My question is, how can I make a .bib file? I have an OpenOffice document that I'd like to use. Browsing a bit on the internet, there seems to exist a possibility to convert .bib files into other types, but I haven't found the right conversion. On bibtex.org the converter is disabled.

I have a feeling I'm doing something very wrong, can someone please help?

5

2 Answers 2

27

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:

  1. lualatex document.tex
  2. biber document.bcf
  3. lualatex document.tex
  4. 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:

result

7
  • 2
    (+1) In my opinion, it is better to use a dedicated tool like JabRef. It is very easy for a beginner (and even a not-so-beginner) a , or a { in the .bib file.
    – Bernard
    Commented Aug 7, 2015 at 19:20
  • 5
    Maybe. I think a little different about tools that make life easier. One should start with the manual way before making things easier and automated. In this order you understand what is happening and can fix problems yourself if something goes wrong.
    – MaxNoe
    Commented Aug 7, 2015 at 19:24
  • @MaxNoe why the biblatex tag to the question?
    – Johannes_B
    Commented Aug 7, 2015 at 19:47
  • 1
    @MaxNoe Tagging should be on the basis of questions not answers. See What's the policy on retagging questions based on answers? for some discussion.
    – Alan Munn
    Commented Aug 7, 2015 at 20:13
  • 1
    It's an alias, what's your point? I would always favor journal, because then the bib file can also be used with bibtex.
    – MaxNoe
    Commented Aug 7, 2015 at 23:56
10

To create a .bib file from scratch, the simplest is to use JabRef, a multiplatform bibliography manager written in java. You only have to choose the type of entries you want to cite (article, book, conference &c.), fill in forms for the relevant fields. JabRef has import and export functionalities.

Added: As @AlanMunn recalled, Mac users have another specific tool, Bibdesk, with many nice functionalities.

enter image description here

Once the .bib file is created you must use it in a latex document. At this point, you must choose if you want to do it with the traditional bibtex or with the more recent biber, which must be used with the latex package biblatex (biblatex is also compatible with bibtex, but uses biber by default).

I'll detail a little how to use biblatex: you have to load it, specifying its backend (bibtex or biber) and a number of options. By default the bibliography style is numeric. You write something like this in your preamble:

\usepackage[backend=biber, style=authoryear, other options]{biblatex}
\addbibresource{mybibliofile.bib}

Note you can have several bibliographic files. The .bib extension is mandatory.

In the body of the document, at the point where you want to print the bibliography, you just have to write, in the simplest case:

\printbibliography

If you want to incorporate all entries to the references (even those which are not cited in the text) add the command \nocite{*} before \printbibliography. Also note that biber understands utf8 encoding for your .bib files, and it has more functionalities than bibtex. Biblatex is much easier to customise than style files for bibtex, as it uses a latex-like syntax.

The compilation process is along the following steps:

  1. compile with pdflatex (or latex, or xelatex, or lualatex). This creates a .bcf file that biber will use.
  2. launch biber. This will create a .bbl file that pdflatex will use to incorporate the bibliographic entries into the main document.
  3. launch pdflatex twice to be sure the cross references are resolved.
7
  • 1
    You should add information on how to cite entries and on the compilation process.
    – MaxNoe
    Commented Aug 7, 2015 at 18:27
  • @MaxNoe I am a bit confused about the purpose. We have Question mark instead of citation number and also Biblatex with Biber: Configuring my editor to avoid undefined citations The question as it stands seems unclear to me. Instead of making up very verbose content, shouldn't we improve what is already out there and found by people using google?
    – Johannes_B
    Commented Aug 7, 2015 at 18:44
  • I understood the question has How do I get a bibliography and then some words he overheard or read on the internet.
    – MaxNoe
    Commented Aug 7, 2015 at 19:07
  • biber does not work with the aux file.
    – Johannes_B
    Commented Aug 7, 2015 at 19:15
  • 1
    If you are using a Mac, the preferred tool is BibDesk. Of course, JabRef can also be used, but BibDesk has a native Mac interface, and many really nice features.
    – Alan Munn
    Commented Aug 7, 2015 at 20:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .