<<newChunk,echo=FALSE,comment=NA,background=NA>>=
x <- "\\includegraphics[width=\\maxwidth]{figure/Kompetenz1.pdf}"
cat(x)
@
如果我在我的 .Rnw 文件中运行这个 r 代码,我将在我的 .tex 文件中得到以下输出:
\begin{knitrout}
\definecolor{shadecolor}{rgb}{1, 1, 1}\color{fgcolor}\begin{kframe}
\begin{verbatim}
\includegraphics[width=\maxwidth]{figure/Kompetenz1.pdf}
\end{verbatim}
\end{kframe}
\end{knitrout}
在我的 .tex 文件中没有任何环境的情况下,如何仅获取\includegraphics{...} ?
最佳答案
我不确定你为什么首先使用 Knitr。看起来您只是想在您的 latex 文档中包含一个 PDF。为此,我将使用以下命令:
\includepdf[pages=-]{figure/Kompetenz1.pdf}
或者
\includegraphics[width=\maxwidth]{figure/Kompetenz1.pdf}
在您的 Rnw 文件中。这里不需要 Knitr block 。
关于r - 没有 knitrout 和逐字环境的 block 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26400959/