[Distr-commits] r495 - branches/distr-2.2/pkg/SweaveListingUtils branches/distr-2.2/pkg/SweaveListingUtils/R branches/distr-2.2/pkg/SweaveListingUtils/chm branches/distr-2.2/pkg/SweaveListingUtils/inst/doc branches/distr-2.2/pkg/SweaveListingUtils/man branches/distr-2.2/pkg/distr/chm branches/distr-2.2/pkg/distr/inst/doc branches/distr-2.2/pkg/distrDoc/inst/doc branches/distr-2.2/pkg/distrEx/chm branches/distr-2.2/pkg/distrEx/src branches/distr-2.2/pkg/distrMod/chm branches/distr-2.2/pkg/distrSim/chm branches/distr-2.2/pkg/distrTEst/chm pkg/SweaveListingUtils pkg/SweaveListingUtils/R pkg/SweaveListingUtils/inst/doc pkg/SweaveListingUtils/man pkg/distr/chm pkg/distr/inst/doc pkg/distrDoc/inst/doc pkg/distrEx/chm pkg/distrSim/chm

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 1 22:25:10 CEST 2009


Author: ruckdeschel
Date: 2009-07-01 22:25:09 +0200 (Wed, 01 Jul 2009)
New Revision: 495

Added:
   branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/cleanup.tex
   pkg/SweaveListingUtils/inst/doc/cleanup.tex
Modified:
   branches/distr-2.2/pkg/SweaveListingUtils/DESCRIPTION
   branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingOptions.R
   branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R
   branches/distr-2.2/pkg/SweaveListingUtils/chm/00Index.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/0SweaveListingUtils-package.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingOptions.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingUtils.chm
   branches/distr-2.2/pkg/SweaveListingUtils/chm/copySourceFromRForge.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/library.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/lstinputSourceFromRForge.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/readSourceFromRForge.html
   branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/ExampleSweaveListingUtils.Rnw
   branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preamble.tex
   branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preambleExp.tex
   branches/distr-2.2/pkg/SweaveListingUtils/man/0SweaveListingUtils-package.Rd
   branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingOptions.Rd
   branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd
   branches/distr-2.2/pkg/SweaveListingUtils/man/copySourceFromRForge.Rd
   branches/distr-2.2/pkg/SweaveListingUtils/man/library.Rd
   branches/distr-2.2/pkg/SweaveListingUtils/man/lstinputSourceFromRForge.Rd
   branches/distr-2.2/pkg/SweaveListingUtils/man/readSourceFromRForge.Rd
   branches/distr-2.2/pkg/distr/chm/Distr.chm
   branches/distr-2.2/pkg/distr/inst/doc/newDistributions.Rnw
   branches/distr-2.2/pkg/distrDoc/inst/doc/distr.Rnw
   branches/distr-2.2/pkg/distrEx/chm/00Index.html
   branches/distr-2.2/pkg/distrEx/chm/0distrEx-package.html
   branches/distr-2.2/pkg/distrEx/chm/E.html
   branches/distr-2.2/pkg/distrEx/chm/distrEx.chm
   branches/distr-2.2/pkg/distrEx/chm/distrEx.toc
   branches/distr-2.2/pkg/distrEx/src/distrEx.dll
   branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
   branches/distr-2.2/pkg/distrSim/chm/0distrSim-package.html
   branches/distr-2.2/pkg/distrSim/chm/distrSim.chm
   branches/distr-2.2/pkg/distrSim/chm/summary-methods.html
   branches/distr-2.2/pkg/distrTEst/chm/0distrTEst-package.html
   branches/distr-2.2/pkg/distrTEst/chm/distrTEst.chm
   pkg/SweaveListingUtils/DESCRIPTION
   pkg/SweaveListingUtils/R/SweaveListingOptions.R
   pkg/SweaveListingUtils/R/SweaveListingUtils.R
   pkg/SweaveListingUtils/inst/doc/ExampleSweaveListingUtils.Rnw
   pkg/SweaveListingUtils/inst/doc/preamble.tex
   pkg/SweaveListingUtils/inst/doc/preambleExp.tex
   pkg/SweaveListingUtils/man/0SweaveListingUtils-package.Rd
   pkg/SweaveListingUtils/man/SweaveListingOptions.Rd
   pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd
   pkg/SweaveListingUtils/man/copySourceFromRForge.Rd
   pkg/SweaveListingUtils/man/library.Rd
   pkg/SweaveListingUtils/man/lstinputSourceFromRForge.Rd
   pkg/SweaveListingUtils/man/readSourceFromRForge.Rd
   pkg/distr/chm/Distr.chm
   pkg/distr/inst/doc/newDistributions.Rnw
   pkg/distrDoc/inst/doc/distr.Rnw
   pkg/distrEx/chm/distrEx.chm
   pkg/distrSim/chm/distrSim.chm
Log:
integrated Andrew Ellis's nice ideas into SweaveListingUtils

