【问题标题】:Harvard citation format in R markdownR markdown 中的哈佛引文格式
【发布时间】:2020-01-05 22:10:41
【问题描述】:

我正在为文档使用 R markdown,但是我只需要对我的引文做一些小的调整。

首先,是否有一个包可以将我的 BibTeX 参考资料转换为哈佛格式?

其次,如何在我的文本引用中获取作者的姓氏和年份以逗号分隔?

这是我的 BibTex 文件中的参考资料之一

@article{schwarz1978estimating,
  title={Estimating the dimension of a model},
  author={Schwarz, Gideon and others},
  journal={The annals of statistics},
  volume={6},
  number={2},
  pages={461--464},
  year={1978},
  publisher={Institute of Mathematical Statistics}
}


当我在文本中引用它时,它会生成 (Schwarz 1978)。我想用逗号分隔姓氏和年份。

如果需要,我还添加了我的 YAML

### Adding additional latex packages:
header-includes:
   - \usepackage{rotating, caption} \DeclareMathOperator*{\argmin}{argmin}
   - \usepackage{booktabs}
   - \usepackage{longtable}
   - \usepackage{array}
   - \usepackage{multirow}
   - \usepackage{wrapfig}
   - \usepackage{float}
   - \usepackage{colortbl}
   - \usepackage{pdflscape}
   - \usepackage{tabu}
   - \usepackage{threeparttable}
   - \usepackage{threeparttablex}
   - \usepackage[normalem]{ulem}
   - \usepackage{makecell}
   - \usepackage{xcolor}

output:
  pdf_document:
    keep_tex: yes
    template: Tex/TexDefault.txt
    fig_width: 3.5 # Adjust default figure sizes. This can also be done in the chunks of the text.
    fig_height: 3.5

【问题讨论】:

  • 哈佛的引文风格有很多种。最简单的方法是使用rticles 包,例如csl: elsevier-harvard.csl。但是,如果 rticles 不包含您想要的 CLS 变体,您可以在 zotero.org/styles 找到适合它的变体。

标签: r bibtex citations


【解决方案1】:

我依赖于许多 Rmd 样式已经添加的标准(并且非常强大)natbib 包,并且您通常可以将其添加到您使用的任何 RMarkdown 模板中(并且您没有说)。

使用我的 pinp 包的快速示例:

---
title: Example

author:
  - name: Dirk Eddelbuettel
    affiliation: a
address:
  - code: a
    address: Planet Earth

papersize: letter
fontsize: 12pt
one_column: true
bibliography: ref
output: pinp::pinp
---

# Introduction 

Two quick examples using natbib

- citet: \citet{schwarz1978estimating}
- citep: \citep{schwarz1978estimating}

For the rest, see the natbib documentation, either at source or contributed
such as https://gking.harvard.edu/files/natnotes2.pdf.

该文档的正文如下:

【讨论】:

  • 我正在使用 elsarticle。我尝试将 natbib 包添加到我的 YAML 中,但这似乎不起作用。关于如何添加包并为我的书目指定哈佛参考格式的任何建议?
  • rticles/rmarkdown/templates/elsevier_article 目录中的快速递归 grep 显示 natbib 已经是受支持的选项,请参阅 template.tex。你只需要打开它。
猜你喜欢
  • 2021-11-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-12
  • 1970-01-01
相关资源
最近更新 更多