knitr is an R package for dynamic report generation based on the concept of literate programming.

learn more… | top users | synonyms

1
vote
0answers
15 views

Use of environ package with knitr

I'm working on a knitr document and trying to place knitr output inside of a new environment defined using the environ package. The example below illustrates the problem. With a traditional LaTeX ...
1
vote
1answer
25 views

Justifying the output of toLatex function of utils R package

Using utils::toLatex(sessionInfo()) in .Rnw we can get R Session Info to put in LaTeX. I would highly appreciate if someone guide me to fully justify the output of utils::toLatex(sessionInfo()). ...
0
votes
0answers
12 views

How to 'Go to Source' for a .Rnw file with knitr on TexStudio

So, I am TeXStudio and R on Windows 8 and have configured with knitr as follows: "C:\Program Files\R\R-3.0.3\bin\Rscript" -e "library(knitr, lib.loc='C:/Users/User/Documents/R/win-library/3.0'); ...
5
votes
1answer
87 views

minitoc package adds extra page when used with float and lastpage packages

The minitoc package adds extra page when used with float and lastpage packages. I figured out that this problem can be resolved by loading minitoc package before float and lastpage packages. In LyX ...
2
votes
1answer
68 views

Avoid R output leaking into LaTeX with ggnet

Please consider the following MWE which I compile into a .tex document via knitr \documentclass{article} \begin{document} <<echo=FALSE, message=FALSE, warning=FALSE>>= library(igraph) ...
0
votes
0answers
24 views

Problem with in-text figure references in APA-style manuscript with Knitr

I'm having trouble getting a Knitr documents figure references to work in an APA style manuscript. I have looked around, but I haven't seen anything that references this problem specifically. When ...
3
votes
1answer
45 views

R Chunk Code within Enumeration Environment with knitr in LyX

I need R Chunk Code within Enumeration Environment in Rnw file. The following .Rnw document works fine. \documentclass{article} \begin{document} \begin{enumerate} \item The quick brown fox jumps ...
0
votes
0answers
29 views

Control stargazer table output in combination with mathpazo and siunitx

I like the idea to control all my numeric outputs with the smallest number possible of packages. I use mathpazo to control my fonts and siunitx to control formatting. Yet when I knit a LaTeX table ...
2
votes
0answers
39 views

knitr: Several figures with subcaptions, alignment issues

Here is a minimal working example: \documentclass{article} \usepackage{subfig} \begin{document} <<echo=FALSE,out.width="0.49\\linewidth",fig.show="hold",fig.align="center",fig.cap="Some ...
1
vote
0answers
38 views

Knitr and numbers

I return to a question, which is few months old and then maybe not yet the best practice around. I use the siunitx package in my documents along with knitr to compile my R chunks. As far as I ...
3
votes
0answers
39 views

Sub-figures in multiple pages but with one figure caption and showing “continued on next page”

The below code (together with Knitr package in R) creates figures on 3 pages under one caption of "Figure 1: Lots of figure". What I want to have is something like "footer" underneath figures in ...
2
votes
1answer
49 views

Memory issue when producing dense TikZ figure (14500 points scatterplot) with knitr

I have a series of plots in my document which are correctly drawn by knitr with dev=tikz. Yet figure number 7, which is much more dense than the others in terms of data points, foo, doesn't: label: ...
1
vote
0answers
30 views

caption above figure using knitr

This is a question originally asked on stackoverflow, but it seems to receive no attention and answers there. Since it's related to latex, I'm posting it also here hoping to receive some hints. I ...
1
vote
1answer
47 views

Cross-referencing tables generated by xtable

I'd like to cross-reference a table that I generated with xtable in R. I cannot able to. Here is what I did: \documentclass{article} \begin{document} Look at \ref{tab:mytable}. ...
2
votes
2answers
67 views

How does one set document class options (e.g. paper size) for LaTeX output?

The header option lets you insert TeX code in the preamble after \documentclass{article}, but what if I want to change the default paper size or the default font size? For this, I would need to ...
1
vote
1answer
66 views

Colouring cells of tables without xcolor

Are there any decent alternatives to xcolor if I want to colour cells in a table? I want to highlight certain cells depending on my data, but not entire rows or columns. I'm using Knitr and am having ...
0
votes
0answers
39 views

Error R Sweave and Knitr Plugins at WinEdt 8.0?

