用knitr制作的乳胶图标题中的文字

luc*_*ano 3 r knitr

我试图用knitr创建的图形标题中的一些文字斜体显示.我在.Rnw文件中有以下代码,我正在使用knitr将其转换为.tex文件:

<<plot_setosa, fig.cap="A plot of $\\textit{setosa}$">>=

plot(iris[iris$Species == "setosa",])

@
Run Code Online (Sandbox Code Playgroud)

如何在图标题中将setosa斜体化?

Tyl*_*ker 8

尝试:

<<plot_setosa, fig.cap="A plot of \\textit{setosa}">>=

plot(iris[iris$Species == "setosa",])

@
Run Code Online (Sandbox Code Playgroud)

不需要 $$