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
0answers
17 views

Overfull hbox within an R output

I'm using Sweave to work with R in a LaTeX document and when I compile my script I get the following badbox, as showed in the log file: Overfull \hbox (14.62822pt too wide) in paragraph at lines 127--...
0
votes
2answers
65 views

Overfull hbox in a section title

Every now and then I get this error and I don't know how to solve it. From what I understand reading other posts, it's because LaTeX doesn't know how to hyphenate some sentences and finds no good way ...
-1
votes
0answers
14 views

KnitR document is still printing code chunks that have been removed

I have a class paper that I've written in LaTeX with knitr code chunks which are mostly just pulling labeled chunks from an R script. I initially included every chunk from the script and then removed ...
0
votes
1answer
28 views

creating multiple generic letters from pulling info from an excel/csv file

I wanted to create 100 invitation letters for a group of 100 people whose name and phone number I have in an excel sheet. I have written one generic letter and wanted to the put in the name and phone ...
0
votes
0answers
15 views

Delete empty rows in RSweave with Kable package

This is my repoducible example: \documentclass{article} \usepackage{booktabs} \usepackage{longtable} \usepackage{array} \usepackage{multirow} \usepackage[table]{xcolor} \usepackage{wrapfig} \...
0
votes
0answers
23 views

Making knit output fit into the light blue space

I'm working with Knit and I'd like R commands and outputs to fit nicely into the light blue box. Is there any LaTeX function to do this? I'm adding a MWE of the same problem with a different case: \...
1
vote
0answers
14 views

Greeks Letter in RStudio + Sweave

This is my Rsweave reproducible code: \documentclass{article} \usepackage[a4paper,left=1.5cm,right=1.5cm,bottom=1cm,top=3cm]{geometry} \usepackage[perpage]{footmisc} \usepackage{csquotes} \...
1
vote
0answers
32 views

Problem with out of KableExtra tables with LATEX in Rstudio: paste0 function

This is my Rsweave reproducible example: \documentclass{article} \DeclareUnicodeCharacter{3B1}{$\alpha$} \DeclareUnicodeCharacter{3C4}{$\tau$} \DeclareUnicodeCharacter{3C3}{$\sigma$} \...
0
votes
0answers
70 views

Output table with KableExtra in Rmarkdown(RStudio): paste0 function

This is my Rsweave reproducible example: \documentclass{article} \DeclareUnicodeCharacter{B5}{$\alpha$} \DeclareUnicodeCharacter{B5}{$\tau$} \DeclareUnicodeCharacter{B5}{$\sigma$} \...
0
votes
0answers
50 views

Get path of (custom) auxiliary file when `-output-directory` flag is given to pdflatex

In short: Say the following is built using pdflatex -output-directory=tmp: \documentclass{article} \newwrite\fileHandle \immediate\openout\fileHandle=outfile.csv \immediate\write\fileHandle{hello ...
0
votes
1answer
133 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
85 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
55 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
261 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 ...
3
votes
1answer
75 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
181 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
163 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=...
2
votes
2answers
680 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
105 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
172 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
1k 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
178 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
1k 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
129 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
198 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
384 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
56 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
470 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
98 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
133 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
395 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
586 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 ...
1
vote
0answers
103 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
294 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
392 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
232 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
1answer
69 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
415 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
256 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: ...
3
votes
0answers
144 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
19 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 ...
2
votes
1answer
2k 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} --> ...
1
vote
2answers
443 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
713 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
518 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
244 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
34 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
125 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
155 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: ---...