[R] Sweave and tth

Frank E Harrell Jr f.harrell at vanderbilt.edu
Tue Jul 25 21:45:36 CEST 2006


Ben Bolker wrote:
> Frank E Harrell Jr <f.harrell <at> vanderbilt.edu> writes:
> 
>> Has anyone 
>> been able to get tth to work with Sweave, defining Sweave.sty and other 
>> needed .sty files to be accepted by tth?
>>
>> Thanks.
> 
>   I use tth and ttm (Tex to MathML) -- not for Word users,
> just for easier web posting.
> 
>   I just use a crude little script to translate Sinput/Soutput into
> color/verbatim chunks.
> 
> #!/bin/sh
> for i in `echo $1-[0-9]*.eps | sed -e 's/\.eps//g'`; do
>    convert $i.eps $i.png
> done
> sed -e 's/\\begin{Sinput}/ { \\color{red} \\begin{verbatim}/
>         s/\\end{Sinput}/ \\end{verbatim} }/
>         s/\\begin{Soutput}/ { \\color{blue} \\begin{verbatim}/
>         s/\\end{Soutput}/ \\end{verbatim} }/
>         s/\\begin{Schunk}/ /
>         s/\\end{Schunk}/ /' $1.tex | \
>  tth -e2 -L$1 >$1.html
> 
> ## notes: a, e, i, o, s, u, y get transmuted by TtH
> ## when they have " in front of them -- protect with
> ## verbatim environment!
> 
>   Ben Bolker

Thanks Ben.  That works great.  Word can open the resulting html file.
Frank



More information about the R-help mailing list