Stack Exchange Network

Stack Exchange network consists of 175 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 [sweave]

Sweave is a function in the statistical programming language R that enables integration of R code into LaTeX or LyX documents.

4
votes
1answer
76 views

How to insert references and bibliography into a .Rnw file produce with RStudio R Sweave and knitr?

So far, I have successfully used RStudio and R Markdown to write scientific papers and insert citations from the medical literature without significant problem as shown in the minimal example (MWE) ...
0
votes
0answers
59 views

Overfull hbox within an R output

I'm using Sweave to work with R in a LaTeX document and when I compile my script I get the following badbox, as showed in the log file: Overfull \hbox (14.62822pt too wide) in paragraph at lines 127--...
0
votes
1answer
33 views

How to use if-else statements in sweave documents

Is there a way to use an if-else statement in an sweave document, so that a figure is only shown depending on the value of an R object. I tried different approaches (two of them are below), but I did ...
2
votes
1answer
70 views

Compiling a .tex file into many pdf without include?

I would like to have a single .tex file, with a main section and an appendix. I would want however to compile it into two distinct pdfs. There are solutions using \include, see How to create ...
2
votes
1answer
94 views

Caption in Sweave after an R plot

I have the following R chunk: <<echo=FALSE>>= par(mfrow=c(3,1)) #cas basal: no negra no fumadora sense prematurs ni hipertensi? lwt.pred<-seq(80,250,1) prob.pred<-0+model.final$...
0
votes
1answer
27 views

Sweave child rnw losing formatting

