NUDT Paper LaTeX 模板使用
分享笔者在使用 NUDT 学位论文 LaTeX 模板时遇到的各种问题和解决方案。文中还提供了一个 copy 即用的 Overleaf 项目。
文章目录
- NUDT Paper LaTeX 模板
- nudtpaper
- nudt_thesis
- 在 Overleaf 编译 nudtpaper
- timed out 的问题
- 解决方法
- 持续更新……
- 参考资料
NUDT Paper LaTeX 模板
nudtpaper
nudtpaper:liubenyuan/nudtpaper: A LaTeX template for Master/PhD Thesis of NUDT
nudtpaper 的 Overleaf 版本:kkrusher/nudtpaper: A LaTeX template for Master/PhD Thesis of NUDT
编译时遇到的错误:
thesis.tex: 错误: 89: Package pdfpages Error: Cannot find file `a3cover/originalitystatement.pdf'. \maketitle

nudtpaper 的 issue #66 提到了笔者遇到过的问题,根据报错信息可知,缺少a3cover/originalitystatement.pdf
文件。
解决方法:编译thesis.tex
前先运行a3cover/makeothers.bat
,生成a3cover/originalitystatement.pdf
独创性声明文件。
nudt_thesis
nudt_thesis:TomHeaven/nudt_thesis: NUDT硕士博士毕业论文latex模板
注意:如果在本地使用 Texstudio 编译项目,在安装依赖的字体时,一定要右键字体文件,选择“为所有用户安装”,不然 Texstudio 可能还是找不到该字体。
在 Overleaf 编译 nudtpaper
笔者最终还是被 Texstudio 频繁的闪退给打败,并毅然决然改用 Overleaf 了……
timed out 的问题
Your project took too long to compile and timed out. and no money to unlock more compile time …
nudtpaper 的 issue #25 提到了笔者遇到过的问题:

校友 Dingxxxx 给了一个 reply:

nudt_thesis 的 issue #11 同样提到了这个问题:

官网教程:I have a custom font I’d like to load to my document. How can I do this? - Overleaf, Online LaTeX Editor
从中可以看出,问题主要出在字体那。
我们再研究下 nudtpaper 的 Overleaf 版本 的首次 commit e79fafd:

改动主要有两处:
1)新建了一个 fonts
文件夹,里面放了 4 个 .OTF
格式的字体文件。
fonts/ADOBEFANGSONGSTDL.OTF
fonts/ADOBEHEITISTD-REGULAR(V5.010).OTF
fonts/ADOBEKAITISTD-REGULAR.OTF
fonts/ADOBESONGSTD-LIGHT(V5.010).OTF
2)修改了 nudtpaper.cls
文档类文件。

可以看到,修改前的代码使用的是系统预装的字体,修改后的代码直接指向了具体的字体文件路径fonts/
。所以,笔者猜测,字体缺失是导致原版的 nudtpaper 和 nudt_thesis 在 Overleaf 编译时间过长的主要原因,修改后直接使用上传的字体文件解决了这个问题。
解决方法
我们以 nudtpaper 为例,版本为 d607e0c35aee23b662f9c7329018df3a798da24f。
1)导入 kkrusher/nudtpaper 项目中的 .OTF
字体文件:
ADOBEFANGSONGSTDL.OTF
ADOBEHEITISTD-REGULAR(V5.010).OTF
ADOBEKAITISTD-REGULAR.OTF
ADOBESONGSTD-LIGHT(V5.010).OTF
2)修改 nudtpaper/nudtpaper.cls 中的 \newcommand{\installotf}
:
% \newcommand{\installotf}{
% %%%% Windows Thesis Fonts
% \setmainfont{Times New Roman PS Std}
% \setsansfont{Arial}
% \setmonofont{Courier New}
% %%%% Using Adobe Family Fonts
% \setCJKmainfont[ItalicFont={Adobe Kaiti Std}]{Adobe Song Std}
% \setCJKsansfont{Adobe Heiti Std} % Hei
% \setCJKmonofont{Adobe Fangsong Std} % Fangsong
% %%%% alias
% \setCJKfamilyfont{song}{Adobe Song Std}
% \setCJKfamilyfont{hei}{Adobe Heiti Std}
% \setCJKfamilyfont{fs}{Adobe Fangsong Std} % fang-song
% \setCJKfamilyfont{kai}{Adobe Kaiti Std} % Kai
% }\newcommand{\installotf}{%\setmainfont{Times New Roman} % could be changed to "Times New Roman PS Std" !!\setsansfont{Arial}\setmonofont{Courier New}\setCJKmainfont[BoldFont=ADOBEHEITISTD-REGULAR(V5.010).OTF,ItalicFont=ADOBEKAITISTD-REGULAR.OTF]{ADOBESONGSTD-LIGHT(V5.010).OTF}\setCJKsansfont{ADOBEHEITISTD-REGULAR(V5.010).OTF}\setCJKmonofont{ADOBEKAITISTD-REGULAR.OTF}\setCJKfamilyfont{song}{ADOBESONGSTD-LIGHT(V5.010).OTF}\setCJKfamilyfont{hei}{ADOBEHEITISTD-REGULAR(V5.010).OTF}\setCJKfamilyfont{fs}{ADOBEFANGSONGSTDL.OTF}\setCJKfamilyfont{kai}{ADOBEKAITISTD-REGULAR.OTF}\setCJKfamilyfont{li}{ADOBEKAITISTD-REGULAR.OTF}\setCJKfamilyfont{you}{ADOBEKAITISTD-REGULAR.OTF}\setCJKfamilyfont{cusong}{STZhongsong}
}
3)修改 nudtpaper/thesis.tex 中的 \documentclass
:
% \documentclass[doctor,twoside,biber,resumebib,fz]{nudtpaper}
\documentclass[master,twoside,biber,resumebib,otf]{nudtpaper}
这里的重点是把 fz 字体格式改为 otf 字体格式,从而和 2)中的修改对应。
经过 1)2)3)后,Overleaf 已经能成功编译 nudtpaper,但仍然有一些报错,也就是笔者在前文提到过的,找不到a3cover/originalitystatement.pdf
的报错。对于强迫症患者,可以首先在本地运行a3cover\makeothers.bat
,并将生成的 .pdf
文件上传到 Overleaf 项目的 a3cover
文件夹中。
我们最终成功地在 Overleaf 编译了 d607e0c35aee23b662f9c7329018df3a798da24f 版的 nudtpaper:

为了帮助到更多的 NUDTer,我和小伙伴 JQ 决定把通过 Overleaf 编译测试的 nudtpaper 开源在 👉 国防科大学位论文LaTeX,读者可以复制并使用该 Overleaf 项目。在此也感谢 JQ 同学与我一起解决编译 LaTeX 版学位论文时遇到的问题。
最后,祝我们毕业顺利!前程似锦!
持续更新……
笔者还会持续更新使用过程中遇到的问题,如有错误请指出!
参考资料
- LaTeX 的使用
- 最新2024 Latex安装 Texlive-Texstudio【超详细-最新】
- 国防科大毕业论文Latex模板(Windows)
- NUDT硕士论文LaTeX模板
- LaTeX:如何在TeXStudio中显示行号?