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

learn more… | top users | synonyms

1
vote
1answer
42 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 ...
1
vote
1answer
83 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 ...
10
votes
0answers
114 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 ...
6
votes
0answers
248 views

Arguments of R Functions in Beamer with knitr

I'm using helpExtract.R function (can be obtained from here) to get arguments of R functions in Beamer with knitr. My (.Rnw) MWE is \documentclass{beamer} \usepackage{ragged2e} %new code ...
6
votes
0answers
490 views

knitr & xcolor: incompatible color definition

I'm using knitr and RStudio to compile LaTeX. In my real project I'd like to use some options from the LaTeX package 'xcolor', but when I do include \usepackage[options]xcolor, I get the error message ...
4
votes
0answers
207 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 ...
4
votes
0answers
98 views

How to mantain consisten font size in different plots

I usually embed numerous R plots in my TeX documents. knitr is very handy in helping me producing plots using the same font family of the TeX document. But a different problem of consistency is given ...
3
votes
0answers
30 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 ...
3
votes
0answers
149 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
0answers
297 views

How to keep ggplot font size constant when varying figure width

I have different figures across my document with different width. I set the the font size for all ggplots globally with theme_set(theme_bw() + theme(text=element_text(family="Palatino", size=20))) but ...
3
votes
0answers
104 views

Using subcaption package with knitr

How can I use subcaption package in knitr, instead of the obsolete subfig and \subfloat? Or, maybe, specify additional options with fig.env = 'subfigure'? It needed something like this: ...
3
votes
0answers
216 views

Show knitr-RNW document structure in Kile

When working with a knitr file (RNW document) on Kile the document structure isn't shown in the structure view, even though it contains a valid LaTeX structure of parts, sections etc. If I change the ...
2
votes
0answers
25 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 ...
2
votes
0answers
77 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 ...
2
votes
0answers
62 views

knitr pdf search invisible text

I use the fantastic knitr to generate beamer-pdf’s with hundreds of slides of plots. Every plot shows data of different measuring equipment, so for example the plot showing result of measuring ...
2
votes
0answers
117 views

Highlight R chunks in a Knitr document when working in Kile

When working on a knitr document in kile I can get highlights for the LaTeX parts of the document by adding the *.Rnw file extension in the Modes & Filetypes tab under Open/save configuration ...
1
vote
0answers
28 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 ...
1
vote
0answers
19 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
0answers
36 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 ...
1
vote
0answers
102 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 ...
1
vote
0answers
66 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'>>= ...
1
vote
0answers
86 views

Is it a known bug with the animate package?

In slide 10 here, I have embedded three animations in only one slide. You can see there's a bug by playing with the animations, is it a known bug ? Or is there something special to do in the code for ...
1
vote
0answers
164 views

Clash between knitr, tikzDevice and pgfplotstable

I use knitr to compile a document composed of two .Rnw. Please considered the following examples from this answer main.Rnw % !Rnw weave = knitr % !TeX program = pdfLaTeX ...
1
vote
0answers
110 views

Knitr/LaTeX: conditional execution based on external parameters

I'm using knitr to create LaTeX documents with integrated R code. Now I'd like to readout some external parameters (saved in a TXT or CSV file) and create a document based on the conditions specified ...
0
votes
0answers
9 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 ...
0
votes
0answers
19 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 ...
0
votes
0answers
27 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
0answers
58 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 ...
0
votes
0answers
58 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: ...
0
votes
0answers
53 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 ...
0
votes
0answers
51 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 ...
0
votes
0answers
118 views

knitr yielding different output in pdf than in R console

I am running RStudio Version 0.98.484 and R version 3.0.2 on OS X Mavericks. While using knitr I noticed a discrepancy between the console output from a summary() command and that generated in the ...