2

I tried for hours to use vimtex to compile a document that require XeLaTeX. As the vimtex documentation say, the first line of my tex document is %! TEX program = xelatex. However, I always get the following error:

/usr/local/texlive/2015/texmf-dist/tex/latex/fontspec/fontspec.sty|43 error| Fatal fontspec error: "cannot-use-pdftex"

So it look like pdflatex is still used. Thank in advance to anyone that can help me. Note that building a document that only require pdflatex work perfectly, and that the document I try to build with xelatex is just a hello world using a class that need xelatex and that compile with xelatex file.txt command in a terminal.

  • can you try with: %!TEX TS-program = xelatex and %!TEX encoding = UTF-8 Unicode on two first lines? – koleygr Sep 19 '17 at 23:10
  • 1
    I know you "tried for hours", but have you actually put the line in the document and restarted vim afterwards? This is what I did wrong. – red_trumpet Sep 21 '17 at 9:56
0

The exclamation point is in the wrong place. It should be this: % !TEX program = xelatex with the exclamation point right before the TEX. Then write the file, reload vimtex with <leader>lx, and recompile and see if that works.

New contributor
QdotThlayli is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • It work as well like I wrote it. All I had to do was restarting Vim. – Nakrule 38 mins ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.