# How to use Calibri and other font options with TexStudio

I need to compile a file in 14pt, Calibri font, but I also need many math and editing packages. I get an error message when trying to compile in either xelatex

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". For immediate help type H <return>.


or lualatex (over 200 error messages, of which the main are:)

fontspec error: "font-not-found" The font "Calibri" cannot be found. For immediate help type H <return>. \setmainfont{Calibri}


The following appears by a citation

Font \EU2/Calibri(0)/m/n/7=Calibri:mode=node;+tlig;+trep; at 7pt not loadable: metric data not found or bad.


The following using roman in math mode

\textfont0 is undefined (character 69).


Similarly with italics, bold, calligraphic fonts.

I cannot solve it (I have already changed the compiler, in spite of the computer not seeing it). It may just be that the Calibri font is not where the compiler can find it (in which case, please, help me do this in Mac), or they may be conflict with some package, in which case, can you see which?

The main features of my code are:



\usepackage[super]{natbib} %for superscripts in bibliography

\usepackage{extsizes}

\usepackage[top=10mm,bottom=13mm,left=10mm,right=10mm]{geometry}

\usepackage{eurosym}
\usepackage{lastpage}
\usepackage{tabularx}
\usepackage{amssymb}
\usepackage{mwe}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{graphicx}
\usepackage{enumitem} %To customize enumerate
\usepackage{kantlipsum} %idem

%\setlist[enumerate]{nosep,itemindent=.75cm}

\usepackage{fontspec}
\setmainfont{Calibri}

\usepackage{soul}%command \ul, manages line breaking unlike underline

\usepackage{setspace}

\usepackage{lipsum}

\usepackage{multicol}

\usepackage{multirow}

\usepackage{array}
\usepackage{color}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{rotating}

\usepackage{caption}

\usepackage{hyperref}
\usepackage{blindtext}
\usepackage{nameref}

%%%%%%%%%%%%%For diagrams

\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{positioning}

\tikzset{
state/.style={
rectangle,
rounded corners,
draw=black, very thick,
minimum height=2em,
inner sep=2pt,
text centered,
},
}

\title{Title}
\author{Author}

\begin{document}

\maketitle
\section{First section}
Blablabla
\subsection{a}
Blablabla
\subsection{b}
Blablabla\cite{1}
\section{Second section}
Blablablabla\cite{2}
\begin{thebibliography}{unsrt}
\bibitem{1} First ref.

\bibitem{2} Second ref.
\end{document}

• as the error says 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". For immediate help type H <return>. you need to use xelatex not pdftex, also the later errors refering to EU2 font encoding mean that you are using an old distribution (any version of fontspec since about 2015 would use TU not EU2. – David Carlisle Oct 4 at 16:36
• Note that Calibri font is only licenced on Windows, it is not available on a Mac (unless you bought it) There may be clones available but they will have other names. carlito from the chromeos distribution is probably available (and uses the same metrics as calibri) – David Carlisle Oct 4 at 16:39
• Unrelated to your main issue: you no longer need eurosym. Either Calibri or Carlito contains the symbol. (Even in 8-bit legacy mode, any font from this century should support it through textcomp.) – Davislor Oct 4 at 20:12
• @David Carliste: regarding your first comment, as I said in my tex, I DO use xelatex or lualatex, but the computer ignores this. About the distribution, I will update, thanks! Thanks also for the carlito tip, I had no idea! But I get the same errors <fontspec error: "font-not-found" The font "carlito" cannot be found. For immediate help type H <return>. \setmainfont{carlito}>. – Ana Oct 5 at 7:15
• computers never ignore things. If you get that error then you are using pdflatex not xetex. Carlito is freely available but that does not mean you have it – David Carlisle Oct 5 at 7:22

Carlito

Calibri

On a Mac you will want to use Carlito font:

\documentclass[a4paper]{article}

\usepackage{fontspec}
\setmainfont{Carlito}
%\setmainfont{Calibri} %only on Windows

\begin{document}

The Calibri font is only available on Windows but Carlito is a drop-in replacement from  Google that has the same metrics.

\end{document}

• What would be an appropriate math font to be used together with Carlito? – Sigur Oct 18 at 23:42