我开始着手写出版物了。根本没有生成.html文件或.docx文件的问题,但是当我生成.pdf文件时,引用似乎并不继承.csl文件中定义的样式。
例如,我希望使用编号为.csl的样式:
[@Author_Title_2003] -> (1)
这在.html和.docx文件中是成功的,但在.pdfs中我得到:
[@Author_Title_2003] ->作者,2003年
也印上了方括号。
举个例子:
test.rmd:
---
title: 'My Title'
author: "Me me me me!"
output: pdf_document
bibliography: references.bib
csl: elsevier-vancouver.csl
---
Application written in the R programming language [@RCoreTeam] using the Shiny framework [@Chang2015].
# REFERENCESreferences.bib:
@Misc{Chang2015,
Title = {shiny: Web Application Framework for R. R package version 0.12.1},
Author = {Chang, W. and Cheng, J. and Allaire, JJ. and Xie, Y. and McPherson, J. },
Year = {2015},
Type = {Computer Program},
Url = {http://CRAN.R-project.org/package=shiny}
}
@Article{RCoreTeam,
Title = {R: A Language and Environment for Statistical Computing},
Author = {{R Core Team}},
Year = {2015},
Type = {Journal Article},
Url = {http://www.R-project.org}
}elsevier-vancouver.csl:链接
运行rmarkdown::render("test.Rmd", "pdf_document")提供:
/home/jordan/.cabal/bin/pandoc +RTS -K512m -RTS paper.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output paper.tex --template /home/jordan/R/x86_64-pc-linux-gnu-library/3.2/rmarkdown/rmd/latex/default-1.14.tex --highlight-style tango --latex-engine pdflatex --natbib --variable graphics=yes --variable 'geometry:margin=1in' --bibliography references.bib 输出文件是:

请参阅格式错误的引文。还请注意,不管头中的csl参数如何,都会生成这种格式。任何帮助都将不胜感激。
pandoc版本1.15.2.1,版本0.8.1.3。
发布于 2015-12-31 17:53:02
所以,我弄清楚了在阅读了rmarkdown的软件包代码之后发生了什么,以及( b)更好地了解了latex。我想我应该把我的答案张贴在这里,以防任何人有类似的问题。
简而言之,rmarkdown从.tex文件中生成一个.rmd文件,然后使用latexmk (或类似的R系统调用)处理.tex文件。当然,乳胶引擎实际上并不使用.csl样式的文件,而是bibtex使用.bst文件。
简而言之,对于.pdf文档中的格式化引用(从.rmd生成),可以:
https://stackoverflow.com/questions/34416827
复制相似问题