Modified: branches/distr-2.2/pkg/SweaveListingUtils/DESCRIPTION
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/DESCRIPTION	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/DESCRIPTION	2009-07-01 20:25:09 UTC (rev 495)
@@ -1,6 +1,6 @@
 Package: SweaveListingUtils
 Title: Utilities for Sweave together with TeX listings package
-Version: 0.3
+Version: 0.4
 Depends: R(>= 2.0.0), startupmsg
 Imports: stats
 LazyLoad: yes
@@ -12,6 +12,6 @@
         vignette and documented source code
 Maintainer: Peter Ruckdeschel <Peter.Ruckdeschel at itwm.fraunhofer.de>
 License: LGPL-3
-Date: 2009-03-19
+Date: 2009-07-01
 LastChangedDate: {$LastChangedDate$}
 LastChangedRevision: {$LastChangedRevision$}
\ No newline at end of file

Modified: branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingOptions.R
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingOptions.R	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingOptions.R	2009-07-01 20:25:09 UTC (rev 495)
@@ -15,7 +15,8 @@
                            "{>=}{{$\\geq$}}2", "{^}{{$\\scriptstyle\\wedge$}}1", sep=""),
                      ## ~,^,<=, >= as suggested by Frank Harrell
         "alsoother" = "{$}", "alsoletter" = "{.<-}",
-        "otherkeywords" = "{!,!=,~,$,*,\\&,\\%/\\%,\\%*\\%,\\%\\%,<-,<<-,/}"        
+        "otherkeywords" = "{!,!=,~,$,*,\\&,\\%/\\%,\\%*\\%,\\%\\%,<-,<<-,/}",
+        "escapeinside" = "{(*}{*)}" ## as suggested by Frank Harrell
         ),
 Rdset = list("fancyvrb" = "true", "language" = "Rd", 
              "keywordstyle" = "{\\bf}",

Modified: branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R	2009-07-01 20:25:09 UTC (rev 495)
@@ -138,7 +138,12 @@
 }
 
 
