简体   繁体   English

Rmarkdown无法识别Pandoc过滤器

[英]Rmarkdown does not recognize pandoc filter

I would like to call a pandoc filter ( this one ) from rmarkdown/RStudio. 我想从rmarkdown / RStudio调用pandoc过滤器( 这个 )。 However, pandoc seems not to recognize the filter. 但是,pandoc似乎无法识别该过滤器。 I've handed over the filter in the YAML header. 我已经移交了YAML标头中的过滤器。 Consider this rmd file: 考虑这个rmd文件:

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

test  
s.S. 

The knitting output shows no sign that the filter was handed over to pandoc: 编织输出没有迹象表明过滤器已移交给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'

The rendered pdf file does not show the effects of the filter, see image 呈现的pdf文件未显示滤镜的效果,请参见图像 在此处输入图片说明

(The effect of the filter is to render a thin space between phrases such as "zB" or "eg".) (过滤器的作用是在诸如“ zB”或“ eg”之类的词组之间渲染一个狭窄的空间。)

What can I do to get this filter run by pandoc via rmarkdown (preferably using the YAML header)? 我该怎么做才能通过rmarkdown(最好使用YAML标头)使pandoc运行此过滤器?

I just realized (thanks to @NMarkgraf) that I had an intendation error. 我刚刚意识到(由于@NMarkgraf)我有一个意图错误。 The correct intendation in YAML is this: YAML中的正确意图是这样的:

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

Then it works - the filter is recognized. 然后开始工作-过滤器被识别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM