[latex3-commits] [latex3/mathtools] master: Added support for using dot as an empty delimiter in \DeClaredPairedDelimiter which fixes #41 (3d3dcc5)

github at latex-project.org github at latex-project.org
Thu Jan 18 10:59:01 CET 2024


Repository : https://github.com/latex3/mathtools
On branch  : master
Link       : https://github.com/latex3/mathtools/commit/3d3dcc5997ad439b64565569027fe60b6cd924e8

>---------------------------------------------------------------

commit 3d3dcc5997ad439b64565569027fe60b6cd924e8
Author: daleif <daleif at github.com>
Date:   Thu Jan 18 10:58:04 2024 +0100

    Added support for using dot as an empty delimiter in \DeClaredPairedDelimiter which fixes #41


>---------------------------------------------------------------

3d3dcc5997ad439b64565569027fe60b6cd924e8
 ANNOUNCEMENT  |  1 +
 mathtools.dtx | 24 ++++++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/ANNOUNCEMENT b/ANNOUNCEMENT
index 9b88713..9d6327e 100644
--- a/ANNOUNCEMENT
+++ b/ANNOUNCEMENT
@@ -7,6 +7,7 @@ For mathtools.dtx v1.30
   not available under unicode-math. (#45)
 * Added a default \MT_active_colon_false: for when centercolon=true has
   never been executed (#49)
+* Gave \DeclarePairedDelimiter... support for the empty scaler (dot) (#41)
 
 
 Announcement release 2022/06/29
diff --git a/mathtools.dtx b/mathtools.dtx
index 79aa910..da70a81 100644
--- a/mathtools.dtx
+++ b/mathtools.dtx
@@ -333,7 +333,7 @@ colorlinks,
 %
 %  \GetFileInfo{mathtools.drv}
 %
-%  \CheckSum{3740}
+%  \CheckSum{3754}
 %
 %  \title{The \pkg{mathtools} package\thanks{This file has version number
 %  \fileversion, last revised \filedate.}}
@@ -2034,6 +2034,17 @@ colorlinks,
 %      \]
 %  \end{itemize}
 %
+%  \paragraph{A note on the delimiters.}  Whenever the manual scalings
+%  are used we internally convert them into their \cs{...l} and
+%  \cs{...r} variants. Therefore if you define your own manual
+%  scalers, remember to also have -l and -r variants.
+%
+%  \paragraph{New from version 1.30.} You can now use »\verb|.|« (dot)
+%  as an empty delimiter, for macros what only have a delimiter on one
+%  side.\footnote{The syntax is borrowed from
+%  \cs{left.}\cs{frac\{1\}\{2\}}\cs{right}\cs{rvert} where the dot marks an empty
+%  delimiter. }
+%
 %  \begin{codesyntax}
 %    \SpecialUsageIndex{\DeclarePairedDelimiterX}
 %    \cs{DeclarePairedDelimiterX}\marg{cmd}\oarg{num args}\marg{left_delim}\marg{right_delim}\marg{body}\\
@@ -2276,7 +2287,7 @@ colorlinks,
 %  The default values for the call backs correspond to
 % \begin{verbatim}
 % star:            \mathopen{}\mathclose\bgroup #1#2\aftergroup\egroup #3
-% nostarnonscaled: \mathopen#1#2\mathclose#3
+% nostarnonscaled: \ifx.#1\else\mathopen#1\fi#2\ifx.#3\else\mathclose#3\fi
 % nostarscaled:    \mathopen{#1}#2\mathclose{#3}
 % \end{verbatim}
 %  The two \texttt{nostar...} versions look the same, but they are
@@ -4000,7 +4011,7 @@ colorlinks,
 % \changes{v1.30}{2022/11/15}{Forgot to define a default
 % \cs{MT\_active\_colon_false:}, who would run centercolon=false
 % before it being true?}
-%    \end{macrocode}
+%    \behin{macrocode}
 \def\MT_active_colon_false:{}
 %    \end{macrocode}
 %  \end{macro}
@@ -4618,8 +4629,13 @@ colorlinks,
     \@namedef{MT_delim_\MH_cs_to_str:N #1 _nostarscaled_wrapper:nnn}##1##2##3{
       \mathopen{##1}##2\mathclose{##3}
     }
+%    \end{macrocode}
+%   \changes{v1.30}{2024/01/18}{Changed the nostarnonscaled to support the empty scaler (dot).}
+%   If we want to support the empty scaler (dot) we need a test in the non-scaled case, otherwise a dot would be left in the output.
+%   Test sugggested by David Carlisle.
+%    \begin{macrocode}
     \@namedef{MT_delim_\MH_cs_to_str:N #1 _nostarnonscaled_wrapper:nnn}##1##2##3{
-      \mathopen##1##2\mathclose##3
+      \ifx.##1\else\mathopen##1\fi##2\ifx.##3\else\mathclose##3\fi
     }
   }
 





More information about the latex3-commits mailing list.