I need R Chunk Code
within Enumeration Environment
in Rnw
file. The following .Rnw
document works fine.
\documentclass{article}
\begin{document}
\begin{enumerate}
\item The quick brown fox jumps over the lazy dog.\\
<<boring-random>>=
1:4
@
\\ The quick brown fox jumps over the lazy dog.
\item The quick brown fox jumps over the lazy dog.
\end{enumerate}
\end{document}
But when I import the same file to LyX
, the R Chunk Code
delimiter @
combines with text (See image below). I would highly appreciate if you guide me how to put R Chunk Code
within Enumeration Environment
in LyX
using LyX
built-in Enumeration Environment
. Thanks
Best Answer
You've "kind of" run into a LyX bug/feature enhancement http://www.lyx.org/trac/ticket/8875
The workaround is simple: add an empty line at the end of your ERT box, after "@".
I say "kind of" above because once that ticket is fixed (possibly in 2.2.0 version which won't be out for a while), I'm not sure we will activate that option for ERT. It will be activated for the Chunk inset, which if you're using LyX 2.1.1 you can get by going to Insert > Custom Insets > Chunk. It's a matter of preference whether to use that inset or ERT. Note that the knitr author, also a LyX user, prefers to use ERT. I prefer to use the Chunk inset.