Questions tagged [sweave]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
46 views

texlive error: File `Sweave.sty' not found. \begin

I work with texlive and R, but when I compile the .tex file I received this error File `Sweave.sty' not found. \begin and I found this answer but its for miktex users and I have texlive
user avatar
0 votes
0 answers
45 views

Unhappy Sweave engine in Texshop

I am working on setting up a new M1 Silicon Monterey OS Mac and my handy-dandy Sweave engine that I like to add to Texshop does not work. I have a Sweave.engine file in my Engines folder with the ...
user avatar
0 votes
0 answers
99 views

Problem Solved - Multiple issues with Sweave and Knitr

Here is the Github link of the files and a short description of the issues: https://github.com/Euniceisnice/What-is-wrong-with-my-Tex-and-Sweave I have never managed to compile my Rnw file with Knitr. ...
user avatar
0 votes
0 answers
36 views

Highlighting R Syntax in .Rnw file

I'm trying to write my lecture slides using beamer (knitr/sweave). However, when I'm adding the R syntax, the most I can do is boxing it, but I want to have my syntax highlighted. Something that is ...
user avatar
0 votes
0 answers
24 views

Sweave Missing endcsname Error in Huxtable While Generating PDF

I am running into an issue in the process of generating PDFs through R/Sweave/tinytex on a CentOS server. Here is the command that runs the process: (generateReport.R) Sweave(rnwFile, encoding = "...
user avatar
0 votes
1 answer
32 views

R - sweave - count words

I could not find a clear solution, so I would like to ask if there is some tool to count words (excluding R - latex code) in a .Rnw file. Thank you!
user avatar
  • 1
1 vote
1 answer
29 views

R sweave - stop tables from floating

Please excuse my naive question: I am using R studio sweave with xelatex and tinytex I run this chunk to produce a table, but it is automatically printed on the last page, adding a huge blank space ...
user avatar
  • 31
0 votes
0 answers
33 views

Installing "listings" in mac for R sweave

I am trying to install the package "listings" so I can show python code on LaTeX, with R sweave. I found the folder /Library and the only thing LaTeX related I found there is a folder called ...
user avatar
0 votes
1 answer
689 views

LaTeX Error: File `suffix.sty` not found

I would like my R Sweave file to run smoothly in Rstudio. I have tried to compile the following: \documentclass[a4paper,12pt]{article} \usepackage{amsmath,natbib} %\usepackage[utf8]{inputenc} \...
user avatar
  • 1
0 votes
0 answers
39 views

How to set the same length between paragraphs when there is a verbatim box?

What I want is to have 1em of distance between the paragraph and the verbatim box and 1em after the verbatim box and the next paragraph. I am using Rstudio with Knitr and PDFLatex. This is what I have ...
user avatar
1 vote
1 answer
2k views

R Sweave does not compile to PDF

I have installed MikTex and Rstudio to use R sweave. I wrote the most basic code on R sweave. I have used it on another Windows laptop but while using it on another windows laptop in the exact same ...
user avatar
  • 23
1 vote
1 answer
459 views

Including images in an R code chunk of R sweave using for loop

I am new to sweave and Latex. I am basically using an if-else loop which should display some specific image (taken from the laptop) if certain condition is satisfied. When I run this loop in R, the ...
user avatar
  • 23
1 vote
0 answers
115 views

Sweave compiles empty table of contents

I have a .tex document which I want to compile using Sweave. I provide its and the .cls file's contents below. Everything works fine, except for the fact that the table of contents is empty. I am ...
user avatar
2 votes
1 answer
61 views

Knitr: storing variables for later use

I'm relatively new to Knitr. I want to run a function just once, so that next time I don't have to evaluate it, because it would yield a different result. My MWE: First time: \documentclass{article} \...
user avatar
  • 21
0 votes
1 answer
150 views

latex - includegraphic with variables in the name

I'm no pro when it comes to latex and I'm working on something that's already been a bit established. I have a batch that produces multiple pdfs with a latex/sweave template. I'm attempted to insert a ...
user avatar
  • 101
1 vote
1 answer
84 views

How to prevent of removing spaces from string by Sexpr?

Here is a string variable. a <- 'This is a sample sentence' If I want to print in inline text mode for PDF, I can write it this way: $\Sexpr{a}$ But, I am getting the output like this way: ...
user avatar
0 votes
1 answer
398 views

Need to Customize Appendix Formatting - both in TOC and Text

I am using a document class template that is specific to my university's dissertation formatting requirements (the utexastheses.cls). It was made by a student a few years ago, and the university does ...
user avatar
1 vote
1 answer
128 views

Spaces in data.frame in R Sweave

I'm making a table in R Sweave using a data frame, but I don't know how to create spaces between the titles, they come out is separated by points. Is there a command that solves this? with the ...
user avatar
  • 13
0 votes
0 answers
222 views

Issue with fig=TRUE in Sweave RStudio

I do not receive plots using the fig=TRUE in the chunks. Rather i receive an 'undefined control sequence' error. Consider a simple code \documentclass{article} \usepackage{graphicx} \begin{document} ...
user avatar
  • 1
1 vote
1 answer
337 views

How to avoid the extension files when I compile pdf on r sweave

I face a problem when I compile pdf file I got many files in the working directory, for example, the files Untitled.tex and Untitled.toc along which my files Untitled.pdf and Untitled.Rnw. Can anyone ...
user avatar
2 votes
1 answer
148 views

Class tufte-book and R listings code box width problem

When I run the following MWE: \documentclass{tufte-book} \usepackage{Sweavel} \usepackage{amsthm} \usepackage{mathtools} \usepackage{soul} %%%%%%%%%% % R example %%%%%%%%%% \newtheoremstyle{rex}{}{...
user avatar
  • 279
6 votes
1 answer
3k 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) ...
user avatar
0 votes
1 answer
282 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 ...
user avatar
  • 218
3 votes
1 answer
146 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 ...
user avatar
  • 455
2 votes
1 answer
936 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$...
user avatar
  • 255
1 vote
1 answer
89 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, ...
user avatar
  • 41
1 vote
0 answers
123 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} \...
user avatar
  • 123
0 votes
1 answer
594 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? ...
user avatar
  • 123
1 vote
0 answers
46 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....
user avatar
  • 31
1 vote
1 answer
139 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 ....
user avatar
  • 31
1 vote
1 answer
1k 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=...
user avatar
  • 73
1 vote
2 answers
648 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 ...
user avatar
  • 111
2 votes
1 answer
2k 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} \...
user avatar
0 votes
1 answer
165 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 ...
user avatar
1 vote
0 answers
166 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(...
user avatar
  • 41
0 votes
1 answer
3k 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. ...
user avatar
  • 41
3 votes
0 answers
587 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 ...
user avatar
  • 629
0 votes
1 answer
353 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} \...
user avatar
  • 165
2 votes
2 answers
1k 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 ...
user avatar
0 votes
0 answers
102 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} \...
user avatar
  • 165
1 vote
1 answer
1k 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 ...
user avatar
1 vote
0 answers
439 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 ...
user avatar
  • 11
1 vote
1 answer
1k 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: <<...
user avatar
1 vote
0 answers
640 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 ...
user avatar
  • 133
1 vote
0 answers
92 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} \...
user avatar
4 votes
1 answer
1k 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 ...
user avatar
3 votes
1 answer
5k 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{...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
  • 11
2 votes
1 answer
412 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 ...
user avatar
  • 1,150
0 votes
2 answers
972 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 ...
user avatar
  • 8,083

1
2 3 4 5