neardws / My-Doctoral-Dissertation

重庆大学博士学位论文LaTex模版,支持2023年格式要求
Other
44 stars 8 forks source link

Package fontspec Error: The font "SimHei" cannot be found. Although SimHei has installed in system. #2

Closed Thesoul20 closed 6 months ago

Thesoul20 commented 6 months ago

When I run the command directly after git clone this repo: xelatex -quiet -halt-on-error -interaction=nonstopmode main.tex then the error of The font "SimHei" cannot be found appear.

When I run the command fc-list SimHei the output is

/usr/share/fonts/SimHei.ttf: SimHei,黑体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta

That is to say the font of SimHei is alright install in my system, but the xelatex cannot find the font. However, when I run the same command in the CQUThesis repo, this command run successful and can get a normal pdf file. So, maybe there are some issues in this repo?

Tex version is

tex --version

TeX 3.141592653 (TeX Live 2022/Debian)
kpathsea version 6.3.4
Copyright 2022 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.

ON Kubuntu 22.10 x86_64

Thesoul20 commented 6 months ago

I have solved this problem by reinstall the simhei.ttf after chmod of the file with the command of

sudo mkfontscale
sudo mkfontdir
sudo fc-cache -fv