[Rd] Rd - \preformatted, \section and LaTeX problem

Henrik Bengtsson hb at maths.lth.se
Wed Mar 10 12:08:28 MET 2004


I have found an unwanted feature in the Rd to LaTeX convertion
regarding \preformatted inside a \section. I have created an Rd
example below, which generates an error in the following 'R CMD check'

 * creating aroma.affine-manual.tex ... OK
 * checking aroma.affine-manual.tex ... ERROR
 LaTeX errors when creating DVI version.
 This typically indicates Rd problems.

I believe the Rd code itself explains the details, the reasons, and
the work around. Should it be reported as a bug?

Best wishes

Henrik Bengtsson

running Rv1.8.1 and MikTeX v2.4 on WinXP with B.R.'s Rtools.

Begin Rd example


No problems here!

\section{A section}{
If an 'preformatted' Rd environment (or whatever it's called) 
within a 'section' is not followed by a newline before the end
of the 'section' the LaTeX version of it generated by \code{R CMD
will end like:
and the LaTeX compiler will complain saying:
! LaTeX Error: \begin{list} on input line 49 ended by \end{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.59 \end{document}
For LaTeX to work, there has to be a newline between like this:
The problem is that empty lines are stripped (for 'section's only?!?).

A work around seems to add a non-empty line. Try for instance to add
following after this 'preformatted' Rd environment at it will
work (as it is now, it will not work!):
\emph{} % A dummy line to "fool" R CMD check and LaTeX
End Rd example

More information about the R-devel mailing list