[ESS] automatically add extra info when inserting a code chunk

Douglas Bates bates at stat.wisc.edu
Sat Oct 2 16:57:24 CEST 2010


On Sat, Oct 2, 2010 at 8:51 AM, David Carslaw <david.carslaw at kcl.ac.uk> wrote:
>  Dear ESS users,
>
> When I type '<' to begin a code chunk, it is automatically expanded to:
>
> <<>>=
> @
>
> which is very useful.
>
> I wondered whether it would be possible to add a bit more information
> automatically?  Specifically:
>
> \begin{minipage}{\pagewidth}
> <<>>=
> @
> \end{minipage}
>
> The reason I would like to do this is to stop code chunks being split
> over two pages.  This is not suggested as a default for ESS but
> something that I could implement locally?
>
> Any suggestions would be very welcome.

An easier way to accomplish this is to define the environment Schunk
to create a minipage.  If you check the .tex file generated from an
Sweave file you will find that it encloses the input and output chunks
in

\begin{Schunk}
\begin{Sinput}
...
\end{Sinput}
\begin{Soutput}
...
\end{Soutput}
\end{Schunk}

and you can redefine the actions of those environments.



More information about the ESS-help mailing list