[Rcpp-commits] r1427 - in pkg/Rcpp/inst/doc: Rcpp-modules Rcpp-package

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 4 20:33:49 CEST 2010


Author: edd
Date: 2010-06-04 20:33:49 +0200 (Fri, 04 Jun 2010)
New Revision: 1427

Modified:
   pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
   pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw
Log:
carry over color spec for hyperref from RcppGSL.Rnw
(and emacs seems to have changed a ton of whitespace)


Modified: pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw	2010-06-04 17:15:29 UTC (rev 1426)
+++ pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw	2010-06-04 18:33:49 UTC (rev 1427)
@@ -1,12 +1,20 @@
 \documentclass[10pt]{article}
 %\VignetteIndexEntry{Rcpp-modules}
 \usepackage{vmargin}
-\usepackage{color}
-\usepackage{alltt}
+\setmargrb{0.75in}{0.75in}{0.75in}{0.75in}
+
+\usepackage{color, alltt}
 \usepackage[authoryear,round,longnamesfirst]{natbib}
+\usepackage[colorlinks]{hyperref}
+\definecolor{link}{rgb}{0,0,0.3}	%% next few lines courtesy of RJournal.sty
+\hypersetup{
+    colorlinks,%
+    citecolor=link,%
+    filecolor=link,%
+    linkcolor=link,%
+    urlcolor=link
+}
 
-\usepackage[colorlinks]{hyperref}
-\setmargrb{0.75in}{0.75in}{0.75in}{0.75in}
 \newcommand{\proglang}[1]{\textsf{#1}}
 \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}}
 
@@ -400,18 +408,18 @@
 \subsubsection{Properties}
 
 A C++ class exposed by a module may expose data members as properties. Properties
-are declared by the \texttt{property} method of \texttt{class\_}. 
+are declared by the \texttt{property} method of \texttt{class\_}.
 
 <<lang=cpp>>=
 class Num{
 public:
     Num() : x(0.0), y(0){} ;
-    
+
     double getX() { return x ; }
     void setX(double value){ x = value ; }
-    
+
     int getY() { return y ; }
-    
+
 private:
     double x ;
     int y ;
@@ -421,10 +429,10 @@
 	using namespace Rcpp ;
 
 	class_<Num>( "Num" )
-	
+
 		// read and write property
 		.property( "x", &Num::getX, &Num::setX )
-		
+
 		// read-only property
 		.property( "y", &Num::getY )
 	;
@@ -435,8 +443,8 @@
 setter (\texttt{x}) so that we can read and write the property at the R level
 with the dollar operator.
 
-The\texttt{y} property only exposes a getter (\texttt{getY}) so attempting to 
-set the property from R will generate an error. 
+The\texttt{y} property only exposes a getter (\texttt{getY}) so attempting to
+set the property from R will generate an error.
 
 <<eval=FALSE>>=
 mod <- Module( "yada" )
@@ -454,12 +462,12 @@
 @
 
 Getters may be const or non-const member functions of the target class taking
-no parameters. Free functions taking a pointer to the target class are also 
+no parameters. Free functions taking a pointer to the target class are also
 allowed as getters.
 
 Setters can be non-const member function taking one parameter or a free
 function taking a pointer to target class as the first parameter, and the new
-value as the second parameter. 
+value as the second parameter.
 
 \subsubsection{Full example}
 

Modified: pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw	2010-06-04 17:15:29 UTC (rev 1426)
+++ pkg/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw	2010-06-04 18:33:49 UTC (rev 1427)
@@ -1,12 +1,20 @@
 \documentclass[10pt]{article}
 %\VignetteIndexEntry{Rcpp-package}
 \usepackage{vmargin}
-\usepackage{color}           
-\usepackage{alltt}           
+\setmargrb{0.75in}{0.75in}{0.75in}{0.75in}
+\usepackage{color,alltt}
 \usepackage[authoryear,round,longnamesfirst]{natbib}
 
 \usepackage[colorlinks]{hyperref}
-\setmargrb{0.75in}{0.75in}{0.75in}{0.75in}
+\definecolor{link}{rgb}{0,0,0.3}	%% next few lines courtesy of RJournal.sty
+\hypersetup{
+    colorlinks,%
+    citecolor=link,%
+    filecolor=link,%
+    linkcolor=link,%
+    urlcolor=link
+}
+
 \newcommand{\proglang}[1]{\textsf{#1}}
 \newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}}
 
@@ -34,7 +42,7 @@
 }
 # this will be integrated to package highlight later
 ex_highlight <- function( file, external.highlight = TRUE, verbatim = FALSE ){
-	if( verbatim ){  
+	if( verbatim ){
 		writeLines( "\\begin{verbatim}" )
 		writeLines( readLines( file ) )
 		writeLines( "\\end{verbatim}" )
@@ -46,27 +54,27 @@
 				system( cmd )
 				tex <- readLines( tf )
 				keep <- seq( which( tex == "\\noindent" ), which( tex == "\\normalfont" ) )
-				tex <- c( 
-					"\\vspace{1em}\\noindent\\fbox{\\begin{minipage}{0.9\\textwidth}" , 
+				tex <- c(
+					"\\vspace{1em}\\noindent\\fbox{\\begin{minipage}{0.9\\textwidth}" ,
 					tex[ keep ],
 					"\\end{minipage}}\\vspace{1em}" )
 				writeLines( tex )
 			})
-		} else { 
+		} else {
 			r = renderer_latex( minipage = TRUE, doc = FALSE )
 			tex <- highlight( file, renderer = r , output = NULL )
 			writeLines( tex )
-		}   
+		}
 	}
 	invisible(NULL)
 }
 @
