On Fri, Oct 19, 2012 at 5:11 AM, Jean-Marc Lasgouttes
<lasgout...@lyx.org> wrote:
> Le 18/10/2012 16:19, Scott Kostyshak a écrit :
>
>> The unchangedConverter.log is here (error):
>> http://paste.debian.net/201557/
>
>
> So the error happens on export to latex because the encoding is not
> specified.

The error happens when importing the Rnw in LyX, which from what I
understand currently calls the Rnw -> LaTeX (plain) converter and then
run tex2lyx.

> I think I do not understand what you do exactly. Does the same happen with
> Sweave (I do not have knitr here)?

Yes, the same happens with Sweave because the converter Sweave ->
LaTeX (plain) has a $$e and that string is set to empty because of the
following code:
command = subst(command, token_encoding, buffer ?
buffer->params().encoding().iconvName() : string());

> Could you send me an example file and a
> step by step description of what you actually do?

Yes. I've been using the example file that comes with LyX but I think
that the same error would occur with trying to import any .Rnw file
via Sweave or knitr.

1. Start a clean LyX instance from current master branch (although I
have the same problem in branch. I wonder if importing a .Rnw has
worked at some point?).
2. File > Open > Examples button > sweave.lyx
3. File > Export > Export As > [tempfolder]/sweaveexample.Rnw  (select
the Sweave (.Rnw) format)
4. Close the current document (the sweave.lyx file) just to make sure
that it's not involved with the import probem.
5. File > Import > Sweave... > [tempfolder]/sweaveexample.Rnw
6. At this point I get an error.

Here are steps to show that (1) it is indeed the Sweave -> LaTeX
(plain) converter that is being used and (2) that setting the $$e
variable improves things:
7. Close the error box from (6).
8. Go to Tools > Preferences > File Handling > Converters > select
Sweave -> LaTeX (plain) and in the Converter text box manually delete
"$$e" and insert in it's place "ISO-8859-15" so that the converter is
now:
Rscript --verbose --no-save --no-restore $$s/scripts/lyxsweave.R
$$p$$i $$p$$o ISO-8859-15 $$r
9. Click the Modify button.
10. Click the Save button.
11. Repeat step (5).
12. The .Rnw is now partly imported. There will be other problems in
the import process which I think are due to tex2lyx, but these
problems are different from the Rnw -> tex problem I am reporting
here.

Is the solution to modify lyxsweave.R and lyxknitr.R so that if they
are not passed an encoding they should just not change the encoding
from the default R one? This would be easy to do.

Thanks,

Scott

Reply via email to