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

learn more… | top users | synonyms

4
votes
2answers
68 views

How to extract a series of text not in an environment, but with defined commands enclosing them

Under Windows 8, I am using R and the knitr package in RStudio with an .Rnw script. My regex skills are passable, but only in R. My document has about thirty pages with a different text section at ...
0
votes
0answers
17 views

XeLaTeX + knitr + Arial = error

When I compile the following: \documentclass{article} \usepackage{fontspec} \setmainfont{Arial} \begin{document} Hello. <<foo, dev='tikz'>>= library(ggplot2) qplot(1) @ \end{document} ...
1
vote
0answers
40 views

How to solve the error: No counter 'sectionpage' defined

I'm trying to use this answer from a previous question to get frame numbers in a table of content in a beamer presentation made in RStudio with R Markdown and knitr (see file below; in in_header.tex ...
0
votes
1answer
24 views

xtable: extend table to both columns

Using the xtable package, is it possible to give some option to xtable function to generate a tex file which will contain following: ``` \begin{table*} ... \end{table*} ```
1
vote
0answers
26 views

Where set font in tikzDevice-plots (.Rnw)

I'm trying to use sans serif fonts for the text in plots (ggplot2) made by R, within KOMA-book. Unfortunately I'm not very experienced in managing fonts and their families. To keep things consistent, ...
2
votes
1answer
42 views

Using Calibri with a Mac

I am preparing a document, writing it in RStudio and knitr in a Mac (OS X El Capitan 10.11.2). I would like to use Calibri (to mimic Office documents). I already have a legal version of Microsoft ...
2
votes
1answer
28 views

Insert line break into knitr fig.cap?

I am using knitr and want to insert a line break in my fig.cap chunk option. Is this possible? The following is all I can think of but it doesn't work. I expect there's some evaluation option but I ...
2
votes
0answers
36 views

What is the counterpart in LaTeX for the R package ezknitr and its tools for managing paths and directories

Dean Attali has just added an R package called ezknitr to CRAN. It enables those who use knitr and RMarkdown in .Rmd files to handle directories quite flexibly. His blog describes it well: path ...
2
votes
0answers
26 views

Formatting text the same way knitr formats code, but outside of chunks

Back when I was using sweave, I could make my inline code look like R code by using \texttt{whatever} or \verb@whatever@. I am trying out knitr, and the format of the code chunks sure is pretty. But ...
1
vote
0answers
110 views

Error 43 while knitting a markdown to pdf in a R project created on mac and run on Windows

I created a R project which outputs some plots to pdf using rmarkdown::render with an .Rmd file. I shared the folder when the R project and all the relative files are kept to a colleague using Google ...
0
votes
0answers
52 views

I can not install the framed package in R Markdown

