[R] patchDVI: how to pass encoding of the .Rnw file?

Marius Hofert marius.hofert at math.ethz.ch
Fri Aug 24 14:47:09 CEST 2012


Dear Duncan,

many thanks for helping. It works fine.

Cheers,

Marius

Duncan Murdoch <murdoch.duncan at gmail.com> writes:

> On 12-08-19 3:47 PM, Marius Hofert wrote:
>> Dear Duncan,
>>
>> I recently asked a question concerning patchDVI on r-help, see
>>
>> ,----
>> | https://stat.ethz.ch/pipermail/r-help/2012-August/321780.html
>> `----
>>
>> Unfortunately, no one could help. I was wondering if you know a solution to the
>> above problem. Any hint is highly appreciated.
>
> Sorry, I'm writing this while offline, so I can't quote your message.
> The issue was that if the main .tex file uses \input to include another file,
> and that file needs to be processed by Sweave, then the usual encoding
> detection method (looking for \usepackage[utf8]{inputenc} or similar) won't
> work, because you can't put that line in the secondary file.
>
> The solution is the same as when using Sweave:  put a default encoding into
> the call to SweavePDF (or the similar functions).  For example, my editor
> always executes this command when asked to process a .Rnw file:
>
> patchDVI::SweavePDF('%2', stylepath=FALSE,
>     preview="f:/SumatraPDF/SumatraPDF \x25s",
>     encoding="utf8")
>
> The %2 is a place holder for the filename to process.  The preview argument
> invokes the PDF previewer that knows Synctex; the stylepath and encoding
> arguments are passed to Sweave.  Because I chose encoding="utf8", Sweave
> will assume that encoding as the default for files.  Another encoding  can be
> explicitly declared.
>
> When I have multi-file projects, I make use of .TexRoot and .SweaveFiles
> in each of the files so I can make the whole project each time;
> see the patchDVI vignette (section 6) for details of how they work.
>
> I think you also asked how to do this in Emacs; I've got no idea about that.
>
> Duncan Murdoch




More information about the R-help mailing list