Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [knitr]

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

0
votes
1answer
15 views

Loading Custom Fonts into RMarkdown

I've been testing loading my own fonts into a personal rmarkdown document using the fontspec latex package. Because I'll eventually need to knit this on a server, using the font library on my mac is ...
3
votes
0answers
31 views

Including an Rmd file in a Rnw file using pandoc

I was trying to follow this example that shows how to write a separate chapter in RMarkdown and then include it in your main RNW file using \include{}. However, I have not been able to get pandoc to ...
0
votes
0answers
23 views

I get an error every time I try to run my Latex document in Texmaker, using a chunk code from R

I'm following the following guide: https://joshldavis.com/2014/04/12/beginners-tutorial-for-knitr/ I've installed the knitr package and run it in R, and I'm trying to copy and paste the example from ...
2
votes
1answer
54 views

Option clash with RMarkdown and beamer

I work across two separate Mac computers, a Macbook Pro at work, and a Macbook Air at home. Both macs are running identical operating systems. I am writing in RMarkdown, using knitr to compile beamer ...
2
votes
1answer
47 views

Plot symbols not showing properly using R + knitr with 'pdf' device

When I include R plots in a latex document using knitr, symbols do not show properly when knitr's graphic device is 'pdf', while everything is OK when the graphic device is 'png'. Here is a MWE: \...
2
votes
2answers
92 views

Automatic bibliography by DOI

