Closed aaannestad closed 1 month ago
(I didn't intend to open this as a bug - it's probably some config issue on my end - but now that it is a bug I see no way to change it)
I'm trying to compile a file that uses the
fontspec
package, which requires xelatex or lualatex to run. My latexmkrc is set up to trigger that:$latex = 'lualatex %O %S';
and indeed, the file compiles perfectly well if I run
latexmk file.tex
from the terminal …
Yes. latexmk
by default will use the latex
option here, and you changed that to run lualatex
.
However:
(I didn't intend to open this as a bug - it's probably some config issue on my end - but now that it is a bug I see no way to change it)
Correct. The problem is that it is not the correct way to specify by .latexmkrc
to use lualatex
. Instead, you should do this:
# This specifies to use lualatex
$pdf_mode = 4;
# This is typically also useful (and will be used both for latex, xelatex,
# pdflatex and lualatex)
set_tex_cmds('-synctex=1 -interaction=nonstopmode --shell-escape %O %S');
You can find details in the latexmk manual.
Notice that VimTeX will recognize the pdf_mode
setting from your .latexmkrc
file.
Thank you! That was remarkably difficult information to find just by googling.
Heh, yes; it's much easier if you already know it. ;)
The main things to know here is how latexmk
works and how VimTeX is running it. Still, it's easy to see how this is hard-to-build knowledge.
Description
I'm trying to compile a file that uses the
fontspec
package, which requires xelatex or lualatex to run. My latexmkrc is set up to trigger that:and indeed, the file compiles perfectly well if I run
latexmk file.tex
from the terminal (though it throws an error about creating a pdf when it expected a dvi file that I can't seem to do anything about). But running\ll
in vimtex results in the compiler giving an error, and complaining thatfontspec
must be run with xelatex or lualatex - clearly indicating that whatever vimtex is doing to calllatexmk
is causing it to miss or ignore my latexmkrc.To be clear, I'm trying to set this up in my latexmkrc file rather than just doing like
latexmk -lualatex
or whatever because I never want to compile with anything other than lualatex or xelatex (which is mostly interchangeable for me), whether that's inside or outside of vim. As far as I'm concerned, engines other than lualatex and xelatex may as well not exist.Steps to reproduce
Create an MWE like the following:
Ensure that
~/.config/latexmk/latexmkrc
contains the above$latex = ...
lineOpen your MWE and do
\ll
Expected behavior
Vimtex calls
latexmk
, which in turn callslualatex
, which compiles the file normally.Actual behavior
Vimtex calls
latexmk
in some way that does not in turn cause it to calllualatex
, meaning you get a fatal error whenfontspec
checks to make sure you're using the right engine.Do you use a latexmkrc file?
Yes
VimtexInfo