-                                                
+
 \begin{document}
 \maketitle
 
 \abstract{
-  \noindent This document is a short overview of the process to follow to write 
+  \noindent This document is a short overview of the process to follow to write
   an R package using \pkg{Rcpp}~\citep{CRAN:Rcpp}. This document only complements~\citep{R:exts}
   which we strongly encourage the reader to familiarize with before reading
   this document.
@@ -76,7 +84,7 @@
 
 \pkg{Rcpp} includes a function \Sexpr{link("Rcpp.package.skeleton")}, modelled
 after \Sexpr{link("package.skeleton")}, that facilitates creation of a skeleton
-package using \pkg{Rcpp}. This is by far the simplest way. 
+package using \pkg{Rcpp}. This is by far the simplest way.
 
 
 <<echo=FALSE>>=
@@ -94,8 +102,8 @@
 \subsection{R code}
 
 The skeleton contains an \proglang{R} function \texttt{rcpp\_hello\_world}
-that simply uses the \Sexpr{link(".Call")} interface to invoke the 
-\proglang{C++} function called \texttt{rcpp\_hello\_world} from the package. 
+that simply uses the \Sexpr{link(".Call")} interface to invoke the
+\proglang{C++} function called \texttt{rcpp\_hello\_world} from the package.
 
 <<echo=FALSE,results=tex>>=
 ex_highlight( file.path( gendir, "mypackage", "R", "rcpp_hello_world.R" ), FALSE )
@@ -104,27 +112,27 @@
 \subsection{C++ code}
 
 The \proglang{C++} function is declared in the \texttt{rcpp\_hello\_world.h}
-header file: 
+header file:
 
 <<echo=FALSE,results=tex>>=
 ex_highlight( file.path( gendir, "mypackage", "src", "rcpp_hello_world.h" )  )
 @
 
-The header includes the \texttt{Rcpp.h} file, which is the only file that 
-needs to be included to use \pkg{Rcpp}. 
+The header includes the \texttt{Rcpp.h} file, which is the only file that
+needs to be included to use \pkg{Rcpp}.
 The function is then implemented in the \texttt{rcpp\_hello\_world.rcpp}
 
 <<echo=FALSE,results=tex>>=
 ex_highlight( file.path( gendir, "mypackage", "src", "rcpp_hello_world.cpp" )  )
 @
 
-The function creates an \proglang{R} list that contains a 
+The function creates an \proglang{R} list that contains a
 \Sexpr{link("character")} vector and a \Sexpr{link("numeric")} using \pkg{Rcpp}
-classes. 
+classes.
 
 \subsection{DESCRIPTION}
 
-The skeleton generates an appropriate \texttt{DESCRIPTION} file, using 
+The skeleton generates an appropriate \texttt{DESCRIPTION} file, using
 \texttt{Depends} and \texttt{LinkingTo} :
 
 <<echo=FALSE,results=tex>>=



More information about the Rcpp-commits mailing list