% \iffalse meta-comment % % Copyright (C) 2016 by Zhennan Li % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in: % % http://www.latex-project.org/lppl.txt % % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % \fi % % \iffalse %<*driver> \ProvidesFile{cquthesis.dtx}[2020/06/23 v1.50 Chongqing University Thesis Template] \documentclass{ltxdoc} \usepackage{dtx-style} \EnableCrossrefs \CodelineIndex \RecordChanges \begin{document} \DocInput{\jobname.dtx} \end{document} % % \fi % % \CheckSum{1893} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \DoNotIndex{\newenvironment,\@bsphack,\@empty,\@esphack,\sfcode} % \DoNotIndex{\addtocounter,\label,\let,\linewidth,\newcounter} % \DoNotIndex{\noindent,\normalfont,\par,\parskip,\phantomsection} % \DoNotIndex{\providecommand,\ProvidesPackage,\refstepcounter} % \DoNotIndex{\RequirePackage,\setcounter,\setlength,\string,\strut} % \DoNotIndex{\textbackslash,\texttt,\ttfamily,\usepackage} % \DoNotIndex{\begin,\end,\begingroup,\endgroup,\par,\\} % \DoNotIndex{\if,\ifx,\ifdim,\ifnum,\ifcase,\else,\or,\fi} % \DoNotIndex{\let,\def,\xdef,\edef,\newcommand,\renewcommand} % \DoNotIndex{\expandafter,\csname,\endcsname,\relax,\protect} % \DoNotIndex{\Huge,\huge,\LARGE,\Large,\large,\normalsize} % \DoNotIndex{\small,\footnotesize,\scriptsize,\tiny} % \DoNotIndex{\normalfont,\bfseries,\slshape,\sffamily,\interlinepenalty} % \DoNotIndex{\textbf,\textit,\textsf,\textsc} % \DoNotIndex{\hfil,\par,\hskip,\vskip,\vspace,\quad} % \DoNotIndex{\centering,\raggedright,\ref} % \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize} % \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne} % \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass} % \DoNotIndex{\AtBeginDocument,\AtEndDocument} % % \GetFileInfo{\jobname.dtx} % % \changes{v0.0.1}{2016/04/03}{模板开始编写。} % \changes{v0.6.9}{2016/05/09}{主体功能完工,迁移模板到生产环境中继续开发。} % \changes{v0.7.5}{2016/05/10}{生产环境建立,模板完成测试。} % \changes{v0.8.1}{2016/05/12}{重绘了论文封面,增加了专业硕士选项。} % \changes{v0.8.5}{2016/05/13}{完成了示例文件。} % \changes{v0.8.7}{2016/05/14}{上线前最后一批修正。} % \changes{v0.8.9}{2016/05/15}{模板登陆Github,开始参与2016年重庆大学毕业设计工作。} % \changes{v0.9.4}{2016/05/19}{用户文档撰写完成,CQUThesis提交至CTAN审核。} % \changes{v0.9.7}{2016/06/09}{参与了2016年重庆大学毕业设计工作后,模板根据实际测试情况作了一番改进,Beta测试落下帷幕。} % \changes{v0.9.7}{2016/06/09}{拆分了\file{cquthesis.sty}宏包,将其大部分内容并入\file{cquthesis.cls}和\file{cquthesis.cfg}。} % \changes{v1.00}{2016/06/17}{最后一些小修补,今年的毕设工作完全结束了。目前本科方面的格式审查没有问题,研究生和博士生哪边还没有数据。} % \changes{v1.00}{2016/06/17}{版本号格式从vX.Y.Z改为vX.YZ,更简洁一些。} % \changes{v1.10}{2016/06/21}{增加了CQUThesis的开发工具Makefile和makewin.bat,现在它对\LaTeX 中高阶用户和开发者更加友好,文档也相应更新了。} % \changes{v1.14}{2016/08/18}{改进了\file{makewin.bat},默认的thesis选项加入了自动判定,如果dtx没有解包,程序会自动解包。这也就是说,新手可以在几乎所有情况下放心地通过双击makewin.bat来完成编译了。} % \changes{v1.20}{2017/05/30}{新增选项blankleft,可选目录和章节右开时空白的左页是否让页眉页脚空白。} % \changes{v1.20}{2017/05/30}{调整了几个可选项的默认值,现在,openright默认开启。} % \changes{v1.20}{2017/05/30}{新功能:盲审模式,由开关blindtrail和\cs{secretize}宏以及\env{secretizeEnv}环境构成。} % \changes{v1.20}{2017/05/30}{再次改进了\file{makewin.bat},现在,Windows用户以管理员身份运行\file{makewin.bat}时不再会遭遇路径错误了。此外,\file{makewin.bat}有中英文两个版本了。} % \changes{v1.30}{2018/02/23}{从\href{https://github.com/zepinglee/gbt7714-bibtex-style}{上游供应商zepinglee/gbt7714-bibtex-style}更新了\file{cqunumerical.bst}。} % \changes{v1.40}{2019/10/12}{修复了\href{https://github.com/nanmu42/CQUThesis/issues/44}{Issue 44}。} % % % \def\indexname{代码索引} % \def\glossaryname{更新记录} % \IndexPrologue{\section{\indexname}} % \GlossaryPrologue{\section{\glossaryname}} % % \title{\bfseries\color{blue!50!black}\cquthesis:重庆大学毕业论文\LaTeX 模板} % \author{{\fangsong 李振楠\footnote{\href{https://nanmu.me/zh-cn/about/}{中文页面},\href{https://nanmu.me/en/about}{About in English}}}\\[5pt]\texttt{i@nanmu.me}} % \date{\fileversion\ (\filedate)} % \maketitle\thispagestyle{empty} % \vspace{\stretch{1}} % \begin{center} % \includegraphics[height=7cm]{figures/CQUbadge} % \end{center} % \vspace{\stretch{2}} % \begin{abstract}\noindent % \cquthesis\footnote{\url{https://github.com/nanmu42/CQUThesis}}是重庆大学毕业论文的\LaTeX{}模板,支持学士(文学、理工)、硕士(学术、专业)、博士论文的排版。 % \end{abstract} % \vspace{\stretch{1}} % \def\abstractname{用户协议} % \begin{abstract}\noindent % \begin{enumerate} % \item 本模板按照LaTeX Project Public License发布,协议版本号为1.3或以后的任何版本(随你意); % \item 截止本文档编译时,重庆大学教务处和研究生院只提供了\href{https://github.com/nanmu42/CQUThesis/tree/master/toolkit}{毕业论文写作指南},没有提供官方模板,也没有授权或认证任何第三方模板为官方模板\footnote{\href{http://jq.qq.com/?_wv=1027&k=2HvYu95}{重庆大学\TeX 用户组}做过推动学校\href{https://github.com/CQUtug/TeXProposal}{认证\cquthesis}的努力。}。本模板是按照写作指南的参考实现,模板作者自当尽力,但不保证审查老师不提意见。在开始使用前,您同意,任何由于本模板而引起的论文格式审查问题与本模板作者无关。 % \end{enumerate} % \vskip2cm % \end{abstract} % % % \clearpage % \pagestyle{fancy} % \begin{multicols}{2}[ % \setlength{\columnseprule}{.4pt} % \setlength{\columnsep}{18pt}] % \tableofcontents % \end{multicols} % \clearpage % % \section{欢迎!} %\cquthesis{}是重庆大学毕业论文的\LaTeX{}模板,支持学士、硕士、博士论文的排版。合理使用本模板可以大大减轻重庆大学毕业生在毕业论文撰写过程中的排版工作量。 % %\cquthesis{}根据重庆大学《重庆大学本科设计(论文)撰写规范化要求(2007年修订版)》和《重庆大学博士、硕士论文撰写格式标准(2007年修订版)》编写,力求合规,简洁,易于实现,用户友好。 % % 本模板的特色: %\begin{itemize} % \item 支持重庆大学本科(文学、理工)、硕士(学术、专业)、博士的毕业论文格式; % \item 内置封面、目录、索引、授权书等论文部件,可按需自动生成; % \item 自动侦测文档页数,生成相应的单面打印/双面打印PDF文件; % \item 预置一批优化过的宏包和小功能,包含中英双语题注及配套图录、表录,国际标准单位、化学式支持、三线表等,可按需开启; % \item 支持基于cwl文件的代码补全,makefile功能能够在Linux, Mac, Windows三平台通用。 % \end{itemize} % % 本文档将尽量完整的介绍模板的使用方法,如有不清楚之处可以参考示例文档或者根据第~\ref{sec:howtoask}节说明提问,有兴趣者都可以参与完善此手册,也非常欢迎对代码的贡献。 % % \note{模板的作用在于减少论文写作过程中格式调整的时间,前提是遵守模板的用法,否则即便用了\cquthesis 也难以保证输出的论文符合学校规范。} % % \section{安装} % \label{sec:installation} % % \subsection{系统要求} % \label{sec:sysrequire} % 本模板用到的宏包比较多,这些包在常见的\TeX{}发行版中都有,按照您操作系统的不同,您可以选择不同的\TeX{}发行版: % \begin{itemize} % \item Windows用户,推荐使用Mik \TeX ,这是一个专为Windows环境设计的\TeX 发行版,下载体积小,而且可以自主解决宏包依赖问题; % \item Linux和Mac用户,推荐使用\TeX Live,这是一套大而全的\TeX{}发行版,考虑到使用这两个系统的用户动手能力相对较强,\TeX Live没法自己解决依赖这个问题应该不是很让人头疼\footnote{使用宏包管理器或者从CTAN获取依赖宏包。}。 % \end{itemize} % % 本模板在Windows和Mac环境下的\TeX Live发行版中都进行了编译测试。 % % \note{在条件允许的情况下,强烈推荐您使用\XeTeX 引擎进行编译工作。} % % \subsection{获取\cquthesis} % 您可通过三个主要途径获取\cquthesis : % % \begin{itemize} % \item 造访\cquthesis 的 \href{https://github.com/nanmu42/CQUThesis}{Github主页}下载最新的开发版本,这是更新最快,功能最全的版本(含工具箱Toolkit); % \item 访问本模板\href{https://www.ctan.org/pkg/cquthesis}{CTAN官方镜像}下载发行版,这个版本定期从预发行版本同步(不含工具箱Toolkit\footnote{这是出于许可证方面的考虑。}); % \item 使用Mik \TeX 或\TeX Live的宏包管理功能直接获得本模板,这个方式不含模板示例文件。 % \end{itemize} % % 除此之外,\cquthesis{}不拥有也不维护任何其他镜像。 % % % \subsection{模板的组成部分} % 下表列出了 \cquthesis{} 的主要文件及其功能介绍: % % \begin{longtable}{l|p{8cm}} % \toprule % {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule % \endfirsthead % \midrule % {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule % \endhead % \endfoot % \endlastfoot % cquthesis.ins & \textsc{DocStrip} 驱动文件(用于安装或更新) \\ % cquthesis.dtx & \textsc{DocStrip} 源文件(用于安装或更新)\\ % makefile & GNU make配置文件(Mac和Linux)\\ % makewin.bat & Windows版make \\\midrule % cquthesis.cls & \LaTeX 模板文件\\ % cquthesis.cfg & 模板配置文件\\ % cqunumerical.bst & 参考文献样式文件\\ % cquthesis.cwl & 代码着色和自动补全配置文件\\\midrule % main.tex & 示例文档主文件\\ % contents/ & 示例文档章节具体内容\\ % figures/ & 示例文档图片路径\\ % ref/ & 示例文档参考文献目录\\ % toolkit/ & 额外的写作工具箱\\ % cquthesis.sty & 为示例文档加载其它宏包\\\midrule % README-English & 英文安装提示,推荐中高阶用户阅读\\ % README.md & Readme\\ % \textbf{cquthesis.pdf} & 用户手册(本文档)\\\bottomrule % \end{longtable} % % \note{\file{cquthesis.cls}和\file{cquthesis.cfg}以及\file{cqunumerical.bst}可以由\file{cquthesis.ins}和\file{cquthesis.dtx}生成,从\cquthesis { }v1.10之后,\file{cquthesis.cls}和\file{cquthesis.cfg}不再做预先提取,这个工作交给用户,整个过程很简单,请见\ref{sec:install}节。} % % \subsection{安装} % \label{sec:install} % 得益于GNU make和makewin.bat,\cquthesis 的安装十分便利。 % 下载\cquthesis{}的\file*{.zip}压缩包后请将整个文件夹解压出来,进入文件夹后: % \begin{itemize} % \item Windows用户可以直接双击运行\file{makewin.bat}; % % \item Linux和Mac用户请在Bash窗口中进行如下操作: % % \begin{shell} % cd cquthesis % make thesis % \end{shell} %\end{itemize} % % 即可完成\cquthesis 的安装和示例文档的编译。 % % \subsection{升级} % \cquthesis 的升级很方便,下载最新的开发版,将zip文件中的\file{cquthesis.dtx} 和\file{cquthesis.ins} 覆盖掉工作文件夹中的相应文件后: % \begin{itemize} % \item Windows用户请在文件夹空白处{\heiti 按住Shift键再点击书鼠标右键},选择“在此处打开命令窗口”,运行下列命令: % % \begin{shell} % makewin extract % \end{shell} % % \item Linux和Mac用户请在Bash窗口中进行如下操作: % % \begin{shell} % cd cquthesis % make cls % \end{shell} %\end{itemize} % % 即可完成\cquthesis 的升级。 % % \subsection{编译用户手册} % 如果您需要编译用户手册,请定位到解压后的文件夹: % \begin{itemize} % \item Windows用户请在文件夹空白处{\heiti 按住Shift键再点击书鼠标右键},选择“在此处打开命令窗口”,运行下列命令: % % \begin{shell} % makewin doc % \end{shell} % % \item Linux和Mac用户请在Bash窗口中进行如下操作: % % \begin{shell} % cd cquthesis % make doc % \end{shell} %\end{itemize} % % \note{关于make命令和makewin命令的更多用法,请使用help命令进行查询,Windows用户请在命令行中运行makewin help,Linux和Mac用户请打开\file{Makefile}文件查看。} % \section{使用说明} % \label{sec:usage} % 本手册假定用户已经能处理一般的 \LaTeX{} 文档,并对\BibTeX{} 有一定了解。如果从来没有接触过 \TeX 和 \LaTeX,建议先学习相关的基础知识。磨刀不误砍柴工! % % 对\LaTeX 还不熟悉的同学,推荐参考\href{http://bbs.ctex.org/forum.php?mod=viewthread&tid=68619}{《\LaTeX{}学习笔记》}。 % % % \subsection{代码自动补全} % \cquthesis 为支持代码自动补全的\LaTeX 编辑器提供了代码补全配置文件\file{cquthesis.cwl}。如果您的编辑器有代码补全功能(如\TeX Studio),那么您可以将\file{cquthesis.cwl}放置在编辑器可以识别的位置,即可享受代码着色和代码自动补全带来的便利。 % % 支持代码补全功能的编辑器有很多种,这里无法一一枚举,关于\file{cquthesis.cwl}的放置位置,请使用搜索引擎查找答案。推荐的关键词:“您的编辑器名称”+ cwl + location。 % % 对于Windows平台的\TeX Studio用户,您可使用【Win+R】快捷键打开“运行”,在其中输入: % % \begin{shell} % %APPDATA%\texstudio\completion\user % \end{shell} % % 然后在打开的文件夹中放入\file{cquthesis.cwl},重启\TeX Studio即可。Linux和Mac的\TeX Studio用户可参照这个思路进行操作。 % % \subsection{示例文件} % \cquthesis 是一个功能高度专门化的文档类,没有示例文档的用户会发现很难下手。推荐新用户从模板自带的示例文档入手,里面包括了论文写作用到的所有命令及其使用方法,只需要用自己的内容进行相应替换就可以。对于不清楚的命令可以查阅本手册。下面的例子描述了模板中章节的组织形式,来自于示例文档,具体内容可以参考模板附带的 \file{main.tex} 和 \file{contents/}。 % % 您可以在您熟悉的IDE(写作环境)中对\file{main.tex}进行编译,推荐使用\XeTeX 进行编译,一般来说,\LaTeX 的编译原则就是多次运行编译命令,直到不再出现警告。这里提供命令行编译方法供您参考: % % \begin{shell} % # 示意:定位到文件夹 % cd cquthesis % # 1.发现文件中的引用关系,文件后缀\textsf{.tex}可省略 % xelatex main % # 2.编译参考文件源文件,生成\textsf{.bbl}文件 % bibtex main % # 3.解决文件中的交叉引用 % xelatex main % # 4.生成完整的pdf文件 % xelatex main % # 5.更新目录 % xelatex main % \end{shell} % % \note{实际情况中,您只需使用make或者makewin就可以自动完成以上所有工作\footnote{make和makewin调用latexmk来完成编译工作,比示意的编译命令更加灵活,能够自主确定必要的编译次数,可以明显缩短编译时间。}。} % % 下面是示例文件中主文件\file{main.tex}的内容: % % \lstinputlisting[style=lstStyleLaTeX]{main.tex} % % \subsection{论文选项} % \DescribeOption{type=} % 选择论文类型,必须项,当前支持:\option{bachelor},\option{master},\option{doctor}。如: % \begin{latex} % % 博士论文 % \documentclass[type=doctor,]{cquthesis} % % % 硕士论文 % \documentclass[type=master,]{cquthesis} % \end{latex} % % \DescribeOption{liberalformat} % 本科生可选,开启后将使用文学类标题格式,使用中文数字对各级标题进行计数,本选项默认关闭。 % % \note{以下所有可选项在不使用时自动取默认值。} % % \DescribeOption{proffesionalmaster=} % 研究生可选,值为\textsf{true}时按专业硕士要求排版(影响封面),值为\textsf{false}时按学术硕士要求排版,默认值为\textsf{false},例如: % \begin{latex} % % 学术硕士论文 % \documentclass[type=master,proffesionalmaster=false,]{cquthesis} % % 上面相当于: % \documentclass[type=master,]{cquthesis} % % % 专业硕士论文 % \documentclass[type=master,proffesionalmaster=true,]{cquthesis} % \end{latex} % \DescribeOption{printmode=} % 可选项,确定单双页打印模式,有三个值可用,默认采用自动判定(auto): % \begin{description} % \item[\option{auto}] 模板会按照学校要求和论文类型自动判定打印模式; % \item[\option{oneside}] 强制以单页模式打印,适合最后提交电子版时; % \item[\option{twoside}] 强制以双页模式打印。 % \end{description} % % \DescribeOption{bilinguallist=} % 从版本v1.12开始,\cquthesis 开始支持图、表、公式的中英双语题注。除此之外,就像您期待的那样,表录、图录、公式目录页有了自己的英文版本,它们全部按双语题注的内容自动生成。这是一个可选项,有三个值可用: % \begin{description} % \item[\option{off}] 缺省默认,模板不会生成表录、图录、公式目录的英文版本; % \item[\option{combined}] 模板会生成表录、图录、公式目录的英文版本,它们会在中文版本中逐条嵌入; % \item[\option{apart}] 模板会生成表录、图录、公式目录的英文版本,它们独立于中文版本,与其一同输出。 % \end{description} % % 有关双语题注的用法和英文版本表录等文档部件的位置调整方式,请参阅第\ref{sec:bicaptions}节。 % % \note{以上三个选项仅与表录、图录、公式目录相关,不会影响双语题注的功能。} % % \DescribeOption{openany} % \DescribeOption{openright} % 正规出版物的章节出现在奇数页,也就是右手边的页面,这就是 \option{openright},在这种情况下,如果前一章的最后一页也是奇数,那么模板会自动生成一个空白页以保证新章节右开。这个选项适合页数较多的论文,您可根据实际情况和个人喜好选择是否开启。默认值\option{openright},本选项在单页打印时自动失效。 % % \DescribeOption{blankleft} % 开启此项,并且在 \option{openright}开启的情况下,模板生成的空白页纯粹空白,不含页眉页脚,本选项默认关闭。 % % \DescribeOption{seriftoc} % 开启此项,目录中的不同级别会采用不同的字号和字体,这是按照学校word样例的实现。但是,蹊跷的是,样例里的这些做法在官方文件里却没有体现,而且一二级标题字号差别太大,个人观点有碍美观,所以这里列为可选项,适用于三级标题很多的情况。本选项默认关闭。 % % \DescribeOption{continuoustoc} % 使用后论文的目录和索引不会自动开启新页,转而以连续的形式编排,这个选项适合索引内容较少但又想使用索引的用户。在开启后,您可能需要在\file{main.tex}中使用\cs{clearpage}来对索引部分进行手动分页。本选项默认关闭。 % % \DescribeOption{abstractopenright} % 开启此项,双页打印模式时中英文摘要右开,这算是开发中的一个彩蛋。本选项默认关闭。 % % \DescribeOption{blindtrail} % 盲审模式开关,盲审模式由宏\cs{secretize}和环境\env{secretizeEnv}构成,在盲审模式开启时: % \begin{itemize} % \item 宏\cs{secretize}内的内容会被三个星号***替代; % \item 环境\env{secretizeEnv}的内容会输出为一片空白。 % \end{itemize} % \cquthesis 默认为封面作者及导师姓名配置宏\cs{secretize},为致谢的内容部分配置环境\env{secretize},如果您有更多需求,可以自行配置。 % % \DescribeOption{draft} % 草稿模式,推荐在写作时开启。这个模式下,\LaTeX 不会加载图片,不会渲染文档内超链接,部分宏包会跳过一些工作以降低编译难度,结合\cs{includeonly}命令可以大大提高预览速度,例如: % % \begin{latex} % % 这是代码片段 % \includeonly{contents/experiment,contents/analysis,} % \include{contents/intrduction} % \include{contents/experiment} % \include{contents/analysis} % \include{contents/conclusion} % \end{latex} % % 此时\LaTeX 只会渲染\file*{contents/experiment}和\file*{contents/analysis},从而加速预览。 % \subsection{中文字体} % \label{sec:chinese-fonts} % % \subsubsection{字体配置} % \label{sec:font-config} % 正确配置中文字体是使用模板的第一步。模板调用 \CTeX 宏包,提供如下字体使用方式: % \begin{itemize} % \item 基于传统 \pkg{CJK} 包,使用 \LaTeX、Pdf\LaTeX\ 编译。 % \item 基于 \pkg{xeCJK} 包,使用 \XeLaTeX\ 编译。(推荐方法) % \end{itemize} % % 模板默认使用 \CTeX 的字体配置。关于中文字体安装、配置的所有问题不在本模板讨论范围。 % % \subsubsection{字体命令} % \label{sec:fontcmds} % \myentry{字体} % \DescribeMacro{\songti} % \DescribeMacro{\fangsong} % \DescribeMacro{\heiti} % \DescribeMacro{\kaishu} % 用来切换宋体、仿宋、黑体、楷体四种基本字体。 % % \begin{latex} % {\songti 爆竹声中一岁除,春风送暖入屠苏。} % {\fangsong 家家乞巧望秋月,穿尽红丝几万条。} % {\heiti 黄沙百战穿金甲,不破楼兰终不还。} % {\kaishu 君不见走马川行雪海边,平沙莽莽黄入天。} % \end{latex} % % 效果如下: % % {\songti 爆竹声中一岁除,春风送暖入屠苏。}\space % {\fangsong 家家乞巧望秋月,穿尽红丝几万条。} % % {\heiti 黄沙百战穿金甲,不破楼兰终不还。}\space % {\kaishu 君不见走马川行雪海边,平沙莽莽黄入天。} % % \DescribeMacro{\zihao} % \cquthesis 使用\CTeX 的原生字体命令,使用中文字号: % \begin{latex} % \zihao{-4} % 后文使用小四号 % {\zihao{2} 使用二号字的段落} % 大括号外又回到小四号 % \end{latex} % % \subsection{封面信息和摘要} % \label{sec:titlepage} % \subsubsection{设置方法} % 封面信息提供两种配置方法:一是通过统一设置命令\cs{cqusetup} 通过\emph{key=value}形式完成;二是每个信息利用命令独立设置,其中命令的名字跟 \emph{key} 相同。两种方式可以交叉使用,并按顺序执行(即对同一项,后来的设置会覆盖前面的)。以 \texttt{c} 开头的命令跟中文相关,\texttt{e} 开头则为对应的英文。 % % \DescribeMacro{\cqusetup} % \cs{cqusetup} 用法与常见 \emph{key=value}命令相同,如下: % \begin{latex} % \cqusetup{ % key1 = value1, % key2 = {a value, with comma}, % } % % 可以多次调用 % \cqusetup{ % key3 = value3, % key1 = anothervalue, % 覆盖 value1 % } % \end{latex} % % \note{\cs{cqusetup} 使用 \pkg{kvoptions} 机制,所以配置项之间不能有空行,否则会报错。} % % 大多数命令的使用方法都是: \cs{command}\marg{arg},例外者将具体指出。这些命令都在示例文档的 \file{contents/cover.tex} 中。 % % \subsubsection{文章标题} % \DescribeMacro{\ctitle} % \DescribeMacro{\etitle} % 设置论文的中文标题和英文标题,标题中可以使用两个右斜杠进行手动换行。 % \begin{latex} % \ctitle{论文标题//这是标题的第二行//第三行//最好别有第四行} % \etitle{Title in English// the 2nd line} % % 以上命令和以下命令等价: % \cqusetup{ % ctitle={论文中文题目}, % etitle={Thesis English Title}, % } % \end{latex} % % \note{下文描述的所有命令都有和自己等价的\cs{cqusetup}形式,请留意。} % % \subsubsection{个人信息} % % \DescribeMacro{\cauthor} % \DescribeMacro{\eauthor} % 作者信息,其中英文信息使用拼音书写。 % % \DescribeMacro{\csupervisor} % \DescribeMacro{\esupervisor} % 导师的中英文信息,填写范例: % \begin{latex} % \cqusetup{ % csupervisor = {匡振义~~教授}, % 使用连字符来进行不会断行的空格 % esupervisor = {Prof. Zhenyi Kuang}, % }% % \end{latex} % % \DescribeMacro{\cpsupervisor} % \DescribeMacro{\epsupervisor} % 仅专硕填写,兼职导师姓名和拼音。 % % \note{在\file{cover.tex}中自己用不上的字段可以坐视不理、注释、删除(随你意)。模板在v 0.9.7 版本后更新了运作机制,\textbf{不再需要}主动注释掉不需要的字段以获得正确的封面排版。} % % \DescribeMacro{\cassistsupervisor} % \DescribeMacro{\cextrasupervisor} % \DescribeMacro{\eassistsupervisor} % 本科毕业设计中,有的同学会有助理指导老师或者在校外进行毕业设计(常见于保研的同学),这时需要在论文封面上标注自己的“助理指导教师”或“校外指导教师”。在使用时需要注意:1.这三个字段中,不使用的项目要求留空为正反大括号;2.“助理指导教师”和“校外指导教师”的英文都填写在\cs{eassistsupervisor}中,如果两类指导老师同时存在(这个情况太少了),可以使用正反大括号括起,括号内以逗号分隔。 % % \note{这是v 1.14 版本中的新增功能。} % % \DescribeMacro{\cmajor} % \DescribeMacro{\emajor} % 填写自己的专业名称,专硕不用这个字段。在专业名称太长的时候封面可能会不够美观,这时可以使用\cs{zihao}来调整这一个字段的字号大小。详情请见\file{cover.tex}。 % % \subsubsection{成文日期} % % \DescribeMacro{\mycdate} % \DescribeMacro{\myedate} % 自行指定封面的中英文成文日期。 % % 默认情况下,封面底部的中英文成文日期自动生成,如果您需要自行指定成文日期,请取消\file{cover.tex}中\cs{mycdate}和\cs{myedate}的注释,按参考格式填入日期。 % % \subsubsection{关键词和摘要} % \myentry{关键词} % \DescribeMacro{\ckeywords} % \DescribeMacro{\ekeywords} % 关键词用英文逗号分割写入相应的命令中,模板会解析各关键词并生成符合不同论文格式。 % 要求的关键词格式。 % % \begin{latex} % \cqusetup{ % ckeywords={关键词 1, 关键词 2}, % ekeywords={keyword 1, keyword 2} % } % % 等价: % \ckeywords{关键词 1, 关键词 2} % \ekeywords{keyword 1, keyword 2} % \end{latex} % % \myentry{摘要} % \DescribeEnv{cabstract} % \DescribeEnv{eabstract} % 摘要只能使用环境命令来设置,不支持\cs{cqusetup}。 % % \begin{latex} % \begin{cabstract} % 摘要请写在这里… % \end{cabstract} % % \begin{eabstract} % Here comes the abstract in English... % \end{eabstract} % \end{latex} % % \subsection{前置部分} % % 以下内容对应\file{main.tex}中的内容。 % \subsubsection{封面} % \DescribeMacro{\makecover} % 生成封面,包含中英文封面。 % % \myentry{开启前置部分} % \DescribeMacro{\frontmatter} % 前置部分标识符,其后的命令将被模板认作属于前置部分。前置部分包含封面后到绪论前的内容。 % % \DescribeMacro{\makeabstract} % 生成中英文摘要。 % % \subsubsection{目录和索引表} % 目录、插图、表格和公式等索引命令分别如下,将其插入到期望的位置即可: % % \DescribeMacro{\tableofcontents} % \DescribeMacro{\listoffigures} % \DescribeMacro{\listoftables} % \DescribeMacro{\listofequations} % \begin{longtable}{ll} % \toprule % {\heiti 用途} & {\heiti 命令} \\ % \midrule % 目录 & \cs{tableofcontents} \\ % 插图索引 & \cs{listoffigures} \\ % 表格索引 & \cs{listoftables} \\ % 公式索引 & \cs{listofequations} \\ % \bottomrule % \end{longtable} % % \LaTeX{} 默认支持插图和表格索引,是通过 \cs{caption} 命令完成的,因此它们必须出现在浮动环境中,否则不被计数。 % % \subsubsection{符号对照表} % \DescribeEnv{denotation} % 主要符号表环境,跟 \env{description} 类似,使用方法参见示例文件。带两个个可选参数,用来指定列表左侧缩进和列表左右距离。(全去掉时默认:20mm,30mm) % \begin{latex} % \begin{denotation} % \item[E] 能量 % \item[m] 质量 % \item[c] 光速 % \end{denotation} % \end{latex} % % 如果默认符号列的宽度不满意,可以通过参数来调整: % \begin{latex} % \begin{denotation}[10mm][40mm] % 左侧缩进10mm,左右距离40mm % \item[E] 能量 % \item[m] 质量 % \item[c] 光速 % \end{denotation} % \end{latex} % % \subsection{主体部分} % % \myentry{开启主体部分} % \DescribeMacro{\mainmatter} % 主体部分标识符,其后的命令将被模板认作属于主体部分。主体部分包含从绪论到结论的所有内容。 % % \DescribeMacro{\include} % 使用该命令从\file{contents/}中导入子文件,配合\cs{includeonly}\marg{子文件名}命令可加速预览。 % % \subsection{后置部分} % % \myentry{开启后置部分} % \DescribeMacro{\backmatter} % 后置部分标识符,其后的命令将被模板认作属于后置部分。后置部分包含从致谢开始的所有内容。 % % \myentry{致谢} % 致谢部分使用普通的\cs{chapter}命令创建即可。 % % \DescribeMacro{\bibliographystyle} % \DescribeMacro{\bibliography} % 定义参考文献样式,指定参考文献源。 % % 其中参考文献的\textsf{.bib文件}推荐使用\textsf{Jabref}来进行处理。 % % \note{如果您的文献资料来源于Web of Science一类的数据库导出,那么您很可能需要使用\textsf{Jabref}一类的文献bib数据管理工具对数据进行清理,以去除每个字段外围的双层花括号(目前已知DOI字段的双层括号会使得参考文献列表出现格式问题)。清理过程是自动而无害的。} % % % \DescribeMacro{\cquauthpage} % 生成原创说明和授权书,这个命令可以带一个\oarg{PDF文件地址}作为参数。这样,在您和您的导师签名之后,您可以单独扫描一下签过名的原创说明和授权书,以\cs{cquauthpage}\oarg{pdf文件地址}的形式将扫描页放入论文的PDF文件中的对应位置。 % % \subsection{宏包和特色功能} % \subsubsection{双语题注} % \label{sec:bicaptions} % \DescribeMacro{\bicaption} % 在学校的相关格式文件中,硕士生和博士生的表格和插图的题注需要中英对照,使用\cs{bicaption}\marg{中文题注}\marg{英文题注}命令代替\cs{caption}即可解决这个问题,示例如下: % % \begin{latex} % \begin{figure}[tbh] % \centering % \includegraphics[width=0.7\linewidth]{figures/TEST} % \bicaption{这是一张测试用图片}{This figure is for test only} % \label{fig:cqubadge} % \end{figure} % \end{latex} % % 在题注很长的时候,为了防止题注对应的表录(或图录)的条目太长,可使用\cs{bicaption}\oarg{短中文}\marg{中文题注}\oarg{短英文}\marg{英文题注}来解决这个问题: % \begin{latex} % \begin{tabularx}{cc} % \bicaption[这是表录中的段条目]{这是一个很长很长很长的中文题注,你可以写很多行}% % [This is a really short one.]{Linebreak is for demostration only. It's okay to go without it.} % \label{fig:cqubadge} % 我 & 在\\ % 测 & 试\\ % \end{tabularx} % \end{latex} % \DescribeMacro{\eqlist} % 重要算式列表\cs{eqlist}和\cs{listeq}命令从v1.12版本后也支持中英双语,用法是\cs{eqlist}\marg{中文}\oarg{英文},请注意括号。 % % 上面的这些用法都在\cquthesis 的示例文件中有所体现,供您参考。 % % \note{英文版本的重要算式列表需要在\option{bilinguallist=}\option{combined}或者\option{apart}时才会生效。另外,当且仅当在\option{bilinguallist=}\option{apart}时,\file{main.tex}中的\cs{listoffiguresEN},\cs{listoftablesEN}和\cs{listofequationsEN}才会发挥作用,此时您可以通过调整这些命令的位置来调整图录、表录、方程式列表各自之间以及中英文版本之间的顺序。} % \subsubsection{数学环境} % \label{sec:math} % \cquthesis{} 定义了常用的数学环境: % % \begin{center} % \begin{tabular}{*{7}{l}}\toprule % axiom & theorem & definition & proposition & lemma & conjecture &\\ % 公理 & 定理 & 定义 & 命题 & 引理 & 猜想 &\\\midrule % proof & corollary & example & exercise & assumption & remark & problem \\ % 证明 & 推论 & 例子& 练习 & 假设 & 注释 & 问题\\\bottomrule % \end{tabular} % \end{center} % % 比如: % \begin{latex} % \begin{definition} % 道千乘之国,敬事而信,节用而爱人,使民以时。 % \end{definition} % \end{latex} % 产生(自动编号): % \medskip % % \noindent\framebox[\linewidth][l]{{\heiti 定义~1.1~~~} % {道千乘之国,敬事而信,节用而爱人,使民以时。}} % % \smallskip % 列举出来的数学环境毕竟是有限的,如果想用\emph{胡说}这样的数学环境,那么可以定义: % \begin{latex} % \newtheorem{nonsense}{胡说}[chapter] % \end{latex} % % 然后这样使用: % \begin{latex} % \begin{nonsense} % 契丹武士要来中原夺武林秘笈。—— 慕容博 % \end{nonsense} % \end{latex} % 产生(自动编号): % % \medskip % \noindent\framebox[\linewidth][l]{{\heiti 胡说~1.1~~~} % {契丹武士要来中原夺武林秘笈。—— 慕容博}} % % \subsubsection{引用方式} % % \DescribeMacro{\inlinecite} % \DescribeMacro{\onlinecite} % 参考文献引用有两种模式:(1)上标模式。比如``同样的工作有多$^{[1,2]}$\ldots''。(2)正文模式。比如``文[3]中详细说明了\ldots''。其中上标模式使用远比正文模式频繁,所以为了符合使用习惯,上标模式仍然用常规的\cs{cite}\marg{key},而\cs{inlinecite}\marg{key} 则用来生成正文模式。 % % 出于易用性考虑,\cs{onlinecite}被安排为\cs{inlinecite}的别名,两者的作用完全一致,可相互替换。 % % \subsubsection{自动编号} % % \DescribeMacro{\xuhao} % \DescribeMacro{\xuhaotype} % \DescribeMacro{\resetxuhao} % \DescribeMacro{\xuhaoseparator} % \DescribeMacro{\rownum} % \DescribeMacro{\rownumtype} % \DescribeMacro{\resetrownum} % \DescribeMacro{\rownumseparator} % \cs{xuhao}命令用来解决表格序号列手动编号的烦恼,这个命令也可以用在行内列表等场景,其中: %\begin{itemize} % \item \cs{xuhao}\oarg{1}用于将计数器设置为1,并输出1; % \item \cs{xuhao}不带参数时每次使用将计数器加1,并输出这个值; % \item \cs{xuhaotype}\oarg{1-6}可设置\cs{xuhao}的输出类型,1--6分别为阿拉伯数字、大写字母、小写字母、大写罗马数字、小写罗马数字、带圈数字(这一项仅支持1--10的数) % \item \cs{resetxuhao}用于重置计数器为1,但不作输出; % \item \cs{xuhaoseparator}用于定义每个序号之后的分割符,默认为空,您可以使用\cs{renewcommand}来更新其定义。 %\end{itemize} % % \begin{latex} % \xuhaotype[3] % \renewcommand{\xuhaoseparator}{.} % \xuhao[1] \xuhao \xuhao \xuhao[1] \xuhao \xuhao \xuhao \xuhao % % 输出为:a. b. c. a. b. c. d. e. % \end{latex} % % \note{考虑到不同用户的语言习惯,\cs{rownum}, \cs{rownumtype}, \cs{resetrownum}分别是\cs{xuhao}, \cs{xuhaotype}, \cs{resetxuhao}的别名,可以相互替换。} % % 向前兼容:老旧命令\cs{setxuhao}和\cs{xuhaotype}的作用相同。 % % \subsubsection{表格命令} % 在表格中,\cs{bigcell}内的内容可以自主换行;\cs{headcell}括起的内容会在单元格中居中和加黑;\cs{colsep}用来设定列间距,默认值为12pt,这个命令在表格开始绘制之前有效。 % % 使用范例请参阅示例文档的附录部分。 % % 本模板已经自动载入了许多表格相关的宏包: % \begin{itemize} % \item 如果您是熟练的\LaTeX 用户,\pkg{array}, \pkg{tabularx}, \pkg{booktabs}, \pkg{longtable}, \pkg{multirow}和\pkg{diagbox}会是您得力的助手,其中,\pkg{tabularx}和\pkg{longtable}的字号已经预先适配为五号字; % \item \cquthesis 还预先载入了\pkg{tabu}宏包,如果您熟悉这个宏包,或者愿意负担一些学习成本,那么\pkg{tabu}宏包的强大功能会让您满意。 % \end{itemize} % % \subsection{其他说明} % 本文档的最后一节有宏索引,对中阶及以上用户或许会有帮助。 % % \subsection{提问和新功能需求}\label{sec:howtoask} % 遇到难以解决的问题了?欢迎您向我反馈,您可以: % \begin{itemize} % \item 在Github上\href{https://github.com/nanmu42/cquthesis/issues}{提交Issue}; % \item 加入\href{http://jq.qq.com/?_wv=1027&k=2HvYu95}{重庆大学\TeX 用户组}进行讨论\footnote{即使您不是重庆大学的学子,只要您对\TeX 足够热爱并且为人友善,我们也会热诚地欢迎您。}。 %\end{itemize} % % 大家的反馈为模板提高带来机会。 % \section{致谢} % 这个模板是站在巨人肩膀上的成果,感谢\LaTeXe{}计划,感谢CTeX开发组提供的中文解决方案,感谢薛瑞尼副教授(Github: xueruini/ThuThesis),感谢WeiJianWen同学(Github: weijianwen/SJTUThesis),感谢中国科学技术大学TeX用户组(Github: ustctug/gbt-7714-2015)。向你们致以真诚的问候和感激! % % 世界因你们更美好。 % % \StopEventually{\PrintChanges\PrintIndex} % \clearpage % \section{实现细节} % 下面这些内容面向\LaTeX 宏包开发者或者对\cquthesis 开发感兴趣的用户,如果您有任何意见或建议或想法,都欢迎到Github\href{https://github.com/nanmu42/cquthesis/issues}{提交Issue}。您对模板开发或者本文档的撰写的任何贡献都会受到诚挚欢迎! % \subsection{模板信息} % \begin{macrocode} %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesClass{cquthesis} %\ProvidesFile{cquthesis.cfg} %[2019/10/12 v1.40 Chongqing University Thesis Template] % \end{macrocode} % 定义一些开发常量: % \begin{macrocode} %<*cls> \hyphenation{Cqu-Thesis} \newcommand{\cquthesis}{\textsc{CquThesis}} \def\version{1.30} % % \end{macrocode} % \file{cquthesis.cfg}中,涉及文档部件的部分常量: % \changes{v0.9.0}{2016/05/16}{把目录加入到了PDF书签中。} % \begin{macrocode} %<*cfg> \def\cqueqshortname {式} \def\cqu@denotation@name {主要符号对照表} \def\shorttablename {表} \def\shorttablenameEN {Table} \def\shortfigurename {图} \def\shortfigurenameEN {Fig.} \def\listofequationsname {重要算式索引} \def\listofequationsnameEN {\textbf{List of Equations}} \def\listoffiguresnameEN {\textbf{List of Figures}} \def\listoftablesnameEN {\textbf{List of Tables}} \def\cqu@bib@name {参考文献} \def\cqu@tocnameinbkmark {目{ }录} \newcommand{\parenthesesthis}[1]{(#1)} % % \end{macrocode} % \subsection{选项的定义和处理} % 使用Key=Value方式进行选项设置,定义前缀和族。 % \begin{macrocode} %<*cls> \RequirePackage{kvoptions} \SetupKeyvalOptions{ family=cqu, prefix=cqu@, setkeys=\kvsetkeys} % \end{macrocode} % 定义用户类型 % \begin{macrocode} \newif\ifcqu@bachelor \newif\ifcqu@master \newif\ifcqu@doctor \cqu@bachelorfalse\cqu@masterfalse\cqu@doctorfalse \define@key{cqu}{type}{% \expandafter\csname cqu@#1true\endcsname} % \end{macrocode} % 定义是否使用本科文学类论文标题格式 % \begin{macrocode} \DeclareBoolOption{liberalformat} % \end{macrocode} % 专业硕士标记 % \begin{macrocode} \DeclareBoolOption[true]{academic} \DeclareComplementaryOption{proffesionalmaster}{academic} % \end{macrocode} % 每个章首页是否右开 % \begin{macrocode} \DeclareBoolOption[false]{openany} \DeclareComplementaryOption{openright}{openany} % \end{macrocode} % 右开时空白的左页是否让页眉页脚空白 % \begin{macrocode} \DeclareBoolOption[false]{blankleft} % \end{macrocode} % 双页模式下英文摘要页右开 % \begin{macrocode} \DeclareBoolOption[false]{abstractopenright} % \end{macrocode} % 盲审模式开关 % \begin{macrocode} \DeclareBoolOption[false]{blindtrail} % \end{macrocode} % 论文是单面打印还是双面打印(默认:自动,手动模式一般不用) % \begin{macrocode} \newif\if@onesideprint \newif\if@twosideprint \newif\if@autoprint \@onesideprintfalse\@twosideprintfalse\@autoprintfalse \define@key{cqu}{printmode}{% \expandafter\csname @#1printtrue\endcsname} % \end{macrocode} % 论文是否保密(默认:关),尚未支持,在计划中 % \begin{macrocode} \DeclareBoolOption[false]{secret} % \end{macrocode} % 目录中的不同级别采用不同的字号和字体,适用于三级标题很多的情况 % \begin{macrocode} \DeclareBoolOption[false]{seriftoc} % \end{macrocode} % 目录和索引不会自动新开一页,适用于索引内容较少时 % \begin{macrocode} \DeclareBoolOption{continuoustoc} % \end{macrocode} % 双语图录、表录、公式列表开关 % \begin{macrocode} \newif\if@bioff \newif\if@bicombined \newif\if@biapart \@biofffalse\@bicombinedfalse\@biapartfalse \define@key{cqu}{bilinguallist}{% \@biofffalse\@bicombinedfalse\@biapartfalse \expandafter\csname @bi#1true\endcsname} % \end{macrocode} % 传递选项给CTeXBook % \begin{macrocode} \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}} % \end{macrocode} % 打开默认选项,处理选项 % \begin{macrocode} \kvsetkeys{cqu}{} \ProcessKeyvalOptions* \PassOptionsToPackage{no-math}{fontspec} % \end{macrocode} % 为CTeXBook定义选项,使用CTeX原生的的Openright和Openany解决方案: % \begin{macrocode} \ifcqu@openany \LoadClass[openany,a4paper,oneside,UTF8,zihao=-4,scheme=plain,linespread=1.39,space=auto]{ctexbook} \else \LoadClass[openright,a4paper,oneside,UTF8,zihao=-4,scheme=plain,linespread=1.39,space=auto]{ctexbook} \fi % \end{macrocode} % 用户必须提供用户类型: % \begin{macrocode} \ifcqu@bachelor\relax\else \ifcqu@master\relax\else \ifcqu@doctor\relax\else \ClassError{cquthesis}% {Specified thesis type is obligatory: \MessageBreak type=[bachelor|master|doctor]}{} \fi \fi \fi % \end{macrocode} % 如果没有指定合适的打印方式则缺省使用自动模式 % \begin{macrocode} \if@autoprint\relax\else \if@onesideprint\relax\else \if@twosideprint\relax\else \ClassWarning{cquthesis}% {Unexpected or missing print mode, processing with AUTO: \MessageBreak printmode=[oneside|twoside|auto]}{} \@autoprinttrue \fi \fi \fi % \end{macrocode} % 如果没有正确指定图录表录的双语模式,取默认值off: % \begin{macrocode} \if@bioff\relax\else \if@bicombined\relax\else \if@biapart\relax\else \kvsetkeys{cqu}{bilinguallist=off,} \ClassWarning{cquthesis}% {Unexpected or missing bilingual list mode, processing with OFF: \MessageBreak bilinguallist=[off|combined|apart]}{} \fi \fi \fi % \end{macrocode} % \subsection{载入宏包} % % 使用成熟的宏包而不是自己造轮子几乎总是一个不错的选择,\LaTeX 的强大之处就在这诸多宏包。 % % 这几个宏包用于提升\LaTeXe 的命令定义和命令处理性能 % \begin{macrocode} \RequirePackage{etoolbox} \RequirePackage{xparse} \RequirePackage{environ} \RequirePackage{calc} \RequirePackage{ifxetex} % \end{macrocode} % % 数学是\LaTeX 关心的大问题,这里先引入\pkg{amsmath}宏包,避免一些载入顺序引发的问题: % \begin{macrocode} \RequirePackage{fontspec} \RequirePackage{amsmath} \RequirePackage{amssymb} \RequirePackage{amsfonts} % \end{macrocode} % % 一些字体相关的宏包: % \begin{macrocode} \RequirePackage[defaultsups]{newtxtext} \RequirePackage{pifont} \RequirePackage{xeCJKfntef} % \end{macrocode} % % 解决各种文档部件需求,如表格、题注、插图等 % \changes{v0.9.41}{2016/05/25}{修正了\pkg{tgcursor}使\cs{textbf}失效的Bug,现在起使用\pkg{courier}代替。} % \changes{v1.12}{2016/07/06}{得益于\pkg{caption}和\pkg{bicaption}和\pkg{newfloat}三个宏包,\cquthesis 支持双语题注了。} % \begin{macrocode} \RequirePackage{newfloat} \RequirePackage{caption} \RequirePackage[labelformat=simple]{subcaption} \RequirePackage{bicaption} \RequirePackage{array} \RequirePackage{tabularx} \RequirePackage{booktabs} \RequirePackage{longtable} \RequirePackage{multirow} \RequirePackage{diagbox} \RequirePackage{tabu} \RequirePackage{courier} \RequirePackage{graphicx} \RequirePackage{pdfpages} \RequirePackage[shortlabels,inline]{enumitem} \RequirePackage[amsmath,thmmarks,hyperref]{ntheorem} % \end{macrocode} % % 解决页面类问题和脚注,其中\pkg{varwidth}用来代替老版本中的\pkg{pbox}。\pkg{xcolor}用来提供色彩支持,\pkg{metalogo}用来提供\cs{XeTeX}等命令支持。 % \begin{macrocode} \RequirePackage{changepage} \RequirePackage{afterpage} \RequirePackage[bottom,perpage,hang,symbol*]{footmisc} \raggedbottom \RequirePackage{varwidth} \RequirePackage{xcolor} \RequirePackage{metalogo} \RequirePackage{xspace} % \end{macrocode} % % 参考文献格式和优化: % \begin{macrocode} \RequirePackage[numbers,square,comma,super,sort&compress]{natbib} % \end{macrocode} % % \changes{v0.9.7}{2016/06/09}{目录、图录和表录的章节间隔不再突兀了。} % 删除默认模板(\file{book.cls})在章之间引入的垂直间隔。要放在\pkg{hyperref}之前才会生效。 % \begin{macrocode} \patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{} % lof \patchcmd{\@chapter}{\addtocontents{lot}{\protect\addvspace{10\p@}}}{}{}{} % lot % \end{macrocode} % % 文档超链接 % \begin{macrocode} \RequirePackage[hyperfootnotes=false,]{hyperref} % \end{macrocode} % % 配置超链接 % \begin{macrocode} \hypersetup{% linktoc=all, bookmarksnumbered=true, bookmarksopen=true, bookmarksopenlevel=1, breaklinks=true, colorlinks=false, plainpages=false, pdfborder=0 0 0} \urlstyle{same} % \end{macrocode} % % 对\XeTeX 进行专门配置,解决一些字体问题: % \begin{macrocode} \ifxetex \def\CJK@null{\kern\CJKnullspace\Unicode{48}{7}\kern\CJKnullspace} \defaultfontfeatures{Mapping=tex-text} \fi \RequirePackage{tocloft} \ifxetex \hypersetup{% CJKbookmarks=true} \else \hypersetup{% unicode=true, CJKbookmarks=false} \fi % \end{macrocode} % % \subsection{页面类设置} % \subsubsection{页面功能} % \begin{macro}{\cleardoublepage} % 首页右开的时候,全空的左页不留页眉页脚,这个功能受blankleft开关影响 % \begin{macrocode} \let\cqu@cleardoublepage\cleardoublepage \renewcommand{\cleardoublepage}{% \clearpage{\ifcqu@blankleft\pagestyle{style@empty}\fi\cqu@cleardoublepage} }%\cleardoublepage % \end{macrocode} % \end{macro} % \begin{macro}{\cqu@addblankpage} % 用来在强制完成空页工作,注意这里的pagestyle调整范围在花括号之内,这个功能受blankleft开关影响 % \begin{macrocode} \newcommand\cqu@addblankpage{% \afterpage{% {\null\ifcqu@blankleft\pagestyle{style@empty}\fi\clearpage}}} % \end{macrocode} % \end{macro} % % \subsubsection{论文的三个部分} % \begin{macro}{\frontmatter} % \begin{macro}{\mainmatter} % \begin{macro}{\backmatter} % \changes{v0.9.0}{2016/05/16}{修正了不该编号的致谢页眉。} % 用来在\file{main.tex}中开启不同的文章部分:前置、主体、后置 % \begin{macrocode} \newif\if@backmatter \renewcommand{\frontmatter}{% \@backmatterfalse \cleardoublepage \pagenumbering{Roman} \pagestyle{style@normal} \ctexset{chapter/numbering = false,} } \renewcommand{\mainmatter}{% \@backmatterfalse \cleardoublepage \pagenumbering{arabic} \pagestyle{style@normal} \ctexset{chapter/numbering = true,} } \renewcommand{\backmatter}{% \@backmattertrue \cleardoublepage \ctexset{chapter/numbering = false, section/number = \Alph{section}, section/name = {,.}, subsection/number = \CTEXthesection{}\arabic{subsection},}% \setcounter{chapter}{0} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsubsection{页面设置} % 定义页面,页眉页脚,先建立页面环境,完成分页再决定单双面打印 % \changes{v1.20}{2017/05/30}{页眉页脚高度以及垂直间距向Word版本靠拢。} % \begin{macrocode} \RequirePackage{geometry} \geometry{ a4paper, ignoreall, nomarginpar, inner=25mm, outer=25mm, top=30mm, bottom=28mm, bindingoffset=10mm, head=16mm, headsep=11mm, foot=12mm, footnotesep=5mm} % \end{macrocode} % % \subsubsection{单双页打印的自动判定} % 重庆大学的单双面打印和论文实际页数有关,此处读取前置部分后的最大页码,自动判断是否需要双面打印。很有趣,本科生70页想要双面打印比硕士生60页还难。此处立flag用来配合\cs{cqu@addblankpage} % \begin{macrocode} \RequirePackage{totcount} \regtotcounter[auxfile=maxpage.aux]{page} \if@autoprint \ifcqu@bachelor \ifnum\totvalue{page}>70 \@twosideprinttrue\else\@onesideprinttrue\fi \else \ifnum \totvalue{page}>60 \@twosideprinttrue\else\@onesideprinttrue\fi \fi \fi % \end{macrocode} % % 在log中记录下打印模式: % \begin{macrocode} \if@onesideprint \ClassWarning{cquthesis}{Printing under oneside mode.}{} \else \if@twosideprint \geometry{twoside} \ClassWarning{cquthesis}{Printing under twoside mode.}{} \fi \fi % \end{macrocode} % % \subsubsection{页眉和页脚} % 页眉页脚共有三种模式: 1. 页眉页脚全空(用于标题页、主体部分另页右开等);2. 用来修正双页打印时的页眉遮挡问题(右开的索引页眉不再是\cs{cqu@thesisname});3. 页眉页脚齐全(用于一般正文页面,这里自动判定用户类型和打印单双面)。 % % 定制页眉页脚模式,全部以style@开头。 % \begin{macrocode} \RequirePackage{fancyhdr} \fancypagestyle{style@empty}{% \fancyhf{} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}} \fancypagestyle{style@fixhead}{% \fancyhead{} \fancyhead[C]{\zihao{-5}\songti\leftmark} \fancyfoot{} \fancyfoot[C]{\zihao{-5}\thepage} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0pt}} \fancypagestyle{style@normal}{% \fancyhead{} \if@twosideprint \fancyhead[EC]{\zihao{-5}\songti\cqu@thesisname} \fancyhead[OC]{\zihao{-5}\songti\leftmark} \else \fancyhead[L]{\zihao{-5}\songti\cqu@thesisname} \fancyhead[R]{\zihao{-5}\songti\leftmark} \fi \fancyfoot{} \fancyfoot[C]{\zihao{-5}\thepage} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0pt}} % \end{macrocode} % \begin{macro}{\cqu@fixhead} % 修正页眉遮挡,这个命令要在标题生成的地方使用 % \begin{macrocode} \newcommand{\cqu@fixhead}{% \if@twosideprint %仅双页打印需要修正 \checkoddpage \ifoddpage\relax\else \thispagestyle{style@fixhead} \fi \fi }%\cqu@fixhead % \end{macrocode} % \end{macro} % 修正fancyhdr的问题,同时让页眉不显示第0章的编号: % \begin{macrocode} \AtBeginDocument{% \pagestyle{style@empty} \renewcommand{\chaptermark}[1]{% \ifnum\value{chapter}>0% \@mkboth{\CTEXthechapter\hskip\ccwd#1}{}% \else \@mkboth{#1}{}% \fi}}%\chaptermark % \end{macrocode} % % \subsection{段落设置} % LaTeX使用\cs{if@afterindent}来决定要不要让标题后的第一个自然段缩进,中文环境下好像并没有个人喜好之类的问题,我们这里让它一直为True。 % \begin{macrocode} \let\@afterindentfalse\@afterindenttrue \@afterindenttrue % \end{macrocode} % 每个自然段之间空1/10行距,增加可读性 % \begin{macrocode} \setlength{\parskip}{0.1\baselineskip} % \end{macrocode} % 全文首行缩进两字符,全角标点,去掉列表中项目之间的额外间隔(enumitem) % \begin{macrocode} \ctexset{% punct=quanjiao, autoindent=true, space=auto} \setlist{ nosep, itemjoin = {{;}} }%setlist % % \end{macrocode} % % \subsection{各级标题} % 各级标题设置,使用\option{fixskip}来抑制三级和四级标题的额外间距。这里的\option{beforeskip}和\option{afterskip}是与Word样例对比后通过尝试得出的。 % \changes{v1.16}{2016/12/07}{去除了三级和四级标题的额外垂直间距。} % \begin{macrocode} %<*cfg> \ctexset{% chapter = {% pagestyle = style@normal, name = {}, format = \sffamily\heiti\centering, nameformat = \zihao{3}, titleformat = \zihao{3}, aftername = \hskip\ccwd, number = {\ifcqu@liberalformat\chinese{chapter}\else\thechapter\fi}, beforeskip = 13bp, afterskip = 24bp, }, section = {% name = {}, format = \sffamily\heiti\raggedright, nameformat = \bfseries\zihao{-3}, titleformat = \zihao{-3}, aftername = \hskip\ccwd, number = {\ifcqu@liberalformat\parenthesesthis{\chinese{section}}\else\thesection\fi}, beforeskip = 24bp plus 1ex minus .2ex, afterskip = 6bp plus .2ex, }, subsection = {% name = {}, format = \sffamily\heiti\raggedright, nameformat = \bfseries\zihao{4}, titleformat = \zihao{4}, aftername = \hskip\ccwd, number = {\ifcqu@liberalformat\arabic{subsection}\else\thesubsection\fi}, beforeskip = 12bp plus 1bp, afterskip = 10bp, fixskip = true, }, subsubsection = { name = {}, runin = false, indent = \parindent, aftertitle = {}, numbering = true, number = {\ifcqu@liberalformat\parenthesesthis{\arabic{subsubsection}}\else\@circlenum{subsubsection}\fi}, numberformat+ = {\ifcqu@liberalformat\relax\else\zihao{4}\fi}, beforeskip = 10bp plus .5bp, afterskip = 10bp, fixskip = true, }, appendix = {% numbering = false, name = {}, }, % \end{macrocode} % 出于各级标题间区分度的考虑,不支持五级及以上的标题: % \begin{macrocode} paragraph = { name = {}, runin = true, aftertitle = {\ClassError{cquthesis}% {Level-5 and below sections are unsupported intentionally.}{}}, beforeskip = 1ex plus 0.5ex minus .2ex, afterskip = 1em, }, subparagraph = { name = {}, runin = true, indent = \parindent, indent = 0pt, aftertitle = {\ClassError{cquthesis}% {Level-5 and below sections are unsupported intentionally.}{}}, beforeskip = 1ex plus 0.5ex minus .2ex, afterskip = 1em, }, appendixname=附录, contentsname={目\hskip\ccwd 录}, listfigurename={插图索引}, listtablename={表格索引}, figurename=图, tablename=表, bibname=参考文献, indexname=索引, } % % \end{macrocode} % % \subsection{文档部件} % \subsubsection{带圈数字} % \begin{macro}{\@circlenum} % \changes{v0.8.9}{2016/05/15}{修正了\cs{@circlenum}无法在嵌套在\env{minipage}中的表格中正常运作的问题,问题原因没有具体查清,但是使用\pkg{footmisc}另外造轮子过了。清华的模板也有这个问题,已提交Issue协助修正。} % 带圈数字功能,最多处理10个。注意这里\cs{@circlenum}要接受的是\textsf{counter}里的值,所以需要\cs{value}来处理,如果用数字直接做\cs{@circlenum}的参数,要去掉\cs{value}才能编译通过,另外,\cs{ding}接受的参数为字符串,所以这里要用上\cs{the}。 % % 这个命令用于生成第四级标题。 % \begin{macrocode} %<*cls> \def\@circlenum#1{% \ifnum \value{#1} >10 \ClassError{cquthesis}% {More than 10 subsubsections in a subsection cannot be handled.}{} \fi \ding{\the\numexpr\value{#1}+171\relax}% } % \end{macrocode} % \end{macro} % % \subsubsection{脚注} % 设置分割线、字号和悬挂缩进 % \begin{macrocode} \def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@} \let\cqu@footnotesize\footnotesize \renewcommand{\footnotesize}{\cqu@footnotesize\zihao{-5}} \footnotemargin1.5em\relax % \end{macrocode} % % 脚注部分将标注换为正文大小,这个过程是动态的: % \begin{macrocode} \let\cqu@makefnmark\@makefnmark \def\cqu@@makefnmark{\mbox{{\normalfont\@thefnmark}}} \pretocmd{\@makefntext}{\let\@makefnmark\cqu@@makefnmark}{}{} \apptocmd{\@makefntext}{\let\@makefnmark\cqu@makefnmark}{}{} % % \end{macrocode} % footmisc定义新脚注symbol,minipage需要额外定义一行,脚注不能大于10 % \begin{macrocode} %<*cfg> \DefineFNsymbols{cqufnsymbol}{ {\ding{172}} {\ding{173}} {\ding{174}} {\ding{175}} {\ding{176}} {\ding{177}} {\ding{178}} {\ding{179}} {\ding{180}} {\ding{181}} }%cqufnsymbol \setfnsymbol{cqufnsymbol} \renewcommand\thempfootnote{\fnsymbol{mpfootnote}} \pretocmd{\thefootnote}{% \ifnum \value{footnote} >10 \ClassError{cquthesis}% {More than 10 footnotes in a single page are not supported.}{} \fi }{}{} \pretocmd{\thempfootnote}{% \ifnum \value{mpfootnote} >10 \ClassError{cquthesis}% {More than 10 footnotes in a single page are not supported.}{} \fi }{}{} % % \end{macrocode} % % \subsubsection{数学公式和定理环境} % 数学公式断行 % \begin{macrocode} %<*cls> \allowdisplaybreaks[4] \let\cqu@tagform@\tagform@ \renewcommand{\eqref}[1]{\cqueqshortname\textup{(\ref{#1})}} % \end{macrocode} % % 定理环境 % \begin{macrocode} \theorembodyfont{\rmfamily\songti} \theoremheaderfont{\rmfamily\heiti} % % \end{macrocode} % % 定理环境中文定义在.cfg中完成 % \begin{macrocode} %<*cfg> \theoremsymbol{\ensuremath{\ding{110}}} \newtheorem*{proof}{证明} \theoremstyle{plain} \theoremsymbol{} \theoremseparator{:} \newtheorem{assumption}{假设}[chapter] \newtheorem{definition}{定义}[chapter] \newtheorem{proposition}{命题}[chapter] \newtheorem{lemma}{引理}[chapter] \newtheorem{theorem}{定理}[chapter] \newtheorem{axiom}{公理}[chapter] \newtheorem{corollary}{推论}[chapter] \newtheorem{exercise}{练习}[chapter] \newtheorem{example}{例}[chapter] \newtheorem{remark}{注释}[chapter] \newtheorem{problem}{问题}[chapter] \newtheorem{conjecture}{猜想}[chapter] % % \end{macrocode} % % \subsubsection{化学式和国际标准单位} % 很棒的化学式和方程支持。不过这里需要补足中文排版中的空格尴尬: % \begin{macrocode} %<*cls> \RequirePackage[version=4]{mhchem} \AtBeginDocument{\pretocmd{\ce}{{ }}{}{}} % \end{macrocode} % \begin{macro}{\cec} % 在命令里使用逗号快速分隔多个化学式: % \begin{macrocode} \newcommand{\cec}[1]{\cesplit{{\,\ }{\0}}{#1}} % \end{macrocode} % \end{macro} % SI单位支持 % \begin{macrocode} \RequirePackage{siunitx} \RequirePackage{upgreek} \ifxetex \sisetup{% math-micro = {\upmu}, text-micro = {\textmu}, }%\sisetup \fi % % \end{macrocode} % % \begin{macrocode} %<*cfg> \sisetup{% list-final-separator = { 和 }, list-pair-separator = { 和 }, range-phrase = {~}, }%\sisetup % \end{macrocode} % % \subsubsection{自动交叉引用} % \begin{macro}{\autoref} % 使用\cs{autoref}可以进行自动判定目标类型的交叉引用,这里对其进行定制: % \begin{macrocode} % 这里定制\autoref{label} \AtBeginDocument{% \def\figureautorefname{图} \def\tableautorefname{表} \def\partautorefname{卷} \def\appendixautorefname{附录} \def\equationautorefname{式} \def\Itemautorefname{列表} \def\chapterautorefname{章} \def\sectionautorefname{节} \def\subsectionautorefname{小节} \def\subsubsectionautorefname{条目} \def\paragraphautorefname{自然段} \def\Hfootnoteautorefname{脚注} \def\AMSautorefname{式} \def\theoremautorefname{理论} \def\pageautorefname{页} }%\AtBeginDocument % % \end{macrocode} % \end{macro} % % \subsubsection{浮动对象} % 设定浮动对象与文字的间距 % \changes{v1.16}{2016/12/07}{优化浮动对象与文字的间距。} % \begin{macrocode} %<*cls> \setlength{\floatsep}{20bp plus2bp minus2bp} \setlength{\intextsep}{20bp plus2bp minus2bp} \setlength{\textfloatsep}{20bp plus2bp minus2bp} \setlength{\@fptop}{6bp plus2bp} \setlength{\@fpsep}{12bp plus2bp} \setlength{\@fpbot}{6bp plus2bp} % \end{macrocode} % 让浮动对象的页面缺省值更宽松 % \begin{macrocode} \renewcommand{\textfraction}{0.15} \renewcommand{\topfraction}{0.85} \renewcommand{\bottomfraction}{0.65} \renewcommand{\floatpagefraction}{0.60} % \end{macrocode} % % \subsubsection{题注和表格} % 主体部分的题注和后置部分的题注需要做分别支持。 % \begin{macro}{\thefigure} % \begin{macro}{\thetable} % \begin{macro}{\theequation} % 重新定义了图、表、公式的计数系统: % \begin{macrocode} \AtBeginDocument{% \renewcommand{\thefigure}{% \if@backmatter \CTEXthesection \@arabic \c@figure \else \ifnum \c@chapter >\z@ \thechapter .\fi \@arabic \c@figure \fi} \renewcommand{\thetable}{% \if@backmatter \CTEXthesection \@arabic \c@table \else \ifnum \c@chapter >\z@ \thechapter .\fi \@arabic \c@table \fi} \renewcommand{\theequation}{% \if@backmatter \CTEXthesection \@arabic \c@equation \else \ifnum \c@chapter >\z@ \thechapter .\fi \@arabic \c@equation \fi} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % 定制表格和插图的题注样式,这里注意\pkg{caption}宏包在设置表格的\option{position}为\option{top}时,\option{aboveskip}和\option{belowskip}的定义会相互调换,即\option{top}时反义,\option{bottom}时字面义。 % \changes{v1.12}{2016/07/06}{题注的字体设置对中英文都进行了适配。} % \changes{v1.16}{2016/12/07}{正文中的题注的名称和序号不再加粗,同时优化了题注和插图(插表)的垂直距离。} % \changes{v1.20}{2017/05/30}{现在,题注有多行时,最后一行会进行居中处理。} % \begin{macrocode} \def\cqu@tabular{\zihao{5}\@tabular} \DeclareCaptionLabelFormat{cqu}{{\zihao{5}\rmfamily\songti #1~#2}} \DeclareCaptionLabelSeparator{cqu}{\hspace{0.5\ccwd}} \DeclareCaptionFont{cqu}{\zihao{5}\rmfamily\songti} \captionsetup{justification=centerlast} \captionsetup{labelformat=cqu,labelsep=cqu,font=cqu} \captionsetup[table]{position=top,belowskip=6bp,aboveskip=0bp} \captionsetup[figure]{position=bottom,belowskip=0bp,aboveskip=6bp} \captionsetup[sub]{font=cqu,skip=6bp} \renewcommand{\thesubfigure}{(\alph{subfigure})} \renewcommand{\thesubtable}{(\alph{subtable})} % \end{macrocode} % \begin{macro}{\bicaption} % \changes{v1.50}{2020/06/23}{修改了双语图注的声明顺序,以适应新版\cs{bicaption}的变更。} % 这里对\cs{bicaption}这个命令进行设置,题注的第二语言默认为英文,用户可以重定义\cs{shorttablenameEN}和\cs{shortfigurenameEN} % \begin{macrocode} \DeclareCaptionOption{bi-first}[]{% \def\tablename{\shorttablename} \def\figurename{\shortfigurename} }%bi-first \DeclareCaptionOption{bi-second}[]{% \def\tablename{\shorttablenameEN} \def\figurename{\shortfigurenameEN} }%bi-second \captionsetup[bi-first]{bi-first} \captionsetup[bi-second]{bi-second} % \end{macrocode} % \end{macro} % \begin{macro}{\listoffiguresEN} % \begin{macro}{\listoftablesEN} % 按照三种不同情况进行不同的工作:1、如果不开启双语索引,则去掉命令作用,将创建出的list作为黑洞;2、要求中英文编录到一起时不分离索引文件: % \begin{macrocode} \DeclareFloatingEnvironment[fileext=lofEN]{figuresEN}[\shortfigurenameEN][\listoffiguresnameEN] \DeclareFloatingEnvironment[fileext=lotEN]{tablesEN}[\shorttablenameEN][\listoftablesnameEN] % \end{macrocode} % 3、中英文分开编译 % \begin{macrocode} \if@bicombined\relax \else \captionsetup[bi-second]{listtype+=sEN} \fi \if@biapart\relax \else \AtBeginDocument{% \let\listoffiguresEN\relax \let\listoftablesEN\relax \let\listofequationsEN\relax }%AtBeginDocument \fi % \end{macrocode} % \end{macro} % \end{macro} % 调整表格字号,调整每列之间的间距,单元格内垂直居中 % \begin{macrocode} \AtBeginEnvironment{tabularx}{\begingroup\zihao{5}} \AtEndEnvironment{tabularx}{\endgroup} \setlength{\tabcolsep}{12pt} \renewcommand{\tabularxcolumn}[1]{m{#1}} % \end{macrocode} % \begin{macro}{\bigcell} % \begin{macro}{\headcell} % \begin{macro}{\colsep} % 在表格中,\cs{bigcell}内的内容可以主动换行;\cs{headcell}用来做表头;\cs{colsep}用来设定列间距,默认值为12pt。 % \begin{macrocode} \newcommand{\bigcell}[1]{\vspace{6pt}\begin{varwidth}{\linewidth}#1\end{varwidth}\vspace{6pt}} \newcommand{\headcell}[1]{\multicolumn{1}{c}{\heiti #1}} \newcommand{\colsep}[1][12pt]{\setlength{\tabcolsep}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % longtable方面也需要做设置 % \begin{macrocode} \setlength{\LTpre}{\bigskipamount} \setlength{\LTpost}{\bigskipamount} \let\cqu@LT@array\LT@array \def\LT@array{\zihao{5}\cqu@LT@array} % \end{macrocode} % % \subsubsection{代码环境} % \begin{environment}{lstStyleBase} % \changes{v1.00}{2016/06/17}{将代码环境的基础字号改为了\cs{footnotesize},原先的\cs{scriptsize}实在太小了。} % 载入\pkg{listings}宏包,定义基础代码环境,注意这个环境只是个模板,没有提供直接使用的接口: % \begin{macrocode} \RequirePackage{listings} \lstdefinestyle{lstStyleBase}{% basicstyle=\footnotesize\ttfamily, aboveskip=\medskipamount, belowskip=\medskipamount, lineskip=0pt, boxpos=c, showlines=false, extendedchars=true, upquote=true, tabsize=2, showtabs=false, showspaces=false, showstringspaces=false, numbers=left, numberstyle=\tiny, linewidth=\linewidth, xleftmargin=4pt, xrightmargin=0pt, resetmargins=false, breaklines=true, breakatwhitespace=false, breakindent=0pt, breakautoindent=true, columns=flexible, keepspaces=true, framesep=3pt, rulesep=2pt, framerule=1pt, backgroundcolor=\color{gray!5}, stringstyle=\color{green!40!black!100}, keywordstyle=\bfseries\color{blue!50!black}, commentstyle=\slshape\color{black!60}} \lstdefinestyle{lstStyleCplus}{% style=lstStyleBase, frame=l, rulecolor=\color{blue}, language=C++} \lstdefinestyle{lstStylePython}{% style=lstStyleBase, frame=l, rulecolor=\color{cyan}, language=Python} % \end{macrocode} % \end{environment} % \begin{environment}{C++} % \changes{v1.16}{2016/12/07}{出于简明的考虑,\env{Cplus}环境现在已经更名为\env{C++}环境。\env{Cplus}环境为历史兼容而保留定义。修改了语言环境定义中的一个错误,现在C++和Python环境能够正确地进行代码上色了。} % \begin{environment}{Python} % \cquthesis 内置了两个代码环境,\env{C++}和\env{Python},您可以参照代码在\file{cquthesis.sty}中定义自己的环境。\env{Cplus}环境为历史兼容而保留定义。 % \begin{macrocode} \lstnewenvironment{C++}{\lstset{style=lstStyleCplus}}{} \lstnewenvironment{Cplus}{\lstset{style=lstStyleCplus}}{} \lstnewenvironment{Python}{\lstset{style=lstStylePython}}{} % \end{macrocode} % \end{environment} % \end{environment} % % \subsubsection{自定义计数器} % 这个计数器可以在很多环境下使用,例如表格中的序号,文章中行内的编号等等: % \begin{macro}{\xuhao} % \begin{macro}{\resetxuhao} % \begin{macro}{\xuhaotype} % \begin{macro}{\xuhaoseparator} % \cs{xuhao}会自增并输出内容,\cs{resetxuhao}或者\cs{xuhao}\oarg{1}会将序号置为1,后者会输出,\cs{xuhaotype}用来设定序号风格,\cs{xuhaoseparator}为序号之后的分隔符,可以用\cs{renewcommand}来定义。 % \begin{macrocode} \newcounter{cquXuHao} \newcounter{cquXuHaoType} \setcounter{cquXuHaoType}{1} \newcommand{\xuhaoseparator}{} \newcommand{\xuhaotype}[1][1]{ \ifnum #1>6 \ClassError{cquthesis}% {Available choices from 1-6.}{}% \fi \setcounter{cquXuHaoType}{#1} }%\xuhaotype \newcommand{\output@xuhao}{% \ifcase\value{cquXuHaoType} \or \arabic{cquXuHao} %1 \or \Alph{cquXuHao} %2 \or \alph{cquXuHao} %3 \or \Roman{cquXuHao} %4 \or \roman{cquXuHao} %5 \or \ifnum\value{cquXuHao}>9\ClassError{cquthesis}% {Xuhao(rownum) of type-6 must be under 10.}{}% \else\fnsymbol{cquXuHao} \fi %6 \fi }%\output@xuhao \newcommand{\xuhao}[1][0]{ \ifcase #1 \stepcounter{cquXuHao} %0 \output@xuhao\xuhaoseparator\xspace \or \resetxuhao\stepcounter{cquXuHao} %1 \output@xuhao\xuhaoseparator\xspace \fi }%\xuhao \newcommand{\resetxuhao}{\setcounter{cquXuHao}{0}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{\rownum} % \begin{macro}{\resetrownum} % \begin{macro}{\rownumtype} % \begin{macro}{\rownumseparator} % 考虑到不同用户的喜好,这里设定一组别名,同时处理\cs{setxuhao}这个兼容性问题。 % \begin{macrocode} \let\rownum\xuhao \let\resetrownum\resetxuhao \let\rownumtype\xuhaotype \let\setxuhao\xuhaotype \let\rownumseparator\xuhaoseparator % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \subsection{盲审模式} % % \begin{macro}{\secretize} % 定义盲审模式工具宏\cs{secretize}: % \begin{macrocode} \newcommand{\secretize}[1]{% \ifcqu@blindtrail {***} \else {#1} \fi } % \end{macrocode} % \end{macro} % % \begin{environment}{secretizeEnv} % 定义盲审模式工具环境\env{secretizeEnv}: % \begin{macrocode} \newcommand{\cqu@@secretizeenv}[1]{\long\gdef\cqu@secretizeenv{#1}} \newenvironment{secretizeEnv}{\Collect@Body\cqu@@secretizeenv}{% \ifcqu@blindtrail \relax \else \cqu@secretizeenv \fi } % \end{macrocode} % \end{environment} % % \subsection{封面绘制} % \subsubsection{信息录入} % \begin{macro}{\cqu@def@term} % 定义一个Key--Definer: % \begin{macrocode} \def\cqu@def@term #1{% \define@key{cqu}{#1}{\csname #1\endcsname{##1}} \expandafter\gdef\csname #1\endcsname##1{% \expandafter\gdef\csname cqu@#1\endcsname{##1}} \csname #1\endcsname{}} % \end{macrocode} % \end{macro} % 下面定义一批会用在封面的变量: % % 论文的中英文题目(封面第二行) % \begin{macrocode} \cqu@def@term{ctitle} \cqu@def@term{etitle} % \end{macrocode} % % 作者的信息(校徽下方) % \begin{macrocode} \cqu@def@term{cauthor} \cqu@def@term{eauthor} \cqu@def@term{studentid} \cqu@def@term{csupervisor} \cqu@def@term{esupervisor} \cqu@def@term{cassistsupervisor} \cqu@def@term{cextrasupervisor} \cqu@def@term{eassistsupervisor} \cqu@def@term{cpsupervisor} \cqu@def@term{epsupervisor} \cqu@def@term{cmajor} \cqu@def@term{emajor} \cqu@def@term{cclass} \cqu@def@term{edgree} % \end{macrocode} % % 底部的学院名称和日期 % \begin{macrocode} \cqu@def@term{cdepartment} \cqu@def@term{edepartment} \cqu@def@term{mycdate} \cqu@def@term{myedate} % % \end{macrocode} % 日期的中英文支持 % \begin{macrocode} %<*cfg> \newcommand{\MONTH}{% \ifcase\the\month \or January% 1 \or February% 2 \or March% 3 \or April% 4 \or May% 5 \or June% 6 \or July% 7 \or August% 8 \or September% 9 \or October% 10 \or November% 11 \or December% 12 \fi} \def\cdate{\zhdigits{\the\year}年\zhnumber{\the\month}月} \def\edate{\MONTH{ }\the\year} % % \end{macrocode} % % 收集关键词并且做关键词分割 % \begin{macrocode} %<*cls> \def\cqu@parse@keywords#1{ \define@key{cqu}{#1}{\csname #1\endcsname{##1}} \expandafter\gdef\csname cqu@#1\endcsname{} \expandafter\gdef\csname #1\endcsname##1{ \@for\reserved@a:=##1\do{ \expandafter\ifx\csname cqu@#1\endcsname\@empty\else \expandafter\g@addto@macro\csname cqu@#1\endcsname{% \ignorespaces\csname cqu@#1@separator\endcsname} \fi \expandafter\expandafter\expandafter\g@addto@macro% \expandafter\csname cqu@#1\expandafter\endcsname\expandafter{\reserved@a}}}} \cqu@parse@keywords{ckeywords} \cqu@parse@keywords{ekeywords} % \end{macrocode} % % 使用kvoptions提供key=value格式支持 % \begin{macrocode} \def\cqusetup{\kvsetkeys{cqu}} % \end{macrocode} % % \subsubsection{绘制中文封面} % \begin{macro}{\make@cover@CN} % \changes{v0.9.7}{2016/06/09}{使用\pkg{varwidth}代替了\pkg{pbox}。} % 基本上的思路是能复用就复用,姓名那几行分为左右两个\env{varwidth}: % \changes{v1.00}{2016/06/17}{现在,标题中的英文和中文统一使用无衬线字体。} % \changes{v1.14}{2016/08/18}{本科封面新增“助理指导教师”“校外指导教师”的字段,自动判定是否有输入,有则显示,无则不显示。} % \begin{macrocode} \newcommand{\make@cover@CN}{% \thispagestyle{style@empty} \begin{center} \rule{0mm}{15mm} \sffamily\heiti \ifcqu@bachelor \zihao{-2}\cqu@thesistypenameCN \\ \vspace{\stretch{1}} \zihao{2}\cqu@ctitle \\ \vspace{\stretch{2}} \includegraphics[width=6cm]{CQUbadge.pdf} \\ \vspace{\stretch{2}} \else \zihao{2}\cqu@ctitle \\ \vspace{\stretch{1}} \includegraphics[width=6cm]{CQUbadge.pdf} \\ \vspace{\stretch{1}} \zihao{-2}\cqu@thesistypenameCN \ifcqu@master{}\\\cqu@mastertype\fi \\ \vspace{\stretch{2}} \fi \ifcqu@bachelor \zihao{3} \begin{varwidth}{\textwidth} \begin{CJKfilltwosides}{4.5\ccwd} \cqu@studentCN\cqu@title@separatorCN\\ \cqu@studentnumCN\cqu@title@separatorCN\\ \cqu@supervisorCN\cqu@title@separatorCN\\ \ifdefstring{\cqu@cassistsupervisor}{}{\relax}{{\zihao{5}\begin{CJKfilltwosides}{66bp}\cqu@assistsupervisorCN\end{CJKfilltwosides}}\hfill\cqu@title@separatorCN\\} \ifdefstring{\cqu@cextrasupervisor}{}{\relax}{{\zihao{5}\begin{CJKfilltwosides}{66bp}\cqu@extrasupervisorCN\end{CJKfilltwosides}}\hfill\cqu@title@separatorCN\\} \cqu@majorCN\cqu@title@separatorCN \end{CJKfilltwosides} \end{varwidth} \else \zihao{3} \begin{varwidth}{\textwidth} \begin{CJKfilltwosides}{4.5\ccwd} \cqu@studentCN\cqu@title@separatorCN\\ \cqu@supervisorCN\cqu@title@separatorCN\\ \ifcqu@academic \cqu@majorCN\cqu@title@separatorCN\\ \else \cqu@psupervisorCN\cqu@title@separatorCN\\ \fi \cqu@majorclassCN\cqu@title@separatorCN \end{CJKfilltwosides} \end{varwidth} \fi \hskip.5\ccwd \zihao{3} \begin{varwidth}{\textwidth}% \mbox{\cqu@cauthor}\\ \ifcqu@bachelor\cqu@studentid\\\fi \cqu@csupervisor\\ %不要放在盒子里 \ifcqu@academic %这里有点复杂 \ifcqu@bachelor \ifdefstring{\cqu@cassistsupervisor}{}{\relax}{\cqu@cassistsupervisor\\} \ifdefstring{\cqu@cextrasupervisor}{}{\relax}{\cqu@cextrasupervisor\\} \fi \mbox{\cqu@cmajor} \ifcqu@bachelor\relax\else\\\cqu@cclass\fi \else \cqu@cpsupervisor\\ \cqu@cclass \fi \end{varwidth} \\ \vspace{\stretch{2}} \zihao{-2}\cqu@universitynameCN\cqu@cdepartment\\[1mm] \zihao{3}\ifdefempty{\cqu@mycdate}{\cdate}{\cqu@mycdate} \vspace{10mm} \end{center}} % \end{macrocode} % \end{macro} % % \subsubsection{绘制英文封面} % \begin{macro}{\make@cover@EN} % 英文封面由于不需要汉字两端对齐,相对来说排版难度低一些: % \changes{v1.14}{2016/08/18}{“助理指导教师”“校外指导教师”的英文字段也相应添加,同样自动判定是否有输入来决定是否显示。} % \changes{v1.16}{2016/12/07}{修正英文封面的指导教师的表达。另外,让“by”加粗了。} % \begin{macrocode} \newcommand{\make@cover@EN}{% \cleardoublepage \thispagestyle{style@empty} \begin{center} \rule{0mm}{15mm} \sffamily \ifcqu@bachelor \zihao{-2}\cqu@thesistypenameEN \\ \vspace{\stretch{2}} \zihao{-1}\textbf{\cqu@etitle} \\ \vspace{\stretch{1}} \includegraphics[width=5cm]{CQUbadge.pdf} \\ \vspace{\stretch{2}} \zihao{3}\textbf{\cqu@studentEN\cqu@title@separatorEN\mbox{\cqu@eauthor}}\\ \cqu@supervisorEN\mbox{\cqu@esupervisor}\\ \ifdefstring{\cqu@eassistsupervisor}{}{\relax}{\cqu@assistsupervisorEN\cqu@title@separatorEN\mbox{\cqu@eassistsupervisor}\\} \cqu@majorEN\cqu@title@separatorEN\mbox{\cqu@emajor} \else \zihao{-1}\textbf{\cqu@etitle} \\ \vspace{\stretch{2}} \includegraphics[width=5cm]{CQUbadge.pdf} \\ \vspace{\stretch{2}} \zihao{3}\cqu@thesistypenameEN \\[1mm] \textbf{\cqu@workby} \\[2mm] \zihao{3}\mbox{\textbf{\cqu@eauthor}} \\ \vspace{\stretch{1}} \textbf{\cqu@supervisorEN}\textbf{\cqu@esupervisor}\\ \ifcqu@academic\relax\else\textbf{\cqu@psupervisorEN\cqu@title@separatorEN\cqu@epsupervisor}\\\fi \textbf{\cqu@majorEN\cqu@title@separatorEN}\mbox{\textbf{\cqu@emajor}} \fi \\ \vspace{\stretch{2}} \zihao{-2}\cqu@edepartment\\\cqu@universitynameEN\\[1mm] \ifdefempty{\cqu@myedate}{\textbf{\edate}}{\textbf{\cqu@myedate}} \vspace{10mm} \end{center}} % \end{macrocode} % \end{macro} % % \subsubsection{PDF文件属性配置} % \begin{macro}{\makecover} % 定义一个总体调用的\cs{makecover},在画封面的同时把PDF属性也做了: % \begin{macrocode} \def\makecover{% \hypersetup{% pdftitle = {\cqu@ctitle}, pdfauthor = {\cqu@cauthor}, pdfsubject = {\cqu@thesistypenameCN}, pdfkeywords = {\cqu@ckeywords}, pdfcreator = {CQUThesis--v\version, a LaTeX template.} } \phantomsection \pdfbookmark[-1]{\cqu@ctitle}{ctitle} \make@cover@CN \make@cover@EN }%makecover % \end{macrocode} % \end{macro} % % \subsection{摘要} % \subsubsection{信息收集} % 论文的中英文摘要 % \begin{macrocode} \newcommand{\cqu@@cabstract}[1]{\long\gdef\cqu@cabstract{#1}} \newenvironment{cabstract}{\Collect@Body\cqu@@cabstract}{} \newcommand{\cqu@@eabstract}[1]{\long\gdef\cqu@eabstract{#1}} \newenvironment{eabstract}{\Collect@Body\cqu@@eabstract}{} % \end{macrocode} % % \subsubsection{生成摘要} % \begin{macro}{\makeabstract} % 生成摘要的命令 % \begin{macrocode} \def\makeabstract{% \cleardoublepage \normalsize \cqu@makeabstract }%makeabstract \newcommand{\cqu@makeabstract}{% \clearpage \chapter[\cqu@cabstract@tocname]{\cqu@cabstract@name} \pagestyle{style@normal} \cqu@fixhead \pagenumbering{Roman} \cqu@cabstract \vskip12bp \cqu@put@kw{\heiti\cqu@ckw@title\cqu@title@separatorCN}{\cqu@ckeywords} \if@twosideprint\ifcqu@openany\ifcqu@abstractopenright\cqu@addblankpage\fi\fi\fi \chapter[\cqu@eabstract@tocname]{\sffamily\textbf{\cqu@eabstract@name}} \cqu@fixhead \cqu@eabstract \vskip12bp \cqu@put@kw{\textbf{\cqu@ekw@title\cqu@title@separatorEN}}{\cqu@ekeywords} } % \end{macrocode} % \end{macro} % 排版关键词: % \begin{macrocode} \newbox\cqu@kw \newcommand{\cqu@put@kw}[2]{% \begingroup \setbox\cqu@kw=\hbox{#1} \noindent\hangindent\wd\cqu@kw\hangafter1 \box\cqu@kw#2\par \endgroup} % \end{macrocode} % % \subsection{独创声明和授权书} % \begin{macro}{\cquauthpage} % 绘制独创性声明和授权书页面 % \begin{macrocode} \NewDocumentCommand{\cqu@makeauth}{o}{% \clearpage \thispagestyle{style@empty} \IfNoValueTF{#1}{% \rule{0mm}{5mm} \begin{center} \zihao{3} \begin{CJKfilltwosides}{6\ccwd} \heiti{}\cqu@innotitle \end{CJKfilltwosides} \end{center} \vspace{2mm} \zihao{-4} \par\cqu@innobody \\[5mm] \par\cqu@innosignature\hfill\cqu@signdate \vspace{15mm} \begin{center} \zihao{3}\heiti \cqu@authtitle \end{center} \vspace{2mm} \zihao{-4} \par\cqu@authbody \\[15mm] \begin{minipage}{\textwidth} \begin{minipage}{15\ccwd} \cqu@authsignaturestu\\[10mm] \cqu@signdate \end{minipage} \hfill \begin{minipage}{15\ccwd} \cqu@authsignaturesup\\[10mm] \cqu@signdate \end{minipage} \end{minipage} }{ \includepdf{#1} } }%\cqu@makeauth \let\cquauthpage\cqu@makeauth % % \end{macrocode} % \end{macro} % 定义封面用到的文字常量 % \begin{macrocode} %<*cfg> \def\cqu@ckeywords@separator{,} \def\cqu@ekeywords@separator{, } \def\cqu@title@separatorCN{:} \def\cqu@title@separatorEN{:~} \def\cqu@cabstract@tocname{中文摘要} \def\cqu@eabstract@tocname{英文摘要} \def\cqu@cabstract@name{摘\hskip\ccwd{}要} \def\cqu@eabstract@name{ABSTRACT} \def\cqu@ckw@title{关键词} \def\cqu@ekw@title{Key words} \def\cqu@workby{by} \ifcqu@bachelor \def\cqu@thesistypenameCN{重庆大学本科学生毕业设计(论文)} \def\cqu@thesistypenameEN{Graduation Design(Thesis) of Chongqing University} \def\cqu@studentCN{学生} \def\cqu@studentEN{Undergraduate} \def\cqu@studentnumCN{学号} \def\cqu@supervisorCN{指导教师} \def\cqu@supervisorEN{Supervised by{ }} \def\cqu@assistsupervisorCN{助理指导教师} \def\cqu@extrasupervisorCN{校外指导教师} \def\cqu@assistsupervisorEN{Assistant Supervisor} \def\cqu@majorCN{专业} \def\cqu@majorEN{Major} \def\cqu@universitynameCN{重庆大学} \def\cqu@universitynameEN{Chongqing University} \else \ifcqu@master \def\cqu@thesistypenameCN{重庆大学硕士学位论文} \def\cqu@thesistypenameEN{A Thesis Submitted to Chongqing University\\% in Partial Fulfillment of the Requirement for% \ifcqu@academic{ }the\fi\\\cqu@edgree} \def\cqu@studentCN{学生姓名} \def\cqu@supervisorCN{指导教师} \def\cqu@supervisorEN{Supervised by{ }} \def\cqu@psupervisorCN{兼职导师} \def\cqu@psupervisorEN{Pluralistic~Supervisor} \def\cqu@majorCN{专业} \def\cqu@majorEN{Specialty} \ifcqu@academic \def\cqu@mastertype{(学术学位)} \def\cqu@majorclassCN{学科门类} \else \def\cqu@mastertype{(专业学位)} \def\cqu@majorclassCN{学位类型} \fi \def\cqu@universitynameCN{重庆大学} \def\cqu@universitynameEN{Chongqing University, Chongqing, China} \else \ifcqu@doctor \def\cqu@thesistypenameCN{重庆大学博士学位论文} \def\cqu@thesistypenameEN{A Thesis Submitted to Chongqing University\\% in Partial Fulfillment of the Requirement for the\\\cqu@edgree} \def\cqu@studentCN{学生姓名} \def\cqu@studentEN{Ph.D. Candidate} \def\cqu@supervisorCN{指导教师} \def\cqu@supervisorEN{Supervised by{ }} \def\cqu@majorCN{专业} \def\cqu@majorclassCN{学科门类} \def\cqu@majorEN{Specialty} \def\cqu@universitynameCN{重庆大学} \def\cqu@universitynameEN{Chongqing University} \else \ClassWarning{cquthesis}% {Specified thesis type is obligatory: \MessageBreak type=[bachelor|master|doctor](How did you bypass the type check?)}{} \fi \fi \fi \def\cqu@innotitle{独创性声明} \def\cqu@innobody{% 本人声明所呈交的学位论文是本人在导师指导下进行的研究工作及取得的研究成果。据我所知,除了文中特别标注和致谢的地方外,论文中不包含其他人已经发表或撰写中的研究成果,也不包含为获得重庆大学或其他教育机构的学位或证书而使用过的材料。与我一同工作的同志对本文所做的任何贡献均已在论文中做了明确的说明并表示谢意。} \def\cqu@innosignature{学位论文作者签名:} \def\cqu@authtitle{学位论文版权使用授权书} \def\cqu@authcheckpart{% 保\hskip\ccwd{}密(\hskip2\ccwd),在\rule{3\ccwd}{0.15mm}年解密后适用本授权书。\\ 不保密(\hskip2\ccwd)。} \def\cqu@authbody{ 本学位论文作者完全了解重庆大学有关保留、使用学位论文的规定,有权保留并向国家有关部门或机构送交论文的复印件和磁盘,允许论文被查阅和借阅。本人授权重庆大学可以把学位论文的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存、汇编学位论文。 \\[\baselineskip] \indent\parbox{7\ccwd}{本学位论文属于}\hskip\ccwd\parbox{.6\textwidth}{\cqu@authcheckpart} \\[\baselineskip] \indent(请只在上述一个括号内打“\ding{51}”)} \def\cqu@authsignaturestu{学位论文作者签名:} \def\cqu@authsignaturesup{导师签名:} \def\cqu@signdate{签字日期:\hskip3\ccwd{}年\hskip2\ccwd{}月\hskip2\ccwd{}日} % % \end{macrocode} % \subsection{主要符号对照表} % \begin{environment}{denotation} % 定义主要符号对照表 % \begin{macrocode} %<*cls> \newlist{cqu@denotation}{description}{1} \setlist[cqu@denotation]{% nosep, font = \normalfont, align = left, leftmargin = !, labelindent = 0mm, labelwidth = 25mm, labelsep* = 5mm, itemindent = 0mm, }%\setlist \NewDocumentEnvironment{denotation}{O{20mm} O{30mm}}{% \chapter*{\cqu@denotation@name} \chaptermark{\cqu@denotation@name}\cqu@fixhead \zihao{-4}\begin{cqu@denotation}[labelindent = #1,labelwidth=#2,] }{ \end{cqu@denotation}}%\denotation % \end{macrocode} % \end{environment} % % \subsection{目录} % \subsubsection{定制目录} % 目录深度和计数器深度,减小章节之间的垂直间隔: % \begin{macrocode} \setcounter{tocdepth}{2} \setcounter{secnumdepth}{3} \setlength{\cftbeforechapskip}{1mm} % \end{macrocode} % 调整subsection的目录缩进 % \begin{macrocode} \ifcqu@liberalformat \cftsetindents{chapter}{0em}{1.5em} \cftsetindents{section}{1.9em}{0.9em} \cftsetindents{subsection}{4.0em}{1.5em} \else \cftsetindents{chapter}{0em}{1.5em} \cftsetindents{section}{1.5em}{2.2em} \cftsetindents{subsection}{3.7em}{2.9em} \fi % \end{macrocode} % 目录中的不同级别采用不同的字号和字体,这是按照学校word样例的实现,但是蹊跷的是,样例里的这些做法在官方文件里却没有体现,所以这里列为可选项,适用于三级标题很多的情况: % \begin{macrocode} \ifcqu@seriftoc \renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} \renewcommand{\cftchapfont}{\zihao{4}\sffamily\heiti} \renewcommand{\cftsecfont}{\zihao{5}\sffamily\heiti} \renewcommand{\cftsubsecfont}{\zihao{5}} \fi % \end{macrocode} % \subsubsection{公式索引} % \begin{macro}{\listofequationsEN} % 支持生成双语对照索引,分三个情况: % \begin{macrocode} \newlistof[chapter]{equations}{equ}{\listofequationsname} \newlistof[chapter]{equationsEN}{equEN}{\listofequationsnameEN} \DeclareDocumentCommand{\listeq}{ m o }{% \addcontentsline{equ}{equations}{\protect\numberline{\theequation}#1}\par \IfNoValueTF{#2}{% \relax }{% \if@bicombined \addcontentsline{equ}{equations}{\protect\numberline{\theequation}#2}\par \else \if@biapart \addcontentsline{equEN}{equationsEN}{\protect\numberline{\theequation}#2}\par \fi \fi } }%listeq \setlength{\cftequationsnumwidth}{2.5em} \setlength{\cftequationsENnumwidth}{2.5em} \let\eqlist\listeq % \end{macrocode} % \end{macro} % % 正确输出页眉页脚 % \begin{macrocode} \tocloftpagestyle{style@normal} % % \end{macrocode} % % 决定论文页眉名称 这个变量不能含有格式 % \begin{macrocode} %\let\cqu@thesisname\cqu@thesistypenameCN % \end{macrocode} % % 目录和索引标题居中,包含\cs{fixhead} % \changes{v0.9.0}{2016/05/16}{把目录加到了PDF书签中。} % \changes{v1.12}{2016/07/06}{现在,目录、图录、表录、公式表的英文字体也采用了无衬线字。} % \changes{v1.20}{2017/05/30}{现在,目录中的章节层级也有了尾随圆点,并且,圆点的间距更近了。} % \begin{macrocode} %<*cls> \renewcommand{\cfttoctitlefont}{% \phantomsection\pdfbookmark[0]{\cqu@tocnameinbkmark}{toc}\cqu@fixhead\hfill\bfseries\sffamily\heiti\zihao{3}} \renewcommand{\cftloftitlefont}{\cqu@fixhead\hfill\sffamily\heiti\zihao{3}} \renewcommand{\cftlottitlefont}{\cqu@fixhead\hfill\sffamily\heiti\zihao{3}} \renewcommand{\cftequtitlefont}{\cqu@fixhead\hfill\sffamily\heiti\zihao{3}} \renewcommand{\cftequENtitlefont}{\cqu@fixhead\hfill\sffamily\heiti\zihao{3}} \renewcommand{\cftaftertoctitle}{\hfill} \renewcommand{\cftafterloftitle}{\hfill} \renewcommand{\cftafterlottitle}{\hfill} \renewcommand{\cftafterequtitle}{\hfill} \renewcommand{\cftafterequENtitle}{\hfill} \renewcommand{\cftdot}{…} \renewcommand{\cftdotsep}{0} \renewcommand{\cftchapdotsep}{\cftdotsep} \renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}} \renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} % \end{macrocode} % % 重写使用tocloft宏包情况下的目录和索引生成,每次生成新开一页 % \begin{macrocode} % \changes{v1.20}{2017/05/30}{除非openany选项打开,否则目录和索引现在会在双页模式进行右开。} \ifcqu@continuoustoc\relax\else \renewcommand{\@cfttocstart}{\cleardoublepage} \renewcommand{\@cfttocfinish}{\cleardoublepage} \fi % \end{macrocode} % % \begin{macro}{\chapterstar} % 定义自己的章节命令\cs{chapterstar},不编号,有目录有页眉(这个命令暂时没用上,还待观察) % \begin{macrocode} \newcommand{\chapterstar}[1]{% \chapter*{#1}% \phantomsection \@mkboth{#1}{} \addcontentsline{toc}{chapter}{#1}} % \end{macrocode} % \end{macro} % % \subsection{参考文献} % \changes{v0.9.7}{2016/06/09}{参考文献现在能正确地显示为五号字了。} % \begin{macro}{\inlinecite} % \begin{macro}{\onlinecite} % 定义\cs{inlinecite}和\cs{onlinecite} % \begin{macrocode} \bibpunct{[}{]}{,}{s}{}{,} \renewcommand\NAT@citesuper[3]{\ifNAT@swa% \unskip\kern\p@\textsuperscript{\NAT@@open #1\NAT@@close}% \if*#3*\else\ (#3)\fi\else #1\fi\endgroup} \DeclareRobustCommand\inlinecite{\@inlinecite} \def\@inlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup} \let\onlinecite\inlinecite % \end{macrocode} % \end{macro} % \end{macro} % % 将参考文献加入目录和pdf书签中 % \begin{macrocode} \pretocmd{\bibliography}{% \clearpage\phantomsection\addcontentsline{toc}{chapter}{\cqu@bib@name}}{}{} % \end{macrocode} % % 参考文献使用五号字,同时优化参考文献占用的空间 % \begin{macrocode} \AtBeginDocument{% \pretocmd{\bibliography}{\begingroup\zihao{5}}{}{} \apptocmd{\bibliography}{\endgroup}{}{} }%AtBeginDocument \renewcommand\@biblabel[1]{\zihao{5}[#1]} \renewenvironment{thebibliography}[1] {\chapter*{\cqu@bib@name \@mkboth{\cqu@bib@name}{}}% \list{\@biblabel{\@arabic\c@enumiv}}% {\settowidth\labelwidth{\@biblabel{#1}}% \leftmargin\labelwidth \advance\leftmargin\labelsep \setlength{\parsep}{1mm} \setlength{\labelsep}{0.5em} \setlength{\itemsep}{0.05pc} \setlength{\listparindent}{0in} \setlength{\itemindent}{0in} \setlength{\rightmargin}{0in} \@openbib@code \usecounter{enumiv}% \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}% \sloppy \clubpenalty4000 \@clubpenalty\clubpenalty \widowpenalty4000% \sfcode`\.\@m }{% \def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist \vskip.2in} % \end{macrocode} % %\subsection{载入配置文件} % 配置文件用于降低主文件的压力: % \begin{macrocode} \AtEndOfClass{\input{cquthesis.cfg}} % % \end{macrocode} % % \iffalse % \begin{macrocode} %<*dtx-style> \ProvidesPackage{dtx-style} \RequirePackage[bottom,perpage,hang,]{footmisc} \RequirePackage{hypdoc} \RequirePackage[UTF8,scheme=chinese]{ctex} \RequirePackage[ top=2.5cm, bottom=2.5cm, left=4cm, right=2cm, headsep=3mm]{geometry} \RequirePackage{array,longtable,booktabs} \RequirePackage{listings} \RequirePackage{fancyhdr} \RequirePackage{xcolor} \RequirePackage{enumitem} \RequirePackage{etoolbox} \RequirePackage{metalogo} \RequirePackage{graphicx} \RequirePackage{xspace} \RequirePackage{pifont} \def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@} \let\cqu@footnotesize\footnotesize \renewcommand{\footnotesize}{\cqu@footnotesize\zihao{-5}} \footnotemargin1.5em\relax \let\cqu@makefnmark\@makefnmark \def\cqu@@makefnmark{\mbox{{\normalfont\@thefnmark}}} \pretocmd{\@makefntext}{\let\@makefnmark\cqu@@makefnmark}{}{} \apptocmd{\@makefntext}{\let\@makefnmark\cqu@makefnmark}{}{} \colorlet{cqu@macro}{blue!60!black} \colorlet{cqu@env}{blue!70!black} \colorlet{cqu@option}{purple} \patchcmd{\PrintMacroName}{\MacroFont}{\MacroFont\bfseries\color{cqu@macro}}{}{} \patchcmd{\PrintDescribeMacro}{\MacroFont}{\MacroFont\bfseries\color{cqu@macro}}{}{} \patchcmd{\PrintDescribeEnv}{\MacroFont}{\MacroFont\bfseries\color{cqu@env}}{}{} \patchcmd{\PrintEnvName}{\MacroFont}{\MacroFont\bfseries\color{cqu@env}}{}{} \appto{\TeX}{\xspace} \appto{\LaTeX}{\xspace} \appto{\XeTeX}{\xspace} \def\DescribeOption{% \leavevmode\@bsphack\begingroup\MakePrivateLetters% \Describe@Option} \def\Describe@Option#1{\endgroup \marginpar{\raggedleft\PrintDescribeOption{#1}}% \cqu@special@index{option}{#1}\@esphack\ignorespaces} \def\PrintDescribeOption#1{\strut \MacroFont\bfseries\sffamily\color{cqu@option} #1\ } \def\cqu@special@index#1#2{\@bsphack \begingroup \HD@target \let\HDorg@encapchar\encapchar \edef\encapchar usage{% \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% }% \index{#2\actualchar{\string\ttfamily\space#2} (#1)\encapchar usage}% \index{#1:\levelchar#2\actualchar {\string\ttfamily\space#2}\encapchar usage}% \endgroup \@esphack} \lstdefinestyle{lstStyleBase}{% basicstyle=\small\ttfamily, aboveskip=\medskipamount, belowskip=\medskipamount, lineskip=0pt, boxpos=c, showlines=false, extendedchars=true, upquote=true, tabsize=2, showtabs=false, showspaces=false, showstringspaces=false, numbers=none, linewidth=\linewidth, xleftmargin=4pt, xrightmargin=0pt, resetmargins=false, breaklines=true, breakatwhitespace=false, breakindent=0pt, breakautoindent=true, columns=flexible, keepspaces=true, gobble=2, framesep=3pt, rulesep=1pt, framerule=1pt, backgroundcolor=\color{gray!5}, stringstyle=\color{green!40!black!100}, keywordstyle=\bfseries\color{blue!50!black}, commentstyle=\slshape\color{black!60}} \lstdefinestyle{lstStyleShell}{% style=lstStyleBase, frame=l, rulecolor=\color{blue}, language=bash} \lstdefinestyle{lstStyleLaTeX}{% style=lstStyleBase, frame=l, rulecolor=\color{cyan}, language=[LaTeX]TeX} \lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{} \lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{} \setlist{nosep} \DeclareDocumentCommand{\option}{m}{\textsf{#1}\xspace} \DeclareDocumentCommand{\env}{m}{\texttt{#1}\xspace} \DeclareDocumentCommand{\pkg}{s m}{% \texttt{#2}\xspace\IfBooleanF#1{\cqu@special@index{package}{#2}}} \DeclareDocumentCommand{\file}{s m}{% \texttt{#2}\xspace\IfBooleanF#1{\cqu@special@index{file}{#2}}} \newcommand{\myentry}[1]{% \marginpar{\raggedleft\color{purple}\bfseries\strut #1}} \newcommand{\note}[1]{{% \color{magenta}{\noindent\bfseries 说明:}\emph{#1}}} \def\cquthesis{\textsc{Cqu}\-\textsc{Thesis}} % % \end{macrocode} % \fi % % \Finale \endinput