# [R] Sweave schunk placement

Ista Zahn izahn at psych.rochester.edu
Fri Feb 20 17:47:33 CET 2009

Right, thanks. I feel a bit sheepish about asking the question now.
I'm using the latex function in the Hmisc package to generate the
tables, which is why it wasn't obvious to me that I just needed to
insert the new line myself.
Thanks,
Ista

On Fri, Feb 20, 2009 at 11:24 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 2/20/2009 11:08 AM, Ista Zahn wrote:
>>
>> Dear Professor Leisch + R helpers,
>> For the past few days I have been trying to figure out why the LaTeX
>> endfloat package is not working with Sweave. I figured it out, and
>> it's trivial: The endfloat package requires that \begin{table} and
>> \end{table} commands are on their own line. But Sweave is writing
>> LaTeX code like \end{table}\end{Schunk} which causes endfloat to
>> choke. Simply moving the code down to a new line like this:
>> \end{table}
>> \end{Schunk}
>>  fixes the problem, but it is annoying to do this for every table
>> everytime I re-run Sweave. I don't understand LaTeX that well, so I'd
>> be really grateful if someone can tell me how to modify Sweave.sty (or
>> another file if needed) so that the \end{Schunk}'s are written on new
>> lines.
>
> I don't know how you are getting \end{table} printed, but ask for a newline
> after that.  (Sweave.sty plays no part in the production of the .tex file.
>  That is done completely by R code, some of which is written by the author
> of the document, i.e. you.)
>
> Duncan Murdoch
>
>