r代码块中的乳胶?
Latex inside r code chunk?
是否可以在 r
代码块中插入 LaTeX 代码?
我正在循环打印 tables(使用 results='asis' 选项,我知道我可以使用 print
来显示一些文本,但理想情况下我会喜欢每个 table 放在单独的 \subsection
中,或者至少显示带有格式良好的公式的注释。
...
\section{Section}
<<echo=FALSE, results="asis">>=
for (i in 1:3) {
# here I want to insert a subsection with a title contating for instance x^i
plot(i:(i*10), col=i)
}
@
...
有人也在为此苦恼吗?
感谢@Benjamin 和@Ben Bolker 的评论,我现在知道答案了:
...
\section{Section}
<<echo=FALSE, results="asis">>=
for (i in 1:3) {
cat('\subsection{$x^', i, '$}')
plot(i:(i*10), col=i)
}
@
\end{document}
...
是否可以在 r
代码块中插入 LaTeX 代码?
我正在循环打印 tables(使用 results='asis' 选项,我知道我可以使用 print
来显示一些文本,但理想情况下我会喜欢每个 table 放在单独的 \subsection
中,或者至少显示带有格式良好的公式的注释。
...
\section{Section}
<<echo=FALSE, results="asis">>=
for (i in 1:3) {
# here I want to insert a subsection with a title contating for instance x^i
plot(i:(i*10), col=i)
}
@
...
有人也在为此苦恼吗?
感谢@Benjamin 和@Ben Bolker 的评论,我现在知道答案了:
...
\section{Section}
<<echo=FALSE, results="asis">>=
for (i in 1:3) {
cat('\subsection{$x^', i, '$}')
plot(i:(i*10), col=i)
}
@
\end{document}
...