authoring是一个很好的文档创作工具。它可以在directory目录中使用LaTeX语句。但是,当我试图插入一个Ti_k_Z图片时,我对如何在其中添加序言\usepackage{tikz}感到迷惑不解,所以编译将失败。
示例代码:
---
title: "R Markdown with tikz picture"
author: "Me"
date: "January 10, 2015"
output: beamer_presentation
---
## TikZ picture
- Here is a TikZ picutre
\begin{tikzpicture}
\draw (0,0) circle (2cm);
\end{tikzpicture}因为它实际上将生成一个LaTeX文档,所以只需将其添加到LaTeX中,然后将其编译成PDF格式就可以了,但我希望我可以在中这样做,然后单击“针织到PDF”按钮直接生成PDF文档。
发布于 2015-01-19 11:45:42
在this post中,描述了如何在R中使用LaTeX包。但不确定tikz包是否适用于。
发布于 2015-08-01 10:34:57
这是一个关于如何在R Studio中使用tikz图的示例
---
title: "Hello World"
author: "Me"
date: "February 17, 2015"
output:
pdf_document: default
header-includes:
- \usepackage{tikz}
- \usepackage{pgfplots}
---
## TikZ picture
- Here is a TikZ picutre
\begin{tikzpicture}
\draw (0,0) circle (2cm);
\end{tikzpicture}
- Here is another TikZ picutre
\begin{tikzpicture}
\begin{axis}[xmax=9,ymax=9, samples=50]
\addplot[blue, ultra thick] (x,x*x);
\addplot[red, ultra thick] (x*x,x);
\end{axis}
\end{tikzpicture}输出:

https://stackoverflow.com/questions/27880563
复制相似问题