I am creating a pdf book in RStudio using bookdown with natbib, and cite with [@reference] from a .bib file created with mendeley. Also, I use the \setcitestyle{numbers,square,comma} style.
For all references that has an URL, all special characters, such as _ and % are wrapped in brackets inside the URL, like this:
Jennifer M Andrews. Determination of minimum inhibitory concentrations. Journal
of Antimicrobial Chemotherapy, 48(suppl_1):5–16, jul 2001. ISSN 1460-2091.
doi: 10.1093/jac/48.suppl_1.5. URL http://academic.oup.com/jac/article/48/
suppl{_}1/5/2473513/Determination-of-minimum-inhibitory-concentrations.
I have read this post similar to my issue, but I do not have issues with line breaks, as the references look fine except the {} wrapping the special characters. Is there any way to make this work with natbib? I have also tried using the url package, which makes no difference.
I have also tried to remove mendeley's option to escape special characters, but then the book fails to render.
My YAML:
site: bookdown::bookdown_site
geometry: "left=4cm,right=3cm,top=3cm,bottom=3cm"
subparagraph: true
output:
bookdown::pdf_book:
toc: false
citation_package: natbib
includes:
before_body: frontpage.tex
after_body: after_body.tex
in_header: preamble.tex
fontsize: 11pt
linestretch: 1.2
documentclass: book
bibliography: [packages.bib, library.bib]
link-citations: yes
---
.bibentry for the bibliography item look like? Does it already contain the escape characters? In that case, things are going to be tricky, because removing them is not going to be particularly simple. Mendeley isn't known for producing good-quality.bibfiles, so you may want to think about switching to a different tool (Zotero?) or may have to accept post-processing your.bibfiles. – moewe Sep 05 '19 at 15:32\and{,}in\emph{E. coli}, then that would explain why things don't work as expected. – moewe Sep 05 '19 at 15:34