I have managed to get a master.rnw include a child.rnw, however, I can maintain the formatting of the child document based on the preamble in the master. Master.Rnw \documentclass[11pt,a4paper, ...
1
vote
0answers
25 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
1answer
106 views

Bibliography output in RStudio with multiple references

From this link I was able to replicate the references result. https://texblog.org/2013/08/20/rknitr-automatic-bibliography-generation-with-biblatex-in-rstudio/ How can I add more than one output? ...
1
vote
0answers
34 views

Sweave barplot label alignment [closed]

when I compile a horizontal barplot in sweave, I get inconsistent justification for long labels (not right justified). However, when I export the barplot with RStudio, the labels are correctly aligned....
0
votes
1answer
57 views

Sweave outputing ascii unicode

i have a file .Rnw with non unicode characters in utf8. When I compile with Sweave(file, encoding="UTF-8"), the .tex output has the unicode characters in the form <U+00F3>. How can I get the ....
1
vote
1answer
266 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=...
1
vote
2answers
173 views

Passing a string into Sweave Rnw file

I understand from this question that it's possible to push a variable to an Rnw file from the R script that calls it by storing that variable in the global environment within the R script. I've tried ...
2
votes
1answer
533 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
1answer
72 views

Marginfigures, environments and scrlayer-notecolumn

I am writing an article in Sweave (knitr), which is a translator from the statistical language R to TeX. Whenever I produce a figure in Sweave it returns something like the following code for a ...
1
vote
0answers
75 views

passing string from R to href in rnw file

I would like to pass a string from R script in order to run href in my rnw file. In the R script I have to include double \\ for the href otherwise I get error. ifelse(is.na(url_ui_1)|is.null(...
0
votes
1answer
2k views

Looping through data frame and adding each value in column to PDF

Please bare with me as im UBBER new to creating pdfs in R Studio. My R code grabs a bunch of files from an ftp site and for each of these files I loop through and create a pdf...all this works great. ...
3
votes
0answers
184 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
1answer
84 views

How to make several minipages with images be on one page

Consider the following code \noindent Some text here \begin{minipage}[t]{0.49\textwidth} \hspace{-30pt} \includegraphics[width=300pt]{img1} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \...
1
vote
2answers
511 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 ...
0
votes
0answers
39 views

Hiding minipage if it contains not existing image

Consider a sequence of something like the following \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=200pt]{figs/fig_12345_1.pdf} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \...
1
vote
1answer
420 views

R code and Sweave output - EDIT

UPDATED Question 1 In the lattest update of KnitR the output is clean as what I expected. Maybe an update was made. The new output : Before update I'm trying to get a particular output with Sweave ...
1
vote
0answers
148 views

R Sweave: print very large dataframe sample which spans on multiple pages inside a floating environment

I'm using R Sweave to output an R document into a LaTeX file through R Studio on a Windows 7. I have a very large data frame from which I have to put a sample at the begin of my document. I use xtable ...
0
votes
1answer
354 views

Trying to get rid of the included chunk in sweave document.

I just translated the mosaic manuals and I'm giving format to them. I'm using this chunk for all the packages, but it's still printing me the whole chunk at the first page of the book: <<...
1
vote
0answers
257 views

Can't compile a PDF with UTF-8 in Sweave [duplicate]

I try to compile in Sweave (R Studio) a PDF which contains cyrillic characters. The PDF-file looks nice, and the cyrillic characters display correctly. But when I try to copy some text from the PDF to ...
1
vote
0answers
79 views

Incorporating R code in problem sheets of probsoln

While working with the probsoln package, how can I include R code in problem sheets? My main document is \documentclass{article} \usepackage{probsoln, verbatim} \PSNrandseed{200} \begin{document} \...
4
votes
1answer
304 views

Can't set singlespacing for code chunks only

I'm just going to put the question inside an example .Rnw code block. It's easiest to see the problem when this is compiled into a .pdf file. I'm using pdfLaTeX and knitr to compile the file from ...
3
votes
1answer
2k views

Putting a user defined Latex environment into R markdown or knitr

I am getting an error when I try to include a user defined environment in my R markdown document. I have at the top: header_includes: - \usepackage{amsmath} - \usepackage{amssymb} - \usepackage{...
-1
votes
1answer
464 views

Dynamic word count for abstract environment in LaTeX using Knitr/Sweave/Rstudio

I am attempting to use TeXcount to count the number of words in my abstract environment and print it out, so that when I update the abstract it prints the new word count. I did my best to search the ...
2
votes
1answer
227 views

Modify the layout of a Table-1 filled with data from R

I want to fill automaticly data from R into a table for a TeX-document. Sweave and Knitr are possibilities here. Please feel free to add more. (I know Sweave and Knitr are R package but the focus of ...
0
votes
2answers
352 views

R Sweave not interpreted correctly due to writing style?

This case won't get correctly interpreted. I doubt it must be to do something with my writing style but I cannot notice what it is. You can run it with R CMD Sweave Test.Rnw; pdflatex Test.tex ...
-1
votes
0answers
60 views

Change name of caption from Table1

I am making three tables, in separate documents. And when I use \caption in the first document, the title becomes Table 1: etc... When I go into the next Sweave document in R and want to produce a ...
2
votes
3answers
123 views

How to create a horizontal space of a desired length when creating a Table

I am new to LaTeX. Started yesterday. I've been working with R and am doing so now but found that it is possible to produce very nice tables with LaTeX.I have been searching and found some code that I ...
1
vote
0answers
386 views

what does “Error running C:/Users/user/AppData/Local/Programs/MIKTEX~1.9/miktex/bin/pdflatex.exe (exit code 1)” mean?

I am trying to run this code in Rsweave \documentclass[a4paper,12pt]{report} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \rhead{\...
1
vote
1answer
178 views

Sweave breaking on escape characters? [closed]

I'm attempting to build out a pdf using texworks and sweave. I can get an output just fine except for a certain chunk of code and I can't tell why. Here's an example of it working: \documentclass[...
2
votes
1answer
6k views

includegraphics scale not working

Im trying to change the size of the picture with "scale" but is not working \documentclass{report} \usepackage{graphicx} \usepackage[left=1.5cm,top=1cm,right=1.5cm,bottom=1cm]{geometry} \begin{...
1
vote
0answers
112 views

Prevent .tex file from opening automatically when working on .Rnw in TeXStudio

I'm working with a Sweave (.Rnw) file in TeXStudio (2.11.0). I have set up custom build commands to knit the Sweave file to LaTeX, with the idea to work on the .Rnw file exclusively. My problem is ...
1
vote
0answers
136 views

Fontspec, Sweave and MacTeX 2016: Font shape undefined

When I compile the following MWE with xelatex, compilation goes fine but I get this warning message: Font shape T1/TimesNewRoman(0)/m/n undefined(Font) using T1/cmr/m/n instead. The problem appeared ...
0
votes
2answers
676 views

how to make a graphic bigger

I've made the following syntax: \begin{figure}[ht] \caption{xxx } \centering <<echo=FALSE,fig=TRUE >>= load("//d049nt01/estudios$/Indicadores de Liquidacion/Tablas de prueba/pago_agg.rda"...
2
votes
0answers
2k views

Sweave error running pdflatex.exe (exit code 1) [closed]

I'm new to sweave, and I keep getting errors. I'm trying to run the following file: \documentclass[a4paper]{article} \begin{document} \SweaveOpts{concordance=TRUE} Hello world! \end{document} ...
2
votes
1answer
97 views

Knitr/Sweave Format Code Output w/ Leading Characters

Using knitr/sweave, I need to format the R code output that gets echoed, according to editorial journal requirements. For example, the following chunk <<example,echo=TRUE>>= library(plyr)...
3
votes
1answer
163 views

No increment of a variable in a Sweave code chunk which is wrapped by a \whiledo loop

I already searched in different forums but until now I couldn’t find a solution. So I hope that you can help me… Like mentioned in the title there is no increment of my variable x in the code chunk ...
1
vote
0answers
60 views

RNW, different sections depending on the value of a variable. Possible? [closed]

I am new to RNW files, and I am not sure if the following is possible. Suppose that I have the following RNW file: \documentclass[12pt,a4paper]{article} \usepackage{Sweave} \usepackage{amsmath} ...
3
votes
2answers
3k views

Tables with reference to R objects in sweave / latex

I'm using knitr/R-sweave to produce a pdf-document wit LaTeX-code. I want to make a table with some numbers produced by some R calculations in the R-code-chuck above this table. When I usually want to ...
1
vote
0answers
531 views

general footnotes in xtable

I am using sweave to create pdf. Using xtable, I am trying to insert a general footnotes under the table (i.e: This symbol means bla bla bla). I've tried a lot of things and everything get me an error ...
2
votes
1answer
188 views

Set TeXstudio for Unicode .Rnw files (Sweave)

I tried to run Sweave on a .Rnw file from TeXstudio, but the unicode characters don't show up in the .tex file when I typeset with xelatex. My user command is /usr/local/bin/Rscript -e "Sweave('%.Rnw'...
1
vote
0answers
50 views

Special Roman/Japanese Encoding with RStudio Sweave

Is there a way for having multiple enconding support in RStudio Sweave? I have the following citation, and using different encodings like uft8 or cjk just results in errors. Reference METI. (...
1
vote
1answer
531 views

Including TikZ picture in Sweave gets me an overfull box error

I have some difficulties in R Sweave so I hope someone could help me. I want to include two TikZ pictures using minipage and figure to the R Sweave but I get an error: Overfull \hbox (2.43085pt too ...
0
votes
1answer
118 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
1answer
2k views

Sweave R code chunk default colors in vignette

Typically, if I create a .Rnw file and add R code chunks to it, and then convert it to .pdf file, the R code text will have default color and font than the rest of the document text. An example ...
2
votes
1answer
203 views

Conditional evaluation of Sweave chunk

I'm using some R code to import and manipulate a time series. The code takes some minutes to run and, as a result, it generates a relatively small time series. Now, to prevent typesetting to take an ...