Using Texmaker 5.0.3, MikTeX 2.9 & Windows 7 x64,

I am currently trying to write a document using \includepackage{fontspec}. This has required me to switch from pdflatex to xelatex. Quick Build is set to XeTeX + Show PDF.

Everytime I compile, despite choosing the XeLaTeX option, it throws me a

Fatal Fontspec Error: "cannot-use-pdftex"

Error, pretty much exactly as in this question.

After fiddling for a bit, I then realized: It works. It's using XeLaTeX and compiling without error...but then it still throws me the above error and a log output which implies it's using PDFLateX, which really confuses me.

In addition, the built-in pdf viewer does not show the resulting *.pdf file (which was the main reason it took me so long to realized that it did, in fact, compile). Manually opening the resulting pdf, however, shows that any changes applied to the source did in fact make it through.

Does anyone know what might cause this and how to fix it? Mostly, it's annoying because it overrides any log output the XeTeX compilation might throw out and because it prevents the updated PDF from automatically showing up.

  • if you get that error then you are using pdflatex not xelatex. Jan 2, 2020 at 16:54
  • Except it's successfully compiling using the fontenc package, which it shouldn't be able to using pdflatex, should it?
    – Suthek
    Jan 2, 2020 at 17:39
  • Maybe the quick build is somehow configured to run both XeLaTeX and pdfLaTeX, and the first run succeeds and incorporates the changes, and the second run fails? I don't use Texmaker, but apparently from the Options-Configure Texmaker menu you can check what the quick build actually does.
    – Marijn
    Jan 2, 2020 at 21:17
  • Are you dealing with fontenc (message above) or fontenc (error message given in your question? Two very different animals. Jan 2, 2020 at 21:23
  • See tex.stackexchange.com/a/522715 for some screenshots on configuring Quick Build, in case it is relevant.
    – Marijn
    Jan 2, 2020 at 22:00

1 Answer 1


Making a user made quick build, as the post from Marjin's comment recommended did solve the issue.

I'm still not sure why selecting XeLaTeX + PDF Viewer manually works, while the premade XeLaTeX + View PDF option does not, but as long as it works, that's fine I guess.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .