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
8 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
24 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
7 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
19 views

Overfull hbox problem with special characters

Alright, I constantly get the "overfull \hbox" error because I have three of these paragraphs with some words with special characters. I know I can set babel to Catalan but my teacher doesn't want it ...
0
votes
0answers
6 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? Thanks
1
vote
0answers
10 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
11 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
12 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
30 views

Read Access db with accented characters using knitr

I get the following error when using knitr to read an Access db: ! Package inputenc Error: Invalid UTF-8 byte sequence. the line in the tex file is: {\ttfamily\noindent\itshape\color{messagecolor}{\#\...
0
votes
0answers
45 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
59 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
59 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
33 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
150 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
64 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
125 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
134 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
471 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
94 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
104 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
835 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
157 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
767 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
118 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
173 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
242 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
44 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
422 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
91 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
84 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
303 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
491 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
88 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
240 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
320 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
204 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
38 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
25 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
63 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
347 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
212 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
126 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 ...
1
vote
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
419 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
597 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
428 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
223 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
33 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, ...