-
Notifications
You must be signed in to change notification settings - Fork 407
magic comment '%! TeX program = *' only work for *.tex #2326
Description
Description
Set latexmk and vimtex's default tex program to xelatex, then use %! TeX program = lualatex to look which tex program vimtex will use for latexmk. For main.tex, vimtex will use lualatex, it's right. But for other file which extension is not tex, such as dtx or tikz, it still use xelatex.
Steps to reproduce
This is a simple tex file:
%! TeX program = lualatex
\documentclass[tikz]{standalone}
\usepackage{iftex}
\begin{document}
\ifluatex
1
\else
0
\fi
\end{document}this is a simple latexmkrc:
$show_time = 1;
$dependents_phony = 1;
$do_cd = 1;
$preview_continuous_mode = 1;
push @default_files, '*.ins', '*.dtx';
push @default_files, '*.tikz';
$pdf_mode = 5;
$xelatex = 'xelatex -shell-escape -8bit -file-line-error -no-pdf -synctex=1 %O %S';
and in vimtex config:
let g:vimtex_compiler_latexmk = {
\ 'options' : [
\ '-verbose',
\ '-synctex=1',
\ '-interaction=nonstopmode',
\ '-shell-escape',
\ '-8bit',
\ ],
\ }
let g:vimtex_compiler_latexmk_engines = {
\ '_': '-xelatex',
\ }
pdf_mode = 5 means we use xelatex to generate dvi and convert dvi to pdf by xdvipdfmx.
When the tex file named main.tex, vimtex:
System info:
OS: Arch Linux
Vim version: NVIM v0.6.1
Has clientserver: true
Servername: /tmp/nvimTwypKA/0
VimTeX project: main
base: main.tex
root: /dev/shm
tex: /dev/shm/main.tex
main parser: current file
document class: standalone
packages: epstopdf-base graphics graphicx ifluatex iftex infwarerr ltxcmds luatex85 pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys shellesc tikz trig xcolor xkeyval
compiler: latexmk
engine: -lualatex
options:
-verbose
-synctex=1
-interaction=nonstopmode
-shell-escape
-8bit
callback: 1
continuous: 1
executable: latexmk
viewer: Zathura
xwin id: 0
qf method: LaTeX logfile
It is right.
However, when the file is main.dtx or main.tikz:
System info:
OS: Arch Linux
Vim version: NVIM v0.6.1
Has clientserver: true
Servername: /tmp/nvimBgTwle/0
VimTeX project: main
base: main.dtx
root: /dev/shm
tex:
main parser: current file
document class:
packages: epstopdf-base graphics graphicx ifluatex iftex infwarerr ltxcmds luatex85 pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys shellesc tikz trig xcolor xkeyval
compiler: latexmk
engine: -xelatex
options:
-verbose
-synctex=1
-interaction=nonstopmode
-shell-escape
-8bit
callback: 1
continuous: 1
executable: latexmk
viewer: Zathura
xwin id: 0
qf method: LaTeX logfile
It use xelatex, and will output a pdf which content is 0 not 1.
Expected behavior
I think whatever the file's name is main.dtx or main.tikz or main.ins or other name, the tex program always be lualatex.
Actual behavior
only main.tex can work.
Do you use a latexmkrc file?
Yes
VimtexInfo
vimtexinfo has been attached above.