# Tag Info

93

I think this is the easiest option! --- title: "Title" author: "Me" header-includes: - \usepackage{bbm} output: pdf_document --- (Edited to have three, instead of four, hyphens to open and close the YAML front-matter)

59

I implemented this for a large R&D lab. We produced several hundred (if not thousand) documents per year, and the LaTeX Users' community there wanted to be able to produce documents using 'tex as well as WYSIWYG software. The OP was right in that a well-defined workflow is essential. Part of this is the process, but you may also need to think about ...

55

Since you are generating the table from R, I'll assume that you are using R's xtable package to generate the table. This package has some deficiencies, but it is still quite usable. Here's a sample R session showing how to use the package. R-session data(tli) ## Demonstrate aov ## Taken from help(aov) in R 1.1.1 ## From Venables and Ripley (1997) p.210....

48

Following Yihui's advice, I found the best option to be to invoke the warning=F and message=F chunk options, like so: {r, message=F, warning=F} library(memisc)  This was using knitr ("Knit HTML") with RStudio to process R markdown.

35

As per this page on the R Markdown website, you can add whatever you want to the preamble via the in-header option in the YAML header; e.g., ---- title: "Titre" date: Fecha output: pdf_document: includes: in_header: mystyles.sty ---- In mystyles.sty, located in the same directory as the .Rmd, you could have a whole list of ...

34

The pgffor package allows for-loop style repetition using the following format: \foreach \<cmd> in {1,...,<total>} {% % stuff } Using this as base, the following is probably what you're after: \documentclass{beamer}% http://ctan.org/pkg/beamer \usepackage{graphicx}% http://ctan.org/pkg/graphicx \usepackage{pgffor}% http://ctan.org/pkg/pgffor ...

31

I ran into this issue, and after some time spent banging my head against a post, I did reach a solution. After installing the package, run the following steps from inconsolata README. Open a cmd and run: initexmf --update-fndb initexmf --edit-config-file updmap The latter command should open updmap.cfg in your default editor, commonly Notepad. Add the line ...

27

To illustrate the problem, here is the output from the following Sweave document: \documentclass[a4paper]{article} \usepackage{Sweave} \DefineVerbatimEnvironment{Sinput}{Verbatim} {xleftmargin=2em, frame=single} \DefineVerbatimEnvironment{Soutput}{Verbatim}{xleftmargin=2em, ...

27

Try adding fig_caption: yes to the YAML header of your .Rmd file. It will look something like this: --- title: "Untitled" author: "Nicholas" date: "20/09/2014" output: pdf_document: fig_caption: yes --- There's more information here: http://rmarkdown.rstudio.com/pdf_document_format.html

24

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 Markdown; see below); I don't think there are IDEs that have integrated ezknitr use (at least not at the time of writing)—because it makes it easier to ensure ...

23

The new version of Word (2013) lets you open and edit PDFs. The workflow is then: Use latex and pdflatex to make your PDF Open the PDF in Word 2013 Save as docx

23

How about using a chunk with <<results=tex, echo=FALSE>>=? It will allow you to: (a) paste together the LaTeX code you'd like to run (i.e. 200 \begin{frame} ... \includegraphics ... \end{frame} constructs); and (b) place that constructed text verbatim in the *.tex file produced by Sweave(). For more details, see here. It's a FAQ! <<...

23

\lstinputlisting{} should not be inside a \begin{lstlisting} and \end{lstlisting} pair. Remove the begin and end and it should work as expected.

22

With Sweave really you need only two steps for a simple document as this my_sweave_file.Rnw: \documentclass{article} \begin{document} Some text <<RTest>>= 2+2 @ \end{document} From the command line is enough: R CMD Sweave my_sweave_file.Rnw pdflatex my_sweave_file.tex Or even only one: R CMD Sweave --pdf my_sweave_file.Rnw In case that you ...

21

