BibTeX-Literaturlisten

Aus SDQ-Wiki

biblatex/biber

Die "klassische" Einbindung von BibTeX erfolgt über das Kommandozeilenprogramm bibtex. Dies bringt einige Nachteile mit sich:

  • BibTeX versteht kein UTF-8; Umlaute müssen in BibTeX-Dateien umständlich kodiert werden, z.B. ä als {\"{a}}
  • BibTeX gestattet keine Unterstriche in URLs, diese müssen ebenfalls escaped werden
  • BibTeX verwendet eine eigene komplizierte Sprache für seine Templates

Die modernere Variante ist daher, stattdessen BibLaTeX im Zusammenhang mit Biber zu verwenden, das die oben genannten Nachteile beseitigt und stattdessen viele Vorteile hat:

  • Verwendung von UTF-8 in den .bib-Dateien
  • Steuerung des Literaturstils über Parameter, z.B.:
    • Anzahl Autorennamen
    • Sortierung/Abkürzung
    • Ausblendung von ISBN, DOI, URLs ohne Änderungen an den bib-Dateien
  • einfache Erstellung mehrerer (getrennter) Literaturverzeichnisse

Beispiel für eine Einbindung von BibLaTeX:

\usepackage[citestyle=numeric,style=numeric,backend=biber]{biblatex}
\addbibresource{resources/ebdiss.bib}\printbibliography

Im Build-Skript dann einfach BibTeX durch Biber ersetzen:

pdflatex document
biber document
pdflatex document
pdflatex document
Weitere Informationen

Intergration von biblatex/biber in LaTeX-IDEs

TeXlipse

  • Der Aufruf des biblatex-Paketes muß in der Haupt-Datei des Projektes erfolgen, damit TeXlipse zum erstellen der Literaturliste biber und biblatex statt bibtex verwendet.
  • Wird biblatex in einer .sty/.cls-Datei aufgerufen, erkennt TeXlipse u.U. nicht, daß biber verwendet werden soll.

Auf Windows mit TeXnicCenter und MiKTeX

  • Entweder latexmk verwenden oder Bibtex im Projekt aktiviert haben und Ausagabeprofil korrekt auf Biber einstellen.

BibTeX-Tipps

Avoid dashed lines in author field in IEEEtran, IEEEtranSA, etc.

In IEEE bibtex styles, dashed lines are inserted in the author field if the same author (or combination of authors) appears multiple times in a bibliography list. This is default behaviour of the IEEE styles, but can be turned off.

To turn this behaviour of, insert the following code at the beginning of the bib files:

@IEEEtranBSTCTL{myctlfullname,
CTLdash_repeated_names = "no"
};

With this command, special IEEEtran options can be set.

In your latex file, put the following code before the

\begin{document}

instruction:

\makeatletter
\def\bstctlcite{\@ifnextchar[{\@bstctlcite}{\@bstctlcite[@auxout]}}
\def\@bstctlcite[#1]#2{\@bsphack
  \@for\@citeb:=#2\do{%
    \edef\@citeb{\expandafter\@firstofone\@citeb}%
    \if@filesw\immediate\write\csname #1\endcsname{\string\citation{\@citeb}}\fi}%
  \@esphack}
\makeatother

In your latex file, put the following code after the

\begin{document}

instruction:

\bstctlcite{myctlfullname}

The code in the latex file enables the IEEE options to be regarded when parsing the bib file.

For more details, see http://mirrors.ctan.org/macros/latex/contrib/IEEEtran/bibtex/IEEEtran_bst_HOWTO.pdf.

Multiple Bibliographies

If you want to have multiple bibliographies, e.g. scientific publications separated from online resources, you will find this comparison of packages for multiple bibliographies useful. If differencing by entry type is sufficient, you might want to use \printbibliography[title={Book references},type=book] etc. to have multiple bibliographies with biblatex.

If you need to combine numeric and author-year styles in multiple bibliographies using bibtex, this minimal example adapted from fix #70 for biblatex should do the trick:

\usepackage[citestyle=authoryear,bibstyle=authortitle,backend=biber,labelnumber,defernumbers]{biblatex}
\DeclareCiteCommand{\citemisc}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{%
     \printfield{prefixnumber}%
     \printfield{labelnumber}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
\defbibenvironment{online}
  {\list
     {\printtext[labelnumberwidth]{%
  \iffieldundef{shorthand}
    {\printfield{prefixnumber}%
     \printfield{labelnumber}}
    {\printfield{shorthand}}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}
% ...
\printbibliography[nottype=misc]
\printbibliography[env=online,sorting=none,title=Miscellaneous,type=misc]

Take care to define the numeric citation command using DeclareCiteCommand instead of the standard newcommand. Furthermore, you might consider to omit the sorting=none option.

Troubleshooting

  • In general, if something bibtex-related causes errors or does not look as intended, make sure to inspect the Bibtex warnings and errors at the end of the log when creating your PS/PDF. Look for the line "This is BibTeX, version ..." and go through all items. An error message with something like "',' expected" indicates that one of your BibTeX entries misses commas to separate fields.
  • In some cases, BibTeX or biber may cause the LaTeX build to hang, especially when executed in "nonstop" (non-interactive) mode. The errors may not point to a BibTeX-related error.
  • Un-escaped "%" or "&" symbols in BibTeX entries can cause errors in connection with biber.
  • If your numbered references are suddenly all printed out as "[0]", check your BibTeX file for incorrectly formatted author fields, e.g., containing "and and".
  • Error message about LaTeX sources being older than 5 years when using Miktex: Use the Miktex Update function to update all packages (or all packages that are older than 5 years). Even if your Miktex distribution is newer (e.g. Miktex 2.8), it came with older source files that will be outdated earlier than the whole distribution.
  • The package ulem overwrites \emph{}, so that emphasized words are underlined and not in italics, which can change the format of the references. To avoid this, refrain from underlining text at all (since it is bad typographic style), and if you must underline text, load the package with \usepackage[normalem]{ulem}, so that \emph{} ist not overwritten.
  • If biber throws the error "Can't decode ill-formed UTF-8 octet sequence" on a .bib file, run grep -axv '.*' <file>.bib to identify the offending line

Weitere Links

Siehe auch