summaryrefslogtreecommitdiff
path: root/macros/latex/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-01-02 03:02:24 +0000
committerNorbert Preining <norbert@preining.info>2020-01-02 03:02:24 +0000
commitaf7bc18edca6890fb1addbeb6a34672275532e3b (patch)
treeb6274aa5bf5b395e381e80a870d068764b427537 /macros/latex/contrib
parent8cd36d1d38fe9da8a02a138e1984636379710e18 (diff)
CTAN sync 202001020302
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r--macros/latex/contrib/caption/README4
-rw-r--r--macros/latex/contrib/caption/bicaption.dtx6
-rw-r--r--macros/latex/contrib/caption/caption-deu.tex7
-rw-r--r--macros/latex/contrib/caption/caption-eng.tex7
-rw-r--r--macros/latex/contrib/caption/caption-rus.tex7
-rw-r--r--macros/latex/contrib/caption/caption.dtx86
-rw-r--r--macros/latex/contrib/caption/caption.ins2
-rw-r--r--macros/latex/contrib/caption/caption3.dtx30
-rw-r--r--macros/latex/contrib/caption/subcaption.dtx6
-rw-r--r--macros/latex/contrib/sanitize-umlaut/CHANGES27
-rw-r--r--macros/latex/contrib/sanitize-umlaut/README10
-rw-r--r--macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.doc.sty2
-rw-r--r--macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdfbin414201 -> 419322 bytes
-rw-r--r--macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty50
-rw-r--r--macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex69
-rw-r--r--macros/latex/contrib/secnum/README.md32
-rw-r--r--macros/latex/contrib/secnum/secnum.dtx470
-rw-r--r--macros/latex/contrib/secnum/secnum.pdfbin0 -> 57260 bytes
18 files changed, 709 insertions, 106 deletions
diff --git a/macros/latex/contrib/caption/README b/macros/latex/contrib/caption/README
index 74919d6378..092748d6ac 100644
--- a/macros/latex/contrib/caption/README
+++ b/macros/latex/contrib/caption/README
@@ -1,8 +1,8 @@
==========================================================================
The `caption' package bundle
-Release 2019-11-24
-Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+Release 2020-01-01
+Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
License: LPPL = LaTeX Project Public Licence
Maintenance Status: maintained (by Axel Sommerfeldt)
diff --git a/macros/latex/contrib/caption/bicaption.dtx b/macros/latex/contrib/caption/bicaption.dtx
index 49c9d1f508..bf6243a2f6 100644
--- a/macros/latex/contrib/caption/bicaption.dtx
+++ b/macros/latex/contrib/caption/bicaption.dtx
@@ -110,12 +110,6 @@
% \newcommand\NEWfeature{\NEW{New feature}}
% \newcommand\NEWdescription{\NEW{New description}}
%
-% \makeatletter
-% \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-% \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
-% \makeatother
-% \newcommand*\See[1]{\nopagebreak{\small (See #1)}}
-%
% \GetFileInfo{bicaption.drv}
% \let\docdate\filedate
% \let\docversion\fileversion
diff --git a/macros/latex/contrib/caption/caption-deu.tex b/macros/latex/contrib/caption/caption-deu.tex
index 420b823878..6a58b3ca9a 100644
--- a/macros/latex/contrib/caption/caption-deu.tex
+++ b/macros/latex/contrib/caption/caption-deu.tex
@@ -1,9 +1,6 @@
%
% This is file `caption-deu.tex'.
%
-% $Id$
-% $HeadURL$
-%
% Copyright (C) 1994-2012 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
@@ -172,8 +169,8 @@
{\endlist}
\makeatletter
-\newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-\newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+\def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+\def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
\newcommand*\SEE[3][]{\nopagebreak{#1(#2 #3)}}
\newcommand*\SeeUserDefined[1][]{\See{\Ref{declare}#1}}
\makeatother
diff --git a/macros/latex/contrib/caption/caption-eng.tex b/macros/latex/contrib/caption/caption-eng.tex
index 8aa5e47331..ef9fd38923 100644
--- a/macros/latex/contrib/caption/caption-eng.tex
+++ b/macros/latex/contrib/caption/caption-eng.tex
@@ -1,9 +1,6 @@
%
% This is file `caption-eng.tex'.
%
-% $Id$
-% $HeadURL$
-%
% Copyright (C) 1994-2012 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
@@ -165,8 +162,8 @@
{\endlist}
\makeatletter
-\newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-\newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+\def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+\def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
\newcommand*\SEE[3][]{\nopagebreak{#1(#2 #3)}}
\newcommand*\SeeUserDefined[1][]{\See{\Ref{declare}#1}}
\makeatother
diff --git a/macros/latex/contrib/caption/caption-rus.tex b/macros/latex/contrib/caption/caption-rus.tex
index c3b536cc2f..2082c375f0 100644
--- a/macros/latex/contrib/caption/caption-rus.tex
+++ b/macros/latex/contrib/caption/caption-rus.tex
@@ -2,9 +2,6 @@
% This is file `caption-rus.tex'.
% Russian translation of `caption-eng.tex'
%
-% $Id$
-% $HeadURL$
-%
% Copyright (C) 1994-2007 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
@@ -196,8 +193,8 @@
{\endlist}
\makeatletter
-\newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-\newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+\def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+\def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
\newcommand*\SEE[3][]{\nopagebreak{#1(#2 #3)}}
\newcommand*\SeeUserDefined[1][]{\See{\Ref{declare}#1}}
\makeatother
diff --git a/macros/latex/contrib/caption/caption.dtx b/macros/latex/contrib/caption/caption.dtx
index 3b0a396831..1bf4873143 100644
--- a/macros/latex/contrib/caption/caption.dtx
+++ b/macros/latex/contrib/caption/caption.dtx
@@ -2,7 +2,7 @@
%
% This is file `caption.dtx'.
%
-% Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
%
@@ -25,7 +25,7 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{2974}
+% \CheckSum{3006}
%
% \iffalse
%<*driver>
@@ -215,13 +215,13 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption}[2019/10/18 v3.4a Customizing captions (AR)]
+\ProvidesPackage{caption}[2020/01/01 v3.4c Customizing captions (AR)]
% \end{macrocode}
%
% \section{Loading the kernel}
%
% \begin{macrocode}
-\RequirePackage{caption3}[2019/09/09] % needs v1.8e or newer
+\RequirePackage{caption3}[2019/12/31] % needs v1.8f or newer
% \end{macrocode}
%
% \section{Check against unknown document classes}
@@ -1311,15 +1311,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\caption@typehook}
-% Hook which will be used inside |\caption@set|\-|type|.
-% It will be extended later on, e.g.~by our \package{float} package
-% support.
-% \begin{macrocode}
-\newcommand*\caption@typehook{}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\caption@iftype}
% \changes{v3.1}{2007/04/11}{This macro and its usage added}
% Since we often need to check if |\@captype| is defined (means: we
@@ -2600,6 +2591,7 @@
% \begin{macro}{\@float@setevery}
% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
% to redefinition of \cs{caption@setfloatcapt}}
+% \changes{v3.4b}{2019/12/16}{Usage of \cs{caption@float@setname} added}
% |\@float@setevery|\marg{float type} is provided by the \package{float}
% package; it's called every time a floating environment defined with
% |\newfloat| or |\restylefloat| begins.
@@ -2648,6 +2640,7 @@
%
% \begin{macrocode}
}{}%
+ \caption@float@setname{#1}%
\caption@freezeHref % will be defrosted in \float@makebox
\caption@ORI@float@setevery{#1}}%
% \end{macrocode}
@@ -2674,8 +2667,9 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\caption@typehook}
+% \begin{macro}{\caption@float@setname}
% \changes{v3.1}{2007/07/08}{float package hook added}
+% \changes{v3.4b}{2019/12/16}{Renamed from \cs{caption@typehook} to \cs{caption@float@setname}}
% \LaTeX\ and almost every other packages use
% |\|\meta{type}|name|
% to provide a macro for the type resp.~environment name -- for example
@@ -2693,7 +2687,7 @@
% \Note{If the float was not defined with \cs{newfloat} but with
% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
% \begin{macrocode}
- \g@addto@macro\caption@typehook{%
+ \newcommand*\caption@float@setname[1]{%
\expandafter\ifx\csname #1name\endcsname\relax
\expandafter\let\csname #1name\expandafter\endcsname
\csname fname@#1\endcsname
@@ -3326,26 +3320,64 @@
% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
+% \changes{v3.4c}{2020/01/01}{Ugly workaround for usage in lists added}
% To support the \package{listings} package we need to redefine
% |\lst@MakeCaption| so the original stuff is nested with
-% |\caption@begin| and |\caption@end| etc.
-% \Note{This macro is always called twice (with `t' resp. `b' as
-% parameter), therefore we need an extra group here.}
+% |\caption@begin| and |\caption@end| etc.\par
+% Unfortunately |\lst@MakeCaption| is sometimes used with |\linewidth| intact but sometimes with |\linewidth| adapted.
+% So we either could write a bunch of very ugly code which is using internals of the \package{listings} package, or
+% we could simply ignore this fact since |\hsize| will be left untouched by the \package{listings} package.
+% (This is reason why the caption is mis-aligned when using one of the options |linewidth=|, |xleftmargin=|, |yleftmargin=|, or |resetmargins=|,
+% even the \package{caption} package isn't used. This needs to be fixed within the \package{listings} package, for example by using
+% |\lst@MakeCaption| inside a parbox of correct width.)
+%
+% The \package{listings} package calls |\lst@MakeCaption| sometimes with original |\linewidth|, sometimes with adapted |\linewidth|.
+% So we need to detect if |\linewidth| is already adapted or not.
+% We realize this by setting a flag inside the "Init" hook of the \package{listings} package (where the adaption takes place).
+% \begin{macrocode}
+%% \caption@setbool{lst@Init}{0}%
+%% \lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}%
+% \end{macrocode}
% \begin{macrocode}
\let\caption@ORI@lst@MakeCaption\lst@MakeCaption
\def\lst@MakeCaption#1{% #1 is `t' or `b'
+% \end{macrocode}
+% This macro is always called twice by the \package{listings} package (with `t' resp. `b' as parameter),
+% therefore we need an extra group here.
+% \begin{macrocode}
\begingroup
% \end{macrocode}
-% Workaround for bug in \package{listings} package:
-% If |\hsize| seems not to be set correctly, we set it to |\linewidth|.
-% \changes{v3.3}{2018/04/30}{Bugfix from Ulrike Fischer applied, see also \url{https://github.com/axelsommerfeldt/caption/issues/1}}
% \begin{macrocode}
- \@tempdima\linewidth
- \advance\@tempdima\lst@xleftmargin
- \advance\@tempdima\lst@xrightmargin
- \ifdim\hsize>\@tempdima
- \hsize\@tempdima
- \fi
+%% \caption@Debug{%
+%% linewidth=\lst@linewidth,
+%% xleftmargin=\lst@xleftmargin,\MessageBreak
+%% xrightmargin=\lst@xrightmargin,
+%% resetmargins=\lst@ifresetmargins true\else false\fi}%
+% \end{macrocode}
+% If |\linewidth| isn't adapted by the \package{listings} package yet, do the adaption here.
+% \begin{macrocode}
+%% \caption@iflst@Init{}{%\lsthk@PreInit\lsthk@Init => has unwanted side-effects (like an extra horizontal line)
+%% \linewidth\lst@linewidth\relax
+%% \lst@ifresetmargins
+%% \advance\linewidth\@totalleftmargin
+%% \advance\linewidth\rightmargin
+%% \@totalleftmargin\z@
+%% \fi
+%% \advance\linewidth-\lst@xleftmargin
+%% \advance\linewidth-\lst@xrightmargin
+%% \advance\@totalleftmargin\lst@xleftmargin\relax}%
+% \end{macrocode}
+% Inside lists the \package{listings} package ignores the left margin (|\@totalleftmargin|) for captions.
+% We emulate this behaviour by adding a negativ skip which will be typeset ahead of |\caption@box|.\par
+% This does not result in correct justification of the caption, but captions inside listings inside
+% lists are not justified correctly anyway. (Again, this needs to be fixed by the \package{listings} package.)\par
+% Note: We cannot use |\@totalleftmargin| here since it was usually resetted by the \package{listings} package.
+% So we have to calculate the total left margin on our own which makes this code even more dirty.
+% \begin{macrocode}
+ \l@addto@macro\caption@beginhook{%
+ \@tempdima\leftmargin
+ \multiply\@tempdima\@listdepth
+ \hskip-\@tempdima\relax}%
% \end{macrocode}
% First of all, we set |position=#1| and if it was set to `top',
% we swap the skips so the default behavior of the \package{listings} package
diff --git a/macros/latex/contrib/caption/caption.ins b/macros/latex/contrib/caption/caption.ins
index 45381b8402..d6ea31962f 100644
--- a/macros/latex/contrib/caption/caption.ins
+++ b/macros/latex/contrib/caption/caption.ins
@@ -6,7 +6,7 @@
\preamble
-Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
https://gitlab.com/axelsommerfeldt/caption
diff --git a/macros/latex/contrib/caption/caption3.dtx b/macros/latex/contrib/caption/caption3.dtx
index 59e24f0fc1..9837f72142 100644
--- a/macros/latex/contrib/caption/caption3.dtx
+++ b/macros/latex/contrib/caption/caption3.dtx
@@ -25,7 +25,7 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{3418}
+% \CheckSum{3405}
%
% \iffalse
%<*driver>
@@ -188,7 +188,7 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption3}[2019/09/09 v1.8e caption3 kernel (AR)]
+\ProvidesPackage{caption3}[2019/12/31 v1.8f caption3 kernel (AR)]
% \end{macrocode}
%
% \section{Workaround for bug in package \package{arabtex}}
@@ -1523,7 +1523,8 @@
\DeclareCaptionBox{colorbox}{\colorbox{\caption@boxcolor}{%
\setlength\caption@tempdima{#1}%
\addtolength\caption@tempdima{-2\fboxsep}%
- \linewidth=\caption@tempdima\hsize=\caption@tempdima
+ \linewidth\caption@tempdima
+ \hsize\caption@tempdima
#2}}
\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}}
\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}}
@@ -3151,6 +3152,7 @@
% \changes{v1.5}{2012/12/26}{max-margin stuff moved to \cs{caption@calcmargin}}
% \changes{v1.6}{2013/05/01}{Usage of \cs{caption@box} added}
% \changes{v1.7}{2016/01/31}{Adapted to the \package{bicaption} package}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
% |\caption@@make|\marg{caption label}\marg{caption text}
% \begin{macrocode}
\newcommand\caption@@make[2]{%
@@ -3167,7 +3169,7 @@
%
% Typeset the outer box |\caption@box|
% \begin{macrocode}
- \caption@box\linewidth{%
+ \caption@box\hsize{%
% \end{macrocode}
%
% Special single-line treatment (option |singlelinecheck=|)
@@ -3237,12 +3239,11 @@
% \end{macro}
%
% \begin{macro}{\caption@calcmargin}
-% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by
-% \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now}
-% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore),
-% use \cs{linewidth} instead of \cs{hsize}}
+% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore), use \cs{linewidth} instead of \cs{hsize}}
% \changes{v1.5}{2012/12/26}{max-margin stuff moved from \cs{caption@@make} to here}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
% |\caption@calcmargin|\par
% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
% values.
@@ -3265,11 +3266,11 @@
% \end{macrocode}
% \begin{macrocode}
\ifdim\captionwidth=\z@
- \captionwidth\linewidth
+ \captionwidth\hsize
\advance\captionwidth by -2\captionmargin
\advance\captionwidth by -\captionmargin@
\else
- \captionmargin\linewidth
+ \captionmargin\hsize
\advance\captionmargin by -\captionwidth
\divide\captionmargin by 2
\captionmargin@\z@
@@ -3278,12 +3279,9 @@
% \begin{macrocode}
\caption@Debug{%
\string\hsize=\the\hsize,
- \string\linewidth=\the\linewidth,\MessageBreak
- \string\leftmargin=\the\leftmargin,
- \string\rightmargin=\the\rightmargin,\MessageBreak
- \string\margin=\the\captionmargin,
- \string\margin@=\the\captionmargin@,
- \string\width=\the\captionwidth}%
+ \string\captionwidth=\the\captionwidth,\MessageBreak
+ \string\captionmargin=\the\captionmargin,
+ \string\captionmargin@=\the\captionmargin@}%
% \end{macrocode}
% \begin{macrocode}
}
diff --git a/macros/latex/contrib/caption/subcaption.dtx b/macros/latex/contrib/caption/subcaption.dtx
index 70b669ee20..2571963bfe 100644
--- a/macros/latex/contrib/caption/subcaption.dtx
+++ b/macros/latex/contrib/caption/subcaption.dtx
@@ -102,10 +102,10 @@
% \newcommand\NEWdescription{\NEW{New description}}
%
% \makeatletter
-% \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-% \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+% \def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+% \def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
% \makeatother
-% \newcommand*\See[1]{\nopagebreak{\small (See #1)}}
+% \def\See#1{\nopagebreak{\small (See #1)}}
%
% \GetFileInfo{subcaption.drv}
% \let\docdate\filedate
diff --git a/macros/latex/contrib/sanitize-umlaut/CHANGES b/macros/latex/contrib/sanitize-umlaut/CHANGES
new file mode 100644
index 0000000000..2c22512ce1
--- /dev/null
+++ b/macros/latex/contrib/sanitize-umlaut/CHANGES
@@ -0,0 +1,27 @@
+%% The LaTeX package sanitize-umlaut - version 1.10 (2020/01/01)
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2016-2020 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
+%% -------------------------------------------------------------------------------------------
+%%
+%% 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 `author-maintained'.
+%%
+%% This work consists of all files listed in README
+%%
+
+version 1.00 (2016/05/27): initial public release
+
+version 1.10 (2020/01/01):
+- implementation changed to adapt for LaTeX/inputenc UTF-8 changes
+ (see documentation):
+ version 1.00 is only compatible to older LaTeX/inputenc UTF-8
+ version 1.10 is only compatible to recent LaTeX/inputenc UTF-8
+- utf8-2018 is a new supported encoding
diff --git a/macros/latex/contrib/sanitize-umlaut/README b/macros/latex/contrib/sanitize-umlaut/README
index 3ec7151a8c..2285acf34d 100644
--- a/macros/latex/contrib/sanitize-umlaut/README
+++ b/macros/latex/contrib/sanitize-umlaut/README
@@ -1,8 +1,8 @@
-%% The LaTeX package sanitize-umlaut - version 1.00 (2016/05/28)
+%% The LaTeX package sanitize-umlaut - version 1.10 (2020/01/01)
%%
-%% --------------------------------------------------------------------------------------
-%% Copyright (c) 2016 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
-%% --------------------------------------------------------------------------------------
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2016-2020 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
+%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -17,7 +17,7 @@
%% This work consists of all files listed in README
%%
-The packages sanitizes umlauts to be used directly in index entries for
+The package sanitizes umlauts to be used directly in index entries for
MakeIndex and friends with pdflatex. This means, that inside '\index' an umlaut
can be used as "U or directly. In both cases, the letter is written as "U into
the raw index file for correct processing with MakeIndex and pdflatex.
diff --git a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.doc.sty b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.doc.sty
index 6d99b4ddc0..dceeea044a 100644
--- a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.doc.sty
+++ b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.doc.sty
@@ -69,7 +69,7 @@
\urlstyle{sf}
\newtcblisting{fullexample}[1]{docexample,minted style=colorful,
- listing and comment,pdf comment,compilable listing,#1}
+ listing and comment,pdf comment,freeze pdf,compilable listing,#1}
\DeclareTotalTCBox{\myverb}{ O{} v }{tile,fontupper=\ttfamily,nobeforeafter,
tcbox raise base,boxsep=0.5mm,top=0pt,bottom=0pt,left=0pt,right=0pt,boxrule=0.3mm,
diff --git a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf
index 732f109560..0d9216b6d9 100644
--- a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf
+++ b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.pdf
Binary files differ
diff --git a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty
index d48a86874a..86918c3baa 100644
--- a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty
+++ b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.sty
@@ -1,9 +1,9 @@
-%% The LaTeX package sanitize-umlaut - version 1.00 (2016/05/28)
+%% The LaTeX package sanitize-umlaut - version 1.10 (2020/01/01)
%% sanitize-umlaut.sty: Sanitize umlauts for makeindex
%%
-%% --------------------------------------------------------------------------------------
-%% Copyright (c) 2016 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
-%% --------------------------------------------------------------------------------------
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2016-2020 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
+%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -18,23 +18,42 @@
%% This work consists of all files listed in README
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{sanitize-umlaut}[2016/05/28 version 1.00 sanitize umlauts]
+\ProvidesPackage{sanitize-umlaut}[2020/01/01 version 1.10 sanitize umlauts]
-\def\define@unicode@char#1#2{%
+\def\sanitize@unicode@char#1#2{%
\@namedef{u8:\detokenize{#1}}{#2}%
}
+\long\def\sanitize@umlaut@UTFviii@two@octets{% patch for 'utf8.def'
+ \ifincsname
+ \expandafter \UTF@two@octets@string
+ \else
+ \fi
+ \UTFviii@two@octets@combine
+}
+
\begingroup
\catcode`\"=12
\gdef\sanitize@umlaut@utfviii{%
- \define@unicode@char{^^c3^^a4}{"a}%
- \define@unicode@char{^^c3^^b6}{"o}%
- \define@unicode@char{^^c3^^bc}{"u}%
- \define@unicode@char{^^c3^^84}{"A}%
- \define@unicode@char{^^c3^^96}{"O}%
- \define@unicode@char{^^c3^^9c}{"U}%
- \define@unicode@char{^^c3^^9f}{"s}%
+ \let\UTFviii@two@octets\sanitize@umlaut@UTFviii@two@octets%
+ \sanitize@unicode@char{^^c3^^a4}{"a}%
+ \sanitize@unicode@char{^^c3^^b6}{"o}%
+ \sanitize@unicode@char{^^c3^^bc}{"u}%
+ \sanitize@unicode@char{^^c3^^84}{"A}%
+ \sanitize@unicode@char{^^c3^^96}{"O}%
+ \sanitize@unicode@char{^^c3^^9c}{"U}%
+ \sanitize@unicode@char{^^c3^^9f}{"s}%
+}
+
+\gdef\sanitize@umlaut@utfviii@old{%
+ \sanitize@unicode@char{^^c3^^a4}{"a}%
+ \sanitize@unicode@char{^^c3^^b6}{"o}%
+ \sanitize@unicode@char{^^c3^^bc}{"u}%
+ \sanitize@unicode@char{^^c3^^84}{"A}%
+ \sanitize@unicode@char{^^c3^^96}{"O}%
+ \sanitize@unicode@char{^^c3^^9c}{"U}%
+ \sanitize@unicode@char{^^c3^^9f}{"s}%
}
\gdef\sanitize@umlaut@latini{%
@@ -64,6 +83,9 @@
\def\@tempa{utf8}\ifx\inputencodingname\@tempa
\let\sanitize@umlaut\sanitize@umlaut@utfviii
\PackageInfo{sanitize-umlaut}{encoding utf8 selected}
+ \else\def\@tempa{utf8-2018}\ifx\inputencodingname\@tempa
+ \let\sanitize@umlaut\sanitize@umlaut@utfviii@old
+ \PackageInfo{sanitize-umlaut}{encoding utf8-2018 selected}
\else\def\@tempa{latin1}\ifx\inputencodingname\@tempa
\let\sanitize@umlaut\sanitize@umlaut@latini
\PackageInfo{sanitize-umlaut}{encoding latin1 selected}
@@ -79,7 +101,7 @@
\else
\def\sanitize@umlaut{}%
\PackageWarning{sanitize-umlaut}{encoding \inputencodingname\space is not supported}
- \fi\fi\fi\fi\fi
+ \fi\fi\fi\fi\fi\fi
\else
\let\sanitize@umlaut\sanitize@umlaut@utfviii
\PackageWarning{sanitize-umlaut}{encoding unknown. utf8 is selected as fallback (possibly nonsense)}
diff --git a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex
index 653bb72f00..cdeac7add0 100644
--- a/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex
+++ b/macros/latex/contrib/sanitize-umlaut/sanitize-umlaut.tex
@@ -2,12 +2,12 @@
% !TeX encoding=UTF-8
% !TeX spellcheck=en_US
%%
-%% The LaTeX package sanitize-umlaut - version 1.00 (2016/05/28)
+%% The LaTeX package sanitize-umlaut - version 1.10 (2020/01/01)
%% sanitize-umlaut.tex: Manual
%%
-%% --------------------------------------------------------------------------------------
-%% Copyright (c) 2016 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
-%% --------------------------------------------------------------------------------------
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2016-2020 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
+%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -27,8 +27,8 @@
\usepackage{%
sanitize-umlaut}
-\def\version{1.00}%
-\def\datum{2016/05/28}%
+\def\version{1.10}%
+\def\datum{2020/01/01}%
\hypersetup{
pdftitle={Manual for the sanitize-umlaut package},
@@ -87,7 +87,7 @@
\clearpage
\section{Purpose of the Package}%
-The packages sanitizes umlauts to be used directly in index entries for
+The package sanitizes umlauts to be used directly in index entries for
|makeindex| and friends with |pdflatex|. This means, that inside |\index| an umlaut can
be used as \myverb{"U} or \myverb{Ü}. In both cases, the letter is written
as \myverb{"U} into the raw index file for correct processing with |makeindex|
@@ -95,7 +95,7 @@ and |pdflatex|.
The package is intended
\begin{itemize}
-\item for documents in german language using the babel package with a setting
+\item for documents in German language using the babel package with a setting
identical or similar to \myverb{\usepackage[ngerman]{babel}}.
\item for documents which are processed by |latex| or |pdflatex| (not |lualatex| or |xelatex|).
\item for documents with an index which is processed using the
@@ -113,22 +113,59 @@ Another alternative is to replace MakeIndex by Xindy or another index
processor.
+\section{Important Compatibility Informations}%
+
+\subsection{Past}
+Until 2018, the default encoding for \LaTeX\ files was 7-bit ASCII.
+For other encodings, packages like |inputenc| had to be loaded.
+Also, |inputenc| used to expand characters like umlauts during |\index| output.
+The package |sanitize-umlaut| version 1.00 replaced this expansion code
+for |\index| output to get \myverb{"U} instead of \myverb{Ü}, etc.
+
+\subsection{Present}
+Since April 2018, the default encoding for \LaTeX\ files has been changed to UTF-8.
+This is done by preloading the UTF-8 settings of the package |inputenc|
+by default \LaTeX, i.e. if you want to use UTF-8 (recommended!), you do not
+longer need to load |inputenc| inside your preamble.
+But, also the implementation of |inputenc| changed for UTF-8 (October 2019?).
+Nowadays, characters like umlauts are not longer expanded during |\index| output,
+but are preserved as is.
+Therefore, |sanitize-umlaut| version 1.00 \textbf{is not compatible} to
+|inputenc| with UTF-8 dating from 2019 or newer.
+
+|sanitize-umlaut| version 1.10 (or newer) patches some UTF-8 code of
+\LaTeX/|inputenc| to return and replace character expansion during |\index| output.
+This patch \textbf{is not compatible} to older versions of \LaTeX/|inputenc| (before October 2019).
+Therefore, if your \LaTeX\ distribution is not reasonable up to date, you
+should stay at version 1.00 of |sanitize-umlaut|.
+
+\subsection{Future}
+As always, the future is dark and difficult to see. Further changes of
+|inputenc| implementation may force further changes of |sanitize-umlaut|.
+Hopefully, this will not happen too soon or too often.
+Also, if some miracle happens, MakeIndex may be updated one day to
+recognize UTF-8 properly to make |sanitize-umlaut| superfluous.
+
+
\section{Package Usage}%
\subsection{Prerequisites}
-The source document needs some encoding by |inputenc| since |pdflatex|
+The source document may need some encoding by |inputenc| since |pdflatex|
is assumed as engine. For example:
\begin{dispListing}
-\usepackage[utf8]{inputenc}
+\usepackage[latin1]{inputenc}
\end{dispListing}
+For |utf8| (UTF-8), modern \LaTeX\ does not need this package inclusion any more!
+
Just some few encodings are supported by |sanitize-umlaut|.
These are the most important for German language texts:
\tcbox[center,size=minimal,enhanced,frame hidden,colback=red!10]{\begin{tabular}{>{\ttfamily}l>{\ttfamily}l}\toprule
\textnormal{\bfseries encoding} & \textnormal{\bfseries recognized as}\\\midrule
utf8 & utf8\\
+utf8-2018 & utf8-2018\\
latin1, ansinew, cp1252 & latin1\\
applemac & applemac\\\bottomrule
\end{tabular}}
@@ -169,7 +206,7 @@ which are written to the \myverb{.idx} file.
\subsection{Technical Information}
-The package uses \myverb{\inputencodingname} (set by the |inputencoding| package)
+The package uses \myverb{\inputencodingname} (set by \LaTeX\ and the |inputencoding| package)
to determine the current encoding.
The package redefines the \myverb{\@sanitize} macro at the begin of the
@@ -193,7 +230,7 @@ outside \myverb{\index}, strange things may happen.
% arara: pdflatex
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
-\usepackage[utf8]{inputenc}
+%\usepackage[utf8]{inputenc} % utf8 is default now
\usepackage[ngerman]{babel}
\usepackage{makeidx}
\usepackage{sanitize-umlaut}
@@ -218,7 +255,7 @@ Test äöüÄÖÜß.
% arara: pdflatex
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
-\usepackage[utf8]{inputenc}
+%\usepackage[utf8]{inputenc} % utf8 is default now
\usepackage[ngerman]{babel}
\usepackage{makeidx}
\usepackage{sanitize-umlaut}
@@ -242,7 +279,7 @@ Test äöüÄÖÜß.
% arara: pdflatex
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
-\usepackage[utf8]{inputenc}
+%\usepackage[utf8]{inputenc} % utf8 is default now
\usepackage[ngerman]{babel}
\usepackage[makeindex]{imakeidx}
\makeindex[options=-s german.ist -g]
@@ -265,7 +302,7 @@ Test äöüÄÖÜß.
% arara: pdflatex
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
-\usepackage[utf8]{inputenc}
+%\usepackage[utf8]{inputenc} % utf8 is default now
\usepackage[ngerman]{babel}
\usepackage[makeindex]{imakeidx}
\makeindex[options=-s german.ist -g]
@@ -289,7 +326,7 @@ Test äöüÄÖÜß.
% arara: pdflatex
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
-\usepackage[utf8]{inputenc}
+%\usepackage[utf8]{inputenc} % utf8 is default now
\usepackage[ngerman]{babel}
\usepackage[makeindex]{imakeidx}
\indexsetup{level=\section*,noclearpage}
diff --git a/macros/latex/contrib/secnum/README.md b/macros/latex/contrib/secnum/README.md
new file mode 100644
index 0000000000..8748c96190
--- /dev/null
+++ b/macros/latex/contrib/secnum/README.md
@@ -0,0 +1,32 @@
+
+# secnum
+
+This package provides a macro \setsecnum to format section numbering intuitively.
+
+## Installation
+
+The installation is the same as usual Tex packages.
+
+0. Put the source file `secnum.dtx` in a empty folder and go to there.
+
+1. Run the following to create the package file `secnum.sty` (as well as this file `README.md`)
+
+ XeTeX secnum.dtx
+
+2. Move the following file into proper directories searched by TeX.
+ The recommended directory is
+
+ tex/latex/secnum
+
+3. To produce the documentation run the following
+
+ XeLaTeX secnum.dtx
+
+4. The recommended directory for the documentation is
+
+ doc/latex/secnum
+
+## Download
+
+One can also download the generated files from the [github release](https://github.com/GauSyu/secnum/releases).
+
diff --git a/macros/latex/contrib/secnum/secnum.dtx b/macros/latex/contrib/secnum/secnum.dtx
new file mode 100644
index 0000000000..5d2fe91f37
--- /dev/null
+++ b/macros/latex/contrib/secnum/secnum.dtx
@@ -0,0 +1,470 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2019
+% Gau, Syu ( GauSyu@Gmail.com )
+%
+% ----------------------------------------------------------------------
+%
+% 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 has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is
+% Gau, Syu ( GauSyu@Gmail.com ).
+%
+% ----------------------------------------------------------------------
+%
+%<*internal>
+\iffalse
+%</internal>
+%<*readme>
+
+# secnum
+
+This package provides a macro \setsecnum to format section numbering intuitively.
+
+## Installation
+
+The installation is the same as usual Tex packages.
+
+0. Put the source file `secnum.dtx` in a empty folder and go to there.
+
+1. Run the following to create the package file `secnum.sty` (as well as this file `README.md`)
+
+ XeTeX secnum.dtx
+
+2. Move the following file into proper directories searched by TeX.
+ The recommended directory is
+
+ tex/latex/secnum
+
+3. To produce the documentation run the following
+
+ XeLaTeX secnum.dtx
+
+4. The recommended directory for the documentation is
+
+ doc/latex/secnum
+
+## Download
+
+One can also download the generated files from the [github release](https://github.com/GauSyu/secnum/releases).
+
+%</readme>
+%<*internal>
+\fi
+\begingroup
+ \def\nameoflatexe{LaTeX2e}
+\expandafter\endgroup\ifx\nameoflatexe\fmtname\else
+\csname fi\endcsname
+%</internal>
+%<*install>
+
+\input docstrip.tex
+
+\preamble
+
+Copyright (C) 2019
+Gau, Syu ( GauSyu@Gmail.com )
+
+----------------------------------------------------------------------
+
+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 has the LPPL maintenance status `maintained'.
+
+The Current Maintainer of this work is
+ Gau, Syu ( GauSyu@Gmail.com ).
+
+----------------------------------------------------------------------
+
+\endpreamble
+
+\keepsilent
+
+\generate{
+ \usedir{tex/latex/secnum}
+ \file{\jobname.sty}{\from{\jobname.dtx}{package}}
+ \nopreamble\nopostamble
+ \file{README.md}{\from{\jobname.dtx}{readme}}
+}
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into proper directories searched by TeX: *}
+\Msg{* *}
+\Msg{* The recommended directory is TDS:tex/latex/secnum *}
+\Msg{* *}
+\Msg{* secnum.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file secnum.dtx *}
+\Msg{* through XeLaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+\endbatchfile
+%</install>
+%<*internal>
+\fi
+%</internal>
+%<*driver>
+\ProvidesFile{secnum.dtx}
+\documentclass{l3doc}
+\usepackage{indentfirst}
+\usepackage{booktabs}
+\usepackage{xcolor}
+\usepackage{secnum}
+\setsecnum{A}
+\ExplSyntaxOn
+\cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n
+\ExplSyntaxOff
+\DeclareRobustCommand \opt {\texttt}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+% \GetFileInfo{\jobname.sty}
+% \DoNotIndex{\cs}
+%
+% \title{ The \pkg{\jobname} package }
+% \author{ Gau, Syu }
+% \date{ \textit{Last Update:} \filedate }
+%
+% \maketitle
+%
+% \begin{abstract}
+% The package \pkg{\jobname} provides a marco \cs{setsecnum}
+% which allows user to format section numbering intuitively.
+% \end{abstract}
+%
+% \tableofcontents
+% \begin{documentation}
+% \section{Usage}
+% Before using the macro, load the package in preamble.
+% \begin{verbatim}
+% \usepackage{secnum}
+% \end{verbatim}
+% Then, one can format the section numbering by using the
+% marco \cs{setsecnum} in preamble.
+% \begin{function}{\setsecnum}
+% \begin{syntax}
+% \cs{setsecnum} \meta{num format}
+% \end{syntax}
+% A typical \meta{num format} is like this:
+% \begin{center}
+% \verb|1.1.1|
+% \end{center}
+% It consists of some syntax abbrs of numbering formats,
+% reffering the follows,
+% \begin{center}
+% \begin{tabular}{ccccc}
+% \toprule
+% A & a & I & i & 1 \\
+% \midrule
+% \cs{Alph} & \cs{alph} & \cs{Roman} & \cs{roman} & \cs{arabic} \\
+% \bottomrule
+% \end{tabular}
+% \end{center}
+% and some separators, which can be any character except
+% the abbrs and special characters such as barces ``\verb|{}|'',
+% comma ``\verb|,|'', space ``\verb*| |'', etc.
+% \end{function}
+%
+% \section{Process}
+% The process of the macro \cs{setsecnum} can be
+% explained as follows.
+% \begin{enumerate}[label=Step \arabic*.]
+% \item The main function eats the input, saying \opt{I.1.a},
+% and stores it in a token list.
+% \item Replace abbrs by macros.
+% In our example, it results
+% ``\cs{Roman}\opt{.}\cs{arabic}\opt{.}\cs{alph}''
+% \item Split this token list into a sequence by macros.
+% In our example, it results ``\cs{Roman}'',
+% ``\opt{.}\cs{arabic}'' and ``\opt{.}\cs{alph}''.
+% \item Store those codes in indivial containers.
+% \item Use them to renew \cs{thesection}, \cs{thesubsection},
+% \cs{thesubsubsection} etc.
+% provided there is no \cs{chapter}.
+% \end{enumerate}
+%
+% \end{documentation}
+%
+% \StopEventually{}
+%
+% \begin{implementation}
+% \section{Implementation}
+% The following is the implementation.
+% Users can ignore.
+% \subsection{Preparations}
+% This document class uses \LaTeX3.
+% Therefore, the packages \pkg{expl3}, \pkg{xparse}
+% and \pkg{l3keys2e} are needed and should use
+% \cs{ProvidesExplClass} rather than \cs{ProvidesClass}.
+%
+% \begin{macrocode}
+%<*package>
+%<@@=syu>
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}
+\ProvidesExplPackage{secnum}{2020/01/01}{}
+ { An intuitive way to format section numbering }
+\RequirePackage{xparse}
+% \end{macrocode}
+%
+% \begin{variable}{ \l__syu_secnum_tl, \l__syu_secnum_seq }
+% The two variables are used to store the formatting information.
+% \begin{macrocode}
+\tl_new:N \l__syu_secnum_tl
+\seq_new:N \l__syu_secnum_seq
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{
+% \g__syu_chapter_tl,
+% \g__syu_section_tl,
+% \g__syu_subsection_tl,
+% \g__syu_subsubsection_tl,
+% \g__syu_paragraph_tl,
+% \g__syu_subparagraph_tl
+% }
+% The following variables are used to store
+% the individal formatting codes.
+% \begin{macrocode}
+\tl_new:N \g__syu_chapter_tl
+\tl_new:N \g__syu_section_tl
+\tl_new:N \g__syu_subsection_tl
+\tl_new:N \g__syu_subsubsection_tl
+\tl_new:N \g__syu_paragraph_tl
+\tl_new:N \g__syu_subparagraph_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{ \g__syu_if_thechapter_int }
+% This \meta{integer} encodes if \cs{thechapter} is defined.
+% \begin{macrocode}
+\int_new:N \g__syu_if_thechapter_int
+% \end{macrocode}
+% If \cs{thechapter} is defined, it is $1$.
+% \begin{macrocode}
+\if_cs_exist:N \thechapter
+ \int_gset:Nn \g__syu_if_thechapter_int 1
+% \end{macrocode}
+% Otherwise, it is $0$.
+% \begin{macrocode}
+\else:
+ \int_gset:Nn \g__syu_if_thechapter_int 0
+\fi:
+% \end{macrocode}
+% \end{variable}
+%
+% \subsection{Main function}
+%
+% \begin{macro}{\setsecnum}
+% Here is the definition of the main function \cs{setsecnum}.
+% \begin{macrocode}
+\DeclareDocumentCommand{\setsecnum}{m}
+ {
+% \end{macrocode}
+% Store the input in.
+% \begin{macrocode}
+ \tl_set:Nn \l__syu_secnum_tl {#1}
+% \end{macrocode}
+% Replace syntax abbrs by corresponding macros.
+% \begin{macrocode}
+ \syu_secnum_unabbr:N \l__syu_secnum_tl
+% \end{macrocode}
+% Split into a sequence by macros.
+% \begin{macrocode}
+ \syu_split_by_macros:NN \l__syu_secnum_tl \l__syu_secnum_seq
+% \end{macrocode}
+% Read formatting information.
+% \begin{macrocode}
+ \syu_secnum_from_seq:N \l__syu_secnum_seq
+% \end{macrocode}
+% Set the \opt{secnumdepth}.
+% \begin{macrocode}
+ \setcounter{secnumdepth}{ \seq_count:N \l__syu_secnum_seq }
+% \end{macrocode}
+% Format numberings.
+% \begin{macrocode}
+ \syu_secnum:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Unabbravation}
+% \begin{variable}{ \syu_secnum_unabbr:N }
+% This function replace the abbrs in a \meta{tl var}
+% by expansions.
+% \begin{macrocode}
+\cs_new_protected:Npn \syu_secnum_unabbr:N #1
+ {
+ \regex_replace_all:nnN {A} {\c{Alph}} #1
+ \regex_replace_all:nnN {a} {\c{alph}} #1
+ \regex_replace_all:nnN {I} {\c{Roman}} #1
+ \regex_replace_all:nnN {i} {\c{roman}} #1
+ \regex_replace_all:nnN {1} {\c{arabic}} #1
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \subsection{Split to sequence}
+% \begin{variable}{ \syu_split_by_macros:NN }
+% This function split a \meta{tl var} into a \meta{sequence}
+% by macros.
+% \begin{macrocode}
+\cs_new_protected:Npn \syu_split_by_macros:NN #1 #2
+ {
+ \tl_clear:N \l_tmpa_tl
+ \seq_clear:N #2
+ \tl_map_inline:Nn #1
+ {
+ \tl_put_right:Nn \l_tmpa_tl ##1
+ \__syu_if_macro:nT ##1
+ {
+ \seq_put_right:NV #2 \l_tmpa_tl
+ \tl_clear:N \l_tmpa_tl
+ }
+ }
+ }
+% \end{macrocode}
+% \end{variable}
+% But how to see if an \meta{item} in the token list is a macro?
+% \begin{variable}{ \g__syu_macro_tl }
+% This \meta{tl var} stores the first five characters
+% of the meaning of any macro,
+% i.e. \opt{macro} (watch out its catcode).
+% The idea is to creat a \meta{tl var} and then set
+% its value to be the first five characters of its meaning.
+% \begin{macrocode}
+\tl_new:N \g__syu_macro_tl
+\tl_set:Nx \g__syu_macro_tl { \meaning \g__syu_macro_tl }
+\tl_gset:Nx \g__syu_macro_tl { \tl_range:Nnn \g__syu_macro_tl {1}{5} }
+% \end{macrocode}
+% \end{variable}
+% \begin{variable}{ \__syu_if_macro:nT,
+% \__syu_if_macro:nF, \__syu_if_macro:nTF, }
+% Then, define a conditional testing if the input is a macro.
+% Note that I use \cs{if_meaning} rather than \cs{tl_if_eq:NNTF}.
+% \begin{macrocode}
+\prg_new_protected_conditional:Npnn \__syu_if_macro:n #1 { T , F , TF }
+ {
+ \group_begin:
+ \tl_set:Nx \l_tmpa_tl {\meaning #1}
+ \tl_set:Nx \l_tmpa_tl {\tl_range:Nnn \l_tmpa_tl {1} {5}}
+% \end{macrocode}
+% This is a trick to keep \cs{l_tmpa_tl} in the current local group
+% \begin{macrocode}
+ \exp_after:wN
+ \group_end:
+% \end{macrocode}
+% while throwing the comparison result out.
+% \begin{macrocode}
+ \if_meaning:w \l_tmpa_tl \g__syu_macro_tl
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \subsection{Read formatting info}
+% \begin{variable}{ \syu_secnum_from_seq:N }
+% Read the formatting info from given \meta{sequence}.
+% \begin{macrocode}
+\cs_new_protected:Npn \syu_secnum_from_seq:N #1
+ {
+% \end{macrocode}
+% Use \cs{tl_gset:Nx} since: 1, these data are global and
+% 2: I need them eating the fully expanded results.
+% \begin{macrocode}
+ \tl_gset:Nx \g__syu_chapter_tl
+ { \seq_item:Nn #1 { \g__syu_if_thechapter_int } }
+ \tl_gset:Nx \g__syu_section_tl
+ { \seq_item:Nn #1 { 1 + \g__syu_if_thechapter_int } }
+ \tl_gset:Nx \g__syu_subsection_tl
+ { \seq_item:Nn #1 { 2 + \g__syu_if_thechapter_int } }
+ \tl_gset:Nx \g__syu_subsubsection_tl
+ { \seq_item:Nn #1 { 3 + \g__syu_if_thechapter_int } }
+ \tl_gset:Nx \g__syu_paragraph_tl
+ { \seq_item:Nn #1 { 4 + \g__syu_if_thechapter_int } }
+ \tl_gset:Nx \g__syu_subparagraph_tl
+ { \seq_item:Nn #1 { 5 + \g__syu_if_thechapter_int } }
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \subsection{Formatting}
+% \begin{variable}{ \syu_secnum: }
+% Formatting section numbering.
+% \begin{macrocode}
+\cs_new:Nn \syu_secnum:
+ {
+% \end{macrocode}
+% When \cs{thechapter} is defined, start from it.
+% \begin{macrocode}
+ \if_cs_exist:N \thechapter
+ \renewcommand*{\thechapter}
+ { \g__syu_chapter_tl {chapter} }
+ \renewcommand*{\thesection}
+ { \thechapter
+ \g__syu_section_tl {section} }
+% \end{macrocode}
+% Otherwise start from \cs{thesection}.
+% \begin{macrocode}
+ \else:
+ \renewcommand*{\thesection}
+ { \g__syu_section_tl {section} }
+ \fi:
+% \end{macrocode}
+% The rest levels.
+% \begin{macrocode}
+ \renewcommand*{\thesubsection}
+ { \thesection
+ \g__syu_subsection_tl {subsection} }
+ \renewcommand*{\thesubsubsection}
+ { \thesubsection
+ \g__syu_subsubsection_tl {subsubsection} }
+ \renewcommand*{\theparagraph}
+ { \thesubsubsection
+ \g__syu_paragraph_tl {paragraph} }
+ \renewcommand*{\thesubparagraph}
+ { \theparagraph
+ \g__syu_subparagraph_tl {subparagraph} }
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%\end{implementation}
+%
+%
+% \changes{}{2020/01/01}{Correct the package name.}
+%
+% \Finale
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/secnum/secnum.pdf b/macros/latex/contrib/secnum/secnum.pdf
new file mode 100644
index 0000000000..e26107701c
--- /dev/null
+++ b/macros/latex/contrib/secnum/secnum.pdf
Binary files differ