-SweaveListingPreparations <- function(LineLength = 80,
+SweaveListingPreparations <- function(
+   withOwnFileSection = FALSE,
+   withVerbatim = FALSE,
+   gin = TRUE,
+   ae = TRUE,
+   LineLength = 80,
    Rset = getSweaveListingOption("Rset"), 
    Rdset = getSweaveListingOption("Rdset"), 
    Rcolor = getSweaveListingOption("Rcolor"), 
@@ -151,10 +156,20 @@
 
 sws <- .SweaveListingOptions
 sws$inSweave <- TRUE
+withVerbatim <- rep(withVerbatim, length.out=3)
+
+if(is.null(names(withVerbatim)))
+   names(withVerbatim) <- c("Sinput", "Soutput", "Scode")
+
+
 assignInNamespace(".SweaveListingOptions", sws, "SweaveListingUtils")
 line <- paste("%",paste(rep("-",LineLength-2),collapse=""),"%\n", sep="")
 
+
+
 cat(line,"%Preparations for Sweave and Listings\n",line,"%\n", sep = "")
+
+
 cat("\\RequirePackage{color}\n")
 cat("\\definecolor{Rcolor}{rgb}{",paste(Rcolor,collapse=", "),"}\n", sep = "")
 cat("\\definecolor{Rbcolor}{rgb}{",paste(Rbcolor,collapse=", "),"}\n", sep = "")
@@ -171,16 +186,67 @@
 cat("\\global\\def\\Rlstset{\\lstset{style=Rstyle}}%\n")
 cat("\\global\\def\\Rdlstset{\\lstset{style=Rdstyle}}%\n")
 cat("\\Rlstset\n")
-cat(line) 
+cat(line,"%copying relevant parts of Sweave.sty\n",line,"%\n", sep = "")
+
+cat("\\RequirePackage{ifthen}%\n")
+cat("\\newboolean{Sweave at gin}%\n")
+if(gin)
+  cat("\\setboolean{Sweave at gin}{true}%\n")
+else
+  cat("\\setboolean{Sweave at gin}{true}%\n")
+cat("\\newboolean{Sweave at ae}\n")
+if(ae)
+   cat("\\setboolean{Sweave at ae}{true}%\n")
+else
+   cat("\\setboolean{Sweave at ae}{true}%\n")
+
+cat("\\RequirePackage{graphicx,fancyvrb}%\n")
+cat("\\IfFileExists{upquote.sty}{\\RequirePackage{upquote}}{}%\n")
+
+cat("\\ifthenelse{\\boolean{Sweave at gin}}{\\setkeys{Gin}{width=0.8\\textwidth}}{}%\n")
+cat("\\ifthenelse{\\boolean{Sweave at ae}}{%\n",
+    "\\RequirePackage[T1]{fontenc}\n",
+    "\\RequirePackage{ae}\n}{}%\n", sep ="")
+
+cat("\\newenvironment{Schunk}{}{}\n\n")
+
+cat("\\newcommand{\\Sconcordance}[1]{% \n",
+  "\\ifx\\pdfoutput\\undefined% \n",
+  "\\csname newcount\\endcsname\\pdfoutput\\fi% \n",
+  "\\ifcase\\pdfoutput\\special{#1}% \n",
+  "\\else\\immediate\\pdfobj{#1}\\fi} \n\n", sep ="")
+cat(line,"% ---- end of parts of Sweave.sty\n",line,"%\n", sep = "")
+
+if(!withOwnFileSection){
+if(withVerbatim["Sinput"]){
 cat("\\DefineVerbatimEnvironment{Sinput}{Verbatim}")
 cat("%\n  {formatcom=\\color{Rcolor}\\lstset{fancyvrb=true,escapechar='}}\n")
+}else{
+#### Thanks to Andrew Ellis !!
+cat("\\lstnewenvironment{Sinput}")
+cat("%\n  {\\Rlstset\\lstset{basicstyle=\\color{Rcolor}\\small,fancyvrb=true}}")
+cat("%\n  {\\Rlstset}\n")
+}
+if(withVerbatim["Soutput"]){
 cat("\\DefineVerbatimEnvironment{Soutput}{Verbatim}")
 cat("%\n  {formatcom=\\color{Rout}\\small\\lstset{fancyvrb=false}}\n")
+}else{
+#### Thanks to Andrew Ellis !!
+cat("\\lstnewenvironment{Soutput}")
+cat("%\n  {\\Rlstset\\lstset{fancyvrb=false,basicstyle=\\color{Rout}\\small}}")
+cat("%\n  {\\Rlstset}\n")
+}
+if(withVerbatim["Scode"]){
 cat("\\DefineVerbatimEnvironment{Scode}{Verbatim}")
 cat("%\n  {fontshape=sl,formatcom=\\color{Rcolor}\\lstset{fancyvrb=true}}\n")
+}else{
+#### Thanks to Andrew Ellis !!
+cat("\\lstnewenvironment{Scode}")
+cat("%\n  {\\Rlstset\\lstset{fontshape=sl,basicstyle=\\color{Rcolor}\\small,fancyvrb=true}}")
+cat("%\n  {\\Rlstset}\n")
+}
+}
 cat(line)
-cat("\\ifthenelse{\\boolean{Sweave at gin}}{\\setkeys{Gin}{width=0.8\\textwidth}}{}%\n")
-cat(line)
 cat("\\let\\code\\lstinline\n")
 cat("\\def\\Code#1{{\\tt\\color{Rcolor} #1}}\n")
 cat("\\def\\file#1{{\\tt #1}}\n")

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/00Index.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/00Index.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/00Index.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -10,7 +10,7 @@
 <param name="keyword" value=".. contents">
 </object>
 
-<h2>Help pages for package &lsquo;SweaveListingUtils&rsquo; version 0.3</h2>
+<h2>Help pages for package &lsquo;SweaveListingUtils&rsquo; version 0.4</h2>
 
 <table width="100%">
 <tr><td width="25%"><a href="0SweaveListingUtils-package.html">SweaveListingUtils-package</a></td>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/0SweaveListingUtils-package.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/0SweaveListingUtils-package.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/0SweaveListingUtils-package.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -76,7 +76,8 @@
 </p>
 <p>
 For a corresponding TeX preamble combining Sweave and &lsquo;<span class="file">listings</span>&rsquo;, 
-we provide command <code><a href="SweaveListingPreparations.html">SweaveListingPreparations</a></code>.
+we provide command <br>
+<code><a href="SweaveListingPreparations.html">SweaveListingPreparations</a></code>.
 </p>
 <p>
 As for the <font face="Courier New,Courier" color="#666666"><b>R</b></font> language definition, we allow for different keywordstyles 
@@ -172,6 +173,6 @@
 
 
 
-<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.3 <a href="00Index.html">Index</a>]</div>
+<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.4 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingOptions.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingOptions.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingOptions.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -84,12 +84,14 @@
 <code>        "commentstyle" = "{\\color{Rcomment}\\ttfamily\\itshape}",</code><br>
 <code>        "literate" = "{&lt;-}{{$\\leftarrow$}}2{&lt;&lt;-}{{$\\twoheadleftarrow$}}2",</code><br>
 <code>        "alsoother" = "{$}","alsoletter" = "{.&lt;-}"</code><br>
+<code>        "otherkeywords" = </code>
 <code>        "otherkeywords" = "{!,!=,~,$,*,\\&amp;,\\ %/\\ %,\\ %*\\ %,\\ %\\ %,&lt;-,&lt;&lt;-,/}")</code><br>
