From 33fdc16a2b39e210cbc8433ec00a4c842ca5529f Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 30 Aug 2021 03:02:01 +0000 Subject: CTAN sync 202108300301 --- macros/latex/contrib/babel-contrib/dutch/README.md | 7 +- macros/latex/contrib/babel-contrib/dutch/dutch.dtx | 13 +- macros/latex/contrib/babel-contrib/dutch/dutch.pdf | Bin 159006 -> 159614 bytes macros/latex/contrib/clrstrip/README.md | 2 +- macros/latex/contrib/clrstrip/clrstrip.dtx | 72 ++--- macros/latex/contrib/clrstrip/clrstrip.pdf | Bin 196215 -> 198936 bytes macros/latex/contrib/etl/README.md | 2 +- macros/latex/contrib/etl/etl.dtx | 279 +++++++++++++++-- macros/latex/contrib/etl/etl.pdf | Bin 341109 -> 357936 bytes macros/latex/contrib/exesheet/exesheet.cls | 36 +++ macros/latex/contrib/exesheet/exesheet.dtx | 140 +++++---- macros/latex/contrib/exesheet/exesheet.ins | 4 +- macros/latex/contrib/exesheet/exesheet.pdf | Bin 234223 -> 235575 bytes macros/latex/contrib/secnum/README.md | 18 +- macros/latex/contrib/secnum/secnum.dtx | 340 ++++++++++++++++++--- macros/latex/contrib/secnum/secnum.pdf | Bin 381934 -> 429962 bytes 16 files changed, 737 insertions(+), 176 deletions(-) create mode 100644 macros/latex/contrib/exesheet/exesheet.cls (limited to 'macros/latex') diff --git a/macros/latex/contrib/babel-contrib/dutch/README.md b/macros/latex/contrib/babel-contrib/dutch/README.md index 49eb16054e..0fab147c28 100644 --- a/macros/latex/contrib/babel-contrib/dutch/README.md +++ b/macros/latex/contrib/babel-contrib/dutch/README.md @@ -1,4 +1,4 @@ -Dutch 3.8k +Dutch 3.8l -------------- This is the babel style for Dutch. @@ -24,3 +24,8 @@ Changes 3.8k ------------ * Use \ij instead of "y in captions. + +Changes 3.8l +------------ + +* Added \ij and \IJ to the case mapping. diff --git a/macros/latex/contrib/babel-contrib/dutch/dutch.dtx b/macros/latex/contrib/babel-contrib/dutch/dutch.dtx index 5d84e67b2a..e93e87fbd6 100644 --- a/macros/latex/contrib/babel-contrib/dutch/dutch.dtx +++ b/macros/latex/contrib/babel-contrib/dutch/dutch.dtx @@ -26,7 +26,7 @@ % and covered by LPPL is defined by the unpacking scripts (with % extension .ins) which are part of the distribution. % \fi -% \CheckSum{300} +% \CheckSum{305} %\iffalse % Tell the \LaTeX\ system who we are and write an entry on the % transcript. @@ -36,7 +36,7 @@ %\ProvidesLanguage{dutch} %\fi %\ProvidesFile{dutch.dtx} - [2021/08/28 v3.8k Dutch support from the babel system] + [2021/08/29 v3.8l Dutch support from the babel system] %\iffalse %% File `dutch.dtx' % @@ -493,6 +493,15 @@ \declare@shorthand{dutch}{"y}{\textormath{\ij{}}{\ddot y}} \declare@shorthand{dutch}{"Y}{\textormath{\IJ{}}{\ddot Y}} % \end{macrocode} +% +% Map case. +% +% \begin{macrocode} +\StartBabelCommands{dutch}{} +\SetCase[\ij\IJ]{}{} +\EndBabelCommands +% \end{macrocode} +% % To enable hyphenation in two words, written together but % separated by a slash, as in `uitdrukking/opmerking' we define the % command |"/|. diff --git a/macros/latex/contrib/babel-contrib/dutch/dutch.pdf b/macros/latex/contrib/babel-contrib/dutch/dutch.pdf index 10b9f23f19..0bf3dd45aa 100644 Binary files a/macros/latex/contrib/babel-contrib/dutch/dutch.pdf and b/macros/latex/contrib/babel-contrib/dutch/dutch.pdf differ diff --git a/macros/latex/contrib/clrstrip/README.md b/macros/latex/contrib/clrstrip/README.md index 733ad8d1b9..4a482cab36 100644 --- a/macros/latex/contrib/clrstrip/README.md +++ b/macros/latex/contrib/clrstrip/README.md @@ -1,6 +1,6 @@ clrstrip: place contents into a full width colour strip -Copyright (C) 2018-2020 by Jonathan P. Spratte +Copyright (C) 2018-2021 by Jonathan P. Spratte This package may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or (at diff --git a/macros/latex/contrib/clrstrip/clrstrip.dtx b/macros/latex/contrib/clrstrip/clrstrip.dtx index a968ddf609..fb7fd40647 100644 --- a/macros/latex/contrib/clrstrip/clrstrip.dtx +++ b/macros/latex/contrib/clrstrip/clrstrip.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: clrstrip.dtx Copyright (C) 2018-2020 Jonathan P. Spratte +% File: clrstrip.dtx Copyright (C) 2018-2021 Jonathan P. Spratte % % It may be distributed and/or modified under the conditions of the LaTeX % Project Public License (LPPL), either version 1.3c of this license or (at your @@ -26,7 +26,7 @@ Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt -------------------------------------------------------------- -Copyright (C) 2018-2020 Jonathan P. Spratte +Copyright (C) 2018-2021 Jonathan P. Spratte This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -88,7 +88,7 @@ and the derived files clrstrip.pdf and \end{document} % %<*pkg> -\newcommand*\clrstrip@date{2020-01-23} +\newcommand*\clrstrip@date{2021-08-28} \ProvidesPackage{clrstrip} [\clrstrip@date\space place contents into a full width colour strip] \RequirePackage{expkv} @@ -249,7 +249,7 @@ and the derived files clrstrip.pdf and % version 2020-01-23, before that version \pkg{clrstrip} had been using % \pkg{keyval}. Though \pkg{keyval} is faster than \pkg{expkv}, \pkg{expkv} is % \emph{a lot} faster than \pkg{xkevyal} which replaces \pkg{keyval} and its -% performance as soon as any other package is loaded. +% performance as soon as it's loaded. % % In addition \pkg{clrstrip} needs a package defining \cs{color} such as % \pkg{color} or \pkg{xcolor} but doesn't load one on its own. @@ -266,48 +266,48 @@ and the derived files clrstrip.pdf and % % \subsection{Initializing Variables} % -% \begin{variable}{\clrstrip@box} +% \begin{variable}[internal]{\clrstrip@box} % Stores the contents of \env{colorstrip}. % \begin{macrocode} \newsavebox\clrstrip@box % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@innerT} +% \begin{variable}[internal]{\clrstrip@innerT} % Stores the upper inner padding. Gets reused to store the overall height of % the colour strip locally. % \begin{macrocode} \newlength\clrstrip@innerT -\clrstrip@innerT\medskipamount +\clrstrip@innerT=\medskipamount % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@innerB} +% \begin{variable}[internal]{\clrstrip@innerB} % Stores the lower inner padding. Gets reused to store the overall depth of % the colour strip locally. % \begin{macrocode} \newlength\clrstrip@innerB -\clrstrip@innerB\clrstrip@innerT +\clrstrip@innerB=\clrstrip@innerT % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@outerT} +% \begin{variable}[internal]{\clrstrip@outerT} % Stores the upper outer padding. % \begin{macrocode} \newlength\clrstrip@outerT -\clrstrip@outerT\clrstrip@innerT +\clrstrip@outerT=\clrstrip@innerT % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@outerB} +% \begin{variable}[internal]{\clrstrip@outerB} % Stores the lower outer padding. % \begin{macrocode} \newlength\clrstrip@outerB -\clrstrip@outerB\clrstrip@innerT +\clrstrip@outerB=\clrstrip@innerT % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@width} +% \begin{variable}[internal]{\clrstrip@width} % Stores the width the text block inside of the colour strip should be wide. % Might be reused to calculate the skip to centre the text block locally. % \begin{macrocode} @@ -315,16 +315,16 @@ and the derived files clrstrip.pdf and % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@left} +% \begin{variable}[internal]{\clrstrip@left} % Stores the left skip from the left border of the text field. Might be reused % to store the necessary left skip for centred alignment locally. % \begin{macrocode} \newlength\clrstrip@left -\clrstrip@left1sp +\clrstrip@left=1sp % \end{macrocode} % \end{variable} % -% \begin{variable}{\clrstrip@arg} +% \begin{variable}[internal]{\clrstrip@arg} % Stores the first optional and the mandatory argument to \env{colorstrip} for % later use. % \begin{macrocode} @@ -334,7 +334,7 @@ and the derived files clrstrip.pdf and % % \subsection{Internal Macros} % -% \begin{macro}{\clrstrip@key,\clrstrip@keyNV} +% \begin{macro}[internal]{\clrstrip@key,\clrstrip@keyNV} % Shortcut to define new keys with \pkg{expkv}. % \begin{macrocode} \newcommand*\clrstrip@key{\protected\ekvdef{clrstrip}} @@ -342,7 +342,7 @@ and the derived files clrstrip.pdf and % \end{macrocode} % \end{macro} % -% \begin{macro}{\clrstrip@start} +% \begin{macro}[internal]{\clrstrip@start} % Used to grab the second optional argument to \env{colorstrip}. Sets the % specified keys and starts the grabbing of the contents inside the \cs{vbox}. % \begin{macrocode} @@ -350,18 +350,18 @@ and the derived files clrstrip.pdf and {% \colorstripSet{#1}% \ifdim\clrstrip@width=\z@ - \clrstrip@width\linewidth + \clrstrip@width=\linewidth \fi \setbox\clrstrip@box\vbox\bgroup - \hsize\clrstrip@width - \linewidth\hsize + \hsize=\clrstrip@width + \linewidth=\hsize \color@setgroup \clrstrip@preventIndent } % \end{macrocode} % \end{macro} % -% \begin{macro}{\clrstrip@afterheading,\clrstrip@noindent} +% \begin{macro}[internal]{\clrstrip@afterheading,\clrstrip@noindent} % These two macros are the two options to suppress the indentation in a % \env{colorstrip}. % \begin{macrocode} @@ -370,7 +370,7 @@ and the derived files clrstrip.pdf and % \end{macrocode} % \end{macro} % -% \begin{macro}{\clrstrip@preventIndent} +% \begin{macro}[internal]{\clrstrip@preventIndent} % Used to prevent the indentation of the first line in a \env{colorstrip}. It % will be let to one of \cs{clrstrip@afterheading} or \cs{clrstrip@noindent}. % \begin{macrocode} @@ -382,14 +382,14 @@ and the derived files clrstrip.pdf and % \subsection{Initializing Keys} % % \begin{macrocode} -\clrstrip@key{inner}{\clrstrip@innerT#1\relax\clrstrip@innerB#1\relax} -\clrstrip@key{outer}{\clrstrip@outerT#1\relax\clrstrip@outerB#1\relax} -\clrstrip@key{inner top}{\clrstrip@innerT#1\relax} -\clrstrip@key{inner bot}{\clrstrip@innerB#1\relax} -\clrstrip@key{outer top}{\clrstrip@outerB#1\relax} -\clrstrip@key{outer bot}{\clrstrip@outerB#1\relax} -\clrstrip@key{width}{\clrstrip@width#1\relax} -\clrstrip@key{left}{\clrstrip@left#1\relax} +\clrstrip@key{inner}{\clrstrip@innerT=#1\relax\clrstrip@innerB=\clrstrip@innerT} +\clrstrip@key{outer}{\clrstrip@outerT=#1\relax\clrstrip@outerB=\clrstrip@outerT} +\clrstrip@key{inner top}{\clrstrip@innerT=#1\relax} +\clrstrip@key{inner bot}{\clrstrip@innerB=#1\relax} +\clrstrip@key{outer top}{\clrstrip@outerB=#1\relax} +\clrstrip@key{outer bot}{\clrstrip@outerB=#1\relax} +\clrstrip@key{width}{\clrstrip@width=#1\relax} +\clrstrip@key{left}{\clrstrip@left=#1\relax} \clrstrip@keyNV{afterheading}{\let\clrstrip@preventIndent\clrstrip@afterheading} \clrstrip@keyNV{noindent}{\let\clrstrip@preventIndent\clrstrip@noindent} % \end{macrocode} @@ -399,7 +399,7 @@ and the derived files clrstrip.pdf and % \begin{macro}{\colorstripSet} % Shortcut for \pkg{expkv}'s \cs{ekvset}. % \begin{macrocode} -\protected\def\colorstripSet{\ekvset{clrstrip}} +\protected\ekvsetdef\colorstripSet{clrstrip} % \end{macrocode} % \end{macro} % @@ -447,9 +447,9 @@ and the derived files clrstrip.pdf and {% \hskip-\paperwidth \vrule - width 2\paperwidth + width 2\paperwidth height \clrstrip@innerT - depth \clrstrip@innerB + depth \clrstrip@innerB }% \endgroup % \end{macrocode} @@ -457,7 +457,7 @@ and the derived files clrstrip.pdf and % \begin{macrocode} \ifdim\clrstrip@left=1sp \advance\clrstrip@width-\linewidth - \clrstrip@left-.5\clrstrip@width + \clrstrip@left=-.5\clrstrip@width \fi \rlap{\hskip\clrstrip@left\copy\clrstrip@box}% % \end{macrocode} diff --git a/macros/latex/contrib/clrstrip/clrstrip.pdf b/macros/latex/contrib/clrstrip/clrstrip.pdf index 775626fdd5..ab9086207e 100644 Binary files a/macros/latex/contrib/clrstrip/clrstrip.pdf and b/macros/latex/contrib/clrstrip/clrstrip.pdf differ diff --git a/macros/latex/contrib/etl/README.md b/macros/latex/contrib/etl/README.md index 8279d34fb0..b45f0d813a 100644 --- a/macros/latex/contrib/etl/README.md +++ b/macros/latex/contrib/etl/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # etl -- expandable token list operations -Version 2021-08-20 v0.1 +Version 2021-08-28 v0.2 Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt diff --git a/macros/latex/contrib/etl/etl.dtx b/macros/latex/contrib/etl/etl.dtx index 93b90ca9d0..4c15f43c13 100644 --- a/macros/latex/contrib/etl/etl.dtx +++ b/macros/latex/contrib/etl/etl.dtx @@ -110,9 +110,9 @@ and the derived files etl.pdf % to unexpandable functions found inside the \pkg{l3tl} module of \pkg{expl3}. % All user functions must not contain the tokens \cs{s__etl_stop}\footnote{At % any nesting level of groups} or \cs{__etl_act_result:n}\footnote{Outside of -% some local brace groups} in any argument (but there might be other forbidden -% tokens, all of which are internals to this package, and usually shouldn't -% somehow end up inside the input stream by accident). +% some local brace groups} in any argument unless specified otherwise (there +% might be other forbidden tokens, all of which are internals to this package, +% and usually shouldn't somehow end up inside the input stream by accident). % % There is another limitation of this package: There are tokens which cannot % expandably be differentiated from each other, those are active characters let @@ -406,7 +406,7 @@ and the derived files etl.pdf % % \begin{function}[EXP]{\etl_replace_once:nnn} % \begin{syntax} -% \cs{etl_replace_once:nnn} \meta{token list} \meta{search text} \meta{replacement} +% \cs{etl_replace_once:nnn} \Arg{token list} \Arg{search text} \Arg{replacement} % \end{syntax} % This function will replace the first occurrence of \meta{search text} % inside of \meta{token list} that is not hidden inside a group with @@ -422,7 +422,7 @@ and the derived files etl.pdf % % \begin{function}[EXP]{\etl_replace_all:nnn} % \begin{syntax} -% \cs{etl_replace_all:nnn} \meta{token list} \meta{search text} \meta{replacement} +% \cs{etl_replace_all:nnn} \Arg{token list} \Arg{search text} \Arg{replacement} % \end{syntax} % This function will replace all occurrences of \meta{search text} % inside of \meta{token list} that are not hidden inside a group with @@ -438,7 +438,7 @@ and the derived files etl.pdf % % \begin{function}[EXP]{\etl_replace_all_deep:nnn} % \begin{syntax} -% \cs{etl_replace_all_deep:nnn} \meta{token list} \meta{search text} \meta{replacement} +% \cs{etl_replace_all_deep:nnn} \Arg{token list} \Arg{search text} \Arg{replacement} % \end{syntax} % This function will replace all occurrences of \meta{search text} % inside of \meta{token list} with \meta{replacement}. @@ -452,14 +452,21 @@ and the derived files etl.pdf % \end{function} % % -% \subsection{New expandable fast tests} +% \subsection{New expandable functions} % -% Functions generated with the means in this section are as fast as the -% \pkg{l3tl} variants of them, but have at least one fixed argument. +% Functions generated with the means in this section are roughly as fast as the +% \pkg{l3tl} variants of them (there might be performance differences; in any +% case they are faster than the generic functions above), but have at least one +% fixed argument. They don't have the drawback of not being able to tell apart +% an active character from a token with the same character code and different +% category code if the active character was let to it and they don't normalise +% braces to \texttt{\{\textsubscript{1}} and \texttt{\}\textsubscript{2}}. +% +% \subsubsection{Conditionals} % % \begin{function}{\etl_new_if_in:Nnn} % \begin{syntax} -% \cs{etl_new_if_in:Nnn} \meta{function} \meta{search text} \meta{conditions} +% \cs{etl_new_if_in:Nnn} \meta{function} \Arg{search text} \Arg{conditions} % \end{syntax} % This will define a new \meta{function} which will act as a conditional and % search for \meta{search text} inside of an |n|-type argument completely @@ -479,6 +486,57 @@ and the derived files etl.pdf % \my_if_a_in:nTF { a text } { true } { false } % \my_if_a_in:nTF { text } { true } { false } % \end{verbatim} +% +% +% \subsubsection{Modifiers} +% +% \begin{function}{\etl_new_replace_once:Nn} +% \begin{syntax} +% \cs{etl_new_replace_once:Nn} \meta{function} \Arg{search text} +% \end{syntax} +% This defines a new \meta{function} that'll accept two arguments (the first +% being a token list, the second a replacement). The generated \meta{function} +% will replace the first occurrence of \meta{search text} inside the token +% list with replacement. It'll ignore things hidden inside a group in the +% token list. Neither the \meta{search text} nor the token list given to the +% generated \meta{function} can contain \cs{s__etl_stop} (this would result in +% undefined behaviour), the given replacement on the other hand might contain +% that token. Additionally \meta{search text} can't contain tokens of category +% group begin or group end (usually |{| and |}|) or macro parameters (usually +% |#|). +% +% \begin{texnote} +% The result of \meta{function} is returned within \cs{exp_not:n}, which +% means that the token list does not expand further when appearing in an +% \hbox{|x|- or} |e|-type argument expansion. The result will be returned +% after exactly two steps of expansion. +% \end{texnote} +% \end{function} +% So the following would yield |AcDC|: +% \begin{verbatim} +% \etl_new_replace_once:Nn \my_replace_C_once:nn { C } +% \my_replace_C_once:nn { ACDC } { c } +% \end{verbatim} +% +% \begin{function}{\etl_new_replace_all:Nn} +% \begin{syntax} +% \cs{etl_new_replace_all:Nn} \meta{function} \Arg{search text} +% \end{syntax} +% This behaves like \cs{etl_new_replace_once:Nn}, but the \meta{function} will +% replace all occurrences of \meta{search text} instead of just the first. +% +% \begin{texnote} +% The result of \meta{function} is returned within \cs{exp_not:n}, which +% means that the token list does not expand further when appearing in an +% \hbox{|x|- or} |e|-type argument expansion. The result will be returned +% after exactly two steps of expansion. +% \end{texnote} +% \end{function} +% So the following would yield |AcDc|: +% \begin{verbatim} +% \etl_new_replace_all:Nn \my_replace_C_all:nn { C } +% \my_replace_C_all:nn { ACDC } { c } +% \end{verbatim} % % % \subsection{Bugs and Feature Requests} @@ -506,7 +564,7 @@ and the derived files etl.pdf % Tell who we are: % \begin{macrocode} \ProvidesExplPackage{etl} - {2021-08-20} {0.1} + {2021-08-28} {0.2} {expandable token list manipulation} % \end{macrocode} % @@ -515,7 +573,7 @@ and the derived files etl.pdf \cs_if_exist:NF \tex_expanded:D { \msg_new:nnn { etl } { expanded-missing } - { The expanded primitive is required. } + { The~ expanded~ primitive~ is~ required. } \msg_fatal:nn { etl } { expanded-missing } } % \end{macrocode} @@ -666,12 +724,10 @@ and the derived files etl.pdf \cs_new:Npn \etl_act:nnnnnnn #1#2#3#4#5#6#7 { \@@_unexpanded:w \@@_expanded:w - { - { - \@@_act:w #7 {\s_@@_stop} . \s_@@_stop {#5} {#1} {#2} {#3} - \@@_act_result:n {#6} {#4} - } - } + {{ + \@@_act:w #7 {\s_@@_stop} . \s_@@_stop {#5} {#1} {#2} {#3} + \@@_act_result:n {#6} {#4} + }} } % \end{macrocode} % We also provide a version without the \cs{@@_unexpanded:w} around it for @@ -1298,6 +1354,9 @@ and the derived files etl.pdf % \end{macro} % \end{macro} % +% +% \subsection{Expandably modify token lists} +% % \begin{macro}[EXP]{\etl_token_replace_all:nNn} % \begin{macro}[EXP]{\@@_token_replace:NnnN} % Replaceing a single token (and in fact the same is true for all the @@ -1647,23 +1706,46 @@ and the derived files etl.pdf % \end{macrocode} % \end{macro} % +% +% \subsection{Defining new tests} +% % \begin{macro}{\etl_new_if_in:Nnn} -% \begin{macro}{\@@_new_if_in:NNnn} +% \begin{macro}{\@@_new_if_in:NnNnn, \@@_new_if_in:NNnn} % These tests work essentially in the same way as \cs{tl_if_in:nnTF}, but % instead they use a predefined internal macro so that no definition at use -% time is necessary. +% time is necessary. We use a small loop to get a unique auxiliary macro name +% for the search text. % \begin{macrocode} -\exp_args:Nno \use:n { \cs_new_protected:Npn \etl_new_if_in:Nnn #1#2 } +\exp_args:Nno \use:n { \cs_new_protected:Npn \etl_new_if_in:Nnn #1#2#3 } { - \exp_args:Nc \@@_new_if_in:NNnn - { @@_user_function ~ \cs_to_str:N #1 ~ \tl_to_str:n {#2} :w } + \scan_stop: + \if_false: { \fi: + \exp_args:Nc \@@_new_if_in:NnNnn + { @@_user_function ~ if_in ~ \tl_to_str:n {#2} :w } + ? #1 {#2} + {#3} + \if_false: } \fi: + } +\cs_new_protected:Npn \@@_new_if_in:NnNnn #1#2#3#4 + { + \cs_if_exist:NTF #1 + { + \cs_set:Npn \@@_tmp:w ##1 #4 {} + \cs_if_eq:NNTF #1 \@@_tmp:w + { \@@_new_if_in:NNnn #1 #3 {#4} } + { + \exp_args:Nc \@@_new_if_in:NnNnn + { @@_user_function ~ if_in #2 ~ \tl_to_str:n {#4} :w } + { #2? } + #3 {#4} + } + } + { \@@_new_if_in:NNnn #1 #3 {#4} } } \cs_new_protected:Npn \@@_new_if_in:NNnn #1#2#3#4 { - \scan_stop: - \if_false: { \fi: - \cs_new:Npn #1 ##1 #3 {} + \cs_gset:Npn #1 ##1 #3 {} \prg_new_conditional:Npnn #2 ##1 {#4} { \if:w @@ -1678,7 +1760,150 @@ and the derived files etl.pdf \prg_return_false: \fi: } - \if_false: } \fi: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{Defining new modifiers} +% +% The implementation of |replace_once| and |replace_all| is modelled closely on +% the implementation used in \pkg{l3tl}. The difference is that we use a hard +% coded delimiter (\cs{s_@@_stop}) instead of searching for one that is always +% legal (we can't do redefinitions, so can't change the delimiter later based on +% the token list input). +% +% +% \begin{macro} +% { +% \@@_new_replace_def:NNn, +% \@@_new_replace_def_aux:NnNnN, \@@_new_replace_def_aux:Nn +% } +% We need another loop to guarantee unique names, if everything's alright we +% go on and define the user function using |#1| of +% \cs{@@_new_replace_def:NNn}. An empty search pattern is forbidden and should +% throw an error. +% \begin{macrocode} +\msg_new:nnn { etl } { empty-search-text } + { The~ search~ text~ of~ #1 must~ not~ be~ empty. } +\cs_new_protected:Npn \@@_new_replace_def:NNn #1#2#3 + { + \tl_if_empty:nTF {#3} + { \msg_error:nnn { etl } { empty-search-text } { #2 } } + { + \scan_stop: + \if_false: { \fi: + \exp_args:Nc \@@_new_replace_def_aux:NnNnN + { @@_user_function ~ replace ~ \tl_to_str:n {#3} ~ :Nnw } + ? + #2 {#3} + #1 + \if_false: } \fi: + } + } +\cs_new_protected:Npn \@@_new_replace_def_aux:NnNnN #1#2#3#4#5 + { + \cs_if_exist:NTF #1 + { + \@@_new_replace_def_aux:Nn \@@_tmp:w {#4} + \cs_if_eq:NNTF #1 \@@_tmp:w + { #5 #1#3 {#4} } + { + \exp_args:Nc \@@_new_replace_def_aux:NnNnN + { @@_user_function ~ replace #2 ~ \tl_to_str:n {#4} ~ :Nnw } + { #2? } #3 {#4} #5 + } + } + { + \@@_new_replace_def_aux:Nn #1 {#4} + #5 #1#3 {#4} + } + } +% \end{macrocode} +% The auxiliary macro uses a loop for the replacement. This is also used for +% the |once| variant. This saves internal functions if both an |all| and a +% |once| function are generated for the same search text (though the |once| +% variant could be coded easier and faster otherwise, but the performance hit +% should be small). +% \begin{macrocode} +\cs_new_protected:Npn \@@_new_replace_def_aux:Nn #1#2 + { + \cs_gset:Npn #1 ##1##2 ##3#2 + { + \@@_new_replace_wrap:w ##3 \s_@@_stop \@@_unexpanded:w {##2} + ##1 #1 {##2} {}{} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_new_replace_wrap:w} +% \begin{macro}{\@@_new_replace_once:w} +% \begin{macro}{\@@_new_replace_done:w} +% We need a few auxiliaries for the two replacement variants here. The first +% just grabs the already processed part of the token list and protects it from +% further expanding. The second breaks the loop for the |once| variant by +% protecting the remainder of the token list from further expanding. The last +% just gobbles the remainder of the loop by using an unbalanced brace trick. +% \begin{macrocode} +\cs_new:Npn \@@_new_replace_wrap:w #1\s_@@_stop + { \@@_unexpanded:w \exp_after:wN { \use_none:nn #1 } } +\cs_new:Npn \@@_new_replace_once:w #1#2 #3\s_@@_stop + { \@@_unexpanded:w \exp_after:wN { \use_none:nn #3 } } +\cs_new:Npn \@@_new_replace_done:w + { \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\etl_new_replace_once:Nn} +% \begin{macro}{\@@_new_replace_once:NNn} +% The |once| variant will use \cs{@@_new_replace_done_once:w} if the +% replacement is successful (that will remove the remainder of the loop, and +% protect both the replacement and the rest of the token list on which we work +% from further expanding). +% \begin{macrocode} +\cs_new_protected:Npn \etl_new_replace_once:Nn + { \@@_new_replace_def:NNn \@@_new_replace_once:NNn } +\cs_new_protected:Npn \@@_new_replace_once:NNn #1#2#3 + { + \cs_new:Npn #2 ##1##2 + { + \@@_unexpanded:w \@@_expanded:w + {{ + \if_false: { \fi: + #1 \@@_new_replace_once:w {##2} {}{} ##1 \s_@@_stop + \@@_new_replace_done:w #3 + } + }} + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\etl_new_replace_all:Nn} +% \begin{macro}{\@@_new_replace_all:NNn} +% The |all| variant will directly protect the replacement from further +% expanding and reiterate (due to the way the auxiliary is defined) until the +% replacement isn't found anymore. +% \begin{macrocode} +\cs_new_protected:Npn \etl_new_replace_all:Nn + { \@@_new_replace_def:NNn \@@_new_replace_all:NNn } +\cs_new_protected:Npn \@@_new_replace_all:NNn #1#2#3 + { + \cs_new:Npn #2 ##1##2 + { + \@@_unexpanded:w \@@_expanded:w + {{ + \if_false: { \fi: + #1 #1 {##2} {}{} ##1 \s_@@_stop + \@@_new_replace_done:w #3 + } + }} + } } % \end{macrocode} % \end{macro} diff --git a/macros/latex/contrib/etl/etl.pdf b/macros/latex/contrib/etl/etl.pdf index 36590e4a54..5bbf575b8a 100644 Binary files a/macros/latex/contrib/etl/etl.pdf and b/macros/latex/contrib/etl/etl.pdf differ diff --git a/macros/latex/contrib/exesheet/exesheet.cls b/macros/latex/contrib/exesheet/exesheet.cls new file mode 100644 index 0000000000..5cea657f2e --- /dev/null +++ b/macros/latex/contrib/exesheet/exesheet.cls @@ -0,0 +1,36 @@ +%% +%% This is file `exesheet.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% exesheet.dtx (with options: `class') +%% +%% This is a generated file. +%% +%% Copyright (C) 2020-2021 by Antoine Missier +%% +%% This file 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. +%% +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesClass{exesheet} + [2020/08/30 v1.1 .dtx exesheet file] + +\DeclareOption{notoc}{\PassOptionsToPackage{notoc}{exesheet}} +\DeclareOption{nosetlist}{\PassOptionsToPackage{nosetlist}{exesheet}} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +\ProcessOptions \relax +\LoadClass{article} +\RequirePackage{exesheet} +\RequirePackage{schooldocs} +\endinput +%% +%% End of file `exesheet.cls'. diff --git a/macros/latex/contrib/exesheet/exesheet.dtx b/macros/latex/contrib/exesheet/exesheet.dtx index c703f6434b..26ce619f4a 100644 --- a/macros/latex/contrib/exesheet/exesheet.dtx +++ b/macros/latex/contrib/exesheet/exesheet.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2020 by Antoine Missier +% Copyright (C) 2020-2021 by Antoine Missier % ---------------------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -23,7 +23,7 @@ %\ProvidesClass{exesheet} %\ProvidesPackage{exesheet} %<*class|package> - [2020/07/22 v1.0 .dtx exesheet file] + [2020/08/30 v1.1 .dtx exesheet file] % % %<*driver> @@ -77,7 +77,7 @@ %\author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}} \subject{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}} -\date{July 22, 2020, \fileversion} +\date{August 30, 2021, \fileversion} \hypersetup{% colorlinks, linkcolor=blue, @@ -91,7 +91,7 @@ % % \fi % -% \CheckSum{637} +% \CheckSum{638} % % \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 @@ -113,6 +113,8 @@ % \changes{v0.0}{2010/09/01}{Initial personal version} % \changes{v0.9}{2020/01/02}{Initial documentation in french} % \changes{v1.0}{2020/07/22}{Initial public version with documentation in english} +% \changes{v1.1}{2021/08/30}{macro tablenum replaced by tablenum1, small modifications due +% to changes in tasks package} % % \GetFileInfo{exesheet.dtx} % @@ -150,7 +152,8 @@ % we can do a correct version for all exercises together, or a correct version per exercise, % per part (subpart of exercise), per question, per sub-question. % -% Finally the original fonctionality of this package is the display of a detailed marking scheme, +% Finally the original fonctionality of this package is the display +% of a detailed marking scheme, % with optional explanations, in the margin of exercise answers. % % There are two possible options: \texttt{notoc} (see \ref{par:notoc}) @@ -177,22 +180,26 @@ % Try to use this first command now, it's easy. % % \bigskip +% |\hrulefill| can be put in the optional argument to produce an horizontal rule. +% % To bring additional text closer to the exercise number, % we can use the |\unskip| command % which eliminates preceding space, see the following example, obtained with -% |\exercise[\unskip : calculation]|: -% \exercise[\unskip: calculation] +% |\exercise[\unskip : calculation\ \hrulefill]|: +% \exercise[\unskip: calculation \ \hrulefill] % \psframe(-0.25,1.3)(12.75,-0.4) % Calculate $1+1$. % % \bigskip % \DescribeMacro{\exercisename} -% The word \emph{\exercisename} has automatic translation in a few languages\footnote{Translation +% The word \emph{\exercisename} has automatic translation +% in a few languages\footnote{Translation % is currently integrated into the package for the following languages: French, % German, Spanish, Italian, Portuguese.} % when the \textsf{babel} package is loaded. % It can be redefined, with |\renewcommand|, which should be placed -% after |\begin{document}|, or else we can use macros from the \textsf{babel} package (allowing dynamic language change), e.g.\\ +% after |\begin{document}|, or else we can use macros from the \textsf{babel} +% package (allowing dynamic language change), e.g.\\ % |\addto\captionssweedish{\def\exercisename{\"Ovning}}| (in the preamble). % % \DescribeMacro{\labelexercise} @@ -248,7 +255,6 @@ % uses |\subpartname| (with automatic translation in a few languages % if \textsf{babel} is loaded), % |\labelsubpart| and |\labelsubpartstyle|, which are editable. -% \pagebreak % % \DescribeMacro{\subpart*} % Like |\exercise*|, the starred version |\subpart*|\oarg{opt}\marg{label} @@ -257,12 +263,13 @@ % % \subsection{The \texttt{\bs annex} command} % \DescribeMacro{\annex} -% The |\annex|\oarg{opt} command typesets the title \textbf{ANNEX}, in uppercase letters, centred +% The |\annex|\oarg{opt} command typesets the title \textbf{ANNEX}, +% in uppercase letters, centred % and in the subsection style, % with an optional parameter, added on the same line. % % \vspace{-\baselineskip} -% \noindent\psframe(-0.25,-0.25)(12.75,-1.25) +% \noindent\psframe(-0.25,-0.3)(12.75,-1.25) % \annex[(to return)] % % \DescribeMacro{\annexname} @@ -287,7 +294,8 @@ % % \subsection{Short exercises: the \texttt{\bs exe} command} % \DescribeMacro{\exe} -% The |\exe| command starts an exercise by the abbreviation \textbf{\exname}.\ followed by the exercise number, +% The |\exe| command starts an exercise by the abbreviation \textbf{\exname}.\ +% followed by the exercise number, % without using sectioning commands, and the exercise body begins on the same % line. An exercise starts a new paragraph without indentation. % @@ -311,7 +319,7 @@ % The starred version prints no separator as shown below: % % \vspace{-\baselineskip} -% \noindent\psframe(-0.25,-0.35)(12.75,-1.2) +% \noindent\psframe(-0.25,-0.35)(12.75,-1.1) % \exe* Another short exercise without separator. % % \subsection{The \texttt{\bs points} command} @@ -319,7 +327,8 @@ % The |\points|\marg{pts} command displays the number of points awarded to an exercise. % It is intended to be entered in the optional argument of the % |\exercise| command\footnote{This command which has to be used -% in the optional argument of \texttt{\bs exercise}, as several others presented below, is incompatible with +% in the optional argument of \texttt{\bs exercise}, as several others presented below, +% is incompatible with % the \textsf{memoir} class which redefines section commands.}. % |\exercise[\points{5}]| yields: % \exercise[\points{5}] @@ -374,7 +383,8 @@ % \end{enumerate} % % \DescribeMacro{nosetlist} -% We can avoid enumeration list modifications and restore the \LaTeX\ default settings by passing the option +% We can avoid enumeration list modifications and restore the \LaTeX\ +% default settings by passing the option % \texttt{nosetlist} to the \texttt{exesheet} class or package. % % \subsection{List of exercises : the \texttt{exenumerate} environment} @@ -382,13 +392,14 @@ % When an exercise sheet is made of short independant exercises, % it would be ill-advised to display the complete title \emph{\exercisename} for each. % In addition to the |\exe| command, previously presented, -% we provide an even lighter solution with the |exenumerate| environment, which is only an enumeration list in which +% we provide an even lighter solution with the |exenumerate| environment, +% which is only an enumeration list in which % spaces between items are further increased compared with those of \texttt{enumerate}. % Here is an example (the main list is an \texttt{exenumerate} environment but % sublists are produced with regular \texttt{enumerate} environments): % % \vspace{-\baselineskip} -% \noindent\psframe(-0.25,-0.3)(12.75,-7.05) +% \noindent\psframe(-0.25,-0.3)(12.75,-6.75) % \begin{exenumerate} % \item Translate the following sentences in english: % \begin{enumerate} @@ -405,54 +416,56 @@ % \item Nulla ullamcorper vestibulum turpis. % \end{enumerate} % \end{exenumerate} -% The environment takes an optional parameter, like \texttt{enumerate}, which enables, among others, +% The environment takes an optional parameter, like \texttt{enumerate}, +% which enables, among others, % to typeset alternative list labels, e.g. % |\begin{exenumerate}[A.]|. % There are many other options (see the \textsf{enumitem} package documentation). % -% \subsection{Items aligned by lines: \texttt{tablenum}} -% \DescribeEnv{tablenum} +% \subsection{Items aligned by lines} +% \DescribeEnv{tablenum1} % \DescribeEnv{tablenuma} % \DescribeEnv{tablitem} -% These three environments are used to typeset short questions (\texttt{tablenum}), +% These three environments are used to typeset short questions (\texttt{tablenum1}), % sub-questions (\texttt{tablenuma}) or \texttt{itemize} lists (\texttt{tablitem}) % on the same line. They have the same syntax: -% |\begin{tablenum}|\oarg{opt}|(|\meta{cols}|)|. +% |\begin{tablenum1}|\oarg{opt}|(|\meta{cols}|)|. % The \meta{cols} parameter is the number of columns used by the environment. It must be % \emph{in parentheses}. This parameter can be omitted, then its value is 2. % As for classic lists, each item begins with the |\item| command. % % These three environments are defined by the -% |\NewTasks| macro, from the \textsf{tasks} package by Clemens Niederberger. +% |\NewTasksEnvironment| macro, from the \textsf{tasks} package by Clemens Niederberger. % They take an optional argument \meta{opt} % explained in the documentation of this package, -% e.g.\ |counter-format=tsk[r])| gives a roman numbering -% following by a closing parenthesis. +% e.g.\ |label=1)| gives a roman numbering +% following by a closing parenthesis (like in \texttt{enumitem} +% or \texttt{enumerate} packages. % There are also many possibilities to place items in an original way, % for instance, the |\item*| command allows to % specify the number of columns the item is supposed to span. % In the following example, % the five |\item| are placed in order between -% |\begin{tablenum}(3)| and |\end{tablenum}|. +% |\begin{tablenum1}(3)| and |\end{tablenum1}|. % Notice that numbering is made line by line. % % \exercise % \psframe(-0.25,1.3)(12.75,-2.7) % Give the derivative of the following functions: -% \begin{tablenum}(3) +% \begin{tablenum1}(3) % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$, % \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$, % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$, % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$, % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$. -% \end{tablenum} +% \end{tablenum1} % % For \texttt{tablenuma}, labels are % letters (a, b, c, \ldots) surrounded % by parentheses. This cannot be modified globally -% (except by redefining the environment with |\RenewTasks|). +% (except by redefining the environment with |\RenewTasksEnvironment|). % If the \textsf{exesheet} package is called with option \texttt{nosetlist}, -% labels of \texttt{tablenum} and \texttt{tablenuma} environments +% labels of \texttt{tablenum1} and \texttt{tablenuma} environments % are displayed in normal font with indentation, as for % \texttt{enumerate}. % @@ -502,7 +515,7 @@ % and a number of items which can be different from one column to the other. % Moreover, an advantage of \texttt{colsenum} is that the choice of labels % is automatic depending on the list level (and the language), -% unlike \texttt{tablenum} or \texttt{tablenuma}. +% unlike \texttt{tablenum1} or \texttt{tablenuma}. % % \DescribeEnv{colsitem} % \DescribeEnv{colsitem*} @@ -510,7 +523,8 @@ % produces items aligned by columns rather than by lines as for % \texttt{tablitem}: % |\begin{colsitem}|\oarg{opt}\marg{cols}. The optional parameter, -% which is passed to the underlying \texttt{itemize} environment, allows to change the item label (bullet by default). +% which is passed to the underlying \texttt{itemize} environment, +% allows to change the item label (bullet by default). % And, as for \texttt{colsenum*}, the \texttt{colsitem*} environment % produces an alignment of columns from the bottom. % @@ -541,7 +555,8 @@ % the title \textbf{\correctionname} is displayed at the beginning % of the \texttt{answers} environment. % It is defined by the |\correctionname| macro (with translation in a few languages -% and that we can change:\footnote{Except for English, if you want to change package keywords you have to do it \emph{after} \texttt{\bs begin\{document\}} +% and that we can change:\footnote{Except for English, if you want to change package +% keywords you have to do it \emph{after} \texttt{\bs begin\{document\}} % because \textsf{babel} will modify these definitions at the end of the preamble.} % for example we may prefer \emph{Solution} % than \emph{\correctionname}). @@ -672,16 +687,19 @@ % \DescribeMacro{\displaypts} % The display of the marking scheme, as above, is internally controlled by the % \texttt{marginpts} boolean. -% The |\displaypts| command, which has to be placed in the preamble, defines \texttt{marginpts} to \texttt{true}, +% The |\displaypts| command, which has to be placed in the preamble, +% defines \texttt{marginpts} to \texttt{true}, % places marginal notes to the left (and not to the right which % is the default behavior of \LaTeX) % and shifts the text body right to increase the left margin compared % with the right one, with a ratio 3:2, % as it is in the present document. % This ratio is defined by the -% |geometry| macro from the \textsf{geometry} package (by Hideo Umeki) and is valid for the whole document. +% |geometry| macro from the \textsf{geometry} package (by Hideo Umeki) +% and is valid for the whole document. % -% \subsection{The \texttt{\bs totalexe}, \texttt{\bs note} and \texttt{\bs totalpoints} commands} +% \subsection{The \texttt{\bs totalexe}, \texttt{\bs note} +% and \texttt{\bs totalpoints} commands} % \label{totalpoints} % \DescribeMacro{\totalexe} % \DescribeMacro{\note} @@ -701,14 +719,15 @@ % \psframe(-3.5,1.3)(12.75,-3.1) % For each following question, say if the assertion is true or false. % Justify the answer carefully. -% \begin{tablenum} +% \begin{tablenum1} % \item $\ds \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}} \,\mathrm{d}x = \ln 2$, % \item $\ds \int_{2}^{\mathrm{e}} \frac{1}{x\ln x} \,\mathrm{d}x = -\ln 2$, % \item* The function $F$ defined on $\mathbf{R}$ by -% $F(x) = \ds \int_{0}^{x}\frac{1}{,t^2+t+1}\,\mathrm{d} t$, is increasing on $\mathbf{R}$. -% \end{tablenum} +% $F(x) = \ds \int_{0}^{x}\frac{1}{,t^2+t+1}\,\mathrm{d} t$ is increasing on $\mathbf{R}$. +% \end{tablenum1} % \end{questions} % +% \pagebreak % \begin{answers} % \vspace{-\baselineskip} % \noindent\psframe(-4.7,0.9)(12.75,-10.25) @@ -789,13 +808,15 @@ % to \texttt{true}, chooses the left margin for display marginal notes % and sets the ratio between left and right margins to 3:2\footnote{So % that the effect on the margin ratio is correct, the -% \texttt{\bs displaypoints} macro must be placed after other commands that could alter the page geometry, for example the \texttt{\bs pagestyle} +% \texttt{\bs displaypoints} macro must be placed after other commands +% that could alter the page geometry, for example the \texttt{\bs pagestyle} % of the \textsf{schooldocs} package.}. % Points will then be displayed without the comments. % % \DescribeMacro{\displaynotes} % The |\displaynotes|\oarg{align} macro, to be placed also in the preamble, -% defines both booleans to \texttt{true} and allows then the complete display of points and comments. +% defines both booleans to \texttt{true} and allows then the complete display +% of points and comments. % The ratio between left/right margins is then set to 5/1\footnote{The % present document kept a ratio of 3/2 because % the \textsf{ltxdoc} class, used here, leaves large enough margins @@ -1093,7 +1114,9 @@ % % When using \textsf{babel} with the \texttt{french} option\footnote{The \texttt{french} option % of \textsf{babel} superseeds the \texttt{frenchb} option.}, -% \texttt{itemize} lists are modified with the same dash label for each list level. These modifications are cancelled here to restore default \LaTeX\ \texttt{itemize} lists (labels and spaces). +% \texttt{itemize} lists are modified with the same dash label for each list level. +% These modifications are cancelled here to restore default +% \LaTeX\ \texttt{itemize} lists (labels and spaces). % As for |\exetranslate|, % we have create the |\standardfrenchlists| command who must be called into % |AtBeginDocument| or not, depending on whether @@ -1135,37 +1158,38 @@ % \end{macrocode} % \end{macro} -% \DescribeEnv{tablenum} \DescribeEnv{tablenuma} +% \DescribeEnv{tablenum1} \DescribeEnv{tablenuma} % The |\NewTasks| command comes from the \textsf{tasks} package. -% It allows to define the environments \texttt{tablenum}, \texttt{tablenuma} +% It allows to define the environments \texttt{tablenum1}, \texttt{tablenuma} % and \texttt{tablitem}. % The horizontal spaces are adjusted to get a good alignment with % items of other \texttt{enumerate} (or \texttt{itemize}) environments. % % \begin{macrocode} \ifthenelse{\boolean{nosetlist}}{ - \NewTasks[counter-format=tsk[1]., + \NewTasksEnvironment[label=1., column-sep=1em, - after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum}[\item](2) - \NewTasks[counter-format=(tsk[a]), + after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2) + \NewTasksEnvironment[label=(a), column-sep=1em,label-align=right, item-indent=2.15em,label-width=1.6em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) }{% by default - \NewTasks[counter-format=tsk[1].,label-format=\bfseries, + \NewTasksEnvironment[label=1.,label-format=\bfseries, column-sep=1em,label-align=right, item-indent=1.5em,label-width=1em,label-offset=0.5em, - after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum}[\item](2) - \NewTasks[counter-format=(tsk[a]),label-format=\bfseries, + after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2) + \NewTasksEnvironment[label=(a),label-format=\bfseries, column-sep=1em,label-align=right, item-indent=2.15em,label-width=1.6em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) } +\PackageWarning{exesheet}{Environment tablenum is deprecated and replaced by tablenum1} % \end{macrocode} % \DescribeEnv{tablitem} % \begin{macrocode} -\NewTasks[label=\labelitemi, +\NewTasksEnvironment[label=\labelitemi, label-align=right, item-indent=2.3333em,label-offset=0.5em, after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablitem}[\item](2) @@ -1239,9 +1263,11 @@ % % \begin{environment}{questions} % It is the |\comment| and |\endcomment| macros, provided by the \textsf{versions} package, -% that allow the magic of conditional displays (we can also find them in the \textsf{verbatim} or \textsf{version} packages). +% that allow the magic of conditional displays (we can also find them +% in the \textsf{verbatim} or \textsf{version} packages). % The noteworthy \textsf{codesection} package, allows to encapsulate -% optional code between the macros |\BeginCodeSection|\marg{skip} and |\EndCodeSection|\marg{skip}, +% optional code between the macros |\BeginCodeSection|\marg{skip} +% and |\EndCodeSection|\marg{skip}, % both in the text body and in the preamble, % but these macros cannot be used inside an environment % as we did here for |\comment| and |\endcomment|. @@ -1351,7 +1377,8 @@ % The commands |\displaypts|, |\displaypoints| and |\displaynotes| % change the ratio between left and right margins\footnote{So % that the effect on the margin ratio is correct, these -% macros must be called, in the preamble, after other commands that also could alter the page geometry.}. +% macros must be called, in the preamble, after other commands +% that also could alter the page geometry.}. % % \DescribeMacro{\pts} \DescribeMacro{\displaypts} % \begin{macrocode} @@ -1378,7 +1405,8 @@ % % \begin{macro}{\totalexe} % In the following macros using -% |\marginpar|, percent symbols and |\ignorespaces| are necessary to avoid too much space in the text (or the margin) +% |\marginpar|, percent symbols and |\ignorespaces| are necessary +% to avoid too much space in the text (or the margin) % where these macros are inserted. % \begin{macrocode} \newlength{\ptsboxlength} diff --git a/macros/latex/contrib/exesheet/exesheet.ins b/macros/latex/contrib/exesheet/exesheet.ins index 37b10a4848..78bc7fd514 100644 --- a/macros/latex/contrib/exesheet/exesheet.ins +++ b/macros/latex/contrib/exesheet/exesheet.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2020 by Antoine Missier +%% Copyright (C) 2020-2021 by Antoine Missier %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3 of this license @@ -21,7 +21,7 @@ This is a generated file. -Copyright (C) 2020 by Antoine Missier +Copyright (C) 2020-2021 by Antoine Missier This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license diff --git a/macros/latex/contrib/exesheet/exesheet.pdf b/macros/latex/contrib/exesheet/exesheet.pdf index 3783421f5a..f7efae7b5a 100644 Binary files a/macros/latex/contrib/exesheet/exesheet.pdf and b/macros/latex/contrib/exesheet/exesheet.pdf differ diff --git a/macros/latex/contrib/secnum/README.md b/macros/latex/contrib/secnum/README.md index 9ee10bcae8..48a2b3117d 100644 --- a/macros/latex/contrib/secnum/README.md +++ b/macros/latex/contrib/secnum/README.md @@ -1,12 +1,20 @@ # secnum -This package provides a macro \setsecnum to format section numbering intuitively. +This package provides a macro `\setsecnum` to format section numbering intuitively. ## Usage -One can simply use `\setsecnum{1.1.1}` to set the section numbering -format as `arabic.arabic.arabic` and depth to be 3. +One can simply use `\setsecnum{A,1.i}` to set the section numbering +format as `Alph` for the sections, `arabic` for the subsections and +`arabic.roman` for the subsubsections and +the `secnumdepth` and `tocdepth` will be 3. + +If one want to set the tocdepth manually, +there is an option `tocdep` for it. + +One may notice that the comma `,` plays a special role in the numbering format: +for deep levels, the numbering before the comma are hided. ## Installation @@ -16,7 +24,7 @@ The installation is the same as usual Tex packages. 1. Run the following to create the package file `secnum.sty` (as well as this file `README.md`) - XeTeX secnum.dtx + pdfTeX secnum.dtx 2. Move the following file into proper directories searched by TeX. The recommended directory is @@ -25,7 +33,7 @@ The installation is the same as usual Tex packages. 3. To produce the documentation run the following - XeLaTeX secnum.dtx + pdfLaTeX secnum.dtx 4. The recommended directory for the documentation is diff --git a/macros/latex/contrib/secnum/secnum.dtx b/macros/latex/contrib/secnum/secnum.dtx index 1220b7ec59..b8309f8c4d 100644 --- a/macros/latex/contrib/secnum/secnum.dtx +++ b/macros/latex/contrib/secnum/secnum.dtx @@ -29,12 +29,20 @@ # secnum -This package provides a macro \setsecnum to format section numbering intuitively. +This package provides a macro `\setsecnum` to format section numbering intuitively. ## Usage -One can simply use `\setsecnum{1.1.1}` to set the section numbering -format as `arabic.arabic.arabic` and depth to be 3. +One can simply use `\setsecnum{A,1.i}` to set the section numbering +format as `Alph` for the sections, `arabic` for the subsections and +`arabic.roman` for the subsubsections and +the `secnumdepth` and `tocdepth` will be 3. + +If one want to set the tocdepth manually, +there is an option `tocdep` for it. + +One may notice that the comma `,` plays a special role in the numbering format: +for deep levels, the numbering before the comma are hided. ## Installation @@ -44,7 +52,7 @@ The installation is the same as usual Tex packages. 1. Run the following to create the package file `secnum.sty` (as well as this file `README.md`) - XeTeX secnum.dtx + pdfTeX secnum.dtx 2. Move the following file into proper directories searched by TeX. The recommended directory is @@ -53,7 +61,7 @@ The installation is the same as usual Tex packages. 3. To produce the documentation run the following - XeLaTeX secnum.dtx + pdfLaTeX secnum.dtx 4. The recommended directory for the documentation is @@ -135,8 +143,8 @@ The Current Maintainer of this work is \usepackage{indentfirst} \usepackage{booktabs} \usepackage{xcolor} -\usepackage{secnum} -\setsecnum{A} +\usepackage[tocdep=2]{secnum} +\setsecnum{A,1.i} \ExplSyntaxOn \cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n \ExplSyntaxOff @@ -168,20 +176,31 @@ The Current Maintainer of this work is % % \tableofcontents % \begin{documentation} +% +% \section{Example} +% This document uses the following setting of section numbering format. +% \begin{verbatim} +% \usepackage[tocdep=2]{secnum} +% \setsecnum{A,1.i} +% \end{verbatim} +% % \section{Usage} % Before using the macro, load the package in preamble. % \begin{verbatim} -% \usepackage{secnum} +% \usepackage{secnum} % \end{verbatim} -% Then, one can format the section numbering by using the +% +% \subsection{Set numbering format} +% One can format the section numbering by using the % marco \cs{setsecnum} in preamble. % \begin{function}{\setsecnum} % \begin{syntax} % \cs{setsecnum}\marg{num format} % \end{syntax} +% % A typical \meta{num format} is like this: % \begin{center} -% \verb|1.1.1| +% \verb|A,1.i| % \end{center} % It consists of some syntax abbrs of numbering formats, % reffering the follows, @@ -194,28 +213,87 @@ The Current Maintainer of this work is % \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. +% and some separators delimiting them. +% +% The separators can be any character except above abbrs, +% the tokens ``\verb|{|'', ``\verb|}|'' and ``\verb|#|'' +% (more precisely, explicit character tokens with category code +% 1 (begin-group) or 2 (end-group), and tokens with category code 6) and the space ``\verb*| |''. +% +% Note that \meta{num format} must end with an abbr. +% +% \begin{texnote} +% This command will overwrite +% \opt{secnumdepth} and \opt{tocdepth} +% \end{texnote} +% \end{function} +% +% \subsection{Breaking the numbering} +% The comma ``\verb|,|'' in above example is used as the breaking mark: +% for deep levels (in our case, deeper than sections), +% the numbering before ``\verb|,|'' will be hided. +% +% Note that the breaking mark must immediately follows an abbr. +% +% \subsection{Package options} +% \subsubsection{tocdep} +% There is an option setting \opt{tocdepth}, the table-of-contents depth manually. +% \begin{function}{ tocdep } +% \begin{syntax} +% \opt{tocdep} = \meta{integer} +% \end{syntax} +% +% The \meta{integer} refers to the table-of-contents depth, +% which should between $1$ and $5$. +% +% \begin{texnote} +% If this option is used, then \cs{setsecnum} will not overwrite \opt{tocdepth}. +% \end{texnote} +% \end{function} +% +% \subsubsection{breaking} +% Another option is used to change the breaking mark. +% \begin{function}{ breaking } +% \begin{syntax} +% \opt{breaking} = \meta{token} +% \end{syntax} +% +% The \meta{token} will be the breaking mark +% (the default is the comma ``\verb|,|''). +% It can be any character except above abbrs, +% the tokens ``\verb|{|'', ``\verb|}|'' and ``\verb|#|'' +% (more precisely, explicit character tokens with category code +% 1 (begin-group) or 2 (end-group), and tokens with category code 6) and the space ``\verb*| |''. % \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}, +% \item The main function eats the input, saying \opt{A,1.i}, % 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}'' +% ``\cs{Alph}\opt{,}\cs{arabic}\opt{.}\cs{roman}'' % \item Split this token list into a sequence by macros. -% In our example, it results ``\cs{Roman}'', -% ``\opt{.}\cs{arabic}'' and ``\opt{.}\cs{alph}''. +% In our example, it results ``\cs{Alph}'', +% ``\opt{,}\cs{arabic}'' and ``\opt{.}\cs{roman}''. % \item Store those codes in indivial containers. -% \item Use them to renew \cs{thesection}, \cs{thesubsection}, +% \item Detect if there is \cs{thechapter}. +% Skip the chapter level if not. +% In our example, this is the case. +% \item Use the containers to redefine +% \cs{thesection}, \cs{thesubsection}, % \cs{thesubsubsection} etc. -% provided there is no \cs{chapter}. +% In each step, detect if such level needs numbering and +% if there is a breaking mark in the container. +% In our example, the numbering formats will be redefined as % \end{enumerate} +% \begin{verbatim} +% \renewcommand*{\thesection}{\Alph{section}} +% \renewcommand*{\thesubsection}{\arabic{subsection}} +% \renewcommand*{\thesubsubsection}{thesubsection.\roman{subsubsection}} +% \end{verbatim} % % \end{documentation} % @@ -227,7 +305,7 @@ The Current Maintainer of this work is % Users can ignore. % \subsection{Preparations} % This package uses \LaTeX3. -% Therefore, the packages \pkg{expl3} and \pkg{xparse} +% Therefore, the packages \pkg{expl3}, \pkg{xparse} and \pkg{l3keys2e} % are needed and should use % \cs{ProvidesExplPackage} rather than \cs{ProvidesPackage}. % @@ -236,16 +314,17 @@ The Current Maintainer of this work is %<@@=syu> \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\ProvidesExplPackage{secnum}{2020/02/02}{} +\ProvidesExplPackage{secnum}{2021/08/28}{} { An intuitive way to format section numbering } -\RequirePackage{xparse} +\RequirePackage{xparse,l3keys2e} % \end{macrocode} % % \begin{variable}{ \l__syu_secnum_tl, \l__syu_secnum_seq } -% The two variables are used to store the formatting information. +% The variables are used to store the formatting information. % \begin{macrocode} \tl_new:N \l__syu_secnum_tl \seq_new:N \l__syu_secnum_seq +\int_new:N \l__syu_secnum_depth % \end{macrocode} % \end{variable} % @@ -287,8 +366,57 @@ The Current Maintainer of this work is % \end{macrocode} % \end{variable} % +% \begin{variable}{ \l__syu_secnum_bkm } +% This variable is used to store the breaking mark. +% \begin{macrocode} +\tl_new:N \g__syu_secnum_bkmr +\tl_gset:Nx \g__syu_secnum_bkmr {,} +% \end{macrocode} +% Note that one needs the following variants +% \begin{macrocode} +\cs_generate_variant:Nn \tl_if_in:NnTF { NV } +\cs_generate_variant:Nn \tl_remove_all:Nn { NV } +% \end{macrocode} +% \end{variable} +% +% \changes{2020/01/12}{2020/01/12}{Add package option to set \opt{tocdepth}.} +% \subsection{Package option} +% \begin{macrocode} +\keys_define:nn { syu / options } + { +% \end{macrocode} +% +% \begin{macro}{ tocdep } +% Set the table-of-contents depth. +% \begin{macrocode} + tocdep .code:n = + { + \int_const:Nn \g__syu_tocdep {#1} + \setcounter{tocdepth}{ \g__syu_tocdep } + }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ breaking } +% Set the breaking mark used in \meta{num format}. +% \begin{macrocode} + breaking .code:n = + { + \tl_gset:Nx \g__syu_secnum_bkmr {#1} + }, +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + } +% \end{macrocode} +% +% Passing keys to options. +% \begin{macrocode} +\ProcessKeysOptions{ syu / options } +% \end{macrocode} +% % \subsection{Main function} -% % \begin{macro}{\setsecnum} % Here is the definition of the main function \cs{setsecnum}. % \begin{macrocode} @@ -314,8 +442,30 @@ The Current Maintainer of this work is % Set the \opt{secnumdepth} and \opt{tocdepth}. % \changes{2020/01/12}{2020/01/12}{Add codes to set \opt{tocdepth}.} % \begin{macrocode} - \setcounter{secnumdepth}{ \seq_count:N \l__syu_secnum_seq } - \setcounter{tocdepth}{ \seq_count:N \l__syu_secnum_seq } + \int_set:Nn \l__syu_secnum_depth + { + \seq_count:N \l__syu_secnum_seq + } + \setcounter{secnumdepth} + { + \int_eval:n + { + \l__syu_secnum_depth - \g__syu_if_thechapter_int + } + } + \int_if_exist:NTF \g__syu_tocdep + { + \setcounter{tocdepth}{ \g__syu_tocdep } + } + { + \setcounter{tocdepth} + { + \int_eval:n + { + \l__syu_secnum_depth - \g__syu_if_thechapter_int + } + } + } % \end{macrocode} % Format numberings. % \begin{macrocode} @@ -434,14 +584,28 @@ The Current Maintainer of this work is \cs_new:Nn \__syu_secnum: { % \end{macrocode} +% \subsubsection{Detect if there is \cs{thechapter}}\noindent % 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} +% Test if the numbering breaks before section. +% \begin{macrocode} + \tl_if_in:NVTF \g__syu_section_tl \g__syu_secnum_bkmr + { + \tl_remove_all:NV \g__syu_section_tl \g__syu_secnum_bkmr + \renewcommand*{\thesection} + { \g__syu_section_tl {section} } + } + { + \renewcommand*{\thesection} + { + \thechapter + \g__syu_section_tl {section} + } + } % \end{macrocode} % Otherwise start from \cs{thesection}. % \begin{macrocode} @@ -450,21 +614,107 @@ The Current Maintainer of this work is { \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} } - } +% +% \changes{2021/08/28}{2021/08/28}{The usage of breaking commas} +% \subsubsection{Subsections}\noindent +% Test if the subsections are needed to be numbered. +% \begin{macrocode} + \tl_if_empty:NTF \g__syu_subsection_tl + {} + { +% \end{macrocode} +% Test if the numbering breaks before subsection. +% \begin{macrocode} + \tl_if_in:NVTF \g__syu_subsection_tl \g__syu_secnum_bkmr + { + \tl_remove_all:NV \g__syu_subsection_tl \g__syu_secnum_bkmr + \renewcommand*{\thesubsection} + { \g__syu_subsection_tl {subsection} } + } + { + \renewcommand*{\thesubsection} + { + \thesection + \g__syu_subsection_tl {subsection} + } + } + } +% \end{macrocode} +% +% \subsubsection{Subsubsections}\noindent +% Test if the subsubsections are needed to be numbered. +% \begin{macrocode} + \tl_if_empty:NTF \g__syu_subsubsection_tl + {} + { +% \end{macrocode} +% Test if the numbering breaks before subsubsection. +% \begin{macrocode} + \tl_if_in:NVTF \g__syu_subsubsection_tl \g__syu_secnum_bkmr + { + \tl_remove_all:NV \g__syu_subsubsection_tl \g__syu_secnum_bkmr + \renewcommand*{\thesubsubsection} + { \g__syu_subsubsection_tl {subsubsection} } + } + { + \renewcommand*{\thesubsubsection} + { + \thesubsection + \g__syu_subsubsection_tl {subsubsection} + } + } + } +% \end{macrocode} +% +% \subsubsection{Paragraphs}\noindent +% Test if the paragraphs are needed to be numbered. +% \begin{macrocode} + \tl_if_empty:NTF \g__syu_paragraph_tl + {} + { +% \end{macrocode} +% Test if the numbering breaks before paragraph. +% \begin{macrocode} + \tl_if_in:NVTF \g__syu_paragraph_tl \g__syu_secnum_bkmr + { + \tl_remove_all:NV \g__syu_paragraph_tl \g__syu_secnum_bkmr + \renewcommand*{\theparagraph} + { \g__syu_paragraph_tl {paragraph} } + } + { + \renewcommand*{\theparagraph} + { + \thesubsubsection + \g__syu_paragraph_tl {paragraph} + } + } + } +% \end{macrocode} +% +% \subsubsection{Subparagraphs}\noindent +% Test if the subparagraphs are needed to be numbered. +% \begin{macrocode} + \tl_if_empty:NTF \g__syu_subparagraph_tl + {} + { +% \end{macrocode} +% Test if the numbering breaks before paragraph. +% \begin{macrocode} + \tl_if_in:NVTF \g__syu_subparagraph_tl \g__syu_secnum_bkmr + { + \tl_remove_all:NV \g__syu_subparagraph_tl \g__syu_secnum_bkmr + \renewcommand*{\thesubparagraph} + { \g__syu_subparagraph_tl {subparagraph} } + } + { + \renewcommand*{\thesubparagraph} + { + \theparagraph + \g__syu_subparagraph_tl {subparagraph} + } + } + } + } % \end{macrocode} % \end{variable} % @@ -477,4 +727,4 @@ The Current Maintainer of this work is % \changes{2020/01/01}{2020/01/01}{Correct the package name.} % % \Finale -\endinput \ No newline at end of file +\endinput diff --git a/macros/latex/contrib/secnum/secnum.pdf b/macros/latex/contrib/secnum/secnum.pdf index 101df250f9..de3f9929b9 100644 Binary files a/macros/latex/contrib/secnum/secnum.pdf and b/macros/latex/contrib/secnum/secnum.pdf differ -- cgit v1.2.3