39
Introduction to BibL a T E X Martin Helsø January 10, 2020

Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Introduction to BibLaTEX

Martin Helsø January 10, 2020

Page 2: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

The basicsbibliography.bib

@article{

key1,author = {...},title = {...},...

}

@book{

key2,author = {...},title = {...},...

}

filename.tex

\documentclass{memoir}

\usepackage[backend = biber]{biblatex}\addbibresource{bibliography.bib}

\begin{document}

Some text and a citation \cite{key1}.More text and a new citation \cite{key2}.

\printbibliography

\end{document}

Martin Helsø Introduction to BibLaTEX January 10, 2020 1 / 18

Page 3: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

The basicsbibliography.bib

@article{

key1,author = {...},title = {...},...

}

@book{

key2,author = {...},title = {...},...

}

filename.tex

\documentclass{memoir}

\usepackage[backend = biber]{biblatex}\addbibresource{bibliography.bib}

\begin{document}

Some text and a citation \cite{key1}.More text and a new citation \cite{key2}.

\printbibliography

\end{document}

Martin Helsø Introduction to BibLaTEX January 10, 2020 1 / 18

Page 4: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

CompilationCompile with the backend in between two ordinary compilations:

pdflatex filename.texbiber filenamepdflatex filename.tex (×2)

Three possible values for the backend:

biber –– written for BibLTEXbibtex –– written for the older package BibTEXbibtex8 –– 8 bit reimplementation of bibtex

Martin Helsø Introduction to BibLaTEX January 10, 2020 2 / 18

Page 5: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

BibLaTEX vs. BibTEX1 BibLTEX supports UTF-82 BibLTEX has more predefined reference types,

e.g., online/www for web pages3 BibLTEX is easier to customize

Supports automatic language switching with babelCan create multiple bibliographies

4 Databases export to BibTEX, but the output can also be readby BibLTEX

5 Some journals require BibTEX

Martin Helsø Introduction to BibLaTEX January 10, 2020 3 / 18

Page 6: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Filling the .bib fileTypically filled by copying metadata from a database

Change the cite key to something that you remember!

The next three slides show how to extract metadata from threecommon databases

Check the library subject page for other databases:https://www.ub.uio.no/english/subjects/informatics-mathematics/mathematics/

Martin Helsø Introduction to BibLaTEX January 10, 2020 4 / 18

Page 7: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

ams.org/mathscinet

Martin Helsø Introduction to BibLaTEX January 10, 2020 5 / 18

Page 8: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

ams.org/mathscinet

Martin Helsø Introduction to BibLaTEX January 10, 2020 5 / 18

Page 9: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

ams.org/mathscinetSometimes the exported metadata contains undefined macros

Solution: \usepackage{mathscinet}

Martin Helsø Introduction to BibLaTEX January 10, 2020 5 / 18

Page 10: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

arXiv.org

Martin Helsø Introduction to BibLaTEX January 10, 2020 6 / 18

Page 11: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

scholar.google.com

Martin Helsø Introduction to BibLaTEX January 10, 2020 7 / 18

Page 12: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

scholar.google.com

Martin Helsø Introduction to BibLaTEX January 10, 2020 7 / 18

Page 13: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Citation notesInput:

\cite[postnote]{key1}\cite[prenote][postnote]{key2}\cite[prenote][]{key3}

Output (depends on style):

[1 , postnote ][ prenote 2 , postnote ][ prenote 3]

Postnotes are used to specify which part of the source your arereferencing:

\cite[Theorem~3.2]{key}\cite[i--vi]{key}

Martin Helsø Introduction to BibLaTEX January 10, 2020 8 / 18

Page 14: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Citation notesInput:

\cite[postnote]{key1}\cite[prenote][postnote]{key2}\cite[prenote][]{key3}

Output (depends on style):

[1 , postnote ][ prenote 2 , postnote ][ prenote 3]

Postnotes are used to specify which part of the source your arereferencing:

\cite[Theorem~3.2]{key}\cite[i--vi]{key}

Martin Helsø Introduction to BibLaTEX January 10, 2020 8 / 18

Page 15: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Citation notesInput:

\cite[postnote]{key1}\cite[prenote][postnote]{key2}\cite[prenote][]{key3}

Output (depends on style):

[1 , postnote ][ prenote 2 , postnote ][ prenote 3]

Postnotes are used to specify which part of the source your arereferencing:

\cite[Theorem~3.2]{key} [1, Theorem 3.2]\cite[i--vi]{key} [1, pp. i–vi]

Martin Helsø Introduction to BibLaTEX January 10, 2020 8 / 18

Page 16: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Notes in optional argumentsSay we have defined the environment theorem (using, e.g., thmtools).

Then this works:

\begin{theorem}[\cite{key}]...\end{theorem}

But this fails:

\begin{theorem}[\cite[Theorem~7]{key}]...\end{theorem}

Martin Helsø Introduction to BibLaTEX January 10, 2020 9 / 18

Page 17: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Notes in optional argumentsSay we have defined the environment theorem (using, e.g., thmtools).

Then this works:

\begin{theorem}[\cite{key}]...\end{theorem}

But this fails:

\begin{theorem}[\cite[Theorem~7]{key}]...\end{theorem}

Martin Helsø Introduction to BibLaTEX January 10, 2020 9 / 18

Page 18: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Notes in optional argumentsSay we have defined the environment theorem (using, e.g., thmtools).

Then this works:

\begin{theorem}[\cite{key}]...\end{theorem}

But this works:

\begin{theorem}[{\cite[Theorem~7]{key}}]...\end{theorem}

Martin Helsø Introduction to BibLaTEX January 10, 2020 9 / 18

Page 19: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Citation commands\cite bare

\parencite cite in parentheses\footcite cite in footnote

\authorcite cite only author\titlecite cite only title

\yearcite cite only year\urlcite cite only url

Martin Helsø Introduction to BibLaTEX January 10, 2020 10 / 18

Page 20: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Cite multiple sourcesSeparate keys with comma:

\cite{key1, key2, key3}

Ensure that the multiple citations are printed in the same order as inthe bibliography:

\usepackage[sortcites = true]{biblatex}

For individual pre- and postnotes:

\cites[prenote][postnote]{key1}[prenote][postnote]{key2}

sortcites = true does not work for \cites

Martin Helsø Introduction to BibLaTEX January 10, 2020 11 / 18

Page 21: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Cite multiple sourcesSeparate keys with comma:

\cite{key1, key2, key3}

Ensure that the multiple citations are printed in the same order as inthe bibliography:

\usepackage[sortcites = true]{biblatex}

For individual pre- and postnotes:

\cites[prenote][postnote]{key1}[prenote][postnote]{key2}

sortcites = true does not work for \cites

Martin Helsø Introduction to BibLaTEX January 10, 2020 11 / 18

Page 22: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Styles\usepackage[style = alphabetic]{biblatex}

Built-in styles:numeric [1]

alphabetic [Har77]authoryear Hartshorne 1977authortitle Hartshorne, Algebraic geometry

style affects both appearance in bibliography and in-text citationsunless citestyle is used (make sure they match!)

You can define your own style or import one (e.g., APA, Chicago,Nature, Science)

All styles are hidden in this list: https://ctan.org/topic/biblatex

Martin Helsø Introduction to BibLaTEX January 10, 2020 12 / 18

Page 23: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Styles\usepackage[style = alphabetic]{biblatex}

Built-in styles:numeric [1]

alphabetic [Har77]authoryear Hartshorne 1977authortitle Hartshorne, Algebraic geometry

style affects both appearance in bibliography and in-text citationsunless citestyle is used (make sure they match!)

You can define your own style or import one (e.g., APA, Chicago,Nature, Science)

