[Rcpp-commits] r3946 - pkg/Rcpp/inst/doc/Rcpp-attributes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 12 21:02:41 CET 2012


Author: jjallaire
Date: 2012-11-12 21:02:40 +0100 (Mon, 12 Nov 2012)
New Revision: 3946

Modified:
   pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw
Log:
suggested changes to attributes vignette 

Modified: pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw	2012-11-12 19:06:04 UTC (rev 3945)
+++ pkg/Rcpp/inst/doc/Rcpp-attributes/Rcpp-attributes.Rnw	2012-11-12 20:02:40 UTC (rev 3946)
@@ -1,8 +1,12 @@
-\documentclass[10pt]{article}
+\documentclass[11pt]{article}
 %\VignetteIndexEntry{Rcpp-attributes}
 \usepackage[USletter]{vmargin}
 \setmargrb{0.75in}{0.75in}{0.75in}{0.75in}
 
+\usepackage[T1]{fontenc}
+\usepackage{pslatex}        % just like RJournal
+\usepackage{palatino,mathpazo}
+
 \usepackage{color, alltt}
 \usepackage[authoryear,round,longnamesfirst]{natbib}
 \usepackage[colorlinks]{hyperref}
@@ -29,27 +33,6 @@
 \title{\pkg{Rcpp} Attributes}
 \date{\pkg{Rcpp} version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}}
 
-<<echo=FALSE>>=
-link <- function( f, package, text = f, root = "http://finzi.psych.upenn.edu/R/library/" ){
-	h <- if( missing(package) ) {
-		as.character( help( f ) )
-	} else {
-		as.character( help( f, package = paste( package, sep = "" ) ) )
-	}
-	if( ! length(h) ){
-		sprintf( "\\\\textbf{%s}", f )
-	} else {
-		rx <- "^.*/([^/]*?)/help/(.*?)$"
-		package <- sub( rx, "\\1", h, perl = TRUE )
-		page <- sub( rx, "\\2", h, perl = TRUE )
-		sprintf( "\\\\href{%s%s/html/%s.html}{\\\\texttt{%s}}", root, package, page, text )
-	}
-}
-linkS4class <- function( cl, package, text = cl, root = "http://finzi.psych.upenn.edu/R/library/" ){
-	link( sprintf("%s-class", cl), package, text, root )
-}
-@
-
 \begin{document}
 \maketitle
 
@@ -221,9 +204,10 @@
 <<eval=FALSE>>=
 cppFunction('
     int fibonacci(const int x) {
-        if (x == 0) return(0);
-        if (x == 1) return(1);
-        return (fibonacci(x - 1)) + fibonacci(x - 2);
+        if (x < 2)
+            return x;
+        else
+            return (fibonacci(x - 1)) + fibonacci(x - 2);
     }
 ')
 



More information about the Rcpp-commits mailing list