Hi there I am using texstudio version 2.12.6. I tried compiling a document (CV) but it keeps repeating the fatal error : "cannot-use-pdftex" The fontspec package requires either XeTeX or LuaTeX to function. You must change your typesetting engine to, e.g., "xelatex" or "lualatex" instead of plain "latex" or "pdflatex". For immediate help type H . I tried to configured the default compiler from pdflatex to xelatex but it will not just work. It keeps returning to pdflatex when I go back to check. Any help will be appreciated.

  • your question is just about the editor you are using, but you have not said which editor that is. On the command line, calling latex directly switching from pdflatex to xelatex simply means typing xelatex file instead of pdflatex file. Jan 25, 2018 at 22:07

1 Answer 1


You can either go to the Tools -> Commands menu and choose xelatex, like this:

enter image description here

Or, change the default compiler, go to the Options -> Configure TeXstudio, choose the Build icon and change the default in the editing window:

enter image description here

  • It wouldn't still work. The error provided is as stated below. Undefined control sequence. \begin{document} Missing number, treated as zero. \begin{document} Font \fb=''[cmr10]'' not loadable: metric data not found or bad. XLTXTRA IS TO BE USED ONLY UNDER XETEX. LOAD FONTSPEC DIRECTLY, INSTEAD. Jan 25, 2018 at 21:41
  • Did you click on OK after you've changed the default compiler?
    – Bernard
    Jan 25, 2018 at 21:47
  • Yes I did that. Jan 25, 2018 at 21:53
  • Which distribution do you have, on which system?
    – Bernard
    Jan 25, 2018 at 21:55

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.