From d811ebd312fa93d2ceef5345a32ee9ccf270aa99 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 8 Oct 2021 03:01:38 +0000 Subject: CTAN sync 202110080301 --- macros/latex/contrib/buctthesis/doc/ChangeLog.md | 15 +- macros/latex/contrib/buctthesis/doc/buctthesis.pdf | Bin 433065 -> 448464 bytes .../latex/contrib/buctthesis/doc/chapter/app1.tex | 2 +- .../contrib/buctthesis/doc/chapter/resume.tex | 22 --- .../contrib/buctthesis/doc/cover/buctcover.tex | 2 +- macros/latex/contrib/buctthesis/doc/main.tex | 13 +- macros/latex/contrib/buctthesis/doc/mycfg.sty | 2 +- macros/latex/contrib/buctthesis/doc/thesisbib.bib | 2 +- .../latex/contrib/buctthesis/source/buctthesis.dtx | 184 ++++++++++++++------- .../latex/contrib/buctthesis/source/buctthesis.ins | 6 +- macros/luatex/generic/luaxml/README | 2 +- macros/luatex/generic/luaxml/luaxml-cssquery.lua | 22 ++- macros/luatex/generic/luaxml/luaxml-transform.lua | 9 +- macros/luatex/generic/luaxml/luaxml.pdf | Bin 118178 -> 118191 bytes macros/luatex/generic/luaxml/luaxml.tex | 2 +- macros/xetex/latex/hanzibox/README.md | 3 +- macros/xetex/latex/hanzibox/hanzibox.dtx | 158 ++++++++++++++---- macros/xetex/latex/hanzibox/hanzibox.pdf | Bin 494235 -> 505041 bytes 18 files changed, 306 insertions(+), 138 deletions(-) delete mode 100644 macros/latex/contrib/buctthesis/doc/chapter/resume.tex (limited to 'macros') diff --git a/macros/latex/contrib/buctthesis/doc/ChangeLog.md b/macros/latex/contrib/buctthesis/doc/ChangeLog.md index 14bbbe196d..32ad1ee556 100644 --- a/macros/latex/contrib/buctthesis/doc/ChangeLog.md +++ b/macros/latex/contrib/buctthesis/doc/ChangeLog.md @@ -1,13 +1,24 @@ # Changelog of BUCTthesis 在这里记录 BUCTthesis 中较为重要的改动。 -## v1.1 - 2021/03/21. +## v1.2 - 2021/09/10 ### Added -- 增加论文封面,仅支持硕博 +- 增加 `fontset` 选项,从而可在非 Windows 系统下选择**中文**字库。 + +### Fixed + +- 封面的下划线现在支持动态调整,具体长度与标题首行相等 +- 英文摘要中的论文标题现在能正确换行了,且调整了垂直间距 +## v1.1 - 2021/03/29 +**本版本提交至CTAN** + +### Added + +- 增加论文封面,仅支持硕博 ## v1.0 - 2021/02/18 diff --git a/macros/latex/contrib/buctthesis/doc/buctthesis.pdf b/macros/latex/contrib/buctthesis/doc/buctthesis.pdf index bcb0ad14f6..170b49620a 100644 Binary files a/macros/latex/contrib/buctthesis/doc/buctthesis.pdf and b/macros/latex/contrib/buctthesis/doc/buctthesis.pdf differ diff --git a/macros/latex/contrib/buctthesis/doc/chapter/app1.tex b/macros/latex/contrib/buctthesis/doc/chapter/app1.tex index 4280b9dd0b..0e755c62e9 100644 --- a/macros/latex/contrib/buctthesis/doc/chapter/app1.tex +++ b/macros/latex/contrib/buctthesis/doc/chapter/app1.tex @@ -37,7 +37,7 @@ \zhlipsum[name = xiangyu] \begin{dfigure}[tbp] - \centering\includegraphics[height=.9\textwidth ,angle=-90]{worm gear.pdf} + \centering\includegraphics[height=.9\textwidth ,angle=-90]{worm-gear.pdf} \caption{设计图纸测试} \end{dfigure} diff --git a/macros/latex/contrib/buctthesis/doc/chapter/resume.tex b/macros/latex/contrib/buctthesis/doc/chapter/resume.tex deleted file mode 100644 index f35b219c12..0000000000 --- a/macros/latex/contrib/buctthesis/doc/chapter/resume.tex +++ /dev/null @@ -1,22 +0,0 @@ -%% 成果与简介--resume.tex -\begin{achievements} - - \section*{发表及已接受的论文:} - - \begin{bibenumerate} - \item - \end{bibenumerate} - - \section*{成果及专利:} - \begin{bibenumerate} - \item - \end{bibenumerate} - -\end{achievements} - - -\begin{resume} - \section*{作者简介:} \zhlipsum[1] - - \section*{导师简介:} \zhlipsum[2] -\end{resume} \ No newline at end of file diff --git a/macros/latex/contrib/buctthesis/doc/cover/buctcover.tex b/macros/latex/contrib/buctthesis/doc/cover/buctcover.tex index 2c6ff3345b..dd8ef95e93 100644 --- a/macros/latex/contrib/buctthesis/doc/cover/buctcover.tex +++ b/macros/latex/contrib/buctthesis/doc/cover/buctcover.tex @@ -6,7 +6,7 @@ %%%%% 各选项之间不要留有空行,并以西文逗号“,”分隔 %%%%% % 学号,位于右上角 studentid = {2021010234}, - % 标题。封面的标题有两行,每一行控制在 13 个汉字长度以内 + % 标题。封面的标题有两行,每一行控制在 18 个汉字长度以内 titleA = {一二三四五六七八九十甲乙丙}, titleB = {丁戊己庚辛壬癸一二三四五六}, % 作者 diff --git a/macros/latex/contrib/buctthesis/doc/main.tex b/macros/latex/contrib/buctthesis/doc/main.tex index 2935af5d6d..18cd777ac9 100644 --- a/macros/latex/contrib/buctthesis/doc/main.tex +++ b/macros/latex/contrib/buctthesis/doc/main.tex @@ -4,6 +4,7 @@ type = bachelor, % bachelor | master | doctor %submit, %openany, % openany | openright(default) + fontset = windows, % fandol | windows (normal) ]{buctthesis} % 在这个文件里载入其他对写作有帮助的宏包,或自定义命令等 @@ -17,17 +18,17 @@ etitle = {HOW TO \TeX\ WITH BUCTthesis: AN EXAMPLE}, % 作者姓名 cauthor = {张三}, - % 班级,仅本科 + % 班级 class = {某某1024}, - % 学号,仅本科 + %学号 studentid = {2018020999}, - % 学院,仅本科 + % 学院 school = {材料科学与工程学院}, - % 专业名称,仅本科 + % 专业名称 major = {高分子材料与工程}, - % 导师的姓名与职称,仅本科 + % 导师的姓名与职称 supervisor = {李四教授}, - % 专业负责人姓名,仅本科 + % 专业负责人姓名 msupervisor = {王五}, % 中文、英文关键词,各关键词间以西文逗号“,”分隔 ckeywords = {论文,\LaTeX{},模板}, diff --git a/macros/latex/contrib/buctthesis/doc/mycfg.sty b/macros/latex/contrib/buctthesis/doc/mycfg.sty index 5c281f6d3f..eacb380ffb 100644 --- a/macros/latex/contrib/buctthesis/doc/mycfg.sty +++ b/macros/latex/contrib/buctthesis/doc/mycfg.sty @@ -16,7 +16,7 @@ \caption{#3}\label{#4} \end{figure} } -\newcommand{\version}{v1.1} +\newcommand{\version}{v1.2} \newcommand{\cs}[1]{\texttt{\textbackslash#1}} \newcommand{\file}{\textsf} \newcommand{\pkg}{\textsf} diff --git a/macros/latex/contrib/buctthesis/doc/thesisbib.bib b/macros/latex/contrib/buctthesis/doc/thesisbib.bib index e1e6bf30a4..91e8f780f5 100644 --- a/macros/latex/contrib/buctthesis/doc/thesisbib.bib +++ b/macros/latex/contrib/buctthesis/doc/thesisbib.bib @@ -22,7 +22,7 @@ publisher = {ACS Publications} } @software{buctthesis, - title = {{BUCTthesis: A LaTeX writting template for BUCT undergraduate thesis}}, + title = {{BUCTthesis: A LaTeX writting template for BUCT thesis}}, author = {{Miracle0565}}, year = {2020}, urldate = {2020-04-08}, diff --git a/macros/latex/contrib/buctthesis/source/buctthesis.dtx b/macros/latex/contrib/buctthesis/source/buctthesis.dtx index 6ed3c2fa66..ce1f4b1f46 100644 --- a/macros/latex/contrib/buctthesis/source/buctthesis.dtx +++ b/macros/latex/contrib/buctthesis/source/buctthesis.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2019-2020 by Miracle0565 +% Copyright (C) 2019-2021 by Miracle0565 % % https://github.com/Miracle0565/BUCTthesis % ------------------------------------------------------- @@ -20,7 +20,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \iffalse %<*driver> -\ProvidesFile{buctthesis.dtx}[2020/03/23 v1.1 BUCT Thesis Template] +\ProvidesFile{buctthesis.dtx}[2021/09/10 v1.2 BUCT Thesis Template] \documentclass{ltxdoc} \usepackage{manual} \begin{document} @@ -186,7 +186,7 @@ % sOmetHInG GoEs wRoNg. % \end{document} % \end{latex} -% \item 如果有必要的话可以将 \file{.log} 文件通过 \url{https://paste.ubuntu.com} 一并提交。 +% \item 如果有必要的话可以将 \file{.log} 文件通过 \href{https://pastebin.com/}{Pastebin} 一并提交。 % \end{enumerate} % % \section{使用说明}\label{sec:usage} @@ -197,9 +197,10 @@ % 主文件 \file{main.tex} 以 % \begin{latex} % \documentclass[ -% type = doctor, % bachelor | master | doctor +% type = doctor, % bachelor | master | doctor +% fontset = windows, % fandol | windows | ... % submit, -% openany, % openany | openright(default) +% openany, % openany | openright(default) % ]{buctthesis} % \end{latex} % 命令载入文档类,从而控制全文格式。 @@ -217,8 +218,29 @@ % \documentclass[type = bachelor,]{buctthesis} % \end{latex} % +% \DescribeOpt{fontset = } +% 该选项会传递至 \pkg{ctex} 宏集,从而指定全文的字体。模板的设置如表~\ref{tab:fontset}~所示。 +% +% 其中选项 \opt{fandol} 或使用 \opt{\meta{others}} 选项 \footnote{参见\pkg{ctex}宏集第 4.3 小节。}是为了一些不方便安装字体的系统或平台(如 Overleaf)所采取的\emph{临时解决方案}。 +% 这些字体与中易系列字体有少许差别,且偶尔有缺字现象。 +% 因此,强烈建议在最后提交论文前,在合适的环境下使用 \opt{fontset = windows} 进行编译。 +% +% \begin{table}[ht] +% \centering +% \caption{模板的字体配置}\label{tab:fontset} +% \begin{tabular}{llll} +% \toprule +% \opt{fontset =} & \opt{windows} & \opt{fandol} & \opt{\meta{others}}\\ +% \midrule +% 中文 & 中易字库 (宋、黑开启伪粗体) & Fandol 字库 & / \\ +% 西文 & Times New Roman & Times New Roman & Times New Roman \\ +% \bottomrule +% \end{tabular} +% \end{table} +% % \DescribeOpt{submit} -% 是否为提交版本。如果启用则会将文章超链接和代码块的颜色全部设置为黑色,适合论文最终提交与付梓。 +% 是否为提交版本。如果启用则会将文章超链接和代码块的文字颜色全部设置为黑色,适合论文最终提交与付梓。 +% 需要提醒的是,它不能转换插图的颜色。 % % \DescribeOpt{openright} % \DescribeOpt{openany} @@ -584,13 +606,15 @@ % % 与本科模板不同的是,BUCTthesis 的硕博模板在 \file{cover} 文件夹中仿制了学校的封面。 % 在该文件夹中的三个文件都与封面有关,编译时请确保它们位于同一路径之下。 +% +% \emph{注意:这里的“仿制”仅是实现封面的效果,学校印制的封面需要手写内容,故不能替代学校统一印制的封面。} % \begin{enumerate} % \item \file{cover.tex}:源文档。与 \cs{buctsetup} 类似,这里使用\cs{coversetup} 定义论文信息。 % \begin{latex} % \coversetup{ % % 学号,位于封面的右上角 % studentid = {2021010234}, -% % 标题。封面的标题有两行,每一行控制在 13 个汉字长度以内 +% % 标题。封面的标题有两行,每一行控制在 18 个汉字长度以内 % titleA = {甲乙丙丁戊己庚辛壬癸一二三}, % titleB = {四五六七八九十甲乙丙丁戊己}, % % 作者 @@ -620,9 +644,9 @@ % % 所使用的字体清单: % \begin{enumerate} -% \item SimSun,宋体(特指中易宋体) -% \item SimHei,黑体(特指中易黑体) -% \item KaiTi,楷体(特指中易楷体) +% \item SimSun,中易宋体 +% \item SimHei,中易黑体 +% \item KaiTi,中易楷体 % \item STXingkai,华文行楷 % \item FZDaBiaoSong-B06S,方正大标宋简体 % \item FZXiaoBiaoSong-B05S,方正小标宋简体 @@ -638,7 +662,7 @@ % \begin{macrocode} %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<*class> -\ProvidesClass{buctthesis}[2020/03/20 v1.1 BUCT Thesis Template] +\ProvidesClass{buctthesis}[2021/09/10 v1.2 BUCT Thesis Template] % \end{macrocode} % % 装载 \pkg{ifxetex} 宏包,并通过 \cs{RequireXeTeX} 命令检查编译命令。 @@ -868,17 +892,37 @@ % \end{macrocode} % % \subsection{字体配置} -% 以下仅对 Windows 系统下做了适配。 +% \begin{macro}{\buct@fontsetval} +% 首先来设置中文的字体。在 \pkg{ctex} 宏集中的 \cs{g\_\_ctex\_fontset\_tl} 存储着选项 \opt{fontset} 的值。 +% 模板尽可能避免使用 \LaTeX 3 语法,所以先用一个 \cs{buct@fontsetval} 来保存它。 +% \begin{macrocode} +\newcommand\buct@fontsetval{\csname g__ctex_fontset_tl\endcsname} +% \end{macrocode} +% \end{macro} +% +% 根据\cs{buct@fontsetval} 的值,分别设置不同的字体。 % -% 开启“伪粗体”和“伪斜体”,并设置的相关系数。 % \begin{macrocode} -\xeCJKsetup{EmboldenFactor=2.2,SlantFactor=0.2} -\setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant] -\setCJKsansfont{SimHei}[AutoFakeBold] +\ifthenelse{\equal{\buct@fontsetval}{windows}}{ +% \end{macrocode} +% +% 在 Windows 系统下,需要对中易宋体、中易黑体开启“伪粗”和“伪斜”,并设置相关系数。 +% \begin{macrocode} + \xeCJKsetup{EmboldenFactor=2.2,SlantFactor=0.2} + \setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant] + \setCJKsansfont{SimHei}[AutoFakeBold] +} +% \end{macrocode} +% 而在非Windows 系统下,则由 \pkg{ctex} 宏集自动检测环境并保留其默认设置, +% 同时警告所使用的字体与《规范》(即默认设置)存在不同。 +% \begin{macrocode} +{ + \ClassWarning{buctthesis}{The fonts differ to the default.} +} % \end{macrocode} % % \begin{macro}{\bfsong} -% 设置“伪粗体”后,使用 \cs{bfseries}将产生加粗的宋体, +% 因设置中易宋体开启“伪粗体”,使用 \cs{bfseries}将产生加粗的效果, % 这与一般的 \LaTeX\ 常识是相悖的。 % 因此模板提供了更明确的命令 \cs{bfsong}。 % \begin{macrocode} @@ -887,7 +931,7 @@ % \end{macro} % \begin{macro}{\bfhei} % -% 对于黑体同理。此外要注意模板将预设的无衬线字体(微软雅黑)改为了黑体。 +% 对于黑体同理。此外要注意模板将Windows下预设的无衬线字体(微软雅黑)改为了黑体。 % \begin{macrocode} \newcommand{\bfhei}{\sffamily\bfseries} % \end{macrocode} @@ -914,6 +958,11 @@ }{} % \end{macrocode} % +% +% 指定 Unicode 中带圈数字 \symbol{"2460}--\symbol{"2469} 使用中文字体。 +% \begin{macrocode} +\xeCJKDeclareCharClass{CJK}{"2460->"2469} +% \end{macrocode} % 页眉与页脚的字体。 % \begin{macrocode} \newcommand{\buct@headfont}{\zihao{-5}\songti} @@ -939,7 +988,7 @@ % \begin{macrocode} \ifbuct@bachelor \newcommand{\buct@abs@titfont}{\zihao{3}\bfsong} - \newcommand{\buct@abs@infofont}{\zihao{5}\songti} + \newcommand{\buct@abs@infofont}{\zihao{5}\mdseries} \newcommand{\buct@abs@absfont}{\zihao{4}\songti} \newcommand{\buct@keywordsfont}{\zihao{4}\heiti\CJKfamily+{}} \newcommand{\buct@abs@titfonten}{\zihao{3}\bfseries} @@ -1311,22 +1360,27 @@ \newenvironment{cabstract}{% \cleardoublepage \buct@pdfmark{\buct@cabstract@title}{cabstract} - \centerline{\buct@abs@titfont\buct@ctitle}\vspace{22pt}% - \centerline{% + \begin{center} + \buct@abs@titfont\buct@ctitle + \vskip22pt \buct@abs@infofont\buct@cauthor\quad% \buct@class\quad\buct@studentid\quad% \buct@supervisor@title\buct@supervisor% - }\vspace{22pt}% - \centerline{\buct@abs@absfont\buct@cabstract@title}\vspace{22pt}% - }{\par\vspace{1em}\noindent\buct@keywordsfont\buct@ckeywords@title\buct@ckeywords} + \vskip22pt + \buct@abs@absfont\buct@cabstract@title + \end{center}\par\vspace{18pt} + }{\vskip1em\noindent\buct@keywordsfont\buct@ckeywords@title\buct@ckeywords} \else \newenvironment{cabstract}{% \cleardoublepage \buct@pdfmark{\buct@cabstract@title}{cabstract}\markboth{\buct@cabstract@title}{} - \centerline{\buct@abs@titfont\buct@ctitle}\vspace{24pt}% - \centerline{\buct@abs@absfont\buct@cabstract@title}\vspace{24pt}% + \begin{center} + \buct@abs@titfont\buct@ctitle + \vskip24pt + \buct@abs@absfont\buct@cabstract@title + \end{center}\par\vspace{12pt} \buct@abs@textfont - }{\par\vspace{24pt}% + }{\vskip24pt% \noindent\buct@keywords@titfont\buct@ckeywords@title\buct@keywords@font\buct@ckeywords} \fi % \end{macrocode} @@ -1339,21 +1393,24 @@ \newenvironment{eabstract}{% \cleardoublepage% \buct@pdfmark{\buct@eabstract@title}{abstracten} - \centerline{\buct@abs@titfonten{\buct@etitle}}\vspace{22pt}% - \centerline{\buct@abs@absfonten\buct@eabstract@title}\vspace{22pt}% - }{\par\vspace{1em}\noindent\buct@keywordsfonten \buct@ekeywords@title\buct@ekeywords} + \begin{center} + \buct@abs@titfonten\buct@etitle\vskip22pt + \buct@abs@absfonten\buct@eabstract@title + \end{center} + \par\vspace{22pt} + }{\vskip1em\noindent\buct@keywordsfonten \buct@ekeywords@title\buct@ekeywords} \else \newenvironment{eabstract}{% \cleardoublepage% - \buct@pdfmark{\buct@eabstract@title}{eabstract}\markboth{\buct@eabstract@title}{} - { - \setlength{\leftskip}{3em plus 1em minus .5em} - \setlength{\rightskip}{3em plus 1em minus .5em} - \centerline{\buct@abs@titfonten\buct@etitle}\vspace{72pt} - \centerline{\buct@abs@absfonten\buct@eabstract@title}\vspace{48pt} - } + \buct@pdfmark{\buct@eabstract@title}{eabstract}\markboth{\buct@eabstract@title}{} + \begin{center} + \setlength{\leftskip}{3em plus 1em minus .5em} + \setlength{\rightskip}{3em plus 1em minus .5em} + \buct@abs@titfonten\buct@etitle\vskip76pt + \buct@abs@absfonten\buct@eabstract@title + \end{center}\par\vspace{40pt} \buct@abs@textfont - }{\par\vspace{48pt}% + }{\vskip48pt% \noindent\buct@keywords@titfonten\buct@ekeywords@title\buct@keywords@fonten\buct@ekeywords} \fi % \end{macrocode} @@ -1523,7 +1580,7 @@ \newcommand{\buct@listof}[2]{% \xpatchcmd{\@dottedtocline}{\hbox{.}}{\hbox{$\cdot$}}{}{} \renewcommand{\@dotsep}{1.7}% - \@ifundefined{ext@#1}{\float@error{#1}}{% + \@ifundefined{ext@#1}{\float@error{#1}}{% \@namedef{l@#1}{\@dottedtocline{1}{0em}{2em}} \float@listhead{\buct@toc@tocfont{}#2}% \begingroup\setlength{\parskip}{\z@}% @@ -1776,8 +1833,8 @@ % 在“符号说明表”中我们嵌套了 \env{longtable} 环境,但其中的字号仍应为小四号。 % 因此这里需要保留原先的定义。 % \begin{macrocode} - \let\oldlongtable=\longtable - \let\endoldlongtable=\endlongtable + \let\oldlongtable\longtable + \let\endoldlongtable\endlongtable \ifbuct@bachelor\relax\else \def\longtable{\zihao{5}\oldlongtable} \AtEndEnvironment{longtable}{\normalsize} @@ -2045,7 +2102,7 @@ % 由于学校会统一印制封面,这里仅提供\emph{硕博论文封面}的一个参考实现。 % \begin{macrocode} %<*cover> -\ProvidesClass{buctcover}[2020/03/20 Cover Maker for BUCTthesis] +\ProvidesClass{buctcover}[2021/04/24 Cover Maker for BUCTthesis] \RequirePackage{ifxetex} \RequireXeTeX \RequirePackage{kvoptions} @@ -2101,9 +2158,9 @@ ]{geometry} % \end{macrocode} % -% 载入表格与插图的宏包。 +% 载入表格、插图、计算尺寸的宏包。 % \begin{macrocode} -\RequirePackage{array,graphicx,hyperref} +\RequirePackage{array,graphicx,calc,hyperref} % \end{macrocode} % % 清空页眉页脚。 @@ -2118,9 +2175,10 @@ \xeCJKsetup{EmboldenFactor=2.3} % \end{macrocode} % -% 各种字体的声明与设置。分别是:中易黑体、华文行楷、中易楷体、方正小标宋和方正大标宋。 +% 各种字体的声明与设置。分别是:中易宋体、中易黑体、华文行楷、中易楷体、方正小标宋和方正大标宋。 % 后二者需前往方正字库网站下载。 % \begin{macrocode} +\setCJKmainfont{SimSun}[AutoFakeBold] \setCJKsansfont{SimHei}[AutoFakeBold] \newCJKfontfamily[xingkai]\xingkai{STXingkai} \newCJKfontfamily[zhkai] \zhkai {KaiTi} [AutoFakeBold] @@ -2133,6 +2191,13 @@ % \usepackage[unit=cm,type=upperleft,hshift=0cm,vshift=0cm]{fgruler} % \end{macrocode} % +% 定义下划线命令,这里利用了 \pkg{calc} 宏包的 \cs{widthof} 命令, +% 取 \cs{buct@titleA} (即首行标题)的长度,用以固定下划线的长度。 +% \begin{macrocode} +\newcommand\buct@title@ul[1]{% + \CJKunderline{\makebox[\widthof{\buct@titleA\enspace}][l]{#1}} +} +% \end{macrocode} % 日期格式处理,将输入的 \cs{buct@date} 拆分。 % \begin{macrocode} \newcommand\buct@format@date[1]{% @@ -2214,20 +2279,19 @@ \begin{tabular}{ >{\begin{CJKfilltwosides}[b]{4\ccwd}\sffamily\bfseries}r% <{\end{CJKfilltwosides}}% - @{}l% - @{}>{\zihao{3}\bfseries}l% + @{}>{\enspace\zihao{3}\bfseries}l% <{\vspace{.2em}}% } % \end{macrocode} % -% 题目需要手动断行,且长度宜控制在 \SI{26}{em} 以内。 +% 题目需要手动断行,且长度控制在 \SI{36}{em} 以内。 % 因表格本身的横线与文字间距较大,这里采用下划线的方式来划线。 % \begin{macrocode} - 题目 &: & \CJKunderline{\makebox[13em][l]{\buct@titleA}}\\ - &\phantom{:} & \CJKunderline{\makebox[13em][l]{\buct@titleB}}\\ - 专业 &: & \CJKunderline{\makebox[13em][l]{\buct@major}}\\ - 研究生 &: & \CJKunderline{\makebox[13em][l]{\buct@author}}\\ - 指导教师 &: & \CJKunderline{\makebox[13em][l]{\buct@supervisor}}\\ + 题目 & \buct@title@ul{\buct@titleA}\\ + &\buct@title@ul{\buct@titleB}\\ + 专业 & \buct@title@ul{\zihao{4}\buct@major}\\ + 研究生 & \buct@title@ul{\zihao{4}\buct@author}\\ + 指导教师 & \buct@title@ul{\zihao{4}\buct@supervisor}\\ \end{tabular} \end{center} % \end{macrocode} @@ -2264,7 +2328,7 @@ % \iffalse % \begin{macrocode} %<*manual> -\ProvidesPackage{manual}[2020/01/23 document style for BUCTthesis] +\ProvidesPackage{manual}[2021/09/25 document style for BUCTthesis] \RequirePackage{hypdoc} \PassOptionsToPackage{AutoFakeSlant}{xeCJK} \RequirePackage[UTF8, heading, fontset = none, linespread = 1.2,]{ctex} @@ -2295,10 +2359,14 @@ name = {第,节}, }, } +\xeCJKDeclareCharClass{CJK}{"2460->"2469} \setcounter{secnumdepth}{4} \setcounter{tocdepth}{3} -\setmainfont{Libertinus Serif} -\setmathfont{LibertinusMath-Regular.otf} +\setmainfont{TeX Gyre Pagella} +\setmonofont[ + HyphenChar = None , + UprightFont=* Light, BoldFont=* Bold, + SlantedFont=* Light Oblique]{CMU Typewriter Text} \captionsetup{strut=off, labelsep=quad, labelfont+=bf} \lstdefinestyle{base}{ aboveskip = 0 pt, @@ -2336,6 +2404,8 @@ } \lstnewenvironment{latex}{\lstset{style=latex}}{} \lstnewenvironment{shell}{\lstset{style=shell}}{} +\let\oldCodelineNo\theCodelineNo +\def\theCodelineNo{\textcolor{gray}{\oldCodelineNo}} \setlist{ leftmargin = 0em, nosep @@ -2393,7 +2463,7 @@ \ctexset{section/numbering=false}% } \hypersetup{ - pdftitle = {BUCTthesis: 北京化工大学学位论文模板}, + pdftitle = {BUCTthesis:北京化工大学学位论文模板}, pdfauthor = {Miracle0565}, } \CodelineIndex diff --git a/macros/latex/contrib/buctthesis/source/buctthesis.ins b/macros/latex/contrib/buctthesis/source/buctthesis.ins index d2374560ac..ada3e84b4a 100644 --- a/macros/latex/contrib/buctthesis/source/buctthesis.ins +++ b/macros/latex/contrib/buctthesis/source/buctthesis.ins @@ -46,7 +46,11 @@ of LaTeX version 1999/12/01 or later. \usedir{tex/latex/buctthesis} \file{buctthesis.cls}{\from{\jobname.dtx}{class} } \file{manual.sty} {\from{\jobname.dtx}{manual}} - \file{buctcover.cls} {\from{\jobname.dtx}{cover}} +} + +\generate{ + \usedir{tex/latex/buctthesis/cover} + \file{buctcover.cls}{\from{\jobname.dtx}{cover}} } \obeyspaces diff --git a/macros/luatex/generic/luaxml/README b/macros/luatex/generic/luaxml/README index bea8ba60fc..38ba699686 100644 --- a/macros/luatex/generic/luaxml/README +++ b/macros/luatex/generic/luaxml/README @@ -28,7 +28,7 @@ Author ------ Michal Hoftich Email: michal.h21@gmail.com -Version: v0.1p, 2021-09-10 +Version: v0.1q, 2021-10-06 Original authors: Paul Chakravarti and Manoel Campos (http://manoelcampos.com) diff --git a/macros/luatex/generic/luaxml/luaxml-cssquery.lua b/macros/luatex/generic/luaxml/luaxml-cssquery.lua index 062d66d745..14d1b66fdb 100644 --- a/macros/luatex/generic/luaxml/luaxml-cssquery.lua +++ b/macros/luatex/generic/luaxml/luaxml-cssquery.lua @@ -41,11 +41,15 @@ local function cssquery() local query = query or {} local specificity = 0 for _, item in ipairs(query.query or {}) do - for key, value in pairs(item) do + for _, t in ipairs(item) do + local key = t.key + -- for key, value in pairs(item) do if key == "id" then specificity = specificity + 100 elseif key == "tag" then specificity = specificity + 1 + elseif key == "any" then + -- * has 0 specificity else specificity = specificity + 10 end @@ -215,7 +219,7 @@ local function cssquery() -- ignore combinators in this function else if type(value) == "table" then value = table.concat(value, ":") end - print("unsupported feature", key, value) + self:debug_print("unsupported feature", key, value) return false end -- TODO: Add more cases @@ -226,7 +230,9 @@ local function cssquery() local function test_object(query, el) -- test one object in CSS selector local matched = {} - for key, value in pairs(query) do + -- for key, value in pairs(query) do + for _, part in ipairs(query) do + local key, value = part.key, part.value local test = test_part(key, value, el) if test~= true then return false end matched[#matched+1] = test @@ -252,9 +258,10 @@ local function cssquery() local selector = query[#query] -- get the last item in selector query if not selector then return nil end -- detect if this selector is a combinator" - if selector and selector.combinator then + -- combinator object must have only one part, so we can assume that it is in the first part + if selector and selector[1].key == "combinator" then -- save the combinator and select next selector from the query - combinator = selector.combinator + combinator = selector[1].value table.remove(query) -- remove combinator from query end return combinator @@ -271,7 +278,7 @@ local function cssquery() local function match_query(query, el) local function match_parent(query, el) - -- loop over the whole elemnt three and try to mach the css selector + -- loop over the whole element tree and try to mach the css selector if el and el:is_element() then local query = query or {} local object = query[#query] @@ -354,6 +361,7 @@ local function cssquery() for _, part in ipairs(item) do local t = {} for _, atom in ipairs(part) do + local key = atom[1] local value if not atom[3] then @@ -370,7 +378,7 @@ local function cssquery() -- to match namespace:element value=value:gsub("|", ":") end - t[key] = value + t[#t+1] = {key=key, value=value} end query[#query + 1] = t end diff --git a/macros/luatex/generic/luaxml/luaxml-transform.lua b/macros/luatex/generic/luaxml/luaxml-transform.lua index 9ea4595ea7..d7631ac78e 100644 --- a/macros/luatex/generic/luaxml/luaxml-transform.lua +++ b/macros/luatex/generic/luaxml/luaxml-transform.lua @@ -30,6 +30,13 @@ local function match_css(element,csspar) local selectors = css:match_querylist(element) if #selectors == 0 then return nil end -- return function with the highest specificity + local last_specificity = selectors[1].specificity + -- if multiple selectors have the same specificity, return the last one + for i, x in ipairs(selectors) do + if x.specificity < last_specificity then + return selectors[i-1].func + end + end return selectors[1].func end @@ -135,7 +142,7 @@ local function simple_content(s,parameters) elseif name:match("^[0-9]+$") then local child = get_child_element(element, tonumber(name)) if child then - return process_children(child, parameters) + return process_tree(child) end -- @ returns contents of matched selectors else diff --git a/macros/luatex/generic/luaxml/luaxml.pdf b/macros/luatex/generic/luaxml/luaxml.pdf index 89f9c3d1ed..4f00cb6f69 100644 Binary files a/macros/luatex/generic/luaxml/luaxml.pdf and b/macros/luatex/generic/luaxml/luaxml.pdf differ diff --git a/macros/luatex/generic/luaxml/luaxml.tex b/macros/luatex/generic/luaxml/luaxml.tex index 562a298cb0..28539d898c 100644 --- a/macros/luatex/generic/luaxml/luaxml.tex +++ b/macros/luatex/generic/luaxml/luaxml.tex @@ -7,7 +7,7 @@ \usepackage{framed} % Version is defined in the makefile, use default values when compiled directly \ifdefined\version\else -\def\version{v0.1p} +\def\version{v0.1q} \let\gitdate\date \fi \newcommand\modulename[1]{\subsection{#1}\label{sec:#1}} diff --git a/macros/xetex/latex/hanzibox/README.md b/macros/xetex/latex/hanzibox/README.md index 5f7e8d4ee0..0daf1efe0e 100644 --- a/macros/xetex/latex/hanzibox/README.md +++ b/macros/xetex/latex/hanzibox/README.md @@ -1,5 +1,5 @@ hanzibox -LaTeX3-based Chinese Character package +Boxed Chinese characters with Pinyin above and translation below based LaTeX3 ======= `hanzibox` is a LaTeX package developed in LaTeX3, which provides `\hanzibox` and `\hanzidialog` macros. These two macros are used for typesetting Chinese character with or without a background grid such as a cross grid or star grid for Chinese character writting learning. @@ -24,6 +24,7 @@ Contributing 1. Gitee repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3) 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls). +======= hanzibox 基于LaTeX3的汉字练习宏包 ======= diff --git a/macros/xetex/latex/hanzibox/hanzibox.dtx b/macros/xetex/latex/hanzibox/hanzibox.dtx index e3099aba20..c499c05c8d 100644 --- a/macros/xetex/latex/hanzibox/hanzibox.dtx +++ b/macros/xetex/latex/hanzibox/hanzibox.dtx @@ -5,7 +5,7 @@ % %<*readme> hanzibox -LaTeX3-based Chinese Character package +Boxed Chinese characters with Pinyin above and translation below based LaTeX3 ======= `hanzibox` is a LaTeX package developed in LaTeX3, which provides `\hanzibox` and `\hanzidialog` macros. These two macros are used for typesetting Chinese character with or without a background grid such as a cross grid or star grid for Chinese character writting learning. @@ -30,6 +30,7 @@ Contributing 1. Gitee repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3) 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls). +======= hanzibox 基于LaTeX3的汉字练习宏包 ======= @@ -153,7 +154,7 @@ Copyright and Licence % %\NeedsTeXFormat{LaTeX2e}[2020/10/01] %\RequirePackage{expl3} -%<+package>\GetIdInfo$Id: hanzibox.dtx 2.1.0 2021-09-30 08:00:00 +0800 Nan Geng $ +%<+package>\GetIdInfo$Id: hanzibox.dtx 2.1.1 2021-10-07 08:00:00 +0800 Nan Geng $ % {Boxed Chinese characters with Pinyin above and translation below.} %\ProvidesExplPackage{\ExplFileName} % {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -186,7 +187,7 @@ Copyright and Licence % \changes{v2.0.0}{2021/09/25}{基于l3draw重新设计} % \changes{v2.0.0}{2021/09/28}{重新编写README.md内容} % -% \CheckSum{1043} +% \CheckSum{1085} % \GetFileId{hanzibox.sty} % % \CharacterTable @@ -445,6 +446,23 @@ Copyright and Licence % 若要去掉 \opt{fillcolor},应将其置为空(\verb|fillcolor={}|),而不是将其设置为white(白色)。 % \end{function} % +% \begin{function}[added=2021-10-07,updated=2021-10-07]{crosscolorratio} +% \begin{syntax} +% crosscolorratio = \meta{integer} \init{20} +% \end{syntax} +% 格子内部十字线或米字线颜色占边框颜色的比例。 +% +% \textcolor[HTML]{AD1457}{注:\textsf{crosscolorratio}选项须在使用\textsf{framecolor}后起效}。 +% +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5] +% \centering +% \hanzibox[frametype=咪,framecolor=red]{十} +% \hanzibox[frametype=咪,crosscolorratio=30,framecolor=red]{田} +% \hanzibox[frametype=咪,crosscolorratio=50,framecolor=red]{米} +% \hanzibox[frametype=咪,crosscolorratio=80,framecolor=red]{咪} +% \end{SideBySideExample} +% \end{function} +% % \begin{function}[added=2021-09-24,updated=2021-09-24]{initial,vowel,tone} % \begin{syntax} % initial = <\TTF> \init{true} @@ -620,6 +638,8 @@ Copyright and Licence % \ExplSyntaxOff % \end{SideBySideExample} % +% \changes{v2.1.1}{2021/10/07}{在格子纸示例中用coffin实现每行格子以提升编译速度} +% % \subsection{生成汉字书写练习格子纸} % % 可以通过将\tn{hanzibox}命令的\Arg{汉字}参数留空, @@ -628,36 +648,46 @@ Copyright and Licence % 再根据需要通过循环的方式生成指定行数和列数的 % 汉字书写练习用格子纸。 % -% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5] +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5] % \hanziboxset{frametype=咪,framecolor=red, -% charcolor=red,charf=\huge} +% charcolor=red,charf=\huge} % \centering % \ExplSyntaxOn -% \int_step_inline:nn {8} +% \hcoffin_set:Nn \l_tmpa_coffin % { % \int_step_inline:nn {6} % { % \hanzibox{} -% \hspace*{-0.4pt} +% \hspace*{-0.35pt} % } -% \par\nointerlineskip\vspace*{-6.0pt} +% } +% \int_step_inline:nn {8} +% { +% \coffin_typeset:Nnnnn +% \l_tmpa_coffin { l } { b } { 0pt } { 0pt } +% \par\nointerlineskip\vspace*{-3.3pt} % } % \ExplSyntaxOff % \end{SideBySideExample} % -% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5] +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5] % \hanziboxset{frametype=咪,framecolor=red, % charcolor=red,charf=\huge,hanzi=false} % \centering % \ExplSyntaxOn -% \int_step_inline:nn {8} +% \hcoffin_set:Nn \l_tmpa_coffin % { % \int_step_inline:nn {6} % { % \hanzibox*{国} -% \hspace*{-0.4pt} +% \hspace*{-0.35pt} % } -% \par\nointerlineskip\vspace*{-6.0pt} +% } +% \int_step_inline:nn {8} +% { +% \coffin_typeset:Nnnnn +% \l_tmpa_coffin { l } { b } { 0pt } { 0pt } +% \par\nointerlineskip\vspace*{-6.30pt} % } % \ExplSyntaxOff % \end{SideBySideExample} @@ -694,7 +724,7 @@ Copyright and Licence % \hanzibox*{故人西辞黄鹤楼}[gu4ren2xi1ci2huang2he2lou2] % \hanzibox*{烟花三月下扬州}[yan1hua1san1yue4] % \hanzibox*{孤帆远影 }[gu1fan1yuan3ying3bi4kong1jin4] -% \hanzibox*{唯见长江天际流}[wei2jian4] +% \hanzibox*{}[wei2jian4chang2jiang1tian1ji4liu2] % \end{SideBySideExample} % % \end{documentation} @@ -755,6 +785,20 @@ Copyright and Licence % % \end{macrocode} % +% \changes{v2.1.1}{2021/10/03}{修订盒子高度计算函数的expl3版本兼容问题} +% +% 判断\tn{box_ht_plus_dp:N}函数是否存在,若不存在,则定义该函数。 +% 为了解决expl3的旧版本兼容问题。 +% 摘录于\url{https://ask.latexstudio.net/ask/question/3773.html}。 +% +% \begin{macrocode} +\cs_if_free:NT \box_ht_plus_dp:N + { + \cs_new_protected:Npn \box_ht_plus_dp:N #1 + { \tex_dimexpr:D \box_ht:N #1 + \box_dp:N #1 \scan_stop: } + } +% \end{macrocode} +% % 检查编译引擎 % % \begin{macrocode} @@ -855,6 +899,7 @@ Copyright and Licence % \l_@@_pinyin_format_tl, % \l_@@_character_format_tl, % \l_@@_translation_format_tl, +% \l_@@_cross_color_ratio_int, % \l_@@_pinyin_int, % \l_@@_character_int, % \l_@@_translation_int, @@ -904,6 +949,7 @@ Copyright and Licence \tl_new:N \l_@@_pinyin_format_tl \tl_new:N \l_@@_character_format_tl \tl_new:N \l_@@_translation_format_tl +\int_new:N \l_@@_cross_color_ratio_int \int_new:N \l_@@_pinyin_int \int_new:N \l_@@_character_int \int_new:N \l_@@_translation_int @@ -1041,14 +1087,18 @@ Copyright and Licence \draw_path_use_clear:n { stroke , fill } } } - +% \end{macrocode} +% +% \changes{v2.1.1}{2021/10/07}{用hanziboxcrosscolor设置内格子线颜色} +% +% \begin{macrocode} \@@_new_frame_construct:nn { 十 } { \tl_if_empty:NF \l_@@_dash_pattern_tl { \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt } } - \color_stroke:n { hanziboxframecolor!30 } + \color_stroke:n { hanziboxcrosscolor } \draw_path_moveto:n { (#3)/2, #2 } \draw_path_lineto:n { #3/2, #4 } \draw_path_moveto:n { #1, (#4)/2 } @@ -1062,7 +1112,7 @@ Copyright and Licence { \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt } } - \color_stroke:n { hanziboxframecolor!30 } + \color_stroke:n { hanziboxcrosscolor } \draw_path_moveto:n { #1, #2 } \draw_path_lineto:n { #3, #4 } \draw_path_moveto:n { #1, #4 } @@ -1265,10 +1315,12 @@ Copyright and Licence { \color_set:nn {#1} {#2} } +\cs_generate_variant:Nn \@@_color_select:nn {nx} \cs_set_nopar:Npn \@@_color_select:nnn #1#2#3 { \color_set:nnn {#1} {#2} {#3} } +\cs_generate_variant:Nn \@@_color_select:nnn {nnx} % \end{macrocode} % \end{macro} % @@ -1411,12 +1463,28 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \changes{v2.1.1}{2021/10/07}{添加格子内部十字和米字线颜色与边框颜色比例选项corsscolorratio} +% +% \begin{macro}{crosscolorratio} +% 边框颜色 +% \begin{macrocode} + crosscolorratio .int_set:N = \l_@@_cross_color_ratio_int, + crosscolorratio .initial:n = 20, +% \end{macrocode} +% \end{macro} +% +% \changes{v2.1.1}{2021/10/07}{为格子内部十字和米字线定义hanziboxcrosscolor颜色} +% % \begin{macro}{framecolor} % 边框颜色 % \begin{macrocode} - framecolor .code:n = { \@@_color_select:nn { hanziboxframecolor } {#1} } , + framecolor .code:n = { \tl_set:Nx \l_tmpa_tl { #1 ! \int_use:N \l_@@_cross_color_ratio_int } + \@@_color_select:nn { hanziboxframecolor } {#1} + \@@_color_select:nx{ hanziboxcrosscolor } { \l_tmpa_tl } } , framecolor .initial:n = black , - framecolor* .code:n = { \@@_color_select:nnn { hanziboxframecolor } #1 } , + framecolor* .code:n = { \tl_set:Nx \l_tmpa_tl { #1 ! \int_use:N \l_@@_cross_color_ratio_int } + \@@_color_select:nnn { hanziboxframecolor } #1 + \@@_color_select:nnx { hanziboxcrosscolor } \l_tmpa_tl } , % \end{macrocode} % \end{macro} % @@ -1576,6 +1644,8 @@ Copyright and Licence tranf = \tiny , frametype = none , resize = none , + crosscolorratio = 20, + framecolor = black, } % \end{macrocode} @@ -1856,39 +1926,57 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \changes{v2.1.1}{2021/10/02}{修复无汉字手动拼音无法正确处理的问题} +% % \begin{macro}{\@@_null_str_coffin_construct:} % 构造空白汉字(0个汉字)带拼音字符串盒子。 % \begin{macrocode} \cs_new:Npn \@@_null_str_coffin_construct: { - \hcoffin_set:Nn \l_@@_str_box_coffin + \bool_if:NTF \l_@@_autopinyin_bool { - \bool_set_false:N \l_@@_withhanzi_bool - - \hcoffin_set:Nn \l_tmpa_coffin + \hcoffin_set:Nn \l_@@_str_box_coffin { + \bool_set_false:N \l_@@_withhanzi_bool \@@_single_handle:N \c_@@_basechar_tl + \allowbreak } - - \bool_if:NT \l_@@_withpinyin_bool + } + { + \hcoffin_set:Nn \l_@@_str_box_coffin { - \hcoffin_set:Nn \l_@@_pinyin_box_coffin + \bool_if:NTF \l_@@_withpinyin_bool { - \color_select:n { hanziboxcharcolor } - \tl_use:N \l_@@_pinyin_format_tl \@@_get_tone_pinyin:V \l_@@_pinyin_tl \clist_clear:N \l_@@_tone_pinyin_clist \clist_set:NV \l_@@_tone_pinyin_clist \l_@@_tone_pinyin_tl - \clist_use:Nn \l_@@_tone_pinyin_clist {} - % \@@_get_tone_pinyin:V \l_@@_pinyin_tl - % \l_@@_tone_pinyin_tl + \int_set:Nn \l_tmpa_int {\clist_count:N \l_@@_tone_pinyin_clist} + + \int_step_inline:nn { \l_tmpa_int } + { + \bool_set_false:N \l_@@_withhanzi_bool + + \hcoffin_set:Nn \l_tmpa_coffin + { + \@@_single_handle:N \c_@@_basechar_tl + } + + \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl + \@@_single_pinyin:V \l_tmpb_tl + + \coffin_join:NnnNnnnn \l_tmpa_coffin + { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt } + \coffin_typeset:Nnnnn \l_tmpa_coffin + { l } { b } { 0pt } { 0pt } + \allowbreak + } + } + { + \bool_set_false:N \l_@@_withhanzi_bool + \@@_single_handle:N \c_@@_basechar_tl + \allowbreak } - \coffin_join:NnnNnnnn \l_tmpa_coffin - { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt } } - \coffin_typeset:Nnnnn \l_tmpa_coffin - { l } { b } { 0pt } { 0pt } - \allowbreak } } % \end{macrocode} diff --git a/macros/xetex/latex/hanzibox/hanzibox.pdf b/macros/xetex/latex/hanzibox/hanzibox.pdf index ce083be4f2..de80686c06 100644 Binary files a/macros/xetex/latex/hanzibox/hanzibox.pdf and b/macros/xetex/latex/hanzibox/hanzibox.pdf differ -- cgit v1.2.3