Take the 2-minute tour ×

I have a master file master.tex containing the preamble and which inputs (via \input{chapter01}, \input{chapter02}, ...) chapters. The chapters are .Rnw files. My goal is to use patchDVI::SweavePDF to compile the chapters (say, chapter.Rnw) individually (each chapter starts with sourcing Sweave preliminary settings but [of course] does not have a preamble). When I execute

Rscript -e "patchDVI::SweavePDF('chapter.Rnw')

I obtain

Error: ‘chapter.Rnw’ is not ASCII and does not declare an encoding

Normally one uses \usepackage[utf8]{inputenc} to solve this problem. However, I can't put this into chapter.Rnw since it is only allowed in the preamble, so in master.tex. But there it has no effect. The question is how to solve this.

I found this but I couldn't figure out how to adjust it to make it work with patchDVI::SweavePDF.

share|improve this question
add comment

Your Answer



Browse other questions tagged or ask your own question.