刚写完博士论文,趁热把哈工大博士论文的LaTex模板hithesis的使用说明总结一下,包括一些强迫症的补充命令,包括最新模板要求的决议页的写法。

本文主要介绍模板的基础配置,以及一些现有模板不完善的地方进行修改,例如正文的参考文献引用中括号不是全角符号,三线表粗细,插入图目录和表目录,以及字体统一为新罗马。

基础设置

mac下安装MacTeX,windows下安装TeX Live 下载模板hithesis的dev分支hithesis/hithesis at dev解压得到hithesis-dev文件夹。

在该目录下执行编译命令:

  • 如果是Linux/Mac执行

    latex hithesis.ins

  • 如果是Windows执行(作者没测试过,如遇问题同上)

    lualatex hithesis.ins

  • 如果喜欢玩 make

    make cls

编译后进入中文博士目录examples/hitbook/chinese

用VS Code打开该目录,安装Latex Workshop插件,在settings.json中写入下面的配置项

"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "lualatexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-lualatex",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "xelatexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-xelatex",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "latexmk_rconly",
"command": "latexmk",
"args": [
"%DOC%"
],
"env": {}
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
},
{
"name": "rnw2tex",
"command": "Rscript",
"args": [
"-e",
"knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')"
],
"env": {}
},
{
"name": "jnw2tex",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")"
],
"env": {}
},
{
"name": "jnw2texmintex",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")"
],
"env": {}
},
{
"name": "tectonic",
"command": "tectonic",
"args": [
"--synctex",
"--keep-logs",
"%DOC%.tex"
],
"env": {}
}
],
"latex-workshop.latex.recipes": [
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"name": "latexmk 🔃",
"tools": [
"latexmk"
]
},
{
"name": "latexmk (latexmkrc)",
"tools": [
"latexmk_rconly"
]
},
{
"name": "latexmk (lualatex)",
"tools": [
"lualatexmk"
]
},
{
"name": "latexmk (xelatex)",
"tools": [
"xelatexmk"
]
},
{
"name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "xelatex ➞ bibtex ➞ xelatex * 2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "Compile Rnw files",
"tools": [
"rnw2tex",
"latexmk"
]
},
{
"name": "Compile Jnw files",
"tools": [
"jnw2tex",
"latexmk"
]
},
{
"name": "tectonic",
"tools": [
"tectonic"
]
}
],

点击xelatex ➞ bibtex ➞ xelatex * 2进行编译。

细节设置

字体改为windows

\documentclass[fontset=windows,type=doctor,campus=harbin]{hithesisbook}

参考文献格式改为全角符号版本,即将下面这行解除注释。

\bibliographystyle{gbt7714-numerical-quanjiao} % 全角标点的国标要求的参考文献样式, 哈尔滨硕博用这个

额外设置

% 重设正文字体为新罗马
\setmainfont{Times New Roman}[
BoldFont={Times New Roman Bold},
ItalicFont={Times New Roman Italic},
BoldItalicFont={Times New Roman Bold Italic}
]

\makeatletter
% 设置正文中参考文献引用的中括号为全角中括号
\renewcommand{\NAT@@open}{[}
\renewcommand{\NAT@@close}{]}

% 设置成果发表列表的编号为全角中括号
\renewenvironment{publist}{%%%%%重定义 publist 环境
\begin{list}{[\arabic{pubctr}]} %% 改成中文括号
{
\usecounter{pubctr}
\setlength{\leftmargin}{2.6em}
\setlength{\itemindent}{0em}
\setlength{\labelsep}{0.5em}
\setlength{\rightmargin}{0em}
\setlength{\topsep}{0ex}
\setlength{\parsep}{0ex}
\setlength{\itemsep}{0ex}
\setlength{\listparindent}{0pt}
}}
{\end{list}}
\makeatother

% 设置三线表的线粗,使得midrule与cmidrule粗细一致
\setlength{\heavyrulewidth}{1.5pt} % \toprule 和 \bottomrule 的粗细
\setlength{\lightrulewidth}{0.5pt} % \midrule 的粗细

% 设置公式编号为中文小括号
\makeatletter
\renewcommand{\tagform@}[1]{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
\makeatother

% 设置\eqref引用自带中括号
\renewcommand{\eqref}[1]{(\ref{#1})}

表目录和图目录(不要求)

如果想添加表目录和图目录,可以添加下面的命令。

\makeatletter
\renewcommand\listoffigures{
\begingroup
\renewcommand{\addvspace}[1]{\vspace{0pt}}
\hit@listof{figure}{\listfigureename}
\endgroup
}
\makeatother
\makeatletter
\renewcommand\listoftables{
\begingroup
\renewcommand{\addvspace}[1]{\vspace{0pt}}
\hit@listof{table}{\listtableename}
\endgroup
}
\makeatother
\listoffigures
\listoftables

决议页

决议页的word模板下载2025博士研究生学位论文书写范例.doc

word编辑好后导出到pdf,并截取表格边框为新pdf。

替换empty-resolution.pdf