本人正在写毕设,使用贵工作室提供的广工大的学位论文模板https://www.latexstudio.net/archives/1791.html
在下好文件刚开始试编译的时候就遇到报错了,值得一提的是,报错的地方不是tex文件而是cls文件:
```
! Undefined control sequence.
l.53 \newfontfamily
\heiti@num{SimHei}[AutoFakeBold=1]
? h
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
```
对应这个报错的部分是cls中的字体设置函数(共3个):
```tex
\newfontfamily\heiti@num{SimHei}[AutoFakeBold=1]
\newfontfamily\heiti@num@bold{SimHei}[AutoFakeBold=2]
\setCJKfamilyfont{heiti@bold}{SimHei}[AutoFakeBold=2]
```
刚开始我以为是没有加 \usepackage{fontspec},后面加进去后又报了这个错:
```tex
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
!
! The fontspec package requires either XeTeX or LuaTeX.
!
! You must change your typesetting engine to, e.g., "xelatex" or
! "lualatex"instead of "latex" or "pdflatex".
!
! See the fontspec documentation for further information.
!
! For immediate help type H .
!...............................................
l.44 \msg_fatal:nn {fontspec} {cannot-use-pdftex}
```
至此就卡壳了不知道怎么解决,求各位大佬相助,谢谢!
cls文件的MWE(不太懂cls哪些代码比较必要所以不太会缩减,先说声抱歉):
```tex
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{gdutart} [2019/04/01 v1.0 Template for GDUT]
\RequirePackage{xkeyval}
\RequirePackage{etoolbox}
\newif\ifcoverpage
\coverpagetrue
\DeclareOptionX{nocoverpage}{\coverpagefalse}
\ifcoverpage%
\define@key{GDUT}{subject}[]{\gdef\GDUT@info@subject{#1}}%
\define@key{GDUT}{topic}[]{\gdef\GDUT@info@topic{#1}}%
\define@key{GDUT}{college}[]{\gdef\GDUT@info@college{#1}}%
\define@key{GDUT}{major}[]{\gdef\GDUT@info@major{#1}}%
\define@key{GDUT}{grade}[]{\gdef\GDUT@info@grade{#1}}%
\define@key{GDUT}{stuid}[]{\gdef\GDUT@info@stuid{#1}}%
\define@key{GDUT}{name}[]{\gdef\GDUT@info@name{#1}}%
\define@key{GDUT}{teacher}[]{\gdef\GDUT@info@teacher{#1}}%
\setkeys{GDUT}{%
subject = 本科毕业设计(论文),
topic = 请填写课题名称,
college = 请填写学院,
major = 请填写专业,
grade = 请填写年级,
stuid = 请填写学号,
name = 请填写姓名,
teacher = 请填写指导老师%
}
\newcommand{\infosetup}[1]{\setkeys{GDUT}{#1}}%
\fi
\ProcessOptionsX\relax
\LoadClass[a4paper, 12pt, notitlepage]{ctexart}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 引用的宏包
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{geometry} % 设置页边距
\RequirePackage{fancyhdr} % 设置页眉和页脚
\RequirePackage{amsthm, amsfonts, amsmath, bm} % 数学环境
\RequirePackage{makecell, multirow, xltabular} % 扩展表格
\RequirePackage{enumitem} % 定制列表环境
\RequirePackage{graphicx} % 插入图片
\RequirePackage{titlesec} % 定制章节格式
\RequirePackage{tocloft} % 定制目录格式
\RequirePackage{hyperref} % 使用超链接
\usepackage{fontspec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 字体设置
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newfontfamily\heiti@num{SimHei}[AutoFakeBold=1]
\newfontfamily\heiti@num@bold{SimHei}[AutoFakeBold=2]
\setCJKfamilyfont{heiti@bold}{SimHei}[AutoFakeBold=2]
```
一周热门 更多>