jba*_*ums 6 r pandoc r-markdown bookdown pandoc-citeproc
我正在使用bookdown,并使用紧凑的数字引用样式从降价渲染 html ,例如,1, 2, 3显示为1-3. 我希望在每页 ( link-citations: yes)底部显示参考文献,但只显示该范围内的第一个和最后一个参考文献(仅显示参考文献 1 和 3,请参见下面的屏幕截图)。有没有办法让所有引用的参考文献显示在每一页上,但需要注意的是只有第一个和最后一个链接?
注意:所有参考文献都正确显示在最终参考书目中。
重现:
download.file('https://raw.githubusercontent.com/jgm/pandoc-citeproc/7d824e2e0d4698cf8a6d5e784aa0df27a0f2888a/tests/biblio.bib', 'ex.bib')
download.file('https://raw.githubusercontent.com/citation-style-language/styles/31187daa2c010df338c2bf9b7b30070c91b7af95/nature.csl', 'nature.csl')
Run Code Online (Sandbox Code Playgroud)
并编织一个包含以下内容的降价文件:
---
title: A title
author: An author
bibliography: ex.bib
link-citations: yes
output:
bookdown::gitbook:
pandoc_args: [ "--csl", "nature.csl" ]
---
# Intro
baz [@item1; @item2; @?????3]
# Refs
Run Code Online (Sandbox Code Playgroud)
download.file('https://raw.githubusercontent.com/jgm/pandoc-citeproc/7d824e2e0d4698cf8a6d5e784aa0df27a0f2888a/tests/biblio.bib', 'ex.bib')
download.file('https://raw.githubusercontent.com/citation-style-language/styles/31187daa2c010df338c2bf9b7b30070c91b7af95/nature.csl', 'nature.csl')
Run Code Online (Sandbox Code Playgroud)
---
title: A title
author: An author
bibliography: ex.bib
link-citations: yes
output:
bookdown::gitbook:
pandoc_args: [ "--csl", "nature.csl" ]
---
# Intro
baz [@item1; @item2; @?????3]
# Refs
Run Code Online (Sandbox Code Playgroud)
我的感觉是,您需要查看文件中的两个nature.csl元素
[第 104-131 行]。
\n\n问题似乎是您的bibliography第 112 行依赖于citation第 104 行的定义。该术语collapse与您的格式相互作用bibliography。
我的建议是您访问引文样式语言网站并查看参考样式以更新您的特定格式。希望这能帮助您指明正确的方向。
\n\n我的感觉是您需要cite-group-delimiter在.csl文件中创建自定义定义而不是使用collapse. 可能很棘手,但感觉可行。
<citation collapse="citation-number">\n <sort>\n <key variable="citation-number"/>\n </sort>\n <layout vertical-align="sup" delimiter=",">\n <text variable="citation-number"/>\n </layout>\n </citation>\n <bibliography et-al-min="6" et-al-use-first="1" second-field-align="flush" entry-spacing="0" line-spacing="2">\n <layout suffix=".">\n <text variable="citation-number" suffix="."/>\n <group delimiter=" ">\n <text macro="author" suffix="."/>\n <text macro="title" suffix="."/>\n <choose>\n <if type="chapter paper-conference" match="any">\n <text term="in"/>\n </if>\n </choose>\n <text macro="container-title"/>\n <text macro="editor"/>\n <text macro="volume"/>\n <text variable="page"/>\n <text macro="issuance"/>\n <text macro="access"/>\n </group>\n </layout>\n </bibliography>\nRun Code Online (Sandbox Code Playgroud)\n\n引文
\n\ncs:itation 元素描述引文的格式,其中包含对书目来源的一个或多个引用 (\xe2\x80\x9ccites\xe2\x80\x9d)。引文以文本内引文(作者中(例如 \xe2\x80\x9c[Doe]\xe2\x80\x9d)、作者日期(\xe2\x80\x9c[Doe 1999]\xe2 \x80\x9d)、标签(\xe2\x80\x9c[doe99]\xe2\x80\x9d)或数字(\xe2\x80\x9c 1 \xe2\x80\x9d)格式)或注释。必需的 cs:layout 子元素描述引文中应包含什么以及如何包含书目数据(请参阅布局)。cs:layout 前面可以有一个 cs:sort 元素,该元素可用于指定引文中的引用应如何排序(请参阅排序)。cs:itation 元素可以携带特定于引文的选项和可继承名称选项的属性。cs:引用元素的示例:
\n\n<citation>\n <sort>\n <key variable="citation-number"/>\n </sort>\n <layout>\n <text variable="citation-number"/>\n </layout>\n</citation>\nRun Code Online (Sandbox Code Playgroud)\n\n给 CSL 处理器开发人员的注释 在注释样式中,引文本身通常就是一个句子。因此,当注释中没有前面的文本时,引文的第一个字符最好应大写。在所有其他情况下(例如,当将引文插入到预先存在的脚注中间时),应按原样打印引文。
\n\n参考书目
\n\ncs:bibliography 元素描述了参考书目的格式,其中列出了一个或多个参考书目来源。所需的 cs:layout 子元素描述了每个书目条目应如何格式化。cs:layout 前面可以有一个 cs:sort 元素,该元素可用于指定参考书目中的引用应如何排序(请参阅排序)。cs:bibliography 元素可以携带参考书目特定选项和可继承名称选项的属性。cs:bibliography 元素的示例:
\n\n<bibliography>\n <sort>\n <key macro="author"/>\n </sort>\n <layout>\n <group delimiter=". ">\n <text macro="author"/>\n <text variable="title"/>\n </group>\n </layout>\n</bibliography>\nRun Code Online (Sandbox Code Playgroud)\n