How to set references to 'sentence case'?
Asked Answered
B

1

3

Although my entries in bibliography.bib are all sentence cased, my references become Title Cased (red underlines). How could I solve this?

Edit: @user2554330's answer indicates that the *.csl file has to be edited. Since rmarkdown uses Chicago author-date format for citations and references by default it would be helpful to know where exactly in the *.csl the 'text case' to be edited can be found.

enter image description here

Rmarkdown code:

---
title: 'Untitled'
output: pdf_document
bibliography: "bibliography.bib"
---

Lorem ipsum dolor sit amet [@einstein_ist_1905; @hawking_thermodynamics_1983].

# References 
<div id="refs"></div>

Content of bibliography.bib:

@article{einstein_ist_1905,
    title = {Ist die {Trägheit} eines {Körpers} von seinem {Energieinhalt} abhängig?},
    volume = {323},
    url = {https://s3.amazonaws.com/objects.readcube.com/articles/downloaded/wiley/a56a92baf12b80889d9de6f28f51f22f8bec1a2b366de4e8171f0d47e890d37a.pdf?response-content-disposition=attachment%3B%20filename%3D%22Einstein-1905-Annalen_der_Physik.pdf%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIS5LBPCM5JPOCDGQ%2F20170830%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170830T124037Z&X-Amz-Expires=127162&X-Amz-SignedHeaders=host&X-Amz-Signature=3de93a7b9a7edbcc0676232820c448641df14f4a22d339ad07a8cc06200d7632},
    doi = {doi:10.1002/andp.19053231314},
    urldate = {2017-08-30},
    journal = {Ann. Phys.},
    author = {Einstein, Albert},
    year = {1905},
    pages = {639--641},
    file = {a56a92baf12b80889d9de6f28f51f22f8bec1a2b366de4e8171f0d47e890d37a.pdf:C\:\\Users\\jay\\Zotero\\storage\\TTPHSMIX\\a56a92baf12b80889d9de6f28f51f22f8bec1a2b366de4e8171f0d47e890d37a.pdf:application/pdf}
}

@article{hawking_thermodynamics_1983,
    title = {Thermodynamics of black holes in anti-de {Sitter} space},
    volume = {87},
    issn = {0010-3616, 1432-0916},
    url = {http://link.springer.com/10.1007/BF01208266},
    doi = {10.1007/BF01208266},
    language = {en},
    number = {4},
    urldate = {2017-10-13},
    journal = {Communications in Mathematical Physics},
    author = {Hawking, S. W. and Page, Don N.},
    month = dec,
    year = {1983},
    pages = {577--588},
    file = {57cae4b908ae3ac722b1eaa1.pdf:C\:\\Users\\jay\\Zotero\\storage\\DZ38DDCK\\57cae4b908ae3ac722b1eaa1.pdf:application/pdf}
}

Session Info

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.5.2  backports_1.1.3 rprojroot_1.3-2 htmltools_0.3.6 tools_3.5.2    
 [6] yaml_2.2.0      Rcpp_1.0.0      rmarkdown_1.8   knitr_1.21      xfun_0.4       
[11] digest_0.6.18   evaluate_0.12  

> rmarkdown::pandoc_version()
[1] ‘1.19.2.1’

# MiKTeX 2.9
Billow answered 10/2, 2019 at 6:57 Comment(0)
W
4

You can specify the style you want using the csl field in the YAML header, for example

---
title: 'Untitled'
output: pdf_document
bibliography: "bibliography.bib"
csl: the-astronomical-journal.csl
---

A big collection of styles is browsable at http://zotero.org/styles, and more details of bibliography handling are at https://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html.

Edited to add: If you have a csl file that is fine except for capitalization, then just delete lines saying things like text-case="capitalize-first", text-case="title", and text-case="lowercase" on the fields with the bad case handling, and whatever capitalization you use in your bib file will be copied into the bibliograpy.

One further edit: If you are aiming for PDF output, you can use natbib or biblatex to produce your bibliography, and use any BibTeX style that works with those. You can even use the command line command latex makebst to make your own custom style. If you've chosen to use style foo.bst with natbib, your YAML should look like

---
title: 'Untitled'
output: 
  pdf_document:
    citation_package: natbib
bibliography: "bibliography.bib"
biblio-style: foo
---

This has the advantage over the csl styles that it will respect the capitalization markup in your bib file, while allowing changes to suit your taste.

Wisecrack answered 10/2, 2019 at 10:58 Comment(7)
Ah, I see, then the question would be where exactly in the *.csl file sentence or title case can be specified. Would you mind to add that to your answer?Billow
I don't know what JabRef is. Somewhere in the csl file you'll have a specification like text-case="uppercase"; you want to remove that.Wisecrack
You could also switch to formatting by bibtex, by specifying citation_package: natbib (for example) as an option to the pdf_document specification. Then you'd be using a bst file to specify the style.Wisecrack
Hmm I can find several text-case="capitalize-first", text-case="title", and text-case="lowercase" in my csl...Billow
Okay, that was the trick after all! I removed all these text-case="." in the *.csl and thus removed all automation that never really worked anyway. One just has to be sure that the entries in the *.bib file are accurate. Perhaps you could add this to your helpful answer so I can accept it.Billow
While in general this is good advice, this part isn't: -- "then just delete all lines saying things like text-case="capitalize-first", text-case="title", and text-case="lowercase"" -- text-case attributes also affect how labels (such as "Edited and translated by", "edition", etc.) are cased, so by removing all of them you'll break things (e.g. getting lowercase letters after periods). The only thing you should remove in the style is text-case="title" and only where it's placed on a variable with title in it (i.e. title, container-title, or collection-title.Floccus
@adam.smith: thanks for that comment. I've edited it to clarify that not all text-case specs should be deleted.Wisecrack

© 2022 - 2024 — McMap. All rights reserved.