diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-17 21:38:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-17 21:38:24 +0000 |
commit | 39948ee1306a518baab7bd81a847e11249643885 (patch) | |
tree | c553796b1fc65014f8f3139236889456dc917f6a /Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx | |
parent | 256f8bfa32f3e9134067457fc40c38ee02d01253 (diff) |
fduthesis (17mar19)
git-svn-id: svn://tug.org/texlive/trunk@50428 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx | 1662 |
1 files changed, 736 insertions, 926 deletions
diff --git a/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx b/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx index 86ee5ea6342..3e2cada62e3 100644 --- a/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx +++ b/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx @@ -2,7 +2,7 @@ % !TeX program = XeLaTeX % !TeX encoding = UTF-8 % -% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com> +% Copyright (C) 2017--2019 by Xiangdong Zeng <xdzeng96@gmail.com> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -37,8 +37,6 @@ % fduthesis.pdf, % fduthesis-en.pdf, % fduthesis-code.pdf, -% latexmkrc, -% latexmkrc-en, % and README.md. % %<*internal> @@ -49,7 +47,7 @@ The `fduthesis` Class ===================== -*LaTeX thesis template for Fudan University, v0.7b* +*LaTeX thesis template for Fudan University, v0.7c* Overview -------- @@ -69,7 +67,7 @@ The documentation can be found in [fduthesis-en.pdf](http://mirrors.ctan.org/macros/latex/contrib/fduthesis/fduthesis-en.pdf) (in English). -GitHub repository: <https://github.com/Stone-Zeng/fduthesis>. +GitHub repository: <https://github.com/stone-zeng/fduthesis>. Installation ------------ @@ -87,7 +85,7 @@ To install `fduthesis`, you can use one of the following methods: - Get the source from GitHub: - git clone https://github.com/Stone-Zeng/fduthesis.git + git clone https://github.com/stone-zeng/fduthesis.git Run `install-win.bat` (on Windows) or `install-linux.sh` (on Linux) to generate the templates and configuration files. These files would @@ -112,8 +110,8 @@ To install `fduthesis`, you can use one of the following methods: Contributing ------------ -[Issues](https://github.com/Stone-Zeng/fduthesis/issues) and -[pull requests](https://github.com/Stone-Zeng/fduthesis/pulls) +[Issues](https://github.com/stone-zeng/fduthesis/issues) and +[pull requests](https://github.com/stone-zeng/fduthesis/pulls) are always welcome. License @@ -126,7 +124,7 @@ version. ----- -Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. +Copyright (C) 2017–2019 by Xiangdong Zeng <xdzeng96@gmail.com>. %</readme> % %<*internal> @@ -144,7 +142,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. \preamble - Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com> + Copyright (C) 2017--2019 by Xiangdong Zeng <xdzeng96@gmail.com> This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -179,8 +177,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. fduthesis.pdf, fduthesis-en.pdf, fduthesis-code.pdf, - latexmkrc, - latexmkrc-en, and README.md. \endpreamble @@ -207,10 +203,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. \usedir{doc/latex/fduthesis} \nopreamble\nopostamble \file{README.md} {\from{\jobname.dtx}{readme}} - % ``.cfg'' is only for internal/temporal use. - % They will be renamed by external scripts. - \file{latexmkrc.cfg} {\from{\jobname-doc.dtx}{latexmk}} - \file{latexmkrc-en.cfg} {\from{\jobname-doc.dtx}{latexmk-en}} } \obeyspaces @@ -244,7 +236,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %<class|class-en|doc|logo>\NeedsTeXFormat{LaTeX2e} %<class|class-en|doc|logo>\RequirePackage{expl3} %<*!(driver|install|ex-logo|cover)> -%<!readme>\GetIdInfo $Id: fduthesis.dtx 0.7b 2018-05-06 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ +%<!readme>\GetIdInfo $Id: fduthesis.dtx 0.7c 2019-03-17 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $ %<class> {Thesis template for Fudan University} %<class>\ProvidesExplClass{\ExplFileName} %<class-en> {Thesis template for Fudan University (English version)} @@ -258,30 +250,57 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %<!readme> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} %</!(driver|install|ex-logo|cover)> %<*driver> -%\PassOptionsToPackage{showframe}{geometry} +% \PassOptionsToPackage{showframe}{geometry} \documentclass{fdudoc} -\usepackage{xpinyin} -\hypersetup - { - pdftitle = {fduthesis: 复旦大学论文模板}, - pdfauthor = {曾祥东} - } -\renewcommand*\expstar{\hyperlink{expstar}{$\mfrake$}} -\renewcommand*\rexpstar{\hyperlink{rexpstar}{$\mfrakc$}} +\usepackage{multirow,xpinyin} +\hypersetup{ + pdftitle = {fduthesis: 复旦大学论文模板}, + pdfauthor = {曾祥东}} % 全角标点放在引号中,需要改成半角式,否则间距过大,不好看 -\newcommand\FSID{“{\xeCJKsetup{PunctStyle=banjiao}。}”} ^^A U+3002 -\newcommand\FSFW{“{\xeCJKsetup{PunctStyle=banjiao}.}”} ^^A U+FF0E -\newcommand\COFW{“{\xeCJKsetup{PunctStyle=banjiao}:}”} ^^A U+FF1A -\newcommand\SCFW{“{\xeCJKsetup{PunctStyle=banjiao};}”} ^^A U+FF1B +\def\FSID{“{\xeCJKsetup{PunctStyle=banjiao}。}”} % U+3002 +\def\FSFW{“{\xeCJKsetup{PunctStyle=banjiao}.}”} % U+FF0E +\def\COFW{“{\xeCJKsetup{PunctStyle=banjiao}:}”} % U+FF1A +\def\SCFW{“{\xeCJKsetup{PunctStyle=banjiao};}”} % U+FF1B +% Libertinus Math 字体不包含 `\QED`,暂时使用 `\blacksquare` 代替 +\AtBeginDocument{\def\QED{\blacksquare}} +%^^A! \PassOptionsToPackage{scheme=plain, linespread=1.1}{ctex} +%^^A! \documentclass{fdudoc} +%^^A! \hypersetup{ +%^^A! pdftitle = {fduthesis: LaTeX Thesis Template for Fudan University}, +%^^A! pdfauthor = {Xiangdong Zeng}} +%^^A! \ctexset{ +%^^A! section = {name = {}, format+ = \raggedright}, +%^^A! subsubsection/tocline = {\CTEXnumberline{#1}#2}} +%^^A! \pagestyle{headings} +%^^A! \def\FSID{{\xeCJKsetup{PunctStyle=banjiao}。}} +%^^A! \def\FSFW{{\xeCJKsetup{PunctStyle=banjiao}.}} +%^^A! \AtBeginDocument{\def\QED{\blacksquare}} +%^^A! + +\title{\textcolor{MaterialIndigo800}{% + \textbf{fduthesis: 复旦大学论文\xpinyin[font=\sffamily]{模}{mu2}板}}} +\author{曾祥东} +\date{2019/03/17\quad v0.7c% + \thanks{\url{https://github.com/stone-zeng/fduthesis}.}} +%^^A! \title{\textcolor{MaterialIndigo800}{% +%^^A! \textbf{The \textsf{fduthesis} Class \\ +%^^A! \LaTeX{} Thesis Template for Fudan University}}} +%^^A! \author{Xiangdong Zeng} +%^^A! \date{2019/03/17\quad v0.7c% +%^^A! \thanks{\url{https://github.com/stone-zeng/fduthesis}.}} +%^^A! + \begin{document} +%^^A! \begin{document} +%^^A! \DisableImplementation %<!--CODEDOC--> \EnableImplementation %<!--CODEDOC--> \def\FDUCODEDOC{} \DocInput{fduthesis.dtx} %<!--CODEDOC--> \DocInput{fduthesis-doc.dtx,fduthesis-logo.dtx} - \IndexLayout - \PrintChanges - \PrintIndex +%<!--CODEDOC--> \IndexLayout +%<!--CODEDOC--> \PrintChanges +%<!--CODEDOC--> \PrintIndex \end{document} %</driver> % \fi @@ -326,48 +345,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % -%^^A! \PassOptionsToPackage{scheme=plain, linespread=1.1}{ctex} -%^^A! \documentclass{fdudoc} -%^^A! \hypersetup -%^^A! { -%^^A! pdftitle = {fduthesis: LaTeX Thesis Template for Fudan University}, -%^^A! pdfauthor = {Xiangdong Zeng} -%^^A! } -%^^A! \ctexset -%^^A! { -%^^A! section = {name = {}, format+ = \raggedright}, -%^^A! subsubsection/tocline = {\CTEXnumberline{#1}#2} -%^^A! } -%^^A! \pagestyle{headings} -%^^A! \renewcommand*\expstar{\hyperlink{expstar}{$\mfrake$}} -%^^A! \renewcommand*\rexpstar{\hyperlink{rexpstar}{$\mfrakc$}} -%^^A! \newcommand\FSID{{\xeCJKsetup{PunctStyle=banjiao}。}} -%^^A! \newcommand\FSFW{{\xeCJKsetup{PunctStyle=banjiao}.}} -%^^A! \IndexPrologue{\section{Index}} -%^^A! \def\IndexLayout{% -%^^A! \setlength\IndexMin{0.5\textheight}% -%^^A! \ctexset{section/numbering=false}% -%^^A! \StopSpecialIndexModule} -%^^A! \def\indexname{Index} -%^^A! \let\usage\relax -%^^A! -% -% \title{\textcolor{MaterialIndigo800}{^^A -% \textbf{fduthesis: 复旦大学论文^^A -% \xpinyin[font=\sffamily]{模}{mu2}板}}} -% \author{曾祥东} -% \date{\today \quad v0.7b^^A -% \thanks{\url{https://github.com/Stone-Zeng/fduthesis}.}} -%^^A! \title{\textcolor{MaterialIndigo800}{% -%^^A! \textbf{The \textsf{fduthesis} Class \\ -%^^A! \LaTeX{} Thesis Template for Fudan University}}} -%^^A! \author{Xiangdong Zeng} -%^^A! \date{\today \quad v0.7b% -%^^A! \thanks{\url{https://github.com/Stone-Zeng/fduthesis}.}} -%^^A! -%^^A! \begin{document} -%^^A! -% %^^A 禁止使用 " 符号作为抄录文本缩略符 % \DeleteShortVerb\" %^^A! \DeleteShortVerb\" @@ -403,8 +380,8 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A 用户手册的页边距 %^^A+ % \newgeometry{ -% left = 1.75 in, -% right = 1.00 in, +% left = 1.65 in, +% right = 0.80 in, % top = 1.25 in, % bottom = 1.00 in % } @@ -426,18 +403,16 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \scite{pandoxie2014fduthesislatex},基本满足了博士(硕士) % 毕业论文格式要求,使用人数较多; % \item richarddzh 编写的硕士论文模板 \cls{fudan-thesis} -% \scite{richard2016fudanthesis}; -% \item hmshan 编写的博士论文模板 \cls{FDU_PhD_Thesis_Template} -% \scite{hmshan2017fduphdthesistemplate}。 +% \scite{richard2016fudanthesis}。 % \end{itemize} % 以上这些模板大都没有经过系统的设计,也鲜有后续维护。相比之下, % 清华大学 \scite{thuthesis}、重庆大学 \scite{cquthesis}、 -% 中国科学技术大学 \scite{zepinglee2017ustcthesis} 以及友校 -% 上海交通大学 \scite{weijianwen2017sjtuthesis}等,都有成熟、 +% 中国科学技术大学 \scite{ustcthesis} 中国科学院大学 \scite{ucasthesis} +% 以及友校上海交通大学 \scite{sjtuthesis}等,都有成熟、 % 稳定的解决方案,值得参考。 % % 本模板将借鉴前辈经验,重新设计,并使用 \LaTeX3 -% \scite{interfaces3,source3} 编写,以适应 \TeX{} 技术发展潮流; +% \scite{source3} 编写,以适应 \TeX{} 技术发展潮流; % 同时还将构建一套简洁的接口,方便用户使用。 %^^A! \cls{fduthesis} is a thesis template for Fudan University. %^^A! This template is mostly written in \LaTeX3 syntax, and @@ -515,10 +490,10 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % % 代码实现主要面向对 \LaTeX{} 宏包开发感兴趣的用户。如果您有任何改进 % 意见或者功能需求,欢迎前往 GitHub 仓库 -% \href{https://github.com/Stone-Zeng/fduthesis/issues}{提交 issue}。 +% \href{https://github.com/stone-zeng/fduthesis/issues}{提交 issue}。 %^^A! If you want to read the implementation part, please turn to the %^^A! Chinese version. Any issues or feature requests can be submitted -%^^A! in the \href{https://github.com/Stone-Zeng/fduthesis/issues}% +%^^A! in the \href{https://github.com/stone-zeng/fduthesis/issues}% %^^A! {GitHub repository}. %^^A! % @@ -583,13 +558,13 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A % 您也可以从源代码直接生成模板(不推荐): % \begin{itemize} -% \item 打开 \href{https://github.com/Stone-Zeng/fduthesis}^^A +% \item 打开 \href{https://github.com/stone-zeng/fduthesis}^^A % {项目主页},点击“Clone or download”,并选择“Download ZIP”, % 下载 \file{fduthesis-master.zip};如果您的电脑中安装有 git % 程序,也可通过以下命令直接克隆代码仓库: % \begin{shellexample}[gobble=7,alsoletter={.},^^A % morekeywords={git,clone}] -% git clone https://github.com/Stone-Zeng/fduthesis.git +% git clone https://github.com/stone-zeng/fduthesis.git % \end{shellexample} % \item 解压并进入到 \file{source} 文件夹,执行以下命令以生成 % 模板的各组件: @@ -607,14 +582,14 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A! Although not recommended, you may generate the whole template %^^A! from source code as well: %^^A! \begin{itemize} -%^^A! \item Open the project's \href{https://github.com/Stone-Zeng/fduthesis}% +%^^A! \item Open the project's \href{https://github.com/stone-zeng/fduthesis}% %^^A! {homepage}, click ``Clone or download'' and choose %^^A! ``Download ZIP'' to download \file{fduthesis-master.zip}. %^^A! If you have git program on your computer, you can also %^^A! clone the repository directly: %^^A! \begin{shellexample}[gobble=5,alsoletter={.},% %^^A! morekeywords={git,clone}] -%^^A! git clone https://github.com/Stone-Zeng/fduthesis.git +%^^A! git clone https://github.com/stone-zeng/fduthesis.git %^^A! \end{shellexample} %^^A! \item Extract files, and get into the \file{source} directory. %^^A! Run the following command to generate all the components: @@ -665,7 +640,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \caption{\cls{fduthesis} 的主要组成部分} % \label{tab:fduthesis-components} % \centering -% \begin{tabular}{lp{24em}} +% \begin{tabular}{lp{20em}} % \toprule % \textbf{文件} & \textbf{功能说明} \\ % \midrule @@ -722,21 +697,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A! \end{table} %^^A! % -% 如需生成用户手册 \file{fduthesis.pdf},可在命令行中执行 -% \begin{shellexample}[morekeywords={xelatex,makeindex},emph={-o,-s,-t}] -% xelatex fduthesis.dtx -% makeindex -s gind.ist -o fduthesis.ind fduthesis.idx -% makeindex -s gglo.ist -o fduthesis.gls -t fduthesis.glg fduthesis.glo -% xelatex fduthesis.dtx -% xelatex fduthesis.dtx -% \end{shellexample} -% 也可使用 \pkg{latexmk}: -% \begin{shellexample}[morekeywords={latexmk}] -% latexmk fduthesis.dtx -% \end{shellexample} -% 本模板已经为编译用户手册提供了 \pkg{latexmk} 配置文件 -% \file{latexmkrc}。 -% % \section{使用说明} %^^A! \section{User's guide} %^^A! @@ -849,13 +809,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A! \end{shellexample} %^^A! % -% 需要注意,请不要把模板中的配置文件 \file{latexmkrc} 放置在工作 -% 文件夹下。该配置文件仅适用于生成模板用户手册。 -%^^A! Note that you should not put the profile \file{latexmkrc} in -%^^A! your working directory. This file is meant to generate the -%^^A! user's guide. -%^^A! -% % \subsection{模板选项} %^^A! \subsection{Options of the template} %^^A! @@ -926,16 +879,15 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % % 双面模式下,正文部分偶数页(在左)的左页眉显示章标题,奇数页 % (在右)的右页眉显示节标题;前置部分的页眉按同样格式显示,但文字 -% 均为对应标题(如“{\kaishu 目\textvisiblespace{}录}”、 -% “{\kaishu 摘\textvisiblespace{}要}”等)。 +% 均为对应标题(如“目录”、“摘要”等)。 % 而在单面模式下,正文部分则页面不分奇偶,均同时显示左、右页眉, % 文字分别为章标题和节标题;前置部分只有中间页眉,显示对应标题。 %^^A! At two-sided mode, left headers on the even pages (left hand) %^^A! in \emph{main body} will show the title of chapters, while the %^^A! right headers on the odd pages (right hand) will show the %^^A! title of sections. Headers in \emph{front matter} have the -%^^A! same style, but they will only show the title as -%^^A! ``\textit{Contents}'', ``\textit{Abstract}'', etc. +%^^A! same style, but they will only show the title as ``Contents'', +%^^A! ``Abstract'', etc. %^^A! %^^A! At one-sided mode, both left and right headers on \emph{all} %^^A! pages in main body will be shown. The text is the title of @@ -1051,9 +1003,8 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \fdusetup{ % style = {cjk-font = adobe, font-size = -4}, % info = { -% title = {关于光产生和转变的一个启发性观点}, -% title* = {On a Heuristic Viewpoint Concerning the Production -% and Transformation of Light}, +% title = {论动体的电动力学}, +% title* = {On the Electrodynamics of Moving Bodies}, % author = {阿尔伯特·爱因斯坦}, % author* = {Albert Einstein}, % department = {物理学系} @@ -1069,9 +1020,8 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \fdusetup{ % style/cjk-font = adobe, % style/font-size = -4, -% info/title = {关于光产生和转变的一个启发性观点}, -% info/title* = {On a Heuristic Viewpoint Concerning the Production -% and Transformation of Light}, +% info/title = {论动体的电动力学}, +% info/title* = {On the Electrodynamics of Moving Bodies}, % info/author = {阿尔伯特·爱因斯坦}, % info/author* = {Albert Einstein}, % info/department = {物理学系} @@ -1106,29 +1056,126 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A! % %^^A+ -% \begin{function}[updated=2017-09-23]{style/font} +% \begin{function}[updated=2019-03-05]{style/font} % \begin{fdusyntax}[emph={[1]font}] -% font = (*<libertinus|lm|palatino|(times)|none>*) +% font = (*<garamond|libertinus|lm|palatino|(times)|times*|none>*) % \end{fdusyntax} %^^A- -% 设置西文字体(包括数学字体)。 +% 设置西文字体(包括数学字体)。具体配置见表~\ref{tab:font}。 % \end{function} -%^^A! Set the western fonts (including math fonts). +%^^A! Set fonts (including math fonts). The details can be found in table~\ref{tab:font}. %^^A! \end{function} %^^A! % +% \begin{table}[ht] +% \begin{threeparttable} +% \caption{西文字体配置} +% \label{tab:font} +% \centering +% \begin{tabular}{ccccc} +% \toprule +% & \strong{正文字体} & \strong{无衬线字体} & \strong{等宽字体} & \strong{数学字体} \\ +% \midrule +% |garamond| & EB Garamond & Libertinus Sans & LM Mono\tnote{a} & Garamond Math \\ +% |libertinus| & Libertinus Serif & Libertinus Sans & LM Mono & Libertinus Math \\ +% |lm| & LM Roman & LM Sans & LM Mono & LM Math \\ +% |palatino| & TG Pagella\tnote{b} & Libertinus Sans & LM Mono & TG Pagella Math \\ +% |times| & XITS & TG Heros & TG Cursor & XITS Math \\ +% |times*|\tnote{c} & Times New Roman & Arial & Courier New & XITS Math \\ +% \bottomrule +% \end{tabular} +% \begin{tablenotes} +% \item[a] “LM”是 Latin Modern 的缩写。 +% \item[b] “TG”是 TeX Gyre 的缩写。 +% \item[c] 本行中,Times New Roman、Arial 和 Courier New 是商业字体, +% 在 Windows 和 macOS 系统上均默认安装。 +% \end{tablenotes} +% \end{threeparttable} +% \end{table} +%^^A! \begin{table}[ht] +%^^A! \begin{threeparttable} +%^^A! \caption{Font configuration} +%^^A! \label{tab:font} +%^^A! \centering +%^^A! \begin{tabular}{ccccc} +%^^A! \toprule +%^^A! & \strong{Roman} & \strong{Sans-serif} & \strong{Monospaced} & \strong{Math} \\ +%^^A! \midrule +%^^A! |garamond| & EB Garamond & Libertinus Sans & LM Mono\tnote{a} & Garamond Math \\ +%^^A! |libertinus| & Libertinus Serif & Libertinus Sans & LM Mono & Libertinus Math \\ +%^^A! |lm| & LM Roman & LM Sans & LM Mono & LM Math \\ +%^^A! |palatino| & TG Pagella\tnote{b} & Libertinus Sans & LM Mono & TG Pagella Math \\ +%^^A! |times| & XITS & TG Heros & TG Cursor & XITS Math \\ +%^^A! |times*|\tnote{c} & Times New Roman & Arial & Courier New & XITS Math \\ +%^^A! \bottomrule +%^^A! \end{tabular} +%^^A! \begin{tablenotes} +%^^A! \item[a] ``LM'' is the abbreviation of Latin Modern. +%^^A! \item[b] ``TG'' is the abbreviation of TeX Gyre. +%^^A! \item[c] Here, Times New Roman, Arial and Courier New are commercial fonts. They are +%^^A! installed on Windows and macOS by default. +%^^A! \end{tablenotes} +%^^A! \end{threeparttable} +%^^A! \end{table} +% %^^A+ -% \begin{function}[rEXP,updated=2017-09-23]{style/cjk-font} +% \begin{function}[rEXP,updated=2019-03-05]{style/cjk-font} % \begin{fdusyntax}[emph={[1]cjk-font}] -% cjk-font = (*<adobe|(fandol)|founder|mac|windows|none>*) +% cjk-font = (*<adobe|(fandol)|founder|mac|sinotype|sourcehan|windows|none>*) % \end{fdusyntax} %^^A- -% 设置中文字体。 +% 设置中文字体。具体配置见表~\ref{tab:cjk-font}。 % \end{function} -%^^A! Set CJK (Chinese, Japanese and Korean) fonts. +%^^A! Set CJK (Chinese, Japanese and Korean) fonts. The details can be found in +%^^A! table~\ref{tab:cjk-font}. %^^A! \end{function} %^^A! % +% \begin{table}[ht] +% \caption{中文字体配置} +% \label{tab:cjk-font} +% \centering +% \begin{tabular}{cccc} +% \toprule +% & \strong{正文字体(宋体)} & \strong{无衬线字体(黑体)} & \strong{等宽字体(仿宋)} \\ +% \midrule +% \multirow{2}*{|adobe|} & Adobe 宋体 & Adobe 黑体 & Adobe 仿宋 \\ +% & Adobe Song Std & Adobe Heiti Std & Adobe Fangsong Std \\ +% \multirow{2}*{|fandol|} & Fandol 宋体 & Fandol 黑体 & Fandol 仿宋 \\ +% & FandolSong & FandolHei & FandolFang \\ +% \multirow{2}*{|founder|} & 方正书宋 & 方正黑体 & 方正仿宋 \\ +% & FZShuSong-Z01 & FZHei-B01 & FZFangSong-Z02 \\ +% \multirow{2}*{|mac|} & (华文)宋体-简 & (华文)黑体-简 & 华文仿宋 \\ +% & Songti SC & Heiti SC & STFangsong \\ +% \multirow{2}*{|sinotype|} & 华文宋体 & 华文黑体 & 华文仿宋 \\ +% & STSong & STHeiti & STFangsong \\ +% \multirow{2}*{|sourcehan|} & 思源宋体 & 思源黑体 & --- \\ +% & Source Han Serif SC & Source Han Sans SC & --- \\ +% \multirow{2}*{|windows|} & (中易)宋体 & (中易)黑体 & (中易)仿宋 \\ +% & SimSun & SimHei & FangSong \\ +% \bottomrule +% \end{tabular} +% \end{table} +%^^A! \begin{table}[ht] +%^^A! \caption{CJK font configuration} +%^^A! \label{tab:cjk-font} +%^^A! \centering +%^^A! \begin{tabular}{cccc} +%^^A! \toprule +%^^A! & \strong{Roman (song)} & \strong{Sans-serif (hei)} & \strong{Monospaced (fang)} \\ +%^^A! \midrule +%^^A! |adobe| & Adobe Song Std & Adobe Heiti Std & Adobe Fangsong Std \\ +%^^A! |fandol| & FandolSong & FandolHei & FandolFang \\ +%^^A! |founder| & FZShuSong-Z01 & FZHei-B01 & FZFangSong-Z02 \\ +%^^A! |mac| & Songti SC & Heiti SC & STFangsong \\ +%^^A! |sinotype| & STSong & STHeiti & STFangsong \\ +%^^A! |sourcehan| & Source Han Serif SC & Source Han Sans SC & --- \\ +%^^A! |windows| & SimSun & SimHei & FangSong \\ +%^^A! \bottomrule +%^^A! \end{tabular} +%^^A! \end{table} +%^^A! +% % 启用 \kvopt{font}{none} 或 \kvopt{cjk-font}{none} 之后,模板将关闭 % 默认西文 / 中文字体设置。此时,您需要自行使用 \cs{setmainfont}、 % \cs{setCJKmainfont}、\cs{setmathfont} 等命令来配置字体。 @@ -1168,7 +1215,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % % 选择 \kvopt{fullwidth-stop}{catcode} 或 \opt{mapping} 后,都会实现 % 上述效果。有所不同的是,在选择 \opt{catcode} 后,只有^^A -% \emph{显式的}\FSID 会被替换为\FSFW,但在选择 \opt{mapping} 后, +% \emph{显式的}\FSID 会被替换为\FSFW;但在选择 \opt{mapping} 后, % \emph{所有的}\FSID 都会被替换。例如,如果您用宏保存了一些含有^^A % \FSID 的文字,那么在选择 \opt{catcode} 时,其中的\FSID 不会被 % 替换为\FSFW。 @@ -1442,7 +1489,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \end{function} %^^A! \begin{function}[added=2018-01-25]{style/bib-resource} %^^A! \begin{fdusyntax}[emph={[1]bib-resource}] -%^^A! bib-resource = (*\marg{bib file(s)}*) +%^^A! bib-resource = (*\marg{bib file\symbol{"28}s\symbol{"29}}*) %^^A! \end{fdusyntax} %^^A! Specify the bibliography database (usually in \file{.bib} %^^A! format). If using more than one files, the file names should @@ -1539,13 +1586,13 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A! % %^^A+ -% \begin{function}[added=2018-02-01]{info/degree} +% \begin{function}[added=2018-02-01,updated=2019-03-12]{info/degree} % \begin{fdusyntax}[emph={[1]degree}] % degree = (*<(academic)|professional>*) % \end{fdusyntax} %^^A- -% 学位类型。本选项仅用于硕士学位论文,\opt{academic} 和 -% \opt{professional} 分表表示学术学位和专业学位。 +% 学位类型,仅适用于博士和硕士学位论文。\opt{academic} 和 \opt{professional} +% 分别表示学术学位和专业学位。 % \end{function} %^^A! Degree type. This option can only be used in master degree %^^A! thesis. @@ -1770,11 +1817,12 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A! \subsection{Writing your thesis} %^^A! % -% \begin{quote*}[喬孟符][宋] -% 作樂府亦有法,曰\CJKunderdot{鳳頭豬肚豹尾}六字是也。 -% 大概起要美麗,中要浩蕩,結要響亮。尤貴在首尾貫穿,意思清新。 -% 茍能若是,斯可以言樂府矣。 -% \end{quote*} +% \begin{quotation} +% 喬孟符(吉)博學多能,以樂府稱。嘗云:「作樂府亦有法,曰^^A +% \CJKunderdot{鳳頭、豬肚、豹尾}六字是也。」大概起要美麗,中要浩蕩, +% 結要響亮。尤貴在首尾貫穿,意思清新。苟能若是,斯可以言樂府矣。 +% \end{quotation} +% \hfill ——陶宗儀《南村輟耕錄·作今樂府法》 % % \subsubsection{凤头} %^^A! \subsubsection{Front matter} @@ -1867,7 +1915,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % (*\meta{符号\ \kern-0.1em$n$}*) & (*\meta{说明}*) % \end{notation} % \end{fdusyntax} -% 符号表。可选参数\meta{列格式说明}与 \LaTeX{} 中标准表格的列格 +% 符号表。可选参数 \meta{列格式说明}与 \LaTeX{} 中标准表格的列格 % 式说明语法一致,默认值为“|lp{7.5cm}|”,即第一列宽度自动调整, % 第二列限宽 \SI{7.5}{cm},两列均为左对齐。 % \end{function} @@ -2015,7 +2063,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % ... % \end{latexexample} %^^A! Actually, the pre-defined math environments are just defined -%^^A! with \cs{newtheorem} and \cs{newtheorem*}: +%^^A! with \cs{new\-the\-o\-rem} and \cs{new\-the\-o\-rem*}: %^^A! \begin{latexexample}[deletetexcs={\newtheorem}, %^^A! morekeywords={\newtheorem,\newtheorem*}] %^^A! \newtheorem*{proof}{proof} @@ -2210,7 +2258,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \begin{itemize} % \item \pkg{expl3}、\pkg{xparse}、\pkg{xtemplate} 和 % \pkg{l3keys2e},用于构建 \LaTeX3 编程环境 -% \scite{interfaces3,source3}。它们分属 \pkg{l3kernel} 和 +% \scite{source3}。它们分属 \pkg{l3kernel} 和 % \pkg{l3packages} 宏集。 % \item \cls{ctexbook},提供中文排版的通用框架。属于 \CTeX{} % 宏集 \scite{CTeX}。 @@ -2225,7 +2273,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \item \pkg{graphicx},提供图形插入的接口。 % \item \pkg{longtable},长表格(允许跨页)支持。 % \item \pkg{caption},用于设置题注。 -% \item \pkg{natbib},提供增强的参考文献著录及引用支持。 % \item \pkg{xcolor},提供彩色支持。 % \item \pkg{hyperref},提供交叉引用、超链接、电子书签等功能。 % \end{itemize} @@ -2258,7 +2305,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. %^^A! \item \pkg{graphicx} %^^A! \item \pkg{longtable} %^^A! \item \pkg{caption} -%^^A! \item \pkg{natbib} %^^A! \item \pkg{xcolor} %^^A! \item \pkg{hyperref} %^^A! \end{itemize} @@ -2287,193 +2333,223 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % % \newcommand\urlprefix{\newline\hspace*{\fill}} % \let\OldUrl=\url -% \renewcommand\url[1]{{\small\OldUrl{#1}}} -% \newcommand\CTANurl[1]{{\small\href{http://mirror.ctan.org/#1}^^A -% {\ttfamily CTAN://#1}}} +% \renewcommand\url[2][]{{\small\textit{#1}~\OldUrl{#2}}} +% \newcommand\CTANurl[2][]{{\small\textit{#1}~\href{http://mirror.ctan.org/#2}^^A +% {\ttfamily CTAN://#2}}} +% +% \subsection{图书} +% +% \bibitem{knuth1986texbook} +% \textsc{Knuth D E}. +% \newblock \textit{The \TeX book: Computers \& Typesetting, volume A} [M]. +% \newblock Boston: Addison--Wesley Publishing Company, 1986 +% \urlprefix \CTANurl[源代码^^A +% \footnote{此代码只可作为学习之用。未经 Knuth 本人同意,您不应当编译此文档。}:]^^A +% {systems/knuth/dist/tex/texbook.tex} +% +% \bibitem{mittelbach2004latexcompanion} +% \textsc{Mittelbach F} and \textsc{Goossens M}. +% \newblock \textit{The \LaTeX{} Companion} [M]. +% \newblock 2nd ed. +% \newblock Boston: Addison--Wesley Publishing Company, 2004 +% +% \bibitem{胡伟2017latex2e} +% 胡伟. +% \newblock \textit{\LaTeXe{} 文类和宏包学习手册} [M]. +% \newblock 北京: 清华大学出版社, 2017 +% +% \bibitem{刘海洋2013latex入门} +% 刘海洋. +% \newblock \textit{\LaTeX{} 入门} [M]. +% \newblock 北京: 电子工业出版社, 2013 +% +% \subsection{标准、规范} +% +% \bibitem{gb-t-7713.1-2006} +% 国务院学位委员会办公室, 全国信息与文献标准化技术委员会. +% \newblock \textit{学位论文编写规则: GB/T 7713.1--2006} [S]. +% \newblock 北京: 中国标准出版社, 2007 +% +% \bibitem{gb-t-7714-2015} +% 全国信息与文献标准化技术委员会. +% \newblock \textit{信息与文献\quad 参考文献著录规则: GB/T 7714--2015} [S]. +% \newblock 北京: 中国标准出版社, 2015 +% +% \bibitem{gb-t-15834-2011} +% 教育部语言文字信息管理司. +% \newblock \textit{标点符号用法: GB/T 15834--2011} [S/OL]. +% \newblock 北京: 中国标准出版社, 2012 +% \urlprefix\url{http://www.moe.gov.cn/ewebeditor/uploadfile/2015/01/13/20150113091548267.pdf} +% +% \bibitem{clreq} +% W3C. +% \newblock \textit{中文排版需求(Requirements for Chinese Text Layout)} [EB/OL]. +% \newblock (2019-03-13) +% \urlprefix\url{https://w3c.github.io/clreq/} +% +% \bibitem{复旦大学论文规范} +% 复旦大学图书馆, 复旦大学研究生院. +% \newblock \textit{复旦大学博士、硕士学位论文规范} [EB/OL]. +% \newblock 2017 年 3 月修订版. +% \newblock (2017-03-27) +% \urlprefix\url{http://www.gs.fudan.edu.cn/_upload/article/4c/a8/a82545ef443b9c057c14ba13782c/c883c6f3-6d7f-410c-8f30-d8bde6fcb990.doc} +% +% \subsection{宏包、模版} % % \bibitem{source2e} % \textsc{Braams J}, \textsc{Carlisle D}, \textsc{Jeffrey A}, et al. % \newblock \textit{The \LaTeXe{} Sources} [CP/OL]. -% \newblock (2018-04-01) \urlprefix -% \CTANurl{macros/latex/base/source2e.pdf} +% \newblock (2018-12-01) +% \urlprefix\url{https://ctan.org/pkg/latex} +% \urlprefix\CTANurl[源代码:]{macros/latex/base/source2e.pdf} % % \bibitem{CTeX} % \textsc{CTEX.ORG}. % \newblock \textit{\CTeX{} 宏集手册} [EB/OL]. -% \newblock version 2.4.12, -% \newblock (2018-01-28) \urlprefix -% \CTANurl{language/chinese/ctex/ctex.pdf} +% \newblock version 2.4.14, +% \newblock (2018-05-02) +% \urlprefix\url{https://ctan.org/pkg/ctex} +% \urlprefix\CTANurl[文档及源代码:]{language/chinese/ctex/ctex.pdf} % % \bibitem{xeCJK} % \textsc{CTEX.ORG}. % \newblock \textit{\pkg{xeCJK} 宏包} [EB/OL]. -% \newblock version 3.7.0, -% \newblock (2018-04-07) \urlprefix -% \CTANurl{macros/xetex/latex/xecjk/xeCJK.pdf} +% \newblock version 3.7.1, +% \newblock (2018-04-30) +% \urlprefix\url{https://ctan.org/pkg/xecjk} +% \urlprefix\CTANurl[文档及源代码:]{macros/xetex/latex/xecjk/xeCJK.pdf} % % \bibitem{natbib} % \textsc{Daly P W}. % \newblock \textit{Natural Sciences Citations and References} [EB/OL]. % \newblock version 8.31b, -% \newblock (2010-09-13) \urlprefix -% \CTANurl{macros/latex/contrib/natbib/natbib.pdf} -% -% \bibitem{hmshan2017fduphdthesistemplate} -% \textsc{hmshan}. -% \newblock \textit{复旦博士论文模板} [EB/OL]. -% \newblock (2017-04-04) \urlprefix -% \url{https://github.com/hmshan/FDU_PhD_Thesis_Template} -% -% \bibitem{knuth1986texbook} -% \textsc{Knuth D E}. -% \newblock \textit{The \TeX book: Computers \& Typesetting, volumn A} [M]. -% \newblock Boston: Addison--Wesley Publishing Company, 1986 -% \urlprefix {\small {\kaishu 源代码 -% \footnote{此代码只可作为学习之用。未经 Knuth 本人同意,您不应当编译此文档。}:} -% \CTANurl{systems/knuth/dist/tex/texbook.tex}} -% -% \bibitem{interfaces3} -% \textsc{The \LaTeX3 Project}. -% \newblock \textit{The \LaTeX3 Interfaces} [EB/OL]. -% \newblock (2018-03-05) \urlprefix -% \CTANurl{macros/latex/contrib/l3kernel/interface3.pdf} +% \newblock (2010-09-13) +% \urlprefix\url{https://ctan.org/pkg/natbib} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/natbib/natbib.pdf} % % \bibitem{source3} % \textsc{The \LaTeX3 Project}. % \newblock \textit{The \LaTeX3 Sources} [CP/OL]. -% \newblock (2018-03-05) \urlprefix -% \CTANurl{macros/latex/contrib/l3kernel/source3.pdf} +% \newblock (2019-03-05) +% \urlprefix\url{https://ctan.org/pkg/l3kernel} +% \urlprefix\CTANurl[源代码:]{macros/latex/contrib/l3kernel/source3.pdf} % % \bibitem{biblatex} % \textsc{Lehman P}, \textsc{Kime P}, \textsc{Boruvka A}, et al. % \newblock \textit{The \pkg{biblatex} Package} [EB/OL]. -% \newblock version 3.11, -% \newblock (2018-03-01) \urlprefix -% \CTANurl{macros/latex/contrib/biblatex/doc/biblatex.pdf} -% -% \bibitem{mittelbach2004latexcompanion} -% \textsc{Mittelbach F} and \textsc{Goossens M}. -% \newblock \textit{The \LaTeX{} Companion} [M]. -% \newblock 2nd ed. -% \newblock Boston: Addison--Wesley Publishing Company, 2004 +% \newblock version 3.12, +% \newblock (2018-10-18) +% \urlprefix\url{https://ctan.org/pkg/biblatex} +% \urlprefix\CTANurl[文档:]{macros/latex/contrib/biblatex/doc/biblatex.pdf} % % \bibitem{lshort} % \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. % \newblock \textit{The Not So Short Introduction to \LaTeXe{}: Or \LaTeXe{} in 139 minutes} [EB/OL]. % \newblock version 6.2, -% \newblock (2018-02-28) \urlprefix -% \CTANurl{info/lshort/english/lshort.pdf} +% \newblock (2018-02-28) +% \urlprefix\url{https://ctan.org/pkg/lshort-english} +% \urlprefix\CTANurl[文档:]{info/lshort/english/lshort.pdf} % % \bibitem{lshort-zh-cn} % \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. -% \newblock \textit{一份不太简短的 \LaTeXe{} 介绍: 或 102 分钟了解 \LaTeXe{}} [EB/OL]. -% \newblock China\TeX{} 论坛, 译. -% \newblock 原版版本 version 5.05, 中文版本 version 5.10, -% \newblock (2017-03-26) \urlprefix -% \CTANurl{info/lshort/chinese/lshort-zh-cn.pdf} +% \newblock \textit{一份不太简短的 \LaTeXe{} 介绍: 或 106 分钟了解 \LaTeXe{}} [EB/OL]. +% \newblock \CTeX{} 开发小组, 译. +% \newblock 原版版本 version 6.2, 中文版本 version 6.0, +% \newblock (2018-09-01) +% \urlprefix\url{https://ctan.org/pkg/lshort-zh-cn} +% \urlprefix\CTANurl[文档:]{info/lshort/chinese/lshort-zh-cn.pdf} +% +% \bibitem{biblatex-gb7714-2015} +% 胡振震. +% \newblock \textit{符合 GB/T 7714-2015 标准的 biblatex 参考文献样式} [EB/OL]. +% \newblock version 1.0q, +% \newblock (2019-02-11) +% \urlprefix\url{https://ctan.org/pkg/biblatex-gb7714-2015} +% \urlprefix\CTANurl[文档:]{biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf} +% +% \bibitem{gbt7714} +% 李泽平(\textsc{Zeping L}). +% \newblock \textit{GB/T 7714-2015 \BibTeX{} Style} [EB/OL]. +% \newblock version 1.0.9, +% \newblock (2018-08-05) +% \urlprefix\url{https://ctan.org/pkg/gbt7714} +% \urlprefix\CTANurl[文档:]{biblio/bibtex/contrib/gbt7714/gbt7714.pdf} +% +% \bibitem{cquthesis} +% 李振楠. +% \newblock \textit{\textsc{CquThesis}:重庆大学毕业论文 \LaTeX{} 模板} [EB/OL]. +% \newblock version 1.30, +% \newblock (2018-02-23) +% \urlprefix\url{https://ctan.org/pkg/cquthesis} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/cquthesis/cquthesis.pdf} +% +% \bibitem{thuthesis} +% 薛瑞尼. +% \newblock \textit{\textsc{ThuThesis}:清华大学学位论文模板} [EB/OL]. +% \newblock version 5.4.5, +% \newblock (2018-05-17) +% \urlprefix\url{https://ctan.org/pkg/thuthesis} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/thuthesis/thuthesis.pdf} +% +% \emph{以下模版未收录至 CTAN,但仍然保持活跃更新。} +% +% \bibitem{sjtuthesis} +% \textsc{SJTUG}. +% \newblock \textit{上海交通大学 \XeLaTeX{} 学位论文及课程论文模板} [EB/OL]. +% \newblock version 0.10.2, +% \newblock (2018-11-05) +% \urlprefix\url{https://github.com/sjtug/SJTUThesis} +% +% \bibitem{ustcthesis} +% \textsc{USTC \TeX{} User Group}. +% \newblock \textit{中国科学技术大学学位论文 \LaTeX{} 模板} [EB/OL]. +% \newblock version 3.1.03, +% \newblock (2019-01-01) +% \urlprefix\url{https://github.com/ustctug/ustcthesis} +% +% \bibitem{ucasthesis} +% \textsc{mohuangrui}. +% \newblock \textit{\pkg{ucasthesis} 国科大学位论文 \LaTeX{} 模板} [EB/OL]. +% \newblock (2019-03-14) +% \urlprefix\url{https://github.com/mohuangrui/ucasthesis} +% +% \emph{以下模版现已停止更新。} % % \bibitem{pandoxie2014fduthesislatex} % \textsc{Pandoxie}. % \newblock \textit{Fudan University-Latex Template} [EB/OL]. -% \newblock (2014-06-07) \urlprefix -% \url{https://github.com/Pandoxie/FDU-Thesis-Latex} +% \newblock (2014-06-07) +% \urlprefix\url{https://github.com/Pandoxie/FDU-Thesis-Latex} % % \bibitem{richard2016fudanthesis} % \textsc{richard}. % \newblock \textit{复旦大学硕士学位论文模板} [EB/OL]. -% \newblock (2016-01-31) \urlprefix -% \url{https://github.com/richarddzh/fudan-thesis} -% -% \bibitem{weijianwen2017sjtuthesis} -% \textsc{weijianwen}. -% \newblock \textit{A \XeLaTeX{} template for Shanghai Jiao Tong University (SJTU) thesis} [EB/OL]. -% \newblock version 0.10, -% \newblock (2018-02-11) \urlprefix -% \url{https://github.com/weijianwen/SJTUThesis} -% -% \bibitem{wright2009dtxfile} -% \textsc{Wright J}. -% \newblock \textit{A model dtx file} [EB/OL]. -% \newblock (2009-10-06) \urlprefix -% \url{http://www.texdev.net/2009/10/06/a-model-dtx-file} -% -% \bibitem{gbt7714} -% \textsc{Zeping Lee}. -% \newblock \textit{GB/T 7714-2015 \BibTeX{} Style} [EB/OL]. -% \newblock version 1.0.3, -% \newblock (2018-03-16) \urlprefix -% \CTANurl{biblio/bibtex/contrib/gbt7714/gbt7714.pdf} -% -% \bibitem{zepinglee2017ustcthesis} -% \textsc{Zeping Lee} and \textsc{seisman}. -% \newblock \textit{\LaTeX{} template for USTC thesis v3.0} [EB/OL]. -% \newblock version 3.0.4, -% \newblock (2018-04-03) \urlprefix -% \url{https://github.com/ustctug/ustcthesis} +% \newblock (2016-01-31) +% \urlprefix\url{https://github.com/richarddzh/fudan-thesis} % % \bibitem{数院毕业论文格式} % 复旦大学数学科学学院. -% \newblock \textit{毕业论文格式 tex 版和 word 版} [EB/OL]. \urlprefix -% \url{http://math.fudan.edu.cn/show.aspx?info_lb=664&flag=101&info_id=1816} +% \newblock \textit{毕业论文格式 tex 版和 word 版} [EB/OL]. +% \urlprefix\url{http://math.fudan.edu.cn/show.aspx?info_lb=664&flag=101&info_id=1816} % % \bibitem{数院毕业论文格式更新} % 复旦大学数学科学学院. -% \newblock \textit{毕业论文格式: Word、\TeX{} 模板更新} [EB/OL]. \urlprefix -% \url{http://math.fudan.edu.cn/Show.aspx?info_lb=664&info_id=1855&flag=101} -% -% \bibitem{复旦大学论文规范} -% 复旦大学图书馆, 复旦大学研究生院. -% \newblock \textit{复旦大学博士、硕士学位论文规范} [EB/OL]. -% \newblock 2017 年 3 月修订版. -% \newblock (2017-03-27) \urlprefix -% \url{http://www.gs.fudan.edu.cn/_upload/article/4c/a8/a82545ef443b9c057c14ba13782c/c883c6f3-6d7f-410c-8f30-d8bde6fcb990.doc} -% -% \bibitem{gb-t-7713.1-2006} -% 国务院学位委员会办公室, 全国信息与文献标准化技术委员会. -% \newblock \textit{学位论文编写规则: GB/T 7713.1--2006} [S]. -% \newblock 北京: 中国标准出版社, 2007 +% \newblock \textit{毕业论文格式: Word、\TeX{} 模板更新} [EB/OL]. +% \urlprefix\url{http://math.fudan.edu.cn/Show.aspx?info_lb=664&info_id=1855&flag=101} % -% \bibitem{胡伟2017latex2e} -% 胡伟. -% \newblock \textit{\LaTeXe{} 文类和宏包学习手册} [M]. -% \newblock 北京: 清华大学出版社, 2017 +% \subsection{其他} % -% \bibitem{biblatex-gb7714-2015} -% 胡振震. -% \newblock \textit{符合 GB/T 7714-2015 标准的 biblatex 参考文献样式} [EB/OL]. -% \newblock version 1.0i, -% \newblock (2018-01-14) \urlprefix -% {\small\href{http://mirror.ctan.org/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf}^^A -% {\ttfamily CTAN://macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb77 14-2015.pdf}} -% -% \bibitem{gb-t-15834-2011} -% 教育部语言文字信息管理司. -% \newblock \textit{标点符号用法: GB/T 15834--2011} [S]. -% \newblock 北京: 中国标准出版社, 2012 -% -% \bibitem{cquthesis} -% 李振楠. -% \newblock \textit{\textsc{CquThesis}:重庆大学毕业论文 \LaTeX{} 模板} [EB/OL]. -% \newblock version 1.30, -% \newblock (2018-02-23) \urlprefix -% \CTANurl{macros/latex/contrib/cquthesis/cquthesis.pdf} -% -% \bibitem{刘海洋2013latex入门} -% 刘海洋. -% \newblock \textit{\LaTeX{} 入门} [M]. -% \newblock 北京: 电子工业出版社, 2013 -% -% \bibitem{gb-t-7714-2015} -% 全国信息与文献标准化技术委员会. -% \newblock \textit{信息与文献 参考文献著录规则: GB/T 7714--2015} [S]. -% \newblock 北京: 中国标准出版社, 2015 +% \bibitem{wright2009dtxfile} +% \textsc{Wright J}. +% \newblock \textit{A model dtx file} [EB/OL]. +% \newblock (2009-10-06) +% \urlprefix\url{https://www.texdev.net/2009/10/06/a-model-dtx-file/} % -% \bibitem{thuthesis} -% 薛瑞尼. -% \newblock \textit{\textsc{ThuThesis}:清华大学学位论文模板} [EB/OL]. -% \newblock version 5.4.3, -% \newblock (2017-12-24) \urlprefix -% \CTANurl{macros/latex/contrib/thuthesis/thuthesis.pdf} +% \bibitem{孔雀计划} +% 刘庆(\textsc{Eric Q L}). +% \newblock \textit{孔雀计划:中文字体排印的思路} [EB/OL]. +% \newblock (2009-10-06) +% \urlprefix\url{https://thetype.com/kongque/} % % \end{thebibliography} % @@ -2483,9 +2559,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % % \end{documentation} % -%^^A \EnableImplementation -%^^A \DisableImplementation -% % \begin{implementation} % %^^A 代码部分的页边距 @@ -2507,16 +2580,14 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % 正常的空格可以使用“|~|”代替;至于 |~| 原来所表示的“带子”, % 则要用 \LaTeXe{} 的原始命令 \tn{nobreakspace} 代替。 % -% 以下代码中有一些形如 \textcolor[HTML]{2E3191}^^A -% {\textsf{\textlangle *class\textrangle}} 的标记,这是 -% \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。 +% 以下代码中有一些形如 \textcolor[HTML]{2E3191}{\textsf{<*class>}} +% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。 % “\textsf{*}”和“\textsf{/}”分别表示该部分的开始和结束。不含 % “\textsf{*}”和“\textsf{/}”的 guard 出现在行号右侧,它们用来确定 % 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。 % -% 另有若干形如 \textcolor{MaterialPink}^^A -% {\textsf{\textlangle @@=fdu\textrangle}} 的 guard ,它们由 -% \pkg{l3docstrip} 定义,用来指示名字空间(模块)。 +% 另有若干形如 \textcolor{MaterialPink}{\textsf{<@@=fdu>}} 的 guard, +% 它们由 \pkg{l3docstrip} 定义,用来指示名字空间(模块)。 % % \subsection{准备} % @@ -2530,7 +2601,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. \RequirePackage { xparse, xtemplate, l3keys2e } \clist_map_inline:nn { expl3, xparse, xtemplate, l3keys2e } { - \@ifpackagelater {#1} { 2017/12/16 } + \@ifpackagelater {#1} { 2018/05/12 } { } { \msg_error:nnn { fduthesis } { l3-too-old } {#1} } } \msg_new:nnn { fduthesis } { l3-too-old } @@ -2841,9 +2912,9 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \changes{v0.7}{2018/01/19}{使用 \cls{ctexbook} 文档类,而非直接使用 % 标准文档类 \cls{book}。} % -% 将选项传入 \cls{ctexbook} 文档类。\\ +% 将选项传入 \cls{ctexbook} 文档类。 % \begin{macrocode} -% TODO: (2017/07/22) Chinese fonts in fduthesis-en +% TODO: (2017-07-22) Chinese fonts in fduthesis-en \PassOptionsToClass { UTF8, @@ -2872,11 +2943,10 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % 本模板会在 \pkg{ctexhook} 提供的钩子 \cs{ctex_at_end_preamble:n} % 中调用 \pkg{biblatex},而 \pkg{biblatex} 自身又会使用 \pkg{etoolbox} % 的钩子 \tn{AtEndPreamble},因此需要在载入 \cls{ctexbook} 之前调用 -% \pkg{etoolbox}。 -% -% 钩子的顺序为:$\text{\tn{CTEX@document@left@hook}} \prec -% \text{\tn{@endpreamblehook}} \prec -% \text{\texttt{\textbackslash begin\{document\}}}$。 +% \pkg{etoolbox}。钩子的顺序为: +% \[ \text{\tn{CTEX@document@left@hook}} +% \prec \text{\tn{@endpreamblehook}} +% \prec \text{\texttt{\textbackslash begin\{document\}}}. \] % \begin{macrocode} \RequirePackage { etoolbox } % \end{macrocode} @@ -2932,7 +3002,9 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. \@@_check_package:nnn { fontspec } { 2017/09/22 } { 2.6e } \@@_check_package:nnn { unicode-math } { 2017/11/18 } { 0.8i } \sys_if_engine_xetex:T - { \@@_check_package:nnn { xeCJK } { 2017/08/07 } { 3.5.0 } } + { \@@_check_package:nnn { xeCJK } { 2017/08/07 } { 3.5.0 } } +\sys_if_engine_luatex:T + { \@@_check_package:nnn { xunicode-addon } { 2018/04/30 } { 3.7.1 } } % \end{macrocode} % % \subsection{页面布局} @@ -2957,753 +3029,497 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % % \subsection{字体} % -% \changes{v0.5}{2017/09/09}{重新实现字体调用。核心内容是分离 -% 字体的声明与设定,并按照宋、黑、仿、楷划分中文字体。} -% -% 为了避免不必要的字体调用开销 -% \footnote{事实上,此处的修正对性能的提升并不大。}, -% 本模板把字体的\emph{声明}与\emph{设定}分离了开来。使用 -% \cs{fdusetup} 设置的字体选项,以及导言区中通过 \cs{setmainfont}、 -% \cs{setCJKmainfont} 等命令设置的字体,均按照字体\emph{声明}处理。 -% 此时,字体名及其选项被存入相关变量中,但不进行实际调用。导言区 -% 末尾,再进行统一调用。本模板将重新定义 \cs{setmainfont}、 -% \cs{setCJKmainfont} 等命令。 +% \subsubsection{预定义字体配置} % -% 对于中文字体,\pkg{ctex} 宏包及其底层 \pkg{xeCJK} 和 -% \pkg{LuaTeX-ja},均与 \pkg{fontspec} 保持一致,以 -% |main|、|sans|、|mono| 三类进行划分;而本模板则按照 -% 宋、黑、仿、楷等进行划分。为此,需要额外建立二者之间的对应关系。 +% \changes{v0.7c}{2019/03/05}{重构字体配置,并兼容 macOS。} % -% \begin{variable}{\g_@@_font_name_prop,\g_@@_font_options_prop} -% 存放西文字体名称及选项。 +% \begin{macro}{\g_@@_font_set_tl, \g_@@_cjk_font_set_tl} +% 存放字体选项值。 % \begin{macrocode} -\prop_new:N \g_@@_font_name_prop -\prop_new:N \g_@@_font_options_prop +\tl_new:N \g_@@_font_set_tl +%<class>\tl_new:N \g_@@_cjk_font_set_tl % \end{macrocode} -% \end{variable} -% -% \begin{variable}{\g_@@_cjk_font_name_prop, -% \g_@@_cjk_font_options_prop} -% 存放中文字体及选项。 -% \begin{macrocode} -\prop_new:N \g_@@_cjk_font_name_prop -\prop_new:N \g_@@_cjk_font_options_prop -% \end{macrocode} -% \end{variable} -% -% \subsubsection{选项处理} +% \end{macro} % -% 定义 |fdu/style| 键值类。 +% \begin{macro}{style/font} +% \changes{v0.7c}{2019/03/05}{新增 \opt{garamond} 和 \opt{times*} 样式。} +% 预定义西文字体。 % \begin{macrocode} \keys_define:nn { fdu / style } { -% \end{macrocode} -% -% \begin{macro}{style/font} -% 预定义西文字体。部分等宽字体(TeX Gyre Cursor)使用 -% \kvopt{Ligatures}{Common\-Off} 选项以禁用连字。 -% \begin{macrocode} - font .choice:, - font .value_required:n = true, -% \end{macrocode} -% Libertinus 系列。 -% \begin{macrocode} - font / libertinus .code:n = - { - \fdu_choose_font:nn { main } { Libertinus~ Serif } - \fdu_choose_font:nn { sans } { Libertinus~ Sans } - \fdu_choose_font_with_option:nnn { mono } - { TeX~ Gyre~ Cursor } { Ligatures = Common Off } - \fdu_choose_font:nn { math } { Libertinus~ Math } - \keys_set:nn { fdu / style } { footnote-style = libertinus } - }, -% \end{macrocode} -% Latin Modern 系列。 -% \begin{macrocode} - font / lm .code:n = - { - \fdu_choose_font:nn { main } { Latin~ Modern~ Roman } - \fdu_choose_font:nn { sans } { Latin~ Modern~ Sans } - \fdu_choose_font:nn { mono } { Latin~ Modern~ Mono } - \fdu_choose_font:nn { math } { Latin~ Modern~ Math } - \keys_set:nn { fdu / style } { footnote-style = pifont } - }, -% \end{macrocode} -% Palatino 系列。 -% \begin{macrocode} - font / palatino .code:n = - { - \fdu_choose_font:nn { main } { TeX~ Gyre~ Pagella } - \fdu_choose_font:nn { sans } { TeX~ Gyre~ Heros } - \fdu_choose_font_with_option:nnn { mono } - { TeX~ Gyre~ Cursor } { Ligatures = Common Off } - \fdu_choose_font:nn { math } { TeX~ Gyre~ Pagella~ Math } - \keys_set:nn { fdu / style } { footnote-style = pifont } - }, -% \end{macrocode} -% \changes{v0.6}{2017/11/11}{额外处理 XITS 字体的小型大写字母。} -% Times Roman 系列。XITS 字体没有小型大写字母,因此使用普通字体代替。 -% \begin{macrocode} - font / times .code:n = - { - \fdu_choose_font_with_option:nnn { main } { XITS } - { - UprightFeatures = { SmallCapsFont = * }, - BoldFeatures = { SmallCapsFont = *~ Bold }, - ItalicFeatures = { SmallCapsFont = *~ Italic }, - BoldItalicFeatures = { SmallCapsFont = *~ Bold~ Italic }, - } - \fdu_choose_font:nn { sans } { TeX~ Gyre~ Heros } - \fdu_choose_font_with_option:nnn { mono } - { TeX~ Gyre~ Cursor } { Ligatures = Common Off } - \fdu_choose_font:nn { math } { XITS~ Math } - \keys_set:nn { fdu / style } { footnote-style = xits } - }, -% \end{macrocode} -% \changes{v0.5}{2017/09/23}{新增 \kvopt{font}{none} 选项。} -% 不设置西文字体。 -% \begin{macrocode} - font / none .code:n = - { - \@@_initialize_prop:Nn \g_@@_font_name_prop - { main, sans, mono, math } - \@@_initialize_prop:Nn \g_@@_font_options_prop - { main, sans, mono, math } - \keys_set:nn { fdu / style } { footnote-style = plain } -%<*class> - }, + font .choices:nn = + { garamond, libertinus, lm, palatino, times, times*, none } + { \tl_set_eq:NN \g_@@_font_set_tl \l_keys_choice_tl } + } % \end{macrocode} % \end{macro} % % \begin{macro}{style/cjk-font} -% 预定义中文(CJK)字体。Adobe 和中易系列没有粗宋体。 -% \begin{macrocode} - cjk-font .choice:, - cjk-font .value_required:n = true, -% \end{macrocode} -% Adobe 系列。 -% \begin{macrocode} - cjk-font / adobe .code:n = - { - \fdu_choose_cjk_font:nn { song } { Adobe~ Song~ Std } - \fdu_choose_cjk_font:nn { hei } { Adobe~ Heiti~ Std } - \fdu_choose_cjk_font:nn { fang } { Adobe~ Fangsong~ Std } - \fdu_choose_cjk_font:nn { kai } { Adobe~ Kaiti~ Std } - }, -% \end{macrocode} -% Fandol 系列。 -% \begin{macrocode} - cjk-font / fandol .code:n = - { - \fdu_choose_cjk_font_with_option:nnn { song } - { FandolSong } { BoldFont = FandolSong~ Bold } - \fdu_choose_cjk_font:nn { hei } { FandolHei } - \fdu_choose_cjk_font:nn { fang } { FandolFang } - \fdu_choose_cjk_font:nn { kai } { FandolKai } - }, -% \end{macrocode} -% 方正系列。 -% \begin{macrocode} - cjk-font / founder .code:n = - { - \fdu_choose_cjk_font_with_option:nnn { song } - { FZShuSong-Z01 } { BoldFont = FZXiaoBiaoSong-B05 } - \fdu_choose_cjk_font:nn { hei } { FZHei-B01 } - \fdu_choose_cjk_font:nn { fang } { FZFangSong-Z02 } - \fdu_choose_cjk_font:nn { kai } { FZKai-Z03 } - }, -% \end{macrocode} -% Mac (华文)系列。 -% \begin{macrocode} - cjk-font / mac .code:n = - { - \fdu_choose_cjk_font_with_option:nnn { song } - { STSong } { BoldFont = STZhongsong } - \fdu_choose_cjk_font:nn { hei } { STHeiti } - \fdu_choose_cjk_font:nn { fang } { STFangsong } - \fdu_choose_cjk_font:nn { kai } { STKaiti } - }, -% \end{macrocode} -% Windows (中易)系列。 -% \begin{macrocode} - cjk-font / windows .code:n = - { - \fdu_choose_cjk_font:nn { song } { SimSun } - \fdu_choose_cjk_font:nn { hei } { SimHei } - \fdu_choose_cjk_font:nn { fang } { FangSong } - \fdu_choose_cjk_font:nn { kai } { KaiTi } - }, -% \end{macrocode} -% \changes{v0.5}{2017/09/23}{新增 \kvopt{cjk-font}{none} 选项。} -% 不设置中文字体。 +% \changes{v0.7c}{2019/03/05}{新增 \opt{sinotype} 和 \opt{sourcehan} 样式。} +% 预定义中文字体。 % \begin{macrocode} - cjk-font / none .code:n = - { - \@@_initialize_prop:Nn \g_@@_cjk_font_name_prop - { rm, sf, tt, kai } - \@@_initialize_prop:Nn \g_@@_cjk_font_options_prop - { rm, sf, tt, kai } -%</class> - } +%<*class> +\keys_define:nn { fdu / style } + { + cjk-font .choices:nn = + { adobe, fandol, founder, mac, sinotype, sourcehan, windows, none } + { \tl_set_eq:NN \g_@@_cjk_font_set_tl \l_keys_choice_tl } } % \end{macrocode} +%</class> % \end{macro} % -% \begin{macro}{\@@_initialize_prop:Nn} -% 把 |prop-list| 清空,将其并设置为 |main={},| |sans={}| 等。 +% \begin{macro}{ +% \@@_setmainfont:nn, +% \@@_setsansfont:nn, +% \@@_setmonofont:nn, +% \@@_setmathfont:nn} +% 用于设置西文字体的辅助函数,来源于 \pkg{fontspec} 和 \pkg{unicode-math}。 % \begin{arguments} -% \item |prop-list| -% \item {\meta{family 1}, \meta{family 2}, \ldots},如 -% |{main,| |sans,| |mono,| |math}| +% \item 字体名 +% \item 选项 % \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_initialize_prop:Nn #1#2 - { - \prop_gclear:N #1 - \clist_map_inline:nn {#2} { \prop_gput:Nnn #1 {##1} { } } - } -% \end{macrocode} -% \end{macro} -% -% \subsubsection{字体声明} -% -% 重定义文档命令,使其只声明字体,而不进行实际调用。 -% -% \begin{macro}{\setmainfont,\setsansfont,\setmonofont,\setmathfont} -% 声明西文字体。参数按照 \pkg{fontspec} 的风格,字体选项 -% 在前在后均可。 -% \begin{macrocode} -\clist_map_inline:nn - { main, sans, mono, math } - { - \exp_args:Nc \RenewDocumentCommand { set #1 font } { O { } m O { } } - { \fdu_choose_font_with_option:nnn { #1 } {##2} { ##1, ##3 } } - } -% \RenewDocumentCommand \setmainfont { O { } m O { } } -% { \fdu_choose_font_with_option:nnn { main } {#2} { #1, #3 } } -% \RenewDocumentCommand \setsansfont { O { } m O { } } -% { \fdu_choose_font_with_option:nnn { sans } {#2} { #1, #3 } } -% \RenewDocumentCommand \setmonofont { O { } m O { } } -% { \fdu_choose_font_with_option:nnn { mono } {#2} { #1, #3 } } -% \RenewDocumentCommand \setmathfont { O { } m O { } } -% { \fdu_choose_font_with_option:nnn { math } {#2} { #1, #3 } } +\cs_new_protected:Npn \@@_setmainfont:nn #1#2 + { \__fontspec_main_setmainfont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setsansfont:nn #1#2 + { \__fontspec_main_setsansfont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setmonofont:nn #1#2 + { \__fontspec_main_setmonofont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setmathfont:nn #1#2 + { \__um_setmathfont:nn {#2} {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\setCJKmainfont,\setCJKsansfont,\setCJKmonofont, -% \setCJKfamilyfont} -% 声明中文字体。参数同样按照 \pkg{fontspec} 的风格 -% \footnote{\pkg{xeCJK} 和 \pkg{ctex} 与之稍有区别,它们要求字体 -% 选项只能位于字体名的\emph{前或后},而不能同时出现(即不允许形如 -% \cs{setCJKmainfont}\texttt{\oarg{选项 1}\marg{字体}\oarg{选项 2}} -% 这样的语句)。}。 +% \begin{macro}{ +% \@@_setCJKmainfont:nn, +% \@@_setCJKsansfont:nn, +% \@@_setCJKmonofont:nn} +% 用于设置中文字体的辅助函数,来源于 \pkg{xeCJK} 和 \pkg{ctex} 宏包。 % \begin{macrocode} %<*class> -\RenewDocumentCommand \setCJKmainfont { O { } m O { } } - { \fdu_choose_cjk_font_with_option:nnn { rm } {#2} { #1, #3 } } -\RenewDocumentCommand \setCJKsansfont { O { } m O { } } - { \fdu_choose_cjk_font_with_option:nnn { sf } {#2} { #1, #3 } } -\RenewDocumentCommand \setCJKmonofont { O { } m O { } } - { \fdu_choose_cjk_font_with_option:nnn { tt } {#2} { #1, #3 } } -\RenewDocumentCommand \setCJKfamilyfont { m O { } m O { } } - { \fdu_choose_cjk_font_with_option:nnn {#1} {#3} { #2, #4 } } +\cs_new_protected:Npn \@@_setCJKmainfont:nn #1#2 + { \@@_set_family:nnn { \CJKrmdefault } {#2} {#1} } +\cs_new_protected:Npn \@@_setCJKsansfont:nn #1#2 + { \@@_set_family:nnn { \CJKsfdefault } {#2} {#1} } +\cs_new_protected:Npn \@@_setCJKmonofont:nn #1#2 + { \@@_set_family:nnn { \CJKttdefault } {#2} {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\setCJKsongfont,\setCJKheifont, -% \setCJKfangfont,\setCJKkaifont} -% 声明中文宋、黑、仿、楷字体,暂时不用。 -% \begin{macrocode} -% \DeclareDocumentCommand \setCJKsongfont { O { } m O { } } -% { \fdu_choose_cjk_font_with_option:nnn { song } {#2} { #1, #3 } } -% \DeclareDocumentCommand \setCJKheifont { O { } m O { } } -% { \fdu_choose_cjk_font_with_option:nnn { hei } {#2} { #1, #3 } } -% \DeclareDocumentCommand \setCJKfangfont { O { } m O { } } -% { \fdu_choose_cjk_font_with_option:nnn { fang } {#2} { #1, #3 } } -% \DeclareDocumentCommand \setCJKkaifont { O { } m O { } } -% { \fdu_choose_cjk_font_with_option:nnn { kai } {#2} { #1, #3 } } -%</class> +% \begin{macro}{\@@_set_cjk_font_kai:nn,\fdu@kai} +% 楷体需要单独设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_set_cjk_font_kai:nn #1#2 + { \@@_set_family:nnn { fdu@kai } {#2} {#1} } +\cs_new_protected:Npn \fdu@kai + { \@@_switch_family:n { fdu@kai } } % \end{macrocode} % \end{macro} % -% 字体选择只需将字体名及选项存入相应变量即可。 -% -% \begin{macro}{\fdu_choose_font_with_option:nnn,\fdu_choose_font:nn} -% 选择西文字体。 -% \begin{arguments} -% \item |main| / |sans| / |mono| / |math| -% \item 字体名 -% \item 选项 -% \end{arguments} +% \begin{macro}{\c_@@_cjk_font_options_tl, +% \@@_setCJKmainfont:n, +% \@@_setCJKsansfont:n, +% \@@_setCJKmonofont:n, +% \@@_set_cjk_font_kai:n} +% 将 bold、italic 和 bold italic 统一按照 roman 设置。 % \begin{macrocode} -\cs_new_protected:Npn \fdu_choose_font_with_option:nnn #1#2#3 - { - \prop_gput:Nnn \g_@@_font_name_prop {#1} {#2} - \prop_gput:Nnn \g_@@_font_options_prop {#1} {#3} - } -\cs_new_protected:Npn \fdu_choose_font:nn #1#2 - { - \prop_gput:Nnn \g_@@_font_name_prop {#1} {#2} - \prop_gput:Nnn \g_@@_font_options_prop {#1} { } - } +\tl_const:Nn \c_@@_cjk_font_options_tl + { UprightFont = *, BoldFont = *, ItalicFont = *, BoldItalicFont = * } +\cs_new_protected:Npx \@@_setCJKmainfont:n #1 + { \@@_setCJKmainfont:nn {#1} { \c_@@_cjk_font_options_tl } } +\cs_new_protected:Npx \@@_setCJKsansfont:n #1 + { \@@_setCJKsansfont:nn {#1} { \c_@@_cjk_font_options_tl } } +\cs_new_protected:Npx \@@_setCJKmonofont:n #1 + { \@@_setCJKmonofont:nn {#1} { \c_@@_cjk_font_options_tl } } +\cs_new_protected:Npx \@@_set_cjk_font_kai:n #1 + { \@@_set_cjk_font_kai:nn {#1} { \c_@@_cjk_font_options_tl } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fdu_choose_cjk_font_with_option:nnn, -% \fdu_choose_cjk_font:nn} -% 选择中文字体。 -% \begin{arguments} -% \item |rm| / |sf| / |tt| 或 |song| / |hei| / |fang| / |kai| -% \item 字体名 -% \item 选项 -% \end{arguments} +% \begin{macro}{\@@_set_family:nnn,\@@_switch_family:n} +% 封装 CJK 字体族的设定和切换命令。 % \begin{macrocode} -\cs_new_protected:Npn \fdu_choose_cjk_font_with_option:nnn #1#2#3 +\sys_if_engine_xetex:TF { - \prop_gput:Nnn \g_@@_cjk_font_name_prop {#1} {#2} - \prop_gput:Nnn \g_@@_cjk_font_options_prop {#1} {#3} + \cs_new_eq:NN \@@_set_family:nnn \xeCJK_set_family:nnn + \cs_new_eq:NN \@@_switch_family:n \xeCJK_switch_family:n } -\cs_new_protected:Npn \fdu_choose_cjk_font:nn #1#2 { - \prop_gput:Nnn \g_@@_cjk_font_name_prop {#1} {#2} - \prop_gput:Nnn \g_@@_cjk_font_options_prop {#1} { } + \cs_new_eq:NN \@@_set_family:nnn \ctex_ltj_set_family:nnn + \cs_new_eq:NN \@@_switch_family:n \ctex_ltj_switch_family:n } +%</class> % \end{macrocode} % \end{macro} % -% \subsubsection{字体设定} -% -% 此时需要利用 \pkg{fontspec}、\pkg{unicode-math}、\pkg{xeCJK}、 -% \pkg{ctex} 等宏包完成实际的字体调用。会在导言区末尾统一进行。 -% -% \begin{macro}{\@@_set_font:} -% 设定西文字体。 +% \begin{macro}{ +% \setmainfont, +% \setsansfont, +% \setmonofont, +% \setmathfont, +% \setCJKmainfont, +% \setCJKsansfont, +% \setCJKmonofont, +% \@@_set_font:n} +% 重新定义以上宏包提供的字体选择命令。我们把它放在导言区末尾,使得用户配置不被 +% 模板配置覆盖。 % \begin{macrocode} -\cs_new_protected:Npn \@@_set_font: +\cs_new_protected:Npn \@@_set_font_helper:n #1 { - \clist_map_inline:nn { main, sans, mono, math } + \exp_args:Nc \RenewDocumentCommand { set #1 font } { O { } m O { } } { - \prop_get:NnN \g_@@_font_name_prop {##1} \l_@@_tmpa_tl - \prop_get:NnN \g_@@_font_options_prop {##1} \l_@@_tmpb_tl - \tl_if_empty:NT \l_@@_tmpa_tl - { \@@_error:nn { font-not-defined } {##1} } - \use:c { @@_set_ ##1 _font:VV } \l_@@_tmpa_tl \l_@@_tmpb_tl + \ctex_at_end_preamble:n + { \use:c { @@_set #1 font:nn } {##2} { ##1, ##3 } } } } +\clist_map_inline:nn { main, sans, mono, math } { \@@_set_font_helper:n {#1} } +%<class>\clist_map_inline:nn { CJKmain, CJKsans, CJKmono } { \@@_set_font_helper:n {#1} } % \end{macrocode} % \end{macro} % -% \changes{v0.5}{2017/09/23}{同步 \pkg{fontspec} v2.6e。} -% -% \begin{macro}{\@@_set_main_font:nn, -% \@@_set_sans_font:nn, -% \@@_set_mono_font:nn} -% 拷贝 \cs{__fontspec_main_setmainfont:nn} 等命令。注意参数顺序 -% 是相反的。 -% \begin{arguments} -% \item 字体名 -% \item 选项 -% \end{arguments} +% \begin{macro}{\@@_load_font_garamond:} +% EB Garamond 系列。 % \begin{macrocode} -\clist_map_inline:nn { main, sans, mono } +\cs_new_protected:Npn \@@_load_font_garamond: { - \cs_new_protected:cpx { @@_set_ #1 _font:nn } ##1 ##2 - { \exp_not:c { __fontspec_main_set #1 font:nn } {##2} {##1} } + \@@_setmainfont:nn { EBGaramond } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic + } + \@@_setsansfont:nn { libertinussans } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { Garamond-Math.otf } { } } % \end{macrocode} % \end{macro} % -% \changes{v0.6}{2017/10/11}{同步 \pkg{unicode-math} v0.8h。} -% -% \begin{macro}{\@@_set_math_font:nn} -% 拷贝 \pkg{unicode-math} 中的 \cs{setmathfont} 命令。参数同上。 -% \begin{macrocode} -\cs_new_protected:Npn \@@_set_math_font:nn #1#2 - { \__um_setmathfont:nn {#2} {#1} } -% \end{macrocode} -% \end{macro} -% -% 生成字体设定函数的变体。 -% \begin{macrocode} -\clist_map_inline:nn { main, sans, mono, math } - { \cs_generate_variant:cn { @@_set_ #1 _font:nn } { VV } } -% \end{macrocode} -% -% \begin{macro}{\@@_set_cjk_font:} -% 设定中文字体。复杂之处在于需要建立宋、黑、仿、楷到 -% |rm| / |sf| / |tt| 的映照,如表~\ref{tab:cjk-font} 所示。 -% \begin{table}[ht] -% \caption{宋、黑、仿、楷到 \texttt{rm} / \texttt{sf} / -% \texttt{tt} 的映照} -% \label{tab:cjk-font} -% \centering -% \begin{tabular}{ccccc} -% \toprule -% & Normal & Bold & Italic & Bold-italic \\ -% \midrule -% |rm| & 宋体 & [粗宋] / \textsf{黑体} & \textit{楷体} & (\textit{粗楷}) \\ -% |sf| & \textsf{黑体} & (\textsf{粗黑}) & \textsf{黑体} & \textsf{黑体} \\ -% |tt| & \texttt{仿体} & (\texttt{粗仿}) & \textit{楷体} & (\textit{粗楷}) \\ -% \bottomrule -% \end{tabular} -% \end{table} +% \begin{macro}{\@@_load_font_libertinus:} +% Libertinus 系列。 % \begin{macrocode} -%<*class> -\cs_new_protected:Npn \@@_set_cjk_font: +\cs_new_protected:Npn \@@_load_font_libertinus: { - \clist_map_inline:nn { rm, sf, tt, kai } + \@@_setmainfont:nn { libertinusserif } { - \use:c { @@_parse_cjk_ ##1 _font: } - \@@_check_cjk_font:n {##1} - \@@_set_cjk_font_aux:n {##1} + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic } -% \end{macrocode} -% 清除冗余键值对。 -% \begin{macrocode} - \clist_map_inline:nn { song, hei, fang } + \@@_setsansfont:nn { libertinussans } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \@@_setmonofont:nn { lmmonolt10 } { - \prop_gremove:Nn \g_@@_cjk_font_name_prop {##1} - \prop_gremove:Nn \g_@@_cjk_font_options_prop {##1} + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique } + \@@_setmathfont:nn { libertinusmath-regular.otf } { } } % \end{macrocode} % \end{macro} % -% \begin{variable}{\l_@@_font_name_tl,\l_@@_font_options_clist} -% 临时存放字体名称和选项。 +% \begin{macro}{\@@_load_font_lm:} +% Latin Modern 系列。在 \XeLaTeX{} 和 \LuaLaTeX{} 中已作为默认字体,所以仅需 +% 额外处理数学部分。 % \begin{macrocode} -\tl_new:N \l_@@_font_name_tl -\clist_new:N \l_@@_font_options_clist +\cs_new_protected:Npn \@@_load_font_lm: + { \@@_setmathfont:nn { latinmodern-math.otf } { } } % \end{macrocode} -% \end{variable} +% \end{macro} % -% \begin{macro}{\@@_parse_cjk_rm_font:} -% 解析 |rm| 字体族。未设置 |rm| 字体族(即未调用 \cs{setmainfont}) -% 时,传入 |song| 对应的字体名和选项。|sf| 和 |tt| 字体族的解析 -% 基本类似。 +% \begin{macro}{\@@_load_font_palatino:} +% Palatino 系列。 % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_cjk_rm_font: +\cs_new_protected:Npn \@@_load_font_palatino: { - \prop_get:NnNF \g_@@_cjk_font_name_prop - { rm } \l_@@_font_name_tl + \@@_setmainfont:nn { texgyrepagella } { - \@@_get_cjk_font_name_options:nn { rm } { song } -% \end{macrocode} -% 根据 \opt{粗宋/黑} 选项来进行操作。目前暂未定义该选项,利用 -% \cs{use_ii:nn} 充当条件判断。使用黑体。 -% \begin{macrocode} - \use_ii:nn - { -% \end{macrocode} -% 粗宋。判断是否定义 \opt{BoldFont},若未定义,则设置 \opt{BoldFont} -% 为普通宋体。 -% \begin{macrocode} - \tl_if_in:NnF \l_@@_font_options_clist { BoldFont = } - { - \clist_put_right:Nx \l_@@_font_options_clist - { BoldFont = \l_@@_font_name_tl } - } - } - { -% \end{macrocode} -% 黑体。注意右侧选项会覆盖左侧选项。\\ -% \begin{macrocode} -% TODO: (2017/09/18) `hei` or `sans`? - \prop_get:NnN \g_@@_cjk_font_name_prop { hei } - \l_@@_tmpa_tl - \clist_put_right:Nx \l_@@_font_options_clist - { BoldFont = \l_@@_tmpa_tl } - } - \@@_get_cjk_kai_font: - \@@_set_cjk_font_options:n { rm } + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_parse_cjk_sf_font:} -% 解析 |sf| 字体族。未设置 |sf| 字体族(即未调用 \cs{setsansfont}) -% 时,传入 |hei| 对应的字体名和选项。 -% \begin{macrocode} -\cs_new_protected:Npn \@@_parse_cjk_sf_font: - { - \prop_get:NnNF \g_@@_cjk_font_name_prop - { sf } \l_@@_font_name_tl + \@@_setsansfont:nn { libertinussans } { - \@@_get_cjk_font_name_options:nn { sf } { hei } -% \end{macrocode} -% 黑体的 \opt{BoldFont}、\opt{ItalicFont}、\opt{BoldItalicFont} -% 都使用普通字体。不需要载入楷体。 -% \begin{macrocode} - \clist_put_right:Nx \l_@@_font_options_clist - { - BoldFont = \l_@@_font_name_tl, - ItalicFont = \l_@@_font_name_tl, - BoldItalicFont = \l_@@_font_name_tl - } - \@@_set_cjk_font_options:n { sf } + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Scale = MatchUppercase } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { texgyrepagella-math.otf } { } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_parse_cjk_tt_font:} -% 解析 |tt| 字体族。未设置 |tt| 字体族(即未调用 \cs{setmonofont}) -% 时,传入 |fang| 对应的字体名和选项。 +% \begin{macro}{\@@_load_font_times:} +% Times 系列。 % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_cjk_tt_font: +\cs_new_protected:Npn \@@_load_font_times: { - \prop_get:NnNF \g_@@_cjk_font_name_prop - { tt } \l_@@_font_name_tl + \@@_setmainfont:nn { XITS } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic, + UprightFeatures = { SmallCapsFont = *-Regular }, + BoldFeatures = { SmallCapsFont = *-Bold }, + ItalicFeatures = { SmallCapsFont = *-Italic }, + BoldItalicFeatures = { SmallCapsFont = *-BoldItalic } + } + \@@_setsansfont:nn { texgyreheros } { - \@@_get_cjk_font_name_options:nn { tt } { fang } - \clist_put_right:Nx \l_@@_font_options_clist - { BoldFont = \l_@@_font_name_tl } - \@@_get_cjk_kai_font: - \@@_set_cjk_font_options:n { tt } + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic } + \@@_setmonofont:nn { texgyrecursor } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Ligatures = CommonOff + } + \@@_setmathfont:nn { XITSMath-Regular.otf }{ BoldFont = XITSMath-Bold.otf } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_parse_cjk_kai_font:} -% 解析 |kai| 字体族。 +% \begin{macro}{\@@_load_font_times*:} +% Times* 系列,出数学部分外采用系统字体。 % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_cjk_kai_font: +\cs_new_protected:cpn { @@_load_font_ times* : } { - \prop_get:NnN \g_@@_cjk_font_name_prop { kai } - \l_@@_font_name_tl -% \end{macrocode} -% 与黑体类似,楷体的 \opt{BoldFont}、\opt{ItalicFont}、 -% \opt{BoldItalicFont} 也都使用普通字体。 -% \begin{macrocode} - \clist_set:Nx \l_@@_font_options_clist - { - BoldFont = \l_@@_font_name_tl, - ItalicFont = \l_@@_font_name_tl, - BoldItalicFont = \l_@@_font_name_tl - } - \@@_set_cjk_font_options:n { kai } + \@@_setmainfont:nn { Times~ New~ Roman } { } + \@@_setsansfont:nn { Arial } { } + \@@_setmonofont:nn { Courier~ New } { } + \@@_setmathfont:nn { XITSMath-Regular.otf }{ BoldFont = XITSMath-Bold.otf } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_get_cjk_font_name_options:nn} -% 处理字体名称和选项。字体名存入 \cs{l_@@_font_name_tl},字体 -% 选项存入 \cs{l_@@_font_options_clist}。注意字体名还被存入了 -% |prop-list| 中(对应的 \meta{key} = |#1|),但选项则在 -% |\__fdu_parse_cjk_..._font:| 的最后才会被存入 |prop-list| 中。 -% 因此还需要有 \cs{@@_set_cjk_font_options:n} 来设置选项。 -% \begin{arguments} -% \item |rm| / |sf| / |tt| -% \item |song| / |hei| / |fang| -% \end{arguments} +% \begin{macro}{\@@_load_cjk_font_adobe:} +% Adobe 字库。 % \begin{macrocode} -\cs_new_protected:Npn \@@_get_cjk_font_name_options:nn #1#2 +\cs_new_protected:Npn \@@_load_cjk_font_adobe: { - \prop_get:NnN \g_@@_cjk_font_name_prop {#2} \l_@@_font_name_tl - \prop_gput:NnV \g_@@_cjk_font_name_prop {#1} \l_@@_font_name_tl - \prop_get:NnN \g_@@_cjk_font_options_prop {#2} \l_@@_tmpa_tl - \clist_set:NV \l_@@_font_options_clist \l_@@_tmpa_tl + \@@_setCJKmainfont:n { AdobeSongStd-Light } + \@@_setCJKsansfont:n { AdobeHeitiStd-Regular } + \@@_setCJKmonofont:n { AdobeFangsongStd-Regular } + \@@_set_cjk_font_kai:n { AdobeKaitiStd-Regular } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_get_cjk_kai_font:} -% 补齐斜体、粗斜体(都设置为楷体)。 +% \begin{macro}{\@@_load_cjk_font_fandol:} +% Fandol 字库。注意它是安装在 TeX 发行版中的,所以使用文件名调用。 % \begin{macrocode} -\cs_new_protected:Npn \@@_get_cjk_kai_font: +\cs_new_protected:Npn \@@_load_cjk_font_fandol: { - \prop_get:NnN \g_@@_cjk_font_name_prop { kai } - \l_@@_tmpa_tl - \clist_put_right:Nx \l_@@_font_options_clist + \@@_setCJKmainfont:nn { FandolSong } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { FandolHei } { - ItalicFont = \l_@@_tmpa_tl, - BoldItalicFont = \l_@@_tmpa_tl + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKmonofont:nn { FandolFang } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + \@@_set_cjk_font_kai:nn { FandolKai } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_set_cjk_font_options:n} +% \begin{macro}{\@@_load_cjk_font_founder:} +% 方正字库。虽然有粗体(方正小标宋)等,但并非免费,故这里不做处理。 % \begin{macrocode} -% 设置选项,即把选项存入 |prop-list|,对应 \meta{key} = |#1|。 -% |#1| = |rm| / |sf| / |tt|。 -\cs_new_protected:Npn \@@_set_cjk_font_options:n #1 +\cs_new_protected:Npn \@@_load_cjk_font_founder: { - \prop_put:NnV \g_@@_cjk_font_options_prop {#1} - \l_@@_font_options_clist + \@@_setCJKmainfont:n { FZShuSong-Z01 } + \@@_setCJKsansfont:n { FZHei-B01 } + \@@_setCJKmonofont:n { FZFangSong-Z02 } + \@@_set_cjk_font_kai:n { FZKai-Z03 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_check_cjk_font:n} -% 检查 CJK 字体族是否已定义。 -% |#1| = |rm| / |sf| / |tt|。 +% \begin{macro}{\@@_load_cjk_font_mac:} +% macOS 自带中文字体。 % \begin{macrocode} -\cs_new_protected:Npn \@@_check_cjk_font:n #1 +\cs_new_protected:Npn \@@_load_cjk_font_mac: { - \prop_get:NnN \g_@@_cjk_font_name_prop {#1} - \l_@@_font_name_tl - \tl_if_empty:NT \l_@@_font_name_tl - { \@@_error:nn { cjk-font-not-defined } {#1} } + \@@_setCJKmainfont:nn { STSongti-SC } + { + UprightFont = *-Light, + BoldFont = *-Bold, + ItalicFont = *-Light, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { STHeitiSC } + { + UprightFont = *-Medium, + BoldFont = *-Medium, + ItalicFont = *-Medium, + BoldItalicFont = *-Medium + } + \@@_setCJKmonofont:n { STFangsong } + \@@_set_cjk_font_kai:nn { STKaitiSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\xeCJK_set_family:nVV,\ctex_ltj_set_family:nVV} -% 生成 \pkg{xeCJK} 和 \pkg{ctex} 中字体族设定函数的变体。 -% 由于 \cs{@@_set_cjk_font_aux:nnnn} 使用了 -% \cs{cs_new_protected:Npx} 定义,因此必须在它之前给出变体形式。 -% \begin{macrocode} -\cs_generate_variant:Nn \xeCJK_set_family:nnn { nVV } -\cs_generate_variant:Nn \ctex_ltj_set_family:nnn { nVV } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_set_cjk_font_aux:n} -% 利用 \pkg{xeCJK} 或 \pkg{ctex-ltj} 调用字体,需按照引擎的不同 -% 分别处理。使用 |Npx| 型来定义是为了在定义时直接确定引擎,以避开 -% 调用时的判断。 -% |#1| = |rm| / |sf| / |tt|。 +% \begin{macro}{\@@_load_cjk_font_sinotype:} +% 华文字库。 % \begin{macrocode} -\cs_new_protected:Npx \@@_set_cjk_font_aux:n #1 +\cs_new_protected:Npn \@@_load_cjk_font_sinotype: { - \prop_get:NnN \exp_not:N \g_@@_cjk_font_name_prop {#1} - \exp_not:N \l_@@_tmpa_tl - \prop_get:NnN \exp_not:N \g_@@_cjk_font_options_prop {#1} - \exp_not:N \l_@@_tmpb_tl - \sys_if_engine_xetex:TF - { \xeCJK_set_family:nVV } - { \sys_if_engine_luatex:T { \ctex_ltj_set_family:nVV } } - {#1} \exp_not:n { \l_@@_tmpb_tl \l_@@_tmpa_tl } + \@@_setCJKmainfont:n { STSong } + \@@_setCJKsansfont:n { STHeiti } + \@@_setCJKmonofont:n { STFangsong } + \@@_set_cjk_font_kai:n { STKaiti } } -%</class> % \end{macrocode} % \end{macro} % -% 字体族未定义信息。 -% \begin{macrocode} -\@@_msg_new:nn { font-not-defined } - { - \str_upper_case:f { \tl_head:n {#1} } \tl_tail:n {#1} ~ - font~ is~ not~ defined. \\\\ - You~ can~ set~ option~ "font"~ via~ "\string\fdusetup",~ - or~ use~ command~ \\ - "\string\set #1 font"~ to~ define~ new~ font~ families. - } -%<*class> -\@@_msg_new:nn { cjk-font-not-defined } - { - CJK~ font~ family~ "#1"~ is~ not~ defined. \\\\ - You~ can~ set~ option~ "cjk-font"~ via~ "\string\fdusetup",~ - or~ use~ commands~ \\ - "\string\setCJKmainfont",~ "\string\setCJKsansfont"~ or~ - "\string\setCJKmonofont",~ etc~ \\ - to~ define~ new~ CJK~ font~ families. - } -% \end{macrocode} -% -% \begin{macrocode} -\sys_if_engine_xetex:T - { -% \end{macrocode} -% 这里给这两个 |prop-list| 变量赋一个空值,使得 \pkg{xeCJK} 认为 -% |rm| 字体族已定义,从而避免警告。\LuaTeX{} 引擎下, -% \pkg{ctex-ltj} 不会给出警告,暂且不管。 -% \begin{macrocode} - \prop_gput:Nnn \g__xeCJK_family_font_name_prop { rm } { } - \prop_gput:Nnn \g__xeCJK_family_name_prop { rm } { } -% \end{macrocode} -% 关闭 \pkg{xeCJK} 中重定义字体族的警告。 -% \begin{macrocode} - \msg_redirect_name:nnn { xeCJK } { CJKfamily-redef } { none } - } -%</class> -% \end{macrocode} -% -% 在导言区末尾载入字体。 +% \begin{macro}{\@@_load_cjk_font_sourcehan:} +% 思源宋体、思源黑体。由于没有对应的楷体和仿宋,这里直接给出警告。 % \begin{macrocode} -\ctex_at_end_preamble:n +\cs_new_protected:Npn \@@_load_cjk_font_sourcehan: { - \@@_set_font: -%<class> \@@_set_cjk_font: - } -% \end{macrocode} -% -% \subsubsection{字体切换(楷体)} -% -% 一般情况下,楷体被用作中文斜体。但有时需要保持西文部分不被倾斜, -% 因此需要额外定义楷体切换命令。 -% -% \begin{macro}[TF]{\fdu_family_if_exist:n} -% \changes{v0.4}{2017/08/10}{修复 \LuaTeX{} 下的展开错误。} -% 判断字体族是否存在。 -% \XeTeX{} 引擎下直接利用 \pkg{xeCJK} 宏包提供的函数。 -% \begin{macrocode} -%<*class> -\sys_if_engine_xetex:TF - { - \prg_new_protected_conditional:Npnn - \fdu_family_if_exist:n #1 { TF } + \@@_setCJKmainfont:nn { SourceHanSerifSC } { - \xeCJK_family_if_exist:nTF {#1} - { \prg_return_true: } { \prg_return_false: } + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold } - } - { -% \end{macrocode} -% \LuaTeX{} 引擎下需要利用 \pkg{ctex} 宏包提供的函数。这两个函数 -% 的参数略有不同。 -% \begin{macrocode} - \sys_if_engine_luatex:T + \@@_setCJKsansfont:nn { SourceHanSansSC } { - \prg_new_protected_conditional:Npnn - \fdu_family_if_exist:n #1 { TF } - { - \ctex_ltj_family_if_exist:nNTF {#1} \l_@@_tmpa_tl - { \prg_return_true: } { \prg_return_false: } - } + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold } + \@@_warning:n { source-han } } +\@@_msg_new:nn { source-han } + { Font~ set~ `sourcehan'~ does~ not~ contain~ kaiti~ and~ fangsong. } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fdu_cjk_font_kai:} -% 楷体切换命令。 +% \begin{macro}{\@@_load_cjk_font_windows:} +% Windows 自带中文字体。 % \begin{macrocode} -\cs_new_protected:Npx \fdu_cjk_font_kai: +\cs_new_protected:Npn \@@_load_cjk_font_windows: { - \fdu_family_if_exist:nTF { kai } - { - \sys_if_engine_xetex:TF - { \xeCJK_switch_family:n { kai } } - { - \sys_if_engine_luatex:T - { \ctex_ltj_switch_family:n { kai } } - } - } - { \exp_not:n { \rmfamily \itshape } } + \@@_setCJKmainfont:n { SimSun } + \@@_setCJKsansfont:n { SimHei } + \@@_setCJKmonofont:n { FangSong } + \@@_set_cjk_font_kai:n { KaiTi } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\fdu@kai} -% 命令 \cs{fdu_cjk_font_kai:} 采用 \LaTeX3 风格,在 \file{.toc} -% 文件里无法正常使用,因此重新定义为 \LaTeXe{} 风格的命令。 +% \begin{macro}{\@@_load_font:} +% 字体加载命令。 % \begin{macrocode} -\cs_new_eq:NN \fdu@kai \fdu_cjk_font_kai: -%</class> +\cs_new_protected:Npn \@@_load_font: + { + \use:c { @@_load_font_ \tl_use:N \g_@@_font_set_tl : } +%<class> \use:c { @@_load_cjk_font_ \tl_use:N \g_@@_cjk_font_set_tl : } + } +\ctex_at_end_preamble:n { \@@_load_font: } % \end{macrocode} % \end{macro} % +%^^A 以下相关代码已在 v0.7c 中移除。 +% \changes{v0.5}{2017/09/09}{重新实现字体调用。核心内容是分离字体的声明与设定, +% 并按照宋、黑、仿、楷划分中文字体。} +% \changes{v0.6}{2017/11/11}{额外处理 XITS 字体的小型大写字母。} +% \changes{v0.5}{2017/09/23}{新增 \kvopt{font}{none} 选项。} +% \changes{v0.5}{2017/09/23}{新增 \kvopt{cjk-font}{none} 选项。} +% \changes{v0.5}{2017/09/23}{同步 \pkg{fontspec} v2.6e。} +% \changes{v0.6}{2017/10/11}{同步 \pkg{unicode-math} v0.8h。} +% % \subsubsection{数学字体设置} % % 根据 GB 3102.11--93 以及 ISO 80000-2:2009 的规定,数学表达式中 % 表示变量的拉丁字母和希腊字母均应当使用斜体。 -% 这里的 |\keys_set:nn{unicode-math}| 实际相当于 \cs{unimathsetup}。\\ +% 这里的 |\keys_set:nn{unicode-math}| 实际相当于 \cs{unimathsetup}。 % \begin{macrocode} -% TODO: (2018/01/19) do we need `mathrm=sym`? +% TODO: (2018-01-19) Do we need `mathrm=sym`? \keys_set:nn { unicode-math } { math-style = ISO, @@ -3946,8 +3762,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % % \begin{macro}{\cleardoublepage} % 重定义 \tn{cleardoublepage},使得偶数页面在没有内容时也不显示 -% 页眉页脚。\\ -% 见 http://tex.stackexchange.com/q/1681 \\ +% 页眉页脚,见 \url{https://tex.stackexchange.com/a/1683}。 \\ % 最后清空中间页眉,确保正文部分页眉显示正确。 % \begin{macrocode} \RenewDocumentCommand \cleardoublepage { } @@ -4168,17 +3983,17 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \begin{macrocode} \c_@@_fn_style_libertinus_tl { - \fontspec { Libertinus~ Serif } + \fontspec { libertinusserif-regular.otf } \@@_fn_symbol_libertinus:n {#1} } \c_@@_fn_style_libertinus_neg_tl { - \fontspec { Libertinus~ Serif } + \fontspec { libertinusserif-regular.otf } \@@_fn_symbol_libertinus_neg:n {#1} } \c_@@_fn_style_libertinus_sans_tl { - \fontspec { Libertinus~ Sans } + \fontspec { libertinussans-regular.otf } \@@_fn_symbol_libertinus_sans:n {#1} } % \end{macrocode} @@ -4197,17 +4012,17 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \begin{macrocode} \c_@@_fn_style_xits_tl { - \fontspec { XITS } + \fontspec { XITS-Regular.otf } \@@_fn_symbol_xits:n {#1} } \c_@@_fn_style_xits_sans_tl { - \fontspec { XITS } + \fontspec { XITS-Regular.otf } \@@_fn_symbol_xits_sans:n {#1} } \c_@@_fn_style_xits_sans_neg_tl { - \fontspec { XITS } + \fontspec { XITS-Regular.otf } \@@_fn_symbol_xits_sans_neg:n {#1} } } @@ -4313,7 +4128,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \end{macrocode} % 设置默认样式为 \opt{plain}。 % \begin{macrocode} -% TODO: (2017/12/07) move to interface +% TODO: (2017-12-07) Move to interface \tl_set:Nn \l_@@_thm_style_tl { plain } % \end{macrocode} % 处理可选参数。利用 |fdu/theorem| 键值对设置,并按此修改证毕符号、 @@ -4681,8 +4496,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. secret-level .choices:nn = { none, i, ii, iii } { - \int_compare:nTF - { \l_keys_choice_int >= 2 } + \int_compare:nTF { \l_keys_choice_int >= 2 } { \bool_set_true:N \l_@@_secret_bool \tl_set:Nn \l_@@_info_secret_level_tl @@ -4713,10 +4527,9 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \item 宽度 % \item 内容 % \end{arguments} -% 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 -% \tn{unskip} 将会去掉最后一个 \tn{hfil}。见 -% \url{http://tex.stackexchange.com/q/169689}。|#2| 需要完全展开以 -% 避免 underfull 警告。 +% 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 \tn{unskip} +% 将会去掉最后一个 \tn{hfil}。见 \url{https://tex.stackexchange.com/q/169689}。 +% |#2| 需要完全展开以避免 underfull 警告。 % \begin{macrocode} \cs_new_protected:Npn \@@_spread_box:nn #1#2 { @@ -4898,19 +4711,16 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \end{macro} % % \begin{macro}{\@@_cover_degree:} +% \changes{v0.7c}{2019/03/12}{允许博士学位论文使用学位类型。} % 学位类型。 % \begin{macrocode} \cs_new_protected:Npn \@@_cover_degree: { - \int_compare:nNnT \g_@@_thesis_type_int = \c_two + \int_compare:nT { \g_@@_thesis_type_int != 3 } { - \tl_set:Nx \l_@@_tmpa_tl - { - \clist_item:Nn \c_@@_degree_type_clist - { \l_@@_info_degree_type_int } - } \c_@@_fullwidth_left_paren_tl - \l_@@_tmpa_tl + \clist_item:Nn \c_@@_degree_type_clist + { \l_@@_info_degree_type_int } \c_@@_fullwidth_right_paren_tl } } @@ -4988,7 +4798,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % 声明封面对象。不需要带参数。 % \begin{macrocode} %<@@=fdu_cover> -\DeclareObjectType { fdu / cover } { \c_zero } +\DeclareObjectType { fdu / cover } { \c_zero_int } % \end{macrocode} % % \begin{macro}{\DeclareCoverTemplate,\fdu_cover_declare_template:nn} @@ -5069,9 +4879,9 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % 为了展开的方便,这里需要封装 \pkg{xtemplate} 的一些函数。 % \begin{macrocode} \cs_new_protected:Npn \@@_declare_template_interface:nn #1#2 - { \DeclareTemplateInterface { fdu / cover } {#1} { \c_zero } {#2} } + { \DeclareTemplateInterface { fdu / cover } {#1} { \c_zero_int } {#2} } \cs_new_protected:Npn \@@_declare_template_code:nnn #1#2#3 - { \DeclareTemplateCode { fdu / cover } {#1} { \c_zero } {#2} {#3} } + { \DeclareTemplateCode { fdu / cover } {#1} { \c_zero_int } {#2} {#3} } \cs_generate_variant:Nn \@@_declare_template_interface:nn { nx } \cs_generate_variant:Nn \@@_declare_template_code:nnn { nxn } % \end{macrocode} @@ -5335,12 +5145,12 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. section / tocline = { %<class-en> \bfseries - \CTEXnumberline {#1} #2 + \CTEXnumberline {#1} #2 }, subsection / tocline = { %<class> \fdu@kai - \CTEXnumberline {#1} #2 + \CTEXnumberline {#1} #2 } } % \end{macrocode} @@ -5736,9 +5546,9 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>. % \begin{macrocode} \cs_new:Npn \@@_biblatex_allow_url_break: { - \int_set_eq:NN \c@biburlucpenalty \c_one - \int_set_eq:NN \c@biburlnumpenalty \c_one - \int_set_eq:NN \c@biburllcpenalty \c_one + \int_set_eq:NN \c@biburlucpenalty \c_one_int + \int_set_eq:NN \c@biburlnumpenalty \c_one_int + \int_set_eq:NN \c@biburllcpenalty \c_one_int } % \end{macrocode} % \end{macro} |