Skip to content

in Rd documentation, line breaks in code blocks?

2 messages · Ulrich Staudinger

#
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
#
Have it for now ...

\preformatted{
..
}

does the job.



On Wed, Nov 28, 2012 at 9:21 PM, Ulrich Staudinger
<ustaudinger at gmail.com> wrote: