Sweave is a function in the statistical programming language R that enables integration of R code into LaTeX or LyX documents.

learn more… | top users | synonyms

12
votes
3answers
7k views

Using fancyhdr to create an image based header and footer

I'm trying to generate a latex report (via Sweave and R) where the header of the document is an image that covers everything (including the top/left/right page margin) and the footer covers everything ...
21
votes
4answers
2k views

Dynamically count and return number of words in a section

I am writing a proposal for which it is required to give the number of words of the main section in the proposal itself. I found this answer on how I can get a word count on a LaTeX document: Is ...
8
votes
2answers
2k views

R, Sweave, Hmisc: pretty-print numbers

I'm creating a LaTeX tables based on a matrix in R using the 'latex' function of the Hmisc package. dat = matrix(c(1000, 100, 10000, 10000), 2) latex(dat, file='') This works (as expected) ...
8
votes
2answers
725 views

Building TeX file from knitr Rnw as child of larger parent TeX file to use R objects and output

Here's my general problem: I'm writing my dissertation using a LaTeX template (http://www.latextemplates.com/template/masters-doctoral-thesis). The template is a parent file with multiple chapters as ...
9
votes
3answers
1k views

Include Sweave input as verbatim

How do I keep Sweave from compiling things in a verbatim environment? For example: \documentclass{article} \begin{document} \begin{verbatim} <<>>= 1+1 @ \end{verbatim} \end{document} ...
8
votes
1answer
832 views

Sweave generating invalid LaTeX

I've encountered a problem when I'm using Sweave to convert an .Rnw file into a .tex file. Sweave is replacing three options from hyperref's \hypersetup block with the value NA. This is the section ...
5
votes
4answers
704 views

Auctex TOC with multifile document

I'm writing my PhD thesis with LaTeX-Sweave and I use EMACS with AucTex and ESS. I have a master file (master.tex) and some slave files and my question is about the use of the TOC in the slave files. ...
1
vote
0answers
1k views

Fatal error occurred, no output PDF file produced in php file [closed]

We are using following code in .php script for generate .pdf file. $result1 = exec("R CMD Sweave /var/www/html/r/r_latex_sweave.Rnw"); $result2 = exec("pdflatex /var/www/html/r/r_latex_sweave.tex"); ...
19
votes
1answer
7k views

Getting Sweave code chunks to stay inside page margins?

Sometimes I get to make an R code chunk (in Sweave) which is longer then the margins of the page. Is there a way to force it to "go to the next line" once that happens? Here is a simple example of ...
6
votes
1answer
2k views

side-by-side xtables in Sweave

I use xtable to manage my tables in Sweave like this <<label=tab1, echo = FALSE, results = tex>>= print(xtable(Table1)) @ <<label=tab2, echo = FALSE, results = tex>>= ...
3
votes
1answer
2k views

What's the best tutorial for beamer, sweave and ggplot2 combined?

I'm looking for the best example presentation publicly available on the Internet that uses beamer, sweave and ggplot2 all at the same time. Ideally it would be the actual example .Rnw file, along with ...
8
votes
5answers
1k views

How to get correct dimensions for a ggplot2 plot in beamer

I have a beamer presentation made with Sweave that I'm preparing and was wanting to place some ggplot2 graphs in but the aspect ratio does not seem to come out correct. This is what is in my Rnw ...
5
votes
1answer
563 views

Remove\begin{Schunk} \begin{Sinput}

I am using Sweave to produce my tex. In addition I use lstlisting to highlight the source code as below. \begin{lstlisting}[caption={Computation $\widehat Y_4$ and its ...
7
votes
1answer
743 views

How to build Knitr document from the command line

I would like to compile a knitr document from the command line. With Sweave, the sequence R CMD Sweave my_sweave_file.Rnw latex my_sweave_file.tex latex my_sweave_file.tex dvips my_sweave_file.dvi ...
4
votes
1answer
813 views

Making LaTeX documents with Hebrew? (in Sweave + RStudio)

I would like to write in Hebrew in an .Rnw file, and use it with RStudio. Searching around, I found an example for using Hebrew in LaTeX in general: Numbers, punctuation and parenthesis reversed in ...
3
votes
1answer
1k views

Latex Error: 'Sweave.sty' not found?

I downloaded the most recent version of Miktex Basic Installer (2.9.5105). After following the Miktex's instructions, I began working through Nicola Satori's Sweave Tutorial. The R portion of ...
4
votes
1answer
1k views

FancyVerb error for Sweave output in Beamer

I'm having trouble including Sweave output in my Beamer file. Specifically, the Soutput environment is causing problems (it runs if I comment those lines out, but, of course, the table is not ...
3
votes
1answer
251 views

Is there a PythonTex equivalent to \Sexpr{} in R?

I started to use the excellent PythonTex package to write reproducible reports but can't seem to get it to evaluate Python code inside a LaTeX command. R has Sweave & knitr which provide the ...
2
votes
1answer
104 views

How to escape inline R command to avoid issue with “while-typing” spelling check

I have a problem with my text editor Aquamacs Emacs (GNU Emacs 23.4.1) when use it with \Sexpr to print inline the output from R functions. The problem results when the R command includes special ...
2
votes
1answer
89 views

Sweave.sty causing error in verbatim environment?

folks-- The following throws an error, shown below \documentclass{book} \usepackage{Sweave} \begin{document} \begin{verbatim} data ds; infile 'dir_location\filename.csv" ...
2
votes
2answers
1k views

Installing Sweave for Miktex 2.9 on Windows 7

I've been looking everywhere, but my computer (Windows 7) just won't install the Sweave.sty package for Miktex 2.9. I tried to put it in a folder respecting the TDS standard, and then to install it, ...
2
votes
1answer
220 views

Rstudio output in Hebrew

(Follow-up to Making LaTeX documents with Hebrew? (in Sweave + RStudio)) Trying to reproduce the above answer, I followed these instructions without success, under Windows 7. The best result I got ...
2
votes
1answer
729 views

Sweave only produces NAs when using Umlauts.

I have a problem with Sweave. As soon as I use any mutated vowels/Umlauts (ü, ä, etc.) Sweave produces an NA in the document although it worked before. I don't know what to do, so any help would be ...