[Tex/LaTex] Error in fontspec.sty

errorsfontspecluatexxetex

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.

Best Answer

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).