From ae02217f0c90b2ddb0efad2ac4c97b3f882f9b31 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 3 Apr 2019 21:40:04 +0000 Subject: fduthesis (3apr19) git-svn-id: svn://tug.org/texlive/trunk@50738 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/fduthesis/fduthesis.dtx | 516 ++++++++++----------- 1 file changed, 245 insertions(+), 271 deletions(-) (limited to 'Master/texmf-dist/source/latex/fduthesis') diff --git a/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx b/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx index 3e2cada62e3..cd50a39ec62 100644 --- a/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx +++ b/Master/texmf-dist/source/latex/fduthesis/fduthesis.dtx @@ -47,7 +47,7 @@ The `fduthesis` Class ===================== -*LaTeX thesis template for Fudan University, v0.7c* +*LaTeX thesis template for Fudan University, v0.7d* Overview -------- @@ -236,7 +236,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . %\NeedsTeXFormat{LaTeX2e} %\RequirePackage{expl3} %<*!(driver|install|ex-logo|cover)> -%\GetIdInfo $Id: fduthesis.dtx 0.7c 2019-03-17 12:00:00Z Xiangdong Zeng $ +%\GetIdInfo $Id: fduthesis.dtx 0.7d 2019-04-03 12:00:00Z Xiangdong Zeng $ % {Thesis template for Fudan University} %\ProvidesExplClass{\ExplFileName} % {Thesis template for Fudan University (English version)} @@ -280,13 +280,13 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . \title{\textcolor{MaterialIndigo800}{% \textbf{fduthesis: 复旦大学论文\xpinyin[font=\sffamily]{模}{mu2}板}}} \author{曾祥东} -\date{2019/03/17\quad v0.7c% +\date{2019/04/03\quad v0.7d% \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! \date{2019/04/03\quad v0.7d% %^^A! \thanks{\url{https://github.com/stone-zeng/fduthesis}.}} %^^A! @@ -316,7 +316,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \changes{v0.3}{2017/07/10}{添加英文模板。} % \changes{v0.3}{2017/07/19}{使用 \pkg{l3docstrip} 管理名字空间。} % \changes{v0.3}{2017/07/28}{整理代码,编写用户文档。} -% \changes{v0.4}{2017/08/03}{拆分 \file{dtx} 文件。} +% \changes{v0.4}{2017/08/03}{拆分 \file{.dtx} 文件。} % \changes{v0.4}{2017/08/11}{添加错误信息提示。} % \changes{v0.6}{2017/11/23}{同步 \pkg{ctex} v2.4.11。} % \changes{v0.6}{2017/11/29}{添加英文版用户文档。} @@ -2548,7 +2548,6 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \bibitem{孔雀计划} % 刘庆(\textsc{Eric Q L}). % \newblock \textit{孔雀计划:中文字体排印的思路} [EB/OL]. -% \newblock (2009-10-06) % \urlprefix\url{https://thetype.com/kongque/} % % \end{thebibliography} @@ -3033,13 +3032,13 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % % \changes{v0.7c}{2019/03/05}{重构字体配置,并兼容 macOS。} % -% \begin{macro}{\g_@@_font_set_tl, \g_@@_cjk_font_set_tl} +% \begin{variable}{\g_@@_font_set_tl, \g_@@_cjk_font_set_tl} % 存放字体选项值。 % \begin{macrocode} \tl_new:N \g_@@_font_set_tl %\tl_new:N \g_@@_cjk_font_set_tl % \end{macrocode} -% \end{macro} +% \end{variable} % % \begin{macro}{style/font} % \changes{v0.7c}{2019/03/05}{新增 \opt{garamond} 和 \opt{times*} 样式。} @@ -3117,23 +3116,26 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{macrocode} % \end{macro} % -% \begin{macro}{\c_@@_cjk_font_options_tl, +% \changes{v0.7d}{2019/03/29}{在字体未提供对应粗体的情况下,允许使用伪粗。} +% +% \begin{macro}{ +% \@@_cjk_font_options:, % \@@_setCJKmainfont:n, % \@@_setCJKsansfont:n, % \@@_setCJKmonofont:n, % \@@_set_cjk_font_kai:n} % 将 bold、italic 和 bold italic 统一按照 roman 设置。 % \begin{macrocode} -\tl_const:Nn \c_@@_cjk_font_options_tl - { UprightFont = *, BoldFont = *, ItalicFont = *, BoldItalicFont = * } +\tl_const:Nn \@@_cjk_font_options: + { UprightFont = *, ItalicFont = *, AutoFakeBold = true } \cs_new_protected:Npx \@@_setCJKmainfont:n #1 - { \@@_setCJKmainfont:nn {#1} { \c_@@_cjk_font_options_tl } } + { \@@_setCJKmainfont:nn {#1} { \@@_cjk_font_options: } } \cs_new_protected:Npx \@@_setCJKsansfont:n #1 - { \@@_setCJKsansfont:nn {#1} { \c_@@_cjk_font_options_tl } } + { \@@_setCJKsansfont:nn {#1} { \@@_cjk_font_options: } } \cs_new_protected:Npx \@@_setCJKmonofont:n #1 - { \@@_setCJKmonofont:nn {#1} { \c_@@_cjk_font_options_tl } } + { \@@_setCJKmonofont:nn {#1} { \@@_cjk_font_options: } } \cs_new_protected:Npx \@@_set_cjk_font_kai:n #1 - { \@@_set_cjk_font_kai:nn {#1} { \c_@@_cjk_font_options_tl } } + { \@@_set_cjk_font_kai:nn {#1} { \@@_cjk_font_options: } } % \end{macrocode} % \end{macro} % @@ -3497,8 +3499,8 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \begin{macrocode} \cs_new_protected:Npn \@@_load_font: { - \use:c { @@_load_font_ \tl_use:N \g_@@_font_set_tl : } -% \use:c { @@_load_cjk_font_ \tl_use:N \g_@@_cjk_font_set_tl : } + \use:c { @@_load_font_ \g_@@_font_set_tl : } +% \use:c { @@_load_cjk_font_ \g_@@_cjk_font_set_tl : } } \ctex_at_end_preamble:n { \@@_load_font: } % \end{macrocode} @@ -3583,9 +3585,8 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . { \@@_set_fullwidth_stop_catcode: }, % \end{macrocode} % 利用 TECKit 映射机制切换,相当于设置了 \tn{defaultCJKfontfeatures} -% |{|\kvopt{Map\-ping}{fullwidth-stop}|}|。这种手段会 -% 替换所有出现的\FSID,并且将影响所有字体。只在 \XeTeX{} -% 下可用。 +% |{|\kvopt{Map\-ping}{fullwidth-stop}|}|。这种手段会替换所有出现的\FSID, +% 并且将影响所有字体。只在 \XeTeX{} 下可用。 % \begin{macrocode} fullwidth-stop / mapping .code:n = { @@ -3624,59 +3625,15 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \begin{macrocode} \cs_new:Npn \@@_set_fullwidth_stop_catcode: { - \char_set_active_eq:nN { "3002 } \c_@@_fullwidth_full_stop_tl + \char_set_active_eq:nN { "3002 } \c_@@_fwid_full_stop_tl \char_set_catcode_active:n { "3002 } } % % \end{macrocode} % \end{macro} % -% \changes{v0.6}{2017/10/28}{优化 \LuaTeX{} 下希腊字母、西里尔字母 -% 和带圈数字的显示(\pkg{ctex} v2.4.11 已默认进行处理)。} -% -% \subsection{章节标题结构} -% -% |\keys_set:nn{ctex}| 实际相当于 \cs{ctexset}。 -% \begin{macrocode} -\keys_set:nn { ctex } - { -% \end{macrocode} -% -% 设置章(chapter)、节(section)与小节(sub-section)标题样式。 -% 此处使用 \kvopt{fixskip}{true} 选项来抑制前后的多余间距。 -% \begin{macrocode} - chapter = - { -% format = \huge \normalfont \sffamily \centering, -%<*class-en> - format = \centering, - nameformat = \LARGE \bfseries, - titleformat = \huge \bfseries, - aftername = \par \nobreak \vskip 10 pt, -% - beforeskip = 50 pt, - afterskip = 40 pt, - number = \@@_arabic:n { chapter }, - fixskip = true - }, - section = - { -% format = \Large \normalfont \sffamily \raggedright, -% format = \Large \bfseries \raggedright, - beforeskip = 3.5 ex plus 1.0 ex minus 0.2 ex, - afterskip = 2.7 ex plus 0.5 ex, - fixskip = true - }, - subsection = - { -% format = \large \normalfont \sffamily \raggedright, -% format = \large \bfseries \raggedright, - beforeskip = 3.25 ex plus 1.0 ex minus 0.2 ex, - afterskip = 2.5 ex plus 0.3 ex, - fixskip = true - } - } -% \end{macrocode} +% \changes{v0.6}{2017/10/28}{优化 \LuaTeX{} 下希腊字母、西里尔字母和带圈数字的 +% 显示(\pkg{ctex} v2.4.11 已默认进行处理)。} % % \subsection{页眉页脚} % @@ -3686,8 +3643,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{macrocode} % % \begin{variable}{\l_@@_header_center_mark_tl} -% 保存中间页眉的文字。正文中设置为空,目录、摘要、符号表等设置为 -% 相应标题。 +% 保存中间页眉的文字。正文中设置为空,目录、摘要、符号表等设置为相应标题。 % \begin{macrocode} \tl_new:N \l_@@_header_center_mark_tl % \end{macrocode} @@ -3744,26 +3700,10 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \RenewDocumentCommand \headrulewidth { } { 0 pt } % \end{macrocode} % -% \begin{macro}{\fdu_front_matter_header:n} -% 在单页模式下,设置前导部分(包括目录、摘要、符号表等)的页眉中间 -% 为相应标题,左右为空。 -% \begin{macrocode} -\cs_new:Npn \fdu_front_matter_header:n #1 - { - \bool_if:NTF \g_@@_twoside_bool - { \markboth {#1} {#1} } - { - \markboth { } { } - \tl_gset:Nn \l_@@_header_center_mark_tl {#1} - } - } -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\cleardoublepage} -% 重定义 \tn{cleardoublepage},使得偶数页面在没有内容时也不显示 -% 页眉页脚,见 \url{https://tex.stackexchange.com/a/1683}。 \\ -% 最后清空中间页眉,确保正文部分页眉显示正确。 +% 重定义 \tn{cleardoublepage},使得偶数页面在没有内容时也不显示页眉页脚,见 +% \url{https://tex.stackexchange.com/a/1683}。最后清空中间页眉,确保正文部分 +% 页眉显示正确。 % \begin{macrocode} \RenewDocumentCommand \cleardoublepage { } { @@ -3778,13 +3718,101 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{macrocode} % \end{macro} % -% \pkg{ctex} 宏包使用 \opt{heading} 选项后,会把页面格式设置为 -% |headings|。因此必须在 \pkg{ctex} 调用之后重新设置 \cs{pagestyle} -% 为 |fancy|。 +% \pkg{ctex} 宏包使用 \opt{heading} 选项后,会把页面格式设置为 |headings|。 +% 因此必须在 \pkg{ctex} 调用之后重新设置 \cs{pagestyle} 为 |fancy|。 % \begin{macrocode} \pagestyle { fancy } % \end{macrocode} % +% \subsection{章节标题结构} +% +% |\keys_set:nn{ctex}| 实际相当于 \cs{ctexset}。 +% \begin{macrocode} +\keys_set:nn { ctex } + { +% \end{macrocode} +% 设置章(chapter)、节(section)与小节(sub-section)标题样式。 +% 此处使用 \kvopt{fixskip}{true} 选项来抑制前后的多余间距。 +% \begin{macrocode} + chapter = + { +% format = \huge \normalfont \sffamily \centering, +%<*class-en> + format = \centering, + nameformat = \LARGE \bfseries, + titleformat = \huge \bfseries, + aftername = \par \nobreak \vskip 10 pt, +% + beforeskip = 50 pt, + afterskip = 40 pt, + number = \@@_arabic:n { chapter }, + fixskip = true + }, + section = + { +% format = \Large \normalfont \sffamily \raggedright, +% format = \Large \bfseries \raggedright, + beforeskip = 3.5 ex plus 1.0 ex minus 0.2 ex, + afterskip = 2.7 ex plus 0.5 ex, + fixskip = true + }, + subsection = + { +% format = \large \normalfont \sffamily \raggedright, +% format = \large \bfseries \raggedright, + beforeskip = 3.25 ex plus 1.0 ex minus 0.2 ex, + afterskip = 2.5 ex plus 0.3 ex, + fixskip = true + } + } +% \end{macrocode} +% +% \changes{v0.7d}{2019/03/24}{优化目录、摘要、参考文献等的标题实现。} +% +% \begin{macro}{\@@_chapter:n,\@@_chapter:V} +% 手动生成章的标题,用于摘要、参考文献等。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter:n #1 + { + \group_begin: + \ctexset { chapter / numbering = false } + \chapter {#1} + \@@_chapter_header:n {#1} + \group_end: + } +\cs_generate_variant:Nn \@@_chapter:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_chapter_no_toc:n,\@@_chapter_no_toc:V} +% 目录自身不出现在目录中,需特别处理。参考 +% \url{https://tex.stackexchange.com/a/1821}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter_no_toc:n #1 + { + \chapter * {#1} + \@@_chapter_header:n {#1} + \pdfbookmark [0] {#1} { toc } + } +\cs_generate_variant:Nn \@@_chapter_no_toc:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_chapter_header:n} +% 单页模式下,目录、摘要、符号表等的页眉中间为相应标题,左右为空。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter_header:n #1 + { + \bool_if:NTF \g_@@_twoside_bool + { \markboth {#1} {#1} } + { + \markboth { } { } + \tl_gset:Nn \l_@@_header_center_mark_tl {#1} + } + } +% \end{macrocode} +% \end{macro} +% % \subsection{脚注} % % \changes{v0.3}{2017/02/21}{支持脚注。} @@ -4667,7 +4695,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . \cs_new:Npn \@@_cover_id_aux:n #1 { \tl_use:c { c_@@_name_ #1 _tl } - \c_@@_fullwidth_colon_tl + \c_@@_fwid_colon_tl \tl_use:c { l_@@_info_ #1 _tl } } % \end{macrocode} @@ -4718,10 +4746,10 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . { \int_compare:nT { \g_@@_thesis_type_int != 3 } { - \c_@@_fullwidth_left_paren_tl + \c_@@_fwid_left_paren_tl \clist_item:Nn \c_@@_degree_type_clist { \l_@@_info_degree_type_int } - \c_@@_fullwidth_right_paren_tl + \c_@@_fwid_right_paren_tl } } % \end{macrocode} @@ -4767,7 +4795,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl \@@_spread_box:nn { 6 em } { \l_@@_tmpa_tl } - \c_@@_fullwidth_colon_tl + \c_@@_fwid_colon_tl \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl } \skip_vertical:n { 1 ex } } @@ -4783,7 +4811,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . { \clist_map_inline:Nn #1 { - ##1 \c_@@_fullwidth_colon_tl + ##1 \c_@@_fwid_colon_tl \@@_blank_underline:n { 6 em } \@@_quad: } @@ -4836,7 +4864,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . \skip_new:c { l_@@ / #1 / ##1 / bottom_skip } } % \end{macrocode} -% 声明模板代码。 +% 声明模板代码。^^A 以下名字空间为 `fdu_cover' 而非 `fdu' % \begin{macrocode} \@@_declare_template_code:nxn {#1} { @@ -5001,12 +5029,13 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . } % \end{macrocode} % +% \changes{v0.7d}{2019/03/29}{封面中文标题改为加粗宋体(可能使用伪粗)。} +% % 定义封面的具体配置参数。 % \begin{macrocode} \DeclareInstance { fdu / cover } { cover-i-default } { cover-i } { -% format = -% \@@_line_spread:N \c_@@_line_spread_fp, +% format = \@@_line_spread:N \c_@@_line_spread_fp, bottom-skip = 0 pt plus 1.5 fill, id / content = \@@_cover_id:, logo / content = \@@_cover_logo:, @@ -5022,9 +5051,8 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . id / format = \zihao { -5 }, type / format = \zihao { 2 }, degree / format = \zihao { 4 }, - title / format = \zihao { -2 } \sffamily, - title-en / format = - \@@_line_spread:n { 1.2 } \zihao { 4 } \bfseries, + title / format = \zihao { -2 } \bfseries, + title-en / format = \@@_line_spread:n { 1.2 } \zihao { 4 } \bfseries, id / bottom-skip = 0 pt plus 1.6 fill, logo / bottom-skip = 0 pt plus 0.3 fill, type / bottom-skip = -18 pt, @@ -5040,8 +5068,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . } \DeclareInstance { fdu / cover } { cover-ii-default } { cover-ii } { -% format = -% \@@_line_spread:N \c_@@_line_spread_fp, +% format = \@@_line_spread:N \c_@@_line_spread_fp, title / content = \@@_spread_box:nn { 7 em } { \c_@@_name_instructors_tl }, name-list / content = @@ -5117,15 +5144,6 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % % \subsection{目录} % -% \begin{variable}{\@@_chapter_toc_format:,\@@_chapter_toc_en_format:} -% 目录中章标题的样式还要用在摘要、符号表中。因为摘要分中英文,所以这里 -% 需要分别定义其样式。 -% \begin{macrocode} -\tl_const:Nn \@@_chapter_toc_format: { \normalfont \sffamily } -\tl_const:Nn \@@_chapter_toc_en_format: { \bfseries } -% \end{macrocode} -% \end{variable} -% % 设置目录标题。 % \begin{macrocode} \keys_set:nn { ctex } @@ -5138,8 +5156,8 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \begin{macrocode} chapter / tocline = { -% \@@_chapter_toc_format: -% \@@_chapter_toc_en_format: +% \normalfont \sffamily +% \bfseries \CTEXnumberline {#1} #2 }, section / tocline = @@ -5156,8 +5174,8 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{macrocode} % % \begin{macro}{\tableofcontents} -% 修改 \tn{tableofcontents} 的定义,使得页眉正确显示。第二个参数中的 -% 代码来源于 \LaTeXe{} 标准文档类 \file{book.cls}。 +% 修改 \cs{tableofcontents} 的定义,使得页眉正确显示,并出现在目录中。原代码 +% 来自于 \LaTeXe{} 标准文档类 \file{book.cls}。 % \begin{macrocode} \@@_patch_cmd:Nnn \tableofcontents { @@ -5165,11 +5183,7 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . \@mkboth{% \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% } - { - \chapter* { \contentsname } -% \fdu_front_matter_header:n { \c_@@_name_toc_tl } -% \fdu_front_matter_header:n { \c_@@_name_toc_en_tl } - } + { \@@_chapter_no_toc:V \contentsname } % \end{macrocode} % \end{macro} % @@ -5207,71 +5221,66 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{environment} % % \begin{macro}{\@@_abstract_begin:,\@@_abstract_en_begin:} -% 摘要页需要修改页眉,并添加到目录。 +% 摘要页标题。 % \begin{macrocode} %<*class> \cs_new_protected:Npn \@@_abstract_begin: - { - \chapter* { \c_@@_name_abstract_tl } - \fdu_front_matter_header:n { \c_@@_name_abstract_tl } - \addcontentsline { toc } { chapter } - { - \@@_chapter_toc_format: - \c_@@_name_abstract_tl - } - } + { \@@_chapter:V \c_@@_name_abstract_tl } % \cs_new_protected:Npn \@@_abstract_en_begin: - { - \chapter* { \c_@@_name_abstract_en_tl } - \fdu_front_matter_header:n { \c_@@_name_abstract_en_tl } - \addcontentsline { toc } { chapter } - { -% \@@_chapter_toc_format: -% \@@_chapter_toc_en_format: - \c_@@_name_abstract_en_tl - } - } + { \@@_chapter:V \c_@@_name_abstract_en_tl } % \end{macrocode} % \end{macro} % +% \changes{v0.7d}{2019/03/28}{优化关键字列表的显示。} +% % \begin{macro}{\@@_abstract_end:,\@@_abstract_en_end:} % 摘要正文完成后,输出关键字列表和中图分类号(CLC)。 % \begin{macrocode} %<*class> \cs_new_protected:Npn \@@_abstract_end: { - \@@_keywords_par: - \textsf { \c_@@_name_keywords_tl \c_@@_fullwidth_colon_tl } - \clist_use:Nn \l_@@_info_keywords_clist - { \c_@@_fullwidth_semicolon_tl } - \@@_clc_par: - \textsf { \c_@@_name_clc_tl \c_@@_fullwidth_colon_tl } - \l_@@_info_clc_tl + \@@_keywords:nNn + { \sffamily \c_@@_name_keywords_tl \c_@@_fwid_colon_tl } + \l_@@_info_keywords_clist { \c_@@_fwid_semicolon_tl } + \@@_clc:nn + { \sffamily \c_@@_name_clc_tl \c_@@_fwid_colon_tl } + { \l_@@_info_clc_tl } } % \cs_new_protected:Npn \@@_abstract_en_end: { - \@@_keywords_par: - \textbf { \c_@@_name_keywords_en_tl } \@@_quad: - \clist_use:Nn \l_@@_info_keywords_en_clist { \@@_quad: } - \@@_clc_par: - \textbf { \c_@@_name_clc_en_tl } \@@_quad: - \l_@@_info_clc_tl + \@@_keywords:nNn + { \bfseries \c_@@_name_keywords_en_tl \@@_quad: } + \l_@@_info_keywords_en_clist { ; ~ } + \@@_clc:nn + { \bfseries \c_@@_name_clc_en_tl \@@_quad: } + { \l_@@_info_clc_tl } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_keywords_par:,\@@_clc_par:} -% 关键字列表前要空一行,使用悬挂缩进;中图分类号不缩进。 +% \begin{macro}{\@@_keywords:nNn,\@@_keywords_prevdepth:,\@@_clc:nn} +% 关键字列表前要空一行,使用悬挂缩进;中图分类号不缩进。|\parbox| 之后的间距 +% 需要调整,见 \url{https://tex.stackexchange.com/a/34982}。 % \begin{macrocode} -\cs_new:Npn \@@_keywords_par: +\cs_new_protected:Npn \@@_keywords:nNn #1#2#3 { - \par \mode_leave_vertical: \par - \noindent \hangindent = 4 em \hangafter = 1 + \par \mode_leave_vertical: \par \noindent + \@@_get_text_width:Nn \l_@@_tmpa_dim {#1} + \group_begin: #1 \group_end: + \parbox [t] { \dim_eval:n { \textwidth - \l_@@_tmpa_dim } } + { + \clist_use:Nn #2 {#3} \par + \cs_gset:Npx \@@_keywords_prevdepth: { \dim_use:N \tex_prevdepth:D } + } + } +\cs_new_protected:Npn \@@_clc:nn #1#2 + { + \par \tex_prevdepth:D \@@_keywords_prevdepth: \noindent + \group_begin: #1 \group_end: + #2 } -\cs_new:Npn \@@_clc_par: - { \par \noindent } % \end{macrocode} % \end{macro} % @@ -5296,28 +5305,12 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{environment} % % \begin{macro}{\@@_notation_begin:} -% 与摘要类似,符号表页需要修改页眉,并添加到目录。 +% 符号表页标题。 % \begin{macrocode} \cs_new_protected:Npn \@@_notation_begin: { -%<*class> - \chapter* { \c_@@_name_notation_tl } - \fdu_front_matter_header:n { \c_@@_name_notation_tl } - \addcontentsline { toc } { chapter } - { - \@@_chapter_toc_format: - \c_@@_name_notation_tl - } -% -%<*class-en> - \chapter* { \c_@@_name_notation_en_tl } - \fdu_front_matter_header:n { \c_@@_name_notation_en_tl } - \addcontentsline { toc } { chapter } - { - \@@_chapter_toc_en_format: - \c_@@_name_notation_en_tl - } -% +% \@@_chapter:V \c_@@_name_notation_tl +% \@@_chapter:V \c_@@_name_notation_en_tl } % \end{macrocode} % \end{macro} @@ -5329,9 +5322,9 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \begin{macrocode} \cs_new_protected:Npn \@@_notation_long_table_setup: { -% \tl_set:Nn \arraystretch { 1.3 } - \dim_set_eq:NN \LTpre \c_zero_dim - \dim_set_eq:NN \LTpost \c_zero_dim +% \tl_set:Nn \arraystretch { 1.3 } + \dim_set_eq:NN \LTpre \c_zero_dim + \dim_set_eq:NN \LTpost \c_zero_dim } % \end{macrocode} % \end{macro} @@ -5368,14 +5361,13 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{variable} % % \changes{v0.6}{2017/10/28}{新增 \opt{style/bib-style} 选项。} -% \changes{v0.7}{2018/01/25}{新增 \opt{style/bib-backend}、 -% \opt{style/cite-style} 和 \opt{style/bib-resource} 选项。} +% \changes{v0.7}{2018/01/25}{新增 \opt{style/bib-backend}、\opt{style/cite-style} +% 和 \opt{style/bib-resource} 选项。} % % \begin{macrocode} \keys_define:nn { fdu / style } { % \end{macrocode} -% % \begin{macro}{style/bib-backend} % 参考文献后端。 % \begin{macrocode} @@ -5387,7 +5379,6 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . { \bool_set_false:N \l_@@_bibtex_bool }, % \end{macrocode} % \end{macro} -% % \begin{macro}{style/bib-style} % 参考文献样式。 % \begin{macrocode} @@ -5407,7 +5398,6 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . { \tl_set_eq:NN \l_@@_bib_style_tl \l_keys_value_tl }, % \end{macrocode} % \end{macro} -% % \begin{macro}{style/cite-style} % 引用样式。 % \begin{macrocode} @@ -5419,7 +5409,6 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . }, % \end{macrocode} % \end{macro} -% % \begin{macro}{style/bib-resource} % 参考文献数据源。 % \begin{macrocode} @@ -5430,64 +5419,32 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \end{macrocode} % \end{macro} % -% 为了保证导言区中的设置能起作用,\pkg{natbib} 或 \pkg{biblatex} 宏包 -% 均需要在导言区末尾载入(仍在 \pkg{hyperref} 之前)。 +% 为了保证导言区中的设置能起作用,\pkg{natbib} 或 \pkg{biblatex} 宏包均需要在 +% 导言区末尾载入(仍在 \pkg{hyperref} 之前),并做相关设置。 % \begin{macrocode} \ctex_at_end_preamble:n { -% \end{macrocode} -% -% 调用 \pkg{natbib} 宏包并进行配置。 -% \begin{macrocode} \bool_if:NTF \l_@@_bibtex_bool { \RequirePackage [ sort & compress ] { natbib } \@@_bibtex_setup: -% \end{macrocode} -% -% \changes{v0.7}{2018/01/25}{统一使用 \cs{printbibliography} 命令 -% 生成参考文献列表。} -% -% \begin{macro}{\printbibliography} -% \BibTeX{} 下接口与 \pkg{biblatex} 统一。 -% \begin{macrocode} - \NewDocumentCommand \printbibliography { o } - { - \exp_args:NV \bibliography \l_@@_bib_resource_tl - \IfValueT {#1} - { \@@_warning:nn { invalid-option-in-bibtex } {#1} } - } } -% \end{macrocode} -% \end{macro} -% -% 调用 \pkg{biblatex} 宏包,并载入参考文献数据库。 -% \cs{@@_biblatex_setup:} 依靠传入宏包选项,因此要放在 -% \tn{RequirePackage} 之前。 -% \begin{macrocode} { - \@@_biblatex_setup: - \RequirePackage [ backend = biber, hyperref = manual, natbib ] - { biblatex } - \exp_args:NV \addbibresource \l_@@_bib_resource_tl - \@@_biblatex_allow_url_break: -% \end{macrocode} -% 英文模板需要重定义参考文献标题。 -% \begin{macrocode} -%<*class-en> - \exp_args:Nnx \DefineBibliographyStrings { english } - { bibliography = { \c_@@_name_bib_en_tl } } -% + \@@_biblatex_pre_setup: + \RequirePackage { biblatex } + \@@_biblatex_post_setup: } } -\@@_msg_new:nn { invalid-option-in-bibtex } - { Option(s)~ "#1"~ are~ invalid~ in~ BibTeX. } % \end{macrocode} % -% \begin{macro}{\@@_bibtex_setup:} -% \BibTeX{} 设置。 +% \changes{v0.7}{2018/01/25}{统一使用 \cs{printbibliography} 命令 +% 生成参考文献列表。} +% \changes{v0.7d}{2019/03/23}{使参考文献在目录中正常显示。} +% +% \begin{macro}{\@@_bibtex_setup:,\bibsection,\printbibliography} +% \BibTeX{} 相关设置。 % \begin{macrocode} -\cs_new:Npn \@@_bibtex_setup: +\cs_new_protected:Npn \@@_bibtex_setup: { \tl_if_empty:NTF \l_@@_bib_style_tl { @@ -5506,14 +5463,32 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . } } { \exp_args:NV \bibliographystyle \l_@@_bib_style_tl } +% \end{macrocode} +% 修改参考文献标题。 +% \begin{macrocode} + \cs_set:Npn \bibsection { \@@_chapter:V \bibname } +% \end{macrocode} +% \BibTeX{} 下接口与 \pkg{biblatex} 保持统一。 +% \begin{macrocode} + \NewDocumentCommand \printbibliography { o } + { + \exp_args:NV \bibliography \l_@@_bib_resource_tl + \IfValueT {##1} + { \@@_warning:nn { invalid-option-in-bibtex } {##1} } + } } +\@@_msg_new:nn { invalid-option-in-bibtex } + { Option(s)~ "#1"~ are~ invalid~ in~ BibTeX. } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_biblatex_setup:} -% \pkg{biblatex} 设置。 +% \begin{macro}{ +% \@@_biblatex_pre_setup:, +% \@@_biblatex_post_setup:, +% \@@_pass_options_to_biblatex:n} +% \pkg{biblatex} 相关设置。 % \begin{macrocode} -\cs_new:Npn \@@_biblatex_setup: +\cs_new_protected:Npn \@@_biblatex_pre_setup: { % \end{macrocode} % 参考文献样式。 @@ -5521,23 +5496,35 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . \tl_if_empty:NTF \l_@@_bib_style_tl { \tl_if_eq:VnTF \l_@@_bib_gb_style_tl { numerical } - { \PassOptionsToPackage { style = gb7714-2015 } } + { \@@_pass_options_to_biblatex:n { style = gb7714-2015 } } { \tl_if_eq:VnT \l_@@_bib_gb_style_tl { author-year } - { \PassOptionsToPackage { style = gb7714-2015ay } } + { \@@_pass_options_to_biblatex:n { style = gb7714-2015ay } } } } - { \PassOptionsToPackage { style = \l_@@_bib_style_tl } } - { biblatex } + { \@@_pass_options_to_biblatex:n { style = \l_@@_bib_style_tl } } % \end{macrocode} % 引用样式。 % \begin{macrocode} \tl_if_empty:NF \l_@@_cite_style_tl - { - \PassOptionsToPackage { citestyle = \l_@@_bib_style_tl } - { biblatex } - } + { \@@_pass_options_to_biblatex:n { citestyle = \l_@@_bib_style_tl } } + \@@_pass_options_to_biblatex:n { backend = biber, hyperref = manual, natbib } + } +\cs_new_protected:Npn \@@_biblatex_post_setup: + { + \exp_args:NV \addbibresource \l_@@_bib_resource_tl + \@@_biblatex_allow_url_break: +% \end{macrocode} +% 修改参考文献标题。 +% \begin{macrocode} + \defbibheading { bibliography } [ \bibname ] { \@@_chapter:n {##1} } +%<*class-en> + \exp_args:Nnx \DefineBibliographyStrings { english } + { bibliography = { \c_@@_name_bib_en_tl } } +% } +\cs_new_protected:Npn \@@_pass_options_to_biblatex:n #1 + { \PassOptionsToPackage {#1} { biblatex } } % \end{macrocode} % \end{macro} % @@ -5573,29 +5560,16 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . { \NAT@numbersfalse %<*class> - \cs_set_eq:NN \NAT@open \c_@@_fullwidth_left_paren_tl - \cs_set_eq:NN \NAT@close \c_@@_fullwidth_right_paren_tl - \cs_set_eq:NN \NAT@sep \c_@@_fullwidth_semicolon_tl - \cs_set_eq:NN \NAT@aysep \c_@@_fullwidth_comma_tl - \cs_set_eq:NN \NAT@yrsep \c_@@_ideographic_comma_tl + \cs_set_eq:NN \NAT@open \c_@@_fwid_left_paren_tl + \cs_set_eq:NN \NAT@close \c_@@_fwid_right_paren_tl + \cs_set_eq:NN \NAT@sep \c_@@_fwid_semicolon_tl + \cs_set_eq:NN \NAT@aysep \c_@@_fwid_comma_tl + \cs_set_eq:NN \NAT@yrsep \c_@@_ideo_comma_tl % } % \end{macrocode} % \end{macro} % -% \begin{macro}{\bibsection} -% 修改参考文献部分的页眉,并将其添加到目录。 -% \begin{macrocode} -\cs_set:Npn \bibsection - { - \chapter* { \bibname } - \fdu_front_matter_header:n { \bibname } - \addcontentsline { toc } { chapter } - { \@@_chapter_toc_format: \bibname } - } -% \end{macrocode} -% \end{macro} -% % \changes{v0.7}{2018/01/25}{同步 \pkg{gbt7714} v1.0,移除有关超链接 % 的额外设置。} % @@ -5889,14 +5863,14 @@ Copyright (C) 2017–2019 by Xiangdong Zeng . % \begin{macrocode} \clist_map_inline:nn { - { ideographic_comma } { "3001 }, - { ideographic_full_stop } { "3002 }, - { fullwidth_comma } { "FF0C }, - { fullwidth_full_stop } { "FF0E }, - { fullwidth_colon } { "FF1A }, - { fullwidth_semicolon } { "FF1B }, - { fullwidth_left_paren } { "FF08 }, - { fullwidth_right_paren } { "FF09 } + { ideo_comma } { "3001 }, + { ideo_full_stop } { "3002 }, + { fwid_comma } { "FF0C }, + { fwid_full_stop } { "FF0E }, + { fwid_colon } { "FF1A }, + { fwid_semicolon } { "FF1B }, + { fwid_left_paren } { "FF08 }, + { fwid_right_paren } { "FF09 } } { \@@_define_punct:nn #1 } % \end{macrocode} -- cgit v1.2.3