Debian Codegraph @

texmf-dist/doc/latex/physics-patch/physics-patch.tex

raw
1 \documentclass[a4paper,12pt]{article}
2 \usepackage[margin=1.27cm,foot=0.77cm]{geometry}
3 \usepackage{amsmath,amssymb,array,etoolbox,fontspec,longtable,listings,multirow,needspace,parskip,setspace,verbatim,titling,xcolor,xparse,xstring}
4 \usepackage[shorttextgreek,shortvargreek,shortupgreek,shortupvargreek,shortboldgreek,shortmathrm,shorttext]{physics-patch}
5 \usepackage[colorlinks,urlcolor=blue]{hyperref}
6 \setmainfont{TeX Gyre Termes}[Ligatures=TeX]
7 \setsansfont{TeX Gyre Heros}[Ligatures=TeX]
8 \setmonofont{TeX Gyre Cursor}[Ligatures=TeX]
9 \usepackage{unicode-math}
10 \setmathfont{XITS Math}\setmathfont[range={cal,bfcal},StylisticSet=1]{XITS Math}
11 \everymath{\displaystyle}
12 \everydisplay{\displaystyle}
13 \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
14 \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
15 \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
16 \newcolumntype{m}{>{$\displaystyle}c<{$}}
17 \newcolumntype{M}[1]{>{$\displaystyle}p{#1}<{$}}
18 \setlength{\LTleft}{\fill}
19 \setlength{\LTright}{\fill}
20 \renewcommand{\maketitle}{
21 \begin{titlepage}
22 \begin{center}
23 \vspace*{\fill}
24 {\huge \bfseries \thetitle\par}
25 \vskip 1.5em
26 {\Large \theauthor\par}
27 \vskip 1em
28 {\large \thedate\par}
29 \vspace*{\fill}
30 \end{center}
31 \end{titlepage}
32 }
33 \lstset{
34 basicstyle=\ttfamily\scriptsize,
35 keywordstyle=\color{blue},
36 stringstyle=\color{red},
37 commentstyle=\color{green!50!black},
38 numbers=none,
39 backgroundcolor=\color{white},
40 showspaces=false,
41 showstringspaces=false,
42 showtabs=false,
43 frame=none,
44 tabsize=4,
45 captionpos=b,
46 breaklines=true,
47 breakatwhitespace=false
48 }
49 \title{The \texttt{physics-patch} package\\\mbox{}\\\textnormal{\large Improved version of the physics package}}
50 \author{\mbox{}\\Willie Shen (Willie169)}
51 \date{Version 3.1\\\textnormal{Last update: July 29, 2025}}
52 \begin{document}
53 \onehalfspacing\thispagestyle{empty}\Needspace{1\textheight}\maketitle\setcounter{page}{1}\Needspace{1\textheight}\tableofcontents\Needspace{1\textheight}\setcounter{page}{1}
54 \section{Preface}
55 Since version 2.0, the \texttt{physics-patch} package has evolved from merely patching the \texttt{physics} package to fully replacing it. While preserving the original goal—simplifying mathematical and physics typesetting for greater readability and efficiency—this package refines the design by addressing unintuitive behaviors, extending commands, and introducing additional macros. For instance, in the original package, parentheses and their contents after \verb|\dv{f}{x}| are ignored. This package also extends commands for broader applicability such as enabling \verb|\xmat| to support ellipses and introducing entirely new macros such as \verb|\omat|.
56 \section{Usage}
57 \subsection{Required packages}
58 The \texttt{physics-patch} package requires \texttt{amsmath}, \texttt{etoolbox}, \texttt{xcolor}, \texttt{xparse}, and \texttt{xstring} package to work. If you are unsure whether you've had them installed, you can either install it again using your local package manager (comes with most distributions) or by visiting the \href{http://www.ctan.org}{CTAN} online package database, or even just try to use \texttt{physics-patch} package without worrying about it. Many modern \LaTeX compilers will locate and offer to download missing required packages for you.
59 \subsection{Using \texttt{physics-patch} in your \LaTeX~document}
60 To use \texttt{physics-patch} in your \LaTeX~document, simply insert \verb|\usepackage{physics-patch}| in the preamble of your document, before \verb|\begin{document}| and after \verb|\documentclass{class}|:
61 \begin{lstlisting}
62 \documentclass{class}
63 ...
64 \usepackage{physics-patch}
65 ...
66 \begin{document}
67 content...
68 \end{document}
69 \end{lstlisting}
70
71 This package will silently override the commands that have been defined before this package is loaded. To use the original definition provided by \texttt{physics}, load \texttt{physics} before this package and use the \texttt{nooverride} option for this package (not recommended). \texttt{nooverride} falls back to the original behavior if \texttt{physics} has not been loaded.
72
73 This package pretends that \texttt{physics} is loaded so that this package won't be overriden if loading \texttt{physics} is called afterward and packages that depend on \texttt{physics} (e.g. \texttt{siunitx}) work correctly. To disable this, use the \texttt{nopretend} option (not recommended).
74
75 If \texttt{siuitx} is loaded before this package, this package will define \verb|\ITquantity| and \verb|\ITqty| with the integration of the revised definition of \texttt{physics}'s \verb|\qty| (in \verb|\PHquantity| and \verb|\PHqty|) and \texttt{siuitx}'s \verb|\SI|. You can optionally set \texttt{siintegrate} option to override \verb|\PTquantity| and \verb|\PTqty| with \verb|\ITqty| (not recommended). \texttt{siintegrate} falls back to the original behavior if \texttt{siunitx} is not loaded.
76 \subsection{Options}
77 Options available in this package include
78 \begin{itemize}
79 \item \verb|nooverride|: Not override macros in physics to patched ones. Fall back to override if physics is not loaded. (not recommended)
80 \item \verb|override|: Override macros in physics to patched ones. This option can be set no matter whether physics is loaded. (default)
81 \item \verb|nopretend|: Not pretend that physics package is loaded. (not recommend).
82 \item \verb|pretend|: Pretend that \texttt{physics} is loaded so that this package won't be overriden if loading \texttt{physics} is called afterward and packages that depend on \texttt{physics} (e.g. \texttt{siunitx}) work correctly. (default)
83 \item \verb|nosiintegrate|: Not override \verb|\PTquantity| and \verb|\PTqty| with \verb|\ITqty|. (default)
84 \item \verb|siintegrate|: Override \verb|\PTquantity| and \verb|\PTqty| with \verb|\ITqty|. Fall back to nosiintegrate if siunitx is not loaded. (not recommended)
85 \item \verb|nooriginaldiv|: Let \verb|\div| be \verb|\divergence|. (not recommended)
86 \item \verb|originaldiv|: Let \verb|\div| be division symbol. (default)
87 \item \verb|notrig|: Not define functions and operators with automatic bracing.
88 \item \verb|trig|: Define functions and operators with automatic bracing. (default)
89 \item \verb|italicdiff|: Italic differentials.
90 \item \verb|uprightdiff|: Upright differentials. (default)
91 \item \verb|arrowdel|: Vector arrow \verb|\nabla| symbol.
92 \item \verb|bolddel|: Vector bold \verb|\nabla| symbol. (default)
93 \item \verb|bolddot|: Vector bold dot product symbol.
94 \item \verb|plaindot|: Vector plain dot product symbol. (default)
95 \item \verb|forcedefault|: Forces the above options to their default ones.
96 \item \verb|noshorttextgreek|: Not define shorthands for text Greek alphabet. (default)
97 \item \verb|shorttextgreek|: Define shorthands for text Greek alphabet.
98 \item \verb|noshortvargreek|: Not define shorthands for variant Greek alphabet. (default)
99 \item \verb|shortvargreek|: Define shorthands for variant Greek alphabet.
100 \item \verb|noshortupgreek|: Not define shorthands for upright Greek alphabet. (default)
101 \item \verb|shortupgreek|: Define shorthands for upright Greek alphabet.
102 \item \verb|noshortupvargreek|: Not define shorthands for upright variant Greek alphabet. (default)
103 \item \verb|shortupvargreek|: Define shorthands for upright variant Greek alphabet.
104 \item \verb|noshortboldgreek|: Not define shorthands for bold Greek alphabet. (default)
105 \item \verb|shortboldgreek|: Define shorthands for bold Greek alphabet.
106 \item \verb|noshortgreek|: Not define all shorthands for Greek alphabet. (default)
107 \item \verb|shortgreek|: Define all shorthands for Greek alphabet.
108 \item \verb|noshortmathrm|: Not define shorthands for mathrm alphabet and chemical element symbols. (default)
109 \item \verb|shortmathrm|: Define shorthands for mathrm alphabet and chemical element symbols.
110 \item \verb|noshorttext|: Not define shorthands for textnormal alphabet. (default)
111 \item \verb|shorttext|: Define shorthands for textnormal alphabet.
112 \end{itemize}
113
114 To use all features of this package, load it with
115 \begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
116 \usepackage[shortgreek,shortmathrm,shorttext]{physics-patch}
117 \end{lstlisting}
118 \section{Communication Channels}
119 \begin{itemize}
120 \item \textbf{Bug tracker:} \href{https://github.com/Willie169/physics-patch/issues}{https://github.com/Willie169/physics-patch/issues}.
121 \item \textbf{Announcements:} \href{https://github.com/Willie169/physics-patch/releases}{https://github.com/Willie169/physics-patch/releases}.
122 \item \textbf{Repository:} \href{https://github.com/Willie169/physics-patch}{https://github.com/Willie169/physics-patch}.
123 \end{itemize}
124 \section{License and Credit}
125 \begin{itemize}
126 \item
127 This package is released under the \textbf{LaTeX Project Public License (LPPL) 1.3c.}
128
129 See \href{https://www.latex-project.org/lppl/lppl-1-3c}{https://www.latex-project.org/lppl/lppl-1-3c} for the details of that license.
130 \item Many parts of this package are modified or copied from the \texttt{physics} package, created by \textbf{Sergio C. de la Barrera} and licenced under \textbf{LPPL 1.3}.
131
132 See \href{https://ctan.org/pkg/physics}{https://ctan.org/pkg/physics} for the details of that package.
133 \item Many parts of this package rely on the \texttt{amsmath} package, created by \textbf{The \LaTeX{} Project Team} and licenced under \textbf{LPPL 1.3c}.
134
135 See \href{https://ctan.org/pkg/amsmath}{https://ctan.org/pkg/amsmath} for the details of that package.
136 \end{itemize}
137 \section{List of Commands}
138 In the commands listed below, the left column is long-form names with non-default alternate names (if any), the middle column is default shorthand commands with detailed syntaxes and explanations.
139
140 If the \texttt{nooverride} option is not used or the \texttt{physics} package is not loaded before this package, a command without \texttt{PT} prefix will be defined as the same definition as that prefixed with \texttt{PT} for every command prefixed with \texttt{PT} below silently.
141 \subsection{Automatic bracing}
142 \begin{longtable}[c]{|L{0.2\textwidth}|L{0.35\textwidth}|L{0.35\textwidth}|}
143 \hline
144 \verb|\PTquantity|, \verb|\PHquantity| or \verb|\PHqty| & \verb|\PTqty(\typical)| $\displaystyle\rightarrow \PTqty(\typical)$ & automatic $\PTqty(\;)$ braces \\
145 & \verb|\PTqty(\tall)| $\displaystyle\rightarrow \PTqty(\tall)$ & \\
146 & \verb|\PTqty(\grande)| $\displaystyle\rightarrow \PTqty(\grande)$ & \\
147 & \verb|\PTqty[\typical]| $\rightarrow \PTqty[\typical]$ & automatic $\PTqty[\;]$ braces \\
148 & \verb+\PTqty|\typical|+ $\rightarrow \PTqty|\typical|$ & automatic $\PTqty|\;|$ braces \\
149 & \verb|\PTqty{\typical}| $\rightarrow \PTqty{\typical}$ & automatic $\PTqty{\;}$ braces \\
150 & \verb|\PTqty\big{}| $\rightarrow \PTqty\big{}$ & \multirow{4}{*}{\parbox{6cm}{manual sizing (works with any of the above bracket types)}} \\
151 & \verb|\PTqty\Big{}| $\rightarrow \PTqty\Big{}$ & \\
152 & \verb|\PTqty\bigg{}| $\rightarrow \PTqty\bigg{}$ & \\
153 & \verb|\PTqty\Bigg{}| $\rightarrow \PTqty\Bigg{}$ & \\
154 & \verb|\pqty{}| $\leftrightarrow$ \verb|\PTqty()| & \multirow{4}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
155 & \verb|\bqty{}| $\leftrightarrow$ \verb|\PTqty[]| & \\
156 & \verb+\vqty{}+ $\leftrightarrow$ \verb+\PTqty||+ & \\
157 & \verb|\Bqty{}| $\leftrightarrow$ \verb|\PTqty{}| & \\\hline
158 \verb|\absolutevalue| & \verb|\abs{a}| $\rightarrow \abs{a}$ & automatic sizing; equivalent to \verb+\PTqty|a|+ \\
159 & \verb|\abs\Big{a}| $\rightarrow \abs\Big{a}$ & inherits manual sizing syntax from \verb|\PTqty| \\
160 & \verb|\abs*{\grande}| $\displaystyle\rightarrow \abs*{\grande}$ & star for no resize \\\hline
161 \verb|\norm| & \verb|\norm{a}| $\rightarrow \norm{a}$ & automatic sizing \\
162 & \verb|\norm\Big{a}| $\rightarrow \norm\Big{a}$ & manual sizing \\
163 & \verb|\norm*{\grande}| $\displaystyle\rightarrow \norm*{\grande}$ & star for no resize \\\hline
164 \verb|\evaluated| & \verb|\eval{x}_0^\infty| $\displaystyle\rightarrow \eval{x}_0^\infty$ & vertical bar for evaluation limits \\
165 & \verb+\eval(x|_0^\infty+ $\displaystyle\rightarrow \eval(x|_0^\infty$ & alternate form \\
166 & \verb+\eval[x|_0^\infty+ $\displaystyle\rightarrow \eval[x|_0^\infty$ & alternate form \\
167 & \verb+\eval[\venti|_0^\infty+ $\displaystyle\rightarrow \eval[\venti|_0^\infty$ & automatic sizing\\
168 & \verb+\eval*[\venti|_0^\infty+ $\displaystyle\rightarrow \eval*[\venti|_0^\infty$ & star for no resize \\\hline
169 \verb|\order| & \verb|\order{x^2}| $\rightarrow \order{x^2}$ & order symbol; automatic sizing and space handling \\
170 & \verb|\order\Big{x^2}| $\rightarrow \order\Big{x^2}$ & manual sizing \\
171 & \verb|\order*{\grande}| $\displaystyle\rightarrow \order*{\grande}$ & star for no resize \\\hline
172 \verb|\commutator| & \verb|\comm{A}{B}| $\rightarrow \comm{A}{B}$ & automatic sizing \\
173 & \verb|\comm\Big{A}{B}| $\rightarrow \comm\Big{A}{B}$ & manual sizing \\
174 & \verb|\comm*{A}{\grande}| $\displaystyle\rightarrow \comm*{A}{\grande}$ & star for no resize \\\hline
175 \verb|\anticommutator| or \verb|\acommutator| & \verb|\acomm{A}{B}| $\rightarrow \acomm{A}{B}$ & same as \verb|\poissonbracket| \\\hline
176 \verb|\poissonbracket| & \verb|\pb{A}{B}| $\rightarrow \pb{A}{B}$ & same as \verb|\anticommutator|\\\hline
177 \verb|\mid| & \verb|\left\{x\mid x>0\right\}| $\rightarrow \left\{x\mid x>0\right\}$ & Expands to \verb+\middle|+ when inside a \verb|\left|...\verb|\right| group (\verb|\currentgrouptype=16|) \\
178 & \verb|\{x\mid x>0\}| $\rightarrow \{x\mid x>0\}$ & Falls back to original \\\hline
179 \end{longtable}
180 \subsection{Vector notation}
181 The default del symbol $\vnabla$ used in \texttt{physics-patch} vector notation can be switched to appear with an arrow $\vec{\vnabla}$ by including the option \texttt{arrowdel} in the document preamble:
182 \begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
183 \usepackage[arrowdel]{physics-patch}
184 \end{lstlisting}
185 \begin{longtable}[c]{|L{0.2\textwidth}|L{0.4\textwidth}|L{0.3\textwidth}|}
186 \hline
187 \verb|\vectorbold| & \verb|\vb{a}| $\rightarrow \vb{a}$ & upright/no Greek \\
188 & \verb|\vb*{a}|, \verb|\vb*{\theta}| $\rightarrow \vb*{a}$, $\vb*{\theta}$ & italic/Greek \\\hline
189 \verb|\vectorarrow| & \verb|\va{a}| $\rightarrow \va{a}$ & upright/no Greek \\
190 & \verb|\va*{a}|, \verb|\va*{\theta}| $\rightarrow \va*{a}$, $\va*{\theta}$ & italic/Greek \\\hline
191 \verb|\vectorunit| & \verb|\vu{a}| $\rightarrow \vu{a}$ & upright/no Greek \\
192 & \verb|\vu*{a}|, \verb|\vu*{\theta}| $\rightarrow \vu*{a}$, $\vu*{\theta}$ & italic/Greek \\\hline
193 \verb|\dotproduct| & \verb|\vdot| $\rightarrow \vdot$ as in $\vb{a} \vdot \vb{b}$ & note: \verb|\dp| is a protected \TeX\ primitive \\\hline
194 \verb|\crossproduct| & \verb|\cross| $\rightarrow \cross$ as in $\vb{a} \cross \vb{b}$ & alternate name \\
195 & \verb|\cp| $\rightarrow \cp$ as in $\vb{a} \cp \vb{b}$ & shorthand name \\\hline
196 \verb|\gradient| & \verb|\grad| $\rightarrow \grad$ & \\
197 & \verb|\grad{\Psi}| $\rightarrow \grad{\Psi}$ & default mode \\
198 & \verb|\grad(\Psi+\tall)| $\displaystyle\rightarrow \grad(\Psi+\tall)$ & long-form (like \verb|\PTqty| but also handles spacing) \\
199 & \verb|\grad[\Psi+\tall]| $\displaystyle\rightarrow \grad[\Psi+\tall]$ & \\\hline
200 \verb|\divisionsymbol| & \verb|\divisionsymbol| $\rightarrow \divisionsymbol$ & \\\hline
201 \verb|\divergence| & \verb|\divg| $\rightarrow \divg$ & note: if \texttt{nooriginaldiv} option is used, \verb|\div| will be overriden as $\divg$ too (not recommended) \\
202 & \verb|\divg{\vb{a}}| $\rightarrow \divg{\vb{a}}$ & default mode \\
203 & \verb|\divg(\vb{a}+\tall)| $\displaystyle\rightarrow \divg(\vb{a}+\tall)$ & long-form \\
204 & \verb|\divg[\vb{a}+\tall]| $\displaystyle\rightarrow \divg[\vb{a}+\tall]$ & \\\hline
205 \verb|\curl| & \verb|\curl| $\rightarrow \curl$ & \\
206 & \verb|\curl{\vb{a}}| $\rightarrow \curl{\vb{a}}$ & default mode \\
207 & \verb|\curl(\vb{a}+\tall)| $\displaystyle\rightarrow \curl(\vb{a}+\tall)$ & long-form \\
208 & \verb|\curl[\vb{a}+\tall]| $\displaystyle\rightarrow \curl[\vb{a}+\tall]$ & \\\hline
209 \verb|\laplacian| & \verb|\laplacian| $\rightarrow \laplacian$ & \\
210 & \verb|\laplacian{\Psi}| $\rightarrow \laplacian{\Psi}$ & default mode \\
211 & \verb|\laplacian(\Psi+\tall)| $\displaystyle\rightarrow \laplacian(\Psi+\tall)$ & long-form \\
212 & \verb|\laplacian[\Psi+\tall]| $\displaystyle\rightarrow \laplacian[\Psi+\tall]$ &\\\hline
213 \end{longtable}
214 \subsection{Operators}
215 The trig functions and some other functions are redefined in \texttt{physics-patch} to provide automatic braces that behave like \verb|\PTqty()|. In addition, an optional power argument is provided. This behavior can be switched off by including the option \texttt{notrig} in the preamble:
216 \begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
217 \usepackage[notrig]{physics-patch}
218 \end{lstlisting}
219 Example redefinitions:
220 \begin{longtable}[c]{|l|l|l|}
221 \hline
222 \verb|\sin| & \verb|\sin(\grande)| $\displaystyle\rightarrow \sin(\grande)$ & automatic braces; old \verb|\sin| renamed \verb|\sine| \\
223 & \verb|\sin[2](x)| $\rightarrow \sin[2](x)$ & optional power \\
224 & \verb|\sin x| $\rightarrow \sin x$ & can still use without an argument \\\hline
225 \end{longtable}
226 The full set of available such functions in \texttt{physics-patch} includes:
227 \begin{longtable}[c]{llll}
228 \verb|\sin(x)| & \verb|\sinh(x)| & \verb|\arcsin(x)| & \verb|\asin(x)| \\
229 \verb|\cos(x)| & \verb|\cosh(x)| & \verb|\arccos(x)| & \verb|\acos(x)| \\
230 \verb|\tan(x)| & \verb|\tanh(x)| & \verb|\arctan(x)| & \verb|\atan(x)| \\
231 \verb|\csc(x)| & \verb|\csch(x)| & \verb|\arccsc(x)| & \verb|\acsc(x)| \\
232 \verb|\sec(x)| & \verb|\sech(x)| & \verb|\arcsec(x)| & \verb|\asec(x)| \\
233 \verb|\cot(x)| & \verb|\coth(x)| & \verb|\arccot(x)| & \verb|\acot(x)| \\
234 \verb|\exp(x)| & \verb|\log(x)| & \verb|\ln(x)| & \verb|\det(x)| \\
235 \verb|\Pr(x)| & \verb|\Arg(x)| & \verb|\arg(x)| & \verb|\Re(x)| \\
236 \verb|\Im(x)| \\
237 \end{longtable}
238 $\Rightarrow$
239 \begin{longtable}[c]{mmmm}
240 \sin(x) & \sinh(x) & \arcsin(x) & \asin(x) \\
241 \cos(x) & \cosh(x) & \arccos(x) & \acos(x) \\
242 \tan(x) & \tanh(x) & \arctan(x) & \atan(x) \\
243 \csc(x) & \csch(x) & \arccsc(x) & \acsc(x) \\
244 \sec(x) & \sech(x) & \arcsec(x) & \asec(x) \\
245 \cot(x) & \coth(x) & \arccot(x) & \acot(x)\\
246 \exp(x) & \log(x) & \ln(x) & \det(x) \\
247 \Pr(x) & \Arg(x) & \arg(x) & \Re(x) \\
248 \Im(x) \\
249 \end{longtable}
250 The same set of functions but without any automatic bracing are available under a new set of longer names:
251 \begin{longtable}[c]{llll}
252 \verb|\sine| & \verb|\hypsine| & \verb|\arcsine| & \verb|\asine| \\
253 \verb|\cosine| & \verb|\hypcosine| & \verb|\arccosine| & \verb|\acosine| \\
254 \verb|\tangent| & \verb|\hyptangent| & \verb|\arctangent| & \verb|\atangent| \\
255 \verb|\cosecant| & \verb|\hypcosecant| & \verb|\arccosecant| & \verb|\acosecant| \\
256 \verb|\secant| & \verb|\hypsecant| & \verb|\arcsecant| & \verb|\asecant| \\
257 \verb|\cotangent| & \verb|\hypcotangent| & \verb|\arccotangent| & \verb|\acotangent|\\
258 \verb|\exponential| & \verb|\logarithm| & \verb|\naturallogarithm| & \verb|\determinant| \\
259 \verb|\Probability| & \verb|\Argument| & \verb|\argument| & \verb|\real| \\
260 \verb|\imaginary| \\
261 \end{longtable}
262 New operators:
263 \begin{longtable}[c]{|L{0.2\textwidth}|L{0.35\textwidth}|L{0.35\textwidth}|}
264 \hline
265 \verb|\tr| & \verb|\tr\rho| $\rightarrow \tr\rho$ also \verb|\tr(\tall)| $\rightarrow \tr(\tall)$ & trace; same bracing as trig functions \\\hline
266 \verb|\Tr| & \verb|\Tr\rho| $\rightarrow \Tr\rho$ & alternate \\\hline
267 \verb|\rank| & \verb|\rank M| $\rightarrow \rank M$ & matrix rank \\\hline
268 \verb|\erf| & \verb|\erf(x)|$\rightarrow \erf(x)$ & error function \\\hline
269 \verb|\Res| & \verb|\Res[f(z)]|$\rightarrow \Res[f(z)]$ & residue; same bracing as trig functions \\\hline
270 \verb|\acosh| & \verb|\acosh(\pi)| $\rightarrow\acosh(\pi)$ & acosh \\\hline
271 \verb|\acsch| & \verb|\acsch(\pi)| $\rightarrow\acsch(\pi)$ & acsch \\\hline
272 \verb|\arccosh| & \verb|\arccosh(\pi)| $\rightarrow\arccosh(\pi)$ & arccosh \\\hline
273 \verb|\arccsch| & \verb|\arccsch(\pi)| $\rightarrow\arccsch(\pi)$ & arccsch \\\hline
274 \verb|\arcsech| & \verb|\arcsech(\pi)| $\rightarrow\arcsech(\pi)$ & arcsech \\\hline
275 \verb|\arcsinh| & \verb|\arcsinh(\pi)| $\rightarrow\arcsinh(\pi)$ & arcsinh \\\hline
276 \verb|\arctanh| & \verb|\arctanh(\pi)| $\rightarrow\arctanh(\pi)$ & arctanh \\\hline
277 \verb|\arctantwo| & \verb|\arctantwo(\pi)| $\rightarrow\arctantwo(\pi)$ & arctan2 \\\hline
278 \verb|\asech| & \verb|\asech(\pi)| $\rightarrow\asech(\pi)$ & asech \\\hline
279 \verb|\asinh| & \verb|\asinh(\pi)| $\rightarrow\asinh(\pi)$ & asinh \\\hline
280 \verb|\atanh| & \verb|\atanh(\pi)| $\rightarrow\atanh(\pi)$ & atanh \\\hline
281 \verb|\atantwo| & \verb|\atantwo(\pi)| $\rightarrow\atantwo(\pi)$ & atan2 \\\hline
282 \verb|\closure| & \verb|\closure(A)| $\rightarrow\closure(A)$ & closure \\\hline
283 \verb|\col| & \verb|\col(\mathbf{A})| $\rightarrow\col(\mathbf{A})$ & column space \\\hline
284 \verb|\Col| & \verb|\Col(\mathbf{A})| $\rightarrow\Col(\mathbf{A})$ & column space \\\hline
285 \verb|\dim| & \verb|\dim(V)| $\rightarrow\dim(V)$ & dimension \\\hline
286 \verb|\Dim| & \verb|\Dim(V)| $\rightarrow\dim(V)$ & dimension \\\hline
287 \verb|\distance| & \verb|\distance(A,B)| $\rightarrow\distance(A,B)$ & lowercase distance \\\hline
288 \verb|\Distance| & \verb|\Distance(A,B)| $\rightarrow\Distance(A,B)$ & uppercase distance \\\hline
289 \verb|\row| & \verb|\row(\mathbf{A})| $\rightarrow\row(\mathbf{A})$ & row space \\\hline
290 \verb|\Row| & \verb|\Row(\mathbf{A})| $\rightarrow\Row(\mathbf{A})$ & row space \\\hline
291 \verb|\ker| & \verb|\ker(\mathbf{A})| $\rightarrow\ker(\mathbf{A})$ & kernel \\\hline
292 \verb|\coker| & \verb|\coker(\mathbf{A})| $\rightarrow\coker(\mathbf{A})$ & cokernel \\\hline
293 \verb|\rank| & \verb|\rank(\mathbf{A})| $\rightarrow\rank(\mathbf{A})$ & rank \\\hline
294 \verb|\Rank| & \verb|\Rank(\mathbf{A})| $\rightarrow\Rank(\mathbf{A})$ & rank \\\hline
295 \verb|\im| & \verb|\im(\mathbf{A})| $\rightarrow\im(\mathbf{A})$ & image space \\\hline
296 \verb|\SD| & \verb|\SD(X)| $\rightarrow\SD(X)$ & standard deviation \\\hline
297 \verb|\Var| & \verb|\Var(X)| $\rightarrow\Var(X)$ & variation \\\hline
298 \verb|\Mode| & \verb|\Mode(X)| $\rightarrow\Mode(X)$ & mode \\\hline
299 \verb|\Median| & \verb|\Median(X)| $\rightarrow\Median(X)$ & median \\\hline
300 \verb|\gcd| & \verb|\gcd(X)| $\rightarrow\gcd(X)$ & lowercase greatest common divisor \\\hline
301 \verb|\lcm| & \verb|\lcm(X)| $\rightarrow\lcm(X)$ & lowercase lowest common multiple \\\hline
302 \verb|\GCD| & \verb|\GCD(X)| $\rightarrow\GCD(X)$ & uppercase greatest common divisor \\\hline
303 \verb|\LCM| & \verb|\LCM(X)| $\rightarrow\LCM(X)$ & uppercase lowest common multiple \\\hline
304 \verb|\UnitVector| & \verb|\UnitVector(\mathbf{r})| $\rightarrow\UnitVector(\mathbf{r})$ & unit vector \\\hline
305 \verb|\principalvalue| & \verb|\pv{\int f(z) \dd{z}}|$\rightarrow \pv{\int f(z) \dd{z}}$ & Cauchy principal value \\
306 & \verb|\PV{\int f(z) \dd{z}}|$\rightarrow \PV{\int f(z) \dd{z}}$ & alternate \\\hline
307 \end{longtable}
308 \subsection{Utilities}
309 \begin{longtable}[c]{|L{0.25\textwidth}|L{0.4\textwidth}|L{0.25\textwidth}|}
310 \hline
311 \verb|\mathcolorbox| & \verb|\mcbox{color}{content}| & \verb|\colorbox| for math environment, applying to all four levels of math styles \\
312 & \verb|\mcbox{cyan}{\typical}| $\rightarrow \mcbox{cyan}{\typical}$ & \\\hline
313 \verb|\autocolorbox| or \verb|\acbox| & \verb|\cbox{color}{content}| & calls \verb|\colorbox| when in text mode, calls \verb|\mathcolorbox| when in math mode \\\hline
314 \verb|\tentothepowerof| & \verb|\tenpow{n}| $\rightarrow \tenpow{n}$ & work in both math mode and text mode \\\hline
315 \verb|\scientificnotation| & \verb|\scinote{3.00}{8}| $\rightarrow \scinote{3.00}{8}$ & work in both math mode and text mode\\\hline
316 \verb|\numbercircled| & \verb|\numcir{1}| $\rightarrow$ \numcir{1} & patched \verb|\textcircled| for numbers \\\hline
317 \verb|\boldsymbol| & \verb|\bsb{\tau}| $\rightarrow\bsb{\tau}$ & shorthand for \verb|\boldsymbol| \\\hline
318 \verb|\RNum| & \verb|\RNum{1}| $\rightarrow$ \RNum{1} & uppercase roman numeral\\\hline
319 \verb|\flatfrac| & \verb|\flatfrac{a}{b}| $\rightarrow\flatfrac{a}{b}$ & flat fraction\\\hline
320 \end{longtable}
321 \subsection{Quick quad text}
322 This set of commands produces text in math-mode padded by \verb|\quad| spacing on either side. This is meant to provide a quick way to insert simple words or phrases in a sequence of equations. Each of the following commands includes a starred version which pads the text only on the right side with \verb|\quad| for use in aligned environments such as \texttt{cases}. General text:
323 \begin{longtable}[c]{|l|l|l|}
324 \hline
325 \verb|\qqtext| & \verb|\qq{}| & general quick quad text with argument \\
326 & \verb|\qq{word or phrase}| $\rightarrow$\Vtextvisiblespace[1em]$\text{word or phrase}$\Vtextvisiblespace[1em] & normal mode; left and right \verb|\quad| \\
327 & \verb|\qq*{word or phrase}| $\rightarrow \text{word or phrase}$\Vtextvisiblespace[1em] & starred mode; right \verb|\quad| only\\\hline
328 \end{longtable}
329 Special macros:
330 \begin{longtable}[c]{|l|l|}
331 \hline
332 \verb|\qcomma| or \verb|\qc| $\rightarrow ,$\Vtextvisiblespace[1em] & right \verb|\quad| only \\\hline
333 \verb|\qcc| $\rightarrow$\Vtextvisiblespace[1em]$\text{c.c.}$\Vtextvisiblespace[1em] & complex conjugate; left and right \verb|\quad| unless starred \verb|\qcc*| $\rightarrow \text{c.c.}$\Vtextvisiblespace[1em] \\\hline
334 \verb|\qif| $\rightarrow$\Vtextvisiblespace[1em]$\text{if}$\Vtextvisiblespace[1em] & left and right \verb|\quad| unless starred \verb|\qif*| $\rightarrow \text{if}$\Vtextvisiblespace[1em]\\\hline
335 \end{longtable}
336 Similar to \verb|\qif|:
337 \begin{longtable}[c]{|c|c|c|c|c|c|}
338 \hline
339 \verb|\qthen| & \verb|\qelse| & \verb|\qotherwise| & \verb|\qunless| & \verb|\qgiven| & \verb|\qusing| \\\hline
340 \verb|\qassume| & \verb|\qsince| & \verb|\qlet| & \verb|\qfor| & \verb|\qall| & \verb|\qeven| \\\hline
341 \verb|\qodd| & \verb|\qinteger| & \verb|\qand| & \verb|\qor| & \verb|\qas| & \verb|\qin| \\\hline
342 \end{longtable}
343 \subsection{Derivatives}
344 The default differential symbol $\mathrm{d}$ and default uppercase differential symbol $\mathrm{D}$ can be switched to italic forms $d$ and $D$ by including the option \texttt{italicdiff} in the preamble:
345 \begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
346 \usepackage[italicdiff]{physics-patch}
347 \end{lstlisting}
348 \begin{longtable}[c]{|L{0.3\textwidth}|L{0.3\textwidth}|L{0.3\textwidth}|}
349 \hline
350 \verb|\dfd| & \verb|\dfd| $\rightarrow \mathrm{d}$ & differential symbol \\\hline
351 \verb|\dfD| & \verb|\dfD| $\rightarrow \mathrm{D}$ & uppercase differential symbol \\\hline
352 \verb|\differential| & \verb|\dd| $\rightarrow \dd$ & \\
353 & \verb|\dd x| $\rightarrow \dd x$ & no spacing (not recommended) \\
354 & \verb|\dd{x}| $\rightarrow$ \textvisiblespace\,$\dd{x}$\textvisiblespace & automatic spacing based on neighbors \\
355 & \verb|\dd[3]{x}| $\rightarrow \dd[3]{x}$ & optional power \\
356 & \verb|\dd(\cos\theta)| $\rightarrow \dd(\cos\theta)$ & long-form; automatic braces \\\hline
357 \verb|\Differential| & \verb|\Dd| $\rightarrow \dd$ & \\
358 & \verb|\Dd x| $\rightarrow \Dd x$ & no spacing (not recommended) \\
359 & \verb|\Dd{x}| $\rightarrow$ \textvisiblespace\,$\Dd{x}$\textvisiblespace & automatic spacing based on neighbors \\
360 & \verb|\Dd[3]{x}| $\rightarrow \Dd[3]{x}$ & optional power \\
361 & \verb|\Dd(\cos\theta)| $\rightarrow \Dd(\cos\theta)$ & long-form; automatic braces \\\hline
362 \verb|\Derivative| & \verb|\Dv{x}| $\displaystyle\rightarrow \Dv{x}$ & one argument \\
363 & \verb|\Dv{f}{x}| $\displaystyle\rightarrow \Dv{f}{x}$ & two arguments \\
364 & \verb|\Dv[n]{f}{x}| $\displaystyle\rightarrow \Dv[n]{f}{x}$ & optional power \\
365 & \verb|\Dv{x}(\grande)| $\displaystyle\rightarrow \Dv{x}(\grande)$ & long-form; automatic braces, spacing \\
366 & \verb|\Dv*{f}{x}| $\displaystyle\rightarrow \Dv*{f}{x}$ & inline form using \verb|\flatfrac| \\\hline
367 \verb|\PTpartialderivative| or \verb|\PTpderivative| & \verb|\PTdv{f}{x}(\grande)| $\displaystyle\rightarrow \PTdv{f}{x}(\grande)$ & note: in original \texttt{physics} package, \verb|\dv{f}{x}(\grande)| $\displaystyle\rightarrow \dv{f}{x}$\\
368 & \verb|\PTpdv{x}| $\displaystyle\rightarrow \PTpdv{x}$ & shorthand name \\
369 & \verb|\PTpdv{f}{x}| $\displaystyle\rightarrow \PTpdv{f}{x}$ & two arguments \\
370 & \verb|\PTpdv[n]{f}{x}| $\displaystyle\rightarrow \PTpdv[n]{f}{x}$ & optional power \\
371 & \verb|\PTpdv{x}(\grande)| $\displaystyle\rightarrow \PTpdv{x}(\grande)$ & long-form \\
372 & \verb|\PTpdv{f}{x}{y}| $\displaystyle\rightarrow \PTpdv{f}{x}{y}$ & mixed partial \\
373 & \verb|\PTpdv*{f}{x}| $\displaystyle\rightarrow \PTpdv*{f}{x}$ & inline form using \verb|\flatfrac| \\
374 & \verb|\PTpdv{f}{x}(\grande)| $\displaystyle\rightarrow \PTpdv{f}{x}(\grande)$ & note: in original \texttt{physics} package, \verb|\pdv{f}{x}(\grande)| $\displaystyle\rightarrow \pdv{f}{x}$ \\\hline
375 \verb|\variation| & \verb|\var{F[g(x)]}| $\rightarrow \var{F[g(x)]}$ & functional variation (works like \verb|\dd|) \\
376 & \verb|\var(E-TS)| $\rightarrow \var(E-TS)$ & long-form \\\hline
377 \verb|\functionalderivative| & \verb|\fdv{g}| $\displaystyle\rightarrow \fdv{g}$ & functional derivative (works like \verb|\PTdv|) \\
378 & \verb|\fdv{F}{g}| $\displaystyle\rightarrow \fdv{F}{g}$ & \\
379 & \verb|\fdv{V}(E-TS)| $\displaystyle\rightarrow \fdv{V}(E-TS)$ & long-form \\
380 & \verb|\fdv*{F}{x}| $\displaystyle\rightarrow \fdv*{F}{x}$ & inline form using \verb|\flatfrac| \\\hline
381 \end{longtable}
382 \subsection{Dirac bra-ket notation}
383 The following collection of macros for Dirac notation contains two fundamental commands, \verb|\bra| and \verb|\ket|, along with a set of more specialized macros which are essentially combinations of the fundamental pair. The fundamental commands are designed to contract with one another algebraically when appropriate and are thus suggested for general use. For instance, the following code renders correctly\footnote{Note the lack of a space between the bra and ket commands. This is necessary in order for the bra to find the corresponding ket and form a contraction.}
384 \begin{displaymath}
385 \verb|\bra{\phi}\ket{\psi}| \rightarrow \bra{\phi}\ket{\psi} \qq{as opposed to} \bra{\phi} \ket{\psi}
386 \end{displaymath}
387 whereas a similar construction with higher-level macros will not contract in a robust manner
388 \begin{displaymath}
389 \verb|\bra{\phi}\dyad{\psi}{\xi}| \rightarrow \bra{\phi}\dyad{\psi}{\xi}.
390 \end{displaymath}
391 On the other hand, the correct output can be generated by sticking to the fundamental commands,
392 \begin{displaymath}
393 \verb|\bra{\phi}\ket{\psi}\bra{\xi}| \rightarrow \bra{\phi}\ket{\psi}\bra{\xi}
394 \end{displaymath}
395 allowing the user to type out complicated quantum mechanical expressions without worrying about bra-ket contractions. That being said, the high-level macros do have a place in convenience and readability, as long as the user is aware of rendering issues that may arise due to an absence of automatic contractions.
396 \begin{longtable}[c]{|L{0.25\textwidth}|L{0.35\textwidth}|L{0.3\textwidth}|}
397 \hline
398 \verb|\ket| & \verb|\ket{\tall}| $\rightarrow \ket{\tall}$ & automatic sizing \\
399 & \verb|\ket*{\tall}| $\rightarrow \ket*{\tall}$ & no resize \\\hline
400 \verb|\bra| & \verb|\bra{\tall}| $\rightarrow \bra{\tall}$ & automatic sizing \\
401 & \verb|\bra*{\tall}| $\rightarrow \bra*{\tall}$ & no resize \\
402 & \verb|\bra{\phi}\ket{\psi}| $\rightarrow \bra{\phi}\ket{\psi}$ & automatic contraction \\
403 & \verb|\bra{\phi}\ket{\tall}| $\rightarrow \bra{\phi}\ket{\tall}$ & contraction inherits automatic sizing \\
404 & \verb|\bra{\phi}\ket*{\tall}| $\rightarrow \bra{\phi}\ket*{\tall}$ & \multirow{2}{*}{\parbox{6cm}{a star on either term in the contraction prohibits resizing}} \\
405 & \verb|\bra*{\phi}\ket{\tall}| $\rightarrow \bra*{\phi}\ket{\tall}$ & \\
406 & \verb|\bra*{\phi}\ket*{\tall}| $\rightarrow \bra*{\phi}\ket*{\tall}$ & \\\hline
407 \verb|\innerproduct| & $\verb|\braket{a}{b}| \rightarrow \braket{a}{b}$ & two-argument braket \\
408 & \verb|\braket{a}| $\rightarrow \braket{a}$ & one-argument (norm) \\
409 & \verb|\braket{a}{\tall}| $\rightarrow \braket{a}{\tall}$ & automatic sizing \\
410 & \verb|\braket*{a}{\tall}| $\rightarrow \braket*{a}{\tall}$ & no resize \\
411 & \verb|\ip{a}{b}| $\rightarrow \ip{a}{b}$ & shorthand name \\\hline
412 \verb|\outerproduct| & \verb|\dyad{a}{b}| $\rightarrow \dyad{a}{b}$ & two-argument dyad \\
413 & \verb|\dyad{a}| $\rightarrow \dyad{a}$ & one-argument (projector) \\
414 & \verb|\dyad{a}{\tall}| $\rightarrow \dyad{a}{\tall}$ & automatic sizing \\
415 & \verb|\dyad*{a}{\tall}| $\rightarrow \dyad*{a}{\tall}$ & no resize \\
416 & \verb|\ketbra{a}{b}| $\rightarrow \ketbra{a}{b}$ & alternative name \\
417 & \verb|\op{a}{b}| $\rightarrow \op{a}{b}$ & shorthand name \\\hline
418 \verb|\expectationvalue| & \verb|\expval{A}| $\rightarrow \expval{A}$ & implicit form \\
419 & \verb|\expval{A}{\Psi}| $\rightarrow \expval{A}{\Psi}$ & explicit form \\
420 & \verb|\ev{A}{\Psi}| $\rightarrow \ev{A}{\Psi}$ & shorthand name \\
421 & \verb|\ev{\grande}{\Psi}| $\rightarrow \ev{\grande}{\Psi}$ & default sizing ignores middle argument \\
422 & \verb|\ev*{\grande}{\tall}| $\rightarrow \ev*{\grande}{\tall}$ & single star does no resizing whatsoever \\
423 & \verb|\ev**{\grande}{\Psi}| $\rightarrow \ev**{\grande}{\Psi}$ & double star resizes based on all parts \\\hline
424 \verb|\matrixelement| & \verb|\matrixel{n}{A}{m}| $\rightarrow \matrixel{n}{A}{m}$ & requires all three arguments \\
425 & \verb|\mel{n}{A}{m}| $\rightarrow \mel{n}{A}{m}$ & shorthand name \\
426 & \verb|\mel{n}{\grande}{m}| $\rightarrow \mel{n}{\grande}{m}$ & default sizing ignores middle argument \\
427 & \verb|\mel*{n}{\grande}{\tall}| $\rightarrow \mel*{n}{\grande}{\tall}$ & single star does no resizing whatsoever \\
428 & \verb|\mel**{n}{\grande}{m}| $\rightarrow \mel**{n}{\grande}{m}$ & double star resizes based on all parts \\\hline
429 \end{longtable}
430 \subsection{Matrix macros}
431 Note: \verb|\mqty| and \verb|\smqty| in \texttt{physics} uses \verb|\mathord|, while \verb|\PTmqty| and \verb|\PTsmqty| in \texttt{physics-patch} don't.
432
433 The following matrix macros produce unformatted rows and columns of matrix elements for use as separate matrices as well as blocks within larger matrices. For example, the command \verb|\identitymatrix{2}| which has also has the shortcut \verb|\imat{2}| produces the elements of a $2 \times 2$ identity matrix $\PTsmqty{\imat{2}}$ without braces or grouping. This allows the command to also be used within another matrix, as in:\\
434 \begin{minipage}{3cm}
435 \begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
436 \begin{pmatrix}
437 \imat{2} \\ a & b
438 \end{pmatrix}
439 \end{lstlisting}
440 \end{minipage}
441 \begin{minipage}{6cm}
442 \begin{displaymath}
443 \Rightarrow\qquad
444 \begin{pmatrix}
445 \imat{2} \\ a & b
446 \end{pmatrix}
447 \end{displaymath}
448 \end{minipage}
449 To specify elements on the right of left sides of our \verb|\imat{2}| sub-matrix we use the grouping command \verb|\PTmatrixquantity| or \verb|\PTmqty| to effectively convert \verb|\imat{2}| into a single matrix element of a larger matrix:\\
450 \begin{minipage}{9cm}
451 \begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
452 \begin{pmatrix}
453 \PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e
454 \end{pmatrix}
455 \end{lstlisting}
456 \end{minipage}
457 \begin{minipage}{6cm}
458 \begin{displaymath}
459 \Rightarrow\qquad
460 \begin{pmatrix}
461 \PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e
462 \end{pmatrix}
463 \end{displaymath}
464 \end{minipage}
465 The extra \verb|\PTmqty| groups were required in this case in order to get the $a$ and $b$ elements to behave as a single element, since \verb|\PTmqty{\imat{2}}| also acts like a single matrix element (the same can be said of the grouped $c$ and $d$ elements). Finally, the outermost \texttt{pmatrix} environment could have also been replaced with the \texttt{physics-patch} macro \verb|\PTmqty()|, allowing the above example to be written on one line:\\
466 \begin{minipage}{9cm}
467 \begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
468 \PTmqty(\PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e)
469 \end{lstlisting}
470 \end{minipage}
471 \begin{minipage}{6cm}
472 \begin{displaymath}
473 \Rightarrow\qquad
474 \PTmqty(\PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e)
475 \end{displaymath}
476 \end{minipage}
477 {\fontsize{8pt}{12pt}\selectfont
478 \begin{longtable}[c]{|p{0.2\textwidth}|p{0.35\textwidth}|p{0.35\textwidth}|}
479 \hline
480 \verb|\PTmatrixquantity| & \verb|\PTmqty{a & b \\ c & d}| $\rightarrow \PTmqty{a & b \\ c & d}$ & groups a set of matrix elements into a single object \\
481 & \verb|\PTmqty(a & b \\ c & d)| $\rightarrow {\PTmqty(a & b \\ c & d)}$ & parentheses \\
482 & \verb|\PTmqty*(a & b \\ c & d)| $\rightarrow {\PTmqty*(a & b \\ c & d)}$ & alternate parentheses \\
483 & \verb|\PTmqty[a & b \\ c & d]| $\rightarrow {\PTmqty[a & b \\ c & d]}$ & square brackets \\
484 & \verb|\PTmqty| \texttt{|} \verb|a & b \\ c & d| \texttt{|} $\rightarrow {\PTmqty|a & b \\ c & d|}$ & vertical bars \\
485 & \verb|\omqty{}| $\leftrightarrow$ \verb|\PTmqty{}| & \multirow{2}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
486 & \verb|\pmqty{}| $\leftrightarrow$ \verb|\PTmqty()| & \\
487 & \verb|\PTpmqty{}| $\leftrightarrow$ \verb|\PTmqty()| & \\
488 & \verb|\PTpmqty*{}| $\leftrightarrow$ \verb|\PTmqty*{}| & \\
489 & \verb|\Pmqty{}| $\leftrightarrow$ \verb|\PTmqty*()| & \\
490 & \verb|\bmqty{}| $\leftrightarrow$ \verb|\PTmqty[]| & \\
491 & \verb|\vmqty{}| $\leftrightarrow$ \verb+\PTmqty||+ & \\\hline
492 \verb|\PTsmallmatrixquantity| & \verb|\PTsmqty{a & b \\ c & d}| $\rightarrow \PTsmqty{a & b \\ c & d}$ & the \texttt{smallmatrix} form of \verb|\PTmqty| \\
493 & \verb|\PTsmqty()| \qor \verb|\spmqty{}| \qor \verb|\PTspmqty{}| & small version of \verb|\PTmqty()| \\
494 & \verb|\PTsmqty*()| \qor \verb|\sPmqty{}| \qor \verb|\PTspmqty*{}| & small version of \verb|\PTmqty*()|\\
495 & \verb|\PTsmqty[]| \qor \verb|\sbmqty{}| & small version of \verb|\PTmqty[]| \\
496 & \verb+\PTsmqty||+ \qor \verb|\svmqty{}| & small version of \verb+\PTmqty||+ \\\hline
497 \verb|\matrixdeterminant| & \verb|\mdet{a & b \\ c & d}| $\rightarrow {\mdet{a & b \\ c & d}}$ & matrix determinant \\
498 & \verb|\smdet{a & b \\ c & d}| $\rightarrow {\smdet{a & b \\ c & d}}$ & small matrix determinant \\\hline
499 \verb|\identitymatrix| & \verb|\imat{n}| & elements of $n \times n$ identity matrix \\
500 & \verb|\PTmqty(\imat{3})| $\rightarrow \PTmqty(\imat{3})$ & formatted with \verb|\PTmqty| or \verb|\PTsmqty| \\\hline
501 \verb|\PTxmatrix| & \verb|\PTxmat{x}{n}{m}| & \multirow{4}{*}{\parbox{6cm}{elements of $n \times m$ matrix filled with $x$, if not provided, $1$ is used}} \\
502 & \verb|\PTmqty(\PTxmat{x}{3}{3})| $\rightarrow \PTmqty(\PTxmat{x}{3}{3})$ & \\
503 & \verb|\PTmqty(\PTxmat{x}{}{3})| $\rightarrow \PTmqty(\PTxmat{x}{}{3})$ & \\
504 & \verb|\PTmqty(\PTxmat{x}{3}{})| $\rightarrow \PTmqty(\PTxmat{x}{3}{})$ & \\
505 & \verb|\PTxmat*{x}{n}{m}| & \multirow{4}{*}{\parbox{6cm}{star for element indices, skip row/column indices $n=1$/$m=1$}} \\
506 & \verb|\PTmqty(\PTxmat*{x}{3}{3})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3})$ & \\
507 & \verb|\PTmqty(\PTxmat*{x}{1}{3})| $\rightarrow \PTmqty(\PTxmat*{x}{1}{3})$ & \\
508 & \verb|\PTmqty(\PTxmat*{x}{3}{1})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{1})$ & \\
509 & \verb|\PTxmat{x}{n}{m}[p]| & \multirow{4}{*}{\parbox{6cm}{only show $p$ rows (including \texttt{\textbackslash vdots} row) with skipped rows indicated by \texttt{\textbackslash vdots}. If $n$ isn't provided, $p$ is used}} \\
510 & \verb|\PTmqty(\PTxmat{x}{5}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{3}[3])$ & \\
511 & \verb|\PTmqty(\PTxmat{x}{3}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{3}{3}[3])$ & \\
512 & \verb|\PTmqty(\PTxmat{x}{}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{}{3}[3])$ & \\
513 & \verb|\PTxmat{x}{n}{m}[p][q]| & \multirow{6}{*}{\parbox{6cm}{only show $p$ rows (including \texttt{\textbackslash vdots} row) and $q$ columns (including \texttt{\textbackslash ldots} column) with skipped rows indicated by \texttt{\textbackslash vdots}, skipped columns indicated by \texttt{\textbackslash ldots}, intersection of \texttt{\textbackslash vdots} row and \texttt{\textbackslash ldots} column being \texttt{\textbackslash ddots}. If $n$/$m$ isn't provided, $p$/$q$ is used. No indices will be added for ellipses even if star is given}} \\
514 & \verb|\PTmqty(\PTxmat{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{5}[3][3])$ & \\
515 & \verb|\PTmqty(\PTxmat{x}{5}{3}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{3}[3][3])$ & \\
516 & \verb|\PTmqty(\PTxmat{x}{3}{3}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{3}{3}[3][3])$ & \\
517 & \verb|\PTmqty(\PTxmat{x}{5}{}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{}[3][3])$ & \\
518 & \verb|\PTmqty(\PTxmat{x}{}{}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{}{}[3][3])$ & \\
519 & \verb|\PTxmat*{x}{n}{m}{g}| & \multirow{3}{*}{\parbox{6cm}{customize last row's element indices to $g$}} \\
520 & \verb|\PTmqty(\PTxmat*{x}{3}{3}{A})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3}{A})$ & \\
521 & \verb|\PTmqty(\PTxmat*{x}{5}{5}[3][3]{A})| $\rightarrow \PTmqty(\PTxmat*{x}{5}{5}[3][3]{A})$ & \\
522 & \verb|\PTxmat*{x}{n}{m}{g}{h}| & \multirow{3}{*}{\parbox{6cm}{customize last row's element indices to $g$ and last column's element indices to $h$}} \\
523 & \verb|\PTmqty(\PTxmat*{x}{3}{3}{A}{B})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3}{A}{B})$ & \\
524 & \verb|\PTmqty(\PTxmat*{x}{5}{5}[3][3]{A}{B})| $\rightarrow \PTmqty(\PTxmat*{x}{5}{5}[3][3]{A}{B})$ & \\
525 & \verb|\PTxmat[0 or 1 or 2]{x}{n}{m}[p][q]| & \multirow{4}{*}{\parbox{6cm}{Change the \texttt{\textbackslash vdots} row/\texttt{\textbackslash ldots} column from the second last one to last one, 0 for both, 1 for row only, 2 for column only. Only work when corresponding $p$/$q$ is provided and do not change the behavior of element indices}} \\
526 & \verb|\PTmqty(\PTxmat[0]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[0]{x}{5}{5}[3][3])$ & \\
527 & \verb|\PTmqty(\PTxmat[1]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[1]{x}{5}{5}[3][3])$ & \\
528 & \verb|\PTmqty(\PTxmat[2]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[2]{x}{5}{5}[3][3])$ & \\\hline
529 \verb|\zeromatrix| & \verb|\zmat{n}{m}| & \multirow{3}{*}{\parbox{6cm}{$n \times m$ matrix filled with zeros, equivalent to \texttt{\textbackslash xmat\{0\}\{n\}\{m\}}. If $m$ isn't provided, $n$ is used}} \\
530 & \verb|\PTmqty(\zmat{2}{2})| $\rightarrow \PTmqty(\zmat{2}{2})$ & \\
531 & \verb|\PTmqty(\zmat{2})| $\rightarrow \PTmqty(\zmat{2})$ & \\\hline
532 \verb|\paulimatrix| & \verb|\pmat{n}| & $n^\text{th}$ Pauli matrix \\
533 & \verb|\PTmqty(\pmat{0})| $\rightarrow \PTmqty(\pmat{0})$ & $n\in \lbrace 0,1,2,3$ or $x,y,z \rbrace$ \\
534 & \verb|\PTmqty(\pmat{1})| $\rightarrow \PTmqty(\pmat{1})$ & \\
535 & \verb|\PTmqty(\pmat{2})| $\rightarrow \PTmqty(\pmat{2})$ & \\
536 & \verb|\PTmqty(\pmat{3})| $\rightarrow \PTmqty(\pmat{3})$ & \\\hline
537 \verb|\diagonalmatrix| & \verb|\dmat{a,b,c,...}| & \multirow{2}{*}{\parbox{6cm}{specify up to eight diagonal or block diagonal elements}} \\
538 & \verb|\PTmqty(\dmat{1,2,3})| $\rightarrow \PTmqty(\dmat{1,2,3})$ & \\
539 & \verb|\PTmqty(\dmat[0]{1,2})| $\rightarrow \PTmqty(\dmat[0]{1,2})$ & optional argument to fill spaces \\
540 & \verb|\PTmqty(\dmat{1,2&3\\4&5})| $\rightarrow \PTmqty(\dmat{1,2&3\\4&5})$ & enter matrix elements for each block as a single diagonal element \\\hline
541 \verb|\antidiagonalmatrix| & \verb|\admat{a,b,c,...}| & same as syntax as \verb|\dmat| \\
542 & \verb|\PTmqty(\admat{1,2,3})| $\rightarrow \PTmqty(\admat{1,2,3})$ & \\\hline
543 \end{longtable}
544 }
545 \subsection{Symbols}
546 \begin{longtable}[c]{|p{0.4\textwidth}|p{0.4\textwidth}|}
547 \hline
548 \verb|\lparen| $\rightarrow\; ($ &\\\hline
549 \verb|\rparen| $\rightarrow\; )$ &\\\hline
550 \verb|\ordersymbol| $\rightarrow \ordersymbol$ & \\\hline
551 \verb|\typical| $\rightarrow \typical$ & \\\hline
552 \verb|\tall| $\rightarrow \tall$ & \\\hline
553 \verb|\grande| $\rightarrow \grande$ & \\\hline
554 \verb|\venti| $\rightarrow \venti$ & \\\hline
555 \verb|\parallelsum| $\rightarrow \parallelsum$ & \\\hline
556 \verb|\calE|$\rightarrow$\verb|\mathcal{E}| & \\\hline
557 \verb|\bbR|$\rightarrow$\verb|\mathbb{R}| & \\\hline
558 \verb|\bbC|$\rightarrow$\verb|\mathbb{C}| & \\\hline
559 \verb|\bbQ|$\rightarrow$\verb|\mathbb{Q}| & \\\hline
560 \verb|\bbN|$\rightarrow$\verb|\mathbb{N}| & \\\hline
561 \verb|\bbZ|$\rightarrow$\verb|\mathbb{Z}| & \\\hline
562 \verb|\bell|$\rightarrow$\verb|\boldsymbol{\ell}| & \\\hline
563 \verb|\Bell|$\rightarrow$\verb|\char"1F514| & the \verb|\bell| command in wasysym, which is a bell symbol \\\hline
564 \verb|\Vtextvisiblespace[width]| $\rightarrow$ \Vtextvisiblespace & a visible space character, where the optional argument, defaulting to \verb|.3em|, sets the width of the horizontal rule \\\hline
565 \verb|\kernnull| & negate the space next to null delimiters, implemented with \verb|\kern-\nulldelimiterspace| \\\hline
566 \verb|\ST| $\rightarrow \ST$ & such that with space before and after it \\\hline
567 \end{longtable}
568 \subsection{Arrows and lines}
569 For math mode only:
570 \begin{longtable}[c]{|p{0.5\textwidth}|p{0.3\textwidth}|}
571 \hline
572 \verb|\Leftrightarrow| or \verb|\Lra| & $\Leftrightarrow$ \\\hline
573 \verb|\leftrightarrow| or \verb|\lra| & $\leftrightarrow$ \\\hline
574 \verb|\Rightarrow| or \verb|\Ra| & $\Rightarrow$ \\\hline
575 \verb|\rightarrow| or \verb|\ra| & $\rightarrow$ \\\hline
576 \verb|\Leftarrow| or \verb|\La| & $\Leftarrow$ \\\hline
577 \verb|\leftarrow| or \verb|\la| & $\leftarrow$ \\\hline
578 \verb|\Uparrow| or \verb|\Upa| & $\Uparrow$ \\\hline
579 \verb|\uparrow| or \verb|\upa| & $\uparrow$ \\\hline
580 \verb|\Downarrow| or \verb|\Dna| & $\Downarrow$ \\\hline
581 \verb|\downarrow| or \verb|\dna| & $\downarrow$ \\\hline
582 \verb|\rightleftharpoons| or \verb|\rlh| & $\rightleftharpoons$ \\\hline
583 \verb|\leftrightharpoons| or \verb|\lrh| & $\leftrightharpoons$ \\\hline
584 \verb|\rightharpoonup| or \verb|\rhu| & $\rightharpoonup$ \\\hline
585 \verb|\leftharpoonup| or \verb|\lhu| & $\leftharpoonup$ \\\hline
586 \verb|\rightharpoondown| or \verb|\rhd| & $\rightharpoondown$ \\\hline
587 \verb|\leftharpoondown| or \verb|\lhd| & $\leftharpoondown$ \\\hline
588 \verb|\upharpoonright| or \verb|\uhr| & $\upharpoonright$ \\\hline
589 \verb|\upharpoonleft| or \verb|\uhl| & $\upharpoonleft$ \\\hline
590 \verb|\downharpoonright| or \verb|\dhr| & $\downharpoonright$ \\\hline
591 \verb|\downharpoonleft| or \verb|\dhl| & $\downharpoonleft$ \\\hline
592 \verb|\hookrightarrow| or \verb|\hkra| & $\hookrightarrow$ \\\hline
593 \verb|\hookleftarrow| or \verb|\hkla| & $\hookleftarrow$ \\\hline
594 \verb|\nLeftrightarrow| or \verb|\nLra| & $\nLeftrightarrow$ \\\hline
595 \verb|\nleftrightarrow| or \verb|\nlra| & $\nleftrightarrow$ \\\hline
596 \verb|\nRightarrow| or \verb|\nRa| & $\nRightarrow$ \\\hline
597 \verb|\nrightarrow| or \verb|\nra| & $\nrightarrow$ \\\hline
598 \verb|\nLeftarrow| or \verb|\nLa| & $\nLeftarrow$ \\\hline
599 \verb|\nleftarrow| or \verb|\nla| & $\nleftarrow$ \\\hline
600 \verb|\mapsto| or \verb|\mpto| & $\mapsto$ \\\hline
601 \verb|\mapsfrom| or \verb|\mpfr| & $\mapsfrom$ \\\hline
602 \verb|\stackrel{\mathrm{def}}{=}| or \verb|\defeq| & $\defeq$ \\\hline
603 \end{longtable}
604 Work in both math mode and text mode:
605 \begin{longtable}[c]{|p{0.5\textwidth}|p{0.3\textwidth}|}
606 \hline
607 \verb|\equiv| or \verb|\eqv| & $\equiv$ \\\hline
608 \verb|\geq| & $\geq$ \\\hline
609 \verb|\leq| & $\leq$ \\\hline
610 \verb|\gg| & $\gg$ \\\hline
611 \verb|\ll| & $\ll$ \\\hline
612 \verb|\approx| or \verb|\apx| & $\approx$ \\\hline
613 \verb|\gtrapprox| or \verb|\gapx| & $\gtrapprox$ \\\hline
614 \verb|\lessapprox| or \verb|\lapx| & $\lessapprox$ \\\hline
615 \verb|\sim| & $\sim$ \\\hline
616 \end{longtable}
617 \subsection{Shorthands for Greek alphabet}
618 If the corresponding options are used, the following shorthands will be defined for every uppercase and lowercase Greek letter. Note that these don’t ensure those commands are defined. Take Alpha for example.
619 \begin{longtable}[c]{|p{0.3\textwidth}|p{0.2\textwidth}|p{0.3\textwidth}|}
620 \hline
621 Command & Option & Note \\\hline
622 \verb|\tgAlpha| $\rightarrow$ \verb|\text{\textAlpha}| & shorttextgreek & accept an optional argument argument in \texttt{\{\}} that is simply skipped \\\hline
623 \verb|\vAlpha| $\rightarrow$ \verb|\varAlpha| & shortvargreek & \\\hline
624 \verb|\uAlpha| $\rightarrow$ \verb|\upAlpha| & shortupgreek & \\\hline
625 \verb|\uvAlpha| $\rightarrow$ \verb|\upvarAlpha| & shortupvargreek & \\\hline
626 \verb|\bAlpha| $\rightarrow$ \verb|\boldsymbol{\Alpha}| & shortboldgreek & \\\hline
627 \end{longtable}
628 \subsection{Shorthands for mathrm alphabet and chemical element symbols}
629 If option \texttt{shortmathrm} is used, the following shorthand will be defined for every uppercase and lowercase English letter and every chemical element symbol, which work in both math mode and text mode and allow superscript and/or subscript. Take A for example.
630 \begin{longtable}[c]{|p{0.4\textwidth}|p{0.4\textwidth}|}
631 \hline
632 \verb|\rmA_a^b| $\rightarrow\mathrm{A}_a^b$ & \verb|\rmA^a_b| $\rightarrow\mathrm{A}^a_b$ \\\hline
633 \end{longtable}
634 \subsection{Shorthands for textnormal alphabet}
635 If option \texttt{shorttext} is used, the following shorthands will be defined for every uppercase and lowercase English letter. Take A for example.
636 \begin{longtable}[c]{|c|}
637 \hline
638 \verb|\txA| $\rightarrow$ \verb|\textnormal{A}|
639 \\\hline
640 \end{longtable}
641 \end{document}