From mschwartz at mn.rr.com  Thu Sep 21 17:58:08 2006
From: mschwartz at mn.rr.com (Marc Schwartz (via MN))
Date: Thu, 21 Sep 2006 10:58:08 -0500
Subject: [Rd] Sweave processes \Sexpr in commented
	LaTeX	source	(2.3.1patched and 2.4.0)
In-Reply-To: <17682.42067.760848.723873@celebrian.ci.tuwien.ac.at>
References: <1158711280.5348.24.camel@localhost.localdomain>
	<17680.58131.594486.582029@celebrian.ci.tuwien.ac.at>
	<x2wt7y261y.fsf@viggo.kubism.ku.dk> <m2psdq7dpy.fsf@ziti.local>
	<b0808fdc0609200947q16f14052o49fb18e62c439439@mail.gmail.com>
	<m2d59q5uwh.fsf@ziti.local>
	<17682.42067.760848.723873@celebrian.ci.tuwien.ac.at>
Message-ID: <1158854289.3888.60.camel@localhost.localdomain>

On Thu, 2006-09-21 at 16:40 +0200, Friedrich Leisch wrote:
> >>>>> On Wed, 20 Sep 2006 10:07:26 -0700,
> >>>>> Seth Falcon (SF) wrote:
> 
>   > "Antonio, Fabio Di Narzo" <antonio.fabio at gmail.com> writes:
>   >> 2006/9/20, Seth Falcon <sfalcon at fhcrc.org>:
>   >>> Peter Dalgaard <p.dalgaard at biostat.ku.dk> writes:
>   >>> > ..not to mention TeX comments inside Sexpr (e.g. %*%...). Skipping
>   >>> > lines with % as the first character might be a viable compromise
>   >>> > though.
>   >>> 
>   >>> +1.  You could probably ignore any lines where the first
>   >>> non-whitespace char is '%'.  But if that seems to risky, then only
>   >>> recognizing first-char-is-% seems a worthwhile heuristic.
>   >>> 
>   >>> Another place where this has bitten people is when they do:
>   >>> 
>   >>> %\usepackage{Sweave}
>   >>> 
>   >>> Sweave picks that up and doesn't insert the usepackage line itself.
>   >> 
>   >> I've found that extremely useful for sweaving Stex files which aren't
>   >> "master" files (i.e., only files to include in a main latex file).
>   >> Inserting '\usepackage{Sweave}' in each would result in a latex error.
>   >> So commenting it out is a useful workaround.
> 
>   > Commenting it out _and_ having Sweave see it?
> 
> Yes, I actually do that quite often, e.g., when I have my own
> definitions of the Sinput/Soutput/... environments in the document
> preamble and don't want to use any Sweave style file.
> 
> Note that we recently had a thread on the \usepackage{Sweave} path
> insertion problems in windows and as a result I will stop being
> special about it at all, i.e., users will have to put a
> \usepackage{Sweave} into their documents, and take care that latex
> finds a version of it.
> 
> The thread was end of August and I didn't do it for 2.4 because I
> didn't want to break all vignettes that close to a release. But I will
> do for the 2.5 series once 2.4.0 is released.
> 
> Ad evaluation of \Sexpr{}: That can be considered a bug, hence I could
> try a fix even in feature freeze. But as I will be offline for a week
> starting tomorrow this will also have to wait until the 2.5 series (or
> 2.4.1, depending on the change).
> 
> My favorite would not be a separate option eval.Sexpr but eveluate
> only when the global option for eval is true. Then an
> 
> 	\SweaveOpts{eval=false}
> 
> at any place in a document would stop all evalualtions, be it code
> chunks (which do not override the default) or Sexpr. If somebody has
> good useage for a separate option I could be convinced to have it,
> otherwise I'll go for \Sexpr{} listening to the eval option.

Fritz,

I appreciate your consideration of this issue.

I think that your solution using a global evaluation option would be
fine.

Thanks again,

Marc




[Rd] Sweave processes \Sexpr in commented LaTeX source (2.3.1patched and 2.4.0)
Marc Schwartz (via MN