texlive[72072] Master/texmf-dist: moremath (20aug24)
commits+karl at tug.org
commits+karl at tug.org
Tue Aug 20 21:31:39 CEST 2024
Revision: 72072
https://tug.org/svn/texlive?view=revision&revision=72072
Author: karl
Date: 2024-08-20 21:31:39 +0200 (Tue, 20 Aug 2024)
Log Message:
-----------
moremath (20aug24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/moremath/moremath-doc.pdf
trunk/Master/texmf-dist/source/latex/moremath/moremath.dtx
trunk/Master/texmf-dist/tex/latex/moremath/moremath.sty
Modified: trunk/Master/texmf-dist/doc/latex/moremath/moremath-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/moremath/moremath.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/moremath/moremath.dtx 2024-08-19 23:42:05 UTC (rev 72071)
+++ trunk/Master/texmf-dist/source/latex/moremath/moremath.dtx 2024-08-20 19:31:39 UTC (rev 72072)
@@ -67,6 +67,18 @@
date = {2024-03-11},
version = {1.30},
}
+
+ at comment{Below are non-package References}
+
+ at article{package-rollback,
+ title = {A rollback concept for packages and classes},
+ author = {Frank Mitelbach},
+ year = {2018},
+ journaltitle = {TUGboat},
+ number = 2,
+ url = {https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf},
+ urldate = {2024-08-06},
+}
\end{filecontents*}
\begin{filecontents*}[overwrite]{\jobname-ams-op-table.tex}
\begin{tabular}{rlrlrlrl}
@@ -161,6 +173,7 @@
% \AddVersion{v0.2.0}{2024-07-04}
% \AddVersion{v0.3.0}{2024-07-08}
% \AddVersion{v0.4.0}{2024-07-15}
+% \AddVersion{v0.5.0}{2024-08-20}
%
% ^^X Placeholder for unreleased versions
% \AddVersion{vUNRELEASED}{UNRELEASED}
@@ -238,7 +251,7 @@
% on their own.
%
% There are also other things that can be improved when typesetting math.
-% One prominent example is the typsetting of row and column vectors,
+% One prominent example is the typesetting of row and column vectors,
% which require the use of a \env{matrix} environment.
% For this case \pkg{moremath} provides commands which accept a comma separated
% list of vector entries,
@@ -888,7 +901,7 @@
% \end{gather*}
% \end{minipage}
%
-% \item Feynman-Notation:
+% \item Feynman-notation:
%
% \begin{minipage}{.49\linewidth}
% \begin{verbatim}
@@ -1351,7 +1364,9 @@
% Valid keys are "delimiter", "fill", and "align",
% their usage is described in section~\ref{sec:options-matrix}.
%
-% \begin{function}{
+% \begin{function}[
+% updated=2024-08-20,
+% ]{
% \cvector,
% \rvector
% }
@@ -1443,7 +1458,7 @@
%
% As vectors are commonly delimited by parenthesis, brackets, braces, etc.\
% several shorthands producing delimited vectors are also available.
-% \begin{function}{
+% \begin{function}[updated=2024-08-20]{
% \pcvector,
% \bcvector,
% \Bcvector,
@@ -1504,7 +1519,9 @@
% This package provides analogous commands for row and column vectors
% to be typeset in inline math mode.
%
-% \begin{function}{
+% \begin{function}[
+% updated=2024-08-20,
+% ]{
% \smallcvector,
% \smallrvector
% }
@@ -1530,7 +1547,7 @@
% \(\smallcvector{1,0}\).
% \end{quote}
%
-% \begin{function}{
+% \begin{function}[updated=2024-08-20]{
% \psmallcvector,
% \bsmallcvector,
% \Bsmallcvector,
@@ -2215,7 +2232,7 @@
% \cs{moremath_delim_nabla_op_manuscale:NNnnn} \meta{operator} \meta{delim}
% \hspace*{2ex} \marg{scale~cmd} \marg{sub} \marg{contents}
% \end{syntax}
-% The usage of function is similar to the above functions
+% The usage of this function is similar to the above functions
% except for the additional argument \meta{scale~cmd} which is a token list
% with a \meta{size~cmd} that should be understood by \pkg{mathtools}
% (e.g.\ \cs{big}, \cs{Big}, etc.).
@@ -2224,11 +2241,18 @@
% \section{Formatting Matrices and Vectors}
% \label{sec:authors-matrix}
%
-% \begin{function}[updated=2024-07-15]{
+% \begin{function}[
+% updated=2024-07-15,
+% updated=2024-08-20,
+% ]{
% \moremath_column_vector:nn,
+% \moremath_column_vector:Vn,
% \moremath_row_vector:nn,
+% \moremath_row_vector:Vn,
% \moremath_column_smallvector:nn,
-% \moremath_row_smallvector:nn
+% \moremath_column_smallvector:Vn,
+% \moremath_row_smallvector:nn,
+% \moremath_row_smallvector:Vn,
% }
% \begin{syntax}
% \cs{moremath_column_vector:nn} \marg{delim spec tl} \marg{clist}
@@ -2256,6 +2280,7 @@
% \begin{function}[
% updated = 2024-07-04,
% updated=2024-07-15,
+% updated=2024-08-20,
% ]{
% \moremath_diagonal_matrix:nn,
% \moremath_diagonal_matrix:nV,
@@ -2330,6 +2355,7 @@
% \begin{function}[
% added=2024-07-08,
% updated=2024-07-15,
+% updated=2024-08-20,
% ]{
% \moremath_vcenter:n,
% }
@@ -2388,10 +2414,23 @@
% (especially for using the "=" option specification)
% and hooks.
%
+% Afterwards we provide rollback information,
+% for the \pkg{latexrelease} rollback mechanism.
+% (See \textcite{package-rollback} for more information.)
+%
+% For the v0.x.x versions I've decided on using the date of the first release
+% that was uploaded to CTAN\@.
+% \begin{macrocode}
+\DeclareCurrentRelease{v0}{2024-07-15}
+% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Add information for \LaTeX{}'s package rollback mechanism.
+% }
+%
% Then identify this package as \pkg{moremath}.
% \begin{macrocode}
\ProvidesExplPackage{moremath}
- {2024-07-15}{v0.4.0}{More Math Macros}
+ {2024-08-20}{v0.5.0}{More Math Macros}
% \end{macrocode}
%
% ^^X Debugging switch
@@ -2830,6 +2869,161 @@
% \end{macrocode}
%
%
+% \section{Abstractions for \TeX{}-primitives and \LaTeXe{}-commands}
+% \label{sec:impl-abstractions}
+%
+% As this package makes use of certain \TeX{}-primitives and \LaTeXe{}-commands,
+% which are either part of the \LaTeX{}-kernel or of some package.
+% It is sensible to provide a (package internal) abstraction for those commands,
+% so that they can be switched out once a \LaTeX3{}-command has been defined for them.
+%
+% \subsection{\TeX{}-primitives}
+% \label{sec:impl-tex-abstractions}
+%
+% \begin{macro}[added=2024-08-20]{
+% \@@_tex_vcenter:n,
+% }
+% \cs{@@_tex_vcenter:n} is an abstraction for \cs{tex_vcenter:D}
+% i.e.\ \tn{vcenter}.
+% Its single argument is passed to \cs{tex_vcenter:D}.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_tex_vcenter:n
+{
+ \tex_vcenter:D {#1}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[added=2024-08-20]{
+% \@@_tex_mathpalette:Nn,
+% }
+% The function \cs{@@_tex_mathpalette:Nn} is an abstraction for the \tn{mathpalette},
+% primitive.
+% The function takes two arguments
+% \begin{arguments}
+% \item The \meta{csname} of the macro to pass to \tn{mathpalette}
+%
+% This macro \textbf{must} accept \textbf{two} arguments:
+% The first is a single token containing the current math-style,
+% the second is the contents to \enquote{typeset}.
+% See \url{https://tex.stackexchange.com/questions/34393/the-mysteries-of-mathpalette/34412#34412}
+% for further information.
+%
+% \item The \meta{tokens} to forward to the macro passed as first argument.
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_tex_mathpalette:Nn
+{
+ \mathpalette #1 {#2}
+}
+% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Added new function.
+% }
+% \end{macro}
+%
+% \begin{macro}[added=2024-08-20]{
+% \@@_tex_mathsurround:n
+% }
+% The function \cs{@@_tex_mathsurround:n} provides (hopefully) a correct abstraction
+% for the \tn{mathsurround} primitive.
+% It takes one argument
+% \begin{arguments}
+% \item A \meta{length~expr} for the whitespace surrounding a math switch.
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected_nopar:Nn \@@_tex_mathsurround:n
+{
+ \tex_mathsurround:D = #1
+}
+% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Added new function.
+% }
+% \end{macro}
+%
+% \begin{macro}[added=2024-08-20]{
+% \@@_tex_mathop:n
+% }
+% The function \cs{@@_tex_mathop:n} provides an abstraction for the \tn{mathop}
+% \TeX{}-primitive.
+% It accepts a single argument:
+% \begin{arguments}
+% \item \meta{Tokens} to treat as a math operator.
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected_nopar:Nn \@@_tex_mathop:n
+{
+ \tex_mathop:D {#1}
+}
+% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Added new function.
+% }
+% \end{macro}
+%
+%
+% \subsection{\LaTeXe{}-commands}
+% \label{sec:impl-latex-abstractions}
+%
+% \begin{macro}[EXP,added=2024-08-20]{
+% \@@_matrix_star_begin:nn,
+% \@@_matrix_star_begin:nV,
+% \@@_matrix_star_begin:Vn,
+% \@@_matrix_star_begin:VV,
+% \@@_matrix_star_end:n,
+% \@@_matrix_star_end:V,
+% }
+% The functions \cs{@@_matrix_star_begin:nn} and \cs{@@_matrix_star_end:n}
+% provide an abstraction to the \env{matrix*} family of environments provided
+% by \pkg{mathtools}.
+% \NB{MI}{These functions need to be expandable,
+% as they produce an empty line otherwise.}
+%
+% \cs{@@_matrix_star_begin:nn} takes two arguments:
+% \begin{arguments}
+% \item A \meta{tl} determining the type of the matrix.
+%
+% This is used to further specify which "matrix*" environment to use.
+%
+% The \meta{tl} may be empty.
+%
+% \item A \meta{tl} specifying the column type.
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_nopar:Nn \@@_matrix_star_begin:nn
+{
+ \begin{ #1 matrix* } [ #2 ]
+}
+% \end{macrocode}
+% We also create "nV", "Vn", and "VV" variants of this function:
+% \begin{macrocode}
+\cs_generate_variant:Nn \@@_matrix_star_begin:nn { nV, Vn, VV }
+% \end{macrocode}
+%
+% The function \cs{@@_matrix_star_end:n} takes only one argument
+% \begin{arguments}
+% \item The \meta{tl} determining the type of the \env{matrix*} environment.
+%
+% The \meta{tl} \textbf{must} have the same value as used for
+% \cs{@@_matrix_star_begin:nn}.
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_nopar:Nn \@@_matrix_star_end:n
+{
+ \end{ #1 matrix* }
+}
+% \end{macrocode}
+% We also provide a "V" type variant of this function.
+% \begin{macrocode}
+\cs_generate_variant:Nn \@@_matrix_star_end:n {V}
+% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Added new functions and variants.
+% }
+% \end{macro}
+%
+%
% \section{Centering Math Symbols Along the Math-Axis}
% \label{sec:impl-vcenter}
%
@@ -2851,7 +3045,7 @@
% \url{http://www.tug.org/TUGboat/Articles/tb22-4/tb72perlS.pdf}
% }
%
-% \begin{macro}[added = 2024-07-08]{
+% \begin{macro}[added = 2024-07-08, updated=2024-08-20]{
% \moremath_vcenter:n
% }
% The function \cs{moremath_vcenter:n} is a wrapper around the \tn{vcenter}
@@ -2872,15 +3066,21 @@
% \begin{macrocode}
\cs_new_protected_nopar:Nn \moremath_vcenter:n
{
- \mathpalette \@@_vcenter:Nn {#1}
+ \@@_tex_mathpalette:Nn \@@_vcenter:Nn {#1}
}
% \end{macrocode}
% \changes{v0.3.0}{\GetVersionDate{v0.3.0}}{
% Added new function.
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Changed: Make use of \cs{@@_tex_mathpalette:Nn}.
+% }
% \end{macro}
%
-% \begin{macro}[added=2024-07-08]{
+% \begin{macro}[
+% added=2024-07-08,
+% updated=2024-08-20,
+% ]{
% \@@_vcenter:Nn,
% }
% As \tn{mathpalette} needs as its first argument a macro which takes two
@@ -2907,12 +3107,12 @@
% \begin{macrocode}
\cs_new_protected_nopar:Nn \@@_vcenter:Nn
{
- \vcenter
+ \@@_tex_vcenter:n
{
\hbox:n
{
$
- \mathsurround=0pt
+ \@@_tex_mathsurround:n {0pt}
#1 {#2}
$
}
@@ -2919,6 +3119,10 @@
}
}
% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Changed: Now uses \cs{@@_tex_vcenter:n} and \cs{@@_tex_mathsurround:n}
+% instead of \TeX-primitives.
+% }
% \end{macro}
%
%
@@ -3598,7 +3802,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_gradient_operator_get:}
+% \begin{macro}[updated=2024-08-20]{\@@_gradient_operator_get:}
% This function returns the gradient operator depending on the current setting
% of the keys.
% \begin{macrocode}
@@ -3606,7 +3810,7 @@
{
\tl_if_empty:NTF \l_@@_grad_op_tl
{
- \mathop
+ \@@_tex_mathop:n
{
% \end{macrocode}
% Otherwise we first need to check if the operator shall have an arrow over it.
@@ -3645,7 +3849,7 @@
\l_@@_nabla_tl
}
}
- }% \mathop
+ }% \@@_tex_mathop:n
\nolimits
}{
% \end{macrocode}
@@ -3656,9 +3860,12 @@
}
}
% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Now uses \cs{@@_tex_mathop:n} instead of \TeX{}-primitives.
+% }
% \end{macro}
%
-% \begin{macro}{\@@_laplace_operator_get:}
+% \begin{macro}[updated=2024-08-20]{\@@_laplace_operator_get:}
% Then we define a function for returning the laplace operator symbol,
% depending on the currently set keys.
% The function wraps the symbol for the operator inside
@@ -3668,7 +3875,7 @@
{
\tl_if_empty:NTF \l_@@_laplacian_tl
{
- \mathop
+ \@@_tex_mathop:n
{
\bool_if:NTF \l_@@_laplacian_delta_bool
{
@@ -3709,9 +3916,12 @@
}
}
% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Now uses \cs{@@_tex_mathop:n} instead of \TeX{}-primitives.
+% }
% \end{macro}
%
-% \begin{macro}{
+% \begin{macro}[updated=2024-08-20]{
% \@@_dalembert_operator_get:
% }
% This function returns the \foreignlanguage{french}{d'Alembert} operator
@@ -3721,10 +3931,10 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_dalembert_operator_get:
{
- \mathop
+ \@@_tex_mathop:n
{
\l_@@_dalembert_symb_tl
- }% \mathop
+ }% \@@_tex_mathop:n
\nolimits
}
% \end{macrocode}
@@ -3731,6 +3941,9 @@
% \changes{v0.2.0}{\GetVersionDate{v0.2.0}}{%
% Added function: \cs{@@_dalembert_operator_get:}
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Now uses \cs{@@_tex_mathop:n} instead of \TeX{}-primitives.
+% }
% \end{macro}
%
% \subsection{Macros Producing an Operator}
@@ -3949,6 +4162,9 @@
% Afterwards we check if the key \verb|scale| has been given.
% If yes we pop it and assign it to the second argument.
% Otherwise we do nothing.
+% \NB{MI}{It may be a better idea to use a key instead but I'm not sure.
+% If one nests those environments the size of the outer one will propagate into
+% the inner scope, which might not be what is wanted.}
% \begin{macrocode}
\prop_set_from_keyval:Nn \l_tmpa_prop {#1}
@@ -4350,11 +4566,13 @@
%
% In the next step we construct the single row/column matrix from the user
% provided input.
-% \begin{macro}{
+% \begin{macro}[updated=2024-08-20]{
% \moremath_column_vector:nn,
+% \moremath_column_vector:Vn,
% \moremath_row_vector:nn,
+% \moremath_row_vector:Vn,
% }
-% The two commands \cs{moremath_column_vector:n} and \cs{moremath_row_vector:n}
+% The two commands \cs{moremath_column_vector:nn} and \cs{moremath_row_vector:nn}
% construct the matrix, they both take two arguments.
% \begin{arguments}
% \item The delimiter specifier.
@@ -4373,29 +4591,43 @@
\seq_clear:N \l_@@_vector_entries_seq
\seq_set_from_clist:Nn \l_@@_vector_entries_seq {#2}
- \exp_args:NnNV \begin{#1 matrix*} [ \l_@@_matrix_align_tl ]
+ \@@_matrix_star_begin:nV {#1} \l_@@_matrix_align_tl
\@@_seq_to_column_vector:N \l_@@_vector_entries_seq
- \end{#1 matrix*}
+ \@@_matrix_star_end:n {#1}
}
-
+%
\cs_new_protected_nopar:Nn \moremath_row_vector:nn
{
\seq_clear:N \l_@@_vector_entries_seq
\seq_set_from_clist:Nn \l_@@_vector_entries_seq {#2}
- \exp_args:NnNV \begin{#1matrix*} [ \l_@@_matrix_align_tl ]
+ \@@_matrix_star_begin:nV {#1} \l_@@_matrix_align_tl
\@@_seq_to_row_vector:N \l_@@_vector_entries_seq
- \end{#1matrix*}
+ \@@_matrix_star_end:n {#1}
}
% \end{macrocode}
+% We also provide a "Vn" variant of those functions.
+% \begin{macrocode}
+\cs_generate_variant:Nn \moremath_column_vector:nn { Vn }
+\cs_generate_variant:Nn \moremath_row_vector:nn { Vn }
+% \end{macrocode}
% \changes{v0.1.0}{\GetVersionDate{v0.1.0}}{%
% Added functions producing row- and column vectors.
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Changed now uses \cs{@@_matrix_star_begin:nV} instead of raw
+% |\begin{#1matrix*}|.
+% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Added new "Vn" variants.
+% }
% \end{macro}
%
% \begin{macro}{
% \moremath_column_smallvector:nn,
-% \moremath_row_smallvector:nn
+% \moremath_column_smallvector:Vn,
+% \moremath_row_smallvector:nn,
+% \moremath_row_smallvector:Vn,
% }
% To make the code more readable, we define functions specifically for
% creating row and column vectors using the \env{smallmatrix*} family of
@@ -4411,10 +4643,16 @@
{
\moremath_row_vector:nn {#1 small} {#2}
}
+% Variants
+\cs_generate_variant:Nn \moremath_column_smallvector:nn { Vn }
+\cs_generate_variant:Nn \moremath_row_smallvector:nn { Vn }
% \end{macrocode}
% \changes{v0.1.0}{\GetVersionDate{v0.1.0}}{%
% Added functions producing inline math row- and column vectors.
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Added new "Vn" variants.
+% }
% \end{macro}
%
% ^^X SUBSECTION: Shorthands for simple matrices
@@ -4534,20 +4772,20 @@
\cs_new_protected:Nn \moremath_diagonal_matrix:nn
{
\seq_set_from_clist:Nn \l_@@_mat_diag_entries_seq { #2 }
- \exp_args:NnNV \begin{#1 matrix*} [ \l_@@_matrix_align_tl ]
+ \@@_matrix_star_begin:nV { #1 } \l_@@_matrix_align_tl
\int_step_function:nN { \seq_count:N \l_@@_mat_diag_entries_seq }
\@@_constr_diagmat_row:n
- \end{#1 matrix*}
+ \@@_matrix_star_end:n { #1 }
}
-
+%
% Anti-diagonal matrix
\cs_new_protected:Nn \moremath_antidiagonal_matrix:nn
{
\seq_set_from_clist:Nn \l_@@_mat_diag_entries_seq { #2 }
- \exp_args:NnNV \begin{ #1 matrix* } [ \l_@@_matrix_align_tl ]
+ \@@_matrix_star_begin:nV { #1 } \l_@@_matrix_align_tl
\int_step_function:nN { \seq_count:N \l_@@_mat_diag_entries_seq }
\@@_constr_antidiagmat_row:n
- \end{ #1 matrix* }
+ \@@_matrix_star_end:n { #1 }
}
% Small versions
@@ -4577,18 +4815,10 @@
% }
% For convenience we also define some variants of the above functions.
% \begin{macrocode}
-\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { n V }
-\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { V n }
-\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { V V }
-\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { n V }
-\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { V n }
-\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { V V }
-\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { n V }
-\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { V n }
-\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { V V }
-\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { n V }
-\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { V n }
-\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { V V }
+\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { nV, Vn, VV }
+\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { nV, Vn, VV }
+\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { nV, Vn, VV}
+\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { nV, Vn, VV }
% \end{macrocode}
% \changes{v0.1.0}{\GetVersionDate{v0.1.0}}{Added variants.}
% \changes{v0.2.0}{\GetVersionDate{v0.2.0}}{Added "nV" and "VV" variants.}
@@ -4597,6 +4827,10 @@
% Added functions producing (anti-)diagonal matrices.
% Also added versions for inline math.
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Changed now uses \cs{@@_matrix_star_begin:nV} instead of raw
+% |\begin{#1matrix*}|.
+% }
% \end{macro}
%
%
@@ -4730,7 +4964,7 @@
\bool_if:nTF \l_@@_predef_crvector_bool
{
% \end{macrocode}
-% \begin{macro}{
+% \begin{macro}[updated=2024-08-20,]{
% \cvector,
% \rvector,
% \smallcvector,
@@ -4747,7 +4981,7 @@
{
\keys_set:nn { moremath / matrix } {#1}
}
- \moremath_column_vector:nn {\l_@@_matrix_delim_tl} {#2}
+ \moremath_column_vector:Vn \l_@@_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -4769,7 +5003,7 @@
{
\keys_set:nn { moremath / matrix } {#1}
}
- \moremath_row_vector:nn {\l_@@_matrix_delim_tl} {#2}
+ \moremath_row_vector:Vn \l_@@_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -4791,7 +5025,7 @@
{
\keys_set:nn {moremath / matrix} {#1}
}
- \moremath_column_smallvector:nn {\l_@@_matrix_delim_tl} {#2}
+ \moremath_column_smallvector:Vn \l_@@_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -4811,7 +5045,7 @@
{
\keys_set:nn { moremath / matrix } {#1}
}
- \moremath_row_smallvector:nn {\l_@@_matrix_delim_tl} {#2}
+ \moremath_row_smallvector:Vn \l_@@_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -4826,6 +5060,9 @@
% Added commands producing row and column vectors,
% including inline math versions.
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Use "Vn" versions of functions when passing variables around.
+% }
% \end{macro}
%
% \paragraph{Commands with Pre-defined Delimiters}
@@ -4832,7 +5069,7 @@
% Next we define several shorthands to for the commonly used delimiters,
% to avoid code duplication, we first create some helper functions which
% define those functions.
-% \begin{macro}{
+% \begin{macro}[updated=2024-08-20]{
% \@@_new_vector_shorth_doc_cmd:NNn
% }
% The function \cs{@@_new_vector_shorth_doc_cmd} creates a new vector shorthand,
@@ -4842,7 +5079,7 @@
% \item The \meta{function} to use for this shorthand.
%
% This should be one of the
-% \cs[no-index]{moremath_\meta{type}_\meta{size}vector:nn}
+% \cs[no-index]{moremath_\meta{type}_\meta{size}vector:Vn}
% like commands.
%
% \item The \meta{delimiter} to use.
@@ -4863,7 +5100,7 @@
{
\keys_set:nn {moremath / matrix } {##1}
}
- #2 {\l_@@_matrix_delim_tl} {##2}
+ #2 \l_@@_matrix_delim_tl {##2}
\group_end:
}
}{
@@ -4875,9 +5112,12 @@
}
}
% \end{macrocode}
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Require function with "Vn" signature to pass variable correctly.
+% }
% \end{macro}
%
-% \begin{macro}{
+% \begin{macro}[updated=2024-08-20]{
% \pcvector,
% \bcvector,
% \Bcvector,
@@ -4894,35 +5134,38 @@
% We begin with the column vector.
% \begin{macrocode}
% parenthesis
-\@@_new_vector_shorth_doc_cmd:NNn \pcvector \moremath_column_vector:nn {p}
+\@@_new_vector_shorth_doc_cmd:NNn \pcvector \moremath_column_vector:Vn {p}
% brackets
-\@@_new_vector_shorth_doc_cmd:NNn \bcvector \moremath_column_vector:nn {b}
+\@@_new_vector_shorth_doc_cmd:NNn \bcvector \moremath_column_vector:Vn {b}
% braces
-\@@_new_vector_shorth_doc_cmd:NNn \Bcvector \moremath_column_vector:nn {B}
+\@@_new_vector_shorth_doc_cmd:NNn \Bcvector \moremath_column_vector:Vn {B}
% single vert
-\@@_new_vector_shorth_doc_cmd:NNn \vcvector \moremath_column_vector:nn {v}
+\@@_new_vector_shorth_doc_cmd:NNn \vcvector \moremath_column_vector:Vn {v}
% double vert
-\@@_new_vector_shorth_doc_cmd:NNn \Vcvector \moremath_column_vector:nn {V}
+\@@_new_vector_shorth_doc_cmd:NNn \Vcvector \moremath_column_vector:Vn {V}
% \end{macrocode}
% Now to the row vectors.
% \begin{macrocode}
% parenthesis
-\@@_new_vector_shorth_doc_cmd:NNn \prvector \moremath_row_vector:nn {p}
+\@@_new_vector_shorth_doc_cmd:NNn \prvector \moremath_row_vector:Vn {p}
% brackets
-\@@_new_vector_shorth_doc_cmd:NNn \brvector \moremath_row_vector:nn {b}
+\@@_new_vector_shorth_doc_cmd:NNn \brvector \moremath_row_vector:Vn {b}
% braces
-\@@_new_vector_shorth_doc_cmd:NNn \Brvector \moremath_row_vector:nn {B}
+\@@_new_vector_shorth_doc_cmd:NNn \Brvector \moremath_row_vector:Vn {B}
% single vert
-\@@_new_vector_shorth_doc_cmd:NNn \vrvector \moremath_row_vector:nn {v}
+\@@_new_vector_shorth_doc_cmd:NNn \vrvector \moremath_row_vector:Vn {v}
% double vert
-\@@_new_vector_shorth_doc_cmd:NNn \Vrvector \moremath_row_vector:nn {V}
+\@@_new_vector_shorth_doc_cmd:NNn \Vrvector \moremath_row_vector:Vn {V}
% \end{macrocode}
% \changes{v0.1.0}{\GetVersionDate{v0.1.0}}{
% Added commands for row and column vectors with predefined delimiters.
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Use functions with "Vn" signature instead of "nn"
+% }
% \end{macro}
%
-% \begin{macro}{
+% \begin{macro}[updated=2024-08-20]{
% \psmallcvector,
% \bsmallcvector,
% \Bsmallcvector,
@@ -4939,32 +5182,32 @@
% \begin{macrocode}
% column vectors
% parenthesis
-\@@_new_vector_shorth_doc_cmd:NNn \psmallcvector \moremath_column_smallvector:nn
+\@@_new_vector_shorth_doc_cmd:NNn \psmallcvector \moremath_column_smallvector:Vn
{p}
% brackets
-\@@_new_vector_shorth_doc_cmd:NNn \bsmallcvector \moremath_column_smallvector:nn
+\@@_new_vector_shorth_doc_cmd:NNn \bsmallcvector \moremath_column_smallvector:Vn
{b}
% braces
-\@@_new_vector_shorth_doc_cmd:NNn \Bsmallcvector \moremath_column_smallvector:nn
+\@@_new_vector_shorth_doc_cmd:NNn \Bsmallcvector \moremath_column_smallvector:Vn
{B}
% single vert
-\@@_new_vector_shorth_doc_cmd:NNn \vsmallcvector \moremath_column_smallvector:nn
+\@@_new_vector_shorth_doc_cmd:NNn \vsmallcvector \moremath_column_smallvector:Vn
{v}
% double vert
-\@@_new_vector_shorth_doc_cmd:NNn \Vsmallcvector \moremath_column_smallvector:nn
+\@@_new_vector_shorth_doc_cmd:NNn \Vsmallcvector \moremath_column_smallvector:Vn
{V}
%
% row vectors
% parenthesis
-\@@_new_vector_shorth_doc_cmd:NNn \psmallrvector \moremath_row_smallvector:nn {p}
+\@@_new_vector_shorth_doc_cmd:NNn \psmallrvector \moremath_row_smallvector:Vn {p}
% brackets
-\@@_new_vector_shorth_doc_cmd:NNn \bsmallrvector \moremath_row_smallvector:nn {b}
+\@@_new_vector_shorth_doc_cmd:NNn \bsmallrvector \moremath_row_smallvector:Vn {b}
% braces
-\@@_new_vector_shorth_doc_cmd:NNn \Bsmallrvector \moremath_row_smallvector:nn {B}
+\@@_new_vector_shorth_doc_cmd:NNn \Bsmallrvector \moremath_row_smallvector:Vn {B}
% single vert
-\@@_new_vector_shorth_doc_cmd:NNn \vsmallrvector \moremath_row_smallvector:nn {v}
+\@@_new_vector_shorth_doc_cmd:NNn \vsmallrvector \moremath_row_smallvector:Vn {v}
% double vert
-\@@_new_vector_shorth_doc_cmd:NNn \Vsmallrvector \moremath_row_smallvector:nn {V}
+\@@_new_vector_shorth_doc_cmd:NNn \Vsmallrvector \moremath_row_smallvector:Vn {V}
}{ % \bool_if:nTF \l_@@_predef_crvector_bool FALSE PATH
@@ -4978,6 +5221,9 @@
% Added commands for inline math row and column vectors
% with predefined delimiters.
% }
+% \changes{v0.5.0}{\GetVersionDate{v0.5.0}}{
+% Use functions with "Vn" signature instead of "nn"
+% }
% \end{macro}
%
%
Modified: trunk/Master/texmf-dist/tex/latex/moremath/moremath.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/moremath/moremath.sty 2024-08-19 23:42:05 UTC (rev 72071)
+++ trunk/Master/texmf-dist/tex/latex/moremath/moremath.sty 2024-08-20 19:31:39 UTC (rev 72072)
@@ -29,8 +29,9 @@
%%
\NeedsTeXFormat{LaTeX2e}[2022-11-01]
+\DeclareCurrentRelease{v0}{2024-07-15}
\ProvidesExplPackage{moremath}
- {2024-07-15}{v0.4.0}{More Math Macros}
+ {2024-08-20}{v0.5.0}{More Math Macros}
\msg_new:nnn { moremath } {load / bm}
{
Option~'bm'~given.\\
@@ -185,18 +186,44 @@
\RequirePackage{amssymb}
}
\RequirePackage{mathtools}[2004/06/05]
+\cs_new_protected:Nn \__moremath_tex_vcenter:n
+{
+ \tex_vcenter:D {#1}
+}
+\cs_new_protected:Nn \__moremath_tex_mathpalette:Nn
+{
+ \mathpalette #1 {#2}
+}
+\cs_new_protected_nopar:Nn \__moremath_tex_mathsurround:n
+{
+ \tex_mathsurround:D = #1
+}
+\cs_new_protected_nopar:Nn \__moremath_tex_mathop:n
+{
+ \tex_mathop:D {#1}
+}
+\cs_new_nopar:Nn \__moremath_matrix_star_begin:nn
+{
+ \begin{ #1 matrix* } [ #2 ]
+}
+\cs_generate_variant:Nn \__moremath_matrix_star_begin:nn { nV, Vn, VV }
+\cs_new_nopar:Nn \__moremath_matrix_star_end:n
+{
+ \end{ #1 matrix* }
+}
+\cs_generate_variant:Nn \__moremath_matrix_star_end:n {V}
\cs_new_protected_nopar:Nn \moremath_vcenter:n
{
- \mathpalette \__moremath_vcenter:Nn {#1}
+ \__moremath_tex_mathpalette:Nn \__moremath_vcenter:Nn {#1}
}
\cs_new_protected_nopar:Nn \__moremath_vcenter:Nn
{
- \vcenter
+ \__moremath_tex_vcenter:n
{
\hbox:n
{
$
- \mathsurround=0pt
+ \__moremath_tex_mathsurround:n {0pt}
#1 {#2}
$
}
@@ -384,7 +411,7 @@
{
\tl_if_empty:NTF \l__moremath_grad_op_tl
{
- \mathop
+ \__moremath_tex_mathop:n
{
\bool_if:NTF \l__moremath_nabla_arrow_bool
{
@@ -411,7 +438,7 @@
\l__moremath_nabla_tl
}
}
- }% \mathop
+ }% \__moremath_tex_mathop:n
\nolimits
}{
\l__moremath_grad_op_tl
@@ -421,7 +448,7 @@
{
\tl_if_empty:NTF \l__moremath_laplacian_tl
{
- \mathop
+ \__moremath_tex_mathop:n
{
\bool_if:NTF \l__moremath_laplacian_delta_bool
{
@@ -463,10 +490,10 @@
}
\cs_new_protected:Nn \__moremath_dalembert_operator_get:
{
- \mathop
+ \__moremath_tex_mathop:n
{
\l__moremath_dalembert_symb_tl
- }% \mathop
+ }% \__moremath_tex_mathop:n
\nolimits
}
\cs_new_protected_nopar:Nn \moremath_gradient_operator:n
@@ -694,20 +721,21 @@
\seq_clear:N \l__moremath_vector_entries_seq
\seq_set_from_clist:Nn \l__moremath_vector_entries_seq {#2}
- \exp_args:NnNV \begin{#1 matrix*} [ \l__moremath_matrix_align_tl ]
+ \__moremath_matrix_star_begin:nV {#1} \l__moremath_matrix_align_tl
\__moremath_seq_to_column_vector:N \l__moremath_vector_entries_seq
- \end{#1 matrix*}
+ \__moremath_matrix_star_end:n {#1}
}
-
\cs_new_protected_nopar:Nn \moremath_row_vector:nn
{
\seq_clear:N \l__moremath_vector_entries_seq
\seq_set_from_clist:Nn \l__moremath_vector_entries_seq {#2}
- \exp_args:NnNV \begin{#1matrix*} [ \l__moremath_matrix_align_tl ]
+ \__moremath_matrix_star_begin:nV {#1} \l__moremath_matrix_align_tl
\__moremath_seq_to_row_vector:N \l__moremath_vector_entries_seq
- \end{#1matrix*}
+ \__moremath_matrix_star_end:n {#1}
}
+\cs_generate_variant:Nn \moremath_column_vector:nn { Vn }
+\cs_generate_variant:Nn \moremath_row_vector:nn { Vn }
\cs_new_protected_nopar:Nn \moremath_column_smallvector:nn
{
\moremath_column_vector:nn {#1 small} {#2}
@@ -717,6 +745,8 @@
{
\moremath_row_vector:nn {#1 small} {#2}
}
+\cs_generate_variant:Nn \moremath_column_smallvector:nn { Vn }
+\cs_generate_variant:Nn \moremath_row_smallvector:nn { Vn }
\seq_clear_new:N \l__moremath_mat_diag_entries_seq
\seq_clear_new:N \l__moremath_mat_row_entries_seq
\cs_new_protected:Nn \__moremath_constr_diagmat_row:n
@@ -759,19 +789,18 @@
\cs_new_protected:Nn \moremath_diagonal_matrix:nn
{
\seq_set_from_clist:Nn \l__moremath_mat_diag_entries_seq { #2 }
- \exp_args:NnNV \begin{#1 matrix*} [ \l__moremath_matrix_align_tl ]
+ \__moremath_matrix_star_begin:nV { #1 } \l__moremath_matrix_align_tl
\int_step_function:nN { \seq_count:N \l__moremath_mat_diag_entries_seq }
\__moremath_constr_diagmat_row:n
- \end{#1 matrix*}
+ \__moremath_matrix_star_end:n { #1 }
}
-
\cs_new_protected:Nn \moremath_antidiagonal_matrix:nn
{
\seq_set_from_clist:Nn \l__moremath_mat_diag_entries_seq { #2 }
- \exp_args:NnNV \begin{ #1 matrix* } [ \l__moremath_matrix_align_tl ]
+ \__moremath_matrix_star_begin:nV { #1 } \l__moremath_matrix_align_tl
\int_step_function:nN { \seq_count:N \l__moremath_mat_diag_entries_seq }
\__moremath_constr_antidiagmat_row:n
- \end{ #1 matrix* }
+ \__moremath_matrix_star_end:n { #1 }
}
\cs_new_protected:Nn \moremath_diagonal_smallmatrix:nn
@@ -783,18 +812,10 @@
{
\moremath_antidiagonal_matrix:nn {#1 small} {#2}
}
-\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { n V }
-\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { V n }
-\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { V V }
-\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { n V }
-\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { V n }
-\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { V V }
-\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { n V }
-\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { V n }
-\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { V V }
-\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { n V }
-\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { V n }
-\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { V V }
+\cs_generate_variant:Nn \moremath_diagonal_matrix:nn { nV, Vn, VV }
+\cs_generate_variant:Nn \moremath_antidiagonal_matrix:nn { nV, Vn, VV }
+\cs_generate_variant:Nn \moremath_diagonal_smallmatrix:nn { nV, Vn, VV}
+\cs_generate_variant:Nn \moremath_antidiagonal_smallmatrix:nn { nV, Vn, VV }
\cs_new_protected_nopar:Nn \__moremath_generate_one_filled_clist:Nn
{
\seq_clear:N \l_tmpa_seq
@@ -842,7 +863,7 @@
{
\keys_set:nn { moremath / matrix } {#1}
}
- \moremath_column_vector:nn {\l__moremath_matrix_delim_tl} {#2}
+ \moremath_column_vector:Vn \l__moremath_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -861,7 +882,7 @@
{
\keys_set:nn { moremath / matrix } {#1}
}
- \moremath_row_vector:nn {\l__moremath_matrix_delim_tl} {#2}
+ \moremath_row_vector:Vn \l__moremath_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -880,7 +901,7 @@
{
\keys_set:nn {moremath / matrix} {#1}
}
- \moremath_column_smallvector:nn {\l__moremath_matrix_delim_tl} {#2}
+ \moremath_column_smallvector:Vn \l__moremath_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -900,7 +921,7 @@
{
\keys_set:nn { moremath / matrix } {#1}
}
- \moremath_row_smallvector:nn {\l__moremath_matrix_delim_tl} {#2}
+ \moremath_row_smallvector:Vn \l__moremath_matrix_delim_tl {#2}
\group_end:
}
}{
@@ -923,7 +944,7 @@
{
\keys_set:nn {moremath / matrix } {##1}
}
- #2 {\l__moremath_matrix_delim_tl} {##2}
+ #2 \l__moremath_matrix_delim_tl {##2}
\group_end:
}
}{
@@ -934,31 +955,31 @@
}
}
}
-\__moremath_new_vector_shorth_doc_cmd:NNn \pcvector \moremath_column_vector:nn {p}
-\__moremath_new_vector_shorth_doc_cmd:NNn \bcvector \moremath_column_vector:nn {b}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Bcvector \moremath_column_vector:nn {B}
-\__moremath_new_vector_shorth_doc_cmd:NNn \vcvector \moremath_column_vector:nn {v}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Vcvector \moremath_column_vector:nn {V}
-\__moremath_new_vector_shorth_doc_cmd:NNn \prvector \moremath_row_vector:nn {p}
-\__moremath_new_vector_shorth_doc_cmd:NNn \brvector \moremath_row_vector:nn {b}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Brvector \moremath_row_vector:nn {B}
-\__moremath_new_vector_shorth_doc_cmd:NNn \vrvector \moremath_row_vector:nn {v}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Vrvector \moremath_row_vector:nn {V}
-\__moremath_new_vector_shorth_doc_cmd:NNn \psmallcvector \moremath_column_smallvector:nn
+\__moremath_new_vector_shorth_doc_cmd:NNn \pcvector \moremath_column_vector:Vn {p}
+\__moremath_new_vector_shorth_doc_cmd:NNn \bcvector \moremath_column_vector:Vn {b}
+\__moremath_new_vector_shorth_doc_cmd:NNn \Bcvector \moremath_column_vector:Vn {B}
+\__moremath_new_vector_shorth_doc_cmd:NNn \vcvector \moremath_column_vector:Vn {v}
+\__moremath_new_vector_shorth_doc_cmd:NNn \Vcvector \moremath_column_vector:Vn {V}
+\__moremath_new_vector_shorth_doc_cmd:NNn \prvector \moremath_row_vector:Vn {p}
+\__moremath_new_vector_shorth_doc_cmd:NNn \brvector \moremath_row_vector:Vn {b}
+\__moremath_new_vector_shorth_doc_cmd:NNn \Brvector \moremath_row_vector:Vn {B}
+\__moremath_new_vector_shorth_doc_cmd:NNn \vrvector \moremath_row_vector:Vn {v}
+\__moremath_new_vector_shorth_doc_cmd:NNn \Vrvector \moremath_row_vector:Vn {V}
+\__moremath_new_vector_shorth_doc_cmd:NNn \psmallcvector \moremath_column_smallvector:Vn
{p}
-\__moremath_new_vector_shorth_doc_cmd:NNn \bsmallcvector \moremath_column_smallvector:nn
+\__moremath_new_vector_shorth_doc_cmd:NNn \bsmallcvector \moremath_column_smallvector:Vn
{b}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Bsmallcvector \moremath_column_smallvector:nn
+\__moremath_new_vector_shorth_doc_cmd:NNn \Bsmallcvector \moremath_column_smallvector:Vn
{B}
-\__moremath_new_vector_shorth_doc_cmd:NNn \vsmallcvector \moremath_column_smallvector:nn
+\__moremath_new_vector_shorth_doc_cmd:NNn \vsmallcvector \moremath_column_smallvector:Vn
{v}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Vsmallcvector \moremath_column_smallvector:nn
+\__moremath_new_vector_shorth_doc_cmd:NNn \Vsmallcvector \moremath_column_smallvector:Vn
{V}
-\__moremath_new_vector_shorth_doc_cmd:NNn \psmallrvector \moremath_row_smallvector:nn {p}
-\__moremath_new_vector_shorth_doc_cmd:NNn \bsmallrvector \moremath_row_smallvector:nn {b}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Bsmallrvector \moremath_row_smallvector:nn {B}
-\__moremath_new_vector_shorth_doc_cmd:NNn \vsmallrvector \moremath_row_smallvector:nn {v}
-\__moremath_new_vector_shorth_doc_cmd:NNn \Vsmallrvector \moremath_row_smallvector:nn {V}
+\__moremath_new_vector_shorth_doc_cmd:NNn \psmallrvector \moremath_row_smallvector:Vn {p}
+\__moremath_new_vector_shorth_doc_cmd:NNn \bsmallrvector \moremath_row_smallvector:Vn {b}
+\__moremath_new_vector_shorth_doc_cmd:NNn \Bsmallrvector \moremath_row_smallvector:Vn {B}
+\__moremath_new_vector_shorth_doc_cmd:NNn \vsmallrvector \moremath_row_smallvector:Vn {v}
+\__moremath_new_vector_shorth_doc_cmd:NNn \Vsmallrvector \moremath_row_smallvector:Vn {V}
}{ % \bool_if:nTF \l__moremath_predef_crvector_bool FALSE PATH
\msg_info:nnnn {moremath} {load / disabling} {no-crvector}
More information about the tex-live-commits
mailing list.