Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7687489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:42:54+00:00 2026-05-31T19:42:54+00:00

I have a Sweave file, JMP.Rnw that inputs several other files in the same

  • 0

I have a Sweave file, JMP.Rnw that inputs several other files in the same directory. The relevant excerpt from JMP.Rnw (pulling in the introduction section) is:

\SweaveInput{intro.tex} 

And yet when I run Sweave from the command line, I get an error message that intro.tex cannot be found.

> Sweave("JMP.Rnw")
Error in SweaveReadFile(c(ifile, file), syntax, encoding = encoding) : 
 no Sweave file with name ‘./intro.tex ’ found
> 

However, the file is definitely there:

$ find . -name intro.tex
./intro.tex
$ 

This input does seem to work for other input files, but I cannot detect a pattern that would explain why some can be imported and others cannot. There does seem to be a number of issues with Sweave and file encoding (see Sweave doesn't seem to get .Rnw file encoding right), but that doesn’t seem to be the problem here—all files are encoded in us-ascii:

$ file -bi JMP.Rnw
text/x-tex; charset=us-ascii
$ file -bi intro.tex
text/x-tex; charset=us-ascii
$ 

The really strange thing is that I have a separate Sweave paper setup and simply moving intro.tex to that directory and adding a \SweaveInput{intro.tex} to that master file works perfectly (i.e., builds without any issue). This other paper is using a different LaTeX template, but this would seem irrelevant since my understanding is that Sweave is basically ignoring all of this until all the code blocks are identified and executed (though my understanding here could be very wrong).

I’m running R version 2.14.2 on a x86_64-pc-linux-gnu (64-bit) machine.

Update: Investigating the answer from https://stackoverflow.com/users/210673/aaron , I found that in my alternate paper where \SweaveInput{} does work, the error message generated when I try to call a non-existent file does not contain an extra space, i.e.,

> Sweave("allocating_visibility.Rnw")
Error in SweaveReadFile(c(ifile, file), syntax, encoding = encoding) : 
 no Sweave file with name ‘./nothere.Rnw’ found
> 

Now, I have no idea why this trailing whitespace thing is happening on one place but not another, but this does seem like the mostly likely cause of the problem.

Update II: So I think this turned out to be an encoding issue after all. When I originally created my master .Rnw file, I pasted in some text that was utf-8 encoded. I converted the file back to ascii using http://billposer.org/Software/uni2ascii.html, and still got the white space error when I ran Sweave. However, when I deleted the original \SweaveInput{} line and retyped it, the problem disappeared (i.e., it builds correctly and the extra space in the error message is gone).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:42:55+00:00Added an answer on May 31, 2026 at 7:42 pm

    I think you might have \SweaveInput{intro.tex }
    instead of \SweaveInput{intro.tex}
    as your error message has an extra space in it before the ending quote.

    To debug, you could also edit the SweaveReadFile command in the utils package to have it output the name of the files it’s looking for, like this.

    SweaveReadFileNew <- function(file, syntax, encoding = "") {
      message(gettextf("looking for Sweave file with name %s", sQuote(file[1L])), domain = NA)
      SweaveReadFileOrig(file, syntax, encoding)
    }
    SweaveReadFileOrig <- utils:::SweaveReadFile
    assignInNamespace("SweaveReadFile", SweaveReadFileNew, ns="utils")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a LaTeX manuscript that inputs from a single Sweave file. The file
I have a big Sweave file with a variable called specialty near the top.
I have a function that sets a vector to a string, copies a Sweave
I want to have a sweave document that will include a variable number of
Say I have a .Rnw file containing the usual LaTex mixed in with R
I have a problem with the width of the output from echo within sweave,
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the
I have a rather large chunk of code that breaks sometimes, as far as
I'm trying to incorporate some plots from R in my LaTeX document through Sweave.
EDIT: Thx to suggestions from the mailing list I realized that the problem I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.