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

learn more… | top users | synonyms

3
votes
0answers
24 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
92 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
53 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
22 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
0answers
29 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 ...
0
votes
0answers
37 views

bibliography is not printed (using knitr, biblatex, backend = bibtex and \nocite{*})

I am trying to include a list of publications into my CV, using knitr in RStudio. \documentclass{article} \usepackage[backend=bibtex]{biblatex} \begin{filecontents}{my-publications.bib} ...
2
votes
1answer
57 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} ...
3
votes
0answers
104 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 ...
1
vote
1answer
60 views

SumatraPDF inverse search for RNW files

I'm using TexStudio to edit my rnw files. I setup an inverse search from SumatraPDF to TexStudio using THIS (verbatim) which is a renewed version of THIS. When I double click a text in SumatraPDF it ...
0
votes
0answers
50 views

How can I nest a code chunk within an enumerate environment when using R Markdown?

When I attempt to do this using this code: --- title: "Title" author: "Me" date: "31 October 2014" output: pdf_document: includes: in_header: includes.sty --- ...
2
votes
1answer
69 views

Special characters and math-mode in tikz graphics using knitr

This question closely relates to this one: Using '$' in a tikz plot generated by knitr I am able to get tikz graphics using knitr working with either math mode as in this post: Math mode in ...
1
vote
0answers
36 views

Force Knitr Figure on same page

I am using Knitr on RStudio. <<glmall, include=TRUE, fig.align='center', fig.cap='Diagnostics plots for full-model with GLM (Poission)', fig.show='asis'>>= par(mfrow=c(2,2)) ...
1
vote
1answer
36 views

Using geom_segment dashed line has odd behavior when using tikz device

My example is: \documentclass[12pt]{article} \begin{document} <<eg, dev='tikz', size='normalsize', echo=FALSE, message=FALSE, warning=FALSE, sanitize=TRUE>>= require(ggplot2) p1 <- ...
0
votes
1answer
43 views

Using '$' in a tikz plot generated by knitr

My example is: \documentclass[12pt]{article} \begin{document} <<eg, dev='tikz', size='normalsize', echo=FALSE, message=FALSE, warning=FALSE>>= require(ggplot2) ggplot(cars) + ...
4
votes
1answer
1k views

no tex installation detected on RStudio after OS X 10.10 yosemite upgrade

I upgraded my MAC to OS X 10.10 yosemite today. Now, when I run RStudio and try to use Knitr to compile pdf, it says no text installation detected. So, I did the following steps sequentially. ...
0
votes
0answers
27 views

LaTeX keeps placing floats above section headlines

I followed the accepted answer to the question on how to Start new page with each section but LaTeX still puts a float object on the top of a page, above the section headline. Instead, I want this ...
1
vote
0answers
115 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 ...
2
votes
1answer
106 views

How to print a table and figure side-by-side in knitr

I see a lot of posts on putting figures side by side with tables without knitr, and posts about putting tables next to tables and figures next to figures in knitr, but nothing on how to put a figure ...
2
votes
1answer
85 views

row and column specifications in xtable output

Using xtable I am trying to format a table x<- 1:5 y<- 11:15 mytable <- table(x,y) print(xtable(mytable)) Which gives I want to add x and y tag also at the top of the rows and sides
2
votes
1answer
924 views

Knitr and rmarkdown will not add figure captions to the output

I am writing a report on Rmarkdown and knitr using RStudio, and cannot find a way to get figure captions on my document. My code for the chunk where I try to plot is like: ```{r ...
1
vote
0answers
55 views

Setting LaTeX => PS => PDF in RStudio

I am using RStudio, with knitr, and want to use Lodewyckx's graphicalmodels.sty for graphs. It requires changing output profile to LaTeX to PS to PDF. Can this be done in RStudio still using knitr?
3
votes
2answers
137 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 ...
1
vote
1answer
35 views

fragile/verbatim R code inside probsoln when using an exterior Rnw file for the data sets

A follow-up on this question about using R code inside the environments used in probsoln package. If you uncomment out the section below and define the problem within the main Rnw file, the R code is ...
2
votes
1answer
681 views

No TeX installation detected. Please install TeX before compiling - RStudio Knitr on Mac [closed]

I have tried to reinstall the MacTex twice. I even reinstall R and RStudio. Nothing could cure this problem. Please Help me, I'm in middle of my thesis and I need to use Knitr and RStudio is only easy ...
1
vote
0answers
101 views

Best practice for ggplot transparency in pdf figures

I lost a couple of hours because of few transparent figures which Adobe Professional couldn't flatten to print (it crashed in the process). I wonder if there's any trick to produce PDF figures with ...
2
votes
0answers
35 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
41 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()). ...
1
vote
1answer
40 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
121 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
87 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
58 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
165 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 ...
1
vote
0answers
104 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
92 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
73 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
66 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
1answer
104 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
65 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
107 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
173 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
80 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 ...
1
vote
0answers
84 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
89 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
185 views

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

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
251 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 ...
3
votes
1answer
97 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
88 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
113 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
96 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
51 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 ...