All styles are hidden in this list: https://ctan.org/topic/biblatex

Martin Helsø Introduction to BibLaTEX January 10, 2020 12 / 18

Page 24: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Styles\usepackage[style = alphabetic]{biblatex}

Built-in styles:numeric [1]

alphabetic [Har77]authoryear Hartshorne 1977authortitle Hartshorne, Algebraic geometry

style affects both appearance in bibliography and in-text citationsunless citestyle is used (make sure they match!)

You can define your own style or import one (e.g., APA, Chicago,Nature, Science)

All styles are hidden in this list: https://ctan.org/topic/biblatex

Martin Helsø Introduction to BibLaTEX January 10, 2020 12 / 18

Page 25: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Styles\usepackage[style = alphabetic]{biblatex}

Built-in styles:numeric [1]

alphabetic [Har77]authoryear Hartshorne 1977authortitle Hartshorne, Algebraic geometry

style affects both appearance in bibliography and in-text citationsunless citestyle is used (make sure they match!)

You can define your own style or import one (e.g., APA, Chicago,Nature, Science)

All styles are hidden in this list: https://ctan.org/topic/biblatex

Martin Helsø Introduction to BibLaTEX January 10, 2020 12 / 18

Page 26: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Sorting schemes\usepackage[sorting = nty]{biblatex}

nty Sort by name, title, year.nyt Sort by name, year, title.

nyvt Sort by name, year, volume, title.anyt Sort by alphabetic label, name, year, title.

anyvt Sort by alphabetic label, name, year, volume, title.ynt Sort by year, name, title.

ydnt Sort by year (descending), name, title.none Do not sort at all. All entries are processed in citation

order.

Martin Helsø Introduction to BibLaTEX January 10, 2020 13 / 18

Page 27: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

ShorthandWhen citing software or a standard reference, you can help the readerrecognize the source:

. . . was computed with [1] . . . by a result in [Gro67]

. . . was computed with [Macaulay2] . . . by a result in [EGA]

