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

learn more… | top users | synonyms

1
vote
0answers
10 views

Using \adjustwidth seems to break with a figure caption in knitr

I need to adjust my margins so I can place two pictures side by side. This works when there is no caption on the picture but when I add a caption the margins revert back to how they were. ...
2
votes
1answer
38 views

Appending an empty row after every 5 or 10 rows in LaTeX table

I wonder how to append an empty row after every 5 or 10 rows in LaTeX table. Here is my MWE in .Rnw format. Any help will be highly appreciated. Thanks \documentclass{article} \usepackage{longtable} ...
0
votes
0answers
24 views

Redefining the knitr code chunk delimeter in LaTeX to compile .Rnw files as .tex files

I am trying to define some LaTeX commands/environments to handle the raw text in an Rnw file (R + LaTeX document compiled with R package knitr). The goal is to allow someone to rename a .Rnw file to a ...
0
votes
1answer
30 views

knitr Caption figure without number

I am looking for a way to caption my figures without numbering them (like \caption*{}). I am not sure how to do this in knitr. The following example shows my first attempt: <<label, ...
0
votes
0answers
17 views

How to determine defaults for a \documentclass in LaTeX

I had been using tufte-handout in LaTeX, but it seems very inflexible and not well documented. My main problem was trying to figure out how to get a table to output in the center of the page (How to ...
2
votes
1answer
32 views

Iterate latex/kintr code

I am new to knitr/Sweave. I need to prepare different versions of an exam with randomly generated questions. One version per student, each with the student's name on it. Below is a simple example with ...
2
votes
1answer
88 views

Two tables (not hard-coded) side-by-side in LaTeX that will page break

I wrote my original question here: (Two tables side-by-side in LaTeX that will page break). Then, I realized I needed to revise my question, by also including an additional problem that comes with it. ...
2
votes
1answer
51 views

How can I conditionally reference a figure?

So here's my knitr .Rnw file: \documentclass{article} \usepackage{hyperref} \hypersetup{} \begin{document} \let\ref\autoref <<plot,fig.cap='try'>>= if(rnorm(1) > 0) x = rbinom(1, 100, ...
1
vote
1answer
74 views

what does this error message suggest?

An error just prompted up when I process an .Rnw file using RSudio: Loading required package: knitr Warning message: package ‘knitr’ was built under R version 3.1.2 processing file: ...
1
vote
1answer
32 views

knitr: less/greater than sign displayed as (¡) and (¿)

I'm a beginner in using knitr to generate a report. I have a R script (see below for an example; BTW I'm using RStudio for all of this) that runs without error and the output is a data frame. My ...
1
vote
2answers
55 views

Conditionally print text with inline R data via knitr

I want to conditionally print a sentence that contains a \Sexpr{} in knitr. How can this be done? I know I can conditionally print text using \Sexpr{} but I run into issues when the text to be printed ...
0
votes
0answers
12 views

Fill arbitrary number of “template analysis page” based on data output by R

I'm using knitr to produce a report on anomalies detected in a machine. I've got an R script that searches for anomalies (there can be an arbitrary number of anomalies) and the script also produces a ...
2
votes
2answers
70 views

Install knitr on own shareLatex server

