【发布时间】:2017-11-03 16:20:02
【问题描述】:
我喜欢将\Sexpr{''} 用于内联 R 代码,包括突出显示。但是,这似乎不适用于公式。波浪号似乎是个问题。它只是没有显示在 pdf 中。
这是一个最小的例子:
\documentclass{article}
\begin{document}
<<setup, echo=FALSE>>=
library("knitr")
knit_hooks$set(inline = function(x) {
if (is.numeric(x)) return(knitr:::format_sci(x, 'latex'))
highr:::hi_latex(x)
})
@
\Sexpr{'plot(x, y)'} works.
\Sexpr{'lm(response ~ treatment, data)'} does not show the tilde.
\end{document}
我得到的是以下内容:
感谢任何帮助。
【问题讨论】: