Post

2 followers Follow
0
Avatar

lualatex

Hi

I'm interested in using LuaLaTeX to compile Rnw files. If I understand correctly from http://www.rstudio.org/docs/authoring/latex_program I can add

% !TeX program = LuaLaTeX

to my .Rnw file and when I compile the file it should use the lualatex engine - is that right?

However, if I do this it continues to use pdflatex. The same is true if I try xelatex using the same method - it uses pdflatex.

Perhaps I'm missing something here?

Many thanks

David

Ian Pylvainen

5 comments

0
Avatar

David,

Thanks for asking and we don't actually fully support the LuaLaTeX engine right now. Currently, the only two commands that you can put directly in your file are either:

% !TeX program = XeLaTeX
or
% !TeX program = pdfLaTeX
(I'm not sure off-hand if capitalization is important)

You might be able to get things working with LuaLaTeX if you define the RSTUDIO_PDFLATEX environment variable (a little further in the documentation). However we do pass certain commands that may or may not work with LuaLaTeX.

Also I'm not sure why you couldn't get XeLaTeX working on a per file basis, but perhaps check the following:

1) Capitalization - try % !TeX program = XeLaTeX

2) Path - make sure that XeLaTeX is on your path. Execute the following:

> Sys.which("xelatex")
> Sys.getenv("PATH")

Josh

Ian Pylvainen 0 votes
Comment actions Permalink
0
Avatar

Ah, yes - I saw that on a second read. The % !TeX program = XeLaTeX bit needs to be on the first line so it might be worth mentioning that in the documentation (unless I missed it).

It is not clear to me how I would set the RSTUDIO_PDFLATEX environment variable (Windows BTW) - could you elaborate and then I can test to see if it works?

Many thanks

David

Ian Pylvainen 0 votes
Comment actions Permalink
0
Avatar

OK, I worked it out:

Sys.setenv(RSTUDIO_PDFLATEX = "LuaLaTeX")

Which all works fine. pdf produced, Synctex works,... in fact it works the same as pdflatex and xelatex. Perhaps this option could be added at some point?

Many thanks

David

Ian Pylvainen 0 votes
Comment actions Permalink
0
Avatar

David,

Okay great! Thanks for the additional note and letting us know. Also setting RSTUDIO_PDFLATEX this way will only last for this session (if you quit R it will reset). To make a more permanent change, you'll have to define this with a .Renviron or Renviron.site. See the following:

> ?.Renviron

Josh

Ian Pylvainen 0 votes
Comment actions Permalink
1
Avatar

It seems to work if I add the variable RSTUDIO_PDFLATEX  in the Windows environment variables  with the value LuaLaTeX

 

But it would be great if you add the option in the knitr (sweave) settings menu.

skan 1 vote
Comment actions Permalink