rstudio - 如何强制 knitr 直接输入 tikzpicture?
问题描述
我的目标是通过将手写的 .tex 文件和使用 knitr 从 Rmarkdown 文件生成的 .tex 文件与呈现为 tikzpicture 的图形混合来生成文档。
如何实现生成的 .tex 文件以简单地包含
\begin{figure}
\input{unnamed-chunk-1-1.tex}
\end{figure}
我正在努力将 tikz 作为设备。我尝试了该tikzDevice
库,并knitr::opts_chunk$set(dev="tikz")
设法为每个块创建了一个带有 tikzpicture 环境的 .tex 文件。不幸的是,knitr 将所述 .tex 文件渲染为 pdf 并生成了一个\includegraphics
命令。最烦人的问题是,我需要将我的标题复制粘贴到options(tikzLatexPackages)
冗余或“TeX 无法计算指标”中。
Additionally I did not manage to put the graphics into a figure
environment. If I simply enclose the chunk with \begin{figure}
and \end{figure}
, it will not include the pdf at all anymore and replace the command with ![](figures/unnamed-chunk-1-1.pdf)<!-- -->
.
After going through the Rmarkdown documentation, I tried setting the chunkoption external=TRUE
, but that had no effect.
EDIT: The environment should be generated when setting the chunk option fig.env='figure'
, but like external=TRUE
, that had no effect on the generated .tex file.
解决方案
推荐阅读
- sanity - 如何将内部连接作为 GROQ 中的条件?
- google-bigquery - 如何在不破坏 BigQuery Connector for Excel 的情况下运行标准 SQL 查询?
- switch-statement - 如何在不使用字母或数字的情况下制作带有单词或短语的选项菜单?
- javascript - 将对象值返回给父函数
- regex - 如何使用正则表达式找到某个单词之前的所有单词?
- python-3.x - 从 git hash 获取 git pull 请求号?
- amazon-athena - 从嵌套的 json 源创建 Athena 表
- python - 制作复合小部件时设置小部件默认值
- go - 等待一个 goroutine 完成
- python-3.x - 斯坦福的 coreNLP 名称实体识别器抛出错误 500 服务器错误:url 的内部服务器错误