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

learn more… | top users | synonyms

1
vote
0answers
87 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
1answer
222 views

knitr generated pdf cut border off from figure

I have a a problem with a figure that is correctly generated in RStudio but when knitted its right margin is not set correctly. Please consider the following MWE \documentclass[a4papera4paper, ...
6
votes
0answers
494 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 ...
3
votes
0answers
299 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
1answer
55 views

R console output spills into LaTeX when using rgdal

I can't avoid the R console output from spilling into the LaTeX document compiled by knitr. Please consider the following \documentclass{article} \begin{document} <<Map, dev='jpeg', dpi=300, ...
0
votes
1answer
257 views

Special characters in knitr generated figure caption

I would like to pass special characters and formatting with the knitr generated captions. I am trying to understand two things: 1) Is it possible to pass LaTeX syntax through the caption? 2) How ...
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 ...
3
votes
0answers
97 views

Fontsize with knitr & tikzDevice [duplicate]

I saw there are already a couple of questions on the argument (here and here) but since they are a few months old and since I can't manage to make the option dev.args=list(pointsize=5) works even ...
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 ...
2
votes
1answer
336 views

Is it possible to \include a .TeX file compiled from .Rnw?

I have a document with this structure: main.TeX which (ideally) includes bodytext.TeX compiled with knitr from bodytext.Rnw. I say ideally because apparently it is not that simple. I noted that ...
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 ...
0
votes
0answers
28 views

How to prevent plots being printed out of document's sections? [duplicate]

I am preparing a document using knitr in which I have multiple charts within two or more sections. The majority of the plots is printed at the end of the document but I would like them to stay within ...
3
votes
0answers
107 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: ...
2
votes
1answer
468 views

passing a variable from R to Tex in knitr

I am sure this has been asked multiple times since it seems to be a common issue. I looked around but all I could find was the \Sexpr for sweave which does what I want. I am using knitr and I can't ...
6
votes
1answer
518 views

Error compiling .Rnw in TeXstudio (knitr with PdfLaTeX)

I´ve been trying to get the minimal Demofile for knitr running and compiling in TeXstudio, but I keep getting errormessages. Here´s the info, mybe somebody can help me out about what I´m doing wrong: ...
1
vote
1answer
387 views

How to debug if Knitr quits unexpectedly when composing tikz figure

I have a .Rnw file that Knitr used to compile perfectly fine until my backend dataset changed. Probably then the size of the graph changed also. For reasons I don't understand knitr now stops abruptly ...
2
votes
1answer
775 views

knitr xtable make two tables equal width

I am using knitr and xtables to automate a report procedure. I want to include a few tables in this report and make them displayed with equal width. The Rnw code is listed below. Anyone could tell me ...
2
votes
1answer
146 views

knitr compiling time with large datasets

I noticed that with a large dataset knitr takes an unexpected long time to compile my document: about 23 minutes from when knitr completes the last chunk to when it writes the .tex. I don't understand ...
2
votes
1answer
188 views

siunitx error: “invalid-number” from R

I have a document in .Rnw which I use to produce a .texdocument with kntir. I have a problem with the formula \num{\Sexpr{max(degree)}} which in R console produce 12598 but after the running knitr in ...
5
votes
1answer
298 views

knitr and font style consistency in graphics

