[Vegan-commits] r2573 - pkg/vegan/inst/doc

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 18 15:00:06 CEST 2013


Author: jarioksa
Date: 2013-07-18 15:00:06 +0200 (Thu, 18 Jul 2013)
New Revision: 2573

Modified:
   pkg/vegan/inst/doc/decision-vegan.Rnw
   pkg/vegan/inst/doc/vegan.sty
Log:
code{} handles underscores, tildes and dollars

Modified: pkg/vegan/inst/doc/decision-vegan.Rnw
===================================================================
--- pkg/vegan/inst/doc/decision-vegan.Rnw	2013-07-18 12:57:11 UTC (rev 2572)
+++ pkg/vegan/inst/doc/decision-vegan.Rnw	2013-07-18 13:00:06 UTC (rev 2573)
@@ -88,7 +88,7 @@
 The \code{mc.cores} option is defined in the \pkg{parallel} package,
 but it is usually unset in which case \pkg{vegan} will default to
 non-parallel computation.  The \code{mc.cores} option can be set by
-the environmental variable \verb|MC_CORES| when the \pkg{parallel}
+the environmental variable \code{MC_CORES} when the \pkg{parallel}
 package is loaded.
 
 \R{} allows\footnote{Since \R{} version 2.15.0.}
@@ -130,7 +130,8 @@
 ## start up and define meandist()
 library(vegan)
 data(sipoo)
-meandist <- function(x) mean(vegdist(x, "bray"))
+meandist <- 
+    function(x) mean(vegdist(x, "bray"))
 library(parallel)
 clus <- makeCluster(4)
 clusterEvalQ(clus, library(vegan))
@@ -216,11 +217,13 @@
   \code{parallel} will be either an integer or a socket cluster, and
   information on the type is saved in variable \code{hasClus}:
 <<eval=false>>=
-if(is.null(parallel) && getRversion()>="2.15.0")
-   parallel <- get("default", 
-                   envir = parallel:::.reg)
-if (is.null(parallel) || getRversion()<"2.14.0")
-    parallel <- 1
+if(is.null(parallel) && 
+   getRversion()>="2.15.0")
+     parallel <- get("default", 
+                 envir = parallel:::.reg)
+if (is.null(parallel) || 
+    getRversion()<"2.14.0")
+      parallel <- 1
 hasClus <- inherits(parallel, "cluster")
 @ 
 \item Integer: An integer value is taken as the number of created
@@ -244,7 +247,7 @@
     will mean creating and stopping socket clusters even when a
     default cluster is set if \code{mc.cores} is not
     \code{NULL}. Please note that the \code{mc.cores} is only set from
-    the environmental variable \verb|MC_CORES| when you load the
+    the environmental variable \code{MC_CORES} when you load the
     \pkg{parallel} package, and it is always unset before first
     \code{require(parallel)}. \footnote{The behaviour of
       \code{mc.cores} option is untested in Windows.}

Modified: pkg/vegan/inst/doc/vegan.sty
===================================================================
--- pkg/vegan/inst/doc/vegan.sty	2013-07-18 12:57:11 UTC (rev 2572)
+++ pkg/vegan/inst/doc/vegan.sty	2013-07-18 13:00:06 UTC (rev 2573)
@@ -19,7 +19,12 @@
 \usepackage{Sweave}
 \usepackage{hyperref}
 %% macros
-\newcommand{\code}[1]{\small\texttt{#1}}
+%% \code should handle _ ,  ~ and $ 
+\makeatletter
+\newcommand\code{\bgroup\@makeother\_\@makeother\~\@makeother\$\@codex}
+\def\@codex#1{{\normalfont\ttfamily\hyphenchar\font=-1 #1}\egroup}
+\makeatother
+%% simple macros
 \newcommand{\pkg}[1]{\textbf{#1}}
 \newcommand{\proglang}[1]{\textsf{#1}}
 \newcommand{\R}{\proglang{R}}



More information about the Vegan-commits mailing list