\documentclass[a4paper,12pt]{article}
\usepackage[margin=1.27cm,foot=0.77cm]{geometry}
\usepackage{amsmath,amssymb,array,etoolbox,fontspec,longtable,listings,multirow,needspace,parskip,setspace,verbatim,titling,xcolor,xparse,xstring}
\usepackage[shorttextgreek,shortvargreek,shortupgreek,shortupvargreek,shortboldgreek,shortmathrm,shorttext]{physics-patch}
\usepackage[colorlinks,urlcolor=blue]{hyperref}
\setmainfont{TeX Gyre Termes}[Ligatures=TeX]
\setsansfont{TeX Gyre Heros}[Ligatures=TeX]
\setmonofont{TeX Gyre Cursor}[Ligatures=TeX]
\usepackage{unicode-math}
\setmathfont{XITS Math}\setmathfont[range={cal,bfcal},StylisticSet=1]{XITS Math}
\everymath{\displaystyle}
\everydisplay{\displaystyle}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
\newcolumntype{m}{>{$\displaystyle}c<{$}}
\newcolumntype{M}[1]{>{$\displaystyle}p{#1}<{$}}
\setlength{\LTleft}{\fill}
\setlength{\LTright}{\fill}
\renewcommand{\maketitle}{
\begin{titlepage}
\begin{center}
\vspace*{\fill}
{\huge \bfseries \thetitle\par}
\vskip 1.5em
{\Large \theauthor\par}
\vskip 1em
{\large \thedate\par}
\vspace*{\fill}
\end{center}
\end{titlepage}
}
\lstset{
basicstyle=\ttfamily\scriptsize,
keywordstyle=\color{blue},
stringstyle=\color{red},
commentstyle=\color{green!50!black},
numbers=none,
backgroundcolor=\color{white},
showspaces=false,
showstringspaces=false,
showtabs=false,
frame=none,
tabsize=4,
captionpos=b,
breaklines=true,
breakatwhitespace=false
}
\title{The \texttt{physics-patch} package\\\mbox{}\\\textnormal{\large Improved version of the physics package}}
\author{\mbox{}\\Willie Shen (Willie169)}
\date{Version 3.1\\\textnormal{Last update: July 29, 2025}}
\begin{document}
\onehalfspacing\thispagestyle{empty}\Needspace{1\textheight}\maketitle\setcounter{page}{1}\Needspace{1\textheight}\tableofcontents\Needspace{1\textheight}\setcounter{page}{1}
\section{Preface}
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|.
\section{Usage}
\subsection{Required packages}
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.
\subsection{Using \texttt{physics-patch} in your \LaTeX~document}
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}|:
\begin{lstlisting}
\documentclass{class}
...
\usepackage{physics-patch}
...
\begin{document}
content...
\end{document}
\end{lstlisting}

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.

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).

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.
\subsection{Options}
Options available in this package include 
\begin{itemize}
\item \verb|nooverride|: Not override macros in physics to patched ones. Fall back to override if physics is not loaded. (not recommended)
\item \verb|override|: Override macros in physics to patched ones. This option can be set no matter whether physics is loaded. (default)
\item \verb|nopretend|: Not pretend that physics package is loaded. (not recommend).
\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)
\item \verb|nosiintegrate|: Not override \verb|\PTquantity| and \verb|\PTqty| with \verb|\ITqty|. (default)
\item \verb|siintegrate|: Override \verb|\PTquantity| and \verb|\PTqty| with \verb|\ITqty|. Fall back to nosiintegrate if siunitx is not loaded. (not recommended)
\item \verb|nooriginaldiv|: Let \verb|\div| be \verb|\divergence|. (not recommended)
\item \verb|originaldiv|: Let \verb|\div| be division symbol. (default)
\item \verb|notrig|: Not define functions and operators with automatic bracing.
\item \verb|trig|: Define functions and operators with automatic bracing. (default)
\item \verb|italicdiff|: Italic differentials.
\item \verb|uprightdiff|: Upright differentials. (default)
\item \verb|arrowdel|: Vector arrow \verb|\nabla| symbol.
\item \verb|bolddel|: Vector bold \verb|\nabla| symbol. (default)
\item \verb|bolddot|: Vector bold dot product symbol.
\item \verb|plaindot|: Vector plain dot product symbol. (default)
\item \verb|forcedefault|: Forces the above options to their default ones.
\item \verb|noshorttextgreek|: Not define shorthands for text Greek alphabet. (default)
\item \verb|shorttextgreek|: Define shorthands for text Greek alphabet.
\item \verb|noshortvargreek|: Not define shorthands for variant Greek alphabet. (default)
\item \verb|shortvargreek|: Define shorthands for variant Greek alphabet.
\item \verb|noshortupgreek|: Not define shorthands for upright Greek alphabet. (default)
\item \verb|shortupgreek|: Define shorthands for upright Greek alphabet.
\item \verb|noshortupvargreek|: Not define shorthands for upright variant Greek alphabet. (default)
\item \verb|shortupvargreek|: Define shorthands for upright variant Greek alphabet.
\item \verb|noshortboldgreek|: Not define shorthands for bold Greek alphabet. (default)
\item \verb|shortboldgreek|: Define shorthands for bold Greek alphabet.
\item \verb|noshortgreek|: Not define all shorthands for Greek alphabet. (default)
\item \verb|shortgreek|: Define all shorthands for Greek alphabet.
\item \verb|noshortmathrm|: Not define shorthands for mathrm alphabet and chemical element symbols. (default)
\item \verb|shortmathrm|: Define shorthands for mathrm alphabet and chemical element symbols.
\item \verb|noshorttext|: Not define shorthands for textnormal alphabet. (default)
\item \verb|shorttext|: Define shorthands for textnormal alphabet.
\end{itemize}

