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

learn more… | top users | synonyms

2
votes
0answers
34 views

Include Tikz-documents with a latex body in Lyx

I also posted this with a little different focus on stackoverflow already, but I am still looking for a elegant solution, so I will try again here. I use tikzDevice in R to transform my graphics into ...
1
vote
0answers
18 views

xtable, via knitr, inside multicols

How can I put an xtable (made with knitr) in a multicols environment? The table is working outside multicols, but when I place it inside multicols it disappear. I've tried with lstlisting inside ...
2
votes
1answer
71 views

Tables with reference to R objects in sweave / latex

I'm using knitr/R-sweave to produce a pdf-document wit LaTeX-code. I want to make a table with some numbers produced by some R calculations in the R-code-chuck above this table. When I usually want to ...
1
vote
1answer
86 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, include=...
1
vote
0answers
20 views

pdf error when compile a knitr figure chunk

I am getting !pdfTeX error: pdflatex (file D:/project/figure/plot-1.pdf): PD F inclusion: required page does not exist <0> ==> Fatal error occurred, no output PDF file produced! when ...
1
vote
1answer
230 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 ...
0
votes
0answers
9 views

How to add reference to a knitr figure chunk in lyx?

Is there a way to make the lyx dialog "add -> cross references" to find knitr figure chunks? I.e., is there a lyx built-in way to add references to knitr figures other than use \ref manually?
2
votes
1answer
15 views

Knitr/Sweave Format Code Output w/ Leading Characters

Using knitr/sweave, I need to format the R code output that gets echoed, according to editorial journal requirements. For example, the following chunk <<example,echo=TRUE>>= library(plyr)...
11
votes
2answers
2k 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 ...
3
votes
0answers
93 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 ...
0
votes
0answers
93 views

Knitr not available in LyX (Windows)

I installed LyX with MicTeX on my pc. I installed the Knitr module. So I see in the packages in R studio that I can add 'Knitr'. After that i added the path of R.home('bin') to the PATH in the ...
0
votes
0answers
61 views

LaTeX Error: Environment snugshade undefined when trying to knit pdf from rmd file

