首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >降级PDF引用没有正确渲染(csl问题?)

降级PDF引用没有正确渲染(csl问题?)
EN

Stack Overflow用户
提问于 2015-12-22 13:18:24
回答 1查看 1.5K关注 0票数 0

我开始着手写出版物了。根本没有生成.html文件或.docx文件的问题,但是当我生成.pdf文件时,引用似乎并不继承.csl文件中定义的样式。

例如,我希望使用编号为.csl的样式:

[@Author_Title_2003] -> (1)

这在.html和.docx文件中是成功的,但在.pdfs中我得到:

[@Author_Title_2003] ->作者,2003年

也印上了方括号。

举个例子:

test.rmd:

代码语言:javascript
复制
---
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].

# REFERENCES

references.bib:

代码语言:javascript
复制
@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")提供:

代码语言:javascript
复制
/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。

EN

回答 1

Stack Overflow用户

发布于 2015-12-31 17:53:02

所以,我弄清楚了在阅读了rmarkdown的软件包代码之后发生了什么,以及( b)更好地了解了latex。我想我应该把我的答案张贴在这里,以防任何人有类似的问题。

简而言之,rmarkdown从.tex文件中生成一个.rmd文件,然后使用latexmk (或类似的R系统调用)处理.tex文件。当然,乳胶引擎实际上并不使用.csl样式的文件,而是bibtex使用.bst文件。

简而言之,对于.pdf文档中的格式化引用(从.rmd生成),可以:

  1. 创建一个具有所需格式的.bst文件,并手动转换R(Studio)生成的.tex文件。
  2. 再次使用pandoc将.tex文件转换为pdf,这可以在过程中使用.csl文件。然而,这似乎确实消除了超链接。
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34416827

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档