EDIT: According to a ShareLatex Github discussion, I should create a .latexmkrc file and add the following code (I tried already in the home directory but it didn't work) : my $root_file = ...
2
votes
1answer
48 views

knitr render html code

How to render html output to pdf in knitr? Here is my code \documentclass{article} \begin{document} <<echo=TRUE, results= 'asis'>>= library(xtable) n <- data.frame(x = 1:6, y = 15:20) ...
1
vote
0answers
35 views

How can I remove extra spaces in code passed through probsoln package?

This is an easy question to a potentially complicated situation. I'm using RStudio to write homework and exams using the probsoln package that embeds R code into the LaTeX directly. I am using knitr ...
4
votes
1answer
50 views

Input Tex file in knitr file

I am showing a simple example here just to frame the question. \documentclass{article} \begin{document} <<>>= library('ggplot2') dataset <- diamonds @ \begin{table}[htbp] ...
2
votes
1answer
94 views

How to use Umlauts (äüö) in axis label with knitr, LuaTex and tikz?

When compiling pdf documents with complex tikz figures using knitr, the pdftex engine would sometimes run out of memory. Thus, I used the luatex engine to compile these Rnw files. However, I am not ...
2
votes
2answers
46 views

shrink knitr output to multiple columns

I am providing a very simple example here. In my dataset, I have 50+ names in column. I get annoyed by the fact that colnames() output takes 50+ lines too! Is it possible to divide the output over ...
1
vote
1answer
85 views

chunk on a new page in knitr

I have a situation where i am knitting a bunch of figures in \enumerate and figures are big such that I would prefer one page for every figure. \documentclass{article} \begin{document} ...
0
votes
1answer
64 views

Modify R output in LaTeX

I'm currently writing a paper for my bachelor thesis with LaTeX. I'm pretty new to LaTeX and I was wondering whether I can modify the R output in LaTeX. For Example: If I type in this: ...
1
vote
1answer
164 views

Creating Bold Column Headers using xtable (knitr)

what is the easiest way to bold all column headers using the output of calling xtable, ideally under the print.xtable command. I am using knitr.
2
votes
2answers
76 views

bundledoc fails with subfolder paths (MiKTeX)

I would like to use bundledoc mainly in Windows with MiKTeX. However, I encounter a problem with subfolder paths that is annoying. I run the program as follows: bundledoc --config=miktex.cfg ...
1
vote
1answer
93 views

Capturing final figure caption using knitr

I'm writing a paper for the journal PLOSone. They require that figure captions be placed in the article but not the figure itself (it's submitted separately). So I'm wondering how to get knitr to ...
2
votes
0answers
104 views

R-code linebreaks AND themes in knitr

hpesoj626 provides two great minimal working examples for how to get R-code linebreaks AND code highlighting in knitr. I was wondering if it was possible to use Yihui's knitr themes within either of ...
1
vote
0answers
68 views

Table dull when transferred from R to word [closed]

I am using latex in R (mostly copied codes) to make beautiful tables. But transferring tables with the help of snipping tool used or saved as jpg from R to word, the table looks dull and not rich ...
0
votes
0answers
52 views

R data.table and knitr

I have an automated report that i produce using knitr. i'm running across the oddest problem. I wrote a function that sums the data by month for several locations. when i run this function in R i ...
0
votes
0answers
39 views

Unwanted white space with knitr+booktabs package

