Closed Freed-Wu closed 2 years ago
It seem to be related to the code judge the self.tex:
let l:ext = fnamemodify(a:main, ':e')
let l:new.tex = l:ext ==# 'tex' ? a:main : ''
If the file's ext is not tex, self.tex will be ''. And magic comment will not be used. Why not get extensions from latexmk's @default_files
? Or just simply provide a variable named g:vimtex_extension_list?
index 0ea336d3..1163ec54 100644
--- a/autoload/vimtex/state/class.vim
+++ b/autoload/vimtex/state/class.vim
@@ -18,7 +18,7 @@ function! vimtex#state#class#new(main, main_parser, preserve_root) abort " {{{1
endif
let l:ext = fnamemodify(a:main, ':e')
- let l:new.tex = l:ext ==# 'tex' ? a:main : ''
+ let l:new.tex = a:main
" Get preamble for some state parsing
let l:preamble = !empty(l:new.tex)
This can solve this problem.
Thanks! I agree that the suggested code should be relaxed. I want to avoid options, so I'll relax to allow .dtx
and .tikz
as well for now, which should resolve your issue.
.ins
is also tex file extension. According to document of docstrip and doc, compile .ins
to get package.sty
, document.cls
, example.tex
, etc, and compile .dtx
to get a document pdf about this macro package. I advice to add .ins
.
I also suppose avoiding options (too many options maybe confuse user). However, I am not sure about .dtx
, .ins
, ... are all tex file extensions. If any new extensions are found (it seldom happen), we should add them.
Ok :)
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. Formain.tex
, vimtex will uselualatex
, it's right. But for other file which extension is nottex
, such asdtx
ortikz
, it still use xelatex.Steps to reproduce
This is a simple tex file:
this is a simple latexmkrc:
and in vimtex config:
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:It is right.
However, when the file is
main.dtx
ormain.tikz
: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
ormain.tikz
ormain.ins
or other name, the tex program always belualatex
.Actual behavior
only
main.tex
can work.Do you use a latexmkrc file?
Yes
VimtexInfo