I know you work on Lyx and Sweave now and then and I appreciate the
effort, but it is not exactly helping me to get my projects done. I
figured if I explain what I'm up to, you might see how I can more
effectively use the module setup in LyX. Or you might fix up LyX to do
this more easily for me.

With Sweave I'm producing lectures (beamer) and book chapters.

I've got several example documents online, such as:

http://pj.freefaculty.org/guides/stat/Distributions/DistributionOverview/DistributionReview.lyx
http://pj.freefaculty.org/guides/stat/Distributions/DistributionOverview/DistributionReview.pdf

http://pj.freefaculty.org/guides/Rcourse/regression-tableAndPlot-1/regression-tableAndPlot.lyx
http://pj.freefaculty.org/guides/Rcourse/regression-tableAndPlot-1/regression-tableAndPlot.pdf

http://pj.freefaculty.org/guides/Rcourse/plot-3d/plots-3d.lyx
http://pj.freefaculty.org/guides/Rcourse/plot-3d/plots-3d.pdf


Instead of Sweave.sty, I use replacement called Sweavel.sty.  It uses
the LaTeX listings class instead of Verbatim and gives some nicer
looking output. (Sweavel:
http://gettinggeneticsdone.blogspot.com/2010/05/using-r-latex-and-sweave-for.html).
 Sweavel eliminates the especially ugly Verbatim rendering of symbols
like tilde, and it has a setting so that two symbols like "<-" are
rendered as a LaTex  \leftarrow.  I've played around with shading on
the backgrounds of the listing output, that makes it a bit more fun.
If you could include that in your thinking on LyX modules, it would be
a bit easier.

Here are ways you could help.

In Beamer, can you make it possible to create frames without all of the ERT?

Each slide requires ERT.

\begin{frame}[containsverbatim]
\frametitle{}

\end{frame}

and when I plop one of those into a LyX document with ordinary LyX
frames, then have to be VERY CAREFUL to put in a LyX FrameEnd before
my ERT frame begins.

Sometimes, with statistical output that is lengthy, I have to start
frames like so:
\begin{frame}[containsverbatim, allowframebreaks]


Second, can you make it more convenient to keep a permanent record of
R output?

Right now, I'm using an R branch in the document. I need to be able to
turn that off, but still compile the same document using previous R
output.

There is some boilerplate code in the document that sets R options for
Sweaving, split=T,  and so all figures and TeX output files from R get
diverted to a folder "plots".  This also makes sure I get no ae "help"
because it makes documents look like crap.

\SweaveOpts{prefix.string=plots/t,split=T,ae=F,height=3,width=5}

The R figure chunks start like so

<<norm, fig=T, include=F, echo=T>>=

The figures are created, but not automatically put into the document.
I do that part manually. (either \includegraphics or a Lyx insert
graphics works).

When the R branch runs, need I copy all R results from the LyX
temporary directory back to the document directory..

Most of my Sweave documents don't compile with Sweave as it is shipped
with LyX 2.0 (http://www.lyx.org/trac/ticket/7552) , so I've fallen
back to the old way.

My "pjconverter" script compiles and copies R results back. It is
invoked by this in .lyx/preferences:

\converter "sweave" "latex" "pjconverter.sh $$p$$i $$p $$r" ""
\converter "sweave" "pdflatex" "pjconverter.sh $$p$$i $$p $$r" ""


============= pjconverter.sh ==================
 #!/bin/bash
rm -rf "$2/plots"

R CMD Sweave $1

if [ -d "$2/plots" ]; then
rsync -rav "$2/plots" $3;
rsync -av $1 $3;
fi

sleep 3
exit 0
###################

In my lyx document directory, that creates a new folder "plots" and it
also copies the *.Rnw file.


Doing it this way is a bit tedious, and to be honest, I don't know
there is anything you can do to help me. I think it would be possible
to build a module that would handle this part, but I'd be the only
user.

Well, maybe you could help. In LyX 2, I don't find an R tangle export
option. The command line

# R CMD Stangle regressionPlots.Rnw

works. Can   you make a menu for that?

Oh, one more thing.  Concerning this "pdf does not update" bug:
http://www.lyx.org/trac/ticket/7571. I see lyx-help talk about pdf
updating not working in general, people blame Acrobat.  But I'm using
Evince as the viewer, and I still have same issue.  Are there other
ideas about it?

pj
-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

Reply via email to