This isn't the answer to the original post, but I came here Googling for "Longtable misplaced noalign" so my eventual solution might be useful for someone. In my case I needed a \\ after the \caption and \label. This seems incredibly counterintuitive to me so if anyone can explain why or tell me where this is documented I'd be grateful. \documentclass{...

20

Here is an alternative approach using the latex function from Hmisc. On the one hand, it only does matrices and data frames; on the other hand, it natively knows about booktabs, is impressively tweakable either directly or via its subroutine format.df, and ships with the standard installation. Using the same npk.aov example as Alan Munn did, I can produce ...

19

I found a very easy solution for converting LaTeX-documents into editable Word-files. Compile your LaTeX-document to PDF Go to the Internet-page http://pdftoword.com/ Upload your PDF and wait until the Word-file arrives. I have only tested the site with text-files (no graphics or formulas), but it converted complex contract in Norwegian (æøå) to pretty ...

18

This post is rather lengthy. I will attempt to address both of your main questions. Sorry for the novel ... Question 1 The following example tries to plot the same thing three times: First without tikzDevice and then in two tikzDevice-ways. The tikzDevice-slides are not very nice looking, which I can improve by manipulating the widths and heights. But ...

17

Are you certain that the encoding should be ISO-8856-9? I've never heard of that one. Maybe you mean ISO-8859-6 (Arabic) or ISO-8859-9 (Turkish)? Let's assume that you meant ISO-8859-9. Then you just write \usepackage[latin1]{inputenc} in the beginning of your code, \inputencoding{latin5} just before you include the file and \inputencoding{latin1} to ...

17

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. The script produced charts either as eps (which I used with LaTeX) or as png (which were needed for the online version of the paper). The charts had long ...

16

I have solved it. The command I use in the user-defined commands for compiling and displaying a Rnw-file in my own pdf-viewer is : "C:/whateverYourPathToRonYourMachineIs/R-3.0.1/bin/Rscript.exe" -e "library(knitr); knit2pdf('%.Rnw')" | pdflatex -synctex=1 -interaction=nonstopmode %.tex | "C:/whateverYourPathToYourPDFViewerOnYourMachineIs/Foxit Reader.exe" "...

15

I found a better solution using the wallpaper package, replacing foo and bar produces the desired result. \documentclass{article} \usepackage{lipsum}% http://ctan.org/pkg/lipsum \usepackage{wallpaper} \begin{document} \ULCornerWallPaper{1}{foo} \LLCornerWallPaper{1}{bar} \lipsum[1-3] \end{document}

14

This error message is low-level TeX output which shows up if you are typesetting material in a font (external name "cmr12" in your example) and you are trying to typeset a glyph that is not in the font. The ? is not a real question mark it stands for a character that is unknown. When you are typesetting a word, say, "aha" then deep down this is all ...

14

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 approximating here. \documentclass[tikz]{standalone} \definecolor{rlogo}{RGB}{126,142,176} \begin{document} \begin{tikzpicture} \shade[even odd rule,shading ...

13

I think your best bet is to reshape the data before exporting. While it might be possible to join the data based on the Sample name in PGFPlots, that's going to get really tricky. In R, it's a one-liner, using cast from the reshape package write.table( cast(data, Region~Sample, value="Density"), "reshaped.csv", quote=F, sep=",", row.names=F) Then you get ...

13

knitr has a few pretty straightforward ways of handling this. Option 1: Using knit_child() with inline R code Say your setup is like the following. In the same directory, you have: graph.R ## ---- graph library(ggplot2) CarPlot <- ggplot() + stat_summary(data= mtcars, aes(x = factor(gear), y = mpg ...

13

(Upgraded from a comment.) Just use library("knitr"); knit("file.Rnw") in the console (where "file.Rnw" is the name of your Sweave file, of course). This will produce "file.tex" in the working directory.

13

If you look at your example, the table does not have a number. I assume you want to reference the table number, so first we must give the table a number. To do this, use the caption argument. Second, when using xtable, you have to be careful with which arguments you want to give to xtable and which arguments to print.xtable. You are currently passing the ...

Only top voted, non community-wiki answers of a minimum length are eligible