I am getting the error shown in the title five times in a row at the beginning of the logs when trying to compile my document with XeLaTex through TexStudio (command used: xelatex -synctex=1 -interaction=nonstopmode %.tex).

I am compiling this document:

%%% demothesis.tex ---

\documentclass[msc,lith,english]{liuthesis}
%% Settings go in settings.tex
\include{settings}
\usepackage{rotating}
\usepackage{color}
\usepackage{multicol}

% \usepackage{changebar}

\department{Institutionen för datavetenskap}
\departmentenglish{Department of Computer and Information Science}
\departmentshort{IDA}

\externalsupervisor{Anonymous}
\supervisor{Anonymous}
\examiner{Anonymous}
\titleenglish{Something}
%\subtitleenglish{with a subtitle}
\titleswedish{En himla bra svensk titel}
\thesissubject{Datateknik}

\publicationyear{2018}
\currentyearthesisnumber{001}
\dateofpublication{2018-06-29}

\author{Anonymous}

\begin{document}

\chapterstyle{VZ43}

\include{intro}
\include{theory}
\include{method}
\include{results}
\include{discussion}
\include{conclusion}
\printbibliography
\include{appendix}

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% demothesis.tex ends here


As can be noticed, I am using a custom class, liuthesis. The file liuthesis.cls is in the same folder as the file I try to compile. The only place where bodyfont is set in this cls file is there:

\def\tryfonts#1#2{
\ifxetex
\def\primaryfont{"#1"} % first preferred font
\def\secondaryfont{"#2"} % if first font not avaliable
\count255=\interactionmode
\batchmode
\font\bodyfont=\primaryfont\space at 10pt
\ifx\bodyfont\nullfont
\font\bodyfont=\secondaryfont\space at 10pt
\ifx\bodyfont\nullfont
\errorstopmode
\errmessage{Neither #1 or #2 fonts installed, quitting..}
\else
\fontspec{#2}
\setmainfont{#2}
\fi
\else
\fontspec{#1}
\setmainfont{#1}
\fi
\interactionmode=\count255
\else
\typeout{ **** Please use XeTeX and install Calibri for correct typesetting ***}
\fi
}


All the tryfonts commands are as follows: \tryfonts{Calibri}{Carlito}

The error does not appear in the full logs (messages tab in TexStudio), but only in the summed up version (log tab in TexStudio). It says it happens at \begin{document}, line 65.

Here is the log output, too big to fit in the post: logs

When encountering this error, most of the times the people solved the problem installing texlive-fonts-recommended. However, using this script shows me that it is already installed (confirmed by apt-get when I try to install it).

I can't find any solution. Does any of you have an idea ? Thank you in advance for your help !

• you have not shown your input which makes it hard for anyone to tell you what is wrong. You should be using fontspec to load an opentype font into xelatex but \bodyfont does not sound like a fontspec font name. – David Carlisle Sep 19 '18 at 14:12
• also you have posted a very long log file which shows no errors in particular it does not show the error in the title. (texstudio must be showing an error from a different document) – David Carlisle Sep 19 '18 at 14:15
• Thank you for your comments, I fixed my post according to what you said. I used to be able to compile without any problem using texstudio and xelatex on a different computer running W10 (I am running Ubuntu on the one with the problem). – V. Déhaye Sep 19 '18 at 15:11
• Oh well that is the answer then: Calibri is a microsoft font not licenced for use on linux. – David Carlisle Sep 19 '18 at 15:29
• you still haven't provided an example that anyone can run, presumably that \tryfonts command is run somewhere but not in the log you showed) and on linux it will be expected to fail on Calibri and then presumably use the next font it tries instead. – David Carlisle Sep 19 '18 at 15:34

You have not shown the use of the \tryfonts command but presumably in your document it tries Calibri and then some other font. On linux the test for Calibri will fail and it will use whatever font you specified for #2 instead. The test itself will place a warning in the log that the font is not found but it is not actually a problem that is the intended behaviour of the test.
• Thank you for your answer. The tryfonts command is as follows: \tryfonts{Calibri}{Carlito}. The weird thing is it should try to find the replacement font, which seems to be Carlito in this case, but it doesn't. Either way, as I am on a dual-boot Windows/Linux, I have Calibri available on the other partition. I followed the instructions in doc.ubuntu-fr.org/msttcorefonts section 2 to make it available to Linux. I did both the solutions with the symbolic link and copying the folder, but still the same error message. The calibri.ttf files are present in the folder, I checked. – V. Déhaye Sep 19 '18 at 16:24
• @V.Déhaye yes as I say that is just the test for calibri failing then it loads carlito, the test is run in \batchmode so failing tests in \tryfonts do not stop tex and are not shown on the terminal but it is the expected behaviour. if tryfonts ever uses the second font it will show the failure to find the first in the log. – David Carlisle Sep 19 '18 at 17:32