I want to include a table in my latex document that I create using knitr package. I "call" the table using: \begin{table}[H] \begin{centering} <<r second part}>>= kable(Per_cond, ...
2
votes
0answers
42 views

After updating to LyX 2.13: getting this message Sweave Noweb syntax? [closed]

After updating to LyX 2.1.3, I'm getting this message Sweave Noweb syntax?. I wonder what message mean and why I'm getting it? After clicking on ok, it works but I'm looking to not show this ...
1
vote
1answer
60 views

Why does this fail in LyX 2.1.3 but works in .Rnw?

This code works fine in .Rnw but does not work in LyX 2.1.3. In LyX 2.1.3 it throws the following error: Error in getModel.baseGmm(all_args, ...): could not find function "is" Any idea how to ...
1
vote
2answers
298 views

knitr in RStudio produces 'Undefined control sequence', alongside other issues

I am getting multiple issues being reported when I try to 'Compile PDF' for a knitr document in RStudio (Windows 7), although the .pdf is still produced in the working directory. I am using R 3.1.3, I ...
5
votes
0answers
103 views

What are the advantages of switching to Emacs for TeX/knitR work?

Currently, I am using TeXStudio. Now, I am considering to switch to Emacs because I heard that is has its advantages when it comes to R and knitR. But what are the specific advantages? Yet, I am still ...
0
votes
0answers
193 views

utf8 encoding problems with knitr

I'm using RStudio 0.98.1102 on Windows 7 with knitr 1.10 (R 3.1.2) and tried to knit the following file: \documentclass{article} \usepackage[ngerman]{babel} \usepackage[utf8]{inputenc} ...
0
votes
1answer
56 views

knitr-manual.lyx fails to compile on LyX 2.1.2

My error message gives me the following: An error occurred while running: Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.1/Resources/scripts/lyxknitr.R" ...
0
votes
0answers
160 views

Best way to Insert R code into a LyX document

Let's suppose that I have a set of R (3.1.2) scripts that I would like to display in LyX (2.1.2). I could use Program Listings, but I think this looks very unprofessional. I am wondering if anyone can ...
2
votes
1answer
72 views

Insert knitr (1.9) Chunks From Separate File Into Lyx (2.12) Document

I have a LyX document (report class) called mwe.lyx and I would like to execute the following Rmd chunk called "mwe.Rmd". {r, eval = FALSE, echo = TRUE, cache = FALSE} 2+2 Of course, I can ...
2
votes
1answer
111 views

How to modify knitr output chunk

I know that it's possible to tweak the output of a knitr code chunk so that it looks the way you want. My problem occurs when using the parskip package. The parskip package adds an extra bit of space ...
1
vote
0answers
59 views

Blog publishing / creation from Latex

I have been using Latex for a few years, and have several articles written in Latex. I want to share some of these articles on blogs, and I am very new to the blogging world. Just wondering if there ...
1
vote
0answers
50 views

Using xtable with listings package

I am the listings package as suggested by the following solution provided in this question: Getting Sweave code chunks to stay inside page margins? More specifically, I am using the following piece ...
2
votes
3answers
149 views

What's the best .Rnw editor?

I'm trying to find out what people use for editing .Rnw files. Desirable features are: Auto R code completion Auto LaTeX code completion Cross platform Automatic display of R function documentation ...
1
vote
0answers
179 views

Problem using tikzDevice in knitr

I can't seem to get knitr to work with tikzdevice. A simple example: \documentclass{article} \begin{document} <<test, dev='tikz'>>= library(knitr) library(tikzDevice) library(ggplot2) ...
2
votes
1answer
299 views

knitr: LaTex Longtable spanning several pages with word continued at bottom and caption appears only once in list of tables

I want to have longtable spanning several pages with word continued at right bottom of the table and its caption appearing only one in the list of tables using knitr. Below is my MWE in .Rnw format. ...
0
votes
0answers
48 views

How to cleanly post-process PDF compilation in AUCTeX and ESS?

This question is somewhat related to this one, but separate. Thanks to Jan Gleixner's utility, One can obtain synchronization between a source foo.Rnw compiled by knitr and the resultant foo.pdf. ...
1
vote
1answer
90 views

Auctex evince synchronization problematic with accented characters in file paths

I recently stumbled on this nice problem (bug ?) : I can use evince to visualize foo.pdf output from LaTeX obtained in AUCTeX and Synctex synchronization,as long as none of the files referenced in ...
4
votes
1answer
124 views

Pass a class/package/theme option to R with knitr

I have a beamer document with R chunks, say 'template.Rnw', which I compile with knitr using 'compile PDF' in RStudio. I have defined a theme 'mytheme.sty'. I would like to have an option to the theme ...
0
votes
1answer
151 views

Which software should I use for making high quality graphs? [closed]

I have written a paper in MS-Word. Now, I am converting it into LaTeX. The problem that I am facing is about figures. Some of the figures I have converted using Adobe Illustrator. However, since I ...
1
vote
0answers
74 views

How can I show a caption, subcaption and source similar to this NY Times style?

I would like to create a LaTeX document that mimics the style used on the NY Times' Upshot Blog (example at NY Times). Here is the desired output: They have these features: A thin gray line ...
2
votes
1answer
171 views

insert figure in sweave using knitr fig.path Version 2

I have a question similar to this post. I am trying to add a .jpg to a .Rnw file (compiling LaTex with RSweave and knitr). I've tried the following without success: ...
1
vote
1answer
192 views

How to include a .TeX file generated from .Rnw file into a .TeX file which is child of parent .TeX file?

I really need help. Here is the 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 ...
2
votes
1answer
157 views

knit() doesn't create .tex file with necessary preamble

I have a question about creating .tex from .Rnw using knitr in Rstudio. I have a test.Rnw file while looks like the following: \input{report_preamble_en.tex} \title{test} \author{author} ...
4
votes
0answers
152 views

tikz stops drawing into pdf after 20 line segments in plot generated through knitr tikzDevice

Problem If I try to draw a curve generated through knitr using tikzDevice into .pdf only 20 line segments of that curve are drawn and TeXstudio, through which I do it, just leaves message running ...