Rmarkdown无法识别pandoc过滤器

问题描述 投票:0回答:1

我想从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.”或“eg”之类的短语之间呈现薄空格。)

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

filter latex knitr r-markdown pandoc
1个回答
2
投票

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

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

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

© www.soinside.com 2019 - 2024. All rights reserved.