How can I use the Calibri font in LaTeX? I am using the following commands:
\usepackage{fontspec}
\setmainfont{Calibri}
I get the following error message:
! Fatal fontspec 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".
!
! See the fontspec documentation for further information.
Best Answer
As others have pointed out in comments, to use system fonts (or any local .otf or .ttf font) easily, you need to use the
fontspec
package and compile your document with eitherxelatex
orlualatex
.pdflatex
won't work, but switching toxelatex
orlualatex
shouldn't require any major change in your document other than converting toutf8
encoding and removing any\usepackage[...]{inputenc}
.FYI,
lualatex
is the official successor ofpdflatex
in LaTeX3, and I personally see very little reasons not to switch asap tolualatex
. If you want to read more on the differences, these links might provide you some more background:Now, if you really can't / do not want to switch to
xelatex
orlualatex
, and if you are really brave, you can stay withpdflatex
, convert your Calibri font to Type1 and make it available to TeX. The tedious process is explained here.