Hi I am trying to install the framed package from LaTeX in RStudio because I get the Error when I am trying to use knitr. There are my LaTeX Error: File `framed.sty' not found. Type X to quit or ...
0
votes
0answers
23 views

vim-latex (and knitr) not compiling bibliography [duplicate]

I had to reinstall vim and the assorted plugins in windows, and now the compiler in latex-suite doesn't work any longer for bibliographies with natbib. A simple example I made is as follows: ref.bib ...
3
votes
2answers
57 views

With knitr and LaTex, how can you arrange the List of Figures alphabetically?

What code will enable me to reorganize the List of Figures alphabetically (and keep the page number)? My goal is to include that alphabetical listing of figures in the PDF file that is created. Here ...
0
votes
0answers
29 views

Can we use itemize specially nested itemize without itemize environment?

I am writing in Markdown a LaTeX doc. In this special environment I apply a R Code after every \item. It means I cannot use itemize environment! And I know that there is HTML possiblity like we ...
2
votes
0answers
35 views

Knitr Plot Tooltips for ADA Compliance

I would like to use Knitr to generate plots in R that have hover-over tooltips. Here is a working example without an R tooltip: \documentclass{article} \usepackage{pdfcomment} ...
3
votes
1answer
52 views

knitr code chunks in footnotes

My issue is to include verbatim output from knitr Sweave code chunks in footnotes. The BVerbatim environment (fancyvrb) gives me the formatting that I want. (NB: one needs to put \VerbatimFootnotes ...
0
votes
0answers
27 views

How can I have the Latex structure in knitr?

how can I have the same structure, I mean: \section, \subsection, ... in knitr or Markdown? Is there any possibility to include every section in a separate file like in latex? ...
2
votes
0answers
33 views

Extra Curly Braces when creating Xtable using Knitr, after specifiying size

I'm creating a R Markdown document using knitr and am running into trouble using xtable to create a table. My table is very large and I'm trying to reduce the size using the size command in the print ...
8
votes
2answers
157 views

Encrypt and decrypt parts of text in a LaTeX source file

Assume that you have some text in parts of your LaTeX document that you only want people with a password to see. A reason could e.g. be a case with an guiding answer. You want to make the case public ...
2
votes
0answers
25 views

Page margins in .Rtex

I'm using ShareLatex to write my thesis (which relies heavily on R) but the page size changes when I set my document to "main.Rtex" instead of "main.tex". I provide a minimal example so you can check ...
1
vote
1answer
72 views

Knitr markdown can't display basic symbols

I'm on Ubuntu 14.04, running RStudio Version 0.99.473. I have LaTeX installed (TeXworks) and knitting Rmarkdown documents works just fine. However, adding mathematical symbols such as $\mu$ causes it ...
0
votes
0answers
36 views

Knitr not available in LyX (Windows)

I installed LyX with MicTeX on my pc. I installed the Knitr module. So I see in the packages in R studio that I can add 'Knitr'. After that i added the path of R.home('bin') to the PATH in the ...
2
votes
2answers
116 views

Running R code from latex. (alternative to knitr)

If you want to export the output of an R script to latex and create a pdf document you can use the package Knitr with RStudio. But I guess this is only a good practise for short results. What if I ...
2
votes
1answer
308 views

Is it safe to reinstall MacTex after upgrading from Yosemite to El Capitan

I was using MacTex on OSX 10.10 (Yosemite). I upgraded to OSX 10.11 (El Capitan) and now I get the error "No TeX installation detected" trying to compile a latex document using knitr. I saw the ...
2
votes
1answer
137 views

knitr texmaker could not start the command

I have recently upgraded to El Capitan and I can't make knitr work with texmaker anymore. I have red all the issue concerning MacTex and the change in the path from /usr to /Library/Tex but here I ...
2
votes
1answer
408 views

knitr not working on LyX after installation of Mac OS X El Capitan

I updated my Mac to OS X El Capitan and knitr doesn't work on it. Before the update everything was fine. Now LyX is saying : "The module knitr requires a package that is not available in your LaTex ...
0
votes
0answers
94 views

How can I set formatting options for an .Rmd outputting to .pdf

I have a .rmd in r studio. This is being compiled by the r package knitr into a pdf via the pdfLaTeX engine. DISCLAIMER: I am very new to LaTeX, and have been searching for days without luck on how ...
0
votes
0answers
220 views

Encoding error when knitr -> LaTeX -> PDF

I have a document written in knitr. I can export it to HTML and docx, but not PDF for some reason. The Rmd file is here http://cl.ly/dJka?_ga=1.30252732.2076817589.1442770201 It says ! Package ...
0
votes
0answers
56 views

R to LaTeX with knitr and pandoc (error in a guide)

I want to follow the guide http://kieranhealy.org/blog/archives/2014/01/23/plain-text/ since my document http://rpubs.com/lindberg/110268 need to be pushed to latex for a better read. The tex says ...
3
votes
2answers
107 views

References and bibliography with knitr, ESS and AUCTEX

I'm trying to get references working in a knitr Rnw document using ESS, AUCTex, TeXLive, and natbib. Here is a minimal example: \documentclass{article} \usepackage{natbib} \begin{document} ...
1
vote
1answer
91 views

Using knitr with TeXworks

I checked out the conversation between Speravir and Yihui, and also Yihui's site and video for getting knitr to work with TeXworks. However, I am definitely not super tech-savvy and I'm having some ...
0
votes
0answers
133 views

Wrap text from xtable row names with knitr

I am using knitr to generate pdfs that contain tables that I'm making with xtable. How can I wrap the text in these tables? Here is my best effort so far: \documentclass{article} \begin{document} ...
0
votes
0answers
48 views

How to create tikz figures via knitr forcing labels featuring LaTeX's font size modifier-commands?

Is there a way to force knitr to create tikz code which includes font size information? The output would be something like this: \begin{tikzpicture}[every node/.style={font=\footnotesize}] Here is ...
2
votes
1answer
128 views

knitr - double spacing in an html document

If my knitr output was a pdf, then I can begin my document as follows to have the text double spaced: title: My Title author: "My Name" date: "Today's Date" header-includes: - ...
1
vote
0answers
87 views

ShareLatex knitr install package

Sharelatex comes with a few R library's that you can query. However, it is impossible for me to install a package or query a non pre-installed package. The package I am trying to use is the arm ...
0
votes
0answers
184 views

Longtable in a knitr (PDF) document: using xtable (or kable)

I am new to knitr and I have had some very basic latex knowledge in the past, so I googled already hoping to find a solution that was already posted somewhere. However, I was not able to solve my ...
2
votes
0answers
90 views

SOLVED - Knitr/pandoc bibliography problem

I would try to convert the way I write my scientific articles from Sweave/LaTeX to knitr/pandoc. I've been able to reproduce almost everithing with the exceptions of the references. I googled a lot ...
1
vote
1answer
74 views

knitr creating a wrong second “#” in a deep hyperlink

I would like to compile a .Rnw Document in RStudio with knitr that includes a "#" in the hyperlink (deeplink) of a float caption. See the minimum working example: (compiled with R Studio Version ...
1
vote
0answers
47 views

Display if the variable is NA / not-NA

I have a variable assigned as a output of a function, which returns numeric value or NA. The following code mimics it. <<>>= data <- sample(c(TRUE, FALSE), size = 1, replace = TRUE) @ ...
1
vote
1answer
67 views

Setting width of page

I would like to control the width of the document, i was able to set the margins more the the left (https://stuff.mit.edu/afs/sipb/project/www/latex/guide/node30.html) But that just moved the text to ...
0
votes
1answer
43 views

Print binary output in knitr

Just showing an example to represent my seemingly simple problem. i generate a variable with random TRUE/FALSE. <<>>= data <- sample(c(TRUE, FALSE), size = 1, replace = TRUE) @ ...
2
votes
1answer
59 views

Lyx / Knitr - R Code in chunck goes beyond set width

I use Lyx (2.1.4) with knitr (1.10.5). I have a lot of trouble having the code chunks respect the width that I tried setting through various ways: In the chunk options (width=50); ...
0
votes
1answer
66 views

knitr example doesn't produce graphics

I tried compiling the given MWE for testing knitr: %% LyX 2.1.3 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. ...
1
vote
1answer
40 views

How does knitr inject TeX code into the document?

I'm very new to knitr. How do I write R code in knitr that composes LaTeX from scratch and injects it into the document at a particular point? I'm thinking of something similar to what PHP or JSP ...
2
votes
1answer
302 views

Formatting R chunks when using knitr

How can I apply the same formatting with R chunks that I apply to regular listings? The following example shows a nicely formatting listing and an (IMHO) awful looking R chunk. I already loaded ...
1
vote
0answers
80 views

vim + knitr + synctex + file watch + sumatrapdf (on windows)

I'm trying to get a task runner watching a directory for changes and then run the following: knit Rnw file pdflatex the resulting tex file (with bibtex) open pdf viewer and have both forward/reverse ...
1
vote
1answer
215 views

Knitr pdf not working on Mac OS X error “! Missing $ inserted.”

I have the following chunk in rmarkdown {r } library(psych) a <- (matrix(c(1:1000), ncol=4)) f <- fa(a) But when I try to print inline the following output: `r f$null.chisq` I get the ...
1
vote
0answers
25 views

Using \adjustwidth seems to break with a figure caption in knitr

I need to adjust my margins so I can place two pictures side by side. This works when there is no caption on the picture but when I add a caption the margins revert back to how they were. ...
10
votes
2answers
558 views

Appending an empty row after every 5 or 10 rows in LaTeX table

I wonder how to append an empty row after every 5 or 10 rows in LaTeX table. Here is my MWE in .Rnw format. Any help will be highly appreciated. Thanks! \documentclass{article} ...
0
votes
0answers
66 views

Redefining the knitr code chunk delimeter in LaTeX to compile .Rnw files as .tex files

I am trying to define some LaTeX commands/environments to handle the raw text in an Rnw file (R + LaTeX document compiled with R package knitr). The goal is to allow someone to rename a .Rnw file to a ...