I am starting to use knitr to print graphics from R in my document. So far what I have been doing (I don't know if this is the best approach, but it is working) is to load the my R workspace with ...
3
votes
1answer
261 views

how to keep position of rotated tables

Since I'm working with R, I'm using the xtable package to produce my tables in Latex. Some of the tables only fit the page if rotated. It seems that sidewaystable always starts a new page. My problem ...
2
votes
1answer
108 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 ...
3
votes
1answer
240 views

addplot data frame

Square one: I have about 8 hours of experience. I want to make a barplot in pgfplots and see many great, creative solutions on this blog. All I want at this stage is not to specify coordinates and not ...
2
votes
1answer
166 views

Knitr plotting outside margin

I like the look of plots that extend beyond the margins \documentclass{article} \usepackage{lipsum} \usepackage[demo]{graphicx} \begin{document} \begin{figure} \centering ...
7
votes
1answer
833 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 ...
9
votes
2answers
795 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 ...
1
vote
0answers
112 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 ...
2
votes
1answer
256 views

xtable function generated latex does not get parsed for special char such as square brackets

I'm using the knitr package for putting my R output into PDF. I have two problems using xtable: When my table data has chars like this: [, ] in them, the conversion from .tex to .pdf fails with ...
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 ...
3
votes
1answer
162 views

Robust processing of autogenerated LaTeX files that contain many errors

I use knitr to generate pretty reports, with pdflatex as backend. Everything works fine if the R code runs without error. However, if the R code fails, the autogenerated file is sometimes invalid in ...
2
votes
1answer
1k views

Plot two figures side by side in knitr without changing mfrow?

I would like to plot 2 figures side-by-side using knitr. I know I could use par(mfrow=c(1,2)), but I've done a lot of work making the figures just right as they are. I've seen this (Two column layout ...
2
votes
1answer
417 views

insert figure in sweave using knitr fig.path

I'm trying to insert a figure using Sweave which is located in the path C:\Users\eccehomo\Documents\mi\fig1.png. I'm using the package knitrwhich has a function called fig.pathbut I'm getting many ...
2
votes
1answer
126 views

How can I make German characters from \input file display correctly?

I'm working with a Rnw file in RStudio and knitr. Everything works correctly so far, but I stumbled upon a problem when I included a chapter to the report that is written in German. I wrote the ...
3
votes
1answer
372 views

Texstudio and Rnw Files

Is there any way in Texstudio, for the document tree to detect Rnw files called within a knitr chunk? For example, the following would be ignored: <<MYCHUNK,child='./Myfile.Rnw'>>= @ ...
5
votes
1answer
376 views

Beamer (with style) to Html5?

My organization require the use of a standardized powerpoint template for how slides should look, so I've written my own Beamer .sty (style file). Then I write .Rnw-files in RStudio that I knit ...
5
votes
2answers
153 views

Create pdf with subset of slides

I use knitr and RStudio with XeLaTeX to create a presentation with many slides. But sometimes not all of the slides should appear in the final pdf. Is it possible to have a variable that I change ...
2
votes
1answer
105 views

Finding the current position on the PDF

I am trying to generate automated reports in R using knitr. There are a list of objects I need to print on the PDF and the size (rows, columns, length etc.) can vary. The problem is that when any of ...
4
votes
1answer
988 views

Using knitr, how can I rotate page to landscape and fit the figure to full extent?

LaTeX newbie here, so please be gentle. I'm working with knitr to generate pdf report. The document consists of quite few large maps, with a lot of details or small multiples. Ideally, whenever such ...
4
votes
1answer
402 views

Using Greek letters in LaTeX tables

I have the following Rnw document which I intend should produce a small table with "a b c" and "α β γ". At the moment, the encoding seems to be causing problems. The funny thing is that the output in ...
3
votes
1answer
288 views

Math mode in knitr

How do one use a math-mode in knitr? For example as a label for X-Y axis: <<fe, echo=FALSE, sanitize=TRUE, dev="tikz">>= plot(1:10, main="${}^{57}Fe$", xlab="$\\\\lambda$", ...
4
votes
1answer
867 views

knitr problem after update to R 3.0.0

I just updated R to 3.0.0. I couldn't compile PDF from my .Rnw file, which I could do with R 2.15. Here is the error I got: ! Undefined control sequence. l.192 \SweaveOpts ...
3
votes
1answer
149 views

Knitr and tikzDevice not working together with article options

I have a problem with knitr and tikzDevice, like someone before me. (See tikzDevice is not getting sizes right (knitr) .) He used dev.args to get rid of this error, but if I run this code through ...
8
votes
2answers
794 views

tikzDevice is not getting sizes right (knitr)

I am using OSX, pdflatex, R (cran), tikz/tikzDevice and knitr to create my documents. My problem is that the font sizes of the produced tikZ-file do not match the LaTeX document font sizes. Result / ...
2
votes
0answers
103 views

Long and rescaled xtable [duplicate]

Is there a way to use scalebox along with tabular.environment='longtable' when printing a long and wide xtable? When I give both of them I get an error: Running xelatex.exe on my_file.tex...failed
1
vote
1answer
1k views

knitr how to label and call a figure number in a text

As a knitr beginner I don't know how to label a figure and call it. For my first figure I've tried the following code witouth succes... <<fig.cap="Dendrogram of GDP ...
6
votes
2answers
2k views

R-code linebreaks AND code highlighting in knitr

I used the great answer from @Sharpie on 19 Jan 2012 Getting Sweave code chunks to stay inside page margins? to get linebreaks in the R-code, but how can there be code highlighting (colors) too? ...
3
votes
2answers
215 views

Force paragraph to stay with previous

I am using knitr to create inline sparkline-esque graphics. However, when knitr inserts images that it generates with R, it add a blank line, which forces LaTeX to make a new paragraph. That is, if I ...
1
vote
0answers
179 views

knitr : Figure are not appearing at the correct place [duplicate]

I'm trying to use knitr while learning LaTeX but all my figures are placed at a seemingly random place. It's driving me insane. Any ideas? Example Input PDF Output I tried reinstalling TeX Live ...
2
votes
0answers
119 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 ...
3
votes
0answers
217 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 ...