TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed "ProTeX" with "TeXstudio 2.3" & "Miktex 2.9". I get an error

! The fontspec package requires either XeTeX or LuaTeX to function

when I attempt to run


Hello world! 

MikTeX is said to come with some of this installed.

share|improve this question

You have to reconfig TeXstudio to use lualatex or xelatex instead of pdflatex which is preconfigured in TeXstudio. You can change it under options, then commands.

You can also use the command line to test whether for example lualatex is running. lualatex test will compile test.tex with lualatex.

share|improve this answer
'comands' reads "latex -src -interaction=nonstopmode %.tex". How should it then read? – Optionparty Sep 14 '12 at 8:42
If you are pressing F6 in running your pdflatex, replace pdflatex in pdflatex -synctex=1 -interaction=nonstopmode %.tex with either lualatex or xelatex. – hpesoj626 Sep 14 '12 at 9:24
@hpesoj626: Thanks for answering; I wasn't online till now. – Kurt Sep 14 '12 at 12:15
Oh, I hope you don't mind. I think the comment was harmless enough. :) – hpesoj626 Sep 14 '12 at 12:50
Thank you for answering. I'm going to learn fast, with everyones help in this forum. – Optionparty Sep 18 '12 at 6:45

If you insist on TeXStudio you may now download TeXStudio 2.4. You can now set up your xelatex and lualatex commands with this version.

I am using Ubuntu 12.04 but TeXStudio 2.4 must have the same features as the Windows version.

See in the picture below that there is already a separate box your xelatex and lualatex commands.

enter image description here

Now, in the build option, choose your default compiler. You may now choose either xelatex or lualatex. See picture below.

enter image description here

If you don't want to update just yet, you may look at my comment in Kurt's answer.

But it is a hassle to keep on changing your default compiler. Some times it is better to just open cmd and run xelatex myfile.tex or lualatex myfile.tex. Just CD to your source folder before doing the compile.

share|improve this answer
I downloaded 2.4. I works great. I love the software improvements. – Optionparty Sep 18 '12 at 6:36
I'm glad it helped. – hpesoj626 Sep 18 '12 at 6:52

You should compile the document with xelatex or lualatex command. For me, your document compiles with both with no errors.

share|improve this answer
I am an old pre-CP/M nerd. I don't use command line stuff if I can help it. Thanks for your answering my cry for help. – Optionparty Sep 18 '12 at 6:42

Also in the MiKTeX Settings (Options window) under the “Formats” tab one must activate the creation of format files (needed for fonts!) for lualatex, luatex, xelatex and xetex:

window screenshot

Select every single of them, click on ‘Change…’ and in the dialogue window “Format Definition” deactivate ‘Exclude this format when updating all format files’.

Then, very important, go to the “General” tab and update all format files, what creates also the new ones, followed by a refresh of the filename data base (FNDB).

share|improve this answer
I have done the above plus exclude Latex, Pdflatex, "Update Formats", and have the same error. – Optionparty Sep 14 '12 at 8:23
@Optionparty: My answer is an addition to the others. You didn’t say anything to them. But also important: I’ve forgotten a second step, see my edit. – Speravir Sep 14 '12 at 15:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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