To use all features of this package, load it with 
\begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
\usepackage[shortgreek,shortmathrm,shorttext]{physics-patch}
\end{lstlisting}
\section{Communication Channels}
\begin{itemize}
\item \textbf{Bug tracker:} \href{https://github.com/Willie169/physics-patch/issues}{https://github.com/Willie169/physics-patch/issues}.
\item \textbf{Announcements:} \href{https://github.com/Willie169/physics-patch/releases}{https://github.com/Willie169/physics-patch/releases}.
\item \textbf{Repository:} \href{https://github.com/Willie169/physics-patch}{https://github.com/Willie169/physics-patch}.
\end{itemize}
\section{License and Credit}
\begin{itemize}
\item
This package is released under the \textbf{LaTeX Project Public License (LPPL) 1.3c.}

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.
\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}.

See \href{https://ctan.org/pkg/physics}{https://ctan.org/pkg/physics} for the details of that package.
\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}.

See \href{https://ctan.org/pkg/amsmath}{https://ctan.org/pkg/amsmath} for the details of that package.
\end{itemize}
\section{List of Commands}
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.

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.
\subsection{Automatic bracing}
\begin{longtable}[c]{|L{0.2\textwidth}|L{0.35\textwidth}|L{0.35\textwidth}|}
\hline
\verb|\PTquantity|, \verb|\PHquantity| or \verb|\PHqty| & \verb|\PTqty(\typical)| $\displaystyle\rightarrow \PTqty(\typical)$ & automatic $\PTqty(\;)$ braces \\
& \verb|\PTqty(\tall)| $\displaystyle\rightarrow \PTqty(\tall)$ & \\
& \verb|\PTqty(\grande)| $\displaystyle\rightarrow \PTqty(\grande)$ & \\
& \verb|\PTqty[\typical]| $\rightarrow \PTqty[\typical]$ & automatic $\PTqty[\;]$ braces \\
& \verb+\PTqty|\typical|+ $\rightarrow \PTqty|\typical|$ & automatic $\PTqty|\;|$ braces \\
& \verb|\PTqty{\typical}| $\rightarrow \PTqty{\typical}$ & automatic $\PTqty{\;}$ braces \\
& \verb|\PTqty\big{}| $\rightarrow \PTqty\big{}$ & \multirow{4}{*}{\parbox{6cm}{manual sizing (works with any of the above bracket types)}} \\
& \verb|\PTqty\Big{}| $\rightarrow \PTqty\Big{}$ & \\
& \verb|\PTqty\bigg{}| $\rightarrow \PTqty\bigg{}$ & \\
& \verb|\PTqty\Bigg{}| $\rightarrow \PTqty\Bigg{}$ & \\
& \verb|\pqty{}| $\leftrightarrow$ \verb|\PTqty()| & \multirow{4}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
& \verb|\bqty{}| $\leftrightarrow$ \verb|\PTqty[]| & \\
& \verb+\vqty{}+ $\leftrightarrow$ \verb+\PTqty||+ & \\
& \verb|\Bqty{}| $\leftrightarrow$ \verb|\PTqty{}| & \\\hline
\verb|\absolutevalue| & \verb|\abs{a}| $\rightarrow \abs{a}$ & automatic sizing; equivalent to \verb+\PTqty|a|+ \\
& \verb|\abs\Big{a}| $\rightarrow \abs\Big{a}$ & inherits manual sizing syntax from \verb|\PTqty| \\
& \verb|\abs*{\grande}| $\displaystyle\rightarrow \abs*{\grande}$ & star for no resize \\\hline
\verb|\norm| & \verb|\norm{a}| $\rightarrow \norm{a}$ & automatic sizing \\
& \verb|\norm\Big{a}| $\rightarrow \norm\Big{a}$ & manual sizing \\
& \verb|\norm*{\grande}| $\displaystyle\rightarrow \norm*{\grande}$ & star for no resize \\\hline
\verb|\evaluated| & \verb|\eval{x}_0^\infty| $\displaystyle\rightarrow \eval{x}_0^\infty$ & vertical bar for evaluation limits \\
& \verb+\eval(x|_0^\infty+ $\displaystyle\rightarrow \eval(x|_0^\infty$ & alternate form \\
& \verb+\eval[x|_0^\infty+ $\displaystyle\rightarrow \eval[x|_0^\infty$ & alternate form \\
& \verb+\eval[\venti|_0^\infty+ $\displaystyle\rightarrow \eval[\venti|_0^\infty$ & automatic sizing\\
& \verb+\eval*[\venti|_0^\infty+ $\displaystyle\rightarrow \eval*[\venti|_0^\infty$ & star for no resize \\\hline
\verb|\order| & \verb|\order{x^2}| $\rightarrow \order{x^2}$ & order symbol; automatic sizing and space handling \\
& \verb|\order\Big{x^2}| $\rightarrow \order\Big{x^2}$ & manual sizing \\
& \verb|\order*{\grande}| $\displaystyle\rightarrow \order*{\grande}$ & star for no resize \\\hline
\verb|\commutator| & \verb|\comm{A}{B}| $\rightarrow \comm{A}{B}$ & automatic sizing \\
& \verb|\comm\Big{A}{B}| $\rightarrow \comm\Big{A}{B}$ & manual sizing \\
& \verb|\comm*{A}{\grande}| $\displaystyle\rightarrow \comm*{A}{\grande}$ & star for no resize \\\hline
\verb|\anticommutator| or \verb|\acommutator| & \verb|\acomm{A}{B}| $\rightarrow \acomm{A}{B}$ & same as \verb|\poissonbracket| \\\hline
\verb|\poissonbracket| & \verb|\pb{A}{B}| $\rightarrow \pb{A}{B}$ & same as \verb|\anticommutator|\\\hline
\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|) \\
& \verb|\{x\mid x>0\}| $\rightarrow \{x\mid x>0\}$ & Falls back to original \\\hline
\end{longtable}
\subsection{Vector notation}
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:
\begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
\usepackage[arrowdel]{physics-patch}
\end{lstlisting}
\begin{longtable}[c]{|L{0.2\textwidth}|L{0.4\textwidth}|L{0.3\textwidth}|}
\hline
\verb|\vectorbold| & \verb|\vb{a}| $\rightarrow \vb{a}$ & upright/no Greek \\
& \verb|\vb*{a}|, \verb|\vb*{\theta}| $\rightarrow \vb*{a}$, $\vb*{\theta}$ & italic/Greek \\\hline
\verb|\vectorarrow| & \verb|\va{a}| $\rightarrow \va{a}$ & upright/no Greek \\
& \verb|\va*{a}|, \verb|\va*{\theta}| $\rightarrow \va*{a}$, $\va*{\theta}$ & italic/Greek \\\hline
\verb|\vectorunit| & \verb|\vu{a}| $\rightarrow \vu{a}$ & upright/no Greek \\
& \verb|\vu*{a}|, \verb|\vu*{\theta}| $\rightarrow \vu*{a}$, $\vu*{\theta}$ & italic/Greek \\\hline
\verb|\dotproduct| & \verb|\vdot| $\rightarrow \vdot$ as in $\vb{a} \vdot \vb{b}$ & note: \verb|\dp| is a protected \TeX\ primitive \\\hline
\verb|\crossproduct| & \verb|\cross| $\rightarrow \cross$ as in $\vb{a} \cross \vb{b}$ & alternate name \\
& \verb|\cp| $\rightarrow \cp$ as in $\vb{a} \cp \vb{b}$ & shorthand name \\\hline
\verb|\gradient| & \verb|\grad| $\rightarrow \grad$ & \\
& \verb|\grad{\Psi}| $\rightarrow \grad{\Psi}$ & default mode \\
& \verb|\grad(\Psi+\tall)| $\displaystyle\rightarrow \grad(\Psi+\tall)$ & long-form (like \verb|\PTqty| but also handles spacing) \\
& \verb|\grad[\Psi+\tall]| $\displaystyle\rightarrow \grad[\Psi+\tall]$ & \\\hline
\verb|\divisionsymbol| & \verb|\divisionsymbol| $\rightarrow \divisionsymbol$ &  \\\hline
\verb|\divergence| & \verb|\divg| $\rightarrow \divg$ & note: if \texttt{nooriginaldiv} option is used, \verb|\div| will be overriden as $\divg$ too (not recommended) \\
& \verb|\divg{\vb{a}}| $\rightarrow \divg{\vb{a}}$ & default mode \\
& \verb|\divg(\vb{a}+\tall)| $\displaystyle\rightarrow \divg(\vb{a}+\tall)$ & long-form \\
& \verb|\divg[\vb{a}+\tall]| $\displaystyle\rightarrow \divg[\vb{a}+\tall]$ & \\\hline
\verb|\curl| & \verb|\curl| $\rightarrow \curl$ & \\
& \verb|\curl{\vb{a}}| $\rightarrow \curl{\vb{a}}$ & default mode \\
& \verb|\curl(\vb{a}+\tall)| $\displaystyle\rightarrow \curl(\vb{a}+\tall)$ & long-form \\
& \verb|\curl[\vb{a}+\tall]| $\displaystyle\rightarrow \curl[\vb{a}+\tall]$ & \\\hline
\verb|\laplacian| & \verb|\laplacian| $\rightarrow \laplacian$ & \\
& \verb|\laplacian{\Psi}| $\rightarrow \laplacian{\Psi}$ & default mode \\
& \verb|\laplacian(\Psi+\tall)| $\displaystyle\rightarrow \laplacian(\Psi+\tall)$ & long-form \\
& \verb|\laplacian[\Psi+\tall]| $\displaystyle\rightarrow \laplacian[\Psi+\tall]$ &\\\hline
\end{longtable}
\subsection{Operators}
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:
\begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
\usepackage[notrig]{physics-patch}
\end{lstlisting}
Example redefinitions:
\begin{longtable}[c]{|l|l|l|}
\hline
\verb|\sin| & \verb|\sin(\grande)| $\displaystyle\rightarrow \sin(\grande)$ & automatic braces; old \verb|\sin| renamed \verb|\sine| \\
& \verb|\sin[2](x)| $\rightarrow \sin[2](x)$ & optional power \\
& \verb|\sin x| $\rightarrow \sin x$ & can still use without an argument \\\hline
\end{longtable}
The full set of available such functions in \texttt{physics-patch} includes:
\begin{longtable}[c]{llll}
\verb|\sin(x)| & \verb|\sinh(x)| & \verb|\arcsin(x)| & \verb|\asin(x)| \\
\verb|\cos(x)| & \verb|\cosh(x)| & \verb|\arccos(x)| & \verb|\acos(x)| \\
\verb|\tan(x)| & \verb|\tanh(x)| & \verb|\arctan(x)| & \verb|\atan(x)| \\
\verb|\csc(x)| & \verb|\csch(x)| & \verb|\arccsc(x)| & \verb|\acsc(x)| \\
\verb|\sec(x)| & \verb|\sech(x)| & \verb|\arcsec(x)| & \verb|\asec(x)| \\
\verb|\cot(x)| & \verb|\coth(x)| & \verb|\arccot(x)| & \verb|\acot(x)| \\
\verb|\exp(x)| & \verb|\log(x)| & \verb|\ln(x)| & \verb|\det(x)| \\
\verb|\Pr(x)| & \verb|\Arg(x)| & \verb|\arg(x)| & \verb|\Re(x)| \\
\verb|\Im(x)| \\
\end{longtable}
$\Rightarrow$
\begin{longtable}[c]{mmmm}
\sin(x) & \sinh(x) & \arcsin(x) & \asin(x) \\
\cos(x) & \cosh(x) & \arccos(x) & \acos(x) \\
\tan(x) & \tanh(x) & \arctan(x) & \atan(x) \\
\csc(x) & \csch(x) & \arccsc(x) & \acsc(x) \\
\sec(x) & \sech(x) & \arcsec(x) & \asec(x) \\
\cot(x) & \coth(x) & \arccot(x) & \acot(x)\\
\exp(x) & \log(x) & \ln(x) & \det(x) \\
\Pr(x) & \Arg(x) & \arg(x) & \Re(x) \\
\Im(x) \\
\end{longtable}
The same set of functions but without any automatic bracing are available under a new set of longer names:
\begin{longtable}[c]{llll}
\verb|\sine| & \verb|\hypsine| & \verb|\arcsine| & \verb|\asine| \\
\verb|\cosine| & \verb|\hypcosine| & \verb|\arccosine| & \verb|\acosine| \\
\verb|\tangent| & \verb|\hyptangent| & \verb|\arctangent| & \verb|\atangent| \\
\verb|\cosecant| & \verb|\hypcosecant| & \verb|\arccosecant| & \verb|\acosecant| \\
\verb|\secant| & \verb|\hypsecant| & \verb|\arcsecant| & \verb|\asecant| \\
\verb|\cotangent| & \verb|\hypcotangent| & \verb|\arccotangent| & \verb|\acotangent|\\
\verb|\exponential| & \verb|\logarithm| & \verb|\naturallogarithm| & \verb|\determinant| \\
\verb|\Probability| & \verb|\Argument| & \verb|\argument| & \verb|\real| \\
\verb|\imaginary| \\
\end{longtable}
New operators:
\begin{longtable}[c]{|L{0.2\textwidth}|L{0.35\textwidth}|L{0.35\textwidth}|}
\hline
\verb|\tr| & \verb|\tr\rho| $\rightarrow \tr\rho$ also \verb|\tr(\tall)| $\rightarrow \tr(\tall)$  & trace; same bracing as trig functions \\\hline
\verb|\Tr| & \verb|\Tr\rho| $\rightarrow \Tr\rho$ & alternate \\\hline
\verb|\rank| & \verb|\rank M| $\rightarrow \rank M$ & matrix rank \\\hline
\verb|\erf| & \verb|\erf(x)|$\rightarrow \erf(x)$ & error function \\\hline
\verb|\Res| & \verb|\Res[f(z)]|$\rightarrow \Res[f(z)]$ & residue; same bracing as trig functions \\\hline
\verb|\acosh| & \verb|\acosh(\pi)| $\rightarrow\acosh(\pi)$ & acosh \\\hline
\verb|\acsch| & \verb|\acsch(\pi)| $\rightarrow\acsch(\pi)$ & acsch \\\hline
\verb|\arccosh| & \verb|\arccosh(\pi)| $\rightarrow\arccosh(\pi)$ & arccosh \\\hline
\verb|\arccsch| & \verb|\arccsch(\pi)| $\rightarrow\arccsch(\pi)$ & arccsch \\\hline
\verb|\arcsech| & \verb|\arcsech(\pi)| $\rightarrow\arcsech(\pi)$ & arcsech \\\hline
\verb|\arcsinh| & \verb|\arcsinh(\pi)| $\rightarrow\arcsinh(\pi)$ & arcsinh \\\hline
\verb|\arctanh| & \verb|\arctanh(\pi)| $\rightarrow\arctanh(\pi)$ & arctanh \\\hline
\verb|\arctantwo| & \verb|\arctantwo(\pi)| $\rightarrow\arctantwo(\pi)$ & arctan2 \\\hline
\verb|\asech| & \verb|\asech(\pi)| $\rightarrow\asech(\pi)$ & asech \\\hline
\verb|\asinh| & \verb|\asinh(\pi)| $\rightarrow\asinh(\pi)$ & asinh \\\hline
\verb|\atanh| & \verb|\atanh(\pi)| $\rightarrow\atanh(\pi)$ & atanh \\\hline
\verb|\atantwo| & \verb|\atantwo(\pi)| $\rightarrow\atantwo(\pi)$ & atan2 \\\hline
\verb|\closure| & \verb|\closure(A)| $\rightarrow\closure(A)$ & closure \\\hline
\verb|\col| & \verb|\col(\mathbf{A})| $\rightarrow\col(\mathbf{A})$ & column space \\\hline
\verb|\Col| & \verb|\Col(\mathbf{A})| $\rightarrow\Col(\mathbf{A})$ & column space \\\hline
\verb|\dim| & \verb|\dim(V)| $\rightarrow\dim(V)$ & dimension \\\hline
\verb|\Dim| & \verb|\Dim(V)| $\rightarrow\dim(V)$ & dimension \\\hline
\verb|\distance| & \verb|\distance(A,B)| $\rightarrow\distance(A,B)$ & lowercase distance \\\hline
\verb|\Distance| & \verb|\Distance(A,B)| $\rightarrow\Distance(A,B)$ & uppercase distance \\\hline
\verb|\row| & \verb|\row(\mathbf{A})| $\rightarrow\row(\mathbf{A})$ & row space \\\hline
\verb|\Row| & \verb|\Row(\mathbf{A})| $\rightarrow\Row(\mathbf{A})$ & row space \\\hline
\verb|\ker| & \verb|\ker(\mathbf{A})| $\rightarrow\ker(\mathbf{A})$ & kernel \\\hline
\verb|\coker| & \verb|\coker(\mathbf{A})| $\rightarrow\coker(\mathbf{A})$ & cokernel \\\hline
\verb|\rank| & \verb|\rank(\mathbf{A})| $\rightarrow\rank(\mathbf{A})$ & rank \\\hline
\verb|\Rank| & \verb|\Rank(\mathbf{A})| $\rightarrow\Rank(\mathbf{A})$ & rank \\\hline
\verb|\im| & \verb|\im(\mathbf{A})| $\rightarrow\im(\mathbf{A})$ & image space \\\hline
\verb|\SD| & \verb|\SD(X)| $\rightarrow\SD(X)$ & standard deviation \\\hline
\verb|\Var| & \verb|\Var(X)| $\rightarrow\Var(X)$ & variation \\\hline
\verb|\Mode| & \verb|\Mode(X)| $\rightarrow\Mode(X)$ & mode \\\hline
\verb|\Median| & \verb|\Median(X)| $\rightarrow\Median(X)$ & median \\\hline
\verb|\gcd| & \verb|\gcd(X)| $\rightarrow\gcd(X)$ & lowercase greatest common divisor \\\hline
\verb|\lcm| & \verb|\lcm(X)| $\rightarrow\lcm(X)$ & lowercase lowest common multiple \\\hline
\verb|\GCD| & \verb|\GCD(X)| $\rightarrow\GCD(X)$ & uppercase greatest common divisor \\\hline
\verb|\LCM| & \verb|\LCM(X)| $\rightarrow\LCM(X)$ & uppercase lowest common multiple \\\hline
\verb|\UnitVector| & \verb|\UnitVector(\mathbf{r})| $\rightarrow\UnitVector(\mathbf{r})$ & unit vector \\\hline
\verb|\principalvalue| & \verb|\pv{\int f(z) \dd{z}}|$\rightarrow \pv{\int f(z) \dd{z}}$ & Cauchy principal value \\
& \verb|\PV{\int f(z) \dd{z}}|$\rightarrow \PV{\int f(z) \dd{z}}$ & alternate \\\hline
\end{longtable}
\subsection{Utilities}
\begin{longtable}[c]{|L{0.25\textwidth}|L{0.4\textwidth}|L{0.25\textwidth}|}
\hline
\verb|\mathcolorbox| & \verb|\mcbox{color}{content}| & \verb|\colorbox| for math environment, applying to all four levels of math styles \\
& \verb|\mcbox{cyan}{\typical}| $\rightarrow \mcbox{cyan}{\typical}$ & \\\hline
\verb|\autocolorbox| or \verb|\acbox| & \verb|\cbox{color}{content}| & calls \verb|\colorbox| when in text mode, calls \verb|\mathcolorbox| when in math mode \\\hline
\verb|\tentothepowerof| & \verb|\tenpow{n}| $\rightarrow \tenpow{n}$ & work in both math mode and text mode \\\hline
\verb|\scientificnotation| & \verb|\scinote{3.00}{8}| $\rightarrow \scinote{3.00}{8}$ & work in both math mode and text mode\\\hline
\verb|\numbercircled| & \verb|\numcir{1}| $\rightarrow$ \numcir{1} & patched \verb|\textcircled| for numbers \\\hline
\verb|\boldsymbol| & \verb|\bsb{\tau}| $\rightarrow\bsb{\tau}$ & shorthand for \verb|\boldsymbol| \\\hline
\verb|\RNum| & \verb|\RNum{1}| $\rightarrow$ \RNum{1} & uppercase roman numeral\\\hline
\verb|\flatfrac| & \verb|\flatfrac{a}{b}| $\rightarrow\flatfrac{a}{b}$ & flat fraction\\\hline
\end{longtable}
\subsection{Quick quad text}
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:
\begin{longtable}[c]{|l|l|l|}
\hline
\verb|\qqtext| & \verb|\qq{}| & general quick quad text with argument \\
& \verb|\qq{word or phrase}| $\rightarrow$\Vtextvisiblespace[1em]$\text{word or phrase}$\Vtextvisiblespace[1em] & normal mode; left and right \verb|\quad| \\
& \verb|\qq*{word or phrase}| $\rightarrow \text{word or phrase}$\Vtextvisiblespace[1em] & starred mode; right \verb|\quad| only\\\hline
\end{longtable}
Special macros:
\begin{longtable}[c]{|l|l|}
\hline
\verb|\qcomma| or \verb|\qc| $\rightarrow ,$\Vtextvisiblespace[1em] & right \verb|\quad| only \\\hline
\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
\verb|\qif| $\rightarrow$\Vtextvisiblespace[1em]$\text{if}$\Vtextvisiblespace[1em] & left and right \verb|\quad| unless starred \verb|\qif*| $\rightarrow \text{if}$\Vtextvisiblespace[1em]\\\hline
\end{longtable}
Similar to \verb|\qif|:
\begin{longtable}[c]{|c|c|c|c|c|c|}
\hline
\verb|\qthen| & \verb|\qelse| & \verb|\qotherwise| & \verb|\qunless| & \verb|\qgiven| & \verb|\qusing| \\\hline
\verb|\qassume| & \verb|\qsince| & \verb|\qlet| & \verb|\qfor| & \verb|\qall| & \verb|\qeven| \\\hline
\verb|\qodd| & \verb|\qinteger| & \verb|\qand| & \verb|\qor| & \verb|\qas| & \verb|\qin| \\\hline
\end{longtable}
\subsection{Derivatives}
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:
\begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
\usepackage[italicdiff]{physics-patch}
\end{lstlisting}
\begin{longtable}[c]{|L{0.3\textwidth}|L{0.3\textwidth}|L{0.3\textwidth}|}
\hline
\verb|\dfd| & \verb|\dfd| $\rightarrow \mathrm{d}$ & differential symbol \\\hline
\verb|\dfD| & \verb|\dfD| $\rightarrow \mathrm{D}$ & uppercase differential symbol \\\hline
\verb|\differential| & \verb|\dd| $\rightarrow \dd$ & \\
& \verb|\dd x| $\rightarrow \dd x$ & no spacing (not recommended) \\
& \verb|\dd{x}| $\rightarrow$ \textvisiblespace\,$\dd{x}$\textvisiblespace & automatic spacing based on neighbors \\
& \verb|\dd[3]{x}| $\rightarrow \dd[3]{x}$ & optional power \\
& \verb|\dd(\cos\theta)| $\rightarrow \dd(\cos\theta)$ & long-form; automatic braces \\\hline
\verb|\Differential| & \verb|\Dd| $\rightarrow \dd$ & \\
& \verb|\Dd x| $\rightarrow \Dd x$ & no spacing (not recommended) \\
& \verb|\Dd{x}| $\rightarrow$ \textvisiblespace\,$\Dd{x}$\textvisiblespace & automatic spacing based on neighbors \\
& \verb|\Dd[3]{x}| $\rightarrow \Dd[3]{x}$ & optional power \\
& \verb|\Dd(\cos\theta)| $\rightarrow \Dd(\cos\theta)$ & long-form; automatic braces \\\hline
\verb|\Derivative| & \verb|\Dv{x}| $\displaystyle\rightarrow \Dv{x}$ & one argument \\
& \verb|\Dv{f}{x}| $\displaystyle\rightarrow \Dv{f}{x}$ & two arguments \\
& \verb|\Dv[n]{f}{x}| $\displaystyle\rightarrow \Dv[n]{f}{x}$ & optional power \\
& \verb|\Dv{x}(\grande)| $\displaystyle\rightarrow \Dv{x}(\grande)$ & long-form; automatic braces, spacing \\
& \verb|\Dv*{f}{x}| $\displaystyle\rightarrow \Dv*{f}{x}$ & inline form using \verb|\flatfrac| \\\hline
\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}$\\
& \verb|\PTpdv{x}| $\displaystyle\rightarrow \PTpdv{x}$ & shorthand name \\
& \verb|\PTpdv{f}{x}| $\displaystyle\rightarrow \PTpdv{f}{x}$ & two arguments \\
& \verb|\PTpdv[n]{f}{x}| $\displaystyle\rightarrow \PTpdv[n]{f}{x}$ & optional power \\
& \verb|\PTpdv{x}(\grande)| $\displaystyle\rightarrow \PTpdv{x}(\grande)$ & long-form \\
& \verb|\PTpdv{f}{x}{y}| $\displaystyle\rightarrow \PTpdv{f}{x}{y}$ & mixed partial \\
& \verb|\PTpdv*{f}{x}| $\displaystyle\rightarrow \PTpdv*{f}{x}$ & inline form using \verb|\flatfrac| \\
& \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
\verb|\variation| & \verb|\var{F[g(x)]}| $\rightarrow \var{F[g(x)]}$ & functional variation (works like \verb|\dd|) \\
& \verb|\var(E-TS)| $\rightarrow \var(E-TS)$ & long-form \\\hline
\verb|\functionalderivative| & \verb|\fdv{g}| $\displaystyle\rightarrow \fdv{g}$ & functional derivative (works like \verb|\PTdv|) \\
& \verb|\fdv{F}{g}| $\displaystyle\rightarrow \fdv{F}{g}$ & \\
& \verb|\fdv{V}(E-TS)| $\displaystyle\rightarrow \fdv{V}(E-TS)$ & long-form \\
& \verb|\fdv*{F}{x}| $\displaystyle\rightarrow \fdv*{F}{x}$ & inline form using \verb|\flatfrac| \\\hline
\end{longtable}
\subsection{Dirac bra-ket notation}
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.}
\begin{displaymath}
\verb|\bra{\phi}\ket{\psi}| \rightarrow \bra{\phi}\ket{\psi} \qq{as opposed to} \bra{\phi} \ket{\psi}
\end{displaymath}
whereas a similar construction with higher-level macros will not contract in a robust manner
\begin{displaymath}
\verb|\bra{\phi}\dyad{\psi}{\xi}| \rightarrow \bra{\phi}\dyad{\psi}{\xi}.
\end{displaymath}
On the other hand, the correct output can be generated by sticking to the fundamental commands,
\begin{displaymath}
\verb|\bra{\phi}\ket{\psi}\bra{\xi}| \rightarrow \bra{\phi}\ket{\psi}\bra{\xi}
\end{displaymath}
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.
\begin{longtable}[c]{|L{0.25\textwidth}|L{0.35\textwidth}|L{0.3\textwidth}|}
\hline
\verb|\ket| & \verb|\ket{\tall}| $\rightarrow \ket{\tall}$ & automatic sizing \\
& \verb|\ket*{\tall}| $\rightarrow \ket*{\tall}$ & no resize \\\hline
\verb|\bra| & \verb|\bra{\tall}| $\rightarrow \bra{\tall}$ & automatic sizing \\
& \verb|\bra*{\tall}| $\rightarrow \bra*{\tall}$ & no resize \\
& \verb|\bra{\phi}\ket{\psi}| $\rightarrow \bra{\phi}\ket{\psi}$ & automatic contraction \\
& \verb|\bra{\phi}\ket{\tall}| $\rightarrow \bra{\phi}\ket{\tall}$ & contraction inherits automatic sizing \\
& \verb|\bra{\phi}\ket*{\tall}| $\rightarrow \bra{\phi}\ket*{\tall}$ & \multirow{2}{*}{\parbox{6cm}{a star on either term in the contraction prohibits resizing}} \\
& \verb|\bra*{\phi}\ket{\tall}| $\rightarrow \bra*{\phi}\ket{\tall}$ & \\
& \verb|\bra*{\phi}\ket*{\tall}| $\rightarrow \bra*{\phi}\ket*{\tall}$ & \\\hline
\verb|\innerproduct| & $\verb|\braket{a}{b}| \rightarrow \braket{a}{b}$ & two-argument braket \\
& \verb|\braket{a}| $\rightarrow \braket{a}$ & one-argument (norm) \\
& \verb|\braket{a}{\tall}| $\rightarrow \braket{a}{\tall}$ & automatic sizing \\
& \verb|\braket*{a}{\tall}| $\rightarrow \braket*{a}{\tall}$ & no resize \\
& \verb|\ip{a}{b}| $\rightarrow \ip{a}{b}$ & shorthand name \\\hline
\verb|\outerproduct| & \verb|\dyad{a}{b}| $\rightarrow \dyad{a}{b}$ & two-argument dyad \\
& \verb|\dyad{a}| $\rightarrow \dyad{a}$ & one-argument (projector) \\
& \verb|\dyad{a}{\tall}| $\rightarrow \dyad{a}{\tall}$ & automatic sizing \\
& \verb|\dyad*{a}{\tall}| $\rightarrow \dyad*{a}{\tall}$ & no resize \\
& \verb|\ketbra{a}{b}| $\rightarrow \ketbra{a}{b}$ & alternative name \\
& \verb|\op{a}{b}| $\rightarrow \op{a}{b}$ & shorthand name \\\hline
\verb|\expectationvalue| & \verb|\expval{A}| $\rightarrow \expval{A}$ & implicit form \\
& \verb|\expval{A}{\Psi}| $\rightarrow \expval{A}{\Psi}$ & explicit form \\
& \verb|\ev{A}{\Psi}| $\rightarrow \ev{A}{\Psi}$ & shorthand name \\
& \verb|\ev{\grande}{\Psi}| $\rightarrow \ev{\grande}{\Psi}$ & default sizing ignores middle argument \\
& \verb|\ev*{\grande}{\tall}| $\rightarrow \ev*{\grande}{\tall}$ & single star does no resizing whatsoever \\
& \verb|\ev**{\grande}{\Psi}| $\rightarrow \ev**{\grande}{\Psi}$ & double star resizes based on all parts \\\hline
\verb|\matrixelement| & \verb|\matrixel{n}{A}{m}| $\rightarrow \matrixel{n}{A}{m}$ & requires all three arguments \\
& \verb|\mel{n}{A}{m}| $\rightarrow \mel{n}{A}{m}$ & shorthand name \\
& \verb|\mel{n}{\grande}{m}| $\rightarrow \mel{n}{\grande}{m}$ & default sizing ignores middle argument \\
& \verb|\mel*{n}{\grande}{\tall}| $\rightarrow \mel*{n}{\grande}{\tall}$ & single star does no resizing whatsoever \\
& \verb|\mel**{n}{\grande}{m}| $\rightarrow \mel**{n}{\grande}{m}$ & double star resizes based on all parts \\\hline
\end{longtable}
\subsection{Matrix macros}
Note: \verb|\mqty| and \verb|\smqty| in \texttt{physics} uses \verb|\mathord|, while \verb|\PTmqty| and \verb|\PTsmqty| in \texttt{physics-patch} don't.

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:\\
\begin{minipage}{3cm}
\begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
\begin{pmatrix}
\imat{2} \\ a & b
\end{pmatrix}
\end{lstlisting}
\end{minipage}
\begin{minipage}{6cm}
\begin{displaymath}
\Rightarrow\qquad
\begin{pmatrix}
\imat{2} \\ a & b
\end{pmatrix}
\end{displaymath}
\end{minipage}
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:\\
\begin{minipage}{9cm}
\begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
\begin{pmatrix}
\PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e
\end{pmatrix}
\end{lstlisting}
\end{minipage}
\begin{minipage}{6cm}
\begin{displaymath}
\Rightarrow\qquad
\begin{pmatrix}
\PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e
\end{pmatrix}
\end{displaymath}
\end{minipage}
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:\\
\begin{minipage}{9cm}
\begin{lstlisting}[language=TeX,basicstyle=\ttfamily\normalsize]
\PTmqty(\PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e)
\end{lstlisting}
\end{minipage}
\begin{minipage}{6cm}
\begin{displaymath}
\Rightarrow\qquad
\PTmqty(\PTmqty{\imat{2}} & \PTmqty{a\\b} \\ \PTmqty{c & d} & e)
\end{displaymath}
\end{minipage}
{\fontsize{8pt}{12pt}\selectfont
\begin{longtable}[c]{|p{0.2\textwidth}|p{0.35\textwidth}|p{0.35\textwidth}|}
\hline
\verb|\PTmatrixquantity| & \verb|\PTmqty{a & b \\ c & d}| $\rightarrow \PTmqty{a & b \\ c & d}$ & groups a set of matrix elements into a single object \\
& \verb|\PTmqty(a & b \\ c & d)| $\rightarrow {\PTmqty(a & b \\ c & d)}$ & parentheses \\
& \verb|\PTmqty*(a & b \\ c & d)| $\rightarrow {\PTmqty*(a & b \\ c & d)}$ & alternate parentheses \\
& \verb|\PTmqty[a & b \\ c & d]| $\rightarrow {\PTmqty[a & b \\ c & d]}$ & square brackets \\
& \verb|\PTmqty| \texttt{|} \verb|a & b \\ c & d| \texttt{|} $\rightarrow {\PTmqty|a & b \\ c & d|}$ & vertical bars \\
& \verb|\omqty{}| $\leftrightarrow$ \verb|\PTmqty{}| & \multirow{2}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
& \verb|\pmqty{}| $\leftrightarrow$ \verb|\PTmqty()| & \\
& \verb|\PTpmqty{}| $\leftrightarrow$ \verb|\PTmqty()| & \\
& \verb|\PTpmqty*{}| $\leftrightarrow$ \verb|\PTmqty*{}| & \\
& \verb|\Pmqty{}| $\leftrightarrow$ \verb|\PTmqty*()| & \\
& \verb|\bmqty{}| $\leftrightarrow$ \verb|\PTmqty[]| & \\
& \verb|\vmqty{}| $\leftrightarrow$ \verb+\PTmqty||+ & \\\hline
\verb|\PTsmallmatrixquantity| & \verb|\PTsmqty{a & b \\ c & d}| $\rightarrow \PTsmqty{a & b \\ c & d}$ & the \texttt{smallmatrix} form of \verb|\PTmqty| \\
& \verb|\PTsmqty()| \qor \verb|\spmqty{}| \qor \verb|\PTspmqty{}| & small version of \verb|\PTmqty()| \\
& \verb|\PTsmqty*()| \qor \verb|\sPmqty{}| \qor \verb|\PTspmqty*{}| & small version of \verb|\PTmqty*()|\\
& \verb|\PTsmqty[]| \qor \verb|\sbmqty{}| & small version of \verb|\PTmqty[]| \\
& \verb+\PTsmqty||+ \qor \verb|\svmqty{}| & small version of \verb+\PTmqty||+ \\\hline
\verb|\matrixdeterminant| & \verb|\mdet{a & b \\ c & d}| $\rightarrow {\mdet{a & b \\ c & d}}$ & matrix determinant \\
& \verb|\smdet{a & b \\ c & d}| $\rightarrow {\smdet{a & b \\ c & d}}$ & small matrix determinant \\\hline
\verb|\identitymatrix| & \verb|\imat{n}| & elements of $n \times n$ identity matrix \\
& \verb|\PTmqty(\imat{3})| $\rightarrow \PTmqty(\imat{3})$ & formatted with \verb|\PTmqty| or \verb|\PTsmqty| \\\hline
\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}} \\
& \verb|\PTmqty(\PTxmat{x}{3}{3})| $\rightarrow \PTmqty(\PTxmat{x}{3}{3})$ & \\
& \verb|\PTmqty(\PTxmat{x}{}{3})| $\rightarrow \PTmqty(\PTxmat{x}{}{3})$ & \\
& \verb|\PTmqty(\PTxmat{x}{3}{})| $\rightarrow \PTmqty(\PTxmat{x}{3}{})$ & \\
& \verb|\PTxmat*{x}{n}{m}| & \multirow{4}{*}{\parbox{6cm}{star for element indices, skip row/column indices $n=1$/$m=1$}} \\
& \verb|\PTmqty(\PTxmat*{x}{3}{3})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3})$ & \\
& \verb|\PTmqty(\PTxmat*{x}{1}{3})| $\rightarrow \PTmqty(\PTxmat*{x}{1}{3})$ & \\
& \verb|\PTmqty(\PTxmat*{x}{3}{1})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{1})$ & \\
& \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}} \\
& \verb|\PTmqty(\PTxmat{x}{5}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{3}[3])$ & \\
& \verb|\PTmqty(\PTxmat{x}{3}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{3}{3}[3])$ & \\
& \verb|\PTmqty(\PTxmat{x}{}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{}{3}[3])$ & \\
& \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}} \\
& \verb|\PTmqty(\PTxmat{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{5}[3][3])$ & \\
& \verb|\PTmqty(\PTxmat{x}{5}{3}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{3}[3][3])$ & \\
& \verb|\PTmqty(\PTxmat{x}{3}{3}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{3}{3}[3][3])$ & \\
& \verb|\PTmqty(\PTxmat{x}{5}{}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{}[3][3])$ & \\
& \verb|\PTmqty(\PTxmat{x}{}{}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{}{}[3][3])$ & \\
& \verb|\PTxmat*{x}{n}{m}{g}| & \multirow{3}{*}{\parbox{6cm}{customize last row's element indices to $g$}} \\
& \verb|\PTmqty(\PTxmat*{x}{3}{3}{A})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3}{A})$ & \\
& \verb|\PTmqty(\PTxmat*{x}{5}{5}[3][3]{A})| $\rightarrow \PTmqty(\PTxmat*{x}{5}{5}[3][3]{A})$ & \\
& \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$}} \\
& \verb|\PTmqty(\PTxmat*{x}{3}{3}{A}{B})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3}{A}{B})$ & \\
& \verb|\PTmqty(\PTxmat*{x}{5}{5}[3][3]{A}{B})| $\rightarrow \PTmqty(\PTxmat*{x}{5}{5}[3][3]{A}{B})$ & \\
& \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}} \\
& \verb|\PTmqty(\PTxmat[0]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[0]{x}{5}{5}[3][3])$ & \\
& \verb|\PTmqty(\PTxmat[1]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[1]{x}{5}{5}[3][3])$ & \\
& \verb|\PTmqty(\PTxmat[2]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[2]{x}{5}{5}[3][3])$ & \\\hline
\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}} \\
& \verb|\PTmqty(\zmat{2}{2})| $\rightarrow \PTmqty(\zmat{2}{2})$ & \\
& \verb|\PTmqty(\zmat{2})| $\rightarrow \PTmqty(\zmat{2})$ & \\\hline
\verb|\paulimatrix| & \verb|\pmat{n}| & $n^\text{th}$ Pauli matrix \\
& \verb|\PTmqty(\pmat{0})| $\rightarrow \PTmqty(\pmat{0})$ & $n\in \lbrace 0,1,2,3$ or $x,y,z \rbrace$ \\
& \verb|\PTmqty(\pmat{1})| $\rightarrow \PTmqty(\pmat{1})$ & \\
& \verb|\PTmqty(\pmat{2})| $\rightarrow \PTmqty(\pmat{2})$ & \\
& \verb|\PTmqty(\pmat{3})| $\rightarrow \PTmqty(\pmat{3})$ & \\\hline
\verb|\diagonalmatrix| & \verb|\dmat{a,b,c,...}| & \multirow{2}{*}{\parbox{6cm}{specify up to eight diagonal or block diagonal elements}} \\
& \verb|\PTmqty(\dmat{1,2,3})| $\rightarrow \PTmqty(\dmat{1,2,3})$ & \\
& \verb|\PTmqty(\dmat[0]{1,2})| $\rightarrow \PTmqty(\dmat[0]{1,2})$ & optional argument to fill spaces \\
& \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
\verb|\antidiagonalmatrix| & \verb|\admat{a,b,c,...}| & same as syntax as \verb|\dmat| \\
& \verb|\PTmqty(\admat{1,2,3})| $\rightarrow \PTmqty(\admat{1,2,3})$ & \\\hline
\end{longtable}
}
\subsection{Symbols}
\begin{longtable}[c]{|p{0.4\textwidth}|p{0.4\textwidth}|}
\hline
\verb|\lparen| $\rightarrow\; ($ &\\\hline
\verb|\rparen| $\rightarrow\; )$ &\\\hline
\verb|\ordersymbol| $\rightarrow \ordersymbol$ & \\\hline
\verb|\typical| $\rightarrow \typical$ & \\\hline
\verb|\tall| $\rightarrow \tall$ & \\\hline
\verb|\grande| $\rightarrow \grande$ & \\\hline
\verb|\venti| $\rightarrow \venti$ & \\\hline
\verb|\parallelsum| $\rightarrow \parallelsum$ & \\\hline
\verb|\calE|$\rightarrow$\verb|\mathcal{E}| & \\\hline
\verb|\bbR|$\rightarrow$\verb|\mathbb{R}| & \\\hline
\verb|\bbC|$\rightarrow$\verb|\mathbb{C}| & \\\hline
\verb|\bbQ|$\rightarrow$\verb|\mathbb{Q}| & \\\hline
\verb|\bbN|$\rightarrow$\verb|\mathbb{N}| & \\\hline
\verb|\bbZ|$\rightarrow$\verb|\mathbb{Z}| & \\\hline
\verb|\bell|$\rightarrow$\verb|\boldsymbol{\ell}| & \\\hline
\verb|\Bell|$\rightarrow$\verb|\char"1F514| & the \verb|\bell| command in wasysym, which is a bell symbol \\\hline
\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
\verb|\kernnull| & negate the space next to null delimiters, implemented with \verb|\kern-\nulldelimiterspace| \\\hline
\verb|\ST| $\rightarrow \ST$ & such that with space before and after it \\\hline
\end{longtable}
\subsection{Arrows and lines}
For math mode only:
\begin{longtable}[c]{|p{0.5\textwidth}|p{0.3\textwidth}|}
\hline
\verb|\Leftrightarrow| or \verb|\Lra| & $\Leftrightarrow$ \\\hline
\verb|\leftrightarrow| or \verb|\lra| & $\leftrightarrow$ \\\hline
\verb|\Rightarrow| or \verb|\Ra| & $\Rightarrow$ \\\hline
\verb|\rightarrow| or \verb|\ra| & $\rightarrow$ \\\hline
\verb|\Leftarrow| or \verb|\La| & $\Leftarrow$ \\\hline
\verb|\leftarrow| or \verb|\la| & $\leftarrow$ \\\hline
\verb|\Uparrow| or \verb|\Upa| & $\Uparrow$ \\\hline
\verb|\uparrow| or \verb|\upa| & $\uparrow$ \\\hline
\verb|\Downarrow| or \verb|\Dna| & $\Downarrow$ \\\hline
\verb|\downarrow| or \verb|\dna| & $\downarrow$ \\\hline
\verb|\rightleftharpoons| or \verb|\rlh| & $\rightleftharpoons$ \\\hline
\verb|\leftrightharpoons| or \verb|\lrh| & $\leftrightharpoons$ \\\hline
\verb|\rightharpoonup| or \verb|\rhu| & $\rightharpoonup$ \\\hline
\verb|\leftharpoonup| or \verb|\lhu| & $\leftharpoonup$ \\\hline
\verb|\rightharpoondown| or \verb|\rhd| & $\rightharpoondown$ \\\hline
\verb|\leftharpoondown| or \verb|\lhd| & $\leftharpoondown$ \\\hline
\verb|\upharpoonright| or \verb|\uhr| & $\upharpoonright$ \\\hline
\verb|\upharpoonleft| or \verb|\uhl| & $\upharpoonleft$ \\\hline
\verb|\downharpoonright| or \verb|\dhr| & $\downharpoonright$ \\\hline
\verb|\downharpoonleft| or \verb|\dhl| & $\downharpoonleft$ \\\hline
\verb|\hookrightarrow| or \verb|\hkra| & $\hookrightarrow$ \\\hline
\verb|\hookleftarrow| or \verb|\hkla| & $\hookleftarrow$ \\\hline
\verb|\nLeftrightarrow| or \verb|\nLra| & $\nLeftrightarrow$ \\\hline
\verb|\nleftrightarrow| or \verb|\nlra| & $\nleftrightarrow$ \\\hline
\verb|\nRightarrow| or \verb|\nRa| & $\nRightarrow$ \\\hline
\verb|\nrightarrow| or \verb|\nra| & $\nrightarrow$ \\\hline
\verb|\nLeftarrow| or \verb|\nLa| & $\nLeftarrow$ \\\hline
\verb|\nleftarrow| or \verb|\nla| & $\nleftarrow$ \\\hline
\verb|\mapsto| or \verb|\mpto| & $\mapsto$ \\\hline
\verb|\mapsfrom| or \verb|\mpfr| & $\mapsfrom$ \\\hline
\verb|\stackrel{\mathrm{def}}{=}| or \verb|\defeq| & $\defeq$ \\\hline
\end{longtable}
Work in both math mode and text mode:
\begin{longtable}[c]{|p{0.5\textwidth}|p{0.3\textwidth}|}
\hline
\verb|\equiv| or \verb|\eqv| & $\equiv$ \\\hline
\verb|\geq| & $\geq$ \\\hline
\verb|\leq| & $\leq$ \\\hline
\verb|\gg| & $\gg$ \\\hline
\verb|\ll| & $\ll$ \\\hline
\verb|\approx| or \verb|\apx| & $\approx$ \\\hline
\verb|\gtrapprox| or \verb|\gapx| & $\gtrapprox$ \\\hline
\verb|\lessapprox| or \verb|\lapx| & $\lessapprox$ \\\hline
\verb|\sim| & $\sim$ \\\hline
\end{longtable}
\subsection{Shorthands for Greek alphabet}
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.
\begin{longtable}[c]{|p{0.3\textwidth}|p{0.2\textwidth}|p{0.3\textwidth}|}
\hline
Command & Option & Note \\\hline
\verb|\tgAlpha| $\rightarrow$ \verb|\text{\textAlpha}| & shorttextgreek & accept an optional argument argument in \texttt{\{\}} that is simply skipped \\\hline
\verb|\vAlpha| $\rightarrow$ \verb|\varAlpha| & shortvargreek & \\\hline
\verb|\uAlpha| $\rightarrow$ \verb|\upAlpha| & shortupgreek & \\\hline
\verb|\uvAlpha| $\rightarrow$ \verb|\upvarAlpha| & shortupvargreek & \\\hline
\verb|\bAlpha| $\rightarrow$ \verb|\boldsymbol{\Alpha}| & shortboldgreek & \\\hline
\end{longtable}
\subsection{Shorthands for mathrm alphabet and chemical element symbols}
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.
\begin{longtable}[c]{|p{0.4\textwidth}|p{0.4\textwidth}|}
\hline
\verb|\rmA_a^b| $\rightarrow\mathrm{A}_a^b$ & \verb|\rmA^a_b| $\rightarrow\mathrm{A}^a_b$ \\\hline
\end{longtable}
\subsection{Shorthands for textnormal alphabet}
If option \texttt{shorttext} is used, the following shorthands will be defined for every uppercase and lowercase English letter. Take A for example.
\begin{longtable}[c]{|c|}
\hline
\verb|\txA| $\rightarrow$ \verb|\textnormal{A}|
\\\hline
\end{longtable}
\end{document}