But in this way I cannot show the code (since echo=FALSE).And if I choose instead echo=TRUE, what I get is the caption, then the codes, and then the graph, which is also not what I want.What I would like to show is the code for R, (and) the graph plotted with that R code, with the caption above the graph.推荐答案尝试使用钩子:<<include=FALSE>>=f <- function(x, options) { paste("\\end{kframe}\n", "\\caption{", options$capT, "}\n", hook_plot_tex(x, options), "\n\\begin{kframe}", sep = "")}knit_hooks$set(plot = f)@\begin{figure}<<a-plot, echo=TRUE, capT="cap, cap, and cap">>=plot(1)@\end{figure} 这篇关于上图的标题使用了Knitr(LaTeX/PDF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 10:49
查看更多