---
: "My title"
title: "John Doe"
author: my_references.bib
bibliography: a_journal_specific_style_definition.csl
csl---
@unique_publication_id]. Some text with a literature citation[
Citing publications in your manuscript
Indsæt referencer i dit manuscript
To leverage citations in Quarto, you will need three things:
- a bibliography – an external file containing details about the publications you want to cite 1
- a citation style definition – an external file which specifies the citation style specific to the journal you are writing for
- in-text citations – a way to indicate inline citations within the Quarto markdown prose
The following is a minimal example Quarto manuscript to illustrate how to cite publications:
The bibliography file (“my_references.bib”) is specified by the YAML key bibliography
.
Similarly, the style definition file is specified by the YAML key csl
.
The prose text contains a single citation of a bibliography item, identified by the unique_publication_id
. To indicate a citation use the [@..]
syntax.
The bibliographic data is stored in a BibTeX file.
BibTeX files are simple text files with an intuitive format.
In most cases you will not need to work directly with the BibTeX file as it is typically generated for you by a bibliographic data manager like Zotero, Mendeley, EndNote or similar.
An example BibTeX entry looks like this:
@article{garrattResponsivenessGenericSpecific2001,
title = {Responsiveness of {{Generic}} and {{Specific Measures}} of {{Health Outcome}} in {{Low Back Pain}}:},
shorttitle = {Responsiveness of {{Generic}} and {{Specific Measures}} of {{Health Outcome}} in {{Low Back Pain}}},
author = {Garratt, Andrew M. and Klaber Moffett, Jennifer and Farrin, Amanda J.},
date = {2001-01},
journaltitle = {Spine},
volume = {26},
number = {1},
pages = {71--77},
issn = {0362-2436},
doi = {10.1097/00007632-200101010-00014},
url = {http://journals.lww.com/00007632-200101010-00014},
urldate = {2022-01-25},
langid = {english}
}
Looking at the example above, pay particular attention to the first line which defines the entry as an article with the unique identifier garrattResponsivenessGenericSpecific2001.
Most of the “key = {value}” pairs defined in the entry are self-explanatory.
Note the use of {single curly brackets} to delimit the values for each key.
Note the use of {{double curly brackets}} inside some values – this is used to specify an exact use of upper and lower case letters.2
A BibTeX file simply consists of several such entries.
The home of BibTeX is found af https://www.bibtex.org/
You specify the BibTeX file in the YAML of your quarto document with the bibliography
parameter, like this:
---
: "My title"
title: "John Doe"
author: my_references.bib
bibliography---
..this assumes, that the BibTeX file ‘my_references.bib’ is located in the same folder as the quarto document (which it probably should be).
Obviously, the publications you cite, needs to be included in the BibTeX file.
The citation style is defined in a CSL file.
The CSL file is an XML file, i.e. a text file, albeit not a very reader-friendly one – fortunately, you will not need to edit CSL files yourself. Instead, you simply download the appropriate CSL file for your chosen journal:
The Zotero style repository is probably the easiest place to find the CSL file you need – the official repository of CSL files is located here.
The home of CSL is found here https://citationstyles.org/.
You specify the CSL file in the YAML of your quarto document with the csl
parameter, like this:
---
: "My title"
title: "John Doe"
author: my_references.bib
bibliography: plos-one.csl
csl---
..this assumes, that the CSL file ‘plos-one.csl’ is located in the same folder as the quarto document (which it probably should be).
Note that some CSL styles refer to other online CSL styles – they require a working internet connection to function correctly.
Citations and references are not actually handled by R, but by Pandoc
. Don’t worry, you wont really need to know about Pandoc and what it does behind the scene.
To insert a citation in your Quarto markdown, use the format: [@unique_id]
.
You can not insert citations inside R code - only in markdown.
In place of unique_id insert the unique identifier specified for the publication in the BibTeX file – in the example given above it was garrattResponsivenessGenericSpecific2001 and the way to cite Garret et al would be with: [@garrattResponsivenessGenericSpecific2001]
.
If you want to cite several publications in one entry, simply separate them with a ;
like this: [@unique_id1; @unique_id2]
. Note, the @
for each unique identifier.
A word of caution: The way citations are handled differs significantly depending on the type of citation style. E.g., given the example [@unique_id1; @unique_id2]
, the two citations may be re-ordered in numbered citation styles (e.g. Vancouver and Oxford), by publication year or order-of-citation. By contrast, Author-Year styles (e.g. Harvard) will typically retain the order in which citations are given. User discretion is advised!
The reference list generated by Pandoc will automatically be place at the end of the Quarto manuscript under the heading # References
.
If you want to overrule this default behavior, specify the placement of the reference list, using ::: div :::
. E.g. the following code, will place the reference list just after the level-3 heading ‘Literature’ and before the appendix section.
### Literature
::: {#refs}
:::
## Appendices
You can read more about citations in the Quarto documentation here.
For at gøre brug af citater i Quarto skal du bruge tre ting:
- en bibliografi – en ekstern fil, der indeholder detaljer om de publikationer, du vil citere 3
- en citations stildefinition - en ekstern fil med stilspecifikation for det tidsskrift, du skriver til
- citationer – en måde at angive citationer indlejret i dit Quarto dokument
Dette er et minimalistisk eksempel på et Quarto manuskript som illustrerer hvordan man citerer publikation:
---
: "My title"
title: "John Doe"
author: my_references.bib
bibliography: a_journal_specific_style_definition.csl
csl---
@unique_publication_id]. Some text with a literature citation[
Bibliografifilen (“my_references.bib”) er specificeret af YAML-nøglen bibliography
.
På samme måde er stildefinitionsfilen specificeret af YAML-nøglen csl
.
Prosateksten indeholder et enkelt citat af en bibliografisk reference, identificeret med ‘unique_publication_id’. For at angive en citation, bruges syntaksen [@..]
.
De bibliografiske data gemmes i en BibTeX-fil.
BibTeX-filer er simple tekstfiler med et intuitivt format.
I de fleste tilfælde behøver du ikke arbejde direkte med BibTeX-filen, da den typisk genereres for dig af en bibliografisk datamanager som Zotero, Mendeley, EndNote eller lignende.
Et eksempel på en BibTeX-reference ser sådan ud:
@article{garrattResponsivenessGenericSpecific2001,
title = {Responsiviteten af {{Generic}} og {{Specific Measures}} af {{Health Outcome}} i {{Low Back Pain}}:},
shorttitle = {Responsivitet af {{Generic}} og {{Specific Measures}} af {{Health Outcome}} i {{Low Back Pain}}},
forfatter = {Garratt, Andrew M. og Klaber Moffett, Jennifer og Farrin, Amanda J.},
dato = {2001-01},
journaltitle = {Spine},
volumen = {26},
tal = {1},
sider = {71--77},
issn = {0362-2436},
doi = {10.1097/00007632-200101010-00014},
url = {http://journals.lww.com/00007632-200101010-00014},
urldate = {2022-01-25},
langid = {engelsk}
}
Når du ser på eksemplet ovenfor, skal du være særlig opmærksom på den første linje, der definerer referencen som en artikel med den unikke identifikator garrattResponsivenessGenericSpecific2001.
De fleste af “nøgle = {value}”-parrene, der er defineret i indtastningen, er selv- forklarende.
Bemærk brugen af {enkelte krøllede parenteser} for at afgrænse værdierne for hver nøgle.
Bemærk brugen af {{dobbelt krøllede parenteser}} i nogle værdier – dette bruges til at specificere en nøjagtig brug af store og små bogstaver.4
En BibTeX-fil består simpelthen af flere sådanne poster.
BibTeX hjemmesiden findes på https://www.bibtex.org/
Du angiver BibTeX-filen i YAML i dit quarto-dokument med parameteren bibliography
, sådan her:
---
: "Min titel"
title: "John Doe"
forfatter: my_references.bib
bibliografi---
..dette forudsætter, at BibTeX-filen ‘my_references.bib’ er placeret i samme mappe som quarto-dokumentet (hvilket det nok burde være).
Det siger sig selv, at de publikationer du citerer, skal inkluderes i BibTeX-filen.
Citationsstilen er defineret i en CSL-fil.
CSL-filen er en XML-fil, det vil sige en tekstfil, som dog ikke er særligt læsevenlig - heldigvis behøver du ikke selv redigere CSL-filer. I stedet downloader du blot den relevante CSL-fil til din valgte journal:
Zotero style repository er sandsynligvis det nemmeste sted at finde den CSL-fil, du har brug for – det officielle lager af CSL-filer er placeret her.
CSL hjemmesiden findes her https://citationstyles.org/.
Du angiver CSL-filen i YAML i dit quarto-dokument med ‘csl’-parameteren, sådan her:
---
: "Min titel"
title: "John Doe"
forfatter: my_references.bib
bibliografi: plos-one.csl
csl---
..dette forudsætter, at CSL-filen ‘plos-one.csl’ er placeret i samme mappe som quarto-dokumentet (hvilket det nok burde være).
Bemærk, at nogle CSL-stile henviser til andre online CSL-stile – de kræver en fungerende internetforbindelse for at fungere korrekt.
Citater og referencer håndteres faktisk ikke af R, men af Pandoc
. Bare rolig, du behøver ikke rigtig at vide noget om Pandoc, eller hvad den gør bag scenen.
For at indsætte et citat i din Quarto markdown skal du bruge formatet: [@unique_id]
.
Du kan ikke indsætte citater i R-koden - kun i markdown.
I stedet for unique_id bruges den unikke identifikator, der er specificeret for publikationen i BibTeX-filen – i eksemplet ovenfor var det garrattResponsivenessGenericSpecific2001 og måden at citere Garret et al på ville være med: [@garrattResponsivenessGenericSpecific2001]
.
Hvis du ønsker at citere flere publikationer i én citation, skal du blot adskille dem med et ;
som denne: [@unique_id1; @unique_id2]
. Bemærk @
for hver unik identifikator.
En advarsel: Den måde, hvorpå citater håndteres, varierer betydeligt afhængigt af typen af citatstil. F.eks. givet eksemplet [@unique_id1; @unique_id2]
, kan de to citater omarrangeres i nummererede citationsstile (f.eks. Vancouver og Oxford), efter udgivelsesår eller citationsrækkefølge. Derimod vil Author-Year-stile (f.eks. Harvard) typisk bevare den rækkefølge, hvori citaterne gives. Brugerens skøn tilrådes!
Referencelisten genereret af Pandoc vil automatisk blive placeret i slutningen af Quarto-manuskriptet under overskriften # Referencer
.
Hvis du vil tilsidesætte denne standardadfærd, skal du angive placeringen af referencelisten ved at bruge ::: div :::
. F.eks. vil følgende kode placere referencelisten lige efter niveau-3 overskriften ‘Litteratur’ og før bilagssektionen ‘Bilag’.
### Litteratur
::: {#refs}
:::
## Bilag
Du kan læse mere om citationer i Quarto-dokumentationen her.
Footnotes
It is possible to include the bibliography definitions directly in your quarto document, but this is generally less practical.↩︎
The formatting of BibTeX entries for different journal formats may cause upper-case characters to be converted to lower-case characters. Use the double brackets to insist, that upper-case characters are retained as such.↩︎
Det er muligt at inkludere bibliografidefinitionerne direkte i dit quarto-dokument, men dette er generelt mindre praktisk.↩︎
Formateringen af BibTeX-poster for forskellige journalformater kan forårsage, at store bogstaver konverteres til små bogstaver. Brug de dobbelte parenteser til at insistere på, at store bogstaver bevares som sådan.↩︎