Questions tagged [knitr]
knitr is an R package for dynamic report generation based on the concept of literate programming.
371
questions
1
vote
1
answer
75
views
Inconsistent Page Numbering Behavior in LaTeX Across Versions
I am experiencing an issue with page numbering when compiling an Rnw file using different versions of LaTeX. Here's a summary of the problem:
Older LaTeX Version (MiKTeX-pdfTeX 2.9.6499):
First page: ...
2
votes
1
answer
40
views
Set global options for all R code chunks and plots throughout LaTeX document
Making a couple of R plots in my LaTeX document on Overleaf. Every R plot is being placed inside of a figure environment:
\begin{figure}[h]
\centering
<<>>=
curve(dnorm(x))
@
\caption{...
0
votes
5
answers
290
views
How to include result values in a LaTeX document?
We are often in the following situation: a lengthy (data analysis) computation spits out a bunch of result values. Imagine a Python or script or an R script doing some resource intensive calculations.
...
1
vote
2
answers
243
views
TinyTex from RStudio Rmarkdown knitting to pdf. "Approximately" sign in ggplot annotate throws error
Reproducible example:
require(ggplot2)
myggplot <- ggplot(data.frame(x=1:2, y=1:2), aes(x=x,y=y)) + geom_point()
z <- 16.9
myggplot <- myggplot + annotate(geom="text", x= 1.5, ...
2
votes
1
answer
65
views
How to use Sweave (knitr) with LuaLaTex?
This is a duplicate of this 5 year old question, because the answers there don't work (for me).
Has someone managed to get knitr for Sweave documents (not RMarkdown) running with LuaLaTex as an engine?...
0
votes
0
answers
130
views
Add greek letter in column header kable and add %-sign in rowname
I had some questions when making a table using kable in Rmarkdown. My output has to be a pdf document, so my header is the following:
output:
pdf_document:
latex_engine: xelatex
...
0
votes
0
answers
44
views
Wrong output format while running knitr script in TeXworks
I wanted to use knitr with my TeXworks install and am noticing a weird issue. I followed the tutorial as described by Yihui here which worked fine. Now suppose my filename is untitled-12.tex and it ...
1
vote
1
answer
40
views
Signature image and date on same line hfill not working and wrapping into new line
I am trying to prefill the signature and date on a document as follows. Everything looks right, except the date wraps into new line instead of sitting on the same line as the signature image.
What am ...
1
vote
1
answer
142
views
knitr - function that works both in \Sexpr and in code-chunks
I try to learn knitr.
knitr lets you nest snippets of "inline-code" written in the language R between \Sexpr{...}.
knitr lets you nest "code-chunks" written in the language R ...
1
vote
0
answers
621
views
How to use Latex with knitr on online editor
I am having troubles with R code. I want to write my bachelor's thesis and I do it in R.
Since I am using R, I use knitr package & format and I also use Overleaf as editor + .tex (LaTeX) code, not ...
0
votes
1
answer
417
views
R - Escaping a character from the BEST package for tikzDevice
I try to modify some plot output from the R BEST package with the help of the package tikzDevice. However, apparently tikzDevice can not proceed due to a parameter with a percent sign ("% HDI&...
0
votes
2
answers
558
views
Error in the code after loading a library in an R code
I have been writing a code in RStudio and using TinyTex to compile my pdf. I wrote the following code in an RSweave file in RStudio:
\documentclass[12 pt]{article}
\usepackage[utf8]{inputenc}
\...
0
votes
1
answer
688
views
How can I mark a portion of R code to be bold in Latex output?
Rmarkdown YAML
output:
pdf_document:
latex_engine: xelatex
classoption: x11names
documentclass: article
header-includes:
- \PassOptionsToPackage{x11names}{xcolor}
- \usepackage{eso-pic,...
0
votes
1
answer
69
views
How do I adjust these texts dynamically depending on length of name?
The following code
\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage[absolute,overlay]{textpos}
\usepackage{fontspec}
\setmainfont{Segoe UI Symbol}
\usepackage[top=2cm, bottom=2cm, ...
1
vote
0
answers
22
views
How do I assign these variables from Rmarkdown? [duplicate]
I have variables that are going to be dynamic in this document. How do I assign theme from Rmarkdown.
Below is how my .tex file looks like
So for example $District_Name$ is a dynamic variable.
I want ...