【发布时间】:2017-01-24 15:05:38
【问题描述】:
我正在尝试使用tufte_handout 在 R Markdown 中生成 tikz 图形,我正在 RStudio 中运行它。这是我的sessionInfo():
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin16.1.0 (64-bit)
Running under: macOS Sierra 10.12.2
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] backports_1.0.4 magrittr_1.5 tufte_0.2 rprojroot_1.1 htmltools_0.3.5 tools_3.3.2 yaml_2.1.14 Rcpp_0.12.8
[9] stringi_1.1.2 rmarkdown_1.3 knitr_1.15.1 stringr_1.1.0 digest_0.6.11 evaluate_0.10
我的例子(还没有工作)是:
---
title: "TikzTest"
output:
tufte::tufte_handout: default
---
This is a test of the R Markdown tufte_handout.^[This is a sidenote in the tufte_handout] To use the tikz package, you have to include this code chunk:
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,dev = 'tikz')
library(tikzDevice)
```
But it doesn't work?:
```{r,engine='tikz'}
\begin{tikzpicture}[line width=0.05cm]
\node [align=center] (x) at (0,0) {$X$};
\node [align=center] (y) at (2.55,0) {$Y$};
\begin{scope}[line width=.05cm,shorten >= 5pt, shorten <= 5pt]
\draw[->,color=black] (x) to (y);
\end{scope}
\end{tikzpicture}
```
当我编织这个时,我收到以下错误:
Error in tools::texi2dvi(texf, pdf = !to_svg, clean = TRUE) :
Running 'texi2dvi' on './tikz145322b8f468.tex' failed.
Messages:
sh: /usr/local/opt/texinfo/bin/texi2dvi: No such file or directory
Calls: <Anonymous> ... call_block -> block_exec -> in_dir -> engine -> <Anonymous>
Execution halted
我已经安装了 MacTeX-2016 分发版
【问题讨论】:
标签: r knitr r-markdown tikz