[Distr-commits] r528 - branches/distr-2.2/pkg/SweaveListingUtils/R branches/distr-2.2/pkg/SweaveListingUtils/chm branches/distr-2.2/pkg/SweaveListingUtils/man pkg/SweaveListingUtils/R pkg/SweaveListingUtils/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 19 00:14:45 CEST 2009


Author: ruckdeschel
Date: 2009-08-19 00:14:44 +0200 (Wed, 19 Aug 2009)
New Revision: 528

Modified:
   branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R
   branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html
   branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingUtils.chm
   branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd
   pkg/SweaveListingUtils/R/SweaveListingUtils.R
   pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd
Log:
Small changes in SweaveListingPreparations.R, <..>.Rd and SweaveListingUtils.R in order to work well with our distrMod article.

Modified: branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R	2009-08-18 14:12:11 UTC (rev 527)
+++ branches/distr-2.2/pkg/SweaveListingUtils/R/SweaveListingUtils.R	2009-08-18 22:14:44 UTC (rev 528)
@@ -196,6 +196,7 @@
 SweaveListingPreparations <- function(
    withOwnFileSection = FALSE,
    withVerbatim = FALSE,
+   withSchunkDef = TRUE,
    gin = TRUE,
    ae = TRUE,
    LineLength = getOption("width"),
@@ -274,6 +275,7 @@
        "\\RequirePackage{ae}\n%\n", sep ="")
 }
 