I try a simple example document .rnw at WinEdt with R Sweave Plugin like this : \documentclass{article} \begin{document} \SweaveOpts{concordance=TRUE} \textbf{hello world} ...
0
votes
1answer
62 views

Any LaTex-based software for beginners? [duplicate]

I want to learn LaTex language so I can format and use that to compile a nice pdf with descriptive statistics using Knitr in RStudio. Any recommendation?
2
votes
0answers
88 views

Configure R Studio to use Biber for APA on Beamer Slides (Biblatex + Biber + R Studio + MiKTeX)

I'm trying to generate with R Studio a beamer presentation that uses backend=biber option. Here is my MWE: \documentclass{beamer} \usepackage[american]{babel} \usepackage{csquotes} %apa requires ...
4
votes
1answer
113 views

Using knitr, beamer, and /foreach to produce unique section titles in pdf from R string variable

Using R, knitr, and beamer, I have created a pdf that contains a graph for each school in our district. I read in each graph using the \includegraphics command within a /foreach loop. I want to ...
2
votes
1answer
53 views

Strange Knitr behavior with APA6 class manuscript

I tried everything that I know to solve this problem. I normally write my homework on share latex, but for this I downloaded and installed MacTex, Sweave and Knitr on my Mac. After trying out every ...
2
votes
1answer
25 views

Latex ifFileExist

\subsection{Checksum: Factor, Specific, and Total Variance} Perhaps the most basic test of a regression model is if the factor and specific variances sum to equal the total variance. Here, we ...
4
votes
3answers
90 views

knitr. Splitting a function into several blocks

Is it possible with knitr to split an R function across several blocks (for documentation reasons)? Here is a MWE: \documentclass{article} \begin{document} Part1 gives salutation. ...
3
votes
2answers
71 views

Typeset R character vectors

I have two vectors in R that I want to typeset. The first vector includes the titles and the second the body texts. Please consider the following MWE \documentclass{article} \begin{document} ...
1
vote
0answers
37 views

How to export changes from a .tex file back to the source .Rnw file

Let's say my work-flow is writing a paper with multiple R chunks as a .Rnw then compiling it into a .tex file and then typesetting it into the final document. Now, after the document has been ...
10
votes
0answers
134 views

How to write an arara rule for knitr

I've been trying to write a rule for invoking knitr via arara, but I don't seem to know what I'm doing, apparently. The arara manual explains how to define custom rules. To do so, it is necessary to ...
0
votes
0answers
85 views

“Math Processing Error” when processing LaTeX using knitr in R

I've never had any problem with my Latex appearing properly when using knitr before, but recently when I compile my document, I get this error: I'm not sure why this is happening. The error output ...
3
votes
1answer
282 views

How to include LaTeX package in R Markdown?

I am writing a report with Rmd in RStudio via knitr package. I want to write a indicator variable symbol in the report, like How do you get \mathbb{1} to work (characteristic function of a set)?. ...
3
votes
2answers
153 views

TikzDictionary slow and blocking in knitr

I need to knit presentations with many slides and Tikz-plots. Knitr is fantastic for this, but it takes very long time and I cant knit two reports in parallel. I have isolated the problem to the ...
3
votes
1answer
49 views

display \Sexpr{} in Latex without evaluation

I am working on a tutorial for the knitr package using the beamer class. I was able to display latex code and knitr chunks inside my presentation without evaluation but I additionally want to add ...
5
votes
1answer
243 views

Howto: Set up knitr (*.Rnw compilation) from in TexStudio

How do I set up TeXstudio to compile xxx.Rnw files? I am using the TeX-Editor TeXstudio 2.7, on Windows 7, and R 3.01 64-bit. I would like to write a xxx.Rnw-file in TeXstudio and then from ...
1
vote
1answer
155 views

Sublime Latexing and Knitr on .RNW files : Send lines to R console for evaluation

I am using Sublime Text 3 and the Latexing package to apply Knitr to compile .Rnw files that contain both Latex and R code. Overall, it works well in that I can compile the .Rnw files into PDFs ...
7
votes
1answer
303 views

Best Practice for nice layout with tikzDevice

R+tikDevice+LaTex+knitr is (as I understand it) the most efficient way to get relly nice looking publications from R, with maximum layout-support from LaTeX. I'm using R+LaTex+knitr now, but would ...
4
votes
1answer
95 views

