[R] in Rd documentation, line breaks in code blocks?

Ulrich Staudinger ustaudinger at gmail.com
Thu Nov 29 10:20:54 CET 2012


Have it for now ...

\preformatted{
..
}

does the job.



On Wed, Nov 28, 2012 at 9:21 PM, Ulrich Staudinger
<ustaudinger at gmail.com> wrote:
> Hi everyone,
>
> following the gentle advice from this list, I write a package
> description Rd file.
>
> I have a section in there. In this section, I have a subsection. In
> this subsection, I want to have a code fragment. This code fragment
> should include several commands, spanning several lines.
>
> Example:
> ==========
> \name{aqr-package}
> \alias{aqr-package}
> \alias{aqr}
> \docType{package}
> \title{Package level introduction}
> \description{description goes here.}
>
> \section{sec1}{
>
> some text.
>
> \subsection{subsec1}{
> some text.
>
> \code{
> require(aqr)
> require(quantmod)
> # fetch them via quantmod
> getSymbols(c("MSFT", "SAP"))
> ...
> }
> }
> }
> ==========
>
> The problem is, everything in \code{} gets printed into one line.
> If I add \cr at the end of every line in \code, it gets broken
> properly, but a warning says "Tag \cr is invalid in a \code block"
>
> What's the right way to include code (same problem with verbatim) in a
> subsection?
>
> Thanks
> Ulrich
>
>
>
>
> --
> Ulrich Staudinger
>
> http://www.activequant.org
> Connect online: https://www.xing.com/profile/Ulrich_Staudinger



-- 
Ulrich Staudinger

http://www.activequant.org
Connect online: https://www.xing.com/profile/Ulrich_Staudinger




More information about the R-help mailing list