Chapter 8 Referencing

8.1 Adding citations

You can reference publications etc using the following syntax:

@bibcode 

where bibcode is the bibcode for the entry in your bib file (see Sec. 8.2). This will give the equivalent of the LaTeX \citet{} command. Example:

@2016Scowcroft showed that the SMC is a very elongated galaxy.

Scowcroft et al. (2016) showed that the SMC is a very elongated galaxy.

For \citep{}, just put the citation in square brackets.

The first observations of SMC Cepheids were taken over 100 years ago [@1912Leavitt].

The first observations of SMC Cepheids were taken over 100 years ago (Leavitt & Pickering 1912).

8.2 Bibliography files

Assuming you’re using natbib style references you can pass the same bib file to bookdown.

Example bib file entry:

@ARTICLE{1912Leavitt,
       author = {{Leavitt}, Henrietta S. and {Pickering}, Edward C.},
        title = "{Periods of 25 Variable Stars in the Small Magellanic Cloud.}",
      journal = {Harvard College Observatory Circular},
         year = "1912",
       volume = {173},
        pages = {1},
}

8.3 Reference style

The referencing style is controlled in the index.Rmd file.

At the top of this file you’ll find the section that defines things like the book title, output format etc. The following lines are where you define the bib file names and referencing format. You can have multiple bib files.

bibliography: [book.bib, packages.bib]
csl: apj.csl
link-citations: yes

The bibliography: line points to your bib file. The csl: line points to your style file. This book uses the ApJ style. Additional style files (e.g. PRL etc.) can be downloaded from zotero. link-citations: yes creates links from the citations in the text to the reference list at the end of the chapter.

Any chapter that includes references will have a the reference list at the end. You can also include a separate reference list for the whole document. To make sure this goes right at the end I usually name my file 99-references.Rmd. If you specify the ordering as described in Section 4.1.1 you need to make sure that the reference chapter is the last one in the list. The references file should contain the following text:

`r if (knitr::is_html_output()) '# References {-}'`

This will create an un-numbered section at the end of the book called ‘References’ that has the full reference list.

References

Leavitt, H. S., & Pickering, E. C. 1912, Harvard College Observatory Circular, 173, 1
Scowcroft, V., Freedman, W. L., Madore, B. F., et al. 2016, ApJ, 816, 49