【问题标题】:Adjust cite format and style in RMarkdown在 RMarkdown 中调整引用格式和样式
【发布时间】:2019-05-31 12:31:51
【问题描述】:

我希望你玩得开心。我正在处理RMarkdown 的报告,我想问一个与风格相关的问题。我正在.Rmd 文件中运行下一个代码:

---
bibliography: bb.bib
fontsize: 11pt
nocite: '@*'
output: pdf_document
link-citations: true
---
\newpage

\section{Testing}\label{sec1}
```{r}
summary(cars)
```
\section{Demo}
This was done using @shiina and we will use some info from Section \ref{sec1} to do.
```{r}
summary(iris)
```
\section{References}

一切正常,我明白了:

在上一个圆圈中的图表是我所做的引用,但我想改变风格。在这种情况下,只有年份链接到参考书目,而作者部分Shiina and Birge 不链接到参考书目。

是否可以调整引用的样式,以便我可以拥有这个:Shiina and Birge, 2004,作者和年份都与参考书目相关联。或者可能是这样的:[Shiina and Birge, 2004] 因为RMarkdown 使用() 而不是[]。我不知道如何在 RMarkdown 中设置该样式。

bb.bib文件的内容如下:

@article {shiina,
author = {Shiina, Takayuki and Birge, John R.},
title = {Stochastic unit commitment problem},
journal = {International Transactions in Operational Research},
volume = {11},
number = {1},
publisher = {Blackwell Publishing},
pages = {19--32},
year = {2004},
}

@book{groewe2001,
  title={Stochastic unit commitment in hydro-thermal power production planning},
  author={Gr{\"o}we-Kuska, N. and R{\"o}misch, W.},
  year={2001},
  series = { Preprints aus dem Institut f{\"u}r Mathematik },
  publisher = { Humboldt-Universit{\"a}t zu Berlin, Institut f{\"u}r Mathematik },
}

非常感谢您的帮助。

【问题讨论】:

    标签: r rstudio r-markdown


    【解决方案1】:

    您可以在 YAML 标头中添加一个 csl 字段作为指向定义样式的 csl file 的链接:

    ---
    bibliography: bb.bib
    fontsize: 11pt
    nocite: '@*'
    csl: cslfilename.csl
    output: pdf_document
    link-citations: true
    ---
    

    See here 以获取更多示例。有一长串csl files on Github,它们都是modifiable

    【讨论】:

    • 谢谢@Mikko,你能推荐我一个符合我想要的风格的 csl 文件吗?
    • @Duck 一个很好的观点。我工作很忙。看看我以后能不能找到解决办法。如果我不能或者如果有人在我之前找到它,我会删除这个答案。
    猜你喜欢
    • 1970-01-01
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-07
    • 2019-07-06
    • 1970-01-01
    相关资源
    最近更新 更多