I'm working on a Chinese-English hybrid document. Previously I'm using pdflatex to build, but now have changed to xelatex in order to change math fonts.
However, many errors popped up when I try to change the fonts. My document is built well using both pdflatex and xelatex. But when I add the following content:
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}
Many errors popped up, like this:
Math formula deleted: Insufficient symbol fonts. \maketitle
Math formula deleted: Insufficient symbol fonts. \maketitle
Math formula deleted: Insufficient symbol fonts. \contentsline {chapter}{序言}{1}{chapter*.5}
Math formula deleted: Insufficient symbol fonts. \contentsline {chapter}{序言}{1}{chapter*.5}
Math formula deleted: Insufficient symbol fonts. ...一章\hspace {0.3em}}引言}{3}{chapter.1}
Math formula deleted: Insufficient symbol fonts. ...rline {1.1}问题的提出}{3}{section.1.1}
Math formula deleted: Insufficient symbol fonts. ...下的发展与变化}{3}{subsection.1.1.1}
Math formula deleted: Insufficient symbol fonts. ...复用的分类}{3}{subsubsection.1.1.1.1}
Math formula deleted: Insufficient symbol fonts. ...的发展趋势}{3}{subsubsection.1.1.1.2}
Math formula deleted: Insufficient symbol fonts. ...}软件资源分类研究}{3}{section.1.2}
Math formula deleted: Insufficient symbol fonts. ...类与)概况}{3}{subsubsection.1.2.0.1}
Math formula deleted: Insufficient symbol fonts. ...和难点/新问题}}{4}{subsection.1.2.1}
The building progress finished eventually, and it did generate a readable pdf file without some math contents.
I have no idea of why these errors come up. I'm not quite familiar with LaTeX, and I am using a template by others. Who can help me with this problem?
=====================================
Supplement 1: Thanks to advices from @egreg. I put up a minimal example that triggers this error.
Except the above error, this code also triggered some undefined control sequence error.
\documentclass[UTF8, colorlinks]{pkuthss}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}
\begin{document}
\maketitle
\end{document}
I have checked the original error log again, found that many errors occur in \maketitle
and \tableofcontents
, also found:
Command \@footnotemark has changed.
Font shape `T1/LatinModernRoman(0)/m/n' undefined(Font) using `T1/cmr/m/n' instead'
Font shape `T1/LatinModernMath(0)/m/n' undefined(Font) using `T1/cmr/m/n' instead
Font shape `T1/LatinModernRoman(0)/bx/n' undefined(Font) using `T1/LatinModernRoman(0)/m/n' instead
Font shape `T1/LatinModernMath(1)/m/n' undefined(Font) using `T1/cmr/m/n' instead
I guess that something in the pkuthss class file might be the causes. However there was no error before I use the /setmathfont
order.
=====================================
Supplement 2: code in the template file(document class)
\renewcommand{\maketitle}{
\cleardoublepage
% Add PDF bookmark for the title page.
\pdfbookmark[1]{\titlepagename}{titlepage}
\begin{titlepage}
% It will be more nice to use this line skip level in the title page.
\linespread{1.6}\selectfont
% Make the title page centered.
\begin{center}
% Emblem and inscription of the university, and type of thesis.
{
\zihao{1}%
\includegraphics[height = 2.4em]{pkulogo}\hspace{0.4em}%
\raisebox{0.4em}{\includegraphics[height = 1.6em]{pkuword}}\\[0.8em]
{\bfseries{\cthesisname}}
}
\vfill
% Title of the thesis.
{
\zihao{2}{\label@ctitle}%
\pkuthss@int@fillinblank{2}{0.64\textwidth}{\textbf{\@ctitle}}
}
\vfill
% Information about the author.
{
% Slightly adjust the line skip when using new font size.
\zihao{-2}\linespread{1.75}\selectfont
\def\pkuthss@tmp@len{0.56\textwidth}
\begin{tabular}{l@{\extracolsep{0.2em}}c}
{\label@cauthor} &
\pkuthss@int@fillinblank{1}{\pkuthss@tmp@len}{\kaishu\@cauthor} \\
{\label@studentid} &
\pkuthss@int@fillinblank{1}{\pkuthss@tmp@len}{\kaishu\@studentid} \\
{\label@school} &
\pkuthss@int@fillinblank{1}{\pkuthss@tmp@len}{\kaishu\@school} \\
{\label@cmajor} &
\pkuthss@int@fillinblank{1}{\pkuthss@tmp@len}{\kaishu\@cmajor} \\
{\label@direction} &
\pkuthss@int@fillinblank{1}{\pkuthss@tmp@len}{\kaishu\@direction} \\
{\label@cmentor} &
\pkuthss@int@fillinblank{1}{\pkuthss@tmp@len}{\kaishu\@cmentor} \\
\end{tabular}
}
\vfill
% Date.
{\kaishu\zihao{2}\@date}
\end{center}
\end{titlepage}
}
=============================
supplement 3:
I found that if I'm not using the unicode-math package, and only add the \setmainfont
order, the file will build and present normally. So I guess that's not an issue related to the fonts?
\setmainfont{Latin Modern Roman}
=========================
supplement 4:
I have another minimal example to generate the error:
\documentclass[UTF8, colorlinks]{pkuthss}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}
\begin{document}
test:$d=\left\langle t_1, t_2, \dots , t_T\right\rangle $\\
corpus:$c=\left\lbrace d_1, d_2, \dots, d_D \right\rbrace $\\
\end{document}
The errors are:
Math formula deleted: Insufficient symbol fonts. test:$d
Math formula deleted: Insufficient symbol fonts. ...angle t_1, t_2, \dots , t_T\right\rangle $
Math formula deleted: Insufficient symbol fonts. ...brace d_1, d_2, \dots, d_D \right\rbrace $
If I change the first line to this, there will be no error. So what should I post from the pkuthss class file?
\documentclass[UTF8, colorlinks]{article}
Also I have noticed some warnings before the error:
Font shape `T1/LatinModernRoman(0)/m/n' undefined(Font) using `T1/cmr/m/n' instead
===============================
supplement 5:
updated to the latest version.
I have updated the pkuthss class file to the latest version, on https://github.com/CasperVector/pkuthss , as suggested by @Mico.
Unfortunately, the errors are still there…
When I try to build the minimal example in supplement 4, the same messages still popped up.
I feel so frustrated… Can anyone help me with this?
Best Answer
I have solved this question after consulting the author of pkuthss.cls.
Following his advice, there are two way to solve my problem.
It's not necessary to use packge unicode-math to meet my requirement of changing math font. Two optional approach:
a) Use document class with a parameter
nopkufont
:\documentclass[UTF8, nopkufont]{pkuthss}
. The current font style are according to the regulations of our university, negate the parameter to use traditional latex font(latexsym).b) Change the cls file content:
Delete the line of
\RequirePackage{newtxmath}
will change the font of math contents to latin modern math without violating the PKU regulations.You can use the above two solutions at the same time, that's what I did since no matter in which case I would like to use latin modern math as the math font and I might have to change the normal text to the newtx font if asked by the university.
Also noticed @egreg did not reproduce my errors, so there might be something wrong in my configuration of tex. As suggested by the author, I uninstalled the tex live and re-install the latest tex live version following the bootstrap guide given by the author (https://bbs.pku.edu.cn/attach/boards/MathTools/M.1435670549.A/pkuthss-bootstrap-0.1.5-r1.pdf?t=1464095057, in Chinese) (not too much changes compared with the normal installation progress).
After re-installation, my errors disappeared... I don't know why and how...
Anyway, my problem has been solved. I think this is such a specific issue only related to the thesis template of our university, may not be helpful to others. Anyway I posted the answer here, in case another PKU student encountered the same problem...