summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/physics2/tex/phy-ab.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/physics2/tex/phy-ab.sty')
-rw-r--r--macros/latex/contrib/physics2/tex/phy-ab.sty26
1 files changed, 14 insertions, 12 deletions
diff --git a/macros/latex/contrib/physics2/tex/phy-ab.sty b/macros/latex/contrib/physics2/tex/phy-ab.sty
index 4436a65214..9845903a82 100644
--- a/macros/latex/contrib/physics2/tex/phy-ab.sty
+++ b/macros/latex/contrib/physics2/tex/phy-ab.sty
@@ -17,7 +17,7 @@
%% The Current Maintainer of this work is Zhang Tingxuan.
%%
\ProvidesFile{phy-ab.sty}
- [2023/02/07 `ab' (autobraces) module of `physics2.sty']
+ [2023/04/02 `ab' (autobraces) module of `physics2.sty']
% \phy@requiremodule{common}
% The `tightbraces' bool option, true or false.
\phy@define@key{ab}{tightbraces}[true]{\def\@phy@abtight{#1}}
@@ -47,16 +47,17 @@
\phy@AB@gen{ab}\Vert{r\Vert\Vert}{\phy@abopen\Vert#1\phy@abclose\Vert}
\phy@AB@gen{ab}\langle{r\langle\rangle}{\phy@abopen\langle#1\phy@abclose\rangle}
% #1 (m): \biggg; #2 (r<token1><token2>): inner content.
-\phy@AB@gen{mb}({mr()}{\mathopen#1(#2\mathclose#1)}
-\phy@AB@gen{mb}[{mr[]}{\mathopen#1[#2\mathclose#1]}
-\phy@AB@gen{mb}\{{mr\{\}}{\mathopen#1\lbrace#2\mathclose#1\rbrace}
-\phy@AB@gen{mb}|{mr||}{\mathopen#1\vert#2\mathclose#1\vert}
-\phy@AB@gen{mb}\|{mr\|\|}{\mathopen#1\Vert#2\mathclose#1\Vert}
-\phy@AB@gen{mb}<{mr<>}{\mathopen#1\langle#2\mathclose#1\rangle}
-\phy@AB@gen{mb}\lbrace{mr\lbrace\rbrace}{\mathopen#1\lbrace#2\mathclose#1\rbrace}
-\phy@AB@gen{mb}\vert{mr\vert\vert}{\mathopen#1\vert#2\mathclose#1\vert}
-\phy@AB@gen{mb}\Vert{mr\Vert\Vert}{\mathopen#1\Vert#2\mathclose#1\Vert}
-\phy@AB@gen{mb}\langle{mr\langle\rangle}{\mathopen#1\langle#2\mathclose#1\rangle}
+% \endgroup's in the end of definition are corresponding to \begingroup in \phy@d@l@genxm.
+\phy@AB@gen{mb}({mr()}{\mathopen#1(#2\mathclose#1)\endgroup}
+\phy@AB@gen{mb}[{mr[]}{\mathopen#1[#2\mathclose#1]\endgroup}
+\phy@AB@gen{mb}\{{mr\{\}}{\mathopen#1\lbrace#2\mathclose#1\rbrace\endgroup}
+\phy@AB@gen{mb}|{mr||}{\mathopen#1\vert#2\mathclose#1\vert\endgroup}
+\phy@AB@gen{mb}\|{mr\|\|}{\mathopen#1\Vert#2\mathclose#1\Vert\endgroup}
+\phy@AB@gen{mb}<{mr<>}{\mathopen#1\langle#2\mathclose#1\rangle\endgroup}
+\phy@AB@gen{mb}\lbrace{mr\lbrace\rbrace}{\mathopen#1\lbrace#2\mathclose#1\rbrace\endgroup}
+\phy@AB@gen{mb}\vert{mr\vert\vert}{\mathopen#1\vert#2\mathclose#1\vert\endgroup}
+\phy@AB@gen{mb}\Vert{mr\Vert\Vert}{\mathopen#1\Vert#2\mathclose#1\Vert\endgroup}
+\phy@AB@gen{mb}\langle{mr\langle\rangle}{\mathopen#1\langle#2\mathclose#1\rangle\endgroup}
% \phy@del, the automatic braces. #1: opensymbol; #2: close symbol; #3
\def\phy@del#1#2#3{\phy@abopen#1#3\phy@abclose#2}
\expandafter\def\csname phy@del\string*\endcsname#1#2#3{\mathopen#1#3\mathclose#2}
@@ -70,7 +71,7 @@
% #1: `mb', according to \phy@AB@gen; #2: `ab'; #3: star or big or left delimiter.
\def\phy@d@lx#1#2#3{%
\ifcsname phy@del\string#3\endcsname%
- \def\reserved@a{#1}% #3 is star or biggg, then get the next argument.
+ \def\reserved@a{#1}% #3 is star or \biggg, then get the next argument.
\else%
\def\reserved@a{#2}% #3 is delimiter, the braces are automatic.
\fi%
@@ -78,6 +79,7 @@
% The first two arguments of \phy@d@lx need to be generated by the following two commands.
\def\phy@d@l@genxm#1{% generate arguments like `mb'
\expandafter\def\csname phy@d@lx#1\endcsname##1##2{%
+ \begingroup% \endgroup in \phy@AB@gen{mb}<open><arg><definition>
\ifx##1*\let\phy@tempa=\relax\else\let\phy@tempa=##1\fi
\csname phy@#1@\string##2\endcsname\phy@tempa##2}}
\def\phy@d@l@genxa#1{% generate arguments like `ab'