summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/adjmulticol/README4
-rw-r--r--macros/latex/contrib/adjmulticol/adjmulticol.dtx38
-rw-r--r--macros/latex/contrib/adjmulticol/adjmulticol.pdfbin265207 -> 266054 bytes
-rw-r--r--macros/latex/contrib/adjmulticol/sample.pdfbin53058 -> 53024 bytes
-rw-r--r--macros/latex/contrib/zwpagelayout/README8
-rw-r--r--macros/latex/contrib/zwpagelayout/adjustfoot.pdfbin88982 -> 91770 bytes
-rw-r--r--macros/latex/contrib/zwpagelayout/adjusthead.pdfbin88745 -> 91530 bytes
-rw-r--r--macros/latex/contrib/zwpagelayout/coversample.pdfbin65924 -> 68722 bytes
-rw-r--r--macros/latex/contrib/zwpagelayout/zwpagelayout.pdfbin475910 -> 501158 bytes
-rw-r--r--macros/latex/contrib/zwpagelayout/zwpagelayout.sty8
-rw-r--r--macros/latex/contrib/zwpagelayout/zwpagelayout.tex5
-rw-r--r--macros/luatex/latex/luamathalign/README.md29
-rw-r--r--macros/luatex/latex/luamathalign/build.lua21
-rw-r--r--macros/luatex/latex/luamathalign/luamathalign-luacmd.lua19
-rw-r--r--macros/luatex/latex/luamathalign/luamathalign-luaprop.lua42
-rw-r--r--macros/luatex/latex/luamathalign/luamathalign.dtx655
-rw-r--r--macros/luatex/latex/luamathalign/luamathalign.pdfbin0 -> 391838 bytes
-rw-r--r--macros/xetex/latex/xduts/README.md18
-rw-r--r--macros/xetex/latex/xduts/xduts.dtx663
-rw-r--r--macros/xetex/latex/xduts/xduts.ins28
-rw-r--r--macros/xetex/latex/xduts/xduts.pdfbin324220 -> 362418 bytes
21 files changed, 1415 insertions, 123 deletions
diff --git a/macros/latex/contrib/adjmulticol/README b/macros/latex/contrib/adjmulticol/README
index c3c9fcbe51..82761b3e43 100644
--- a/macros/latex/contrib/adjmulticol/README
+++ b/macros/latex/contrib/adjmulticol/README
@@ -13,4 +13,6 @@ Changes:
v1.2 Bug fix: now adjmulticols works inside a box too.
- v1.3 Big fix: disappearing material in one column output \ No newline at end of file
+ v1.3 Big fix: disappearing material in one column output
+
+ v1.4 New version of bug fix with one column \ No newline at end of file
diff --git a/macros/latex/contrib/adjmulticol/adjmulticol.dtx b/macros/latex/contrib/adjmulticol/adjmulticol.dtx
index 9ce7012f03..66d2f060e5 100644
--- a/macros/latex/contrib/adjmulticol/adjmulticol.dtx
+++ b/macros/latex/contrib/adjmulticol/adjmulticol.dtx
@@ -308,7 +308,7 @@
%</gobble>
%<style>\ProvidesPackage{adjmulticol}
%<*style>
-[2022/03/27 v1.3 Adjusted margins for multicolumn layout]
+[2022/04/17 v1.4 Adjusted margins for multicolumn layout]
% \end{macrocode}
%
%
@@ -364,6 +364,7 @@
%
% \begin{macro}{\adjmulticols}
% \changes{v1.3}{2022/03/27}{Do not try to balance one-column version}
+% \changes{v1.4}{2022/04/17}{Change the balancing of one-column}
% We have three mandatory arguments instead of one for |multicols|:
% the number of columns, the left margin delta and the right margin
% delta:
@@ -392,8 +393,7 @@
I therefore use 10 columns instead}%
\col@number10 \fi
\ifnum\col@number=\@ne\relax
- \let\balance@columns@out
- \multi@column@out
+ \let\balance@columns\adjmc@process@ne@column
\fi
% \end{macrocode}
%
@@ -500,19 +500,13 @@
%
%
% \begin{macro}{\adjmc@page@sofar}
+% \changes{v1.4}{2022/04/17}{No longer copying boxes for one column
+% version}
% We redefine |\page@sofar| to change the margins and allow for
% one-column output:
% \begin{macrocode}
\def\adjmc@page@sofar{%
% \end{macrocode}
-% If we have one column, the standard mechanisms leave empty space
-% instead of the first column. Ok, we use the fact that there is a
-% copy of the first column in |\mult@firstbox|\dots
-% \begin{macrocode}
- \ifnum\col@number=\@ne
- \setbox\mult@rightbox\box\mult@firstbox
- \fi
-% \end{macrocode}
% We redefine |\multicol@leftmargin| to introduce the shift of the
% box. We save the old code in |\adjmc@saved@leftmargin|
% \begin{macrocode}
@@ -534,15 +528,28 @@
% \end{macrocode}
%
% \end{macro}
+%
+% \begin{macro}{\adjmc@process@ne@column}
+% \changes{v1.4}{2022/04/17}{Added macro}
+% If we have one column, we do not need to balance it. Mostly stolen
+% from |multicol.sty|
+% \begin{macrocode}
+\def\adjmc@process@ne@column{%
+ \setbox\mult@firstbox\copy\mult@box}
+% \end{macrocode}
%
%
+% \end{macro}
+%
%\subsection{Not Balancing Columns}
%\label{sec:not_balance}
%
% The starred versions do not balance the columns.
%
% \begin{macro}{\adjmulticols*}
-% This follows the code of the \textsf{multicols} package:
+% \changes{v1.4}{2022/04/17}{Special code for one column version}
+% This follows the code of the \textsf{multicols} package with the
+% special check for one column:
% \begin{macrocode}
\newenvironment{adjmulticols*}{%
\ifinner
@@ -551,8 +558,11 @@
not make sense.\MessageBreak
Going to balance anyway}%
\else
- \let\balance@columns@out
- \multi@column@out
+ \ifnum\col@number=\@ne\relax
+ \let\balance@columns\adjmc@process@ne@column
+ \else
+ \let\balance@columns@out\multi@column@out
+ \fi
\fi
\adjmulticols}{%
\vfill
diff --git a/macros/latex/contrib/adjmulticol/adjmulticol.pdf b/macros/latex/contrib/adjmulticol/adjmulticol.pdf
index 05999ddfdc..7e8514791d 100644
--- a/macros/latex/contrib/adjmulticol/adjmulticol.pdf
+++ b/macros/latex/contrib/adjmulticol/adjmulticol.pdf
Binary files differ
diff --git a/macros/latex/contrib/adjmulticol/sample.pdf b/macros/latex/contrib/adjmulticol/sample.pdf
index af96fd4aa2..b063dffc00 100644
--- a/macros/latex/contrib/adjmulticol/sample.pdf
+++ b/macros/latex/contrib/adjmulticol/sample.pdf
Binary files differ
diff --git a/macros/latex/contrib/zwpagelayout/README b/macros/latex/contrib/zwpagelayout/README
index 1a7f466f62..f41aade7fe 100644
--- a/macros/latex/contrib/zwpagelayout/README
+++ b/macros/latex/contrib/zwpagelayout/README
@@ -1,5 +1,5 @@
=============================================================================
-Package: zwpagelayout Version 1.4d 28 February 2020
+Package: zwpagelayout Version 1.4e 18 April 2022
=============================================================================
This package was developed as a typographers toolbox offering the most
@@ -10,10 +10,8 @@ Finally it is possible to reflect pages both horizontally and vertically.
Partial PDF/X conformance is implemented and black overprint is enabled
in pdfTeX, dvips, as well as (x)dvipdfm(x) drivers, i.e in XeLaTeX.
-Version 1.4d is a bug fix:
-* PDF/X-1a identification corrected.
-* Package iftex loaded instead of ifpdf and ifxetex.
-* Lualatex compatibility supported
+Version 1.4e is a bug fix:
+A typo in a macro name corrected.
Version 1.4 implements black overprint for (x)dvipdfm(x) family of drivers,
i.e. it now works also with XeLaTeX.
diff --git a/macros/latex/contrib/zwpagelayout/adjustfoot.pdf b/macros/latex/contrib/zwpagelayout/adjustfoot.pdf
index d2384367b3..d5722bb0fc 100644
--- a/macros/latex/contrib/zwpagelayout/adjustfoot.pdf
+++ b/macros/latex/contrib/zwpagelayout/adjustfoot.pdf
Binary files differ
diff --git a/macros/latex/contrib/zwpagelayout/adjusthead.pdf b/macros/latex/contrib/zwpagelayout/adjusthead.pdf
index 9598698e97..12b9ab9698 100644
--- a/macros/latex/contrib/zwpagelayout/adjusthead.pdf
+++ b/macros/latex/contrib/zwpagelayout/adjusthead.pdf
Binary files differ
diff --git a/macros/latex/contrib/zwpagelayout/coversample.pdf b/macros/latex/contrib/zwpagelayout/coversample.pdf
index 334662fd3d..8427857093 100644
--- a/macros/latex/contrib/zwpagelayout/coversample.pdf
+++ b/macros/latex/contrib/zwpagelayout/coversample.pdf
Binary files differ
diff --git a/macros/latex/contrib/zwpagelayout/zwpagelayout.pdf b/macros/latex/contrib/zwpagelayout/zwpagelayout.pdf
index aedc8a60dd..13c14b79e7 100644
--- a/macros/latex/contrib/zwpagelayout/zwpagelayout.pdf
+++ b/macros/latex/contrib/zwpagelayout/zwpagelayout.pdf
Binary files differ
diff --git a/macros/latex/contrib/zwpagelayout/zwpagelayout.sty b/macros/latex/contrib/zwpagelayout/zwpagelayout.sty
index 35e7416976..7454bf9fff 100644
--- a/macros/latex/contrib/zwpagelayout/zwpagelayout.sty
+++ b/macros/latex/contrib/zwpagelayout/zwpagelayout.sty
@@ -1,7 +1,7 @@
-\ProvidesPackage{zwpagelayout}[2020/02/28 ZW Page Layout]
-\PackageInfo{zwpagelayout}{$Id: zwpagelayout.sty 547 2020-02-28 13:17:43Z zw $\@gobble}
+\ProvidesPackage{zwpagelayout}[2022/04/18 ZW Page Layout]
+\PackageInfo{zwpagelayout}{$Id: zwpagelayout.sty 552 2022-04-18 09:39:07Z zw $\@gobble}
-%% Copyright 2008--2020 Z. Wagner, http://icebearsoft.euweb.cz
+%% Copyright 2008--2022 Z. Wagner, http://icebearsoft.euweb.cz
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -758,7 +758,7 @@
\def\zwpl@patchfoot{\let\zwpl@oddfoot\@oddfoot \let\zwpl@evenfoot\@evenfoot
\ifzwpl@overprint
\expandafter\ifx\csname OverprintXeTeXExtGState\endcsname\relax \else
- \let\zwpl@oddhead\@oddhead \let\zwpl@evenhead\evenhead
+ \let\zwpl@oddhead\@oddhead \let\zwpl@evenhead\@evenhead
\def\@oddhead{\OverprintXeTeXExtGState \zwpl@oddhead}%
\def\@evenhead{\OverprintXeTeXExtGState \zwpl@evenhead}%
\fi
diff --git a/macros/latex/contrib/zwpagelayout/zwpagelayout.tex b/macros/latex/contrib/zwpagelayout/zwpagelayout.tex
index fe99d96270..a6e5a6f7b7 100644
--- a/macros/latex/contrib/zwpagelayout/zwpagelayout.tex
+++ b/macros/latex/contrib/zwpagelayout/zwpagelayout.tex
@@ -1,4 +1,4 @@
-%% $Id: zwpagelayout.tex 548 2020-02-28 13:27:51Z zw $
+%% $Id: zwpagelayout.tex 552 2022-04-18 09:39:07Z zw $
\input utf8-t1 % encTeX required
\documentclass[11pt]{article}
\usepackage{zwgetfdate}
@@ -1271,6 +1271,9 @@ This section summarizes the changes. The version and the package date is given.
specify the date in the \cmd{usepackage} or \cmd{RequirePackage} command if you rely on a specific
feature not available in the old version of the package.
+\subsection{Version 1.4e, 2022/04/18}
+Bug fix, a typo in a macro name.
+
\subsection{Version 1.4d, 2020/02/07}
\begin{itemize}
\item Bug fix, packages \pkg{ifpdf} and \pkg{ifxetex} replaced with \pkg{iftex}.
diff --git a/macros/luatex/latex/luamathalign/README.md b/macros/luatex/latex/luamathalign/README.md
new file mode 100644
index 0000000000..0eb7c4d06f
--- /dev/null
+++ b/macros/luatex/latex/luamathalign/README.md
@@ -0,0 +1,29 @@
+# The `luamathalign` package for LuaLaTeX
+
+With `amsmath`'s `align` environment simple equations can be aligned easily, e.g.
+
+```tex
+2 &=1+1\\
+2-1&=1
+```
+
+but even just adding an underline makes this much more complicated. E.g.
+
+```tex
+2 &=1+1\\
+\underline{2-1&=1}
+```
+
+is not allowed. Similarly alignment points surrounded by `\left` and `\right`
+or points nested in other environments do not work.
+
+For LuaLaTeX this can be solved with luamathalign. It adds a command `\AlignHere`
+which behaves mustly like `&` except that it's allowed almost anywhere. E.g.
+
+```
+ 2 &= 1+1\\
+\underline{2-1 \AlignHere= 1}
+```
+
+
+Licensed under the LPPL v1.3c or later.
diff --git a/macros/luatex/latex/luamathalign/build.lua b/macros/luatex/latex/luamathalign/build.lua
new file mode 100644
index 0000000000..3ce83c670a
--- /dev/null
+++ b/macros/luatex/latex/luamathalign/build.lua
@@ -0,0 +1,21 @@
+module = "luamathalign"
+typesetexe = "lualatex"
+tdsroot = "lualatex"
+checkengines = {"luatex"}
+unpackfiles = {"*.dtx"}
+installfiles = {"*.sty", "*.lua"}
+sourcefiles = {"*.dtx", "*.lua"}
+
+uploadconfig = {
+ pkg = "luamathalign",
+ version = "v0.1",
+ author = "Marcel Krüger",
+ license = "lppl1.3c",
+ summary = "More flexible alignment in amsmath environments",
+ ctanPath = "/macros/luatex/latex/luamathalign/",
+ -- repository = "https://github.com/zauguin/luamathalign/"
+ description = "Allow aligning mathematical expressions on points where \z
+ where direcly using &amp; is not possible, especially in nested macros or environments.",
+ topic = {'maths', 'luatex'},
+ -- update = true,
+}
diff --git a/macros/luatex/latex/luamathalign/luamathalign-luacmd.lua b/macros/luatex/latex/luamathalign/luamathalign-luacmd.lua
new file mode 100644
index 0000000000..a2ff4ed067
--- /dev/null
+++ b/macros/luatex/latex/luamathalign/luamathalign-luacmd.lua
@@ -0,0 +1,19 @@
+----Copyright (C) 2019--2022 by Marcel Krueger
+---
+--- This file may be distributed and/or modified under the
+--- conditions of the LaTeX Project Public License, either
+--- version 1.3c of this license or (at your option) any later
+--- version. The latest version of this license is in:
+---
+--- http://www.latex-project.org/lppl.txt
+---
+--- and version 1.3 or later is part of all distributions of
+--- LaTeX version 2005/12/01 or later.
+local func_tbl = lua.get_functions_table()
+local set_lua = token.set_lua
+local new_luafunction = luatexbase.new_luafunction
+return function(name, func, ...)
+ local idx = new_luafunction(name)
+ set_lua(name, idx, ...)
+ func_tbl[idx] = func
+end
diff --git a/macros/luatex/latex/luamathalign/luamathalign-luaprop.lua b/macros/luatex/latex/luamathalign/luamathalign-luaprop.lua
new file mode 100644
index 0000000000..3e10f0fc45
--- /dev/null
+++ b/macros/luatex/latex/luamathalign/luamathalign-luaprop.lua
@@ -0,0 +1,42 @@
+----Copyright (C) 2019--2022 by Marcel Krueger
+---
+--- This file may be distributed and/or modified under the
+--- conditions of the LaTeX Project Public License, either
+--- version 1.3c of this license or (at your option) any later
+--- version. The latest version of this license is in:
+---
+--- http://www.latex-project.org/lppl.txt
+---
+--- and version 1.3 or later is part of all distributions of
+--- LaTeX version 2005/12/01 or later.
+return function(namespace)
+ return {
+ query = function(n)
+ local p = node.getproperty(n)
+ return p and p[namespace]
+ end,
+ get = function(n, ...)
+ local p = node.getproperty(n)
+ if not p then
+ p = {}
+ node.setproperty(n, p)
+ end
+ local n = p[namespace]
+ if nil == p[namespace] then
+ local d = select('#', ...) ~= 0 and ... or {}
+ n, p[namespace] = d, d
+ end
+ return n
+ end,
+ set = function(n, v)
+ local p = node.getproperty(n)
+ if not p then
+ p = {}
+ node.setproperty(n, p)
+ end
+ local old = p[namespace]
+ p[namespace] = v
+ return old
+ end,
+ }
+end
diff --git a/macros/luatex/latex/luamathalign/luamathalign.dtx b/macros/luatex/latex/luamathalign/luamathalign.dtx
new file mode 100644
index 0000000000..401c8ef7ea
--- /dev/null
+++ b/macros/luatex/latex/luamathalign/luamathalign.dtx
@@ -0,0 +1,655 @@
+% \iffalse meta-comment
+%
+%% Copyright (C) 2019--2022 by Marcel Krueger
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%
+%<*batch>
+%<*gobble>
+\ifx\jobname\relax\let\documentclass\undefined\fi
+\ifx\documentclass\undefined
+\csname fi\endcsname
+%</gobble>
+\input l3docstrip.tex
+\keepsilent
+\preamble
+\endpreamble
+\generate{\file{luamathalign.sty}{\from{luamathalign.dtx}{package}}}
+\begingroup
+\def\MetaPrefix{--}
+\preamble
+\endpreamble
+\postamble
+\endpostamble
+\generate{\file{luamathalign.lua}{\from{luamathalign.dtx}{lua}}}
+\endgroup
+\endbatchfile
+%</batch>
+%<*gobble>
+\fi
+\expandafter\ifx\csname @currname\endcsname\empty
+\csname fi\endcsname
+%</gobble>
+%<*driver>
+\documentclass[full]{l3doc}
+\usepackage{luamathalign}
+\usepackage{csquotes}
+\MakeShortVerb{\|}
+\setlength\IndexMin{100pt}
+\begin{document}
+\DocInput{luamathalign.dtx}
+\PrintIndex
+\PrintChanges
+\end{document}
+%</driver>
+%<*gobble>
+\fi
+%</gobble>
+% \fi
+%
+% \GetFileInfo{luamathalign.dtx}
+% \title{The \pkg{luamathalign} package\thanks{This document
+% corresponds to \pkg{luamathalign}~v0.1, dated~2022-04-18.}}
+% \author{Marcel Kr\"uger \\ \href{mailto:tex@2krueger.de}{tex@2krueger.de}}
+%
+% \maketitle
+%
+% \begin{documentation}
+% \section{The problem}
+% In most cases, |amsmath| makes it simple to align multiple equations in a
+% |align| environment. But sometimes, special requirements come up.
+%
+% Maybe one of your alignment points is in an exponent, or in a radical?
+% The first attempts for such alignments often fail. For example, assume that
+% you want to align the following radicals like this (at the $x^3$ term):
+% \begin{align*}
+% \sqrt{1-3x+3x^2+(\AlignHere x-1)^3}\\
+% =\sqrt{1-3x+3x^2+{\AlignHere x}^3-3x^2+3x-1}\\
+% =\sqrt{\AlignHere x^3}
+% \end{align*}
+% \enquote{Just adding \texttt{\&} at the alignment points} doesn't work:
+% \begin{verbatim}
+% \begin{align*}
+% \sqrt{1-3x+3x^2+(&x-1)^3}\\
+% =\sqrt{1-3x+3x^2+&x^3-3x^2+3x-1}\\
+% =\sqrt{&x^3}
+% \end{align*}
+% \end{verbatim}
+% fails with
+% \begin{verbatim}
+% ! Missing } inserted.
+% <inserted text>
+% }
+% l.73 \end{align*}
+% \end{verbatim}
+%
+% Another problem are nested alignments. Take this sample from \href{https://tex.stackexchange.com/questions/68547/alignment-across-nested-aligned-environments}{anonymous on \TeX\ -- \LaTeX\ StackExchange}: We want alignment like
+% \begin{align*}
+% aaaa &= 1 &&\text{for $X$} \\
+% bbbb &= 1 &&\text{for $Y$} \\
+% \left. \begin{aligned}
+% c \SetAlignmentPoint1 &= 1 \\
+% d &= 12
+% \end{aligned} \right\}\ExecuteAlignment1 &&\text{for $Z$}
+% \end{align*}
+% but in
+% \begin{verbatim}
+% \begin{align*}
+% aaaa &= 1 &&\text{for $X$} \\
+% bbbb &= 1 &&\text{for $Y$} \\
+% \left. \begin{aligned}
+% c &= 1 \\
+% d &= 12
+% \end{aligned} \right\}&&&\text{for $Z$}
+% \end{align*}
+% \end{verbatim}
+% there is not obvious way to align the equal signs in the nested |aligned| with the outer signs.
+% \section{The solution}
+% \pkg{luamathalign} provides solutions for both problems under Lua\LaTeX:
+% \begin{function}{\AlignHere}
+% The most important new macro is \cmd\AlignHere:
+% It generates an alignment point like \texttt{\&},
+% but it can be used almost everywhere.
+%
+% So problems like our first example can be implemented by just using \cmd\AlignHere\ instead of \texttt{\&}:
+% \begin{verbatim}
+% \begin{align*}
+% \sqrt{1-3x+3x^2+(\AlignHere x-1)^3}\\
+% =\sqrt{1-3x+3x^2+{\AlignHere x}^3-3x^2+3x-1}\\
+% =\sqrt{\AlignHere x^3}
+% \end{align*}
+% \end{verbatim}
+% \begin{align*}
+% \sqrt{1-3x+3x^2+(\AlignHere x-1)^3}\\
+% =\sqrt{1-3x+3x^2+{\AlignHere x}^3-3x^2+3x-1}\\
+% =\sqrt{\AlignHere x^3}
+% \end{align*}
+% \end{function}
+% Sadly, this doesn't really help with the nested alignment problem:
+% Even if we use \cmd\AlignHere\ in the \env{aligned} environment, the alignment points
+% would be inserted in the inner and not in the outer alignment.
+% For such cases, there is a variant which allows to specify at which level the alignment should happen:
+% \begin{function}{\SetAlignmentPoint,\ExecuteAlignment}
+% The primary command for this is \cmd\SetAlignmentPoint\meta{number}. When called with a negative number it specifies the nesting level.
+% For example when \meta{number} is -1 it is the same as \cmd\AlignHere, while for -2 it is aligning one level higher and so on.
+%
+% For example, our nested alignment above wanted to align the inner \env{aligned} and the outer \env{align*} at the same point,
+% so |\SetAlignmentPoint-2| is used directly next to a inner alignment point (here |&|, \cmd\AlignHere\ would work too).
+% Then the \cmd\ExecuteAlignment\ has to appear in the context of the outer \env{align*}, so it can be written e.g. directly before the next |&| of the outer \env{align*}:
+% \begin{verbatim}
+% \begin{align*}
+% aaaa &= 1 &&\text{for $X$} \\
+% bbbb &= 1 &&\text{for $Y$} \\
+% \left. \begin{aligned}
+% c \SetAlignmentPoint-2 &= 1 \\
+% d &= 12
+% \end{aligned} \right\}&&\text{for $Z$}
+% \end{align*}
+% \end{verbatim}
+% \begin{align*}
+% aaaa &= 1 &&\text{for $X$} \\
+% bbbb &= 1 &&\text{for $Y$} \\
+% \left. \begin{aligned}
+% c \SetAlignmentPoint-2 &= 1 \\
+% d &= 12
+% \end{aligned} \right\}&&\text{for $Z$}
+% \end{align*}
+%
+% If you do not want to keep track of the right nesting level you can explicitly mark a level and refer to it.
+% To do so, use a non-negative \meta{number}.
+% When \cmd\SetAlignmentPoint\ is used with a non-negative \meta{number} then \cmd\ExecuteAlignment\meta{number}
+% must be executed afterwards with the same \meta{number} at a point where adding a |&| would add a valid alignment point at the right level.
+%
+% Our example above could therefore also be written as
+% \begin{verbatim}
+% \begin{align*}
+% aaaa &= 1 &&\text{for $X$} \\
+% bbbb &= 1 &&\text{for $Y$} \\
+% \left. \begin{aligned}
+% c \SetAlignmentPoint0 &= 1 \\
+% d &= 12
+% \end{aligned} \right\}\ExecuteAlignment0 &&\text{for $Z$}
+% \end{align*}
+% \end{verbatim}
+% \begin{align*}
+% aaaa &= 1 &&\text{for $X$} \\
+% bbbb &= 1 &&\text{for $Y$} \\
+% \left. \begin{aligned}
+% c \SetAlignmentPoint0 &= 1 \\
+% d &= 12
+% \end{aligned} \right\}\ExecuteAlignment0 &&\text{for $Z$}
+% \end{align*}
+%
+% This variant is also useful when working with custom alignment environment not prepared to work with luamathalign.
+% By default \cmd\SetAlignmentPoint\meta{number} with negative numbers (and therefore also \cmd\AlignHere) only work with
+% amsmath's \texttt{\{align\}}, \texttt{\{aligned\}} and their variants.
+% If you have another environment which also follows similar alignment rules then you can either restrict yourself to
+% non-negative \meta{number}s in combination with \cmd\ExecuteAlignment\ or patch these environments similar to what luamathalign does for amsmath.
+% \end{function}
+% \end{documentation}
+% \begin{implementation}
+% \section{The implementation}
+% \subsection{Lua}
+% \iffalse
+%<*gobble>
+\RequirePackage{docstrip-luacode}
+\begin{docstrip-luacode}{luamathalign}
+%</gobble>
+%<*lua>
+% \fi
+% \begin{macrocode}
+local luacmd = require'luamathalign-luacmd'
+local luaprop = require'luamathalign-luaprop'('mathalign')
+local hlist = node.id'hlist'
+local vlist = node.id'vlist'
+local whatsit = node.id'whatsit'
+local kern = node.id'kern'
+local user_defined = node.subtype'user_defined'
+local whatsit_id = luatexbase.new_whatsit'mathalign'
+local node_cmd = token.command_id'node'
+local ampersand = token.new(38, 4)
+-- We might want to add y later
+local function is_marked(mark, list)
+ for n in node.traverse(list) do
+ local id = n.id
+ if id == hlist or id == vlist then
+ if is_marked(mark, n.head) then return true end
+ elseif id == whatsit and n.subtype == user_defined
+ and n.user_id == whatsit_id and n.value == mark then
+ return true
+ end
+ end
+ return false
+end
+local function assert_unmarked(mark, list, ...)
+ local marked = is_marked(mark, list)
+ if marked then
+ tex.error("Multiple alignment marks", "I found multiple alignment marks \z
+ of type " .. mark .. " in an alignment where I already had an \z
+ alignment mark of that type. You should look at both of them and \z
+ decide which one is right. I will continue with the first one for now.")
+ end
+ return ...
+end
+local measure do
+ local vmeasure
+ local function hmeasure(mark, list)
+ local x, last = 0, list.head
+ for n in node.traverse(last) do
+ local id = n.id
+ if id == hlist then
+ local w, h, d = node.rangedimensions(list, last, n)
+ x, last = x + w, n
+ local dx = hmeasure(mark, n)
+ if dx then return assert_unmarked(mark, n.next, dx + x) end
+ elseif id == vlist then
+ local w, h, d = node.rangedimensions(list, last, n)
+ x, last = x + w, n
+ local dx = vmeasure(mark, n)
+ if dx then return assert_unmarked(mark, n.next, dx + x) end
+ elseif id == whatsit and n.subtype == user_defined
+ and n.user_id == whatsit_id and n.value == mark then
+ local w, h, d = node.rangedimensions(list, last, n)
+ local after
+ list.head, after = node.remove(list.head, n)
+ return assert_unmarked(mark, after, x + w)
+ end
+ end
+ end
+ function vmeasure(mark, list)
+ for n in node.traverse(list.head) do
+ local id = n.id
+ if id == hlist then
+ local dx = hmeasure(mark, n)
+ if dx then return assert_unmarked(mark, n.next, dx + n.shift) end
+ elseif id == vlist then
+ local dx = vmeasure(mark, n)
+ if dx then return assert_unmarked(mark, n.next, dx + n.shift) end
+ elseif id == whatsit and n.subtype == user_defined
+ and n.user_id == whatsit_id and n.value == mark then
+ local after
+ list.head, after = node.remove(list.head, n)
+ return assert_unmarked(mark, after, 0)
+ end
+ end
+ end
+ function measure(mark, head)
+ local x, last = 0, head
+ for n in node.traverse(last) do
+ local id = n.id
+ if id == hlist then
+ local w, h, d = node.dimensions(last, n)
+ x, last = x + w, n
+ local dx = hmeasure(mark, n)
+ if dx then return assert_unmarked(mark, n.next, head, dx + x) end
+ elseif id == vlist then
+ local w, h, d = node.dimensions(last, n)
+ x, last = x + w, n
+ local dx = vmeasure(mark, n)
+ if dx then return assert_unmarked(mark, n.next, head, dx + x) end
+ elseif id == whatsit and n.subtype == user_defined
+ and n.user_id == whatsit_id and n.value == mark then
+ local w, h, d = node.dimensions(last, n)
+ local after
+ head, after = node.remove(head, n)
+ return assert_unmarked(mark, after, head, x + w)
+ end
+ end
+ return head
+ end
+end
+
+local isolate do
+ local visolate
+ local function hisolate(list, offset)
+ local x, last = 0, list.head
+ local newhead, newtail = nil, nil
+ local n = last
+ while n do
+ local id = n.id
+ if id == hlist then
+ local w, h, d = node.rangedimensions(list, last, n)
+ x, last = x + w, n
+ local inner_head, inner_tail, new_offset = hisolate(n, offset - x)
+ if inner_head then
+ if newhead then
+ newtail.next, inner_head.prev = inner_head, newtail
+ else
+ newhead = inner_head
+ end
+ newtail = inner_tail
+ offset = x + new_offset
+ end
+ n = n.next
+ elseif id == vlist then
+ local w, h, d = node.rangedimensions(list, last, n)
+ x, last = x + w, n
+ local inner_head, inner_tail, new_offset = visolate(n, offset - x)
+ if inner_head then
+ if newhead then
+ newtail.next, inner_head.prev = inner_head, newtail
+ else
+ newhead = inner_head
+ end
+ newtail = inner_tail
+ offset = x + new_offset
+ end
+ n = n.next
+ elseif id == whatsit and n.subtype == user_defined
+ and n.user_id == whatsit_id then
+ local w, h, d = node.rangedimensions(list, last, n)
+ x = x + w
+ list.head, last = node.remove(list.head, n)
+ if x ~= offset then
+ local k = node.new(kern)
+ k.kern, offset = x - offset, x
+ newhead, newtail = node.insert_after(newhead, newtail, k)
+ end
+ newhead, newtail = node.insert_after(newhead, newtail, n)
+ n = last
+ else
+ n = n.next
+ end
+ end
+ return newhead, newtail, offset
+ end
+ function visolate(list, offset)
+ local newhead, newtail = nil, nil
+ local n = list.head
+ while n do
+ local id = n.id
+ if id == hlist then
+ if dx then return assert_unmarked(mark, n.next, dx + n.shift) end
+ local inner_head, inner_tail, new_offset = hisolate(n, offset)
+ if inner_head then
+ if newhead then
+ newtail.next, inner_head.prev = inner_head, newtail
+ else
+ newhead = inner_head
+ end
+ newtail = inner_tail
+ offset = new_offset
+ end
+ n = n.next
+ elseif id == vlist then
+ if dx then return assert_unmarked(mark, n.next, dx + n.shift) end
+ local inner_head, inner_tail, new_offset = visolate(n, offset)
+ if inner_head then
+ if newhead then
+ newtail.next, inner_head.prev = inner_head, newtail
+ else
+ newhead = inner_head
+ end
+ newtail = inner_tail
+ offset = new_offset
+ end
+ n = n.next
+ elseif id == whatsit and n.subtype == user_defined
+ and n.user_id == whatsit_id then
+ local after
+ list.head, after = node.remove(list.head, n)
+ if 0 ~= offset then
+ local k = node.new(kern)
+ k.kern, offset = -offset, 0
+ newhead, newtail = node.insert_after(newhead, newtail, k)
+ end
+ newhead, newtail = node.insert_after(newhead, newtail, n)
+ n = last
+ else
+ n = n.next
+ end
+ end
+ return newhead, newtail, offset
+ end
+ function isolate(head)
+ local x, last = 0, head
+ local newhead, newtail, offset = nil, nil, 0
+ local n = last
+ while n do
+ local id = n.id
+ if id == hlist then
+ local w, h, d = node.dimensions(last, n)
+ x, last = x + w, n
+ local inner_head, inner_tail, new_offset = hisolate(n, offset - x)
+ if inner_head then
+ if newhead then
+ newtail.next, inner_head.prev = inner_head, newtail
+ else
+ newhead = inner_head
+ end
+ newtail = inner_tail
+ offset = x + new_offset
+ end
+ n = n.next
+ elseif id == vlist then
+ local w, h, d = node.dimensions(last, n)
+ x, last = x + w, n
+ local inner_head, inner_tail, new_offset = visolate(n, offset - x)
+ if inner_head then
+ if newhead then
+ newtail.next, inner_head.prev = inner_head, newtail
+ else
+ newhead = inner_head
+ end
+ newtail = inner_tail
+ offset = x + new_offset
+ end
+ n = n.next
+ elseif id == whatsit and n.subtype == user_defined
+ and n.user_id == whatsit_id then
+ local w, h, d = node.dimensions(last, n)
+ x = x + w
+ head, last = node.remove(head, n)
+ if x ~= offset then
+ local k = node.new(kern)
+ k.kern, offset = x - offset, x
+ newhead, newtail = node.insert_after(newhead, newtail, k)
+ end
+ newhead, newtail = node.insert_after(newhead, newtail, n)
+ n = last
+ else
+ n = n.next
+ end
+ end
+ return head, newhead
+ end
+end
+
+local mark, afterkern
+luatexbase.add_to_callback('post_mlist_to_hlist_filter', function(n)
+ if mark then
+ local x
+ n, x = measure(mark, n)
+ local k = node.new'kern'
+ local off = x - n.width
+ k.kern, afterkern.kern = off, -off
+ node.insert_after(n.head, nil, k)
+ n.width = x
+ mark, afterkern = nil, nil
+ end
+ return n
+end, 'luamathalign')
+
+local function get_kerntoken(newmark)
+ assert(not mark)
+ mark, afterkern = newmark, node.new'kern'
+ return token.new(node.direct.todirect(afterkern), node_cmd)
+end
+
+local function insert_whatsit(mark)
+ local n = node.new(whatsit, user_defined)
+ n.user_id, n.type, n.value = whatsit_id, string.byte'd', mark
+ node.write(n)
+end
+luacmd("SetAlignmentPoint", function()
+ local mark = token.scan_int()
+ if mark < 0 then
+ for i=tex.nest.ptr,0,-1 do
+ local t = tex.nest[i].head
+ if luaprop.query(t) ~= nil then
+ mark = mark + 1
+ if mark == 0 then
+ luaprop.set(t, true)
+ return insert_whatsit(-i)
+ end
+ end
+ end
+ tex.error('No compatible alignment environment found',
+ 'This either means that \\SetAlignmentPoint was used outside\n\z
+ of an alignment or the used alignment is not setup for use with\n\z
+ luamathalign. In the latter case you might want to look at\n\z
+ non-negative alignment marks.')
+ else
+ return insert_whatsit(mark)
+ end
+end, "protected")
+
+function handle_whatsit(mark)
+ token.put_next(ampersand, get_kerntoken(mark))
+end
+luacmd("ExecuteAlignment", function()
+ return handle_whatsit(token.scan_int())
+end, "protected")
+
+luacmd("LuaMathAlign@begin", function()
+ local nest = tex.nest.top
+ luaprop.set(nest.head, false)
+end, "protected")
+luacmd("LuaMathAlign@end@early", function()
+ local t = tex.nest.top.head
+ if luaprop.set(t, nil) == true then
+ handle_whatsit(-tex.nest.ptr)
+ end
+end, "protected")
+local delayed
+luacmd("LuaMathAlign@end", function()
+ local nest = tex.nest.top
+ local t = nest.head
+ if luaprop.set(t, nil) == true then
+ assert(not delayed)
+ delayed = {get_kerntoken(-tex.nest.ptr), ampersand}
+ end
+end, "protected")
+luatexbase.add_to_callback("hpack_filter", function(head, groupcode)
+ if delayed and groupcode == "align_set" then
+-- HACK: token.put_next puts the tokens into the input stream after the cell
+-- is fully read, before the next starts. This will act as if the content was
+-- written as the first element of the next field.
+ token.put_next(delayed)
+ delayed = nil
+ end
+ return true
+end, "luamathalign.delayed")
+
+luacmd("LuaMathAlign@IsolateAlignmentPoints", function()
+ local main = token.scan_int()
+ if not token.scan_keyword 'into' then
+ tex.error'Expected "into"'
+ end
+ local marks = token.scan_int()
+ local head, newhead = isolate(tex.box[main])
+ tex.box[marks] = node.direct.tonode(node.direct.hpack(
+ newhead and node.direct.todirect(newhead) or 0))
+end, "protected")
+% \end{macrocode}
+% \subsection{LaTeX}
+% \iffalse
+%</lua>
+%<*gobble>
+\end{docstrip-luacode}
+%</gobble>
+%<*package>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage
+ {luamathalign}
+ [2022-04-18 v0.1 additional math alignment tricks using Lua]
+% \fi
+% The actual \LaTeX\ package just loads the Lua module and patches \pkg{amsmath}:
+% \begin{macrocode}
+% \RequirePackage{scrlfile}
+\directlua{require'luamathalign'}
+\IfPackageLoadedTF{amsmath}{%
+ \@firstofone
+}{%
+ \AddToHook{package/amsmath/after}
+}
+{%
+ \def\align@preamble{%
+ &\hfil
+ \strut@
+ \setboxz@h{\@lign$\m@th\displaystyle{%
+ \LuaMathAlign@begin##\LuaMathAlign@end}$}%
+ \ifmeasuring@\savefieldlength@\fi
+ \set@field
+ \tabskip\z@skip
+ &\setboxz@h{\@lign$\m@th\displaystyle{{}##}$}%
+ \ifmeasuring@\savefieldlength@\fi
+ \set@field
+ \hfil
+ \tabskip\alignsep@
+ }
+ \renewcommand{\start@aligned}[2]{%
+ \RIfM@\else
+ \nonmatherr@{\begin{\@currenvir}}%
+ \fi
+ \savecolumn@ % Assumption: called inside a group
+ \alignedspace@left
+ \if #1t\vtop \else \if#1b \vbox \else \vcenter \fi \fi \bgroup
+ \maxfields@#2\relax
+ \ifnum\maxfields@>\m@ne
+ \multiply\maxfields@\tw@
+ \let\math@cr@@@\math@cr@@@alignedat
+ \alignsep@\z@skip
+ \else
+ \let\math@cr@@@\math@cr@@@aligned
+ \alignsep@\minalignsep
+ \fi
+ \Let@ \chardef\dspbrk@context\@ne
+ \default@tag
+ \spread@equation % no-op if already called
+ \global\column@\z@
+ \ialign\bgroup
+ &\column@plus
+ \hfil
+ \strut@
+ $\m@th\displaystyle{\LuaMathAlign@begin##\LuaMathAlign@end}$%
+ \tabskip\z@skip
+ &\column@plus
+ $\m@th\displaystyle{{}##}$%
+ \hfil
+ \tabskip\alignsep@
+ \crcr
+ }
+ \edef\math@cr@@@alignedat{\LuaMathAlign@end@early
+ \unexpanded\expandafter{\math@cr@@@alignedat}}
+ \edef\math@cr{\LuaMathAlign@end@early
+ \unexpanded\expandafter{\math@cr}}
+ \edef\endaligned{\LuaMathAlign@end@early
+ \unexpanded\expandafter{\endaligned}}
+}
+\protected\def\AlignHere{\SetAlignmentPoint\m@ne}
+\begingroup
+ \def\patch@finph@nt\setbox\tw@\null{%
+ \LuaMathAlign@IsolateAlignmentPoints\z@ into \tw@
+ }%
+\expanded{\endgroup%
+\protected\def\noexpand\finph@nt{%
+ \unexpanded\expandafter\expandafter\expandafter{%
+ \expandafter\patch@finph@nt\finph@nt
+ }%
+}}
+\ExplSyntaxOff
+% \end{macrocode}
+% \iffalse
+%</package>
+% \fi
+% \end{implementation}
+\endinput
diff --git a/macros/luatex/latex/luamathalign/luamathalign.pdf b/macros/luatex/latex/luamathalign/luamathalign.pdf
new file mode 100644
index 0000000000..d946d14894
--- /dev/null
+++ b/macros/luatex/latex/luamathalign/luamathalign.pdf
Binary files differ
diff --git a/macros/xetex/latex/xduts/README.md b/macros/xetex/latex/xduts/README.md
index f4e54ed187..7b6c9610fd 100644
--- a/macros/xetex/latex/xduts/README.md
+++ b/macros/xetex/latex/xduts/README.md
@@ -17,10 +17,12 @@ In the future, we plan to add the following document classes, including
## Installation
-You can install XDUTS by either CTAN or GitHub by following the instructions below.
+You can install XDUTS from either CTAN or GitHub by following the instructions below.
### CTAN
+#### TeX Live/MacTeX
+
Make sure the latest version of TeX Live/MacTeX is installed. Then, you can install XDUTS by running command below. If on Windows, it may be necessary to start a Command Prompt as an Administrator. If on macOS or GNU/Linux, please run the command with `sudo`.
```shell
@@ -33,6 +35,20 @@ Run command below to open the documentation in TeX Live/MacTeX.
texdoc xduts
```
+#### MiKTeX
+
+You can install XDUTS by running command below.
+
+```shell
+miktex packages install xduts
+```
+
+Run command below to open the documentation.
+
+```shell
+texdoc xduts
+```
+
### GitHub
Generally speaking, CTAN updates XDUTS slowly. If you want to use the latest version of XDUTS, download this repository and run the following commands to get the corresponding documentation and document class/package files.
diff --git a/macros/xetex/latex/xduts/xduts.dtx b/macros/xetex/latex/xduts/xduts.dtx
index 4c7e798e76..d0e0686923 100644
--- a/macros/xetex/latex/xduts/xduts.dtx
+++ b/macros/xetex/latex/xduts/xduts.dtx
@@ -1,13 +1,13 @@
% \iffalse
%<*driver>
\ProvidesFile{xduts.dtx}
-[2022/04/11 v0.7.0.0 Xidian University TeX Suite]
+[2022/04/16 v1.2.0.0 Xidian University TeX Suite]
%</driver>
%<class|sty>\NeedsTeXFormat{LaTeX2e}
%<class|sty>\RequirePackage{expl3}
%<xduugthesis>\ProvidesExplClass{xduugthesis}
%<xdufont>\ProvidesExplPackage{xdufont}
-%<class|sty> {2022/04/11}{0.7.0.0}
+%<class|sty> {2022/04/16}{1.2.0.0}
%<xdufont> {Xidian University Font package}
%<xduugthesis> {Xidian University Undergraduate Thesis document class}
%<*driver>
@@ -39,8 +39,8 @@
\usepackage{multirow}
\usepackage{makecell}
% 交叉引用
-\newcommand{\secref}[1]{第\xspace\ref{#1}\xspace{节}}
-\newcommand{\tableref}[1]{\tablename\xspace\ref{#1}\xspace}
+\newcommand{\secrefx}[1]{第\xspace\ref{#1}\xspace 节}
+\newcommand{\tabrefx}[1]{\tablename\xspace\ref{#1}\xspace}
% 文档类选项
\newcommand{\optx}[1]{\xspace\opt{#1}\xspace}
% /name LaTeX3控制序列
@@ -68,8 +68,6 @@
\newcommand{\valuex}[1]{\xspace\texttt{#1}\xspace}
% 命令
\newcommand{\cmdx}[1]{\xspace\texttt{#1}\xspace}
-% 引用
-\newcommand{\secrefx}[1]{第\xspace\ref{#1}\xspace 节}
% 链接
\newcommand{\footurl}[1]{\footnote{\url{#1}}}
\newcommand{\ctanurl}[1]{\href{https://mirrors.ustc.edu.cn/CTAN/#1}{\ttfamily CTAN://#1}}
@@ -143,7 +141,7 @@
\end{document}
%</driver>
% \fi
-% \CheckSum{872}
+% \CheckSum{1068}
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -213,12 +211,15 @@
% 中提及的内容本文档将不再提及。
% \xduts{}中的所有文档类和宏包仅内置了实现功能所必要的宏包,
% 对于常用的宏包如\pkgx{subfig}、\pkgx{algpseudocodex}、
-% \pkgx{amsmath}、\pkgx{amsthm}和\pkgx{siunitx}等均未内置,
+% \pkgx{amsmath}、\pkgx{amsthm}和\pkgx{siunitx}等\textbf{均未内置},
% 用户视需求自行加载。
% 请在最新版\LaTeX{}环境中使用最新版\xduts{},
% 认真阅读相应文档类/宏包使用说明章节即可使用\xduts{}。
% \par
% 相应格式规范均已实现,用户仅需要撰写文章内容即可,请勿随意添加格式修改命令。
+% \changes{v1.1.2.1}{2022/04/15}{增加默认值说明}
+% 部分样式的默认值并不严格符合学校规范,
+% 用户可以结合学校规范并参考\secrefx{功能说明}功能说明自行修改。
% \subsection{xdufont}
% \pkgx{xdufont}宏包基于\pkgx{xeCJK},相较于\pkgx{ctex}宏包的主要优势为默认支持宋体粗体、斜体,内置多种字体配置,可任意搭配中/英/数学字体,更加符合校内各种文档的撰写要求。
% \par
@@ -237,6 +238,7 @@
% \subsection{xduugthesis}
% \pkgx{xduugthesis}基于\clsx{ctexbook}文档类,
% 提供多种字体配置,部分样式可自定义,信息录入便捷。
+% 请在阅读《本科生毕业设计(论文)工作手册》后再使用\pkgx{xduugthesis}。
% \par
% 典型的\clsx{xduugthesis}主文件结构应该如下所示:
% \begin{latexexample}[moretexcs={\xdusetup,\frontmatter,\mainmatter,\chapter,\backmatter},emph={[1]document}]
@@ -256,7 +258,11 @@
% 部分英文字体切换见\secrefx{英文字体},
% 论文语言切换见\secrefx{语言配置},
% 参考文献配置见\secrefx{参考文献配置},
-% 图片配置见\secrefx{图片配置},
+% 页面配置见\secrefx{页面配置},
+% 交叉引用配置见\secrefx{交叉引用配置},
+% Caption配置见\secrefx{Caption配置},
+% 表格配置见\secrefx{表格配置},
+% 算法配置见\secrefx{算法配置},
% 章节配置见\secrefx{章节配置}。
% 如需附录,请使用附录环境,具体见\secrefx{附录环境}。
% 仅支持如下信息录入,具体每个选项的含义见\secrefx{信息录入},如没有部分选项,则删除该行即可。
@@ -284,6 +290,7 @@
% \par
% 学会以上用法后即可立即使用\clsx{xduugthesis}文档类了。
% \section{功能说明}
+% \label{功能说明}
% 请根据\secrefx{使用说明}中相应文档类/宏包的说明来选择性地阅读本节内容。
% \subsection{编译}
% \label{编译}
@@ -332,9 +339,9 @@
% \label{字体选项}
% \begin{function}[added=2022-03-06]{style/cjk-font}
% \begin{syntax}
-% \optx{style/cjk-font}=\metax{adobe|fandol|founder|sinotype|(win)|none}
+% \optx{style/cjk-font}=\metax{adobe|(fandol)|founder|sinotype|win|none}
% \end{syntax}
-% 设置中文字体,具体配置见\tableref{tab:cjk-font}。
+% 设置中文字体,具体配置见\tabrefx{tab:cjk-font}。
% \end{function}
% \begin{optdesc}
% \item[none] 关闭内置中文字体配置,需自行配置中文字体。
@@ -375,11 +382,11 @@
% \end{syntax}
% 设置中文字体伪斜体倾斜程度。默认为\valuex{0.2}。
% \end{function}
-% \begin{function}[added=2022-03-06]{style/latin-font}
+% \begin{function}[added=2022-03-06,updated=2022-04-13]{style/latin-font}
% \begin{syntax}
-% \optx{style/latin-font}=\metax{(tacn)|thcs|none}
+% \optx{style/latin-font}=\metax{tacn|thcs|(gyre)|none}
% \end{syntax}
-% 设置英文字体,具体配置见\tableref{tab:latin-font}。
+% 设置英文字体,具体配置见\tabrefx{tab:latin-font}。
% \end{function}
% \begin{optdesc}
% \item[none] 关闭内置英文字体配置,需自行配置英文字体。
@@ -395,6 +402,7 @@
% \midrule
% |tacn|\tnote{1} & Times New Roman & Arial & Courier New \\
% |thcs|\tnote{2} & Times New Roman & Helvetica & Courier Std \\
+% |gyre| & TeX Gyre Termes & TeX Gyre Heros & TeX Gyre Cursor \\
% \bottomrule
% \end{tabularx}
% \begin{tablenotes}
@@ -407,7 +415,7 @@
% \begin{syntax}
% \optx{style/math-font}=\metax{asana|cambria|(cm)|fira|garamond|lm|...|termes|xits|none}
% \end{syntax}
-% 设置数学字体,具体配置见\tableref{tab:math-font}。除Computer Modern字体外,均使用\pkgx{unicode-math}宏包调用字体。
+% 设置数学字体,具体配置见\tabrefx{tab:math-font}。除Computer Modern字体外,均使用\pkgx{unicode-math}宏包调用字体。
% \end{function}
% \changes{v0.1.4.1}{2022/04/04}{数学字体风格介绍}
% \begin{optdesc}
@@ -481,7 +489,7 @@
% \begin{syntax}
% \optx{style/en-cjk-font}=\metax{true|(false)}
% \end{syntax}
-% 切换字体族时,英文是否使用中文字体。主要作用于封面、章节标题、页眉页脚等。
+% 切换字体族时,英文是否使用中文字体。主要作用于封面、章节标题、caption、页眉页脚等。
% \end{function}
% \begin{optdesc}
% \item[true] 英文使用相对应字体族的中文字体。
@@ -517,14 +525,67 @@
% \end{syntax}
% 设置参考文献\filex{.bib}文件,多个文件之间需要使用英文半角逗号隔开。
% \end{function}
-% \subsection{图片配置}
-% \label{图片配置}
+% \subsection{页面配置}
+% \label{页面配置}
+% \begin{function}[added=2022-04-12]{style/symmetric-margin}
+% \begin{syntax}
+% \optx{style/symmetric-margin}=\metax{true|(false)}
+% \end{syntax}
+% 设置左右页边距是否对称。
+% \end{function}
+% \begin{optdesc}
+% \item[true] 对称。
+% \item[false] 不对称。
+% \end{optdesc}
+% \subsection{交叉引用配置}
+% \label{交叉引用配置}
+% \begin{function}[added=2022-04-16]{style/ref-add-space}
+% \begin{syntax}
+% \optx{style/ref-add-space}=\metax{true|(false)}
+% \end{syntax}
+% 是否自动调整\tnx{ref}两侧中英文间空白。
+% \end{function}
+% \begin{optdesc}
+% \item[true] 自动调整\tnx{ref}两侧中英文间空白。未避免产生不正常的空白宽度,请不要在\tnx{ref}两侧输入空格。仅在\optx{language}等于|zh|时有效。
+% \item[false] 保持原始\tnx{ref}命令效果。
+% \end{optdesc}
+% \subsection{Caption配置}
+% \label{Caption配置}
+% \changes{v1.0.0.0}{2022/04/14}{设置图、表、算法标签与后面标题之间的间距}
+% \begin{function}[added=2022-04-14]{style/caption-label-sep}
+% \begin{syntax}
+% \optx{style/caption-label-sep}=\argx{间距}
+% \end{syntax}
+% 设置图、表、算法标签与后面标题之间的间距,默认值为\valuex{0.75em}。
+% \end{function}
% \begin{function}[added=2022-04-03]{style/fig-label-sep}
+% 已弃用。
+% \end{function}
+% \subsection{表格配置}
+% \label{表格配置}
+% \changes{v0.10.0.1}{2022/04/13}{补充表格内容字号文档说明}
+% \begin{function}[added=2022-04-13,updated=2022-04-15]{style/table-small-font}
% \begin{syntax}
-% \optx{style/fig-label-sep}=\argx{间距}
+% \optx{style/table-small-font}=\metax{(true)|false}
% \end{syntax}
-% 设置图片标签与后面标题之间的间距,默认值为\valuex{0.75em}。
+% 设置表格内容字号是否为五号。
% \end{function}
+% \begin{optdesc}
+% \item[true] 五号。
+% \item[false] 小四号。
+% \end{optdesc}
+% \subsection{算法配置}
+% \label{算法配置}
+% \begin{function}[added=2022-04-15]{style/algorithm-small-font}
+% \begin{syntax}
+% \optx{style/algorithm-small-font}=\metax{(true)|false}
+% \end{syntax}
+% 设置算法内容字号是否为五号。
+% \end{function}
+% \begin{optdesc}
+% \item[true] 五号。
+% \item[false] 小四号。
+% \end{optdesc}
% \subsection{章节配置}
% \label{章节配置}
% \begin{function}[added=2022-04-05]{style/before-skip}
@@ -756,8 +817,8 @@
% \begin{variable}
% {
% \l_@@_cjk_font_tl,
-% \l_@@_fake_bold_str,
-% \l_@@_fake_slant_str,
+% \l_@@_fake_bold_tl,
+% \l_@@_fake_slant_tl,
% \l_@@_latin_font_tl,
% \l_@@_math_font_tl,
% \l_@@_unicode_math_tl,
@@ -768,13 +829,14 @@
% \begin{macrocode}
\tl_new:N \l_@@_cjk_font_tl
% \end{macrocode}
+% \changes{v0.8.2.0}{2022/04/12}{修复LaTeX3新接口导致的Overleaf无法编译}
% 中文字体伪粗体粗细程度。
% \begin{macrocode}
-\str_new:N \l_@@_fake_bold_str
+\tl_new:N \l_@@_fake_bold_tl
% \end{macrocode}
% 中文字体伪斜体倾斜程度。
% \begin{macrocode}
-\str_new:N \l_@@_fake_slant_str
+\tl_new:N \l_@@_fake_slant_tl
% \end{macrocode}
% 英文字体配置名称。
% \begin{macrocode}
@@ -811,15 +873,15 @@
% \end{macrocode}
% 中文字体伪粗体粗细程度。
% \begin{macrocode}
- cjk-fake-bold .str_set:N = \l_@@_fake_bold_str,
+ cjk-fake-bold .tl_set:N = \l_@@_fake_bold_tl,
% \end{macrocode}
% 中文字体伪斜体倾斜程度。
% \begin{macrocode}
- cjk-fake-slant .str_set:N = \l_@@_fake_slant_str,
+ cjk-fake-slant .tl_set:N = \l_@@_fake_slant_tl,
% \end{macrocode}
% 英文字体配置。
% \begin{macrocode}
- latin-font .choices:nn = { tacn, thcs, none }
+ latin-font .choices:nn = { tacn, thcs, gyre, none }
{ \tl_set_eq:NN \l_@@_latin_font_tl \l_keys_choice_tl },
% \end{macrocode}
% 数学字体配置。
@@ -844,18 +906,19 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\keys_set:nn}
+% \changes{v0.9.1.0}{2022/04/13}{修改中英文字体默认配置}
% 初始设置。
% \begin{macrocode}
\keys_set:nn { xdu }
{
- style / cjk-font = win,
- style / cjk-fake-bold = 3,
- style / cjk-fake-slant = 0.2,
- style / latin-font = tacn,
- style / math-font = cm,
- style / unicode-math = { },
- style / font-type = font,
- style / font-path = fonts
+ style / cjk-font = fandol,
+ style / cjk-fake-bold = 3,
+ style / cjk-fake-slant = 0.2,
+ style / latin-font = gyre,
+ style / math-font = cm,
+ style / unicode-math = { },
+ style / font-type = font,
+ style / font-path = fonts
}
% \end{macrocode}
% \end{macro}
@@ -925,7 +988,7 @@
\cs_new:Npn \@@_cfg_cjk_font_sub_fb:n #1
{
BoldFont = { #1 },
- BoldFeatures = { FakeBold = \l_@@_fake_bold_str }
+ BoldFeatures = { FakeBold = \l_@@_fake_bold_tl }
}
% \end{macrocode}
% \end{macro}
@@ -935,7 +998,7 @@
\cs_new:Npn \@@_cfg_cjk_font_sub_fs:n #1
{
SlantedFont = { #1 },
- SlantedFeatures = { FakeSlant = \l_@@_fake_slant_str }
+ SlantedFeatures = { FakeSlant = \l_@@_fake_slant_tl }
}
% \end{macrocode}
% \end{macro}
@@ -947,8 +1010,8 @@
BoldSlantedFont = { #1 },
BoldSlantedFeatures =
{
- FakeBold = \l_@@_fake_bold_str,
- FakeSlant = \l_@@_fake_slant_str
+ FakeBold = \l_@@_fake_bold_tl,
+ FakeSlant = \l_@@_fake_slant_tl
}
}
% \end{macrocode}
@@ -959,7 +1022,7 @@
\cs_new:Npn \@@_cfg_cjk_font_sub_bfs:n #1
{
BoldSlantedFont = { #1 },
- BoldSlantedFeatures = { FakeSlant = \l_@@_fake_slant_str }
+ BoldSlantedFeatures = { FakeSlant = \l_@@_fake_slant_tl }
}
% \end{macrocode}
% \end{macro}
@@ -978,7 +1041,7 @@
\cs_new:Npn \@@_cfg_cjk_font_sub_fi:n #1
{
ItalicFont = { #1 },
- ItalicFeatures = { FakeSlant = \l_@@_fake_slant_str }
+ ItalicFeatures = { FakeSlant = \l_@@_fake_slant_tl }
}
% \end{macrocode}
% \end{macro}
@@ -988,7 +1051,7 @@
\cs_new:Npn \@@_cfg_cjk_font_sub_ifb:n #1
{
BoldItalicFont = { #1 },
- BoldItalicFeatures = { FakeBold = \l_@@_fake_bold_str }
+ BoldItalicFeatures = { FakeBold = \l_@@_fake_bold_tl }
}
% \end{macrocode}
% \end{macro}
@@ -1000,8 +1063,8 @@
BoldItalicFont = { #1 },
BoldItalicFeatures =
{
- FakeBold = \l_@@_fake_bold_str,
- FakeSlant = \l_@@_fake_slant_str
+ FakeBold = \l_@@_fake_bold_tl,
+ FakeSlant = \l_@@_fake_slant_tl
}
}
% \end{macrocode}
@@ -1207,7 +1270,6 @@
% \begin{macrocode}
\cs_new:Npn \@@_set_latin_font:nnn #1#2#3
{
- \@@_font_path:
BoldFont = { #1 },
SlantedFont = { #2 },
BoldSlantedFont = { #3 },
@@ -1216,6 +1278,22 @@
}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\@@_off_latin_ligatures:}
+% \changes{v0.8.3.0}{2022/04/13}{匹配小写字母字符高度}
+% 匹配小写字母字符高度。
+% \begin{macrocode}
+\cs_new:Npn \@@_set_latin_scale:
+ { Scale = MatchLowercase , }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@_off_latin_ligatures:}
+% \changes{v0.8.3.0}{2022/04/13}{关闭连字}
+% 关闭连字。
+% \begin{macrocode}
+\cs_new:Npn \@@_off_latin_ligatures:
+ { Ligatures = CommonOff , }
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\@@_set_latin_main_font:nnnnn}
% 配置英文罗马族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。
% \begin{arguments}
@@ -1230,11 +1308,18 @@
{
\str_if_eq:NNTF { \l_@@_font_type_tl } { font }
{ \setmainfont { #1 } }
- { \setmainfont { #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ {
+ \setmainfont { #2 }
+ [
+ \@@_font_path:
+ \@@_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@@_set_latin_sans_font:nnnnn}
+% \changes{v0.8.3.0}{2022/04/13}{修正英文无衬线族字体字符高度}
% 配置英文无衬线族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。
% \begin{arguments}
% \item 字体名称。
@@ -1247,12 +1332,20 @@
\cs_new:Npn \@@_set_latin_sans_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l_@@_font_type_tl } { font }
- { \setsansfont { #1 } }
- { \setsansfont { #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ { \setsansfont { #1 } [ \@@_set_latin_scale: ] }
+ {
+ \setsansfont { #2 }
+ [
+ \@@_font_path:
+ \@@_set_latin_scale:
+ \@@_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@@_set_latin_mono_font:nnnnn}
+% \changes{v0.8.3.0}{2022/04/13}{修正英文等宽族字体字符高度并取消连字}
% 配置英文等宽族字体,参数分别为字体名称、字体文件名称(常规、粗体、意大利体、粗意大利体)。
% \begin{arguments}
% \item 字体名称。
@@ -1265,8 +1358,76 @@
\cs_new:Npn \@@_set_latin_mono_font:nnnnn #1#2#3#4#5
{
\str_if_eq:NNTF { \l_@@_font_type_tl } { font }
- { \setmonofont{ #1 } }
- { \setmonofont{ #2 } [ \@@_set_latin_font:nnn { #3 } { #4 } { #5 } ] }
+ { \setmonofont{ #1 } [ \@@_set_latin_scale: \@@_off_latin_ligatures: ]}
+ {
+ \setmonofont{ #2 }
+ [
+ \@@_font_path:
+ \@@_set_latin_scale:
+ \@@_off_latin_ligatures:
+ \@@_set_latin_font:nnn { #3 } { #4 } { #5 }
+ ]
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@_set_latin_main_font:nnnn}
+% \changes{v0.9.0.0}{2022/04/13}{配置TeX Live内置英文罗马族字体}
+% 配置英文罗马族字体,参数分别为字体文件名称(常规、粗体、意大利体、粗意大利体)。
+% \begin{arguments}
+% \item 常规字体名称。
+% \item 粗体字体名称。
+% \item 意大利体字体名称。
+% \item 粗意大利体字体名称。
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \@@_set_latin_main_font:nnnn #1#2#3#4
+ {
+ \setmainfont { #1 }
+ [
+ \@@_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@_set_latin_sans_font:nnnn}
+% \changes{v0.9.0.0}{2022/04/13}{配置TeX Live内置英文无衬线族字体}
+% 配置英文无衬线族字体,参数分别为字体文件名称(常规、粗体、意大利体、粗意大利体)。
+% \begin{arguments}
+% \item 常规字体名称。
+% \item 粗体字体名称。
+% \item 意大利体字体名称。
+% \item 粗意大利体字体名称。
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \@@_set_latin_sans_font:nnnn #1#2#3#4
+ {
+ \setsansfont { #1 }
+ [
+ \@@_set_latin_scale:
+ \@@_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@_set_latin_mono_font:nnnn}
+% \changes{v0.9.0.0}{2022/04/13}{配置TeX Live内置英文等宽族字体}
+% 配置英文等宽族字体,参数分别为字体文件名称(常规、粗体、意大利体、粗意大利体)。
+% \begin{arguments}
+% \item 常规字体名称。
+% \item 粗体字体名称。
+% \item 意大利体字体名称。
+% \item 粗意大利体字体名称。
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \@@_set_latin_mono_font:nnnn #1#2#3#4
+ {
+ \setmonofont{ #1 }
+ [
+ \@@_set_latin_scale:
+ \@@_off_latin_ligatures:
+ \@@_set_latin_font:nnn { #2 } { #3 } { #4 }
+ ]
}
% \end{macrocode}
% \end{macro}
@@ -1310,6 +1471,30 @@
}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\@@_load_latin_font_gyre:}
+% \changes{v0.9.0.0}{2022/04/13}{新增gyre系列英文字体配置}
+% 英文字体配置\valuex{gyre}。
+% \begin{macrocode}
+\cs_new:Npn \@@_load_latin_font_gyre:
+ {
+ \@@_set_latin_main_font:nnnn
+ { texgyretermes-regular.otf }
+ { texgyretermes-bold.otf }
+ { texgyretermes-italic.otf }
+ { texgyretermes-bolditalic.otf }
+ \@@_set_latin_sans_font:nnnn
+ { texgyreheros-regular.otf }
+ { texgyreheros-bold.otf }
+ { texgyreheros-italic.otf }
+ { texgyreheros-bolditalic.otf }
+ \@@_set_latin_mono_font:nnnn
+ { texgyrecursor-regular.otf }
+ { texgyrecursor-bold.otf }
+ { texgyrecursor-italic.otf }
+ { texgyrecursor-bolditalic.otf }
+ }
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\@@_load_latin_font_none:}
% 英文字体配置\valuex{none}。
% \begin{macrocode}
@@ -1608,7 +1793,9 @@
% \l_@@_lang_tl,
% \l_@@_bib_tool_tl,
% \l_@@_bib_file_clist,
-% \l_@@_fig_label_sep_tl,
+% \l_@@_cap_label_sep_tl,
+% \l_@@_tab_small_bool,
+% \l_@@_alg_small_bool,
% \l_@@_before_skip_clist,
% \l_@@_after_skip_clist,
% \l_@@_chap_tl,
@@ -1616,7 +1803,8 @@
% \l_@@_subsec_tl,
% \l_@@_subsubsec_tl,
% \l_@@_para_tl,
-% \l_@@_subpara_tl
+% \l_@@_subpara_tl,
+% \l_@@_sym_mgn_bool
% }
% 英文是否使用中文字体。
% \begin{macrocode}
@@ -1634,9 +1822,21 @@
% \begin{macrocode}
\clist_new:N \l_@@_bib_file_clist
% \end{macrocode}
-% 图片标签与后面标题之间的间距。
+% 是否在\tnx{ref}两侧自动调整中英文间空白。
+% \begin{macrocode}
+\tl_new:N \l_@@_ref_add_space
+% \end{macrocode}
+% 标签与后面标题之间的间距。
+% \begin{macrocode}
+\tl_new:N \l_@@_cap_label_sep_tl
+% \end{macrocode}
+% 设置表格字号是否为五号。
% \begin{macrocode}
-\tl_new:N \l_@@_fig_label_sep_tl
+\bool_new:N \l_@@_tab_small_bool
+% \end{macrocode}
+% 设置算法字号是否为五号。
+% \begin{macrocode}
+\bool_new:N \l_@@_alg_small_bool
% \end{macrocode}
% 设置章节标题前后的垂直间距。
% \begin{macrocode}
@@ -1652,6 +1852,10 @@
\tl_new:N \l_@@_para_tl
\tl_new:N \l_@@_subpara_tl
% \end{macrocode}
+% 设置页边距是否对称。
+% \begin{macrocode}
+\bool_new:N \l_@@_sym_mgn_bool
+% \end{macrocode}
% \end{variable}
% \begin{macro}{\keys_define:nn}
% 定义样式键值。
@@ -1677,9 +1881,21 @@
% \begin{macrocode}
bib-resource .clist_set:N = \l_@@_bib_file_clist,
% \end{macrocode}
-% 图片标签与后面标题之间的间距。
+% 是否在\tnx{ref}两侧自动调整中英文间空白。
% \begin{macrocode}
- fig-label-sep .tl_set:N = \l_@@_fig_label_sep_tl,
+ ref-add-space .bool_set:N = \l_@@_ref_add_space,
+% \end{macrocode}
+% 标签与后面标题之间的间距。
+% \begin{macrocode}
+ caption-label-sep .tl_set:N = \l_@@_cap_label_sep_tl,
+% \end{macrocode}
+% 设置表格字号是否为五号。
+% \begin{macrocode}
+ table-small-font .bool_set:N = \l_@@_tab_small_bool,
+% \end{macrocode}
+% 设置算法字号是否为五号。
+% \begin{macrocode}
+ algorithm-small-font .bool_set:N = \l_@@_alg_small_bool,
% \end{macrocode}
% 设置章节标题前的垂直间距。
% \begin{macrocode}
@@ -1696,7 +1912,11 @@
subsec-zihao .tl_set:N = \l_@@_subsec_tl,
subsubsec-zihao .tl_set:N = \l_@@_subsubsec_tl,
para-zihao .tl_set:N = \l_@@_para_tl,
- subpara-zihao .tl_set:N = \l_@@_subpara_tl
+ subpara-zihao .tl_set:N = \l_@@_subpara_tl,
+% \end{macrocode}
+% 设置页边距是否对称。
+% \begin{macrocode}
+ symmetric-margin .bool_set:N = \l_@@_sym_mgn_bool
}
% \end{macrocode}
% \end{macro}
@@ -1705,13 +1925,17 @@
% \begin{macrocode}
\keys_set:nn { xdu }
{
- style / en-cjk-font = false,
- style / language = zh,
- style / bib-backend = biblatex,
- style / bib-resource = { },
- style / fig-label-sep = { 0.75em },
- style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt },
- style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt }
+ style / en-cjk-font = false,
+ style / language = zh,
+ style / bib-backend = biblatex,
+ style / bib-resource = { },
+ style / ref-add-space = false,
+ style / caption-label-sep = { 0.75em },
+ style / table-small-font = true,
+ style / algorithm-small-font = true,
+ style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt },
+ style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt },
+ style / symmetric-margin = false
}
% \end{macrocode}
% \end{macro}
@@ -1847,10 +2071,10 @@
}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\@@_n_chapter_head:nn}
+% \begin{macro}{\@@_n_chapter_head_ii:nn}
% 新建无编号章节并添加页眉和书签并单独设置标题样式。
% \begin{macrocode}
-\cs_new:Npn \@@_n_chapter_head:nn #1#2
+\cs_new:Npn \@@_n_chapter_head_ii:nn #1#2
{
{
\ctexset { chapter / format = { #2 } }
@@ -1859,14 +2083,46 @@
}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\@@_n_chapter_head:nn}
+% \changes{v1.1.4.0}{2022/04/16}{新建无编号章节并单独添加页眉和书签}
+% 新建无编号章节并添加页眉和书签,多用于章节标题为2个汉字的情况。
+% \begin{arguments}
+% \item 书签和页眉处。
+% \item 章节标题处。
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \@@_n_chapter_head:nn #1#2
+ {
+ \@@_add_bookmark:n { #1 }
+ \chapter* { #2 }
+ \markboth { #1 } { }
+ }
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\@@_n_chapter_head_toc:n}
% 新建无编号章节并添加目录及页眉。
% \begin{macrocode}
\cs_new:Npn \@@_n_chapter_head_toc:n #1
{
\@@_add_toc:n { #1 }
- \chapter* { #1 }
- \markboth { #1 } { }
+ \chapter* { #1 }
+ \markboth { #1 } { }
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@_n_chapter_head_toc:nn}
+% \changes{v1.1.4.0}{2022/04/16}{新建无编号章节并单独添加目录及页眉}
+% 新建无编号章节并添加目录及页眉,多用于章节标题为2个汉字的情况。
+% \begin{arguments}
+% \item 目录、书签、页眉处。
+% \item 章节标题处。
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \@@_n_chapter_head_toc:nn #1#2
+ {
+ \@@_add_toc:n { #1 }
+ \chapter* { #2 }
+ \markboth { #1 } { }
}
% \end{macrocode}
% \end{macro}
@@ -1913,18 +2169,44 @@
}
\savegeometry { main }
% \end{macrocode}
-% 封面页面:上2.5厘米、下2.5厘米、内侧3厘米、外侧2厘米。
+% 左右对称正文页面:上3厘米、下2厘米、内侧3厘米、外侧3厘米;页眉2厘米;页脚1厘米。
+% \begin{macrocode}
+\newgeometry
+ {
+ top = 3cm,
+ bottom = 2cm,
+ inner = 3cm,
+ outer = 3cm,
+ head = 2cm,
+ foot = 1cm
+ }
+\savegeometry { main-sym }
+% \end{macrocode}
+% 封面页面:上2.5厘米、下2厘米、内侧3厘米、外侧2厘米。
+% \changes{v0.10.3.0}{2022/04/14}{修复封面超页}
% \begin{macrocode}
\newgeometry
{
top = 2.5cm,
- bottom = 2.5cm,
+ bottom = 2cm,
inner = 3cm,
outer = 2cm
}
\savegeometry { cover }
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\@@_load_main_geometry:}
+% \changes{v0.8.0.0}{2022/04/12}{根据用户配置加载正文页边距配置}
+% 根据用户配置加载正文页边距配置。
+% \begin{macrocode}
+\cs_new:Npn \@@_load_main_geometry:
+ {
+ \bool_if:NTF \l_@@_sym_mgn_bool
+ { \loadgeometry { main-sym } }
+ { \loadgeometry { main } }
+ }
+% \end{macrocode}
+% \end{macro}
% \subsubsection{页眉页脚}
% \begin{macro}{\chaptermark}
% 设置奇数页页眉为章标题。
@@ -2174,14 +2456,114 @@
\renewcommand { \theequation } { \thechapter - \arabic { equation } }
% \end{macrocode}
% \end{macro}
-% \subsection{图片}
+% \subsection{算法}
+% \begin{macro}{\ALG@name,\algorithmcfname}
+% \changes{v1.1.1.0}{2022/04/15}{汉化算法标签名称}
+% 算法标签名称。
+% \begin{macrocode}
+\ctex_at_end_preamble:n
+ {
+ \clist_map_inline:nn
+ {
+ { \algorithmname },
+ { \ALG@name },
+ { \algorithmcfname }
+ }
+ { \cs_set:Npn #1 { \@@_lang_switch:nn { 算法 } { Algorithm } } }
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thealgorithm,\floatplacement}
+% \changes{v0.10.1.0}{2022/04/13}{重定义算法编号样式}
+% \changes{v0.10.2.0}{2022/04/14}{修正算法环境未加载导致的无法编译}
+% \changes{v0.10.4.0}{2022/04/14}{修正\pkgx{algorithm}算法编号样式}
+% \changes{v1.0.1.0}{2022/04/14}{修改\pkgx{algorithm}算法浮动体默认浮动位置}
+% \changes{v1.1.2.0}{2022/04/15}{检测是否加载\pkgx{algorithm}}
+% 重定义\pkgx{algorithm}宏包算法编号样式并修改默认浮动位置。
+% \begin{macrocode}
+\PassOptionsToPackage { chapter } { algorithm }
+\ctex_at_end_preamble:n
+ {
+ \@ifpackageloaded { algorithm }
+ {
+ \cs_if_exist:NT \thealgorithm
+ {
+ \floatplacement { algorithm } { tbp }
+ \cs_set:Npn \thealgorithm { \thechapter . \arabic { algorithm } }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\renewenvironment}
+% \changes{v1.1.0.0}{2022/04/15}{设置\pkgx{algorithm}算法内容字号}
+% 设置\pkgx{algorithm}算法内容字号。
+% \begin{macrocode}
+ \bool_if:NT \l_@@_alg_small_bool
+ {
+ \renewenvironment { algorithm }
+ {
+ \@nameuse { fst@algorithm }
+ \@float@setevery { algorithm }
+ \ctex_gadd_ltxhook:nn
+ { cmd/@floatboxreset/after }
+ { \zihao { 5 } }
+ \@float { algorithm }
+ }
+ { \float@end }
+ }
+ }
+ }
+ { }
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thealgocf}
+% \changes{v0.10.4.0}{2022/04/14}{修正\pkgx{algorithm2e}算法编号样式}
+% \changes{v1.1.2.0}{2022/04/15}{检测是否加载\pkgx{algorithm2e}}
+% 重定义\pkgx{algorithm2e}宏包算法编号样式。
+% \begin{macrocode}
+\PassOptionsToPackage { algochapter } { algorithm2e }
+\ctex_at_end_preamble:n
+ {
+ \@ifpackageloaded { algorithm2e }
+ {
+ \cs_if_exist:NT \thealgocf
+ {
+ \cs_set:Npn \thealgocf { \thechapter . \arabic { algocf } }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\renewenvironment}
+% \changes{v1.0.3.0}{2022/04/15}{修改\pkgx{algorithm2e}算法浮动体默认浮动位置}
+% 修改\pkgx{algorithm2e}算法浮动体默认浮动位置。
+% \begin{macrocode}
+ \renewenvironment { \algocf@envname } [ 1 ] [ tbp ]
+ {
+ \setboolean { algocf@algostar } { false }
+ \setboolean { algocf@procenvironment } { false }
+ \gdef \algocfautorefname { \algorithmautorefname }
+ \begin { algocf@algorithm } [ #1 ] \ignorespaces
+ }
+ { \end { algocf@algorithm } \ignorespacesafterend }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\SetAlFnt}
+% \changes{v1.1.0.0}{2022/04/15}{设置\pkgx{algorithm2e}算法内容字号}
+% 设置\pkgx{algorithm2e}算法内容字号。
+% \begin{macrocode}
+ \bool_if:NT \l_@@_alg_small_bool
+ { \SetAlFnt { \zihao { 5 } } }
+ }
+ }
+ { }
+ }
+% \end{macrocode}
+% \end{macro}
+% \subsection{Caption}
% \begin{macro}{\DeclareCaptionLabelSeparator,\DeclareCaptionFont,\captionsetup}
% \changes{v0.1.2.0}{2022/04/03}{设置图片标签与后面标题之间的间距}
% \changes{v0.1.3.0}{2022/04/03}{设置图片标签与标题字体字号}
-% 设置图片标签与后面标题之间的间距。
+% 设置图表标签与后面标题之间的间距。
% \begin{macrocode}
\RequirePackage { caption }
-\DeclareCaptionLabelSeparator { customskip } { \hskip \l_@@_fig_label_sep_tl }
+\DeclareCaptionLabelSeparator { customskip } { \hskip \l_@@_cap_label_sep_tl }
\DeclareCaptionFont { customfont } { \@@_rm_family: \zihao { 5 } }
\captionsetup
{
@@ -2190,6 +2572,37 @@
}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\captionsetup}
+% \changes{v1.0.4.0}{2022/04/15}{设置\pkgx{algorithm}算法标签与标题字体字号及标签与后面标题之间的间距}
+% \changes{v1.1.3.0}{2022/04/15}{修正\pkgx{algorithm}算法标签字体系列}
+% 设置\pkgx{algorithm}算法标签与标题字体字号及标签与后面标题之间的间距。
+% \begin{macrocode}
+\captionsetup [ algorithm ]
+ {
+ labelsep = customskip,
+ labelfont = customfont,
+ font = customfont
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\SetAlgoCaptionSeparator,\SetAlCapNameFnt,\SetAlCapFnt}
+% \changes{v1.0.0.0}{2022/04/14}{修正\pkgx{algorithm2e}算法标签与后面标题之间的间距}
+% \changes{v1.0.4.0}{2022/04/15}{修正\pkgx{algorithm2e}算法标签与标题字体字号}
+% 设置\pkgx{algorithm2e}算法标签与标题字体字号及标签与后面标题之间的间距。
+% \begin{macrocode}
+\ctex_at_end_preamble:n
+ {
+ \cs_if_exist:NT \thealgocf
+ {
+ \SetAlgoCaptionSeparator { \hbox_to_wd:nn { \l_@@_cap_label_sep_tl } { } }
+ \SetAlCapNameFnt { \@@_rm_family: \zihao { 5 } }
+ \SetAlCapFnt { \@@_rm_family: \zihao { 5 } }
+ \SetAlCapSty { }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+% \subsection{图片}
% \begin{macro}{\PassOptionsToPackage,\captionsetup}
% \changes{v0.4.2.0}{2022/04/05}{设置子图标签与标题字体字号}
% 设置子图标签与标题字体字号,支持\pkgx{subfig}和\pkgx{subcaption}宏包。
@@ -2198,6 +2611,23 @@
\captionsetup [ sub ] { font = customfont }
% \end{macrocode}
% \end{macro}
+% \subsection{表格}
+% \changes{v0.10.0.0}{2022/04/13}{设置表格字号是否为五号}
+% \changes{v1.0.2.0}{2022/04/14}{修复表格五号字无法设定浮动位置}
+% \begin{macro}{table}
+% 设置表格字号是否为五号。
+% \begin{macrocode}
+\ctex_at_end_preamble:n
+ {
+ \bool_if:NT \l_@@_tab_small_bool
+ {
+ \renewenvironment { table }
+ { \def\@floatboxreset { \reset@font\small\@setminipage } \@float { table } }
+ { \end@float }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
% \subsection{超链接和PDF元数据}
% \begin{macro}{\hyperref}
% 配置超链接和PDF元数据。
@@ -2220,6 +2650,35 @@
}
% \end{macrocode}
% \end{macro}
+% \subsection{交叉引用}
+% \begin{macro}{\@@_trad_ref:n,\ref}
+% \changes{v1.2.0.0}{2022/04/16}{优化中文环境下\tnx{ref}两侧中英文间空白}
+% 优化中文环境下\tnx{ref}两侧中英文间空白。
+% \begin{macrocode}
+\ctex_at_end_preamble:n
+ {
+ \bool_if:NT \l_@@_ref_add_space
+ {
+ \str_if_eq:NNT { \l_@@_lang_tl } { zh }
+ {
+ \RequirePackage { xspace }
+ \xspaceaddexceptions { 。?!,、;:“”‘’—….--~·《》<>_ }
+ \cs_generate_variant:Nn \str_if_in:nnTF { xnTF }
+ \ctex_after_end_preamble:n
+ {
+ \cs_set_eq:NN \@@_trad_ref:n \ref
+ \cs_set:Npn \ref #1
+ {
+ \str_if_in:xnTF { \__hyp_get_anchor:n { #1 } } { chapter }
+ { \@@_trad_ref:n { #1 } }
+ { \xspace \@@_trad_ref:n { #1 } \xspace }
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
% \subsection{参考文献}
% \begin{macro}{\@@_begin_document:n}
% 钩子。
@@ -2251,6 +2710,8 @@
% 附录环境。
% \changes{v0.3.0.0}{2022/04/04}{新增附录环境}
% \changes{v0.3.1.0}{2022/04/04}{修正附录中图表编号样式}
+% \changes{v0.10.2.0}{2022/04/14}{修正附录中算法编号样式}
+% \changes{v0.10.4.0}{2022/04/14}{修正附录中\pkgx{algorithm2e}算法编号样式}
% \begin{macrocode}
\RequirePackage { environ }
\NewEnviron { appendixes }
@@ -2258,6 +2719,10 @@
\appendix
\renewcommand { \thefigure } { \thechapter \arabic { figure } }
\renewcommand { \thetable } { \thechapter \arabic { table } }
+ \cs_if_exist:NT \thealgorithm
+ { \cs_set:Npn \thealgorithm { \thechapter \arabic { algorithm } } }
+ \cs_if_exist:NT \thealgocf
+ { \cs_set:Npn \thealgocf { \thechapter \arabic { algocf } } }
\BODY
}
% \end{macrocode}
@@ -2368,7 +2833,16 @@
\cs_generate_variant:Nn \@@_split_title:Nn { NV }
% \end{macrocode}
% \end{macro}
+% \begin{variable}{\l_@@_is_ent_bool,\l_@@_is_wide_bool}
+% \changes{v0.8.1.0}{2022/04/12}{封面导师标签标志位}
+% 是否为校外毕设,是否为宽名称。
+% \begin{macrocode}
+\bool_new:N \l_@@_is_ent_bool
+\bool_new:N \l_@@_is_wide_bool
+% \end{macrocode}
+% \end{variable}
% \begin{macro}{\@@_cover_iii:nnnn}
+% \changes{v0.8.1.0}{2022/04/12}{使用标志位计算论文信息标签宽度}
% \changes{v0.1.4.0}{2022/04/03}{自动调整论文信息标签宽度}
% 绘制论文信息并自动调整论文信息标签宽度。
% \begin{arguments}
@@ -2380,11 +2854,17 @@
% \begin{macrocode}
\ctex_at_end_preamble:n
{
+ \tl_if_blank:VF \l_@@_supv_dept_str
+ { \bool_set_true:N \l_@@_is_wide_bool }
+ \tl_if_blank:VF \l_@@_supv_ent_str
+ { \bool_set_true:N \l_@@_is_wide_bool }
+ \tl_if_blank:VF \l_@@_supv_sch_str
+ { \bool_set_true:N \l_@@_is_wide_bool }
\cs_new:Npn \@@_cover_iii:nnnn #1#2#3#4
{
- \tl_if_blank:VTF \l_@@_supv_dept_str
- { \@@_cover_iii:nnnnn { 4em } { #1 } { #2 } { #3 } { #4 } }
+ \bool_if:NTF \l_@@_is_wide_bool
{ \@@_cover_iii:nnnnn { 6em } { #1 } { #2 } { #3 } { #4 } }
+ { \@@_cover_iii:nnnnn { 4em } { #1 } { #2 } { #3 } { #4 } }
}
}
% \end{macrocode}
@@ -2434,9 +2914,14 @@
\@@_cover_iii:nnnn { 专业 } { rm } { -3 } { \l_@@_major_str }
\@@_cover_iii:nnnn { 学生姓名 } { rm } { -3 } { \l_@@_author_str }
% \end{macrocode}
+% \changes{v0.8.1.0}{2022/04/12}{修正封面论文信息标签宽度}
% 校外毕设,排版校外导师姓名、校内导师姓名。
% \begin{macrocode}
- \tl_if_blank:VTF \l_@@_supv_str
+ \tl_if_blank:VF \l_@@_supv_ent_str
+ { \bool_set_true:N \l_@@_is_ent_bool }
+ \tl_if_blank:VF \l_@@_supv_sch_str
+ { \bool_set_true:N \l_@@_is_ent_bool }
+ \bool_if:NTF \l_@@_is_ent_bool
{
\@@_cover_iii:nnnn { 校外导师姓名 } { rm } { -3 } { \l_@@_supv_ent_str }
\@@_cover_iii:nnnn { 校内导师姓名 } { rm } { -3 } { \l_@@_supv_sch_str }
@@ -2457,15 +2942,18 @@
}
\cleardoublepage
% \end{macrocode}
+% \changes{v0.8.0.0}{2022/04/12}{支持对称页边距}
% 更换页面尺寸、页面样式和页码样式。
% \begin{macrocode}
- \loadgeometry { main }
+ \@@_load_main_geometry:
\pagestyle { plain }
\pagenumbering { Roman }
% \end{macrocode}
% 中文摘要,宋体小四号。
% \begin{macrocode}
- \@@_n_chapter_head:n { 摘要 }
+ \@@_n_chapter_head:nn
+ { 摘要 }
+ { 摘 { \quad } 要 }
{
\dim_set:Nn \parindent { 2\ccwd }
\rmfamily \zihao { -4 }
@@ -2483,7 +2971,7 @@
% 英文摘要,Times New Roman字体,小四号。
% \changes{v0.4.3.0}{2022/04/05}{修正英文摘要标题字体}
% \begin{macrocode}
- \@@_n_chapter_head:nn {ABSTRACT} { \rmfamily \zihao{3} \bfseries \centering }
+ \@@_n_chapter_head_ii:nn {ABSTRACT} { \rmfamily \zihao{3} \bfseries \centering }
{
\dim_set:Nn \parindent { 2\ccwd }
\rmfamily \zihao { -4 }
@@ -2498,23 +2986,27 @@
}
\cleardoublepage
% \end{macrocode}
+% \changes{v1.1.4.0}{2022/04/16}{为目录章节标题增加间距}
+% \changes{v1.1.5.0}{2022/04/16}{目录中移除目录章节}
% 目录。
% \begin{macrocode}
\setcounter { tocdepth } { 5 }
- \tl_set:Nn \contentsname { \@@_lang_switch:nn { 目录 } { Contents } }
- \@@_add_bookmark:n { \contentsname }
- \tableofcontents
+ \@@_n_chapter_head:nn
+ { \@@_lang_switch:nn { 目录 } { Contents } }
+ { \@@_lang_switch:nn { 目 { \quad } 录 } { Contents } }
+ \@starttoc { toc }
\cleardoublepage
}
% \end{macrocode}
% \end{macro}
% \subsection{正文}
% \begin{macro}{\mainmatter}
+% \changes{v0.8.0.0}{2022/04/12}{支持对称页边距}
% 排版正文部分。
% \begin{macrocode}
\renewcommand{\mainmatter}
{
- \loadgeometry { main }
+ \@@_load_main_geometry:
\pagestyle { plain }
\pagenumbering { arabic }
\dim_set:Nn \parindent { 2\ccwd }
@@ -2528,9 +3020,12 @@
\renewcommand{\backmatter}
{
% \end{macrocode}
+% \changes{v1.1.4.0}{2022/04/16}{为致谢章节标题增加间距}
% 致谢。
% \begin{macrocode}
- \@@_n_chapter_head_toc:n { \@@_lang_switch:nn { 致谢 } { Acknowledgements } }
+ \@@_n_chapter_head_toc:nn
+ { \@@_lang_switch:nn { 致谢 } { Acknowledgements } }
+ { \@@_lang_switch:nn { 致 { \quad } 谢 } { Acknowledgements } }
{
\dim_set:Nn \parindent { 2\ccwd }
\rmfamily \zihao { -4 }
diff --git a/macros/xetex/latex/xduts/xduts.ins b/macros/xetex/latex/xduts/xduts.ins
index e5bbb7fdd8..fbd4017b14 100644
--- a/macros/xetex/latex/xduts/xduts.ins
+++ b/macros/xetex/latex/xduts/xduts.ins
@@ -2,22 +2,24 @@
\askforoverwritefalse
\preamble
- Copyright (C) 2022--\the\year by @note286 in GitHub
----------------------------------------------------------------------
+Copyright 2022--\the\year by @note286 in GitHub and CTAN
- This work may be distributed and/or modified under the
- conditions of the LaTeX Project Public License, either
- version 1.3c of this license or (at your option) any later
- version. This version of this license is in
- http://www.latex-project.org/lppl/lppl-1-3c.txt
- and the latest version of this license is in
- http://www.latex-project.org/lppl.txt
- and version 1.3 or later is part of all distributions of
- LaTeX version 2005/12/01 or later.
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
- This work has the LPPL maintenance status "maintained".
+This work has the LPPL maintenance status `author-maintained'.
----------------------------------------------------------------------
+The Current Maintainer of this work is @note286 in GitHub and CTAN.
+
+This work consists of the files README.md, xduts.dtx, and xduts.ins
+and the derived files xduts.pdf, xduugthesis.cls, and xdufont.sty.
+
+The copyright of xidian-text.pdf and xidian-logo.pdf is Xidian University.
\endpreamble
\postamble
diff --git a/macros/xetex/latex/xduts/xduts.pdf b/macros/xetex/latex/xduts/xduts.pdf
index e802bb7ff2..659f965266 100644
--- a/macros/xetex/latex/xduts/xduts.pdf
+++ b/macros/xetex/latex/xduts/xduts.pdf
Binary files differ