-(CAVEAT: the spaces between the double backslashes and the percent sign in the last line 
+(CAVEAT: the spaces between the double backslashes and the percent sign in the last line
 are <EM>not</EM> intended; I simply did not find another work-around)
 </dd>
 <dt>Rdset:</dt><dd>default setting for \lstset-definition of Rd-code, default value is<br>
-<code>list("fancyvrb" = "true", "language" = "Rd", "basicstyle" = "{\\color{black}\\tiny}",</code><br>
+<code>list("fancyvrb" = "true", "language" = "Rd",</code><br>
+<code>        "basicstyle" = "{\\color{black}\\tiny}",</code><br>
 <code>        "keywordstyle" = "{\\bf}",</code><br>
 <code>        "commentstyle" = "\\ttfamily\\itshape",</code><br>
 <code>        "alsolanguage" = "R")</code>
@@ -122,7 +124,7 @@
 "r-forge.r-project.org" (or a mirror) or not; defaults to 
 <code>TRUE</code>.</dd>
 <dt>base.url:</dt><dd>default setting for the base url to download code sniplets from
-(character); defaults to
+(character); defaults to<br>
 "http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/"
 </dd>
 
@@ -165,6 +167,6 @@
 </script>
 
 
-<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.3 <a href="00Index.html">Index</a>]</div>
+<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.4 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -24,7 +24,12 @@
 <h3>Usage</h3>
 
 <pre>
-SweaveListingPreparations(LineLength = 80,
+SweaveListingPreparations(
+   withOwnFileSection = FALSE,  
+   withVerbatim = FALSE, 
+   gin = TRUE,
+   ae = TRUE,
+   LineLength = 80,
    Rset = getSweaveListingOption("Rset"),
    Rdset = getSweaveListingOption("Rdset"),
    Rcolor = getSweaveListingOption("Rcolor"),
@@ -40,6 +45,33 @@
 <h3>Arguments</h3>
 
 <table summary="R argblock">
+<tr valign="top"><td><code>withOwnFileSection</code></td>
+<td>
+logical: Does one want to use an own definition file/
+section to define <code>Sinput</code>, <code>Soutput</code>,
+<code>Scode</code> environments; if <code>TRUE</code> you should write some
+<KBD>\include</KBD> directive to include your own
+definitions / or write them in your &lsquo;<span class="file">.Rnw</span>&rsquo; file.
+</td></tr>
+<tr valign="top"><td><code>withVerbatim</code></td>
+<td>
+logical of length 3 (filled by recycling if of shorter length)
+either named ("Sinput", "Soutput", "Scode") or taken in
+order (Sinput, Soutput, Scode):
+Should we use Verbatim from TeX package 'fancyvrb'
+(i.e. the original
+<KBD>"\DefineVerbatimEnvironment{Sinput}{Verbatim}"</KBD> by
+Fritz Leisch) or just TeX package 'listings'
+(i.e. we define our own <code>Sinput</code> environment
+based on 'listings' command 'lstnewenvironment';
+this option is due to a suggestion by
+Andrew Ellis (thank you!).</td></tr>
+<tr valign="top"><td><code>gin</code></td>
+<td>
+logical: shall we use <code>gin</code></td></tr>
+<tr valign="top"><td><code>ae</code></td>
+<td>
+logical: shall we use <code>ae</code></td></tr>
 <tr valign="top"><td><code>LineLength</code></td>
 <td>
 numeric; defaults to 80</td></tr>
@@ -127,6 +159,14 @@
 <p>
 <code>invisible()</code></p>
 
+<h3>Acknowledgement</h3>
+
+<p>
+The author wants to thank Frank E. Harrel and Andrew Ellis for
+very valuable suggestions to enhance this package.
+</p>
+
+
 <h3>Author(s)</h3>
 
 <p>
@@ -143,6 +183,6 @@
 
 
 
-<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.3 <a href="00Index.html">Index</a>]</div>
+<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.4 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingUtils.chm
===================================================================
(Binary files differ)

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/copySourceFromRForge.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/copySourceFromRForge.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/copySourceFromRForge.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -25,9 +25,9 @@
 
 <pre>
 copySourceFromRForge(PKG, TYPE, FILENAME, PROJECT, from, to,
-                                 offset.before = 0, offset.after = 0,
-                                 fromRForge = getSweaveListingOption("fromRForge"),
-                                 base.url = getSweaveListingOption("base.url") )
+                     offset.before = 0, offset.after = 0,
+                     fromRForge = getSweaveListingOption("fromRForge"),
+                     base.url = getSweaveListingOption("base.url") )
 </pre>
 
 
@@ -127,6 +127,6 @@
 </script>
 
 
-<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.3 <a href="00Index.html">Index</a>]</div>
+<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.4 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/library.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/library.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/library.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -223,6 +223,14 @@
 require(distr)
 @
 </pre>
+In order to unmask the original versions of <code>library</code> and <code>require</code>
+again after Sweave-ing your <code>.Rnw</code> file, at the end of your <code>.Rnw</code>
+file you should include an Sweave chunk like
+<pre>
+&lt;&lt;cleanup, echo=FALSE&gt;&gt;=
+unloadNamespace("SweaveListingUtils")
+@
+</pre>
 </p>
 
 
@@ -255,6 +263,6 @@
 </script>
 
 
-<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.3 <a href="00Index.html">Index</a>]</div>
+<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.4 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/lstinputSourceFromRForge.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/lstinputSourceFromRForge.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/lstinputSourceFromRForge.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -25,11 +25,11 @@
 
 <pre>
 lstinputSourceFromRForge(PKG, TYPE, FILENAME, PROJECT, from, to,
-                                 offset.before = 0, offset.after = 0,
-                                 LineLength = 80,
-                                 withLines = ifelse(TYPE=="R", TRUE, FALSE),
-                                 fromRForge = getSweaveListingOption("fromRForge"),
-                                 base.url = getSweaveListingOption("base.url"))
+                         offset.before = 0, offset.after = 0,
+                         LineLength = 80,
+                         withLines = ifelse(TYPE=="R", TRUE, FALSE),
+                         fromRForge = getSweaveListingOption("fromRForge"),
+                         base.url = getSweaveListingOption("base.url"))
 </pre>
 
 
