![LaTeX 错误:cls 文件中缺少 \begin{document}](https://linux22.com/image/450807/LaTeX%20%E9%94%99%E8%AF%AF%EF%BC%9Acls%20%E6%96%87%E4%BB%B6%E4%B8%AD%E7%BC%BA%E5%B0%91%20%5Cbegin%7Bdocument%7D.png)
错误信息:
kpathsea: Running mktexmf SimSun
! I can't find file `SimSun'.
<*> ...:=ljfour; mag:=1; nonstopmode; input SimSun
Please type another input file name
! Emergency stop.
<*> ...:=ljfour; mag:=1; nonstopmode; input SimSun
Transcript written on mfput.log.
grep: SimSun.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input SimSun' failed to make SimSun.tfm.
kpathsea: Appending font creation commands to missfont.log.
./thuthesis.cls:687: LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.687 }
No pages of output.
有关错误的源代码(.cls l.687):
\newcommand\thu@mac@word@font@path{%
/Applications/Microsoft Word.app/Contents/Resources/DFonts/%
}
\ifthu@fontset@auto
\ifthu@system@windows
\thusetup{fontset = windows}
\else
\IfFontExistsTF{SimSun}{
\thusetup{fontset = windows}
}{
\IfFileExists{\thu@mac@word@font@path/SimSun.ttf}{
\thusetup{fontset = windows}
}{
\ifthu@system@mac
\thusetup{fontset = mac}
\else
\IfFontExistsTF{Noto Serif CJK SC}{
\thusetup{fontset = ubuntu}
}{
\thusetup{fontset = fandol}
}
\fi
}
} % l.687
\fi
\fi
我还没有学过tex。但是我使用的cls文件中的这段代码告诉它,如果找到SimSun.ttf,字体集将是windows。
不知道这个错误是不是跟有关I can't find file SimSun.
,平台是mac,不过SimSun.ttf确实存在,路径是/Applications/Microsoft Word.app/Contents/Resources/DFonts/SimSun.ttf
。
至于fontspec,thuthesis.cls中的代码:
\PassOptionsToPackage{no-math}{fontspec}
我认为该错误与 tex 文件无关。其内容:
\documentclass[degree=master]{thuthesis}
\input{thusetup}
\begin{document}
\maketitle
\input{data/committee}
\copyrightpage
\frontmatter
\input{data/abstract}
\tableofcontents
\input{data/denotation}
\mainmatter
\input{data/chap01}
\input{data/chap02}
\input{data/chap03}
\input{data/chap04}
\backmatter
\appendix
\input{data/appendix}
\input{data/acknowledgements}
\statement
\input{data/resume}
\input{data/comments}
\input{data/resolution}
\end{document}
我使用 xelatex 进行编译。发行版本是
XeTeX 3.14159265-2.6-0.99999 (TeX Live 2018)
kpathsea version 6.3.0