-
-
Notifications
You must be signed in to change notification settings - Fork 880
Open
Description
Thanks for creating and maintaining knitr! 🌻
During rendering a rather large report, I encountered an issue that boils down to the MWE below. Not sure yet whether this is a knitr or a user problem. 🙂 Happy about any hint to what might be going wrong here.
\documentclass{article}
\begin{document}
\begin{figure}
\begin{center}
<<1, fig.width=11, fig=TRUE, echo=FALSE>>=
x = cumsum(rnorm(100))
# uncomment to make it work: x + 2
warning("last warning")
plot(x)
@
\end{center}
\end{figure}
\end{document}This seems to result in invalid LaTeX when processed using:
knit(Sweave2knitr("./full.l"))
When textual output is added by uncommenting x+2. The resulting LaTeX is valid. (Also when disabling output of warnings).
The relevant generated LaTeX section that does not compile is:
\begin{document}
\begin{figure}
\begin{center}
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
{\ttfamily\noindent\color{warningcolor}{\#\# Warning: last warning}}\end{kframe}
\includegraphics[width=\maxwidth]{figure/1-1}
\end{knitrout}
\end{center}
\end{figure}
\end{document}When added the line x+2 the following LaTeX is generated:
\begin{document}
\begin{figure}
\begin{center}
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{verbatim}
... loads of numbers ...
\end{verbatim}
{\ttfamily\noindent\color{warningcolor}{\#\# Warning: last warning}}\end{kframe}
\includegraphics[width=\maxwidth]{figure/1-1}
\end{knitrout}
\end{center}
\end{figure}
\end{document}For completeness, the resulting LaTeX error is:
! LaTeX Error: Something's wrong--perhaps a missing \item.
...
l.60 ...}{\#\# Warning: last warning}}\end{kframe}
Metadata
Metadata
Assignees
Labels
No labels