Rmarkdown无法识别pandoc过滤器

时间:2017-12-17 20:11:00

标签: filter latex knitr r-markdown pandoc

我想从rmarkdown / RStudio调用一个pandoc过滤器(this one)。但是,pandoc似乎没有识别过滤器。我已经在YAML标题中移交了过滤器。考虑这个rmd文件:

---
title: "test"
output: pdf_document
header-includes:
    - \usepackage{xspace}
pandoc_args:
    - --filter
    - pandoc-filter/typography.py
---

test  
s.S. 

编织输出显示没有迹象表明过滤器被移交给pandoc:

/usr/local/bin/pandoc +RTS -K512m -RTS test_typography-py.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test_typography-py.pdf --template /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --pdf-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in'

渲染的pdf文件未显示过滤器的效果,请参阅图像enter image description here

(过滤器的效果是在诸如“z.B.”或“例如”之类的短语之间呈现薄空格。)

如何通过rmarkdown(最好使用YAML标头)通过pandoc运行此过滤器?

1 个答案:

答案 0 :(得分:2)

我刚刚意识到(感谢@NMarkgraf)我有一个意图错误。 YAML中的正确意图是:

---
title: "test"
header-includes:
  - \usepackage{xspace}
output: 
  pdf_document:
    pandoc_args:
      - --filter
      - typography.py
---

然后它可以工作 - 识别过滤器。

相关问题