+if(withSchunkDef)
 cat("\\newenvironment{Schunk}{}{}\n\n")
 
 cat("\\newcommand{\\Sconcordance}[1]{% \n",
@@ -297,7 +299,7 @@
 }
 if(withVerbatim["Soutput"]){
 cat("\\DefineVerbatimEnvironment{Soutput}{Verbatim}")
-cat("%\n  {formatcom=\\color{Rout}\\small\\lstset{fancyvrb=false}}\n")
+cat("%\n  {formatcom=\\color{Routcolor}\\small\\lstset{fancyvrb=false}}\n")
 }else{
 #### Thanks to Andrew Ellis !!
 lstset(taglist(list=Rout), LineLength=LineLength,

Modified: branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html	2009-08-18 14:12:11 UTC (rev 527)
+++ branches/distr-2.2/pkg/SweaveListingUtils/chm/SweaveListingPreparations.html	2009-08-18 22:14:44 UTC (rev 528)
@@ -26,6 +26,7 @@
 SweaveListingPreparations(
    withOwnFileSection = FALSE,
    withVerbatim = FALSE,
+   withSchunkDef = TRUE,
    gin = TRUE,
    ae = TRUE,
    LineLength = getOption("width"),
@@ -69,6 +70,9 @@
 based on 'listings' command 'lstnewenvironment';
 this option is due to a suggestion by
 Andrew Ellis (thank you!).</td></tr>
+<tr valign="top"><td><code>withSchunkDef</code></td>
+<td>
+logical: shall environment <PRE>Schunk</PRE> be defined?</td></tr>
 <tr valign="top"><td><code>gin</code></td>
 <td>
 logical: shall we use <code>gin</code></td></tr>
@@ -155,7 +159,7 @@
 defines commands <code>\code</code>, <code>\file</code>, <code>\pkg</code> and sets
 the corresponding package version.<br>
 The default values are taken from
-<a href="../../SweaveListingUtils/html/SweaveListingOptions.html">SweaveListingOptions</a>.
+.
 The output to stdout can be captured in an &lsquo;<span class="file">.Rnw</span>&rsquo; file as
 <pre>
 &lt;&lt; lstPreamble, results=tex, echo=FALSE&gt;&gt;=
@@ -169,7 +173,7 @@
 by <code>require</code> or <code>library</code> without adding extra arguments
 to these commands (and hence displaying the actual <font face="Courier New,Courier" color="#666666"><b>R</b></font> code),
 you have to set up a global formatting matrix  
-<code>.tobeDefinedPkgs</code> by <code><a href="../../SweaveListingUtils/html/setToBeDefinedPkgs.html">setToBeDefinedPkgs</a></code>.
+<code>.tobeDefinedPkgs</code> by <code></code>.
 </p>
 
 

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

Modified: branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd
===================================================================
--- branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd	2009-08-18 14:12:11 UTC (rev 527)
+++ branches/distr-2.2/pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd	2009-08-18 22:14:44 UTC (rev 528)
@@ -9,6 +9,7 @@
 SweaveListingPreparations(
    withOwnFileSection = FALSE,
    withVerbatim = FALSE,
+   withSchunkDef = TRUE,
    gin = TRUE,
    ae = TRUE,
    LineLength = getOption("width"),
@@ -44,6 +45,7 @@
                        based on 'listings' command 'lstnewenvironment';
                        this option is due to a suggestion by
                        Andrew Ellis (thank you!).}
+  \item{withSchunkDef}{logical: shall environment \verb{Schunk} be defined?}
   \item{gin}{logical: shall we use \code{gin}}
   \item{ae}{logical: shall we use \code{ae}}
   \item{LineLength}{numeric; defaults to 80}

Modified: pkg/SweaveListingUtils/R/SweaveListingUtils.R
===================================================================
--- pkg/SweaveListingUtils/R/SweaveListingUtils.R	2009-08-18 14:12:11 UTC (rev 527)
+++ pkg/SweaveListingUtils/R/SweaveListingUtils.R	2009-08-18 22:14:44 UTC (rev 528)
@@ -196,6 +196,7 @@
 SweaveListingPreparations <- function(
    withOwnFileSection = FALSE,
    withVerbatim = FALSE,
+   withSchunkDef = TRUE,
    gin = TRUE,
    ae = TRUE,
    LineLength = getOption("width"),
@@ -274,6 +275,7 @@
        "\\RequirePackage{ae}\n%\n", sep ="")
 }
 
+if(withSchunkDef)
 cat("\\newenvironment{Schunk}{}{}\n\n")
 
 cat("\\newcommand{\\Sconcordance}[1]{% \n",
@@ -297,7 +299,7 @@
 }
 if(withVerbatim["Soutput"]){
 cat("\\DefineVerbatimEnvironment{Soutput}{Verbatim}")
-cat("%\n  {formatcom=\\color{Rout}\\small\\lstset{fancyvrb=false}}\n")
+cat("%\n  {formatcom=\\color{Routcolor}\\small\\lstset{fancyvrb=false}}\n")
 }else{
 #### Thanks to Andrew Ellis !!
 lstset(taglist(list=Rout), LineLength=LineLength,
@@ -423,23 +425,25 @@
    lE <- length(erg)
    if(withLines){
       for(k in 1:lE){
-        if( k == 1 ) {
-             if( ( lineNr[[k]][1] < lineNr[[k]][2] ) || ( lE>1 ) )
-                  cat("lines ")
-             else cat("line ")
-        }else{
-             if( k < lE )
-                  cat(", \n")
-             else cat(", and\n")
-             }
-        if(lineNr[[k]][1] < lineNr[[k]][2])
-           cat(lineNr[[k]][1], "--", lineNr[[k]][2], sep = "")
-        else cat(lineNr[[k]][1])
+        if( !is.null(lineNr[[k]])){
+          if( k == 1 ) {
+               if( ( lineNr[[k]][1] < lineNr[[k]][2] ) || ( lE>1 ) )
+                    cat("lines ")
+               else cat("line ")
+          }else{
+               if( k < lE )
+                    cat(", \n")
+               else cat(", and\n")
+               }
+          if(lineNr[[k]][1] < lineNr[[k]][2])
+             cat(lineNr[[k]][1], "--", lineNr[[k]][2], sep = "")
+          else cat(lineNr[[k]][1])
+        }
       }
       cat("\n")
    }
    for(k in 1:length(erg)){
-     if(lR[[k]]){
+     if(!is.null(lR[[k]])){ if(lR[[k]]){
         todo <- NULL
         if(TYPE=="man"){
           ex.from <- if(length(gr <- grep("\\\\examples\\{",RL[[k]]))) gr[1] else lR[[k]]
@@ -466,7 +470,7 @@
           writeLines(RL[[k]])
         }
         cat("\\end{lstlisting}\n",line,"%\n\n",sep="")
-        }
+        }}
       }
    return(invisible())
 }

Modified: pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd
===================================================================
--- pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd	2009-08-18 14:12:11 UTC (rev 527)
+++ pkg/SweaveListingUtils/man/SweaveListingPreparations.Rd	2009-08-18 22:14:44 UTC (rev 528)
@@ -9,6 +9,7 @@
 SweaveListingPreparations(
    withOwnFileSection = FALSE,
    withVerbatim = FALSE,
+   withSchunkDef = TRUE,
    gin = TRUE,
    ae = TRUE,
    LineLength = getOption("width"),
@@ -44,6 +45,7 @@
                        based on 'listings' command 'lstnewenvironment';
                        this option is due to a suggestion by
                        Andrew Ellis (thank you!).}
+  \item{withSchunkDef}{logical: shall environment \verb{Schunk} be defined?}
   \item{gin}{logical: shall we use \code{gin}}
   \item{ae}{logical: shall we use \code{ae}}
   \item{LineLength}{numeric; defaults to 80}
@@ -75,10 +77,11 @@
 \details{
 \code{SweaveListingPreparations}
 writes a corresponding preamble to the \file{.Rnw}-file for the simultaneous use
-of Sweave and package listings; note that the lines
+of Sweave and package listings; note that so far, even if you do not want to
+use the default style file \file{Sweave.sty}, the lines
 \preformatted{
-\usepackage{Sweave}
-\SweaveOpts{keep.source=TRUE}
+\%\\usepackage{Sweave}
+\\SweaveOpts{keep.source=TRUE}
 }
 still have to appear in the \file{.Rnw} file --- before the corresponding
 \code{SweaveListingPreparations}-chunk.\cr



More information about the Distr-commits mailing list