diff options
Diffstat (limited to 'macros/latex/contrib/physics2')
-rw-r--r-- | macros/latex/contrib/physics2/doc/phy2docdef.tex | 2 | ||||
-rw-r--r-- | macros/latex/contrib/physics2/doc/physics2-legacy.pdf | bin | 97692 -> 82826 bytes | |||
-rw-r--r-- | macros/latex/contrib/physics2/doc/physics2-legacy.tex | 31 | ||||
-rw-r--r-- | macros/latex/contrib/physics2/doc/physics2.pdf | bin | 87049 -> 87997 bytes | |||
-rw-r--r-- | macros/latex/contrib/physics2/doc/physics2.tex | 28 | ||||
-rw-r--r-- | macros/latex/contrib/physics2/tex/phy-ab.braket.sty | 12 | ||||
-rw-r--r-- | macros/latex/contrib/physics2/tex/phy-ab.legacy.sty | 20 | ||||
-rw-r--r-- | macros/latex/contrib/physics2/tex/phy-ab.sty | 32 | ||||
-rw-r--r-- | macros/latex/contrib/physics2/tex/phy-braket.sty | 22 | ||||
-rw-r--r-- | macros/latex/contrib/physics2/tex/phy-common.sty | 7 |
10 files changed, 86 insertions, 68 deletions
diff --git a/macros/latex/contrib/physics2/doc/phy2docdef.tex b/macros/latex/contrib/physics2/doc/phy2docdef.tex index d5d0699a76..f6d5c5da9f 100644 --- a/macros/latex/contrib/physics2/doc/phy2docdef.tex +++ b/macros/latex/contrib/physics2/doc/phy2docdef.tex @@ -64,7 +64,7 @@ \newenvironment{example} {\stepcounter{example}\example@start}{\example@end} \author{Zhang Tingxuan} -\date{2023/02/07\quad Version 0.1.1\thanks{% +\date{2023/03/30\quad Version 0.2.0\thanks{% \url{https://www.github.com/AlphaZTX/physics2}}} \makeatother \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/physics2/doc/physics2-legacy.pdf b/macros/latex/contrib/physics2/doc/physics2-legacy.pdf Binary files differindex 796463ab07..682d20a08b 100644 --- a/macros/latex/contrib/physics2/doc/physics2-legacy.pdf +++ b/macros/latex/contrib/physics2/doc/physics2-legacy.pdf diff --git a/macros/latex/contrib/physics2/doc/physics2-legacy.tex b/macros/latex/contrib/physics2/doc/physics2-legacy.tex index fea5894ad0..d1b64a4374 100644 --- a/macros/latex/contrib/physics2/doc/physics2-legacy.tex +++ b/macros/latex/contrib/physics2/doc/physics2-legacy.tex @@ -8,10 +8,10 @@ \documentclass[11pt,letterpaper]{article} \usepackage{amsmath} \usepackage{unicode-math} -\setmainfont{Latin Modern Roman} -\setsansfont{Latin Modern Sans} -\setmonofont{Latin Modern Mono} -\setmathfont{Latin Modern Math} +\setmainfont{Libertinus Serif} +\setsansfont{Libertinus Sans} +\setmonofont{Noto Sans Mono}[Scale=MatchLowercase] +\setmathfont{Libertinus Math} \usepackage{physics2} \usephysicsmodule{ab} \usephysicsmodule{ab.legacy,nabla.legacy} @@ -177,11 +177,11 @@ the \modu{ab} module of \pkg{physics2}, these commands have changed to \[ \aab{\0} \quad \vab{\0} \quad \Vab{\0} \] \end{example} -Also, after \texttt{\textbackslash}$X$\texttt{ab} can be a ``biggg'' command -or a star. For example, +\texttt{\textbackslash$X$ab} can take an optional star and an optional \oarg{biggg} +argument. For example, \begin{example} \def\0{\frac12} -\[ \pab\Big{\0} \quad \bab*{\0} \] +\[ \pab[Big]{\0} \quad \bab*{\0} \] \end{example} \pkg{physics} also provides the following commands: @@ -197,18 +197,19 @@ the first four commands can be used through the \modu{ab.legacy} module of For example, \begin{example} \def\0{\frac12} -\[ \abs{\0} \quad \abs\Big{\0} +\[ \abs{\0} \quad \abs[big]{\0} \quad \abs*{\0} \] \end{example} Users of the legacy \pkg{physics} package should notice that the syntax of -\cs{eval} has been changed to \cs{eval}\oarg{left delimiter}\marg{subformula}. -The \modu{ab.legacy} module abandoned the \verb"\eval(foo|"-like syntax. The -\meta{left delimiter} argument is optional. For example, +\cs{eval} has been changed. The \modu{ab.legacy} module abandoned the +\verb"\eval(foo|"-like syntax. The new \cs{eval}'s syntax is just like other +commands in this module. There are also two variants of \cs{eval} --- \cs{peval} +and \cs{beval}. For example, \begin{example} -\def\0{\frac12x} -\[ \eval{\0}_a^b \quad - \eval[(]{\0}_a^b \quad - \eval[[]\big{\0}_a^b \] +\def\0{1+\frac12x} +\[ \eval{\0}_a^b \quad + \peval*{\0}_a^b \quad + \beval[big]{\0}_a^b \] \end{example} The \cs{comm}, \cs{acomm} and \cs{pb} (Poisson bracket) are not supported. But you can write like \verb|\ab[foo,baz]| or \verb|\bab{foo,baz}| instead. diff --git a/macros/latex/contrib/physics2/doc/physics2.pdf b/macros/latex/contrib/physics2/doc/physics2.pdf Binary files differindex a5721ef991..47645e84d8 100644 --- a/macros/latex/contrib/physics2/doc/physics2.pdf +++ b/macros/latex/contrib/physics2/doc/physics2.pdf diff --git a/macros/latex/contrib/physics2/doc/physics2.tex b/macros/latex/contrib/physics2/doc/physics2.tex index 043e262853..f567d5219c 100644 --- a/macros/latex/contrib/physics2/doc/physics2.tex +++ b/macros/latex/contrib/physics2/doc/physics2.tex @@ -172,11 +172,12 @@ with paired delimiters. For example, \[ \pab{\0} \bab{\0} \Bab{\0} \] \[ \aab{\0} \vab{\0} \Vab{\0} \] \end{example} -After \texttt{\textbackslash}$X$\texttt{ab} can be a ``biggg'' command or a -star. For example, +These \texttt{\textbackslash$X$ab} commands can take an optional star and +an optional \oarg{biggg} argument. Star stands for using the default sizes. +For example, \begin{example} -\def\0{\frac12} -\[ \pab\Big{\0} \quad \bab*{\0} \] +\def\0{n+\frac12} +\[ \pab[Big]{\0} \quad \bab*{\0} \] \end{example} \paragraph{The options of \modu{ab} module} @@ -471,21 +472,22 @@ legacy \pkg{physics} package. It's not suggest to use them in a new document. \subsection{The \modu{ab.legacy} module} This module provides the following commands: \begin{Verbatim}[fontsize=\small] -\abs \norm \eval \order +\abs \norm \eval (\peval \beval) \order \end{Verbatim} -They can take a normal argument. Between these commands and their argument -can be a ``biggg'' command or a star. For example, +They shares the same syntax as \meta{cmd}\opt{*}\oarg{biggg}\marg{subformula}. +Star and \meta{biggg} are optional. Star stands for ``use the default size''. +For example, \begin{example} -\def\0{\frac12} +\def\0{1+\frac12} \[ \abs{\0} \quad - \norm\Big{\0} \quad + \norm[Big]{\0} \quad \order*{\0} \] \end{example} \begin{example} -\def\0{\frac12x} -\[ \eval{\0}_a^b \quad - \eval[(]{\0}_a^b \quad - \eval[[]\big{\0}_a^b \] +\def\0{1+\frac12x} +\[ \eval{\0}_a^b \quad + \peval*{\0}_a^b \quad + \beval[big]{\0}_a^b \] \end{example} You can set the ``order'' symbol in this module through the \opt{order} option like this: diff --git a/macros/latex/contrib/physics2/tex/phy-ab.braket.sty b/macros/latex/contrib/physics2/tex/phy-ab.braket.sty index a65ce94bc5..818d8a75e8 100644 --- a/macros/latex/contrib/physics2/tex/phy-ab.braket.sty +++ b/macros/latex/contrib/physics2/tex/phy-ab.braket.sty @@ -39,11 +39,11 @@ % \braket<foo|bar> \begingroup \catcode`\|=\active -\gdef\phy@@mb@bk#1#2{\begingroup% +\gdef\phy@@mb@bk#1#2{\begingroup \mathcode`\|="8000\def|{\egroup#1\vert\bgroup}% \def\<{\mathrel{<}}\def\>{\mathrel{>}}% \mathopen#1\langle\bgroup#2\egroup\mathclose#1\rangle\endgroup} -\gdef\phy@@ab@bk#1{\begingroup% +\gdef\phy@@ab@bk#1{\begingroup \mathcode`\|="8000\def|{\egroup\phy@abb@bkv\bgroup}% \def\<{\mathrel{<}}\def\>{\mathrel{>}}% \phy@abopen\langle\bgroup#1\egroup\phy@abclose\rangle\endgroup} @@ -58,18 +58,18 @@ \begingroup \catcode`\<=\active \catcode`\>=\active -\gdef\phy@@mb@kb#1#2{\begingroup% +\gdef\phy@@mb@kb#1#2{\begingroup \mathcode`\<="8000 \mathcode`\>="8000% \def<{#1\langle}\def>{#1\rangle}% \def\<{\phy@abb@l}\def\>{\phy@abb@r}% \mathopen#1\vert#2\mathclose#1\vert\endgroup} \endgroup -\gdef\phy@@ab@kb#1>#2<#3\phy@@end{\begingroup% +\gdef\phy@@ab@kb#1>#2<#3\phy@@end{\begingroup \def\<{\phy@abb@l}\def\>{\phy@abb@r}% \phy@abopen\vert\mathopen{\phy@mathvphantom{#3}}#1\phy@abclose\rangle#2% - \phy@abopen\langle#3\mathclose{\phy@mathvphantom{#1}}\phy@abclose\vert% + \phy@abopen\langle#3\mathclose{\phy@mathvphantom{#1}}\phy@abclose\vert \endgroup} -\AtBeginDocument{\ifcsname symbf\endcsname% +\AtBeginDocument{\ifcsname symbf\endcsname \def\phy@abb@l{\Umathchar 3 \symoperators "003C }% \def\phy@abb@r{\Umathchar 3 \symoperators "003E }% \fi} diff --git a/macros/latex/contrib/physics2/tex/phy-ab.legacy.sty b/macros/latex/contrib/physics2/tex/phy-ab.legacy.sty index d21e52f5d1..bbfa1f2b4a 100644 --- a/macros/latex/contrib/physics2/tex/phy-ab.legacy.sty +++ b/macros/latex/contrib/physics2/tex/phy-ab.legacy.sty @@ -17,7 +17,7 @@ %% The Current Maintainer of this work is Zhang Tingxuan. %% \ProvidesFile{phy-ab.legacy.sty} - [2023/01/25 `ab.legacy' module of `physics2.sty'] + [2023/03/29 `ab.legacy' module of `physics2.sty'] \phy@requiremodule{ab} % The `tight' bool option, true or false. \phy@define@key{ab.legacy}{order}[\mathcal{O}]{\def\phy@ab@ordersym{#1}} @@ -25,9 +25,19 @@ \phy@setkeys{ab.legacy}{order} \phy@processkeyopt{ab.legacy} % The braced operators. -\DeclareRobustCommand\abs{\phy@d@ly\vert\vert} -\DeclareRobustCommand\norm{\phy@d@ly\Vert\Vert} -\DeclareRobustCommand\order{\phy@ab@ordersym\phy@d@ly()} -\DeclareRobustCommand\eval[1][.]{\phy@d@ly#1|} +\phy@d@l@geny\abs\vert\vert +\phy@d@l@geny\norm\Vert\Vert +\DeclareDocumentCommand\order{som}{% + \phy@ab@ordersym + \IfBooleanTF{#1}% + {(#3)}% + {\IfValueTF{#2}% + {\csname#2l\endcsname(#3\csname#2r\endcsname)}% + {\phy@abopen(#3\phy@abclose)}% + }% +} +\phy@d@l@geny\eval.\vert +\phy@d@l@geny\peval(\vert +\phy@d@l@geny\beval[\vert \endinput %% End of file `phy-ab.legacy.sty'. diff --git a/macros/latex/contrib/physics2/tex/phy-ab.sty b/macros/latex/contrib/physics2/tex/phy-ab.sty index 089d01b53c..4436a65214 100644 --- a/macros/latex/contrib/physics2/tex/phy-ab.sty +++ b/macros/latex/contrib/physics2/tex/phy-ab.sty @@ -57,7 +57,7 @@ \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} -% \phy@del, the automatic +% \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} \expandafter\def\csname phy@del\string\big\endcsname#1#2#3{\bigl#1#3\bigr#2} @@ -66,8 +66,6 @@ \expandafter\def\csname phy@del\string\Bigg\endcsname#1#2#3{\Biggl#1#3\Biggr#2} \expandafter\def\csname phy@del\string\biggg\endcsname#1#2#3{\bigggl#1#3\bigggr#2} \expandafter\def\csname phy@del\string\Biggg\endcsname#1#2#3{\Bigggl#1#3\Bigggr#2} -% \phy@AB@gb(a|b|..): gobble (a|b|..) arguments in the middle. -\def\phy@AB@gbc#1#2#3#4#5{#1{#5}} % \phy@d@lx (phy_del_x): the internal defination of \ab. % #1: `mb', according to \phy@AB@gen; #2: `ab'; #3: star or big or left delimiter. \def\phy@d@lx#1#2#3{% @@ -88,18 +86,24 @@ % Generate the `mb' and `ab' arguments. \phy@d@l@genxm{mb} \phy@d@l@genxa{ab} -% \phy@d@ly (phy_del_y): the internal defination of \(p|b|..)ab. -\def\phy@d@ly#1#2#3{\ifcsname phy@del\string#3\endcsname - \phy@AB@gbc{\csname phy@del\string#3\endcsname#1#2}% - \else{\phy@del#1#2{#3}}\fi} % \ab(<subformula>), after \ab can be a star or \biggg. \DeclareRobustCommand\ab{\phy@d@lx{mb}{ab}} -% \(p|b|..)ab{<subformula>}, after \(p|..)ab can be a star or \biggg. -\DeclareRobustCommand\pab{\phy@d@ly()} -\DeclareRobustCommand\bab{\phy@d@ly[]} -\DeclareRobustCommand\Bab{\phy@d@ly\lbrace\rbrace} -\DeclareRobustCommand\vab{\phy@d@ly\vert\vert} -\DeclareRobustCommand\aab{\phy@d@ly\langle\rangle} -\DeclareRobustCommand\Vab{\phy@d@ly\Vert\Vert} +% \phy@d@l@geny: define commands like \pab. #1: cs; #2: open symbol; #3: close symbol. +\def\phy@d@l@geny#1#2#3{% + \DeclareDocumentCommand#1{som}{% ##1: star; ##2: bigg (csname); ##3: subformula. + \IfBooleanTF{##1}% + {#2##3#3}% + {\IfValueTF{##2}% + {\csname##2l\endcsname#2##3\csname##2r\endcsname#3}% + {\phy@abopen#2##3\phy@abclose#3}% + }% + }% +} +\phy@d@l@geny\pab() +\phy@d@l@geny\bab[] +\phy@d@l@geny\Bab\lbrace\rbrace +\phy@d@l@geny\vab\vert\vert +\phy@d@l@geny\aab\langle\rangle +\phy@d@l@geny\Vab\Vert\Vert \endinput %% End of file `phy-ab.sty'. diff --git a/macros/latex/contrib/physics2/tex/phy-braket.sty b/macros/latex/contrib/physics2/tex/phy-braket.sty index a6e88c13cc..bd3a9f3249 100644 --- a/macros/latex/contrib/physics2/tex/phy-braket.sty +++ b/macros/latex/contrib/physics2/tex/phy-braket.sty @@ -17,7 +17,7 @@ %% The Current Maintainer of this work is Zhang Tingxuan. %% \ProvidesFile{phy-braket.sty} - [2023/01/25 `braket' module of `physics2.sty'] + [2023/03/29 `braket' module of `physics2.sty'] % Here we need to get the definition of \phy@abopen and \phy@abclose. \phy@requiremodule{ab} \ifdefined\phy@abb@bkv @@ -74,23 +74,23 @@ \csname\@phy@bk@m\endcsname\vert{#2}% \csname\@phy@bk@m\endcsname\vert{#3}% \csname\@phy@bk@r\endcsname\rangle} -% Parse the optional argument of \braket. -\def\@phy@bk@do@pt#1,{\ifx#1\relax\@empty\else% +% Parse the optional argument of \braket. This will add 3 entries to hash table. +\def\@phy@bk@do@pt#1,{\ifx#1\relax\@empty\else \edef\reserved@a{\zap@space#1 \@empty}% - \ifx\reserved@a\@empty\else% - \ifcsname phy@del\expandafter\string\csname\reserved@a\endcsname\endcsname% + \ifx\reserved@a\@empty\else + \ifcsname phy@del\expandafter\string\csname\reserved@a\endcsname\endcsname \xdef\@phy@bk@l{\reserved@a l}% \xdef\@phy@bk@m{\reserved@a}% but not m (m stands for \mathrel) \xdef\@phy@bk@r{\reserved@a r}% - \else% + \else \ifnum\reserved@a>3% \PackageError{physics2}{\string\braket\space can only take 3 mandatory arguments at most}{Check if you had written a number more than 3 in the [optional] argument.}% - \fi% + \fi \xdef\@phy@bk@argnum{\romannumeral\reserved@a}% - \fi% - \fi% + \fi + \fi \expandafter\@phy@bk@do@pt\fi} \def\phy@bk@doopt#1{\@phy@bk@do@pt#1,\relax,} % \ketbra @@ -100,9 +100,9 @@ {\IfValueTF{#2}% {\csname#2l\endcsname\vert#3\csname#2r\endcsname\rangle#4% \csname#2l\endcsname\langle#5\csname#2r\endcsname\vert}% - {\begingroup% + {\begingroup \phy@abopen\vert\mathopen{\phy@mathvphantom{#5}}#3\phy@abclose\rangle#4% - \phy@abopen\langle#5\mathclose{\phy@mathvphantom{#3}}\phy@abclose\vert% + \phy@abopen\langle#5\mathclose{\phy@mathvphantom{#3}}\phy@abclose\vert \endgroup}% }% } diff --git a/macros/latex/contrib/physics2/tex/phy-common.sty b/macros/latex/contrib/physics2/tex/phy-common.sty index f20d258365..e587c02bec 100644 --- a/macros/latex/contrib/physics2/tex/phy-common.sty +++ b/macros/latex/contrib/physics2/tex/phy-common.sty @@ -17,9 +17,10 @@ %% The Current Maintainer of this work is Zhang Tingxuan. %% \ProvidesFile{phy-common.sty} - [2023/01/25 `common' module of `physics2.sty'] -% Check if `unicode-math' loaded and (re)define the vert symbols. -% The `\relax'es here are for \ifx to compare. + [2023/03/29 `common' module of `physics2.sty'] +% Check if unicode-math loaded and (re)define the vert symbols. +% The \relax's here are for \ifx to compare. +% unicode-math sets these symbols in \fam1, \symoperators is set 1 in 2e kernel. \AtBeginDocument{\ifcsname symrm\endcsname \protected\def\|{\Udelimiter 0 \symoperators "2016 }% \protected\def\vert{\Udelimiter 0 \symoperators "007C\relax}% |