在bookdown/rmarkdown中使用简短的作者引用

8
在我的报告中,我引用了AERA、APA和NCME的《教育和心理测量标准》。
@Book{standards,
  title = {{Standards for Educational and Psychological Testing}},
  author = {{American Educational Research Association} and {American Psychological Association} and {National Council on Measurement in Education}},
  shortauthor = {AERA},
  publisher = {American Educational Research Association},
  address = {Washington, DC},
  year = {2014}
}

根据APA样式指南第6版,应使用可识别的作者组织缩写。当我在文本中首次引用这本书时,它应该看起来像这样:
“这里是一些填充文本(美国教育研究协会[AERA]、美国心理学协会和全国教育测量委员会,2014)。这里还有一些填充文本(AERA等人,2014)。”
然而,我的引用目前显示为:
“这里是一些填充文本(美国教育研究协会、美国心理学协会和全国教育测量委员会,2014)。这里还有一些填充文本(美国教育研究协会等人,2014)。”
是否有一种方法在bookdown中实现这些引用?一个最小的可再现示例在这里:https://github.com/wjakethompson/bookdown-citations

也适用于世界卫生组织(WHO)和疾病控制与预防中心(CDC)。如果使用LaTeX,可能会有所帮助;但是,我的.bib文件中的“shortauthor”无法正常工作。 - penguinv22
2个回答

4
我能够改进 Mikey Harper 提供的解决方案。它仅是一个部分解决方案,因为它使用 LaTeX 包,只能用于 PDF。主要思路是使用 这个 LaTeX 解决方案 并将其适应到 RMarkdown。 test.bib 的内容如下:
@Book{standards,
  title = {{Standards for Educational and Psychological Testing}},
  author = {{American Educational Research Association} and {American Psychological Association} and {National Council on Measurement in Education}},
  shortauthor = {{AERA et al.}},
  publisher = {American Educational Research Association},
  address = {Washington, DC},
  year = {2014}
}

Rmd文件:
---
output: 
  pdf_document:
    citation_package: biblatex
bibliography: test.bib
biblio-style: apa
biblatexoptions:
  - sortcites
header-includes:
  - \DeclareLanguageMapping{english}{american-apa}
---

[@standards]

[@standards]

结果: 在此输入图片描述

这不是完全符合要求的格式,因为短作者在作者列表末尾,但根据这个问题,没有更好的解决方案。因此,我已经打开了https://github.com/plk/biblatex-apa/issues/63


干得好:很高兴看到不需要外部的.tex文件。这是否适用于问题中提供的原始引用,其中有多个作者? - Michael Harper
@MikeyHarper 只有部分地匹配。即使使用 shortauthor = {AERA and APA and NCME},缩写也无法与其长形式匹配。 - Ralf Stubner

3
我已经开发了一个部分可行的解决方案。该解决方案可以打印长作者和缩短版本,但是仅适用于单个作者,并且因为它使用LaTeX来实现自定义,所以仅适用于PDF输出
通过修改您提供的示例,我创建了一个参考文献test.bib,如下所示:
@Book{standards2,
  title = {{Standards for Educational and Psychological Testing}},
  author = {{American Educational Research Association}},
  shortauthor = {AERA},
  publisher = {American Educational Research Association},
  address = {Washington, DC},
  year = {2014}
}

还创建了一个名为header.tex的文件。其中定义了一个新的LaTeX命令\citefull,用于以格式(作者[简写作者],年份)打印引用。该方法的设计基于此处的答案。文件内容如下:
\DeclareCiteCommand{\citefull}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \DeclareNameAlias{labelname}{first-last}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   (\printnames{author}
   [\printnames{shortauthor}],
   {\printdate})
   }

  {\usebibmacro{postnote}}

% Adds a comma between the author and year
\renewcommand*{\nameyeardelim}{\addcomma\space}

以下是Rmarkdown文件。更改使用biblatex作为引用程序包。要获得完整的引文,可以使用命令\citefull{}
---
output: 
  pdf_document:
    includes:
      in_header:  header.tex
    citation_package: biblatex
bibliography: test.bib
biblio-style: authoryear

---

\citefull{standards2}

[@standards2]

enter image description here


附加注释

正如我所说的,这是一个部分解决方案,对于多个作者来说并不适用。我必须承认,我的定制LaTeX引用的知识并不那么深入!希望有人能够进一步完善这个答案,以改进这种功能。

我尝试使用这里解释的 解决方案,但由于它要求在biblatex之前加载LaTeX软件包,所以需要修改pandoc .tex模板。我觉得这比使用头文件更不理想。

即使我编辑了原始模板,我仍然遇到了问题,无法让此解决方案起作用。我经常出现错误“\DeclareLanguageMappingSuffix”,并且无法弄清楚自己错在哪里。

我希望这些说明能够帮助任何考虑探索更好解决方案的人。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接