<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\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[shortgreek,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{M}{&gt;{$\displaystyle}c&lt;{$}}
\newcolumntype{L}{&gt;{$\displaystyle}l&lt;{$}}
\newcolumntype{C}[1]{&gt;{\centering\arraybackslash}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 2.7\\\textnormal{Last update: Mar. 18, 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, covering all its commands. While preserving the original goalâ€”simplifying mathematical and physics typesetting for greater readability and efficiencyâ€”this package refines the design by addressing unconventional behaviors, extending commands, and introducing additional macros.

Like the original, this package provides commands with intuitive names and well-defined shorthands, ensuring both clarity and ease of recall.

This package resolved the unintuitive definitions and behaviors in \texttt{physics} without changing the command names and intended behaviors. For instance, in the original package, parentheses and their contents after \verb|\dv{f}{x}| are ignored.

Beyond refining existing functionality, this package extends commands for broader applicability such as enabling \verb|\xmat| to support ellipses and introduces 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 properly in your \LaTeX~document. 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}[language=TeX]
\documentclass{class}
...
\usepackage{physics-patch}
...
\begin{document}
content...
\end{document}
\end{lstlisting}
\begin{itemize}
\item \texttt{physics-patch} has covered all commands in \texttt{physics} since version 2.0, so there's no need to load \texttt{physics}.
\item It is ok to load \texttt{physics} before this package. This package will silently overrides macros in \texttt{physics} with an improved version. To use the original version provided by \texttt{physics}, load \texttt{physics} before this package and use the \texttt{nooverride} option (not recommended). \texttt{nooverride} falls back to \texttt{override} if physics is not loaded.
\item This package pretends that \texttt{physics} package is loaded so that this package won't be overriden if loading \texttt{physics} is called afterward and packages loaded afterward that checks whether \texttt{physics} is loaded to determine its behavior (e.g. \texttt{siunitx}) work correctly. To disable this, use the \texttt{nopretend} option (not recommended).
\item If \texttt{siuitx} is loaded before this package, this package will define \verb|\ITquantity| and \verb|\ITqty| as the integration of the improved 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 \texttt{nosiintegrate} if \texttt{siunitx} is not loaded.
\end{itemize}
\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 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.
\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.

Commands that have different definitions come with \texttt{PT} in the beginning of their name (e.g. \verb|\PTmqty|). If \texttt{nooverride} is not used or the \texttt{physics} package is not loaded before this package, the commands without \texttt{PT} will be silent overriden to be the same as the ones with \texttt{PT}.
\subsection{Automatic bracing}
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\verb|\PTquantity|, \verb|\PHquantity| or \verb|\PHqty| &amp; \verb|\PTqty(\typical)| $\displaystyle\rightarrow \PTqty(\typical)$ &amp; automatic $\PTqty(\;)$ braces \\
&amp; \verb|\PTqty(\tall)| $\displaystyle\rightarrow \PTqty(\tall)$ &amp; \\
&amp; \verb|\PTqty(\grande)| $\displaystyle\rightarrow \PTqty(\grande)$ &amp; \\
&amp; \verb|\PTqty[\typical]| $\rightarrow \PTqty[\typical]$ &amp; automatic $\PTqty[\;]$ braces \\
&amp; \verb+\PTqty|\typical|+ $\rightarrow \PTqty|\typical|$ &amp; automatic $\PTqty|\;|$ braces \\
&amp; \verb|\PTqty{\typical}| $\rightarrow \PTqty{\typical}$ &amp; automatic $\PTqty{\;}$ braces \\
&amp; \verb|\PTqty\big{}| $\rightarrow \PTqty\big{}$ &amp; \multirow{2}{*}{\parbox{6cm}{manual sizing (works with any of the above bracket types)}} \\
&amp; \verb|\PTqty\Big{}| $\rightarrow \PTqty\Big{}$ &amp; \\
&amp; \verb|\PTqty\bigg{}| $\rightarrow \PTqty\bigg{}$ &amp; \\
&amp; \verb|\PTqty\Bigg{}| $\rightarrow \PTqty\Bigg{}$ &amp; \\
&amp; \verb|\pqty{}| $\leftrightarrow$ \verb|\PTqty()| &amp; \multirow{2}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
&amp; \verb|\bqty{}| $\leftrightarrow$ \verb|\PTqty[]| &amp; \\
&amp; \verb+\vqty{}+ $\leftrightarrow$ \verb+\PTqty||+ &amp; \\
&amp; \verb|\Bqty{}| $\leftrightarrow$ \verb|\PTqty{}| &amp; \\\hline
\verb|\absolutevalue| &amp; \verb|\abs{a}| $\rightarrow \abs{a}$ &amp; automatic sizing; equivalent to \verb|\PTqty| \!\!\texttt{|a|} \\
&amp; \verb|\abs\Big{a}| $\rightarrow \abs\Big{a}$ &amp; inherits manual sizing syntax from \verb|\PTqty| \\
&amp; \verb|\abs*{\grande}| $\displaystyle\rightarrow \abs*{\grande}$ &amp; star for no resize \\\hline
\verb|\norm| &amp; \verb|\norm{a}| $\rightarrow \norm{a}$ &amp; automatic sizing \\
&amp; \verb|\norm\Big{a}| $\rightarrow \norm\Big{a}$ &amp; manual sizing \\
&amp; \verb|\norm*{\grande}| $\displaystyle\rightarrow \norm*{\grande}$ &amp; star for no resize \\\hline
\verb|\evaluated| &amp; \verb|\eval{x}_0^\infty| $\displaystyle\rightarrow \eval{x}_0^\infty$ &amp; vertical bar for evaluation limits \\
&amp; \verb|\eval(x| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval(x|_0^\infty$ &amp; alternate form \\
&amp; \verb|\eval[x| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval[x|_0^\infty$ &amp; alternate form \\
&amp; \verb|\eval[\venti| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval[\venti|_0^\infty$ &amp; automatic sizing\\
&amp; \verb|\eval*[\venti| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval*[\venti|_0^\infty$ &amp; star for no resize \\\hline
\verb|\order| &amp; \verb|\order{x^2}| $\rightarrow \order{x^2}$ &amp; order symbol; automatic sizing and space handling \\
&amp; \verb|\order\Big{x^2}| $\rightarrow \order\Big{x^2}$ &amp; manual sizing \\
&amp; \verb|\order*{\grande}| $\displaystyle\rightarrow \order*{\grande}$ &amp; star for no resize \\\hline
\verb|\commutator| &amp; \verb|\comm{A}{B}| $\rightarrow \comm{A}{B}$ &amp; automatic sizing \\
&amp; \verb|\comm\Big{A}{B}| $\rightarrow \comm\Big{A}{B}$ &amp; manual sizing \\
&amp; \verb|\comm*{A}{\grande}| $\displaystyle\rightarrow \comm*{A}{\grande}$ &amp; star for no resize \\\hline
\verb|\anticommutator| or \verb|\acommutator| &amp; \verb|\acomm{A}{B}| $\rightarrow \acomm{A}{B}$ &amp; same as \verb|\poissonbracket| \\\hline
\verb|\poissonbracket| &amp; \verb|\pb{A}{B}| $\rightarrow \pb{A}{B}$ &amp; same as \verb|\anticommutator|\\\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]
\usepackage[arrowdel]{physics-patch}
\end{lstlisting}
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\verb|\vectorbold| &amp; \verb|\vb{a}| $\rightarrow \vb{a}$ &amp; upright/no Greek \\
&amp; \verb|\vb*{a}|, \verb|\vb*{\theta}| $\rightarrow \vb*{a}$, $\vb*{\theta}$ &amp; italic/Greek \\\hline
\verb|\vectorarrow| &amp; \verb|\va{a}| $\rightarrow \va{a}$ &amp; upright/no Greek \\
&amp; \verb|\va*{a}|, \verb|\va*{\theta}| $\rightarrow \va*{a}$, $\va*{\theta}$ &amp; italic/Greek \\\hline
\verb|\vectorunit| &amp; \verb|\vu{a}| $\rightarrow \vu{a}$ &amp; upright/no Greek \\
&amp; \verb|\vu*{a}|, \verb|\vu*{\theta}| $\rightarrow \vu*{a}$, $\vu*{\theta}$ &amp; italic/Greek \\\hline
\verb|\dotproduct| &amp; \verb|\vdot| $\rightarrow \vdot$ as in $\vb{a} \vdot \vb{b}$ &amp; note: \verb|\dp| is a protected \TeX\ primitive \\\hline
\verb|\crossproduct| &amp; \verb|\cross| $\rightarrow \cross$ as in $\vb{a} \cross \vb{b}$ &amp; alternate name \\
&amp; \verb|\cp| $\rightarrow \cp$ as in $\vb{a} \cp \vb{b}$ &amp; shorthand name \\\hline
\verb|\gradient| &amp; \verb|\grad| $\rightarrow \grad$ &amp; \\
&amp; \verb|\grad{\Psi}| $\rightarrow \grad{\Psi}$ &amp; default mode \\
&amp; \verb|\grad(\Psi+\tall)| $\displaystyle\rightarrow \grad(\Psi+\tall)$ &amp; long-form (like \verb|\PTqty| but also handles spacing) \\
&amp; \verb|\grad[\Psi+\tall]| $\displaystyle\rightarrow \grad[\Psi+\tall]$ &amp; \\\hline
\verb|\divisionsymbol| &amp; \verb|\divisionsymbol| $\rightarrow \divisionsymbol$ &amp;  \\\hline
\verb|\divergence| &amp; \verb|\divg| $\rightarrow \divg$ &amp; note: if \texttt{nooriginaldiv} option is used, \verb|\div| will be overriden as $\divg$ too (not recommended) \\
&amp; \verb|\divg{\vb{a}}| $\rightarrow \divg{\vb{a}}$ &amp; default mode \\
&amp; \verb|\divg(\vb{a}+\tall)| $\displaystyle\rightarrow \divg(\vb{a}+\tall)$ &amp; long-form \\
&amp; \verb|\divg[\vb{a}+\tall]| $\displaystyle\rightarrow \divg[\vb{a}+\tall]$ &amp; \\\hline
\verb|\curl| &amp; \verb|\curl| $\rightarrow \curl$ &amp; \\
&amp; \verb|\curl{\vb{a}}| $\rightarrow \curl{\vb{a}}$ &amp; default mode \\
&amp; \verb|\curl(\vb{a}+\tall)| $\displaystyle\rightarrow \curl(\vb{a}+\tall)$ &amp; long-form \\
&amp; \verb|\curl[\vb{a}+\tall]| $\displaystyle\rightarrow \curl[\vb{a}+\tall]$ &amp; \\\hline
\verb|\laplacian| &amp; \verb|\laplacian| $\rightarrow \laplacian$ &amp; \\
&amp; \verb|\laplacian{\Psi}| $\rightarrow \laplacian{\Psi}$ &amp; default mode \\
&amp; \verb|\laplacian(\Psi+\tall)| $\displaystyle\rightarrow \laplacian(\Psi+\tall)$ &amp; long-form \\
&amp; \verb|\laplacian[\Psi+\tall]| $\displaystyle\rightarrow \laplacian[\Psi+\tall]$ &amp;\\\hline
\end{longtable}
\subsection{Operators}
The standard set of trig functions is 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]
\usepackage[notrig]{physics-patch}
\end{lstlisting}
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\multicolumn{3}{|l|}{Example trig redefinitions:} \\\hline
\verb|\sin| &amp; \verb|\sin(\grande)| $\displaystyle\rightarrow \sin(\grande)$ &amp; automatic braces; old \verb|\sin| renamed \verb|\sine| \\
&amp; \verb|\sin[2](x)| $\rightarrow \sin[2](x)$ &amp; optional power \\
&amp; \verb|\sin x| $\rightarrow \sin x$ &amp; can still use without an argument \\\hline
\end{longtable}
The full set of available trig functions in \texttt{physics-patch} includes:\\
\begin{longtable}{llll}
\verb|\sin(x)| &amp; \verb|\sinh(x)| &amp; \verb|\arcsin(x)| &amp; \verb|\asin(x)| \\
\verb|\cos(x)| &amp; \verb|\cosh(x)| &amp; \verb|\arccos(x)| &amp; \verb|\acos(x)| \\
\verb|\tan(x)| &amp; \verb|\tanh(x)| &amp; \verb|\arctan(x)| &amp; \verb|\atan(x)| \\
\verb|\csc(x)| &amp; \verb|\csch(x)| &amp; \verb|\arccsc(x)| &amp; \verb|\acsc(x)| \\
\verb|\sec(x)| &amp; \verb|\sech(x)| &amp; \verb|\arcsec(x)| &amp; \verb|\asec(x)| \\
\verb|\cot(x)| &amp; \verb|\coth(x)| &amp; \verb|\arccot(x)| &amp; \verb|\acot(x)|
\end{longtable}$\Rightarrow$
\begin{longtable}{MMMM}
\sin(x) &amp; \sinh(x) &amp; \arcsin(x) &amp; \asin(x) \\
\cos(x) &amp; \cosh(x) &amp; \arccos(x) &amp; \acos(x) \\
\tan(x) &amp; \tanh(x) &amp; \arctan(x) &amp; \atan(x) \\
\csc(x) &amp; \csch(x) &amp; \arccsc(x) &amp; \acsc(x) \\
\sec(x) &amp; \sech(x) &amp; \arcsec(x) &amp; \asec(x) \\
\cot(x) &amp; \coth(x) &amp; \arccot(x) &amp; \acot(x)\\
\end{longtable}
The standard trig functions (plus a few that are missing in \texttt{amsmath}) are available without any automatic bracing under a new set of longer names:\\
\begin{longtable}{llll}
\verb|\sine| &amp; \verb|\hypsine| &amp; \verb|\arcsine| &amp; \verb|\asine| \\
\verb|\cosine| &amp; \verb|\hypcosine| &amp; \verb|\arccosine| &amp; \verb|\acosine| \\
\verb|\tangent| &amp; \verb|\hyptangent| &amp; \verb|\arctangent| &amp; \verb|\atangent| \\
\verb|\cosecant| &amp; \verb|\hypcosecant| &amp; \verb|\arccosecant| &amp; \verb|\acosecant| \\
\verb|\secant| &amp; \verb|\hypsecant| &amp; \verb|\arcsecant| &amp; \verb|\asecant| \\
\verb|\cotangent| &amp; \verb|\hypcotangent| &amp; \verb|\arccotangent| &amp; \verb|\acotangent|\\
\end{longtable}
Similar behavior has also been extended to the following functions:\\
\begin{longtable}{|l|&gt;{$}l&lt;{$}|l|l|}
\hline
\verb|\exp(\tall)| &amp; \exp(\tall) &amp; \multirow{5}{*}{old definitions $\Rightarrow$} &amp; \verb|\exponential| \\\cline{1-2}\cline{4-4}
\verb|\log(\tall)| &amp; \log(\tall) &amp; &amp; \verb|\logarithm| \\\cline{1-2}\cline{4-4}
\verb|\ln(\tall)| &amp; \ln(\tall) &amp; &amp; \verb|\naturallogarithm| \\\cline{1-2}\cline{4-4}
\verb|\det(\tall)| &amp; \det(\tall) &amp; &amp; \verb|\determinant| \\\cline{1-2}\cline{4-4}
\verb|\Pr(\tall)| &amp; \Pr(\tall) &amp; &amp; \verb|\Probability|\\\hline
\verb|\Arg(\tall)| &amp; \Arg(\tall) &amp; &amp; \verb|\Argument|\\\hline
\verb|\arg(\tall)| &amp; \arg(\tall) &amp; &amp; \verb|\argument|\\\hline
\verb|\Re(\tall)| &amp; \Re(\tall) &amp; &amp; \verb|\real|\\\hline
\verb|\Im(\tall)| &amp; \Im(\tall) &amp; &amp; \verb|\imaginary|\\\hline
\end{longtable}
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\multicolumn{3}{|l|}{New operators:} \\\hline
\verb|\tr| &amp; \verb|\tr\rho| $\rightarrow \tr\rho$ also \verb|\tr(\tall)| $\rightarrow \tr(\tall)$  &amp; trace; same bracing as trig functions \\\hline
\verb|\Tr| &amp; \verb|\Tr\rho| $\rightarrow \Tr\rho$ &amp; alternate \\\hline
\verb|\rank| &amp; \verb|\rank M| $\rightarrow \rank M$ &amp; matrix rank \\\hline
\verb|\erf| &amp; \verb|\erf(x)|$\rightarrow \erf(x)$ &amp; error function \\\hline
\verb|\Res| &amp; \verb|\Res[f(z)]|$\rightarrow \Res[f(z)]$ &amp; \parbox{6cm}{residue; same bracing as trig functions} \\\hline
\verb|acosh| &amp; \verb|\acosh(\pi)| $\rightarrow\acosh(\pi)$ &amp; acosh \\\hline
\verb|acsch| &amp; \verb|\acsch(\pi)| $\rightarrow\acsch(\pi)$ &amp; acsch \\\hline
\verb|arccosh| &amp; \verb|\arccosh(\pi)| $\rightarrow\arccosh(\pi)$ &amp; arccosh \\\hline
\verb|arccsch| &amp; \verb|\arccsch(\pi)| $\rightarrow\arccsch(\pi)$ &amp; arccsch \\\hline
\verb|arcsech| &amp; \verb|\arcsech(\pi)| $\rightarrow\arcsech(\pi)$ &amp; arcsech \\\hline
\verb|arcsinh| &amp; \verb|\arcsinh(\pi)| $\rightarrow\arcsinh(\pi)$ &amp; arcsinh \\\hline
\verb|arctanh| &amp; \verb|\arctanh(\pi)| $\rightarrow\arctanh(\pi)$ &amp; arctanh \\\hline
\verb|arctantwo| &amp; \verb|\arctantwo(\pi)| $\rightarrow\arctantwo(\pi)$ &amp; arctan2 \\\hline
\verb|asech| &amp; \verb|\asech(\pi)| $\rightarrow\asech(\pi)$ &amp; asech \\\hline
\verb|asinh| &amp; \verb|\asinh(\pi)| $\rightarrow\asinh(\pi)$ &amp; asinh \\\hline
\verb|atanh| &amp; \verb|\atanh(\pi)| $\rightarrow\atanh(\pi)$ &amp; atanh \\\hline
\verb|atantwo| &amp; \verb|\atantwo(\pi)| $\rightarrow\atantwo(\pi)$ &amp; atan2 \\\hline
\verb|closure| &amp; \verb|\closure(A)| $\rightarrow\closure(A)$ &amp; closure \\\hline
\verb|col| &amp; \verb|\col(\mathbf{A})| $\rightarrow\col(\mathbf{A})$ &amp; column space \\\hline
\verb|row| &amp; \verb|\row(\mathbf{A})| $\rightarrow\row(\mathbf{A})$ &amp; row space \\\hline
\verb|ker| &amp; \verb|\ker(\mathbf{A})| $\rightarrow\ker(\mathbf{A})$ &amp; kernel \\\hline
\verb|SD| &amp; \verb|\SD(X)| $\rightarrow\SD(X)$ &amp; standard deviation \\\hline
\verb|Var| &amp; \verb|\Var(X)| $\rightarrow\Var(X)$ &amp; variation \\\hline
\verb|Mode| &amp; \verb|\Mode(X)| $\rightarrow\Mode(X)$ &amp; mode \\\hline
\verb|Median| &amp; \verb|\Median(X)| $\rightarrow\Median(X)$ &amp; median \\\hline
\verb|gcd| &amp; \verb|\gcd(X)| $\rightarrow\gcd(X)$ &amp; lowercase greatest common divisor \\\hline
\verb|lcm| &amp; \verb|\lcm(X)| $\rightarrow\lcm(X)$ &amp; lowercase lowest common multiple \\\hline
\verb|GCD| &amp; \verb|\GCD(X)| $\rightarrow\GCD(X)$ &amp; uppercase greatest common divisor \\\hline
\verb|LCM| &amp; \verb|\LCM(X)| $\rightarrow\LCM(X)$ &amp; uppercase lowest common multiple \\\hline
\verb|UnitVector| &amp; \verb|\UnitVector(\mathbf{r})| $\rightarrow\UnitVector(\mathbf{r})$ &amp; unit vector \\\hline
\verb|\principalvalue| &amp; \verb|\pv{\int f(z) \dd{z}}|$\rightarrow \pv{\int f(z) \dd{z}}$ &amp; Cauchy principal value \\
&amp; \verb|\PV{\int f(z) \dd{z}}|$\rightarrow \PV{\int f(z) \dd{z}}$ &amp; alternate \\\hline
\end{longtable}
\subsection{Utilities}
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\verb|\mathcolorbox| &amp; \verb|\mcbox{color}{content}| &amp; \multirow{2}{*}{\parbox{6cm}{\texttt{\textbackslash colorbox} for math environment, applying to all four levels of math styles}} \\
&amp; \verb|\mcbox{cyan}{\typical}| $\rightarrow \mcbox{cyan}{\typical}$ &amp; \\\hline
\verb|\autocolorbox| or \verb|\acbox| &amp; \verb|\cbox{color}{content}| &amp; calls \verb|\colorbox| when in text mode, calls \verb|\mathcolorbox| when in math mode \\\hline
\verb|\tentothepowerof| &amp; \verb|\tenpow{n}| $\rightarrow \tenpow{n}$ &amp; work in both math mode and text mode \\\hline
\verb|\scientificnotation| &amp; \verb|\scinote{3.00}{8}| $\rightarrow \scinote{3.00}{8}$ &amp; work in both math mode and text mode\\\hline
\verb|\numbercircled| &amp; \verb|\numcir{1}| $\rightarrow$ \numcir{1} &amp; patched \verb|\textcircled| for numbers \\\hline
\verb|\boldsymbol| &amp; \verb|\bsb{\tau}| $\rightarrow\bsb{\tau}$ &amp; shorthand for \verb|\boldsymbol| \\\hline
\verb|\RNum| &amp; \verb|\RNum{1}| $\rightarrow$ \RNum{1} &amp; uppercase roman numeral\\\hline
\verb|\flatfrac| &amp; \verb|\flatfrac{a}{b}| $\rightarrow\flatfrac{a}{b}$ &amp; 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}.\\
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\multicolumn{3}{|l|}{General text:} \\\hline
\verb|\qqtext| &amp; \verb|\qq{}| &amp; general quick quad text with argument \\
&amp; \verb|\qq{word or phrase}| $\rightarrow$\Vtextvisiblespace[1em]$\text{word or phrase}$\Vtextvisiblespace[1em] &amp; normal mode; left and right \verb|\quad| \\
&amp; \verb|\qq*{word or phrase}| $\rightarrow \text{word or phrase}$\Vtextvisiblespace[1em] &amp; starred mode; right \verb|\quad| only\\\hline
\end{longtable}
\begin{longtable}[l]{| l | l | }
\hline
Special macros: &amp; \\\hline
\verb|\qcomma| or \verb|\qc| $\rightarrow ,$\Vtextvisiblespace[1em] &amp; right \verb|\quad| only \\\hline
\verb|\qcc| $\rightarrow$\Vtextvisiblespace[1em]$\text{c.c.}$\Vtextvisiblespace[1em] &amp; 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] &amp; left and right \verb|\quad| unless starred \verb|\qif*| $\rightarrow \text{if}$\Vtextvisiblespace[1em]\\\hline
\end{longtable}
\begin{longtable}[l]{ | l | }
\hline
Similar to \verb|\qif|: \\\hline
\verb|\qthen|, \verb|\qelse|, \verb|\qotherwise|, \verb|\qunless|, \verb|\qgiven|, \verb|\qusing|, \verb|\qassume|, \verb|\qsince|, \verb|\qlet| \\ \verb|\qfor|, \verb|\qall|, \verb|\qeven|, \verb|\qodd|, \verb|\qinteger|, \verb|\qand|, \verb|\qor|, \verb|\qas|, \verb|\qin| \\\hline
\end{longtable}
\subsection{Derivatives}
The default differential symbol $\dd$ which is used in \verb|\differential| and \verb|\derivative| can be switched to an italic form $d$ by including the option \texttt{italicdiff} in the preamble:
\begin{lstlisting}[language=TeX]
\usepackage[italicdiff]{physics-patch}
\end{lstlisting}
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\verb|\differential| &amp; \verb|\dd| $\rightarrow \dd$ &amp; \\
&amp; \verb|\dd x| $\rightarrow \dd x$ &amp; no spacing (not recommended) \\
&amp; \verb|\dd{x}| $\rightarrow$ \textvisiblespace\,$\dd{x}$\textvisiblespace &amp; automatic spacing based on neighbors \\
&amp; \verb|\dd[3]{x}| $\rightarrow \dd[3]{x}$ &amp; optional power \\
&amp; \verb|\dd(\cos\theta)| $\rightarrow \dd(\cos\theta)$ &amp; long-form; automatic braces \\\hline
\verb|\PTderivative| &amp; \verb|\PTdv{x}| $\displaystyle\rightarrow \PTdv{x}$ &amp; one argument \\
&amp; \verb|\PTdv{f}{x}| $\displaystyle\rightarrow \PTdv{f}{x}$ &amp; two arguments \\
&amp; \verb|\PTdv[n]{f}{x}| $\displaystyle\rightarrow \PTdv[n]{f}{x}$ &amp; optional power \\
&amp; \verb|\PTdv{x}(\grande)| $\displaystyle\rightarrow \PTdv{x}(\grande)$ &amp; long-form; automatic braces, spacing \\
&amp; \verb|\PTdv*{f}{x}| $\displaystyle\rightarrow \PTdv*{f}{x}$ &amp; inline form using \verb|\flatfrac| \\\hline
\verb|\PTpartialderivative| or \verb|\PTpderivative| &amp; \verb|\PTdv{f}{x}(\grande)| $\displaystyle\rightarrow \PTdv{f}{x}(\grande)$ &amp; note: in original \texttt{physics} package, \verb|\dv{f}{x}(\grande)| $\displaystyle\rightarrow \dv{f}{x}$\\
&amp; \verb|\PTpdv{x}| $\displaystyle\rightarrow \PTpdv{x}$ &amp; shorthand name \\
&amp; \verb|\PTpdv{f}{x}| $\displaystyle\rightarrow \PTpdv{f}{x}$ &amp; two arguments \\
&amp; \verb|\PTpdv[n]{f}{x}| $\displaystyle\rightarrow \PTpdv[n]{f}{x}$ &amp; optional power \\
&amp; \verb|\PTpdv{x}(\grande)| $\displaystyle\rightarrow \PTpdv{x}(\grande)$ &amp; long-form \\
&amp; \verb|\PTpdv{f}{x}{y}| $\displaystyle\rightarrow \PTpdv{f}{x}{y}$ &amp; mixed partial \\
&amp; \verb|\PTpdv*{f}{x}| $\displaystyle\rightarrow \PTpdv*{f}{x}$ &amp; inline form using \verb|\flatfrac| \\
&amp; \verb|\PTpdv{f}{x}(\grande)| $\displaystyle\rightarrow \PTpdv{f}{x}(\grande)$ &amp; note: in original \texttt{physics} package, \verb|\pdv{f}{x}(\grande)| $\displaystyle\rightarrow \pdv{f}{x}$ \\\hline
\verb|\variation| &amp; \verb|\var{F[g(x)]}| $\rightarrow \var{F[g(x)]}$ &amp; functional variation (works like \verb|\dd|) \\
&amp; \verb|\var(E-TS)| $\rightarrow \var(E-TS)$ &amp; long-form \\\hline
\verb|\functionalderivative| &amp; \verb|\fdv{g}| $\displaystyle\rightarrow \fdv{g}$ &amp; functional derivative (works like \verb|\PTdv|) \\
&amp; \verb|\fdv{F}{g}| $\displaystyle\rightarrow \fdv{F}{g}$ &amp; \\
&amp; \verb|\fdv{V}(E-TS)| $\displaystyle\rightarrow \fdv{V}(E-TS)$ &amp; long-form \\
&amp; \verb|\fdv*{F}{x}| $\displaystyle\rightarrow \fdv*{F}{x}$ &amp; 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}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\verb|\ket| &amp; \verb|\ket{\tall}| $\rightarrow \ket{\tall}$ &amp; automatic sizing \\
&amp; \verb|\ket*{\tall}| $\rightarrow \ket*{\tall}$ &amp; no resize \\\hline
\verb|\bra| &amp; \verb|\bra{\tall}| $\rightarrow \bra{\tall}$ &amp; automatic sizing \\
&amp; \verb|\bra*{\tall}| $\rightarrow \bra*{\tall}$ &amp; no resize \\
&amp; \verb|\bra{\phi}\ket{\psi}| $\rightarrow \bra{\phi}\ket{\psi}$ &amp; automatic contraction \\
&amp; \verb|\bra{\phi}\ket{\tall}| $\rightarrow \bra{\phi}\ket{\tall}$ &amp; contraction inherits automatic sizing \\
&amp; \verb|\bra{\phi}\ket*{\tall}| $\rightarrow \bra{\phi}\ket*{\tall}$ &amp; \multirow{2}{*}{\parbox{6cm}{a star on either term in the contraction prohibits resizing}} \\
&amp; \verb|\bra*{\phi}\ket{\tall}| $\rightarrow \bra*{\phi}\ket{\tall}$ &amp; \\
&amp; \verb|\bra*{\phi}\ket*{\tall}| $\rightarrow \bra*{\phi}\ket*{\tall}$ &amp; \\\hline
\verb|\innerproduct| &amp; $\verb|\braket{a}{b}| \rightarrow \braket{a}{b}$ &amp; two-argument braket \\
&amp; \verb|\braket{a}| $\rightarrow \braket{a}$ &amp; one-argument (norm) \\
&amp; \verb|\braket{a}{\tall}| $\rightarrow \braket{a}{\tall}$ &amp; automatic sizing \\
&amp; \verb|\braket*{a}{\tall}| $\rightarrow \braket*{a}{\tall}$ &amp; no resize \\
&amp; \verb|\ip{a}{b}| $\rightarrow \ip{a}{b}$ &amp; shorthand name \\\hline
\verb|\outerproduct| &amp; \verb|\dyad{a}{b}| $\rightarrow \dyad{a}{b}$ &amp; two-argument dyad \\
&amp; \verb|\dyad{a}| $\rightarrow \dyad{a}$ &amp; one-argument (projector) \\
&amp; \verb|\dyad{a}{\tall}| $\rightarrow \dyad{a}{\tall}$ &amp; automatic sizing \\
&amp; \verb|\dyad*{a}{\tall}| $\rightarrow \dyad*{a}{\tall}$ &amp; no resize \\
&amp; \verb|\ketbra{a}{b}| $\rightarrow \ketbra{a}{b}$ &amp; alternative name \\
&amp; \verb|\op{a}{b}| $\rightarrow \op{a}{b}$ &amp; shorthand name \\\hline
\verb|\expectationvalue| &amp; \verb|\expval{A}| $\rightarrow \expval{A}$ &amp; implicit form \\
&amp; \verb|\expval{A}{\Psi}| $\rightarrow \expval{A}{\Psi}$ &amp; explicit form \\
&amp; \verb|\ev{A}{\Psi}| $\rightarrow \ev{A}{\Psi}$ &amp; shorthand name \\
&amp; \verb|\ev{\grande}{\Psi}| $\rightarrow \ev{\grande}{\Psi}$ &amp; default sizing ignores middle argument \\
&amp; \verb|\ev*{\grande}{\tall}| $\rightarrow \ev*{\grande}{\tall}$ &amp; single star does no resizing whatsoever \\
&amp; \verb|\ev**{\grande}{\Psi}| $\rightarrow \ev**{\grande}{\Psi}$ &amp; double star resizes based on all parts \\\hline
\verb|\matrixelement| &amp; \verb|\matrixel{n}{A}{m}| $\rightarrow \matrixel{n}{A}{m}$ &amp; requires all three arguments \\
&amp; \verb|\mel{n}{A}{m}| $\rightarrow \mel{n}{A}{m}$ &amp; shorthand name \\
&amp; \verb|\mel{n}{\grande}{m}| $\rightarrow \mel{n}{\grande}{m}$ &amp; default sizing ignores middle argument \\
&amp; \verb|\mel*{n}{\grande}{\tall}| $\rightarrow \mel*{n}{\grande}{\tall}$ &amp; single star does no resizing whatsoever \\
&amp; \verb|\mel**{n}{\grande}{m}| $\rightarrow \mel**{n}{\grande}{m}$ &amp; 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]
\begin{pmatrix}
\imat{2} \\ a &amp; b
\end{pmatrix}
\end{lstlisting}
\end{minipage}
\begin{minipage}{6cm}
\begin{displaymath}
\Rightarrow\qquad
\begin{pmatrix}
\imat{2} \\ a &amp; 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]
\begin{pmatrix}
\PTmqty{\imat{2}} &amp; \PTmqty{a\\b} \\ \PTmqty{c &amp; d} &amp; e
\end{pmatrix}
\end{lstlisting}
\end{minipage}
\begin{minipage}{6cm}
\begin{displaymath}
\Rightarrow\qquad
\begin{pmatrix}
\PTmqty{\imat{2}} &amp; \PTmqty{a\\b} \\ \PTmqty{c &amp; d} &amp; 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]
\PTmqty(\PTmqty{\imat{2}} &amp; \PTmqty{a\\b} \\ \PTmqty{c &amp; d} &amp; e)
\end{lstlisting}
\end{minipage}
\begin{minipage}{6cm}
\begin{displaymath}
\Rightarrow\qquad
\PTmqty(\PTmqty{\imat{2}} &amp; \PTmqty{a\\b} \\ \PTmqty{c &amp; d} &amp; e)
\end{displaymath}
\end{minipage}
{\fontsize{8pt}{12pt}\selectfont\\
\begin{longtable}[l]{ | C{6cm} | C{6cm} | C{6cm} | }
\hline
\verb|\PTmatrixquantity| &amp; \verb|\PTmqty{a &amp; b \\ c &amp; d}| $\rightarrow \PTmqty{a &amp; b \\ c &amp; d}$ &amp; groups a set of matrix elements into a single object \\
&amp; \verb|\PTmqty(a &amp; b \\ c &amp; d)| $\rightarrow {\PTmqty(a &amp; b \\ c &amp; d)}$ &amp; parentheses \\
&amp; \verb|\PTmqty*(a &amp; b \\ c &amp; d)| $\rightarrow {\PTmqty*(a &amp; b \\ c &amp; d)}$ &amp; alternate parentheses \\
&amp; \verb|\PTmqty[a &amp; b \\ c &amp; d]| $\rightarrow {\PTmqty[a &amp; b \\ c &amp; d]}$ &amp; square brackets \\
&amp; \verb|\PTmqty| \texttt{|} \verb|a &amp; b \\ c &amp; d| \texttt{|} $\rightarrow {\PTmqty|a &amp; b \\ c &amp; d|}$ &amp; vertical bars \\
&amp; \verb|\omqty{}| $\leftrightarrow$ \verb|\PTmqty{}| &amp; \multirow{2}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
&amp; \verb|\pmqty{}| $\leftrightarrow$ \verb|\PTmqty()| &amp; \\
&amp; \verb|\PTpmqty{}| $\leftrightarrow$ \verb|\PTmqty()| &amp; \\
&amp; \verb|\PTpmqty*{}| $\leftrightarrow$ \verb|\PTmqty*{}| &amp; \\
&amp; \verb|\Pmqty{}| $\leftrightarrow$ \verb|\PTmqty*()| &amp; \\
&amp; \verb|\bmqty{}| $\leftrightarrow$ \verb|\PTmqty[]| &amp; \\
&amp; \verb|\vmqty{}| $\leftrightarrow$ \verb+\PTmqty||+ &amp; \\\hline
\verb|\PTsmallmatrixquantity| &amp; \verb|\PTsmqty{a &amp; b \\ c &amp; d}| $\rightarrow \PTsmqty{a &amp; b \\ c &amp; d}$ &amp; the \texttt{smallmatrix} form of \verb|\PTmqty| \\
&amp; \verb|\PTsmqty()| \qor \verb|\spmqty{}| \qor \verb|\PTspmqty{}| &amp; small version of \verb|\PTmqty()| \\
&amp; \verb|\PTsmqty*()| \qor \verb|\sPmqty{}| \qor \verb|\PTspmqty*{}| &amp; small version of \verb|\PTmqty*()|\\
&amp; \verb|\PTsmqty[]| \qor \verb|\sbmqty{}| &amp; small version of \verb|\PTmqty[]| \\
&amp; \verb+\PTsmqty||+ \qor \verb|\svmqty{}| &amp; small version of \verb+\PTmqty||+ \\\hline
\verb|\matrixdeterminant| &amp; \verb|\mdet{a &amp; b \\ c &amp; d}| $\rightarrow {\mdet{a &amp; b \\ c &amp; d}}$ &amp; matrix determinant \\
&amp; \verb|\smdet{a &amp; b \\ c &amp; d}| $\rightarrow {\smdet{a &amp; b \\ c &amp; d}}$ &amp; small matrix determinant \\\hline
\verb|\identitymatrix| &amp; \verb|\imat{n}| &amp; elements of $n \times n$ identity matrix \\
&amp; \verb|\PTmqty(\imat{3})| $\rightarrow \PTmqty(\imat{3})$ &amp; formatted with \verb|\PTmqty| or \verb|\PTsmqty| \\\hline
\verb|\PTxmatrix| &amp; \verb|\PTxmat{x}{n}{m}| &amp; \multirow{4}{*}{\parbox{6cm}{elements of $n \times m$ matrix filled with $x$, if not provided, $1$ is used}} \\
&amp; \verb|\PTmqty(\PTxmat{x}{3}{3})| $\rightarrow \PTmqty(\PTxmat{x}{3}{3})$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{}{3})| $\rightarrow \PTmqty(\PTxmat{x}{}{3})$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{3}{})| $\rightarrow \PTmqty(\PTxmat{x}{3}{})$ &amp; \\
&amp; \verb|\PTxmat*{x}{n}{m}| &amp; \multirow{4}{*}{\parbox{6cm}{star for element indices, skip row/column indices $n=1$/$m=1$}} \\
&amp; \verb|\PTmqty(\PTxmat*{x}{3}{3})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3})$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat*{x}{1}{3})| $\rightarrow \PTmqty(\PTxmat*{x}{1}{3})$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat*{x}{3}{1})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{1})$ &amp; \\
&amp; \verb|\PTxmat{x}{n}{m}[p]| &amp; \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}} \\
&amp; \verb|\PTmqty(\PTxmat{x}{5}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{3}[3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{3}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{3}{3}[3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{}{3}[3])| $\rightarrow \PTmqty(\PTxmat{x}{}{3}[3])$ &amp; \\
&amp; \verb|\PTxmat{x}{n}{m}[p][q]| &amp; \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}} \\
&amp; \verb|\PTmqty(\PTxmat{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{5}[3][3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{5}{3}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{3}[3][3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{3}{3}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{3}{3}[3][3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{5}{}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{5}{}[3][3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat{x}{}{}[3][3])| $\rightarrow \PTmqty(\PTxmat{x}{}{}[3][3])$ &amp; \\
&amp; \verb|\PTxmat*{x}{n}{m}{g}| &amp; \multirow{3}{*}{\parbox{6cm}{customize last row's element indices to $g$}} \\
&amp; \verb|\PTmqty(\PTxmat*{x}{3}{3}{A})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3}{A})$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat*{x}{5}{5}[3][3]{A})| $\rightarrow \PTmqty(\PTxmat*{x}{5}{5}[3][3]{A})$ &amp; \\
&amp; \verb|\PTxmat*{x}{n}{m}{g}{h}| &amp; \multirow{3}{*}{\parbox{6cm}{customize last row's element indices to $g$ and last column's element indices to $h$}} \\
&amp; \verb|\PTmqty(\PTxmat*{x}{3}{3}{A}{B})| $\rightarrow \PTmqty(\PTxmat*{x}{3}{3}{A}{B})$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat*{x}{5}{5}[3][3]{A}{B})| $\rightarrow \PTmqty(\PTxmat*{x}{5}{5}[3][3]{A}{B})$ &amp; \\
&amp; \verb|\PTxmat[0 or 1 or 2]{x}{n}{m}[p][q]| &amp; \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}} \\
&amp; \verb|\PTmqty(\PTxmat[0]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[0]{x}{5}{5}[3][3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat[1]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[1]{x}{5}{5}[3][3])$ &amp; \\
&amp; \verb|\PTmqty(\PTxmat[2]{x}{5}{5}[3][3])| $\rightarrow \PTmqty(\PTxmat[2]{x}{5}{5}[3][3])$ &amp; \\\hline
\verb|\zeromatrix| &amp; \verb|\zmat{n}{m}| &amp; \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}} \\
&amp; \verb|\PTmqty(\zmat{2}{2})| $\rightarrow \PTmqty(\zmat{2}{2})$ &amp; \\
&amp; \verb|\PTmqty(\zmat{2})| $\rightarrow \PTmqty(\zmat{2})$ &amp; \\\hline
\verb|\paulimatrix| &amp; \verb|\pmat{n}| &amp; $n^\text{th}$ Pauli matrix \\
&amp; \verb|\PTmqty(\pmat{0})| $\rightarrow \PTmqty(\pmat{0})$ &amp; $n\in \lbrace 0,1,2,3$ or $x,y,z \rbrace$ \\
&amp; \verb|\PTmqty(\pmat{1})| $\rightarrow \PTmqty(\pmat{1})$ &amp; \\
&amp; \verb|\PTmqty(\pmat{2})| $\rightarrow \PTmqty(\pmat{2})$ &amp; \\
&amp; \verb|\PTmqty(\pmat{3})| $\rightarrow \PTmqty(\pmat{3})$ &amp; \\\hline
\verb|\diagonalmatrix| &amp; \verb|\dmat{a,b,c,...}| &amp; \multirow{2}{*}{\parbox{6cm}{specify up to eight diagonal or block diagonal elements}} \\
&amp; \verb|\PTmqty(\dmat{1,2,3})| $\rightarrow \PTmqty(\dmat{1,2,3})$ &amp; \\
&amp; \verb|\PTmqty(\dmat[0]{1,2})| $\rightarrow \PTmqty(\dmat[0]{1,2})$ &amp; optional argument to fill spaces \\
&amp; \verb|\PTmqty(\dmat{1,2&amp;3\\4&amp;5})| $\rightarrow \PTmqty(\dmat{1,2&amp;3\\4&amp;5})$ &amp; enter matrix elements for each block as a single diagonal element \\\hline
\verb|\antidiagonalmatrix| &amp; \verb|\admat{a,b,c,...}| &amp; same as syntax as \verb|\dmat| \\
&amp; \verb|\PTmqty(\admat{1,2,3})| $\rightarrow \PTmqty(\admat{1,2,3})$ &amp; \\\hline
\end{longtable}
}
\subsection{Symbols}
\begin{center}\begin{tabular}{ | C{6cm} | C{6cm} | }
\hline
\verb|\lparen| $\rightarrow\; ($ &amp;\\\hline
\verb|\rparen| $\rightarrow\; )$ &amp;\\\hline
\verb|\ordersymbol| $\rightarrow \ordersymbol$ &amp; \\\hline
\verb|\typical| $\rightarrow \typical$ &amp; \\\hline
\verb|\tall| $\rightarrow \tall$ &amp; \\\hline
\verb|\grande| $\rightarrow \grande$ &amp; \\\hline
\verb|\venti| $\rightarrow \venti$ &amp; \\\hline
\verb|\parallelsum| $\rightarrow \parallelsum$ &amp; \\\hline
\verb|\calE|$\rightarrow$\verb|\mathcal{E}| &amp; \\\hline
\verb|\bbR|$\rightarrow$\verb|\mathbb{R}| &amp; \\\hline
\verb|\bbC|$\rightarrow$\verb|\mathbb{C}| &amp; \\\hline
\verb|\bbQ|$\rightarrow$\verb|\mathbb{Q}| &amp; \\\hline
\verb|\bbN|$\rightarrow$\verb|\mathbb{N}| &amp; \\\hline
\verb|\bbZ|$\rightarrow$\verb|\mathbb{Z}| &amp; \\\hline
\verb|\bell|$\rightarrow$\verb|\boldsymbol{\ell}| &amp; \\\hline
\verb|\btau|$\rightarrow$\verb|\boldsymbol{\tau}| &amp; \\\hline
\verb|\Vtextvisiblespace[width]| $\rightarrow$ \Vtextvisiblespace &amp; \parbox{6cm}{a visible space character, where the optional argument, defaulting to \texttt{.3em}, sets the width of the horizontal rule}\\\hline
\end{tabular}\end{center}
\subsection{Shorthands for Greek alphabet}
If option \texttt{shortgreek} is used, the following shorthands will be defined for every uppercase and lowercase Greek letter:\\
\begin{center}\begin{tabular}{ | C{6cm} | C{10cm} | }
\hline
\verb|\tgAlpha| $\rightarrow$ \verb|\text{\textAlpha}}| &amp; accept an optional argument argument in \texttt{\{\}} that is simply skipped \\\hline
\verb|\vAlpha| $\rightarrow$ \verb|\varAlpha| &amp; \\\hline
\verb|\uAlpha| $\rightarrow$ \verb|\upAlpha| &amp; \\\hline
\verb|\uvAlpha| $\rightarrow$ \verb|\upvarAlpha| &amp; \\\hline
\end{tabular}\end{center}
Note that these donâ€™t ensure those commands are defined.
\subsection{Shorthands for mathrm alphabet and chemical element symbols}
If option \texttt{shortmathrm} is used, the following shorthands will be defined for every uppercase and lowercase English letter and every chemical element symbols (\verb|A\verb| for example):\\
\begin{longtable}[l]{ | C{6cm} | C{6cm} | }
\hline
\verb|\rmA_a^b| $\rightarrow\mathrm{A}_a^b$ &amp; work in both math mode and text mode
\\\hline
\end{longtable}
which are implemented with:
\begin{lstlisting}[language=TeX]
\DeclareDocumentCommand{\rmA}{e{_^}}{\ensuremath{\mathrm{A}\IfValueTF{#1}{_{#1}}{}\IfValueTF{#2}{^{#2}}{}}}
\end{lstlisting}
\subsection{Shorthands for textnormal alphabet}
If option \texttt{shorttext} is used, the following shorthands will be defined for every uppercase and lowercase English letter (\verb|A\verb| for example):\\
\begin{longtable}{| l |}
\hline
\verb|\txA| $\rightarrow$ \verb|\textnormal{A}|
\\\hline
\end{longtable}
\end{document}</pre></body></html>