27
votes
Export tables from R to LaTeX
Welcome! Look at ?print.xtable. This works
print(xtable(newobject2, type = "latex"), file = "filename2.tex")
24
votes
Literate R Programming
0. tl;dr
knitr is preferable to Sweave, and ezknitr is a wrapper around knitr that is probably worth using—especially if you are only building documents from the command line (but this limits you to R ...
22
votes
Accepted
How do I indent text within a tabular environment?
You could insert an \hspace{<some length>} directive at the start of cells. In the example below, I've set the length to 3mm; you're obviously free to choose a different length.
\documentclass{...
20
votes
Accepted
Insert R code in Latex
I'm not going to find every possible case of how R studio styles code. But maybe this will get you started.
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{listings}
\lstset{...
19
votes
Accepted
align, aligned and R Markdown
So, just to be clear (as it says this is unanswered), just write the align (without $$):
\begin{align}
a_1 &= \beta_0 \\
b_1 &= \beta_1 \\
c_1 &= \beta_2 \\
d_1 &= \beta_3
\end{align}
...
18
votes
Literate R Programming
The baseline approach is just to keep them separate. My work flow on a recent paper was as follows:
I wrote an R script to calculate the statistics and generate (a) charts and (b) tables of numbers. ...
16
votes
How to include LaTeX package in R Markdown?
As of rmarkdown version 1.4 it has been possible to use the extra_dependencies parameter to list a character vector of LaTeX packages. This is useful if you need to load multiple packages:
---
title: ...
16
votes
Using LaTeX font in R (Computer Modern)
This is how I did it in Windows:
Install the extrafont package.
Install Latin Modern fonts, e.g. from http://www.fontsquirrel.com/fonts/latin-modern-roman. Watch out, you need to install the TTF ...
14
votes
Accepted
New R Logo with Tikz
The best thing is to export everything from Inkscape but here I've just exported the R letter and placed it over the ellipses via the old logo colors. You might need to adjust it properly I'm just ...
12
votes
12
votes
Accepted
How to draw a function like sin(x)~cos(x) in tikz/pgfplots?
It is also easy with pgfplots
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[domain=0:360,samples=101,no marks] ...
12
votes
Accepted
Using biblatex with R Markdown
One rule of LaTeX is that it is a bad idea to load packages twice and that it is an error to load the same package twice with different options.
This is what happens here. You load biblatex manually ...
11
votes
Trying to include R Code with listings package
I have no sufficient reputation to comment, so I will point out that you need to include
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0....
11
votes
How do I indent text within a tabular environment?
A slight improvement for the alignment of the left column (on the endash):
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\noindent
\begin{tabular}{@{}rccc@{}}
\toprule
\multicolumn{...
11
votes
Accepted
What are the key advantages of TeX over R Markdown?
As you know, a R markdown file can produce several formats but make a PDF is done via LaTeX exportation with pandocas David pointed, so in this case is equivalent to write what RStudio call a R Sweave ...
9
votes
Accepted
How to incorporate a TEXMF tree managed by distro's package manager when using TeX Live from upstream on a GNU/Linux system?
I think the best way to achieve this is the following:
Add a line TEXMFDISTRO = /usr/share/texmf to /usr/local/texlive/2015/texmf.cnf, creating it if it is not present.
Copy the definition of TEXMF ...
9
votes
Accepted
How can I use Context and R together?
In short, yes, using the filter module. In fact, the filter module has a specific example for using R. I'm not sure about Sweave, but the integration doesn't seem to be quite as tight as something ...
8
votes
Workflow for converting LaTeX into Open Office / MS Word Format
Another unlisted solution is the full version of Adobe Acrobat.
I tried the majority of the solutions listed here, which all failed pretty miserably.
Adobe successfully converted nearly everything ...
8
votes
Accepted
Encrypt and decrypt parts of text in a LaTeX source file
Updated answer
This is Enigma.
Notice that Enigma is symmetric. Thus you can encode and decode at the same place. In the following example, the first input AN ENIGMA MACHINE... comes from the ...
8
votes
Accepted
Help with long table from Stargazer
A table enviroment cannot be broken across pages. Delete \begin{table}\centering and \end{table}, replace tabular with longtable, move \caption and label to immediately after \begin{longtable}{..}. ...
8
votes
Accepted
Can TinyTeX replace MiKTeX or TeX Live
Yes (according to the documentation)
TinyTeX can be used in place of other TeX distributions because it is essentially TeX Live.
But
Depending on the files you compile in TeXStudio and LyX, as ...
7
votes
Howto: Set up knitr (*.Rnw compilation) from in TexStudio
Posting this is an answer which is similar to above because this will work for mac and (probably) on other linux based systems.
I use OS X El Capitan (mac), and the approach is kind of same. After ...
7
votes
Workflow for converting LaTeX into Open Office / MS Word Format
If all else fails (it did for me), Word 2016 can open pdfs directly. It does a decent job of converting them (I was surprised!), although equations are often converted into images.
7
votes
Encrypt and decrypt parts of text in a LaTeX source file
This is not an issue related to LaTeX. You simply ask, how to encrypt parts (!) of an ASCII file.
Some editors are able to do this. As an example, orgmode, a major mode of Emacs, provides encryption ...
7
votes
Accepted
Using LaTeX font in R (Computer Modern)
The selected solution.
It seems to be imposible to do without installing an external library. I tried using extrafont, but then my default PDF Viewer did not have the font used.
I ended up using the ...
7
votes
Literate R Programming
Are there other approaches?
Yes, lazyWeave. While Sweave and knitr process LaTeX files with R chunks (R noweb files), lazyWeave can create LaTeX documents from scratch.
Beside this, it is worth to ...
7
votes
Accepted
2D correlation plot matrix with shapes
Here's a way to achieve this:
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis equal image, % ...
7
votes
Accepted
Left Quotation Marks when using RMarkdown and knitR
First of all, you need to be aware of this fact:
Markdown is not LaTeX.
So in general you should not expect LaTeX syntax to work in Markdown documents. The correct way to write quotes in Markdown ...
7
votes
Accepted
R Markdown/pandoc: Change how code blocks are converted to LaTeX
Thanks to @AlanMunn, I found at least 2 solutions that work for code chunks with undefined language. Both are pandoc-specific, and don't actually require rmarkdown (examples for both can be found here)...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
r × 585knitr × 156
sweave × 127
tables × 59
markdown × 48
rstudio × 41
tikz-pgf × 38
pdftex × 31
xtable × 29
listings × 26
beamer × 24
graphics × 21
tikzdevice × 18
pdf × 17
rmarkdown × 17
fonts × 16
errors × 13
pandoc × 13
code × 12
pgfplots × 11
lyx × 11
xetex × 10
plot × 10
texlive × 9
overleaf × 8