0

I am creating a pdf-book using bookdown, with the citation package natbib in the apalike style. I get my citations from a .bib file created by mendeley. I create my citations like this: [@citation].

When I cite a web page, the URL of the page is omitted in the rendered bibliography, even if the URL is present in the .bib file, like this:

Biology-Online (2019). Phylogeny

Instead of:

Biology-Online (2019). Phylogeny, https://www.biology-online.org/dictionary/Phylogeny, accessed: 21.08.2019

The .bib entry looks like this:

@misc{BiologyOn,
author = {Biology-Online},
title = {{Phylogeny}},
url = {https://www.biology-online.org/dictionary/Phylogeny},
urldate = {2019-08-21},
year = {2019}
}

Despite the @misc category, it is categorized as a web page in mendeley. Is there a way to ensure that the URL is included?

Haakonkas
  • 171
  • is there a hard requirement for using natbib ans apalike? Since bookdown is based on pandoc you could use biblatex or pandoc-citeproc instead... – DG' Sep 04 '19 at 09:58
  • Pandoc and biblatex didn't support citations in figure captions, if i remember correctly... And natbib citations look better in my opinion – Haakonkas Sep 04 '19 at 10:15

2 Answers2

0

I had the same problem. Adding \usepackage{url} worked for me.

Or you try to configure your bibliography style but that could be a bit over the top.

Asriel
  • 16
  • Thanks for the suggestion, however this didn't seem to fix the problem for me – Haakonkas Sep 04 '19 at 10:16
  • Ok, maybe that package is just useful for biblatex. But have you looked around? There are some similar questions here: 1. https://tex.stackexchange.com/questions/103133/problems-with-natbib-strange-url-format-and-urldate-not-shown 2. https://tex.stackexchange.com/questions/146158/referencing-webpage-using-apalike-and-natbib 3. https://tex.stackexchange.com/questions/405102/display-url-in-natbib-and-apalike-fr-references?rq=1 – Asriel Sep 04 '19 at 10:55
  • 1
    Thanks, I looked through them and found that the apalike style doesn't support URLs. I will try to change to apacite – Haakonkas Sep 04 '19 at 13:06
0

A solution that worked for me -- bookdown from RStudio on MacOS -- is to download a CSL from the Zotero repository that has the desired style and includes URLs (the Zotero site shows examples). Then add that to the bookdown index options. That is described here in the bookdown documentation: https://bookdown.org/yihui/rmarkdown-cookbook/bibliography.html

For example, the default bookdown style is a Chicago Style Manual format. So I got the CSL for the "Chicago Manual of Style 17th edition (note)", specifically here: https://www.zotero.org/styles/chicago-note-bibliography

Put that CSL file into the bookdown project root folder. Then in "index.Rmd", remove any conflicting styles and add a line with "csl:" pointing to the new CSL filename. I did this:

csl: chicago-note-bibliography.csl

After that, it compiles for me with URLs in the bibliography (and they work when clicked, e.g., from PDF).