I downloaded a template for CV and one of the requirements was installation of fontspec.sty. Now when I compile the file the code file of fontspec.sty pops up in a new tab in TeXnicCenter and it points to errors in the file. Among which are

fatal fontspec error: "cannot use pdflatex"

It also shows that the .sty requires xetex or luatex to function which I have both installed. Please help.


fontspec doesn't work with PDFTeX (and thus pdflatex) indeed. It requires XeTeX or LuaTeX (in recent versions). If the template you are using makes use of fontspec, it means it wants to use system fonts (TTF/OTF/AAT). You will need to compile this document using XeTeX (xelatex) or LuaTeX (lualatex).

Note that using XeTeX or LuaTeX may not be sufficient to compile this example, as you will also need to have the font required for it. If you don't have it, you will get a "font-not-found" error, and you will have to find the TTF/OTF/AAT font and install it in your system (hopefully, it's a free font).

  • Thank you, Raph and Werner, quite useful. Indeed Raph, now I have a font-not-found error. Googled around but it would be really helpful if you could tell me how to find and install the TTF/OTF/AAT font, please. – Abhimanyu Arora Sep 29 '11 at 7:13
  • @AbhimanyuArora: I'd have to know which font that is first :-) The error message tells you the name of the font. – ℝaphink Sep 29 '11 at 7:43
  • :Thanks a million. The font problem is solved. Now, upon compiling all errors (12 in no.) I get in the output file say xelatex> ! Undefined control sequence. Any clue how to get around this? Salutes – Abhimanyu Arora Sep 29 '11 at 7:54
  • I think it's missing some info there. Can you open a new question with the full description of your error? – ℝaphink Sep 29 '11 at 8:00
  • @AbhimanyuArora: if this answered your question, please check the mark under the number. – ℝaphink Sep 29 '11 at 10:21

You are compiling your template using pdflatex, as is suggested by the error message. Instead, you need to compile it using either xetex (or xelatex) or luatex (or lualatex). You can do this from the command line by typing xetex file.tex (since you mention that xetex is installed), or by defining a new output profile under the Built menu Alt+7 and compiling file.tex using this newly-created profile from within TeXnicCenter.

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.