Overrule the citation style for individual references by adding ashorthand to its entry in the .bib file:@misc{

M2,shorthand = {Macaulay2},author = {Grayson, Daniel R. and Stillman, Michael E.},title = {Macaulay2},howpublished = {Available at

\url{http://www.math.uiuc.edu/Macaulay2/}}}

Martin Helsø Introduction to BibLaTEX January 10, 2020 14 / 18

Page 28: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

ShorthandWhen citing software or a standard reference, you can help the readerrecognize the source:

. . . was computed with [1] . . . by a result in [Gro67]

. . . was computed with [Macaulay2] . . . by a result in [EGA]

Overrule the citation style for individual references by adding ashorthand to its entry in the .bib file:@misc{

M2,shorthand = {Macaulay2},author = {Grayson, Daniel R. and Stillman, Michael E.},title = {Macaulay2},howpublished = {Available at

\url{http://www.math.uiuc.edu/Macaulay2/}}}

Martin Helsø Introduction to BibLaTEX January 10, 2020 14 / 18

Page 29: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Further customizationOmit information from the bibliography:

\usepackage[doi = false,isbn = false,url = false]{biblatex}

Issuing url = false does not remove the URL from the onlinereference type

Use initials for given names with giveninits = true

Specify how many author names are printed before they are replacedby “et al.” with maxcitenames = n and maxbibnames = m

Print last names first:

\DeclareNameAlias{sortname}{family-given}\DeclareNameAlias{default}{family-given}

Martin Helsø Introduction to BibLaTEX January 10, 2020 15 / 18

Page 30: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Further customizationOmit information from the bibliography:

\usepackage[doi = false,isbn = false,url = false]{biblatex}

Issuing url = false does not remove the URL from the onlinereference type

Use initials for given names with giveninits = true

Specify how many author names are printed before they are replacedby “et al.” with maxcitenames = n and maxbibnames = m

Print last names first:

\DeclareNameAlias{sortname}{family-given}\DeclareNameAlias{default}{family-given}

Martin Helsø Introduction to BibLaTEX January 10, 2020 15 / 18

Page 31: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Further customizationOmit information from the bibliography:

\usepackage[doi = false,isbn = false,url = false]{biblatex}

Issuing url = false does not remove the URL from the onlinereference type

Use initials for given names with giveninits = true

Specify how many author names are printed before they are replacedby “et al.” with maxcitenames = n and maxbibnames = m

Print last names first:

\DeclareNameAlias{sortname}{family-given}\DeclareNameAlias{default}{family-given}

Martin Helsø Introduction to BibLaTEX January 10, 2020 15 / 18

Page 32: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Further customizationOmit information from the bibliography:

\usepackage[doi = false,isbn = false,url = false]{biblatex}

Issuing url = false does not remove the URL from the onlinereference type

Use initials for given names with giveninits = true

Specify how many author names are printed before they are replacedby “et al.” with maxcitenames = n and maxbibnames = m

Print last names first:

\DeclareNameAlias{sortname}{family-given}\DeclareNameAlias{default}{family-given}

Martin Helsø Introduction to BibLaTEX January 10, 2020 15 / 18

Page 33: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Showkeys\usepackage{showkeys}

Display cite keys (and label keys) in margin

Aggressive output, prefer loading

\usepackage[notcite, notref]{showkeys}

Disable by passing final to document class

Martin Helsø Introduction to BibLaTEX January 10, 2020 16 / 18

Page 34: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Showkeys\usepackage{showkeys}

Display cite keys (and label keys) in margin

Aggressive output, prefer loading

\usepackage[notcite, notref]{showkeys}

Disable by passing final to document class

Martin Helsø Introduction to BibLaTEX January 10, 2020 16 / 18

Page 35: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Showkeys\usepackage{showkeys}

Display cite keys (and label keys) in margin

Aggressive output, prefer loading

\usepackage[notcite, notref]{showkeys}

Disable by passing final to document class

Martin Helsø Introduction to BibLaTEX January 10, 2020 16 / 18

Page 36: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Referencing without BibLaTEXJoin the names of different people with an endash:

Navier–Stokes equations, Cauchy–Schwarz inequality

Navier--Stokes equations, Cauchy--Schwarz inequality

This distinguishes multiple people from people with hyphenatednames:

The Birch–Swinnerton-Dyer conjecture was formulated by two people,Birch and Swinnerton-Dyer

Martin Helsø Introduction to BibLaTEX January 10, 2020 17 / 18

Page 37: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Referencing without BibLaTEXJoin the names of different people with an endash:

Navier–Stokes equations, Cauchy–Schwarz inequality

Navier--Stokes equations, Cauchy--Schwarz inequality

This distinguishes multiple people from people with hyphenatednames:

The Birch–Swinnerton-Dyer conjecture was formulated by two people,Birch and Swinnerton-Dyer

Martin Helsø Introduction to BibLaTEX January 10, 2020 17 / 18

Page 38: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Further reading (sorted by length)BibLaTEX cheat sheethttp://mirror.hmc.edu/ctan/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf

Knut Hegna: BibLaTEX –– course noteshttp://www.ub.uio.no/fag/informatikk-matematikk/informatikk/kursmateriell/biblatex/biblatexbooklet.pdf

Dag Langmyhr & Knut Hegna: Local guide to BibLaTEXhttp://dag.at.ifi.uio.no/latex-links/biblatex-guide.pdf

BibLaTEX manualhttp://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf

Martin Helsø Introduction to BibLaTEX January 10, 2020 18 / 18

Page 39: Introduction to BibLaTeXfolk.uio.no › martibhe › Undervisning › MAT2000 › biblatex.pdf · BibLaTEX vs. BibTEX 1 BibL TEX supports UTF-8 2 BibL TEX has more predefined reference

Martin Helsø

Introduction to BibLaTEX