Rmarkdown 中的引用:使用 .bib 文件中的标题大写

Edu*_*ual 5 bibtex bibliography knitr r-markdown csl

我正在使用 Rmarkdown 与 RStudio 和knitr. 为了格式化参考文献,我使用了Global Ecology and Biogeography.csl杂志的文件,该文件是我从https://www.zotero.org/styles获得的。

\n\n

我的问题是标题会自动转换为句子大小写。这对于小写的物种名称来说尤其成问题。

\n\n

例如,

\n\n
Two types of morphophysiological dormancy in seeds of two genera (Osmorhiza and Erythronium) with an Arcto-Tertiary distribution pattern\n
Run Code Online (Sandbox Code Playgroud)\n\n

变成

\n\n
Two types of morphophysiological dormancy in seeds of two genera (osmorhiza and erythronium) with an arcto-tertiary distribution pattern\n
Run Code Online (Sandbox Code Playgroud)\n\n

根据这个问题:如何设置对“句子大小写”的引用?,我应该从.csl文件中删除所有像text-case=. 问题是没有这样的行,但我的标题仍然被转换了。

\n\n

作为额外奖励,我还想知道如何将物种名称保留为斜体。

\n\n

Rmarkdown 文件

\n\n
---\ntitle: "Untitled"\noutput: html_document\nbibliography: refs.bib\ncsl: global-ecology-and-biogeography.csl\nlink-citations: yes\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE)\n```\n\n[@RN1045]\n\n# References\n
Run Code Online (Sandbox Code Playgroud)\n\n

包含参考书目的 refs.bib 文件

\n\n
@article{RN1045,\n   author = {Baskin, Carol C.; Meyer, Susan E.; Baskin, Jerry M.},\n   title = {Two types of morphophysiological dormancy in seeds of two genera (Osmorhiza and Erythronium) with an Arcto-Tertiary distribution pattern},\n   journal = {American Journal of Botany},\n   volume = {82},\n   number = {3},\n   pages = {293-298},\n   ISSN = {00029122},\n   DOI = {10.1002/j.1537-2197.1995.tb12633.x},\n   url = {<Go to ISI>://WOS:A1995QM77500001; https://bsapubs.onlinelibrary.wiley.com/doi/abs/10.1002/j.1537-2197.1995.tb12633.x},\n   year = {1995},\n   type = {Journal Article}\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

具有以下样式的 global-ecology-and-biogeography.csl 文件

\n\n
<?xml version="1.0" encoding="utf-8"?>\n<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">\n  <info>\n    <title>Global Ecology and Biogeography</title>\n    <id>http://www.zotero.org/styles/global-ecology-and-biogeography</id>\n    <link href="http://www.zotero.org/styles/global-ecology-and-biogeography" rel="self"/>\n    <link href="http://www.zotero.org/styles/bioinformatics" rel="template"/>\n    <link href="http://onlinelibrary.wiley.com/journal/10.1111/%28ISSN%291466-8238/homepage/ForAuthors.html" rel="documentation"/>\n    <author>\n      <name>Bernhard Hoi\xc3\x9f</name>\n      <email>bernhard.hoiss@uni-wuerzburg.de</email>\n    </author>\n    <category citation-format="author-date"/>\n    <category field="biology"/>\n    <issn>1466-822X</issn>\n    <eissn>1466-8238</eissn>\n    <summary>The Global Ecology and Biogeography style</summary>\n    <updated>2016-09-10T14:32:31+00:00</updated>\n    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>\n  </info>\n  <locale>\n    <terms>\n      <term name="edition" form="short">edn.</term>\n      <term name="editor" form="verb-short">ed. by</term>\n      <term name="translator" form="verb-short">trans.</term>\n    </terms>\n  </locale>\n  <macro name="editor">\n    <names variable="editor" delimiter=",">\n      <label form="verb-short" prefix=" (" suffix=" "/>\n      <name sort-separator=", " and="text" initialize-with="." delimiter=", " suffix=")"/>\n    </names>\n  </macro>\n  <macro name="author">\n    <names variable="author">\n      <name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with="." delimiter=", " delimiter-precedes-last="never"/>\n      <label form="short" prefix=" "/>\n      <substitute>\n        <names variable="editor"/>\n        <text variable="title"/>\n      </substitute>\n    </names>\n  </macro>\n  <macro name="author-short">\n    <names variable="author">\n      <name form="short" and="symbol" delimiter=", " initialize-with=". "/>\n      <et-al term="et-al" font-style="italic"/>\n      <substitute>\n        <names variable="editor"/>\n        <names variable="translator"/>\n        <text variable="title"/>\n      </substitute>\n    </names>\n  </macro>\n  <macro name="title">\n    <text variable="title"/>\n  </macro>\n  <macro name="publisher">\n    <group delimiter=", ">\n      <text variable="publisher"/>\n      <text variable="publisher-place"/>\n    </group>\n  </macro>\n  <macro name="year-date">\n    <date variable="issued">\n      <date-part name="year"/>\n    </date>\n  </macro>\n  <macro name="edition">\n    <choose>\n      <if is-numeric="edition">\n        <group delimiter=" ">\n          <number variable="edition" form="ordinal"/>\n          <text term="edition" form="short"/>\n        </group>\n      </if>\n      <else>\n        <text variable="edition" suffix="."/>\n      </else>\n    </choose>\n  </macro>\n  <citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" collapse="year-suffix" year-suffix-delimiter=",">\n    <sort>\n      <key macro="year-date"/>\n      <key macro="author-short"/>\n    </sort>\n    <layout prefix="(" suffix=")" delimiter="; ">\n      <group delimiter=", ">\n        <text macro="author-short"/>\n        <text macro="year-date"/>\n        <text variable="locator"/>\n      </group>\n    </layout>\n  </citation>\n  <bibliography hanging-indent="true" entry-spacing="0">\n    <sort>\n      <key macro="author"/>\n      <key variable="title"/>\n    </sort>\n    <layout suffix=".">\n      <text macro="author"/>\n      <date variable="issued" prefix=" (" suffix=")">\n        <date-part name="year"/>\n      </date>\n      <choose>\n        <if type="bill book graphic legal_case legislation motion_picture report song" match="any">\n          <group delimiter=" " prefix=" ">\n            <text macro="title" font-style="italic" suffix=","/>\n            <text macro="edition"/>\n            <text macro="editor"/>\n            <text macro="publisher"/>\n          </group>\n        </if>\n        <else-if type="chapter paper-conference" match="any">\n          <text macro="title" prefix=" " suffix="." font-style="italic"/>\n          <group prefix=" " suffix=",">\n            <text variable="container-title" font-style="italic"/>\n            <text variable="collection-title" prefix=" " suffix="."/>\n            <text macro="editor"/>\n          </group>\n          <group suffix=".">\n            <group prefix=" " suffix=".">\n              <label variable="page" suffix=" " form="short"/>\n              <text variable="page"/>\n            </group>\n            <text macro="publisher" prefix=" "/>\n          </group>\n        </else-if>\n        <else>\n          <text macro="title" prefix=" " suffix="."/>\n          <group delimiter=", " prefix=" " suffix=".">\n            <text variable="container-title" form="long" font-style="italic"/>\n            <text variable="volume" font-weight="bold"/>\n            <text variable="page"/>\n          </group>\n        </else>\n      </choose>\n    </layout>\n  </bibliography>\n</style>\n
Run Code Online (Sandbox Code Playgroud)\n

Rin*_*lle 5

它看起来像knitr用于pandoc-citeproc引文渲染,并且您可以通过在标题周围使用另一组括号来保留大小写。请参阅https://github.com/jgm/pandoc-citeproc/issues/269。

所以而不是

title = {Two types of morphophysiological dormancy in seeds of two genera (Osmorhiza and Erythronium) with an Arcto-Tertiary distribution pattern}
Run Code Online (Sandbox Code Playgroud)

你会用

title = {{Two types of morphophysiological dormancy in seeds of two genera (Osmorhiza and Erythronium) with an Arcto-Tertiary distribution pattern}}
Run Code Online (Sandbox Code Playgroud)

另请参阅https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md#titles-title-vs-sentence-case,

对于物种名称,请尝试\textit{Osmorhiza}. (根据https://latex.org/forum/viewtopic.php?t=21255)

  • 谢谢,这解决了我的问题。对于那些(像我一样)从 EndNote 库生成“.bib”文件的人,我将补充一点,您可以编辑 EndNote 的 BibTeX 导出样式,以便它在您的标题中插入双 {{}} 以保护它们免受大小写更改。您还可以在 EndNote 引用中插入 `\textit{Osmorhiza}` ,以便在使用 `knitr` 生成的最终文档中使用斜体,但如果您想在 Word 中使用它,它就会像这样显示。 (2认同)