如何在乳胶编织图标题中加入希腊字母?

Pat*_*thy 13 latex r knitr

我搜索了这个,但是找不到它.在knitr文档中,我想将$\alpha_1 $作为标题添加到如下情节:

<<fig.cap='$\alpha_1$'>>=
 plot(1:5,1:5)
@
Run Code Online (Sandbox Code Playgroud)

试图编织这个错误

! Text line contains an invalid character.
l.172 ...axwidth]{figure/plotSigma1} \caption[$^^G
                                              lpha_1$]{$^^Glpha_1$\label...
Run Code Online (Sandbox Code Playgroud)

有办法吗?

Pat*_*thy 17

没关系 - 你只需要逃避\为alpha

<<fig.cap='$\\alpha_1$'>>=
 plot(1:5,1:5)
@
Run Code Online (Sandbox Code Playgroud)