inline knitr code that isn't a simple number

It is easy enough to do something like \Sexpr{1 + 1}. But how can I do \Sexpr{mymatrix} with mymatrix being a matrix object in R workspace? More generally, how can I print object that is more complex ...
4
votes
1answer
43 views

Turning off line-wrapping in auctex for smooth transition with ess in same file

I sometimes use auctex + ess for Sweave/knitr documents. Every time I switch from auctex to ess and vice versa, there is a pause/jolt while the auctex lines re-wrap themselves. Previously, I also ...
1
vote
0answers
77 views

How do I add a caption to a table within a minipage?

I am using Knitr to generate two tables side by side on a two column layout (ACM sigproc). \begin{table*} \begin{minipage}[h]{0.49\linewidth} <<results='asis'>>= ...
7
votes
4answers
162 views

tikz has probably problems with czech babel when compiling .Rnw

Problem Tikz seems to have a problem with \usepackage[czech]{babel}. I had a moderately big .Rnw document written in czech with some plots via knitr chunks. When I set dev = 'tikz' the TeXmaker ...
2
votes
1answer
615 views

Controlling formatting options for xtable

All, I'm a LaTex/knitr/Sweave amateur and have had trouble finding answers to what seem like they should be fairly simple questions online. I have a .Rnw script that I am currently compiling to PDF ...
0
votes
0answers
70 views

Custom chunk hooks in knitr

[Cross-posted from SO] I am trying to create a chunk hook that can produce a \floatfoot{} as part of the output from a chunk. Hopefully the following example makes clear what I am trying to achieve: ...
5
votes
2answers
212 views

What do Sweave/knitr offer that make doesn't?

I use LaTeX to write papers and R for data analysis and visualization, so I've been looking into Sweave and knitr. The Sweave website says: The purpose is to create dynamic reports, which can be ...
0
votes
0answers
62 views

Make .Rnw child document independent from main document

This is a followed-up question to this answer. I have a variables.Rnw document in charge with the task of loading data from R datafiles and create R variables that I will then compile into a .tex ...
1
vote
1answer
92 views

How to create a newcommand with knitr?

I am using knitr and I'd like to make some new commands to combine common tasks into one, e.g. \newcommand{\numps}[1]{\numprint{\Sexpr{#1}}} so that I can do something like \numps{pi}. I can't seem to ...
0
votes
0answers
52 views

Is it possible to place a chunk within a chunk?

I am asking this question because I need to loop a \section tile by a chunk and place the according result in the section using another chunk. Here is an example of one circle: The chunk for ...
4
votes
1answer
108 views

passing a String from an R Script to .Rnw template R code section ,brew/knitr

this is my first ever post and i am quite new to all of this, so i hope i am doing this right. my problem is the following: i wrote some R code to get some ID's from a Database, which are then used ...
8
votes
1answer
198 views

Different colors for default and language-specific listings

I'm generating pdf documents using knitr and pandoc. The conversion is mostly automated from R markdown -> markdown -> latex -> pdf. However, my documents combine R source code and its output, and I ...
2
votes
1answer
325 views

Dynamically format labels/columns of a LaTeX table generated in R/knitr/xtable

I have some tables coming from the statistical package R that I want to export in LaTeX markup. I would like to make every column large as the longest word of its label (assuming for simplicity the ...
4
votes
1answer
145 views

Insert a TeX file created with knitr into a main TeX file [duplicate]

I want to insert a knitr output file (created in RStudio as .rnw file, then I compiled, it creates the .tex file) into my main .tex file. But I got an error, how we can do this? Knitter Tex file: ...
1
vote
0answers
16 views

Insert the .tex file created through the knitter to main .tex file [duplicate]

I want to insert out put file (created in RStudio as .rnw file, then I complied, it creates the .tex file) into my main .tex file. But I got an error, hw we can do this?
3
votes
2answers
801 views

Suppress library comments from ouput with knitr

I noticed that some library comment manage to pass through the knitr options, with R 3.0.1 and knitr 1.5 running on Mac OSX 10.8.5. The following MWE \documentclass{article} \begin{document} ...
4
votes
1answer
253 views

Color first row in a xtable generated table

I am trying to color the FIRST row of my table. But if I add \rowcolor[gray]{0.95} to the FIRST row the colored row will be the SECOND. Indeed it is quite straight forward to modify from the second ...