【问题标题】:minimal working example of tikz usage in bookdown?bookdown 中 tikz 使用的最小工作示例?
【发布时间】:2018-08-28 08:31:24
【问题描述】:

我一直在尝试自己先在 bookdown 中实现 tikz 块,然后关注 this thread

不幸的是,我不断遇到各种错误和不兼容问题,例如这个:

工具错误::texi2dvi(texf, pdf = !to_svg, clean = TRUE) : 无法在 '.\tikzf702b605920.tex' 上运行 'pdflatex'

(尽管 tinytex::pdflatex('test.tex') 本身工作正常)

在他的博客和 github 上,Yihui Xie 提到这绝对是可能的,但我找不到任何可行的例子,所以我希望这里的任何人都可以分享一个,请(或指出我做错了什么)

【问题讨论】:

  • 你找到这个了吗?我遇到了类似的问题,它说无法运行latex(不是pdflatex)。

标签: r latex tikz bookdown


【解决方案1】:

@PaulLemmens,我发现了我的问题所在。此处免责声明,我使用的是 windows,而我在 linux/macos 上使用 r 的同事都没有这个问题。

当在其中一个块中使用 engine=tikz 时,knitr 出现问题。要使其正常工作,需要安装 imagemagick (https://www.imagemagick.org/script/index.php) 和 GhostScript (https://www.ghostscript.com/)。除此之外,我不得不稍微重写 knitr (https://github.com/darthaline/knitr)。这是一个快速而肮脏的解决方案,但它对我有用。在 R/engine.R 的第 281 行,imagemagick 的转换路径是硬编码的,否则 Windows 似乎将其解释为 System32 目录中的“convert.exe”(ImageMagick PATH not being recognized with engine = "tikz" in knitr

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    • 1970-01-01
    • 2013-10-08
    • 2019-05-23
    • 2017-06-18
    • 2015-06-19
    相关资源
    最近更新 更多