diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..747ae04 --- /dev/null +++ b/.gitignore @@ -0,0 +1,293 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# ide +.vscode +.idea/ +.history + +.DS_Store + +## Core latex/pdflatex auxiliary files: +*.aux +*.lof +*.log +*.lot +*.fls +*.out +*.toc +*.fmt +*.fot +*.cb +*.cb2 +.*.lb + +## Intermediate documents: +*.dvi +*.xdv +*-converted-to.* +# these rules might exclude image files for figures etc. +# *.ps +# *.eps +# *.pdf + +## Generated if empty string is given at "Please type another file name for output:" +.pdf + +## Bibliography auxiliary files (bibtex/biblatex/biber): +*.bbl +*.bcf +*.blg +*-blx.aux +*-blx.bib +*.run.xml + +## Build tool auxiliary files: +*.fdb_latexmk +*.synctex +*.synctex(busy) +*.synctex.gz +*.synctex.gz(busy) +*.pdfsync + +## Build tool directories for auxiliary files +# latexrun +latex.out/ + +## Auxiliary and intermediate files from other packages: +# algorithms +*.alg +*.loa + +# achemso +acs-*.bib + +# amsthm +*.thm + +# beamer +*.nav +*.pre +*.snm +*.vrb + +# changes +*.soc + +# comment +*.cut + +# cprotect +*.cpt + +# elsarticle (documentclass of Elsevier journals) +*.spl + +# endnotes +*.ent + +# fixme +*.lox + +# feynmf/feynmp +*.mf +*.mp +*.t[1-9] +*.t[1-9][0-9] +*.tfm + +#(r)(e)ledmac/(r)(e)ledpar +*.end +*.?end +*.[1-9] +*.[1-9][0-9] +*.[1-9][0-9][0-9] +*.[1-9]R +*.[1-9][0-9]R +*.[1-9][0-9][0-9]R +*.eledsec[1-9] +*.eledsec[1-9]R +*.eledsec[1-9][0-9] +*.eledsec[1-9][0-9]R +*.eledsec[1-9][0-9][0-9] +*.eledsec[1-9][0-9][0-9]R + +# glossaries +*.acn +*.acr +*.glg +*.glo +*.gls +*.glsdefs +*.lzo +*.lzs + +# uncomment this for glossaries-extra (will ignore makeindex's style files!) +# *.ist + +# gnuplottex +*-gnuplottex-* + +# gregoriotex +*.gaux +*.gtex + +# htlatex +*.4ct +*.4tc +*.idv +*.lg +*.trc +*.xref + +# hyperref +*.brf + +# knitr +*-concordance.tex +# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files +# *.tikz +*-tikzDictionary + +# listings +*.lol + +# luatexja-ruby +*.ltjruby + +# makeidx +*.idx +*.ilg +*.ind + +# minitoc +*.maf +*.mlf +*.mlt +*.mtc[0-9]* +*.slf[0-9]* +*.slt[0-9]* +*.stc[0-9]* + +# minted +_minted* +*.pyg + +# morewrites +*.mw + +# nomencl +*.nlg +*.nlo +*.nls + +# pax +*.pax + +# pdfpcnotes +*.pdfpc + +# sagetex +*.sagetex.sage +*.sagetex.py +*.sagetex.scmd + +# scrwfile +*.wrt + +# sympy +*.sout +*.sympy +sympy-plots-for-*.tex/ + +# pdfcomment +*.upa +*.upb + +# pythontex +*.pytxcode +pythontex-files-*/ + +# tcolorbox +*.listing + +# thmtools +*.loe + +# TikZ & PGF +*.dpth +*.md5 +*.auxlock + +# todonotes +*.tdo + +# vhistory +*.hst +*.ver + +# easy-todo +*.lod + +# xcolor +*.xcp + +# xmpincl +*.xmpi + +# xindy +*.xdy + +# xypic precompiled matrices and outlines +*.xyc +*.xyd + +# endfloat +*.ttt +*.fff + +# Latexian +TSWLatexianTemp* + +## Editors: +# WinEdt +*.bak +*.sav + +# Texpad +.texpadtmp + +# LyX +*.lyx~ + +# Kile +*.backup + +# gummi +.*.swp + +# KBibTeX +*~[0-9]* + +# TeXnicCenter +*.tps + +# auto folder when using emacs and auctex +./auto/* +*.el + +# expex forward references with \gathertags +*-tags.tex + +# standalone packages +*.sta + +# Makeindex log files +*.lpz + +# xwatermark package +*.xwm + +# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib +# option is specified. Footnotes are the stored in a file with suffix Notes.bib. +# Uncomment the next line to have this generated file ignored. +#*Notes.bib \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0ca77bf --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog in Chinese + +此处记载了 pkuthss(iofu728 version) 中所有值得留意的改动,格式参照 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)。 + +点击版本号即可在 GitHub 上查看相邻版本间的代码变动。 + +## [v1.0.0] - 2021-06-09 + +### Changed + +- 支持《北京大学研究生学位论文写作指南 V2.0-2019.pdf》和《硕士论文模板 2020.word》中对硕士学位论文目录格式要求。 +- 支持 Overleaf。 +- 支持门户原创页/版权声明页插入。 +- 透传 ctex 的 fontset 设定,支持更多样的字体设定。 +- 完善基本的文档和 Overleaf 适配细节。 +- 增加主要符号对照表。 +- 简化 blind 模式下用户设定。 +- Windows 下中易宋体的粗体用假粗体替代。 + +### Fixed + +- 修正硕士学位论文封面“姓名”,“学号”等 key 的字体。 +- 修正硕士学位论文目录章级段前间距。 +- 修正图书馆上传版本对隐藏超链接的要求。 +- 修正表格内引用序号,子图引用序号。 diff --git a/README.md b/README.md new file mode 100644 index 0000000..7813586 --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +**iofu728-pkuthss**: Modified version of `LaTeX` Peking University thesis template base on [CasperVector/pkuthss](https://github.com/CasperVector/pkuthss) v1.9.0 + +[**Overleaf** Version](https://www.overleaf.com/latex/templates/2021-peking-university-master-thesis-template-iofu728-pkuthss/rwfvbkpzydpf) is public, welcome to use! + +## Overview + +To use pkuthss in the overleaf platform, and to support some customization requirements in writing processing, I redevelop the template of pkuthss. + +**Modified details:** + +- Style Part: + + - Fixed the styles of table of contents(chapter); + - Fixed `KEY WORDS`, `Title` in the cover -> remove the setting of `bold`; + - Fixed Font Size / Font in the cover, like title and keys; + - Hind hreflink; + +- Functional Part: + - Support library inspection requirements; + - Supported Overleaf online mode; + - Support denotation table; + - Support subfigure \ref, footnote in table; + - Supported scanned pdf insert(origin and copy pages); + - Add fontset mode, change bfseries -> AutoFakeBold in windows; + - Simplify user settings in blind mode; + +## Quick Start + +_Requirements_ + +- TextLive(In mac, you can use MacTex) + +```bash +> cd tex && make all +> cd ../doc/example && latexmk +``` + +## Notes and Acknowledgments + +This code base is built on top of [CasperVector/pkuthss](https://github.com/CasperVector/pkuthss). + +The following files have been changed + +- .gitignore +- README.md +- tex/pkuthss.cls +- tex/pkuthss-\*.def +- tex/Makefile +- doc/example/chap/\* +- doc/example/latexmkrc +- doc/example/thesis.bib +- doc/example/thesis.tex + +## ToDo Lists + +- [x] Check Table and Fig Setting. +- [x] Support Overleaf. +- [x] Fix table of contents. +- [x] Support insert pdf (copy and origin pages). +- [x] Adaptive pkuthss v1.9.0. + +## Change Log + +See [CHANGELOG.md](CHANGELOG.md) for the detailed changes in each release. + +## QA in chinese + +1. Q: 原创页使用这种方式生成得到的文件与 Mac 端字体不同。 + +A: 门户生成的 PDF 文件将字体信息写入文件,导致在 Mac 端呈现字体效果不同(Mac 端显示的是华文字体,而 Windows 端显示的是中易字体)。 +请务必在 Windows 系统下进行打印,或者使用本包生成文件进行打印。 + +## Lincense + +This repository following [LaTeX Project Public License](http://www.latex-project.org/lppl.txt) and [Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/deed.en). diff --git a/README.txt b/README.txt deleted file mode 100644 index 424793e..0000000 --- a/README.txt +++ /dev/null @@ -1,18 +0,0 @@ -pkuthss: LaTeX template for dissertations in Peking University --------------------------------------------------------------- - -Maintainer: Casper Ti. Vector -Homepage: - -Licence: -* New BSD Licence for `copy.tex' and `origin.tex'. -* LaTeX Project Public Licence 1.3 or later for files in `tex/' and - `doc/readme/', except for those mentioned above. -* Public domain for all other files. - -This package provides a simple, clear and flexible LaTeX template for -dissertations in Peking University. - -This file (`README.txt') is *NOT* intended as the documentation for this -package; please see the file `pkuthss.pdf' instead. - diff --git a/doc/example/chap/abs.tex b/doc/example/chap/abs.tex index ea215a8..0e7f2f8 100644 --- a/doc/example/chap/abs.tex +++ b/doc/example/chap/abs.tex @@ -1,12 +1,9 @@ -% Copyright (c) 2014,2016,2021 Casper Ti. Vector -% Public domain. - \begin{cabstract} - \pkuthssffaq % 中文测试文字。 + 中文摘要部分... \end{cabstract} -\ifblind\begin{beabstract}\else\begin{eabstract}\fi - Test of the English abstract. -\ifblind\end{beabstract}\else\end{eabstract}\fi +\begin{eabstract} + 英文摘要部分... +\end{eabstract} % vim:ts=4:sw=4 diff --git a/doc/example/chap/ach.tex b/doc/example/chap/ach.tex new file mode 100644 index 0000000..46106ac --- /dev/null +++ b/doc/example/chap/ach.tex @@ -0,0 +1,9 @@ +\def\cpublication{攻读硕士期间发表的论文及其他成果} + +\renewcommand{\bibname}{\cpublication} +\begin{thebibliography}{9}{ +\zihao{5} +\bibitem{publish} +\textbf{扎克·施耐德}, XXX XXX, et al. XXXX Title[C/OL]//III H D, SINGH A. Proceedings of Machine Learning Research: Proceedings of the 37th International Conference on Machine Learning: vol. 119. [S.l.]: PMLR, 2020: XXXX-XXXX. http://proceedings.ml r.press/XXXX.html.(一作,CCF-A) +}\end{thebibliography} +\addcontentsline{toc}{chapter}{\cpublication} diff --git a/doc/example/chap/ack.tex b/doc/example/chap/ack.tex index 4af4d39..7062130 100644 --- a/doc/example/chap/ack.tex +++ b/doc/example/chap/ack.tex @@ -1,7 +1,3 @@ -% Copyright (c) 2014,2016 Casper Ti. Vector -% Public domain. - \chapter{致谢} -\pkuthssffaq % 中文测试文字。 -% vim:ts=4:sw=4 +致谢部分... \ No newline at end of file diff --git a/doc/example/chap/chap1.tex b/doc/example/chap/chap1.tex index 3d631f3..1cc5eb8 100644 --- a/doc/example/chap/chap1.tex +++ b/doc/example/chap/chap1.tex @@ -1,7 +1,272 @@ -% Copyright (c) 2014,2016,2018 Casper Ti. Vector -% Public domain. +\chapter{引论} +\label{chap:introduction} -\chapter{引言} -\pkuthssffaq % 中文测试文字。 +本章为\iofupkuthss{}\footnote{\iofupkuthss{} 是基于\pkuthss{}~\cite{casper2011pkuthss}针对硕士研究生学位论文要求进行适配的\LaTeX{}文档类,符合北京大学硕士学位论文写作规范,并能通过图书馆审查。其官方仓库为\url{https://github.com/iofu728/pkuthss},当前版本\iofuversion。}文档类的示例文档,对硕士学位论文写作过程中常见用法和问题进行介绍说明。 -% vim:ts=4:sw=4 +\section{封面及pkuthssinfo相关} +\label{sec:cover-pkuthssinfo} + +pkuthssinfo相关配置与\pkuthss{}原文档类完全一致,均为配置参数,可参考\pkuthss{}文档\footnote{\url{https://bbs.pku.edu.cn/attach/c8/3e/c83e980c93b838a3/pkuthss-bootstrap-0.1.7.pdf}}。 +目前\iofupkuthss{}基于\pkuthss{} \iofubaseversion{}进行开发。 + +封面部分参考《北京大学研究生学位论文写作指南V2.0-2019》(以下简称写作指南)第1.1节中描述和《硕士论文模板2020》进行修改。 + +\begin{Verbatim} +\pkuthss{}info{ + cthesisname = {硕士学位论文}, + thesiscover = {硕士研究生学位论文}, + ethesisname = {Master Thesis}, + ctitle = {基于XXXX的XXXX系统设计与实现}, + etitle = {Design and implementation of a XXXXX system based on XXXX}, + cauthor = {扎克·施耐德}, eauthor = {Zack Snyder}, + studentid = {180XXXXXXX}, + % 具体时间以教务为准,初稿3月,送审4月,答辩5月,最终6月。 + date = {\zhdigits{2021}\ \ 年\ \ \zhnumber{6}\ \ 月}, + school = {XXXXXX学院}, + cmajor = {XXXX}, emajor = {XXXX}, + direction = {XXXX}, + mentorlines = {2}, % 导师个数 + % 副教授 A.P. 讲师 Lec. + cmentor = {XXX\ \ 教授\\YYY\ \ 教授}, ementor = {Prof.\ XXX and Prof.\ YYY}, + ckeywords = {A,B,C,D}, + ekeywords = {A,B,C,D}, + % 盲审模式参数, 需在documentclass增加blind + blindid = {XXXXXXXXX}, discipline = {XXXX} +} +\end{Verbatim} + +\section{字体设定} +\label{sec:fontset} + +本文档类提供五种默认字体设定分别为\verb|windows|,\verb|windows@overleaf|,\verb|mac|,\verb|ubuntu|,\verb|fandol|。 +其中,默认情况下,Overleaf平台下仅可使用\verb|fandol|,\verb|ubuntu|两种模式,\textbf{推荐使用}\verb|fandol|\textbf{模式(默认)}。 +如遇字符不显示问题,可使用\verb|ubuntu|模式,或者自行收集上传\verb|simsun.ttf|,\verb|simhei.ttf|,\verb|simfang.ttf|,\verb|simkai.ttf|至根目录并使用\verb|windows|模式(注意文件名称和 版权问题),亦或者下载至本地windows环境使用\verb|windows@overleaf|模式。详细可见第\ref{chap:related}章文档内容。 + +\section{版权声明与原创页} +\label{sec:copy-origin} + +写作指南中要求各学生从校内门户或者从研究生院网站下载相应的文件进行替换、签名或者打印。 +\textbf{需要注意的是},门户生成的PDF文件将字体信息写入文件,导致在Mac端呈现字体效果不同(Mac 端显示的是华文字体,而 Windows 端显示的是中易字体)。请务必在Windows系统下进行打印,或者使用本包生成文件进行打印。 +本文使用\verb|textblock|和\verb|colorbox|宏包进行实现,参数按照PDF格式为A4进行调校,如有需要可以进行微调。 + +\begin{Verbatim} + \begin{textblock}{1}(-0.8,-0.08) + \colorbox{white}{ + \includegraphics[height = 1.2448\textheight]{文件路径} + } + \end{textblock} +\end{Verbatim} + +此外在论文电子版制作过程中,需要替换原创页签名扫描件,使用相同方式即可。 + +\section{摘要部分} +\label{sec:abstract} + +在\verb|\begin{cabstract}|和\verb|\begin{eabstract}|环境中进行书写。 +如论文工作受到基金资助,需要在中文摘要第一页的页脚处标注:本研 究得到某某基金(编号:xxx)资助。 + +\section{目录} +\label{sec:directory} + +按照写作指南和《硕士论文模板2020》进行调整,1)对章级增加点线;2)对间距和字体进行调整。 + +\section{主要符号对照表} +\label{sec:denotation} + +参考\verb|chap/deno.tex|即可,在\verb|\begin{denotation}|环境下,使用\verb|\item[X] Y|分别表示符号及其说明。 + +已知问题: 符号处不能输入中括号$[$,$]$。 + +\section{图表相关} +\label{sec:table-figure} + +\subsection{表格样例} +\label{sec:table-example} + +\begin{table*}[htb] + \centering + \begin{minipage}[t]{0.55\linewidth} % + \caption[表格脚注样例表]{表格脚注样例表。表名可通过中括号添加缩略名。} + \label{tab:example-table-basic} + \begin{small} + \begin{tabular}{@{}lccccc@{}} + \toprule[1.5pt] + & \textbf{X} & \textbf{Y} & \textbf{Z} & \textbf{N} & \textbf{M} \\ + \midrule[1pt] + 默认 & 99.99 & 99.99 & 99.99 & 99.99\footnote{表格中的脚注1} & 99.99 \\ + \quad w/o X & 99.99 & 99.99 & 99.99 & 99.99 & 99.99 \\ + \quad w/o Y & 99.99 & 99.99 & 99.99 & 99.99 & 99.99 \\ + \quad w/o Z & 99.99\footnote{表格中的脚注2} & 99.99 & 99.99 & 99.99 & 99.99 \\ + \quad w/o N & 99.99 & 99.99 & 99.99 & 99.99 & 99.99 \\ + \quad w/o M & 99.99 & 99.99 & 99.99 & 99.99 & 99.99 \\ + \bottomrule[1.5pt] + \end{tabular} + \end{small} + \end{minipage} +\end{table*} + +一般学术论文需要使用三线表(如表~\ref{tab:example-table-basic}),需要依赖宏包\verb|booktabs|,使用\verb|\toprule|,\verb|\midrule|,\verb|\bottomrule|控制三线。 +此外表序和表名位于表格的上方。 +如果需要对表格内进行脚注,可通过\texttt{minipage}中嵌套\texttt{tabular}来实现,具体可参考Stack Overflow\footnote{\url{https://stackoverflow.com/questions/2888817/footnotes-for-tables-in-latex}}。 + +如需要注明表格中数据来源,则可使用类似的方式,见表~\ref{tab:example-table-source-foot}。 + +当表格较大,不能在一页内打印时,可以“续表”的形式另页打印,可使用宏包\verb|longtable|实现,如表~\ref{tab:example-table-continue}。 + +{\begin{longtable}[c]{c*{7}{r}} +\caption[续表]{续表样例表。} +\label{tab:example-table-continue}\\ +\toprule[1.5pt] + \multicolumn{1}{c}{年龄} & 性别 & \multicolumn{1}{c}{cp} & \multicolumn{1}{c}{静息血压} & \multicolumn{1}{c}{chol} +& \multicolumn{1}{c}{空腹血糖>} & \multicolumn{1}{c}{restecg} & \multicolumn{1}{c}{thalachh} \\ +\multicolumn{1}{c}{(岁)} & & \multicolumn{1}{c}{胸痛型}& +\multicolumn{1}{c}{毫米汞柱}& \multicolumn{1}{c}{胆固醇}& \multicolumn{1}{c}{ + 120 mg/dl}& 静息状态 & 最大心率 \\\midrule[1pt] +\endfirsthead +\multicolumn{8}{c}{续表~\thetable\hskip1em 续表样例表。}\\ +\toprule[1.5pt] + \multicolumn{1}{c}{年龄} & 性别 & \multicolumn{1}{c}{cp} & \multicolumn{1}{c}{静息血压} & \multicolumn{1}{c}{chol} +& \multicolumn{1}{c}{空腹血糖>} & \multicolumn{1}{c}{restecg} & \multicolumn{1}{c}{thalachh} \\ +\multicolumn{1}{c}{(岁)} & & \multicolumn{1}{c}{胸痛型}& +\multicolumn{1}{c}{毫米汞柱}& \multicolumn{1}{c}{胆固醇}& \multicolumn{1}{c}{ + 120 mg/dl}& 静息状态 & 最大心率 \\\midrule[1pt] +\endhead +\hline +\multicolumn{8}{r}{续下页} +\endfoot +\endlastfoot +63 & 1 & 3 & 145 & 233 & 1 & 0 & 150 \\ +37 & 1 & 2 & 130 & 250 & 0 & 1 & 187 \\ +41 & 0 & 1 & 130 & 204 & 0 & 0 & 172 \\ +56 & 1 & 1 & 120 & 236 & 0 & 1 & 178 \\ +57 & 0 & 0 & 120 & 354 & 0 & 1 & 163 \\ +57 & 1 & 0 & 140 & 192 & 0 & 1 & 148 \\ +56 & 0 & 1 & 140 & 294 & 0 & 0 & 153 \\ +44 & 1 & 1 & 120 & 263 & 0 & 1 & 173 \\ +52 & 1 & 2 & 172 & 199 & 1 & 1 & 162 \\ +57 & 1 & 2 & 150 & 168 & 0 & 1 & 174 \\ +54 & 1 & 0 & 140 & 239 & 0 & 1 & 160 \\ +48 & 0 & 2 & 130 & 275 & 0 & 1 & 139 \\ +49 & 1 & 1 & 130 & 266 & 0 & 1 & 171 \\ +64 & 1 & 3 & 110 & 211 & 0 & 0 & 144 \\ +\bottomrule[1.5pt] +\end{longtable} +\footnotesize 注:数据来源于Kaggle Heart Attack Analysis \& Prediction Data Set。} + +\begin{table*}[htbp] + \centering + \caption[数据来源注释表]{表格数据来源注释样例表。} + \label{tab:example-table-source-foot} + \begin{minipage}[t]{0.9\textwidth} + \begin{small} + \begin{tabular}{@{}l|ccc|ccc@{}} + \toprule + \multirow{2}{*}{\textbf{Model}} & \multicolumn{3}{c|}{\textbf{数据集A}} & \multicolumn{3}{c}{\textbf{数据集B}} \\ \cmidrule(l){2-7} + & \textbf{指标a}(\%) & \textbf{指标b}(\%) & \textbf{指标c} & \textbf{指标a} (\%) & \textbf{指标b}(\%) & \textbf{指标c} \\ \midrule + \citet{devlin2018bert} &99.99 & 99.99 & 99.99 &99.99 & 99.99 & 99.99 \\ + \citet{yang2019xlnet} &99.99 & 99.99 & 99.99 &99.99 & 99.99 & 99.99 \\ + \bottomrule + \end{tabular}\\[6pt] + \footnotesize 注:数据来源XXXXXX。\\ + \end{small} + \end{minipage} +\end{table*} + +\subsection{图片样例} +\label{sec:figure-example} + +\begin{figure}[htb] + \centering + \subfloat[北京大学校徽]{ + \label{sfig:example-fig-logo-fig} + \includegraphics[height=2cm]{img/pku-fig-logo}}\hspace{4em} + \subfloat[北京大学中文校名,依照北京大学标识管理办公室出具的北大标识使用基本规范进行使用]{ + \label{sfig:example-fig-logo-text} + \includegraphics[height=2cm]{img/pku-text-logo}} + \caption{包含子图形的大图形} + \label{fig:example-fig-subfloat} +\end{figure} + +当需要插入多个子图的时候,可以选用宏包\verb|subfloat|,不推荐使用 +\verb|subfigure| 和 \verb|subtable|。 + +若使用继承于\verb|subfigure|的宏包,例如\verb|subfloat|、\verb|subfigure|等,则可直接使用引用\verb|\ref{sfig:xxxx}|引用子图label,如图~\ref{sfig:example-fig-logo-fig}。 +否则需要引用主图,再单独标注子图序号,以便符合学位论文要求。 + +此外,与表格相反,图序和图名需要位于图片的下方。 +如果含有子图,每个子图需要具有相应的子图名。 + + +如果需要并排使用两个独立的图形,分别编排图序,则可使用\verb|minipage|,如图~\ref{fig:example-fig-abreast-1}和图~\ref{fig:example-fig-abreast-2}。 + +\begin{figure}[htb] +\begin{minipage}{0.48\textwidth} + \centering + \includegraphics[height=2cm]{img/pku-fig-logo} + \caption{北京大学校徽} + \label{fig:example-fig-abreast-1} +\end{minipage}\hfill +\begin{minipage}{0.48\textwidth} + \centering + \includegraphics[height=2cm]{img/pku-text-logo} + \caption{北京大学中文校名,依照北京大学标识管理办公室出具的北大标识使用基本规范进行使用} + \label{fig:example-fig-abreast-2} +\end{minipage} +\end{figure} + +\section{公式} +\label{sec:equation} + +公式部分考虑到写作指南中无关于公式页的说明,并未做改动,使用通用\LaTeX{}规范即可。对于复杂公式需求,可使用\verb|amsmath|宏包结合Mathpix\footnote{\url{https://mathpix.com/}}等自动化识别工具。 + +\begin{multline*} +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\,dx\biggr\}\,dy \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\,dy +\end{multline*} + +上述公式来源于\citeauthor{liu2003uncertain}的《不确定规划》\citet{liu2003uncertain}。 + +\section{参考文献} +\label{sec:bibtex} + +参考文献根据写作指南使用\verb|gb7714-2015|bibstyle进行管理,具体引用命令与日常使用类似,\verb|\cite{}|,\verb|\citet{}|,\verb|\citeauthor{}|,具体用法见相应文档\footnote{\url{https://github.com/hushidong/biblatex-gb7714-2015}}。 + +例如\verb|\cite{devlin2018bert}|=\cite{devlin2018bert},\verb|\citeauthor{gut2013probability}|=\citeauthor{gut2013probability},... +相对于的bib文件的书写基本上直接用Google Scholar拷贝的BibTex即可,部分属性按提示进行微调。 +\begin{Verbatim} + \usepackage[backend=biber,bibstyle=gb7714-2015,citestyle=gb7714-2015]{biblatex} +\end{Verbatim} + +\section{其他} +\label{sec:other} + +正文不建议使用四级目录\verb|\subsubsection{}|。 + +本示例文档参考写作指南,《硕士论文模板2020》,《清华大学学位论文\LaTeX{}模板使用示例文档》和《\pkuthss{} 使用说明》进行书写。 +遵循 \LaTeX{} Project Public License 和 Attribution 4.0 International (CC BY 4.0) 开源协议。 + +\section{与\pkuthss{} \iofubaseversion{}异同} + +\textbf{格式方面:} + +\begin{enumerate} + \item ``关键词” + ``KEY WORDS” 非粗体 + \item ``题目” key 字号2号,value 字号1号 + \item ``姓名” key 字号小3 + \item 隐藏超链接 + \item 目录字体、样式(点线)、间距 +\end{enumerate} + +\textbf{功能方面:} + +\begin{enumerate} + \item 增加主要符号对照表 + \item 脚注从当前页开始标注 + \item 表格内脚注样式 + \item 子图引用格式 + \item 字体模式 + \item 简化blind模式下用户设定 + \item Windows 下中易宋体的粗体用假粗体替代 +\end{enumerate} diff --git a/doc/example/chap/chap2.tex b/doc/example/chap/chap2.tex index 85f7008..e2b1466 100644 --- a/doc/example/chap/chap2.tex +++ b/doc/example/chap/chap2.tex @@ -1,7 +1,142 @@ -% Copyright (c) 2014,2016 Casper Ti. Vector -% Public domain. +\chapter{理论基础} +\label{chap:related} -\chapter{章节} -\pkuthssffaq % 中文测试文字。 +本章对\pkuthss{}适配Overleaf平台的工作进行阐述和整理,希望对有兴趣了解和有需求修改相应配置的同学有所帮助。 +本人才疏学浅,如有纰漏欢迎交流指正。 -% vim:ts=4:sw=4 +\def\XeLaTeX{ +\leavevmode +\setbox0=\hbox{X\lower.5ex\hbox{\kern-.15em\reflectbox{E}}\kern-.1667em\LaTeX}% +\dp0=0pt\ht0=0pt\box0 +} + +\section{Overleaf适配存在的问题} +\label{sec:overleaf-problem} + +Overleaf是一个开源在线实时协作\LaTeX{}编辑器,其\url{www.overleaf.com}托管版本是基于Ubuntu构建的。 +Overleaf适配过程中遇到的问题不是\TeX{} Live版本\footnote{Overleaf托管版本目前支持2014-2020共8种\TeX{} Live版本。},也不是\TeX{}排班引擎/方式的问题\footnote{Overleaf托管版本目前支持\LaTeX{},pdf\LaTeX{},Lua\LaTeX{},\XeLaTeX{}四种编译方式。而\pkuthss{}是支持\XeLaTeX{}、\LaTeX{}+DVIPDFM$x$和pdf\LaTeX{}三种模式,本文选择\XeLaTeX{}编译方式进行适配。}, +主要问题在于字体包使用。 + +\section{适配细节} +\label{sec:overleaf-detail} + +\pkuthss{}适配Overleaf可追溯到Casper/pkuthss的\href{https://github.com/CasperVector/pkuthss/issues/28}{Issue\#28}。 +事实上当时@lianze已经给出了正确的解决方案。 + +\subsection{\CTeX{}字库特点} +\label{sec:ctex-font} + +\pkuthss{}使用\CTeX{}宏集进行中文排版,具体为文档类\verb|ctexbook|。 +而默认情况下,\CTeX{}宏集根据编译方式和操作系统相应字库。 +表~\ref{tab:ctex-font-select}中归纳了默认状态下各个操作系统和编译方式对应的字库使用策略。 + +由于本文选用了\XeLaTeX{}编译方式进行适配,而原始文档类\pkuthss{}使用的是Windows下\verb|ctex-fontset|设定,Overleaf托管版本基于Linux系统,两者区别在于原始文档类\pkuthss{}使用商用字体库(例如中易黑体、微软雅黑等),而Overleaf托管版本使用开源中文字体库Fandol。 + +原先\pkuthss{}在\verb|ctex-fontset-pkuthss.def|定义了使用的字体依赖,具体情况如下: +\begin{itemize} + \item \verb|\songti|,中易宋体,作为默认中文字体使用,衬线字体,\verb|\textrm|; + \item \verb|\heiti|,中易黑体,无衬线字体,\verb|\bfseries|,\verb|\textbf|和\verb|\textsf|; + \item \verb|\fangsong|,中易仿宋,等宽字体,\verb|\texttt|; + \item \verb|\kaishu|,中易楷体,\verb|\textit|; + \item \verb|\lishu|, \verb|\youyuan|这两者在Linux下不存在,在windows、founder、macnew字库中才存在。原\pkuthss{}文档类中仅申明未使用。 +\end{itemize} + +\begin{table}[htbp] +\centering +\begin{minipage}[t]{\linewidth} % +\caption{\CTeX{} 宏集自动配置字体策略} +\label{tab:ctex-font-select} +\resizebox{\linewidth}{!}{ +\begin{tabular}{*{5}{c}} + \toprule + & macOS Old\footnotemark[1] + & macOS New\footnotemark[2] + & Windows\footnotemark[3] + & 其他\footnotemark[4] \\ + \midrule + \XeLaTeX & \makecell{\pkg{xeCJK}\\华文字库} + & \makecell{\pkg{xeCJK}\\华文字库 + 苹方} + & \makecell{\pkg{xeCJK}\\中易字库 + 微软雅黑} + & \makecell{\pkg{xeCJK}\\Fandol 字库\footnotemark[5]} \\ + \cmidrule(lr){1-5} + Lua\LaTeX\footnotemark[6] + & \makecell{\pkg{LuaTeX-ja}\\华文字库} + & \makecell{\pkg{LuaTeX-ja}\\华文字库 + 苹方} + & \makecell{\pkg{LuaTeX-ja}\\中易字库 + 微软雅黑} + & \makecell{\pkg{LuaTeX-ja}\\Fandol 字库} \\ + \cmidrule(lr){1-5} + pdf\LaTeX + & 不可用 + & 不可用 + & \makecell{\pkg{CJK} + \pkg{zhmetrics}\\中易字库 + 微软雅黑\footnotemark[7]} + & 不可用 \\ + \cmidrule(lr){1-5} + \makecell{\LaTeX{} + \\ DVIPDFM$x$} + & 不可用 + & \makecell{\pkg{CJK} + \pkg{zhmetrics}\\华文字库 + 苹方} + & \makecell{\pkg{CJK} + \pkg{zhmetrics}\\中易字库 + 微软雅黑\footnotemark[7]} + & \makecell{\pkg{CJK} + \pkg{zhmetrics}\\Fandol 字库} \\ + \cmidrule(lr){1-5} + \makecell{up\LaTeX{} + \\DVIPDFM$x$} + & 不可用 + & \makecell{\pkg{zhmetrics-uptex}\\华文字库 + 苹方} + & \makecell{\pkg{zhmetrics-uptex}\\中易字库 + 微软雅黑} + & \makecell{\pkg{zhmetrics-uptex}\\Fandol 字库} \\ + \bottomrule +\end{tabular} +} +\footnotetext[1]{Yosemite (10.10) 及以前的 macOS 系统。} +\footnotetext[2]{El Capitan (10.11) 及以后的 macOS 系统。} +\footnotetext[3]{仅支持 Windows Vista 及以后的 Windows 操作系统。} +\footnotetext[4]{\CTeX{}将其他系统统一归为 Linux。} +\footnotetext[5]{由马起园、苏杰、黄晨成等人开发的开源中文字体, + 参见:\url{https://www.ctan.org/pkg/fandol}。} +\footnotetext[6]{Lua\LaTeX{} 编译时使用 \pkg{LuaTeX-ja} 宏包。} +\footnotetext[7]{微软雅黑字体并不总是有效,与选项 \pkg{zhmap} 的取值有关。} +\\[6pt] +\footnotesize 注:数据来源与\CTeX{}宏集手册v2.5.6。\\ +\end{minipage} +\end{table} + +\subsection{fontset 设定} +\label{sec:overleaf-fontset} + +查阅写作指南,申明使用中文字体宋体、仿宋和黑体,英文字体Times New Roman和\textsf{Arial}共五种字体,对楷体、隶书、幼圆等字体并未提及。 + +由于Overleaf托管版本只拥有开源字体版权\footnote{具体清单详见Overleaf说明文档\url{https://www.overleaf.com/learn/latex/Questions/Which_OTF_or_TTF_fonts_are_supported_via_fontspec\%3F}},无商用字体版权(例如中易字集)。 + + +\begin{table}[htb] + \centering + \caption{\iofupkuthss{}预设的字体} + \label{tab:ctex-fontset} + \begin{minipage}[t]{0.55\linewidth} % + \begin{tabular}{ccccc} + \toprule + & \option{windows}\footnote{与windows@overleaf模式相同} & \option{mac} & \option{ubuntu} & \option{fandol} \\ + \midrule + 宋体 & 中易宋体 & 华文宋体 & 思源宋体 & Fandol 宋体 \\ + \heiti{黑体} & 中易黑体 & 华文黑体 & 思源黑体 & Fandol 黑体 \\ + \fangsong{仿宋} & 中易仿宋 & 华文仿宋 & Fandol 仿宋 & Fandol 仿宋 \\ + \bottomrule + \end{tabular} + \end{minipage} +\end{table} + +本文档类申明的5种字体模式\verb|fontset|对应使用字体情况如表~\ref{tab:ctex-fontset}所示。 +其中,\verb|windows|和\verb|mac|模式为商业字体。默认情况下,不能在Overleaf平台上使用。而\verb|fandol|和\verb|ubuntu|模式为开源字体,可在Overleaf平台上使用。 + +而对于中文字体,不同种类的字体实现细节存在细微差异,所对应的字符数也不同,对于极生僻词开源字体可能会出现显示异常的情况,如垚y\'ao,\verb|fandol|模式下不可见。 +但考虑到版权问题和字体效果,\textbf{Overleaf平台仍然推荐使用}\verb|fandol|\textbf{模式}。 +如在使用中发现较多字符不显示,可考虑使用\verb|ubuntu|模式,或者自行收集上传\verb|simsun.ttf|,\verb|simhei.ttf|,\verb|simfang.ttf|,\verb|simkai.ttf|至根目录并使用\verb|windows@overleaf|模式(注意文件名称和版权问题),亦或者下载至本地windows环境使用\verb|windows|模式。 + +为支持文档类的fontset设定能力,使用宏包\verb|kvsetkeys|,\verb|kvdefinekeys|,\verb|kvoptions|对key的默认值,可选范围进行管理。 + +\subsection{编码方式} +\label{sec:overleaf-encoding} + +由于使用\XeLaTeX{}编译时,\CTeX{}宏集强制使用UTF-8编码,相对应的包括\verb|.def|文件、所有\verb|*.tex|文件均应该使用UTF-8编码方式进行编码。 + +\subsection{粗体设定} + +由于Windows 下中易宋体无粗体,原文档类\pkuthss{}对于宋体的粗体\verb|\textbf{}|使用黑体替代,本文档类\iofupkuthss{}则依照Windows惯常设定,使用对应字体的假粗体作为粗体\verb|\textbf{}|。 diff --git a/doc/example/chap/chap3.tex b/doc/example/chap/chap3.tex index ed66f12..72c9767 100644 --- a/doc/example/chap/chap3.tex +++ b/doc/example/chap/chap3.tex @@ -1,7 +1,4 @@ -% Copyright (c) 2014,2016,2018 Casper Ti. Vector -% Public domain. +\chapter{Model 1} +\label{chap:model1} -\chapter{结论和展望} -\pkuthssffaq % 中文测试文字。 - -% vim:ts=4:sw=4 +第三章部分... \ No newline at end of file diff --git a/doc/example/chap/chap4.tex b/doc/example/chap/chap4.tex new file mode 100644 index 0000000..936d18f --- /dev/null +++ b/doc/example/chap/chap4.tex @@ -0,0 +1,4 @@ +\chapter{Model 2} +\label{chap:model2} + +第四章部分... \ No newline at end of file diff --git a/doc/example/chap/chap5.tex b/doc/example/chap/chap5.tex new file mode 100644 index 0000000..cff060c --- /dev/null +++ b/doc/example/chap/chap5.tex @@ -0,0 +1,4 @@ +\chapter{Model 3} +\label{chap:model3} + +第五章部分... \ No newline at end of file diff --git a/doc/example/chap/chap6.tex b/doc/example/chap/chap6.tex new file mode 100644 index 0000000..3d0d8e9 --- /dev/null +++ b/doc/example/chap/chap6.tex @@ -0,0 +1,4 @@ +\chapter{总结和展望} +\label{chap:conclusion} + +第六章部分... \ No newline at end of file diff --git a/doc/example/chap/copy.tex b/doc/example/chap/copy.tex index 4dd05b3..f1498b5 100644 --- a/doc/example/chap/copy.tex +++ b/doc/example/chap/copy.tex @@ -1,5 +1,6 @@ % Copyright (c) 2008-2009 solvethis % Copyright (c) 2010-2017,2021 Casper Ti. Vector +% Copyright (c) 2021 iofu728 % All rights reserved. % % Redistribution and use in source and binary forms, with or without @@ -35,11 +36,13 @@ \chapter*{版权声明} 任何收存和保管本论文各种版本的单位和个人, 未经本论文作者同意,不得将本论文转借他人, 亦不得随意复制、抄录、拍照或以任何方式传播。 -否则,引起有碍作者著作权之问题,将可能承担法律责任。 +否则一旦引起有碍作者著作权之问题,将可能承担法律责任。 -% 若须排版二维码,请将二维码图片重命名为“barcode”, -% 转为合适的图片格式,并放在当前目录下,然后去掉下面 2 行的注释。 -%\vfill\noindent -%\includegraphics[height = 5em]{barcode} +% 替换门户下载pdf +\begin{textblock}{1}(-0.8,-0.08) + \colorbox{white}{ + \includegraphics[height = 1.2448\textheight]{img/bqsm_180xxxxxxx.pdf} + } +\end{textblock} -% vim:ts=4:sw=4 +% vim:ts=4:sw=4 \ No newline at end of file diff --git a/doc/example/chap/deno.tex b/doc/example/chap/deno.tex new file mode 100644 index 0000000..b12cce1 --- /dev/null +++ b/doc/example/chap/deno.tex @@ -0,0 +1,21 @@ +\begin{denotation} + +\item[$x,y,m,n,t$] 标量,通常为变量 +\item[$K,L,D,M,N,T$] 标量,通常为超参数 +\item[$x\in \mathbb{R}^{D}$] D维列向量 +\item[$(x_1,\cdots,x_D)$] D维行向量 +\item[$(x_1,\cdots,x_D)^T$ or $(x_1;\cdots;x_D)^T$] D维行向量 +\item[$\v A\in \mathbb{R}^{K\times D}$] 大小为$K\times D$的矩阵 +\item[$x\in \mathbb{R}^{KD}$] ($KD$)维的向量 +\item[$\mathbb{M}_i$ or $\mathbb{M}_i(\v x)$] 第$i$列为$\v 1$(或者$\v x$),其余为$\v 0$的矩阵 +\item[$diag(\v x)$] 对角矩阵,其对角元素为$\v x$ +\item[$\v I_N$ or $I$] ($N\times N$)的单位阵 +\item[$diag(\v A)$] 列向量,其元素为$\v A$的对角元素 +\item[$\v A \in \mathbb{R}^{D_1\times D_2\times \cdots \times D_K}$] 大小为$D_1\times D_2\times \cdots \times D_K$的张量 +\item[$\{x^{(n)}\}^{N}_{n=1}$] 集合 +\item[$\{(x^{(n)},y^{(n)})\}^{N}_{n=1}$] 数据集 +\item[$\mathcal{N}(\v x;\mu,\sum)$] 变量$x$服从均值为$\mu$,方差为$\sum$的高斯分布 + +\end{denotation} + +\footnotetext[1]{本符号对照表内容选自\citeauthor{qiu2020nndl}老师的《神经网络与深度学习》\cite{qiu2020nndl}一书。} \ No newline at end of file diff --git a/doc/example/chap/origin.tex b/doc/example/chap/origin.tex index bf0cc33..46c3312 100644 --- a/doc/example/chap/origin.tex +++ b/doc/example/chap/origin.tex @@ -1,6 +1,7 @@ % Copyright (c) 2008-2009 solvethis % Copyright (c) 2010-2017,2021 Casper Ti. Vector % Copyright (c) 2021 Kurapica +% Copyright (c) 2021 iofu728 % All rights reserved. % % Redistribution and use in source and binary forms, with or without @@ -37,48 +38,13 @@ % 学校书面要求本页面不要页码,但在给出的 Word 模版中又有页码。 % 此处以学校书面要求为准。 \thispagestyle{empty} - \mbox{}\vspace*{-3em} - \section*{原创性声明} - - 本人郑重声明: - 所呈交的学位论文,是本人在导师的指导下,独立进行研究工作所取得的成果。 - 除文中已经注明引用的内容外, - 本论文不含任何其他个人或集体已经发表或撰写过的作品或成果。 - 对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。 - 本声明的法律结果由本人承担。 - \vskip 1em - \rightline{% - 论文作者签名:\hspace{5em}% - 日期:\hspace{2em}年\hspace{2em}月\hspace{2em}日% - } - - \section*{% - 学位论文使用授权说明\\[-0.33em] - \textmd{\zihao{5}(必须装订在提交学校图书馆的印刷本)}% - } - - 本人完全了解北京大学关于收集、保存、使用学位论文的规定,即: - \begin{itemize} - \item 按照学校要求提交学位论文的印刷本和电子版本; - \item 学校有权保存学位论文的印刷本和电子版, - 并提供目录检索与阅览服务,在校园网上提供服务; - \item 学校可以采用影印、缩印、数字化或其它复制手段保存论文; - \item 因某种特殊原因须要延迟发布学位论文电子版, - 授权学校 $\Box$\nobreakspace{}一年 / - $\Box$\nobreakspace{}两年 / - $\Box$\nobreakspace{}三年以后,在校园网上全文发布。 - \end{itemize} - \centerline{(保密论文在解密后遵守此规定)} - \vskip 1em - \rightline{% - 论文作者签名:\hspace{5em}导师签名:\hspace{5em}% - 日期:\hspace{2em}年\hspace{2em}月\hspace{2em}日% - } - - % 若须排版二维码,请将二维码图片重命名为“barcode”, - % 转为合适的图片格式,并放在当前目录下,然后去掉下面 2 行的注释。 - %\vfill\noindent - %\includegraphics[height = 5em]{barcode} + + % 替换扫描pdf,去除includegraphics前注释 + \begin{textblock}{1}(-0.8,-0.08) + \colorbox{white}{ + \includegraphics[height = 1.2448\textheight]{img/lwsm_180xxxxxxx.pdf} + } + \end{textblock} } -% vim:ts=4:sw=4 +% vim:ts=4:sw=4 \ No newline at end of file diff --git a/doc/example/img/bqsm_180xxxxxxx.pdf b/doc/example/img/bqsm_180xxxxxxx.pdf new file mode 100644 index 0000000..a2ce278 Binary files /dev/null and b/doc/example/img/bqsm_180xxxxxxx.pdf differ diff --git a/doc/example/img/lwsm_180xxxxxxx.pdf b/doc/example/img/lwsm_180xxxxxxx.pdf new file mode 100644 index 0000000..1e2cda7 Binary files /dev/null and b/doc/example/img/lwsm_180xxxxxxx.pdf differ diff --git a/doc/example/img/pku-fig-logo.png b/doc/example/img/pku-fig-logo.png new file mode 100644 index 0000000..fede175 Binary files /dev/null and b/doc/example/img/pku-fig-logo.png differ diff --git a/doc/example/img/pku-text-logo.png b/doc/example/img/pku-text-logo.png new file mode 100644 index 0000000..57b6b8d Binary files /dev/null and b/doc/example/img/pku-text-logo.png differ diff --git a/doc/example/latexmkrc b/doc/example/latexmkrc index 8df2c24..0a43c6e 100644 --- a/doc/example/latexmkrc +++ b/doc/example/latexmkrc @@ -6,6 +6,7 @@ $pdf_mode = 5; # 用 latex 模式编译时,使用 dvipdfmx 而非默认的 dvipdf。 $dvipdf = "dvipdfmx %O -o %D %S"; +$xdvipdfmx="xdvipdfmx -E -o %D %O %S"; # 此选项相关说明见 texdoc latexmk。 $bibtex_use = 1.5; $biber = "biber -l zh__pinyin --output-safechars %O %S"; diff --git a/doc/example/thesis.bib b/doc/example/thesis.bib index ac5b0c9..502d77f 100644 --- a/doc/example/thesis.bib +++ b/doc/example/thesis.bib @@ -1,19 +1,54 @@ -@article{test-en, - author = {Author}, - title = {Title}, - type = {J}, - journal = {Journal}, - date = {2014-04-01}, - language = {english}, +@online{casper2011pkuthss, + title={pkuthss: LaTeX template for dissertations in Peking University}, + url={https://gitea.com/CasperVector/pkuthss}, + author={Casper Ti. Vector}, + urldate={2011-06-26}, + year={2011} } -@article{test-zh, - author = {作者}, - title = {标题}, - type = {J}, - journal = {期刊}, - date = {2014-04-01}, - language = {chinese}, +@article{devlin2018bert, + title={Bert: Pre-training of deep bidirectional transformers for language understanding}, + author={Devlin, Jacob and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina}, + journal={Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)}, + year={2019} } -% vim:ts=4:sw=4 +@inproceedings{yang2019xlnet, + author = {Yang, Zhilin and Dai, Zihang and Yang, Yiming and Carbonell, Jaime and Salakhutdinov, Russ R and Le, Quoc V}, + booktitle = {Advances in Neural Information Processing Systems}, + editor = {H. Wallach and H. Larochelle and A. Beygelzimer and F. d\textquotesingle Alch\'{e}-Buc and E. Fox and R. Garnett}, + pages = {}, + publisher = {Curran Associates, Inc.}, + title = {XLNet: Generalized Autoregressive Pretraining for Language Understanding}, + url = {https://proceedings.neurips.cc/paper/2019/file/dc6a7e655d7e5840e66733e9ee67cc69-Paper.pdf}, + volume = {32}, + year = {2019} +} + +@book{gut2013probability, + title={Probability: a graduate course}, + author={Gut, Allan}, + volume={75}, + year={2013}, + publisher={Springer Science \& Business Media} +} + +@book{liu2003uncertain, + title={不确定规划及应用}, + author={刘宝碇}, + volume={1}, + year={2003}, + publisher={清华大学出版社有限公司} +} + +@book{qiu2020nndl, + title = {神经网络与深度学习}, + publisher = {机械工业出版社}, + year = {2020}, + author = {邱锡鹏}, + address = {北京}, + isbn = {9787111649687}, + url = {https://nndl.github.io/}, +} + +% vim:ts=4:sw=4 \ No newline at end of file diff --git a/doc/example/thesis.tex b/doc/example/thesis.tex index 8e6c261..d34a736 100644 --- a/doc/example/thesis.tex +++ b/doc/example/thesis.tex @@ -1,122 +1,105 @@ % Copyright (c) 2008-2009 solvethis % Copyright (c) 2010-2016,2018-2019,2021 Casper Ti. Vector % Copyright (c) 2021 Kurapica -% Public domain. +% Copyright (c) 2021 iofu728 +% Local version. + +%********************************************************************* +% iofu728-pkuthss: 北京大学研究生学位论文模板 +% 2021/06/09 v1.0.0 % -% 使用前请先仔细阅读 pkuthss 和 biblatex-caspervector 的文档, -% 特别是其中的 FAQ 部分和用红色强调的部分。 -% 两者可在终端/命令提示符中用 -% texdoc pkuthss -% texdoc biblatex-caspervector -% 调出。 +% 重要提示: +% 1. 当前overleaf版符合2021研究生学位论文要求,可通过图书馆审核 +% 2. 当前版本基于pkuthss v1.9.0 +% 3. 请使用UTF-8编码,XeLaTeX方式编译 +% 4. 请仔细阅读用户文档 +% 5. 修改、使用、发布本文档类请务必遵循LaTeX Project Public License和知识共享4.0 +% 6. 如有疑问github/iofu728/pkuthss上提问或联系作者@iofu728 +%********************************************************************* -% 如果格式审查提示字号不严格符合标准,可以在 [] 中加入“ugly”选项。 -\documentclass[UTF8]{pkuthss} -% 如果的确须要使脚注按页编号的话,可以去掉后面 footmisc 包的注释。 -%\usepackage[perpage]{footmisc} +\documentclass[fontset=fandol,ugly]{pkuthss} + % 请保留 ugly 参数 + % 是否为盲审模式 blind(默认否) + % 字体库 fontset + % auto | windows | windows@overleaf | mac | fandol | ubuntu | none + % 除windows、mac均为商业字体,如需使用请遵循相应版权协议 + % fandol与windows效果相近,但字符库偏少,推荐使用(默认); + % ubuntu字体效果偏差较大;设为none时需自行配置字体集; -% 使用 biblatex 排版参考文献,并规定其格式(详见 biblatex-caspervector 的文档)。 -% 这里按照西文文献在前,中文文献在后排序(“sorting = ecnyt”); -% 若须按照中文文献在前,西文文献在后排序,请设置“sorting = cenyt”; -% 若须按照引用顺序排序,请设置“sorting = none”。 -% 若须在排序中实现更复杂的需求,请参考 biblatex-caspervector 的文档。 -% biblatex-caspervector 也有一个“ugly”选项,使其更像国标格式;此外也可考虑 -% 改用 style = gb7714-2015 并去掉之后两选项,详见 biblatex-gb7714-2015 的文档。 -\usepackage[backend = biber, style = caspervector, utf8, sorting = ecnyt]{biblatex} +\usepackage[backend=biber,style=gb7714-2015]{biblatex} + % 参考文献遵循GB/T 7714-2015标准,使用biblatex-gb7714-2015 宏包。 + % 此处使用顺序编码制,如使用著者-出版年制则更改为b7714-2015ay。 -% 对于 linespread 值的计算过程有兴趣的同学可以参考 pkuthss.cls。 -\renewcommand*{\bibfont}{\zihao{5}\linespread{1.27}\selectfont} -% 按学校要求设定参考文献列表的段间距。 +% 示例文档用包和设定,该段均可移除. +\usepackage{enumitem,fancyvrb} +\usepackage{booktabs,multirow,longtable,makecell} % 表格相关 +\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{frame = single, tabsize = 4, fontsize=\footnotesize} +\renewcommand{\v}[1]{\boldsymbol{#1}} +\newcommand\pkg[1]{\textsf{#1}} + +% 参考文献边距字体 \setlength{\bibitemsep}{3bp} +\renewcommand*{\bibfont}{\zihao{5}\linespread{1.27}\selectfont} -% 如是双盲版论文,将 \blindfalse 改为 \blindtrue。后面可用 -% \ifblind 根据是否双盲来条件地启用代码(参见本文件后面部分)。 -\newif\ifblind\blindfalse -% 设定文档的基本信息。 \pkuthssinfo{ - cthesisname = {博士学位论文}, ethesisname = {Doctor Thesis}, - thesiscover = {博士研究生学位论文}, - % 长标题可用 \thssnl 强制换行,不能用“\\”(双盲版会出错)。 - ctitle = {测试文档}, - etitle = {Test Document}, - cauthor = {某某}, eauthor = {Test}, date = {某年某月}, - studentid = {0123456789}, school = {某某学院}, - cmajor = {某某专业}, emajor = {Some Major}, - direction = {某某方向}, mentorlines = {2}, - cmentor = {某甲教授\\某乙教授}, - ementor = {Prof.\ Somebody and Prof.\ Someone}, - ckeywords = {其一,其二}, - ekeywords = {First, Second}, - % 以下两项无双盲评审需求的用户可保持原状。 - % 注意 discipline/major 分别指一/二级学科。 - blindid = {9876543210}, discipline = {某某学科} + cthesisname = {硕士学位论文}, + thesiscover = {硕士研究生学位论文}, + ethesisname = {Master Thesis}, + ctitle = {基于XXXX的XXXX系统设计与实现}, + etitle = {Design and implementation of a XXXXX system based on XXXX}, + cauthor = {扎克·施耐德}, eauthor = {Zack Snyder}, + studentid = {180XXXXXXX}, + % 具体时间以教务为准,初稿3月,送审4月,答辩5月,最终6月。 + date = {\zhdigits{2021}\ \ 年\ \ \zhnumber{6}\ \ 月}, + school = {XXXXXX学院}, + cmajor = {XXXX}, emajor = {XXXX}, + direction = {XXXX}, + mentorlines = {2}, % 导师个数 + % 副教授 A.P. 讲师 Lec. + cmentor = {XXX\ \ 教授\\YYY\ \ 教授}, ementor = {Prof.\ XXX and Prof.\ YYY}, + ckeywords = {A,B,C,D}, + ekeywords = {A,B,C,D}, + % 盲审模式参数, 需在documentclass增加blind + blindid = {XXXXXXXXX}, discipline = {XXXX} } -% 载入参考文献数据库(注意不要省略“.bib”)。 \addbibresource{thesis.bib} -% 普通用户可删除此段,并相应地删除 chap/*.tex 中的 -% “\pkuthssffaq % 中文测试文字。”一行。 -\usepackage{color} -\def\pkuthssffaq{% - \emph{\textcolor{red}{pkuthss 文档模版最常见问题:}} - - \texttt{\string\cite}、\texttt{\string\parencite} % - 和 \texttt{\string\supercite} 三个命令分别产生% - 未格式化的、带方括号的和上标且带方括号的引用标记:% - \cite{test-en},\parencite{test-zh}、\supercite{test-en, test-zh}。 - - 若要避免章末空白页,请在调用 pkuthss 文档类时加入 \texttt{openany} 选项。 - - 如果编译时不出参考文献, - 请参考 \texttt{texdoc pkuthss}“问题及其解决”一章 - “上游宏包可能引起的问题”一节中关于 biber 的说明。 - - 因无法假定用户使用哪种方式排版表格,用户须自行保证表格字号符合学校规定。% -} \begin{document} - % 以下为正文之前的部分,默认不进行章节编号。 \frontmatter - % 此后到下一 \pagestyle 命令之前不排版页眉或页脚。 \pagestyle{empty} - % 自动生成封面。 - \ifblind\makeblind\else\maketitle\fi - % 版权声明。封面要求单面打印,故须新开右页。 + \maketitle \cleardoublepage + % 需替换门户版权声明pdf \include{chap/copy} - % 此后到下一 \pagestyle 命令之前正常排版页眉和页脚。 \cleardoublepage \pagestyle{plain} - % 重置页码计数器,用大写罗马数字排版此部分页码。 \setcounter{page}{0} \pagenumbering{Roman} - % 中西文摘要。 \include{chap/abs} - % 自动生成目录。 \tableofcontents + % 如有需要使用主要符号对照表 + \include{chap/deno} - % 以下为正文部分,默认要进行章节编号。 \mainmatter - % 各章节。 \include{chap/chap1} \include{chap/chap2} \include{chap/chap3} + \include{chap/chap4} + \include{chap/chap5} + \include{chap/chap6} + + \appendix + \printbibliography[heading = bibintoc] + % 如有需要使用研究生成果页 + \include{chap/ach} - % 正文中的附录部分。 - \appendix - % 排版参考文献列表。bibintoc 选项使“参考文献”出现在目录中; - % 如果同时要使参考文献列表参与章节编号,可将“bibintoc”改为“bibnumbered”。 - \printbibliography[heading = bibintoc] - % 各附录。 - \include{chap/encl1} - - % 以下为正文之后的部分,默认不进行章节编号。 \backmatter - % 致谢。 - \ifblind\else\include{chap/ack}\fi - % 原创性声明和使用授权说明。 + \include{chap/ack} + % 需替换门户原创页pdf/扫描pdf \include{chap/origin} + \end{document} -% vim:ts=4:sw=4 +% vim:ts=4:sw=4 \ No newline at end of file diff --git a/tex/Makefile b/tex/Makefile index a2e159b..d86c8f7 100644 --- a/tex/Makefile +++ b/tex/Makefile @@ -1,11 +1,14 @@ # Copyright (c) 2008-2009 solvethis # Copyright (c) 2010-2012,2014 Casper Ti. Vector +# Copyright (c) 2021 iofu728 # Public domain. PDFS = pkulogo.pdf pkuword.pdf PS2PDF = ps2pdf -dEPSCrop all: $(PDFS) + cp pkuthss* ../doc/example/ + cp pkuthss* ../doc/readme/ %.pdf: %.eps $(PS2PDF) $< $@ diff --git a/tex/pkuthss-gbk.def b/tex/pkuthss-gbk.def index bb09161..e511827 100644 --- a/tex/pkuthss-gbk.def +++ b/tex/pkuthss-gbk.def @@ -3,6 +3,7 @@ % Copyright (c) 2008-2009 solvethis % Copyright (c) 2010-2013,2015,2021 Casper Ti. Vector % Copyright (c) 2021 Kurapica +% Copyright (c) 2021 iofu728 % % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3 of this license or (at @@ -34,7 +35,9 @@ \def\label@cmajor{ר\hphantom{}ҵ} \def\label@direction{о} \def\label@cmentor{\hphantom{}ʦ} +\def\label@ementor{Directed by\ } \def\label@ckeywords{ؼʣ} +\def\label@ekeywords{KEY WORDS:\ } \def\label@blindcover{ķ棩} \def\label@blindctitle{Ŀ} \def\label@blindetitle{ӢĿ} @@ -44,8 +47,14 @@ \def\titlepagename{} \def\cuniversity{ѧ} -\def\cthesisname{ʿѧλ} +\def\euniversity{Peking University} +\def\cthesisname{˶ʿѧλ} +\def\ethesisname{Doctor Thesis} +\def\thesiscover{˶ʿоѧλ} \def\cabstractname{ժҪ} +\def\eabstractname{ABSTRACT} +\def\denotationname{ҪŶձ} +\def\mentorlines{1} \endinput % vim:ft=tex:ts=2:sw=2 diff --git a/tex/pkuthss-utf8.def b/tex/pkuthss-utf8.def index afed37b..7b87c5d 100644 --- a/tex/pkuthss-utf8.def +++ b/tex/pkuthss-utf8.def @@ -3,6 +3,7 @@ % Copyright (c) 2008-2009 solvethis % Copyright (c) 2010-2013,2015,2021 Casper Ti. Vector % Copyright (c) 2021 Kurapica +% Copyright (c) 2021 iofu728 % % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3 of this license or (at @@ -34,7 +35,9 @@ \def\label@cmajor{专\hphantom{汉字}业:} \def\label@direction{研究方向:} \def\label@cmentor{导\hphantom{汉字}师:} +\def\label@ementor{Directed by\ } \def\label@ckeywords{关键词:} +\def\label@ekeywords{KEY WORDS:\ } \def\label@blindcover{(匿名评阅论文封面)} \def\label@blindctitle{中文题目:} \def\label@blindetitle{英文题目:} @@ -44,8 +47,14 @@ \def\titlepagename{封面} \def\cuniversity{北京大学} -\def\cthesisname{博士学位论文} +\def\euniversity{Peking University} +\def\cthesisname{硕士学位论文} +\def\ethesisname{Master Thesis} +\def\thesiscover{硕士研究生学位论文} \def\cabstractname{摘要} +\def\eabstractname{ABSTRACT} +\def\denotationname{主要符号对照表} +\def\mentorlines{1} \endinput % vim:ft=tex:ts=2:sw=2 diff --git a/tex/pkuthss.cls b/tex/pkuthss.cls index 6ee4e69..fb7fce4 100644 --- a/tex/pkuthss.cls +++ b/tex/pkuthss.cls @@ -3,6 +3,7 @@ % Copyright (c) 2008-2009 solvethis % Copyright (c) 2010-2021 Casper Ti. Vector % Copyright (c) 2021 Kurapica +% Copyright (c) 2021 iofu728 % % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3 of this license or (at @@ -26,21 +27,112 @@ \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesClass{pkuthss} [2021/03/29 v1.9.0 Peking University dissertation document class] - +\def\pkuthss{pkuthss} +\def\iofupkuthss{iofu728/pkuthss} +\def\iofuversion{v1.0.0} +\def\iofubaseversion{v1.9.0} +\newcommand\thss@error[1]{% + \ClassError{pkuthss}{#1}{}% +} +\newcommand\thss@warning[1]{% + \ClassWarning{pkuthss}{#1}{}% +} +\RequirePackage{iftex} +\ifXeTeX\else + \thss@error{% + The Overleaf pkuthss class requires Xe\TeX{}.\\\\ + You must change your typesetting engine to, e.g., + "xelatex" instead of "latex", "lualatex" or "pdflatex". + } +\fi +\RequirePackage{kvdefinekeys} +\RequirePackage{kvsetkeys} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{ + family=thss, + prefix=thss@opt@, + setkeys=\kvsetkeys} +\newcommand\thss@setup[1]{% + \kvsetkeys{thss}{#1}% +} +\newcommand\thss@define@key[1]{% + \kvsetkeys{thss@key}{#1}% +} +\kv@set@family@handler{thss@key}{% + \@namedef{thss@#1@@name}{#1}% + \def\thss@@default{}% + \def\thss@@choices{}% + \kv@define@key{thss@value}{name}{% + \@namedef{thss@#1@@name}{##1}% + }% + \@namedef{thss@#1@@check}{}% + \@namedef{thss@#1@@code}{}% + \kv@define@key{thss@value}{choices}{% + \def\thss@@choices{##1}% + \@namedef{thss@#1@@reset}{}% + \@namedef{thss@#1@@check}{% + \@ifundefined{% + ifthss@\@nameuse{thss@#1@@name}@\@nameuse{thss@\@nameuse{thss@#1@@name}}% + }{% + \thss@error{Invalid value "#1 = \@nameuse{thss@\@nameuse{thss@#1@@name}}"}% + }% + \@nameuse{thss@#1@@reset}% + \@nameuse{thss@\@nameuse{thss@#1@@name}@\@nameuse{thss@\@nameuse{thss@#1@@name}}true}% + }% + }% + \kv@define@key{thss@value}{default}{% + \def\thss@@default{##1}% + }% + \kvsetkeys{thss@value}{#2}% + \@namedef{thss@\@nameuse{thss@#1@@name}}{}% + \kv@set@family@handler{thss@choice}{% + \ifx\thss@@default\@empty + \def\thss@@default{##1}% + \fi + \expandafter\newif\csname ifthss@\@nameuse{thss@#1@@name}@##1\endcsname + \expandafter\g@addto@macro\csname thss@#1@@reset\endcsname{% + \@nameuse{thss@\@nameuse{thss@#1@@name}@##1false}% + }% + }% + \kvsetkeys@expandafter{thss@choice}{\thss@@choices}% + \expandafter\let\csname thss@\@nameuse{thss@#1@@name}\endcsname\thss@@default + \expandafter\ifx\csname thss@\@nameuse{thss@#1@@name}\endcsname\@empty\else + \@nameuse{thss@#1@@check}% + \fi + \kv@define@key{thss}{#1}{% + \@namedef{thss@\@nameuse{thss@#1@@name}}{##1}% + \@nameuse{thss@#1@@check}% + \@nameuse{thss@#1@@code}% + }% +} +\thss@define@key{ + fontset = { + choices = { + auto, + windows, + windows@overleaf, + mac, + ubuntu, + fandol, + none, + }, + default = auto, + }, + encoding = { + choices = { + UTF8, + GBK, + }, + default = UTF8, + }, +} % eg. `\thss@int@boolopt{spacing}{true}' will expand to: % \newif\ifthss@opt@spacing \thss@opt@spacingtrue % \DeclareOption{spacing}{\thss@opt@spacingtrue} % \DeclareOption{nospacing}{\thss@opt@spacingfalse} \def\thss@int@boolopt#1#2{ - \expandafter\newif\csname ifthss@opt@#1\endcsname - \@nameuse{thss@opt@#1#2} - \DeclareOption{#1}{\@nameuse{thss@opt@#1true}} - \DeclareOption{no#1}{\@nameuse{thss@opt@#1false}} + \DeclareBoolOption[#2]{#1} } -% Process the encoding options. -\newif\ifthss@opt@gbk \thss@opt@gbktrue -\DeclareOption{GBK}{\thss@opt@gbktrue\PassOptionsToClass{GBK}{ctexbook}} -\DeclareOption{UTF8}{\thss@opt@gbkfalse\PassOptionsToClass{UTF8}{ctexbook}} % Whether to enable `\Uppercase' (works problematically) in heading marks. \thss@int@boolopt{uppermark}{false} % Whether to modify fonts according to school regulation. @@ -60,10 +152,12 @@ \thss@int@boolopt{pdfprop}{true} % Whether to disable some infractions intended to make the style less ugly. \thss@int@boolopt{ugly}{false} +% Whether in bind mode. +\thss@int@boolopt{blind}{false} % Pass all other options to `ctexbook' document class. -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}} +\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}} % Process all class options now. -\ProcessOptions\relax +\ProcessKeyvalOptions* % Prevent fontspec (loaded by xeCJK) from interfering with newtxmath. \ifthss@opt@pkufont\PassOptionsToPackage{no-math}{fontspec}\fi @@ -71,7 +165,7 @@ % cf. . \ifthss@opt@pkufont\RequirePackage{amsmath}\fi % pkuthss is based on ctexbook; we use `xiao 4' as default font size. -\LoadClass[zihao = -4]{ctexbook}[2014/03/06] +\LoadClass[a4paper,\thss@encoding,zihao=-4,fontset=none]{ctexbook}[2014/03/06] % ctex 2.x no longer loads ifpdf and ifxetex by itself. \RequirePackage{ifpdf, ifxetex} % Provides support for `key = val' grammar. @@ -84,9 +178,32 @@ \RequirePackage{fancyhdr} % Provides `\uline' used in `\maketitle' (but do not mess with `\emph'). \RequirePackage[normalem]{ulem} +% Provides tableofcontents setting. +\RequirePackage{titletoc} +% Provides cover the scanned version pdf. +\RequirePackage[absolute,overlay]{textpos} +\RequirePackage{color} +% Preset subcaption labelformat to simple. +\RequirePackage[labelformat=simple]{subcaption} +% Provides fontset. +\RequirePackage{xeCJKfntef} % `\AtEndOfClass' used to avoid `PDF destination not defined' with setspace. \AtEndOfClass{\RequirePackage{hyperref}} -\input{pkuthss.def} + +\ifthss@encoding@GBK + \input{pkuthss-gbk.def} + \ifxetex + % No support for XeLaTeX compilation in non-unicode encoding, i.e. GBK. + \ClassError{pkuthss}% + {XeLaTeX compilation is not supported without UTF-8}% + {% + XeLaTeX compilation without UTF-8 is very problematic.\MessageBreak + Therefore please use UTF-8 encoding for the LaTeX code.% + } + \fi +\else + \input{pkuthss-utf8.def} +\fi \ifthss@opt@pkufont % Use Times New Roman / Arial according to school regulation. @@ -99,6 +216,10 @@ \fi \ifthss@opt@pkufoot + % Recounter for each page. + \RequirePackage{chngcntr} + \counterwithout{footnote}{chapter} + \counterwithin{footnote}{page} % Handle the `Unparsed material' issue with latex/dvipdfmx compilation. \unless\ifxetex\unless\ifpdf \newcommand*{\pgfsysdriver}{pgfsys-dvipdfm.def} @@ -114,8 +235,8 @@ } % Use circled numbers as footnote symbols. Does not affect title page, but % footnote is rarely used in dissertation covers ;) - \renewcommand*{\thefootnote}% - {\protect\thss@int@circled{\arabic{footnote}}} + \renewcommand*{\thefootnote}{\protect\thss@int@circled{\arabic{footnote}}} + \renewcommand*{\thempfootnote}{\protect\thss@int@circled{\arabic{mpfootnote}}} % Provides utility to modify footnote spacing. % Option used to make sure it does not render interleaf pages totally blank. \RequirePackage[cleardoublepage = current]{scrextend} @@ -137,7 +258,7 @@ % provides functions similar to `subfigure'/`subfig' but does not clash with % `tocloft'; it clashes with `subfigure'/`subfig', but the error message will % say they cannot be used simultaneously. - \RequirePackage{caption, subcaption} + \RequirePackage{caption} \ifthss@opt@ugly \DeclareCaptionFont{capfsize}{\fontsize{11bp}{13.2bp}} \else @@ -173,6 +294,20 @@ % Set up spacing for displayed formulae. \setlength{\abovedisplayskip}{\belowdisplayshortskip} \setlength{\belowdisplayskip}{\abovedisplayskip} + \hypersetup{ + linktoc = all, + bookmarksdepth = 2, + bookmarksnumbered = true, + bookmarksopen = true, + bookmarksopenlevel = 1, + bookmarksdepth = 3, + unicode = true, + psdextra = true, + breaklinks = true, + plainpages = false, + pdfdisplaydoctitle = true, + hidelinks, + }% \ifthss@opt@pdftoc % Add PDF bookmark for table of contents. @@ -238,6 +373,7 @@ \thss@int@infoitemb{mentorlines} \thss@int@infoitemb{cabstractname} \thss@int@infoitemb{eabstractname} +\thss@int@infoitemb{denotationname} % Set up document information using the `key = value' grammar. \newcommand*{\pkuthssinfo}[1]{\setkeys{thss@info}{#1}} % Becomes \newline in the \makeblind scope. @@ -269,19 +405,19 @@ } \ctexset{ chapter = {nameformat = {}, titleformat = {}}, - subsubsection = {format = {\zihao{-4}\bfseries}} + subsubsection = {format = {\zihao{-4}\heiti}} } \ifthss@opt@ugly \ctexset{ - chapter = {format = {\zihao{3}\bfseries\centering}}, - section = {format = {\zihao{4}\bfseries}}, - subsection = {format = {\fontsize{13bp}{15.6bp}\selectfont\bfseries}} + chapter = {format = {\zihao{3}\heiti\centering}}, + section = {format = {\zihao{4}\heiti}}, + subsection = {format = {\fontsize{13bp}{15.6bp}\selectfont\heiti}} } \else \ctexset{ - chapter = {format = {\zihao{-2}\bfseries\centering}}, - section = {format = {\zihao{-3}\bfseries}}, - subsection = {format = {\zihao{4}\bfseries}} + chapter = {format = {\zihao{-2}\heiti\centering}}, + section = {format = {\zihao{-3}\heiti}}, + subsection = {format = {\zihao{4}\heiti}} } \fi @@ -342,7 +478,7 @@ } % Set up format of the title page (cover). -\renewcommand{\maketitle}{% +\newcommand{\maketitle@normal}{% \thss@int@pdfmark{\titlepagename}{titlepage} % Make the title page centered. \begin{titlepage}\centering @@ -355,14 +491,13 @@ \zihao{1}\includegraphics[height = 2.4em]{pkulogo}\hspace{0.4em}% \raisebox{0.4em}{\includegraphics[height = 1.6em]{pkuword}}\\[0.8em] \fi% - {\bfseries\ifx\thesiscover\empty{\cthesisname}\else{\thesiscover}\fi}% + {\heiti\ifx\thesiscover\empty{\cthesisname}\else{\thesiscover}\fi}% } \vfill % Title of the thesis. {% - \ifthss@opt@ugly\zihao{-1}\else\zihao{2}\fi% - \linespread{1.6}\selectfont{\label@ctitle}% - \thss@int@fillinblank{2}{0.64\textwidth}{\textbf{\@ctitle}}% + \zihao{2}\linespread{1.6}\selectfont{\label@ctitle}% + \thss@int@fillinblank{2}{0.64\textwidth}{\heiti{\zihao{1}\@ctitle}}% } \vfill % Information about the author. @@ -371,19 +506,18 @@ \zihao{3}\linespread{1.75}\selectfont \def\thss@tmp@len{0.56\textwidth} \begin{tabular}{l@{\extracolsep{0.2em}}c} - {\bfseries\label@cauthor} & + {\heiti{\zihao{-3}\label@cauthor}} & \thss@int@fillinblank{1}{\thss@tmp@len}{\fangsong\@cauthor} \\ - {\bfseries\label@studentid} & + {\heiti{\zihao{-3}\label@studentid}} & \thss@int@fillinblank{1}{\thss@tmp@len}{\fangsong\@studentid} \\ - {\bfseries\label@school} & + {\heiti{\zihao{-3}\label@school}} & \thss@int@fillinblank{1}{\thss@tmp@len}{\fangsong\@school} \\ - {\bfseries\label@cmajor} & + {\heiti{\zihao{-3}\label@cmajor}} & \thss@int@fillinblank{1}{\thss@tmp@len}{\fangsong\@cmajor} \\ - {\bfseries\label@direction} & + {\heiti{\zihao{-3}\label@direction}} & \thss@int@fillinblank{1}{\thss@tmp@len}{\fangsong\@direction} \\ - {\bfseries\label@cmentor} & - \thss@int@fillinblank{\mentorlines}% - {\thss@tmp@len}{\fangsong\@cmentor} \\ + {\heiti{\zihao{-3}\label@cmentor}} & + \thss@int@fillinblank{\mentorlines}{\thss@tmp@len}{\fangsong\@cmentor} \\ \end{tabular}% } \vfill @@ -412,35 +546,241 @@ \end{titlepage}% } +% Unified Set up format of the cover two mode. +\renewcommand{\maketitle}{% + \ifthss@opt@blind \makeblind + \else\maketitle@normal + \fi +} + % Typeset the Chinese abstract. \newenvironment{cabstract}{% \thss@int@pdfmark{\cabstractname}{cabstract} \chapter*{\cabstractname}\markboth{\cabstractname}{}% }{% Keywords at the bottom of the page. - \vfill\noindent\textbf{\label@ckeywords}{\@ckeywords}% + \vfill\noindent\label@ckeywords{\@ckeywords}% } -% Typeset the English abstract. +% Typeset the English abstract & double-blind review. \newenvironment{eabstract}{% \thss@int@pdfmark{\eabstractname}{eabstract} \chapter*{\sffamily\@etitle}\markboth{\eabstractname}{} - \begin{center} - {\@eauthor} ({\@emajor})\\ - {\label@ementor}{\@ementor}\\[2em] - \textbf{\sffamily\eabstractname} - \end{center}\par% + \ifthss@opt@blind + \begin{center}\textbf{\sffamily\eabstractname}\end{center}\par% + \else + \begin{center} + {\@eauthor} ({\@emajor})\\ + {\label@ementor}{\@ementor}\\[2em] + \textbf{\sffamily\eabstractname} + \end{center} + \fi\par% }{% Keywords at the bottom of the page. - \vfill\noindent\textbf{\label@ekeywords}{\@ekeywords}% + \vfill\noindent\label@ekeywords{\@ekeywords}% } -% Typeset the English abstract for double-blind review. -\newenvironment{beabstract}{% - \thss@int@pdfmark{\eabstractname}{eabstract} - \chapter*{\sffamily\@etitle}\markboth{\eabstractname}{} - \begin{center}\textbf{\sffamily\eabstractname}\end{center}\par% -}{% Keywords at the bottom of the page. - \vfill\noindent\textbf{\label@ekeywords}{\@ekeywords}% + +% Typeset the tableofcontents. +\renewcommand*{\tableofcontents}{% + \chapter*{\contentsname}% + \@mkboth{\MakeUppercase\contentsname}% + {\MakeUppercase\contentsname}% + \@starttoc{toc}% +} +\newcommand\thss@leaders{\titlerule*[4.4bp]{.}} +\newcommand\thss@set@toc@format{% + \contentsmargin{\z@}% + \titlecontents{chapter} + [\z@]{\addvspace{6bp}\zihao{-4}\heiti} + {\contentspush{\thecontentslabel\quad}}{} + {\thss@leaders\thecontentspage}% + \titlecontents{section} + [1em]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thss@leaders\thecontentspage}% + \titlecontents{subsection} + [2em]{} + {\contentspush{\thecontentslabel\quad}}{} + {\thss@leaders\thecontentspage}% +} +\thss@set@toc@format + +% Subfigure reference format. +\renewcommand\thesubfigure{(\alph{subfigure})} + +% Typeset the item of denotation. +\newlist{thss@denotation}{description}{1} +\setlist[thss@denotation]{% + nosep, + font=\normalfont, + align=left, + leftmargin=!, % sum of the following 3 lengths + labelindent=0pt, + labelwidth=5.5cm, + labelsep*=0.5cm, + itemindent=0pt, +} + +% Typeset the denotation. +\newenvironment{denotation}[1][5.5cm]{% + \thss@int@pdfmark{\denotationname}{denotation} + \chapter*{\denotationname}\markboth{\denotationname}{}% + \vskip-30bp\zihao{-4}\begin{thss@denotation}[labelwidth=#1] +}{% + \end{thss@denotation} +} + +% Auto mode fontset. +\ifthss@fontset@auto + \IfFontExistsTF{simsun.ttf}{ + \thss@setup{fontset = windows} + }{ + \IfFileExists{/System/Library/Fonts/Menlo.ttc}{ + \thss@setup{fontset = mac} + }{ + \thss@setup{fontset = fandol} + } + } +\fi + +\newcommand\thss@set@cjk@font@windows{% + \xeCJKsetup{EmboldenFactor=3}% + \setCJKmainfont{SimSun}[ + AutoFakeBold = true, + ItalicFont = KaiTi, + ]% + \setCJKsansfont{SimHei}[AutoFakeBold]% + \setCJKmonofont{FangSong}% + \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold]% + \setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold]% + \setCJKfamilyfont{zhkai}{KaiTi}% + \setCJKfamilyfont{zhfs}{FangSong}% +} +\newcommand\thss@set@cjk@font@windows@overleaf{% + \xeCJKsetup{EmboldenFactor=3}% + \setCJKmainfont{simsun.ttf}[ + AutoFakeBold = true, + ItalicFont = simkai.ttf, + ]% + \setCJKsansfont{simhei.ttf}[AutoFakeBold]% + \setCJKmonofont{simfang.ttf}% + \setCJKfamilyfont{zhsong}{simsun.ttf}[AutoFakeBold]% + \setCJKfamilyfont{zhhei}{simhei.ttf}[AutoFakeBold]% + \setCJKfamilyfont{zhkai}{simkai.ttf}% + \setCJKfamilyfont{zhfs}{simfang.ttf}% +} +\newcommand\thss@set@cjk@font@mac{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{Songti SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ItalicFont = Kaiti SC Regular, + BoldItalicFont = Kaiti SC Bold, + ]% + \setCJKsansfont{Heiti SC}[ + UprightFont = * Light, + BoldFont = * Medium, + ]% + \setCJKmonofont{STFangsong} + \setCJKfamilyfont{zhsong}{Songti SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ]% + \setCJKfamilyfont{zhhei}{Heiti SC}[ + UprightFont = * Light, + BoldFont = * Medium, + ]% + \setCJKfamilyfont{zhfs}{STFangsong}% + \setCJKfamilyfont{zhkai}{Kaiti SC}[ + UprightFont = * Regular, + BoldFont = * Bold, + ]% + \setCJKfamilyfont{zhli}{Baoli SC}% + \setCJKfamilyfont{zhyuan}{Yuanyi SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ]% +} +\newcommand\thss@set@cjk@font@ubuntu{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{Noto Serif CJK SC}[ + UprightFont = * Light, + BoldFont = * Bold, + ItalicFont = FandolKai-Regular, + ItalicFeatures = {Extension = .otf}, + Script = CJK, + ]% + \setCJKsansfont{Noto Sans CJK SC}[ + BoldFont = * Medium, + Script = CJK, + ]% + \setCJKmonofont{FandolFang} + \setCJKfamilyfont{zhsong}{Noto Serif CJK SC}[ + UprightFont = * Light, + UprightFont = * Bold, + Script = CJK, + ]% + \setCJKfamilyfont{zhhei}{Noto Sans CJK SC}[ + BoldFont = * Medium, + Script = CJK, + ]% + \setCJKfamilyfont{zhfs}{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhkai}{FandolKai}[ + Extension = .otf, + UprightFont = *-Regular, + ]% } +\newcommand\thss@set@cjk@font@fandol{% + \defaultCJKfontfeatures{}% + \setCJKmainfont{FandolSong}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = FandolKai-Regular, + ItalicFeatures = {Extension = .otf}, + ]% + \setCJKsansfont{FandolHei}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKmonofont{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhsong}{FandolSong}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKfamilyfont{zhhei}{FandolHei}[ + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ]% + \setCJKfamilyfont{zhfs}{FandolFang}[ + Extension = .otf, + UprightFont = *-Regular, + ]% + \setCJKfamilyfont{zhkai}{FandolKai}[ + Extension = .otf, + UprightFont = *-Regular, + ]% +} +\newcommand\thss@set@cjk@font{% + \ifthss@fontset@none\else + \@nameuse{thss@set@cjk@font@\thss@fontset}% + \providecommand\songti{\CJKfamily{zhsong}} + \providecommand\heiti{\CJKfamily{zhhei}} + \providecommand\fangsong{\CJKfamily{zhfs}} + \providecommand\kaishu{\CJKfamily{zhkai}} + \fi +} +\ifthss@opt@pkufoot + \thss@set@cjk@font +\fi \endinput % vim:ft=tex:ts=2:sw=2 diff --git a/tex/pkuthss.def b/tex/pkuthss.def deleted file mode 100644 index 9450851..0000000 --- a/tex/pkuthss.def +++ /dev/null @@ -1,57 +0,0 @@ -% Peking University dissertation document class -% -% Copyright (c) 2008-2009 solvethis -% Copyright (c) 2010-2013,2015,2021 Casper Ti. Vector -% -% This work 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 -% https://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. -% -% This work has the LPPL maintenance status `maintained'. -% The current maintainer of this work is Casper Ti. Vector. -% -% This work consists of the following files: -% pkuthss.cls -% pkuthss.def -% pkuthss-gbk.def -% pkuthss-utf8.def -% pkulogo.eps -% pkuword.eps - -\ProvidesFile{pkuthss.def} - [2021/03/29 v1.9.0 Labels and captions for the pkuthss document class] - -\def\label@ementor{Directed by\ } -\def\euniversity{Peking University} -\def\ethesisname{Doctor Thesis} -\def\thesiscover{} -\def\mentorlines{1} -\def\eabstractname{ABSTRACT} - -\ifthss@opt@ugly - \def\label@ekeywords{KEY WORDS:\ } -\else - \def\label@ekeywords{KEYWORDS:\ } -\fi - -\ifthss@opt@gbk - \input{pkuthss-gbk.def} - \ifxetex - % No support for XeLaTeX compilation in non-unicode encoding, i.e. GBK. - \ClassError{pkuthss}% - {XeLaTeX compilation is not supported without UTF-8}% - {% - XeLaTeX compilation without UTF-8 is very problematic.\MessageBreak - Therefore please use UTF-8 encoding for the LaTeX code.% - } - \fi -\else - \input{pkuthss-utf8.def} -\fi - -\endinput -% vim:ft=tex:ts=2:sw=2