@@ -152,6 +152,6 @@
 
 
 
-<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.3 <a href="00Index.html">Index</a>]</div>
+<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.4 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/readSourceFromRForge.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/readSourceFromRForge.html	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/readSourceFromRForge.html	2009-07-01 20:25:09 UTC (rev 495)
@@ -25,8 +25,8 @@
 
 <pre>
 readSourceFromRForge(PKG, TYPE, FILENAME, PROJECT,
-                                 fromRForge = getSweaveListingOption("fromRForge"),
-                                 base.url = getSweaveListingOption("base.url"))
+                     fromRForge = getSweaveListingOption("fromRForge"),
+                     base.url = getSweaveListingOption("base.url"))
 </pre>
 
 
@@ -86,6 +86,6 @@
 
 
 
-<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.3 <a href="00Index.html">Index</a>]</div>
+<hr><div align="center">[Package <em>SweaveListingUtils</em> version 0.4 <a href="00Index.html">Index</a>]</div>
 
 </body></html>

Modified: branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/ExampleSweaveListingUtils.Rnw
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/ExampleSweaveListingUtils.Rnw	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/ExampleSweaveListingUtils.Rnw	2009-07-01 20:25:09 UTC (rev 495)
@@ -68,9 +68,9 @@
 \newcommand{\hreft}[1]{\href{#1}{\tt\small\url{#1}}}
 %
 % -------------------------------------------------------------------------------
+\RequirePackage{fancyvrb}
 \RequirePackage{listings}
-\usepackage{Sweave}
-% -------------------------------------------------------------------------------
+%\usepackage{Sweave}
 \SweaveOpts{keep.source=TRUE}
 % -------------------------------------------------------------------------------
 <<SweaveListingsPreparations, results=tex, echo=FALSE>>=
@@ -164,7 +164,37 @@
 \lstinputlisting[style=TeXstyle,basicstyle=\footnotesize]{preambleExp.tex}
 %
 \end{footnotesize}
+Finally to clean up things (in particular unmask the base functions
+\code{require} and \code{library} again) at the end of your document
+you should append something like
+%------------
+% use \lstinputlisting{....}
+% to avoid that Sweave interprets the chunks in cleanup.tex
+%------------
+\lstinputlisting[style=TeXstyle]{cleanup.tex}
 %
+
+%
+\paragraph{Remark:} As suggested by \href{mailto:ellis at finance.ch}{Andrew Ellis},
+ETH Z{\"u}rich, \code{SweaveListingPreparations} from version {\tt 0.3}
+has two more options: First, by setting argument \code{withOwnFileSection}
+(default \code{FALSE}), one can have one's own definition of \LaTeX\
+environments for \texttt{Sinput}, \texttt{Soutput}, \texttt{Scode}, be it in
+an extra file or in a section in one's \file{.Rnw} file. Second,
+and this is Andrew's suggestion, by
+means of argument \code{withVerbatim} (default \code{FALSE}), you may
+from now on use \LaTeX\
+environments for \texttt{Sinput}, \texttt{Soutput}, \texttt{Scode} using
+{\tt listings}-command \lstinline[style=TeXstyle,basicstyle=\tt]|\lstnewenvironment|
+instead of the original {\tt fancyvrb} definitions provided in the original
+\file{Sweave.sty} file by Fritz Leisch. This way we also solve the
+escaping problem (as noted by Frank E. Harrel): the escaping mechanisms
+provided by {\tt listings}  command {\tt lstset} (as e.g. {\tt escapechar},
+{\tt escapeinline}) as described in detail in \cite[section~4.14]{H:M:07}
+are now available; in particular one can place \LaTeX\ references
+\lstinline[style=TeXstyle,basicstyle=\tt]|\ref{...}|,
+\lstinline[style=TeXstyle,basicstyle=\tt]|\label{...}| within comments.
+
 % -------------------------------------------------------------------------------
 \section{Listings markup}
 % -------------------------------------------------------------------------------
@@ -172,8 +202,8 @@
 % -------------------------------------------------------------------------------
 Any keyword of some new {\sf R} package ``loaded in'' by \code{require} 
 or \code{library} which is on the \code{search} list item of this package
-afterwords when used in \lstinline[style=TeXstyle]`\lstinline{ .... }` or
-\lstinline[style=TeXstyle]`\begin{lstlisting} .... \end{lstlisting}`
+afterwords when used in \lstinline[style=TeXstyle,basicstyle=\tt]`\lstinline{ .... }` or
+\lstinline[style=TeXstyle,basicstyle=\tt]`\begin{lstlisting} .... \end{lstlisting}`
 or in some Sweave chunk is typeset in style \code{keywordstyle}.
 More specifically, with argument \code{keywordstyles} of functions
 \code{setToBeDefinedPkgs} or \code{lstsetLanguage} 
@@ -188,7 +218,7 @@
 
 Note that in order to define these new keywords correctly,
 they must not be included into a 
-\lstinline[style=TeXstyle]`\begin{Schunk} .... \end{Schunk}`
+\lstinline[style=TeXstyle,basicstyle=\tt]`\begin{Schunk} .... \end{Schunk}`
 environment, so  we use
 %------------
 % use \lstinputlisting{....} 
@@ -451,7 +481,9 @@
 %
 
 \end{thebibliography}
-
+<<cleanup, echo=FALSE>>=
+unloadNamespace("SweaveListingUtils")
+@
 % -------------------------------------------------------------------------------
 \end{document}
 % -------------------------------------------------------------------------------

Added: branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/cleanup.tex
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/cleanup.tex	                        (rev 0)
+++ branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/cleanup.tex	2009-07-01 20:25:09 UTC (rev 495)
@@ -0,0 +1,3 @@
+<<cleanup, echo=FALSE>>=
+unloadNamespace("SweaveListingUtils")
+@

Modified: branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preamble.tex
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preamble.tex	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preamble.tex	2009-07-01 20:25:09 UTC (rev 495)
@@ -1,6 +1,6 @@
 % -------------------------------------------------------------------------------
+\RequirePackage{fancyvrb}
 \RequirePackage{listings}
-\usepackage{Sweave}
 % -------------------------------------------------------------------------------
 \SweaveOpts{keep.source=TRUE}
 % -------------------------------------------------------------------------------

Modified: branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preambleExp.tex
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preambleExp.tex	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/inst/doc/preambleExp.tex	2009-07-01 20:25:09 UTC (rev 495)
@@ -1,3 +1,7 @@
+% -------------------------------------------------------------------------------
+\RequirePackage{fancyvrb}
+\RequirePackage{listings}
+% -------------------------------------------------------------------------------
 %------------------------------------------------------------------------------%
 %Preparations for Sweave and Listings
 %------------------------------------------------------------------------------%
@@ -9,31 +13,32 @@
 \definecolor{Rcomment}{rgb}{0.101, 0.043, 0.432}
 %------------------------------------------------------------------------------%
 \lstdefinelanguage{Rd}[common]{TeX}%
-  {moretexcs={acronym,alias,arguments,author,bold,cite,%
+{moretexcs={acronym,alias,arguments,author,bold,cite,%
           code,command,concept,cr,deqn,describe,%
-          description,details,dfn,docType,dots,%
+          description,details,dfn,doctype,dots,%
           dontrun,dontshow,donttest,dQuote,%
           email,emph,enc,encoding,enumerate,env,eqn,%
           examples,file,format,item,itemize,kbd,keyword,%
-          keyword,ldots,link,linkS4class,method,name,note,%
-          option,pkg,preformatted,R,references,S3method,%
-          S4method,samp,section,seealso,source,sp,special,%
+          ldots,link,linkS4class,method,name,note,%
+          option,pkg,preformatted,R,Rdopts,Rdversion,%
+          references,S3method,S4method,Sexpr,samp,section,%
+          seealso,source,sp,special,%
           sQuote,strong,synopsis,tab,tabular,testonly,%
-          title,url,usage,value,var},
+          title,url,usage,value,var,verb},
    sensitive=true,%
-   morecomment=[l]\%% 2008 Peter Ruckdeschel
+   morecomment=[l]\%% 2008/9 Peter Ruckdeschel
 }[keywords,comments]%%
 %------------------------------------------------------------------------------%
-\lstdefinestyle{Rstyle}{fancyvrb=true,escapechar=.,language=R,%
+\lstdefinestyle{Rstyle}{fancyvrb=true,escapechar=§,language=R,%
                         basicstyle={\color{Rcolor}\small},%
                         keywordstyle={\bf\color{Rcolor}},%
                         commentstyle={\color{Rcomment}\ttfamily\itshape},%
                         literate={<-}{{$\leftarrow$}}2{<<-}{{$\twoheadleftarrow$}}2%
-                                 {~}{{$\\sim$}}1{<=}{{$\\leq$}}2%
-                                 {>=}{{$\\geq$}}2{^}{{$^\\wedge$}}1,%
+                        {~}{{$\sim$}}1{<=}{{$\leq$}}2{>=}{{$\geq$}}2{^}{{$\scriptstyle\wedge$}}1,%
                         alsoother={$},%
                         alsoletter={.<-},%
-                        otherkeywords={!,!=,~,$,*,\&,\%/\%,\%*\%,\%\%,<-,<<-,/}}%
+                        otherkeywords={!,!=,~,$,*,\&,\%/\%,\%*\%,\%\%,<-,<<-,/},%
+                        escapeinside={(*}{*)}}%
 \lstdefinestyle{Rdstyle}{fancyvrb=true,language=Rd,keywordstyle={\bf},%
                          basicstyle={\color{black}\footnotesize},%
                          commentstyle={\ttfamily\itshape},%
@@ -43,31 +48,56 @@
 \global\def\Rdlstset{\lstset{style=Rdstyle}}%
 \Rlstset
 %------------------------------------------------------------------------------%
-\DefineVerbatimEnvironment{Sinput}{Verbatim}%
-  {formatcom=\color{Rcolor}\lstset{fancyvrb=true,escapechar='}}
-\DefineVerbatimEnvironment{Soutput}{Verbatim}%
-  {formatcom=\color{Rout}\small\lstset{fancyvrb=false}}
-\DefineVerbatimEnvironment{Scode}{Verbatim}%
-  {fontshape=sl,formatcom=\color{Rcolor}\lstset{fancyvrb=true}}
+%copying relevant parts of Sweave.sty
 %------------------------------------------------------------------------------%
-\ifthenelse{\boolean{Sweave at gin}}{\setkeys{Gin}{width=0.6\textwidth}}{}%
+%
+\RequirePackage{ifthen}%
+\newboolean{Sweave at gin}%
+\setboolean{Sweave at gin}{true}%
+\newboolean{Sweave at ae}
+\setboolean{Sweave at ae}{true}%
+\RequirePackage{graphicx,fancyvrb}%
+\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}%
+\ifthenelse{\boolean{Sweave at gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}%
+\ifthenelse{\boolean{Sweave at ae}}{%
+\RequirePackage[T1]{fontenc}
+\RequirePackage{ae}
+}{}%
+\newenvironment{Schunk}{}{}
+
+\newcommand{\Sconcordance}[1]{%
+\ifx\pdfoutput\undefined%
+\csname newcount\endcsname\pdfoutput\fi%
+\ifcase\pdfoutput\special{#1}%
+\else\immediate\pdfobj{#1}\fi}
+
 %------------------------------------------------------------------------------%
+% ---- end of parts of Sweave.sty
+%------------------------------------------------------------------------------%
+%
+\lstnewenvironment{Sinput}%
+  {\Rlstset\lstset{basicstyle=\color{Rcolor}\small,fancyvrb=true}}%
+  {\Rlstset}
+\lstnewenvironment{Soutput}%
+  {\Rlstset\lstset{fancyvrb=false,basicstyle=\color{Rout}\small}}%
+  {\Rlstset}
+\lstnewenvironment{Scode}%
+  {\Rlstset\lstset{fontshape=sl,basicstyle=\color{Rcolor}\small,fancyvrb=true}}%
+  {\Rlstset}
+%------------------------------------------------------------------------------%
 \let\code\lstinline
-\newcommand{\Code}[1]{{\tt\color{Rcolor} #1}}
-\newcommand{\file}[1]{{\tt #1}}
-\newcommand{\pkg}[1]{{\tt "#1"}}
-\newcommand{\pkgversion}{{\tt 2.0.3}}
+\def\Code#1{{\tt\color{Rcolor} #1}}
+\def\file#1{{\tt #1}}
+\def\pkg#1{{\tt "#1"}}
+\newcommand{\pkgversion}{{\tt 2.2}}
 %------------------------------------------------------------------------------%
 % --------------------------
 % Registration of package SweaveListingUtils
 % --------------------------
-% --------------------------
-\lstset{morekeywords={[2]changeKeywordstyles,copySourceFromRForge,%
-getSweaveListingOption,lstinputSourceFromRForge,lstset,%
-lstsetLanguage,lstsetR,lstsetRd,readPkgVersion,readSourceFromRForge,%
-setToBeDefinedPkgs,SweaveListingMASK,SweaveListingoptions,%
-SweaveListingOptions,SweaveListingPreparations,%
-taglist%
+\lstset{morekeywords={[2]taglist,SweaveListingPreparations,SweaveListingOptions,%
+SweaveListingoptions,SweaveListingMASK,setToBeDefinedPkgs,readSourceFromRForge,%
+readPkgVersion,lstsetRd,lstsetR,lstsetLanguage,lstset,lstinputSourceFromRForge,%
+getSweaveListingOption,copySourceFromRForge,changeKeywordstyles%
 },%
 keywordstyle={[2]{\bf}}%
 }
@@ -77,26 +107,24 @@
 % --------------------------
 % Registration of package startupmsg
 % --------------------------
-\lstset{morekeywords={[3]buildStartupMessage,infoShow,mySMHandler,%
-mystartupMessage,NEWS,onlytypeStartupMessages,pointertoNEWS,%
-readURLInformation,readVersionInformation,startupMessage,%
-StartupMessage,startupPackage,startupType,suppressStartupMessages%
+\lstset{morekeywords={[3]suppressStartupMessages,startupType,startupPackage,%
+StartupMessage,startupMessage,startupEndline,readVersionInformation,%
+readURLInformation,pointertoNEWS,onlytypeStartupMessages,%
+NEWS,mystartupMessage,mySMHandler,infoShow,buildStartupMessage%
 },%
 keywordstyle={[3]{\bf}}%
 }
 %
-%
 
 %
 ...
-snipped expanded \TeX\ code for registration of packages
+snipped expanded `\TeX` (see how the original `\verb|`\TeX`|` gets escaped!)
+code for registration of packages
         tools, stats, graphics, grDevices, utils, datasets, methods, base
 ...
 %
 
 %------------------------------------------------------------------------------%
-%
-%%
 \lstset%
 {keywordstyle={[2]\bf\color{blue}}
 }%

Modified: branches/distr-2.2/pkg/SweaveListingUtils/man/0SweaveListingUtils-package.Rd
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/man/0SweaveListingUtils-package.Rd	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/man/0SweaveListingUtils-package.Rd	2009-07-01 20:25:09 UTC (rev 495)
@@ -43,7 +43,8 @@
 \code{<<-} get typeset by one symbol each.  
 
 For a corresponding TeX preamble combining Sweave and \file{listings}, 
-we provide command \code{\link{SweaveListingPreparations}}.
+we provide command \cr
+\code{\link{SweaveListingPreparations}}.
 
 As for the \R language definition, we allow for different keywordstyles 
 to typeset symbols from different packages. This is useful to distinguish

Modified: branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingOptions.Rd
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingOptions.Rd	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingOptions.Rd	2009-07-01 20:25:09 UTC (rev 495)
@@ -51,13 +51,15 @@
 \code{        "commentstyle" = "{\\\\color{Rcomment}\\\\ttfamily\\\\itshape}",}\cr
 \code{        "literate" = "{<-}{{$\\\\leftarrow$}}2{<<-}{{$\\\\twoheadleftarrow$}}2",}\cr
 \code{        "alsoother" = "{$}","alsoletter" = "{.<-}"}\cr
+\code{        "otherkeywords" = }%
 \code{        "otherkeywords" = "{!,!=,~,$,*,\\\\&,\\\\ \%/\\\\ \%,\\\\ \%*\\\\ \%,\\\\ \%\\\\ \%,<-,<<-,/}")}\cr
-(CAVEAT: the spaces between the double backslashes and the percent sign in the last line 
+(CAVEAT: the spaces between the double backslashes and the percent sign in the last line
 are \emph{not} intended; I simply did not find another work-around)
 }
 \item{Rdset:}{%
 default setting for \\lstset-definition of Rd-code, default value is\cr
-\code{list("fancyvrb" = "true", "language" = "Rd", "basicstyle" = "{\\\\color{black}\\\\tiny}",}\cr
+\code{list("fancyvrb" = "true", "language" = "Rd",}\cr
+\code{        "basicstyle" = "{\\\\color{black}\\\\tiny}",}\cr
 \code{        "keywordstyle" = "{\\\\bf}",}\cr
 \code{        "commentstyle" = "\\\\ttfamily\\\\itshape",}\cr
 \code{        "alsolanguage" = "R")}
@@ -90,7 +92,7 @@
                    "r-forge.r-project.org" (or a mirror) or not; defaults to 
                    \code{TRUE}.}
 \item{base.url:}{default setting for the base url to download code sniplets from
-            (character); defaults to
+            (character); defaults to\cr
             "http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/"
             }
 

Modified: branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd	2009-07-01 04:06:39 UTC (rev 494)
+++ branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd	2009-07-01 20:25:09 UTC (rev 495)
@@ -6,7 +6,12 @@
 helping tool for writing the corresponding TeX preamble commands
 to integrate Sweave and package listings}
 \usage{
-SweaveListingPreparations(LineLength = 80,
+SweaveListingPreparations(
+   withOwnFileSection = FALSE,  % suggestion by Andrew Ellis!
+   withVerbatim = FALSE, % suggestion by Andrew Ellis!
+   gin = TRUE,
+   ae = TRUE,
+   LineLength = 80,
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/distr -r 495


More information about the Distr-commits mailing list