I have a basic Rmd file which looks like this: --- title: "trial" output: pdf_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r trial} plot(1:10) ``` When I ...
4
votes
3answers
360 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
21 views

How to create looped output with knitr?

In my thesis, I have found 79 different concepts I need to describe in detail in the appendix. I used R for the analysis, and I want to use knitr for creating that appendix. Each description follows ...
1
vote
0answers
155 views

“Undefined control sequence” error in .rnw file

I see that this error has been posted to tex.stackexchange but the answers seem to differ based on the sytnax used to cause the error, and I cannot find a similar enough context to my own (For ...
2
votes
1answer
27 views

How to tell alltt not to skip lines at beginning/end?

It seems like there is no option for specifying that, like a hack for verbatim I found on tex.stackexchange: \usepackage{etoolbox}% \makeatletter \preto{\@verbatim}{\topsep=0pt \partopsep=0pt} \...
1
vote
1answer
287 views

Wrap text from xtable row names with knitr

I am using knitr to generate pdfs that contain tables that I'm making with xtable. How can I wrap the text in these tables? Here is my best effort so far: \documentclass{article} \begin{document} &...
1
vote
1answer
129 views

Using knitr with TeXworks

I checked out the conversation between Speravir and Yihui, and also Yihui's site and video for getting knitr to work with TeXworks. However, I am definitely not super tech-savvy and I'm having some ...
0
votes
0answers
34 views

Texmaker: display the structure of the whole document

I am working on a Latex document which includes several parts in separate documents. Is there a way to make Texmaker look into the included documents to display on the left hand sire panel all the ...
0
votes
0answers
57 views

Caption options don't work in rmarkdown beamer template

I want to resize the figure captions in an rmarkdown beamer template, so I added \usepackage[font={small,it}]{caption} to my header.tex. But it doesn't work - the options are ignored. I didn't find ...
1
vote
1answer
174 views

Knitr markdown can't display basic symbols

I'm on Ubuntu 14.04, running RStudio Version 0.99.473. I have LaTeX installed (TeXworks) and knitting Rmarkdown documents works just fine. However, adding mathematical symbols such as $\mu$ causes it ...
3
votes
1answer
36 views

Use a LaTeX expression in a knitr figure caption

I am writing an .Rnw document in RStudio. I would like to be able to use latex expressions in Figure captions created by knitr. First a code chunk for the caption: <<cap_4, echo=FALSE>>= ...
8
votes
1answer
1k 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 ...
2
votes
1answer
96 views

How to change row height within xtable environment?

I would like to change row height such that all rows except the header row will have fix height x and the header row will have eight y. I would like to do this within xtable environment because I ...
0
votes
1answer
61 views

with rmarkdown tufte-handout template xtables placed at the document end

I cannot understand why the chunks in rmarkdown would place tables at the end of the document. If I allow ECHO = TRUE in the chunk header, the code gets output in the correct place, but the table (...
1
vote
2answers
83 views

Where set font in tikzDevice-plots (.Rnw)

I'm trying to use sans serif fonts for the text in plots (ggplot2) made by R, within KOMA-book. Unfortunately I'm not very experienced in managing fonts and their families. To keep things consistent, ...
15
votes
2answers
3k 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 ...
0
votes
0answers
51 views

knitr: How to wrap text around a table generated around code chunk?

I would like to wrap text around a table generated by a knitr code chunk. I found a solution for a regular table here, but I didn't manage to re-implement it for a table generated by a code chunk. For ...
2
votes
1answer
22 views

Knitr: how to use citep control sequence inside code chunk option fig.cap?

I have a problem to include a citation into a code chunk option fig.cap, e.g.: fig.cap= Reprinted from \citep{Moran2008}. When the citep control sequence is included in the option, the execution of ...
2
votes
2answers
73 views

Knitr: How to make a crossreferences to figures and tables generatrd by code chunks?

I would like to make cross-references to images and tables generated from knitr code chunk in the same way as to standard figures and tables. In a standard figure I use control sequence \label, but i ...
3
votes
3answers
571 views

knitr sanitises the % marker for LaTex comments and they show up in the final document

I am writing a knitr document using xtable to get my tables. Xtable inserts by default a comment saying: "latex table generated in R 3.1.0 by stable 1.7-3 package % Thu Sep 18 14:19:21 2014" This ...
2
votes
1answer
52 views

TeXStudio not compiling .Rnw properly with “scholar” R package

I'm working on making my CV with LaTeX, but I'm having an issue with including some R code. I'm using knitr and have made a user command for TeXStudio as follows: /Library/Frameworks/R.framework/...
4
votes
1answer
173 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'); ...
3
votes
2answers
497 views

knitr not working on LyX after installation of Mac OS X El Capitan

I updated my Mac to OS X El Capitan and knitr doesn't work on it. Before the update everything was fine. Now LyX is saying : "The module knitr requires a package that is not available in your LaTex ...
4
votes
3answers
121 views

How to extract a series of text not in an environment, but with defined commands enclosing them

Under Windows 8, I am using R and the knitr package in RStudio with an .Rnw script. My regex skills are passable, but only in R. My document has about thirty pages with a different text section at ...
2
votes
0answers
30 views

Why are the axis labels too large when using tikzDevice and lattice?

I'm working on a paper that is to be submitted to an Elsevier journal. The official guidelines state that: As a general rule, the lettering on the artwork should have a finished, printed size of ...
0
votes
0answers
49 views

XeLaTeX + knitr + Arial = error

When I compile the following: \documentclass{article} \usepackage{fontspec} \setmainfont{Arial} \begin{document} Hello. <<foo, dev='tikz'>>= library(ggplot2) qplot(1) @ \end{document} ...
3
votes
1answer
73 views

knitr code chunks in footnotes

My issue is to include verbatim output from knitr Sweave code chunks in footnotes. The BVerbatim environment (fancyvrb) gives me the formatting that I want. (NB: one needs to put \VerbatimFootnotes ...
1
vote
0answers
72 views

How to solve the error: No counter 'sectionpage' defined [closed]

I'm trying to use this answer from a previous question to get frame numbers in a table of content in a beamer presentation made in RStudio with R Markdown and knitr (see file below; in in_header.tex ...
0
votes
1answer
33 views

xtable: extend table to both columns

Using the xtable package, is it possible to give some option to xtable function to generate a tex file which will contain following: ``` \begin{table*} ... \end{table*} ```
2
votes
1answer
123 views

Using Calibri with a Mac

I am preparing a document, writing it in RStudio and knitr in a Mac (OS X El Capitan 10.11.2). I would like to use Calibri (to mimic Office documents). I already have a legal version of Microsoft ...
2
votes
2answers
88 views

With knitr and LaTex, how can you arrange the List of Figures alphabetically?

What code will enable me to reorganize the List of Figures alphabetically (and keep the page number)? My goal is to include that alphabetical listing of figures in the PDF file that is created. Here ...
2
votes
1answer
68 views

Insert line break into knitr fig.cap?

I am using knitr and want to insert a line break in my fig.cap chunk option. Is this possible? The following is all I can think of but it doesn't work. I expect there's some evaluation option but I ...
5
votes
1answer
950 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$", ylab="\\\\$...
3
votes
1answer
405 views

Is it safe to reinstall MacTex after upgrading from Yosemite to El Capitan

I was using MacTex on OSX 10.10 (Yosemite). I upgraded to OSX 10.11 (El Capitan) and now I get the error "No TeX installation detected" trying to compile a latex document using knitr. I saw the ...
2
votes
0answers
58 views

What is the counterpart in LaTeX for the R package ezknitr and its tools for managing paths and directories

Dean Attali has just added an R package called ezknitr to CRAN. It enables those who use knitr and RMarkdown in .Rmd files to handle directories quite flexibly. His blog describes it well: path ...
2
votes
0answers
33 views

Formatting text the same way knitr formats code, but outside of chunks

Back when I was using sweave, I could make my inline code look like R code by using \texttt{whatever} or \verb@whatever@. I am trying out knitr, and the format of the code chunks sure is pretty. But ...
15
votes
1answer
2k 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 ...
1
vote
0answers
741 views

Error 43 while knitting a markdown to pdf in a R project created on mac and run on Windows

I created a R project which outputs some plots to pdf using rmarkdown::render with an .Rmd file. I shared the folder when the R project and all the relative files are kept to a colleague using Google ...
4
votes
1answer
2k views

Sweave and Knitr Figure Size

I recently made the switch from using Sweave to Knitr in order to gain Knitr's ability to cache R code chunks. So far its been fairly straightforward except for one thing. I cannot seem to find an ...