I would like to know if it is possible in LaTeX to automatise the bibliography. For example, I would only put the DOI link in the bibliography and latex would take all the info (author, date, title ...
0
votes
1answer
76 views

How to re-run Bibtex on the file(s) - RSweave; KnitR

I have a document called Code.Rnw where I write my document in and I'm using Sweave and Knitr to compile it. For my bibliography I use biblatex. My setting is the following: \usepackage[bibstyle=...
1
vote
2answers
219 views

Left Quotation Marks when using RMarkdown and knitR

Normally when you want left quotation marks in LaTeX, you type the following: `` However, in RMarkdown, you will trigger a block of R code to run when you type two pairs of backticks on the same ...
1
vote
0answers
75 views

TeX capacity exceeded using Knitr

I am unable to weave a document containing LaTeX and R code using RStudio due what I think are TeX capacity limitations. Is there a way of fixing this without having to compile using LuaLaTeX which is ...
2
votes
1answer
61 views

Escaping % symbol when passed as a string from R chunk to knitr

I can't get the following to work: \begin{minipage} <<percentile, echo=FALSE>>= your_rank <- percentile ## calculated earlier rank_message <- ifelse(is.na(score), ' ', paste0("...
1
vote
1answer
459 views

pdflatex problem with Rstudio

I'm trying to compile a simple Rnw file in Rstudio using knitr "compile pdf" functionality. But it gives me an error. This is what I have in hello.Rnw: \documentclass{article} \begin{document} ...
0
votes
0answers
121 views

R code in LaTeX in YAML before_body include

I have a LaTeX section that I put at the top of my knitr generated PDF document. I achieved this by using the YAML options output: pdf_document: includes: before_body: file....
1
vote
1answer
346 views

Minimal LaTeX install for knitr to export PDFs from Rmarkdown on Debian-based system

I use RStudio and started writing Rmarkdown documents to knit them into HTML pages and PDFs. I tried installing TexLive but it failed when the astounding number of packages filled my limited ...
2
votes
2answers
110 views

Determine within LaTeX how many times latexmk have run

Backround So I've gathered that latexmk runs pdflatex until "all files are up to date". Problem and motivation Say that I have some dynamic content that should only be run once. By dynamic I mean a ...
0
votes
0answers
137 views

R-markdown does not produce citation list with Bibtex. No error messages

R Markdown produces a document without error but ignores my bibtex file. The citations are ignored and the reference list at the end of my document is empty. ... blah, blah [@sde] [@iacus]. My r-...
1
vote
1answer
123 views

execute R code in latex file imported from separate R file

My personal objective in this Rnotebook revolution where typesetting and number crunching cohabitate is to keep R files separate from latex and as little polluted by markdown as possible and only in ...
0
votes
0answers
34 views

table created by sapply used in Rmarkdown is being printed into .tex file when I knit (! TeX capacity exceeded, sorry [main memory size=3000000].)

Excuse the lack of understanding of pdflatex and tex, I'm new here and I'm not even sure this is the place for this question... I've been knitting an rmarkdown file (.rmd) to .pdf using Rstudio and I ...
7
votes
1answer
365 views

colour R code to match knitr theme using listings, minted, or other

with the listings package, and the help of this answer and this answer, I can include R code in my LaTeX document that looks almost like what knitr produces natively. However, as I am combining a ...
0
votes
1answer
73 views

Decreasing the size of a plot

Hi there so I have this plot in knitr in R, which i want to transfer to my Latex PDF file, but it's just way too big it fills up like 3/4 of a page: compPlot ( mdata$GDP, fitted( cesNewton), xlab = "...
1
vote
1answer
62 views

Using knitr and Latex problem

So I am currently doing a CES function estimation using the micEconCES package in R. I want to incorporate the outputs of the estimation into my latex file, but I cant seem to get it to work. This is ...
0
votes
1answer
207 views

Including multiple images with single caption

I'm trying to insert side-by-side images with one caption using knitr: --- title: "XY" author: "Doogan" date: '`r format(Sys.Date(), "%B %d, %Y")`' graphics: yes output: pdf_document: toc: no ...
0
votes
1answer
381 views

Make all fonts in beamer presentation larger

I'm working in R and knitting my output into a beamer presentation (The script below can be copied into an R script). My titles are naturally larger than the main text. However, I would like ...
0
votes
0answers
78 views

Incredibly slow compilation with knitr and tikzDevice

I am having some compilation difficulties when using knitr and tikzDevice. Compilataion works, but I am seeing times upwards of 10 minutes, and this is only increasing as my document grows (I am ...
1
vote
2answers
192 views

Using LuaLaTeX and knitr together

I would like to include R results in a LuaLaTeX document, which I prefer over XeLaTeX mainly because of the greater support of the package microtype. Do you know whether and how is it possible? ...
2
votes
1answer
203 views

Excessive blank space after a graphic using R and kntir

The problem is the following: I want to have the text from section 6 way closer to the graphics. This is the code I am using: \documentclass{article} \usepackage{graphicx} \usepackage{microtype} \...
0
votes
0answers
178 views

Setting font size in tikzDevice

I'm having difficulty changing the font size in figures generated by tikzDevice in knitr \LaTeX documents. I have read this, this, and this, but when I try setting dev.args=list(pointsize=10), no ...
0
votes
0answers
35 views

knit2pdf with Chinese character only in Chunk garbled

I use knitr to convert my .Rnw file into PDF for a while and it has never disappointed me. But something really weird happened recently after I had changed to a new computer. I've been working on a ...
0
votes
0answers
22 views

attachfile using knitr/Rsweave

I am trying to compile a latex pdf document in Rsweave using knitr. I would like to attach a link to an embedded pdf file, or an embedded word document. I tried using \attachfile but got an error: ...
0
votes
1answer
50 views

PassOptionsToPackage and knitr child documents

I am using Knitr and the standalone version of .RNW files where I can compile either a main document or work with and compile child documents individually. Because of other packages, I would like to ...
2
votes
1answer
272 views

debugging LaTeX errors in R - viewing dependencies

I've installed MacTex and I'm trying to format tables in a PDF with the kable function using knitr/Rmarkdown. When I output my data as kable(dt, format = 'latex') it works fine, but as soon as I try ...
3
votes
1answer
172 views

Can’t yet set up knitr with TeXShop

I want to use knitr with TeXShop. So far I can’t get knitr and TeXShop to talk. I’m not sure how to make a reproducible example nor how to make the following succinct, but here’s what I’ve tried: ...
2
votes
0answers
109 views

Proper ERT LaTeX Code in LyX Math-mode

The problem I am having is I cannot have full "monospaced font" ERT code in LyX math-mode. In the picture below, you can see that in math-mode there is no red box and the argument in the curly ...
0
votes
0answers
18 views

knitr conditional syntax to select image to include [duplicate]

I am creating a document using knitr. I want to compare two values and display one of two images depending on whether the first value is greater than the second or vice versa. Here is my test data ...
1
vote
1answer
1k views

How to center a multiline equation? [duplicate]

I want to center multi row equationing but all my attemts won't work. I'm working with pandoc/knitr of Rmarkdown. I show you an example: \begin{equation} \begin{aligned} <!-- \begin{center} --> ...
0
votes
0answers
146 views

Tufte-style beamer presentations in Rmarkdown?

I'd love to make "beamer presentations" Tufte-style in Rmarkdown. There I can put in the YAML header either output: beamer_presentation or output: tufte::tufte_html: default tufte::...
1
vote
2answers
351 views

Compiling a Latex-Sweave child into a main Latex-Sweave file

I'm in the process of writing my thesis, where I have two chapters ready. I'm looking to unify those two chapters into one single Sweave file. Suppose I have a folder called chapter1 which contains ...
1
vote
1answer
500 views

Rmarkdown - fig.cap will not add caption in figure

I want to add a caption to a figure in Rmarkdown, and it won't let me. The header of the file looks like this --- title: "..." author: "..." date: '...' output: pdf_document: fig_caption: ...
5
votes
2answers
386 views

pandoc, markdown: create self-contained .bib file from cited references

In Latex there are a variety of tools that can be used to create a self-contained .bib file for the cited references that are extracted from several larger .bib files; see this popular tex....
0
votes
0answers
194 views

Creating latex table from R dataframe with multicolumn rows using Tables package

I have a dataframe that is created dynamically in R that looks like this: I would like to create a latex table where the broad macrogroup category spans multiple columns and habitat and acres are ...
0
votes
0answers
29 views

Using R plot in Latex output - not finding saved .png [duplicate]

I am trying to create a plot in R and use knitr and latex to print that plot to a pdf. I think I am taking the correct steps: 1. save plot as .png in same folder as .tex file 2. write this into the ...
0
votes
1answer
39 views

Why does position of my picture change in PDF output with same code?

I have a block of code where I am just trying to left justify a few headings and right justify a picture: \documentclass{article} \usepackage{graphicx} \usepackage{geometry} \geometry{letterpaper, ...
0
votes
0answers
100 views

knitr umlaut problem in tex-editors

While the following code works fine in the R-console, it produces strange output of the german umlaute when compiled with a tex-editor (I checked texworks, texstudio, texshop). Take away the \Sexpr() ...
1
vote
1answer
110 views

Flipping headers on even and odd pages with fandyhdr doesn't work

When using the fancyhdr package in Rmarkdown the header does not flip as code would expect. I have always author on the left and page number on the right. What's wrong? This is my Rmarkdown file: ---...
0
votes
2answers
88 views

Can't copy certain characters (inverted commas) from pdf

I am using knitr to compile an rnw document containing both R and latex code, though it seems to also be a problem with the verbatim environment in general. The pdf looks fine, but when I try to copy ...
1
vote
1answer
265 views

R code and Sweave output - EDIT

UPDATED Question 1 In the lattest update of KnitR the output is clean as what I expected. Maybe an update was made. The new output : Before update I'm trying to get a particular output with Sweave ...
1
vote
1answer
529 views

Require vertical centering for Header 1 in R Markdown : \vspace , \bigskip and \newline are ignored

First question on tex.stackexchange after lurking a while, apologies if my form is poor, comments to improve it are welcome. I am converting a RMarkdown report to LaTeX using knitr in RStudio with a ...
1
vote
0answers
73 views

Request: LaTeX packages supported by knitr+RStudio [closed]

Question: Is there a list anywhere of R packages which work with knitr+RStudio? (Note: I already changed RStudio's defaults to use xeLaTeX and knitr instead of PDFLaTeX and Sweave, since my default ...
3
votes
1answer
295 views

Table spacing issue converting to PDF via LaTeX with pandoc

In the application of Rmarkdown I often found my answers concerning “LaTeX” and “pandoc” here at TeX Stackexchange. For that reason I want to repeat here my question I asked at stackoverflow hoping to ...
1
vote
1answer
287 views

Controlling space between lines of knitr output

I have prepared a Rtex document for processing by knitr. Is it possible to have the LaTeX output from knitr single spaced while the remainder of the LaTeX document is double spaced? If so, what ...
0
votes
0answers
397 views

APA references in Knitr with RStudio

My first question for Stack Exchange. While my ignorance is deep, my gratitude for the help I have found for my learning R and LaTex is much greater. I have found similar questions on Stack Exchange ...