summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/physics/physics.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-12-21 00:14:35 +0000
committerKarl Berry <karl@freefriends.org>2012-12-21 00:14:35 +0000
commit2c4e98f4a8f057d2b65327ddea8801115ade7e3e (patch)
tree7d4e79c1549ce1202ce6aa676136125336a5cd14 /Master/texmf-dist/doc/latex/physics/physics.tex
parent73f8591735e08fcbd2c9745c7878d0afae79820f (diff)
physics (20dec12)
git-svn-id: svn://tug.org/texlive/trunk@28590 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/physics/physics.tex')
-rw-r--r--Master/texmf-dist/doc/latex/physics/physics.tex315
1 files changed, 253 insertions, 62 deletions
diff --git a/Master/texmf-dist/doc/latex/physics/physics.tex b/Master/texmf-dist/doc/latex/physics/physics.tex
index 5a634b1ee95..34081efbc5e 100644
--- a/Master/texmf-dist/doc/latex/physics/physics.tex
+++ b/Master/texmf-dist/doc/latex/physics/physics.tex
@@ -2,19 +2,39 @@
\usepackage{fullpage}
\usepackage{parskip}
\usepackage{physics}
+\usepackage{amssymb}
+\usepackage{xcolor}
\usepackage[colorlinks,urlcolor=blue]{hyperref}
\usepackage{array}
\usepackage{longtable}
\usepackage{multirow}
-\newcommand\Vtextvisiblespace[1][.3em]{%
+\newcolumntype{M}{>{$\displaystyle}c<{$}}
+\newcolumntype{L}{>{$\displaystyle}l<{$}}
+
+\newcommand\Vtextvisiblespace[1][.3em]
+{%
\mbox{\kern.06em\vrule height.3ex}%
\vbox{\hrule width#1}%
- \hbox{\vrule height.3ex}}
+ \hbox{\vrule height.3ex}
+}
+
+\newcommand{\cbox}[2][cyan]
+{\mathchoice
+ {\setlength{\fboxsep}{0pt}\colorbox{#1}{$\displaystyle#2$}}
+ {\setlength{\fboxsep}{0pt}\colorbox{#1}{$\textstyle#2$}}
+ {\setlength{\fboxsep}{0pt}\colorbox{#1}{$\scriptstyle#2$}}
+ {\setlength{\fboxsep}{0pt}\colorbox{#1}{$\scriptscriptstyle#2$}}
+}
+
+\newcommand{\typical}{\cbox{\phantom{A}}}
+\newcommand{\tall}{\cbox{\phantom{A^{\vphantom{x^x}}_x}}}
+\newcommand{\grande}{\cbox{\phantom{\frac{1}{xx}}}}
+\newcommand{\venti}{\cbox{\phantom{\sum_x^x}}}
-% physics 1.20
+% physics 1.30
\title{The \texttt{physics} package}
-\author{Sergio C. de la Barrera}
+\author{Sergio C. de la Barrera \\ \texttt{physics.tex@gmail.com}}
\begin{document}
\maketitle
@@ -42,29 +62,44 @@ To use the \texttt{physics} package, simply insert \verb|\usepackage{physics}| i
\section{List of commands}
\subsection{Automatic bracing}
\begin{longtable}[l]{ l l p{6cm} }
-\verb|\quantity| & \verb|\qty(a+b)| $\rightarrow \qty(a+b)$ & automatic $\qty(\;)$ braces \\
-& \verb|\qty[a+b]| $\rightarrow \qty[a+b]$ & automatic $\qty[\;]$ braces \\
-& \verb|\qty| \!\!\texttt{|}\!\! \verb|a+b| \!\!\texttt{|} $\rightarrow \qty|a+b|$ & automatic $\qty|\;|$ braces \\
-& \verb|\qty{a+b}| $\rightarrow \qty{a+b}$ & automatic $\qty{\;}$ braces \\
+\verb|\quantity| & \verb|\qty(\typical)| $\displaystyle\rightarrow \qty(\typical)$ & automatic $\qty(\;)$ braces \\
+& \verb|\qty(\tall)| $\displaystyle\rightarrow \qty(\tall)$ & \\
+& \verb|\qty(\grande)| $\displaystyle\rightarrow \qty(\grande)$ & \\
+& \verb|\qty[\typical]| $\rightarrow \qty[\typical]$ & automatic $\qty[\;]$ braces \\
+& \verb+\qty|\typical|+ $\rightarrow \qty|\typical|$ & automatic $\qty|\;|$ braces \\
+& \verb|\qty{\typical}| $\rightarrow \qty{\typical}$ & automatic $\qty{\;}$ braces \\
& \verb|\qty\big{}| $\rightarrow \qty\big{}$ & \multirow{2}{*}{\parbox{6cm}{manual sizing (works with any of the above bracket types)}} \\
& \verb|\qty\Big{}| $\rightarrow \qty\Big{}$ & \\
& \verb|\qty\bigg{}| $\rightarrow \qty\bigg{}$ & \\
& \verb|\qty\Bigg{}| $\rightarrow \qty\Bigg{}$ & \\
+& \verb|\pqty{}| $\leftrightarrow$ \verb|\qty()| & \multirow{2}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
+& \verb|\bqty{}| $\leftrightarrow$ \verb|\qty[]| & \\
+& \verb+\vqty{}+ $\leftrightarrow$ \verb+\qty||+ & \\
+& \verb|\Bqty{}| $\leftrightarrow$ \verb|\qty{}| & \\
\verb|\absolutevalue| & \verb|\abs{a}| $\rightarrow \abs{a}$ & automatic sizing; equivalent to \verb|\qty| \!\!\texttt{|a|} \\
& \verb|\abs\Big{a}| $\rightarrow \abs\Big{a}$ & inherits manual sizing syntax from \verb|\qty| \\
+& \verb|\abs*{\grande}| $\displaystyle\rightarrow \abs*{\grande}$ & star for no resize \\
\verb|\norm| & \verb|\norm{a}| $\rightarrow \norm{a}$ & automatic sizing \\
& \verb|\norm\Big{a}| $\rightarrow \norm\Big{a}$ & manual sizing \\
-\verb|\evaluated| & \verb|\eval{x}_0^\infty| $\displaystyle\rightarrow \eval{x}_0^\infty$ & automatic right vertical bar for evaluation limits \\
-& \verb|\eval(x)_y| $\displaystyle\rightarrow \eval(x)_y$ & parenthetical form for holding values constant \\
+& \verb|\norm*{\grande}| $\displaystyle\rightarrow \norm*{\grande}$ & star for no resize \\
+\verb|\evaluated| & \verb|\eval{x}_0^\infty| $\displaystyle\rightarrow \eval{x}_0^\infty$ & vertical bar for evaluation limits \\
+& \verb|\eval(x| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval(x|_0^\infty$ & alternate form \\
+& \verb|\eval[x| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval[x|_0^\infty$ & alternate form \\
+& \verb|\eval[\venti| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval[\venti|_0^\infty$ & automatic sizing\\
+& \verb|\eval*[\venti| \!\!\texttt{|}\!\! \verb|_0^\infty| $\displaystyle\rightarrow \eval*[\venti|_0^\infty$ & star for no resize \\
\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 \\
\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 \\
\verb|\anticommutator| & \verb|\acomm{A}{B}| $\rightarrow \acomm{A}{B}$ & same as \verb|\poissonbracket| \\
-& \verb|\acommutator{A}{B}| $\rightarrow \acommutator{A}{B}$ & alternate name \\
+%& \verb|\acommutator{A}{B}| $\rightarrow \acommutator{A}{B}$ & alternate name \\
\verb|\poissonbracket| & \verb|\pb{A}{B}| $\rightarrow \pb{A}{B}$ & same as \verb|\anticommutator|
\end{longtable}
\subsection{Vector notation}
+The default del symbol $\vnabla$ used in \texttt{physics} vector notation can be switched to appear with an arrow $\vec{\vnabla}$ by including the option \texttt{arrowdel} in the document preamble $\rightarrow$ \verb|\usepackage[arrowdel]{physics}|.
\begin{longtable}[l]{ l l p{6cm} }
\verb|\vectorbold| & \verb|\vb{a}| $\rightarrow \vb{a}$ & upright/no Greek \\
& \verb|\vb*{a}|, \verb|\vb*{\theta}| $\rightarrow \vb*{a}$, $\vb*{\theta}$ & italic/Greek \\
@@ -72,56 +107,105 @@ To use the \texttt{physics} package, simply insert \verb|\usepackage{physics}| i
& \verb|\va*{a}|, \verb|\va*{\theta}| $\rightarrow \va*{a}$, $\va*{\theta}$ & italic/Greek \\
\verb|\vectorunit| & \verb|\vu{a}| $\rightarrow \vu{a}$ & upright/no Greek \\
& \verb|\vu*{a}|, \verb|\vu*{\theta}| $\rightarrow \vu*{a}$, $\vu*{\theta}$ & italic/Greek \\
-\verb|\dotproduct| & \verb|\vdot| $\rightarrow \vdot$ as in $\vb{a} \vdot \vb{b}$ & note that \verb|\dp| is a protected \TeX\ primitive \\
-\verb|\crossproduct| & \verb|\cross| $\rightarrow \cross$ as in $\vb{a} \cross \vb{b}$ & \\
-& \verb|\cp| $\rightarrow \cp$ as in $\vb{a} \cp \vb{b}$ & alternate name \\
-\verb|\vnabla| & \verb|\vnabla| $\rightarrow \vnabla$ versus $\nabla$ & low-level macro for bold version \\
+\verb|\dotproduct| & \verb|\vdot| $\rightarrow \vdot$ as in $\vb{a} \vdot \vb{b}$ & note: \verb|\dp| is a protected \TeX\ primitive \\
+\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 \\
\verb|\gradient| & \verb|\grad| $\rightarrow \grad$ & \\
& \verb|\grad{\Psi}| $\rightarrow \grad{\Psi}$ & default mode \\
-& \verb|\grad(\Psi+\Phi)| $\rightarrow \grad(\Psi+\Phi)$ & long-form (like \verb|\qty| but also handles spacing) \\
-& \verb|\grad[\Psi+\Phi]| $\rightarrow \grad[\Psi+\Phi]$ & \\
-\verb|\divergence| & \verb|\div| $\rightarrow \div$ & note \texttt{amsmath} symbol $\divisionsymbol$ renamed \verb|\divisionsymbol| \\
+& \verb|\grad(\Psi+\tall)| $\displaystyle\rightarrow \grad(\Psi+\tall)$ & long-form (like \verb|\qty| but also handles spacing) \\
+& \verb|\grad[\Psi+\tall]| $\displaystyle\rightarrow \grad[\Psi+\tall]$ & \\
+\verb|\divergence| & \verb|\div| $\rightarrow \div$ & note: \texttt{amsmath} symbol $\divisionsymbol$ renamed \verb|\divisionsymbol| \\
& \verb|\div{\vb{a}}| $\rightarrow \div{\vb{a}}$ & default mode \\
-& \verb|\div(\vb{a}+\vb{b})| $\rightarrow \div(\vb{a}+\vb{b})$ & long-form \\
-& \verb|\div[\vb{a}+\vb{b}]| $\rightarrow \div[\vb{a}+\vb{b}]$ & \\
+& \verb|\div(\vb{a}+\tall)| $\displaystyle\rightarrow \div(\vb{a}+\tall)$ & long-form \\
+& \verb|\div[\vb{a}+\tall]| $\displaystyle\rightarrow \div[\vb{a}+\tall]$ & \\
\verb|\curl| & \verb|\curl| $\rightarrow \curl$ & \\
& \verb|\curl{\vb{a}}| $\rightarrow \curl{\vb{a}}$ & default mode \\
-& \verb|\curl(\vb{a}+\vb{b}})| $\rightarrow \curl(\vb{a}+\vb{b})$ & long-form \\
-& \verb|\curl[\vb{a}+\vb{b}]| $\rightarrow \curl[\vb{a}+\vb{b}]$ & \\
+& \verb|\curl(\vb{a}+\tall)| $\displaystyle\rightarrow \curl(\vb{a}+\tall)$ & long-form \\
+& \verb|\curl[\vb{a}+\tall]| $\displaystyle\rightarrow \curl[\vb{a}+\tall]$ & \\
\verb|\laplacian| & \verb|\laplacian| $\rightarrow \laplacian$ & \\
& \verb|\laplacian{\Psi}| $\rightarrow \laplacian{\Psi}$ & default mode \\
-& \verb|\laplacian(\Psi+\Phi)| $\rightarrow \laplacian(\Psi+\Phi)$ & long-form \\
-& \verb|\laplacian[\Psi+\Phi]| $\rightarrow \laplacian[\Psi+\Phi]$ &
+& \verb|\laplacian(\Psi+\tall)| $\displaystyle\rightarrow \laplacian(\Psi+\tall)$ & long-form \\
+& \verb|\laplacian[\Psi+\tall]| $\displaystyle\rightarrow \laplacian[\Psi+\tall]$ &
\end{longtable}
\subsection{Operators}
-The standard set of trig functions is redefined in \texttt{physics} to provide automatic braces that behave like \verb|\qty()|. In addition, an optional power argument is provided. The old definition of each trig function is stored in a long form version as in \verb|\sin| $\rightarrow$ \verb|\sine|, \verb|\cos| $\rightarrow$ \verb|\cosine|, and so on.
-\begin{longtable}[l]{ l l p{8cm} }
-\multicolumn{3}{l}{Trig redefinitions:} \\
-\verb|\sin| & \verb|\sin(x)| $\rightarrow \sin(x)$ & automatic braces; old \verb|\sin| renamed \verb|\sine| \\
+The standard set of trig functions is redefined in \texttt{physics} to provide automatic braces that behave like \verb|\qty()|. In addition, an optional power argument is provided. This behavior can be switched off by including the option \texttt{notrig} in the preamble $\rightarrow$ \verb|\usepackage[notrig]{physics}|.
+
+\begin{tabular}[l]{ l l p{8cm} }
+\multicolumn{3}{l}{Example trig redefinitions:} \\
+\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|\cos| & \verb|\cos(x)| $\rightarrow \cos(x)$ & works with all trig functions \\
-\verb|\tan| & \verb|\tan x| $\rightarrow \tan x$ & can still use without an argument \\
-$\quad\vdots$ & & $\qquad\vdots$ \\
+& \verb|\sin x| $\rightarrow \sin x$ & can still use without an argument
+\end{tabular}
+
+The full set of available trig functions in \texttt{physics} includes:
+
+\begin{tabular}{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)|
+\end{tabular}$\Rightarrow$
+\begin{tabular}{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)
+\end{tabular}
+
+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{tabular}{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|
+\end{tabular}
+
+Similar behavior has also been extended to the following functions:
+
+\begin{tabular}{l>{$}l<{$}ll}
+\verb|\exp(\tall)| & \exp(\tall) & & \verb|\exponential| \\
+\verb|\log(\tall)| & \log(\tall) & & \verb|\logarithm| \\
+\verb|\ln(\tall)| & \ln(\tall) & old definitions $\Rightarrow$ & \verb|\naturallogarithm| \\
+\verb|\det(\tall)| & \det(\tall) & & \verb|\determinant| \\
+\verb|\Pr(\tall)| & \Pr(\tall) & & \verb|\Probability|
+\end{tabular}
+
+\begin{longtable}[l]{ l l p{8cm} }
\multicolumn{3}{l}{New operators:} \\
-\verb|\tr| & \verb|\tr\rho| $\rightarrow \tr\rho$ & trace \\
+\verb|\trace| or \verb|\tr| & \verb|\tr\rho| $\rightarrow \tr\rho$ also \verb|\tr(\tall)| $\rightarrow \tr(\tall)$ & trace; same bracing as trig functions \\
+\verb|\Trace| or \verb|\Tr| & \verb|\Tr\rho| $\rightarrow \Tr\rho$ & alternate \\
\verb|\rank| & \verb|\rank M| $\rightarrow \rank M$ & matrix rank \\
-\verb|\erf| & \verb|\erf(x)|$\rightarrow \erf(x)$ & Gauss error function
+\verb|\erf| & \verb|\erf(x)|$\rightarrow \erf(x)$ & Gauss error function \\
+\verb|\Res| & \verb|\Res[f(z)]|$\rightarrow \Res[f(z)]$ & residue; same bracing as trig functions \\
+\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 \\
+\verb|\Re| & \verb|\Re{z}| $\rightarrow \Re{z}$ & old \verb|\Re| renamed to \verb|\real| $\rightarrow \real$ \\
+\verb|\Im| & \verb|\Im{z}| $\rightarrow \Im{z}$ & old \verb|\Im| renamed to \verb|\imaginary| $\rightarrow \imaginary$
\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]{ l l p{6cm} }
+
+\begin{tabular}[l]{ l l p{6cm} }
General text: & & \\
\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
-\end{longtable}
+\end{tabular}
+
\begin{longtable}[l]{ l l }
Special macros: & \\
\verb|\qcomma| or \verb|\qc| $\rightarrow ,$\Vtextvisiblespace[1em] & right \verb|\quad| only \\
\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] \\
-\verb|\qif| $\rightarrow$\Vtextvisiblespace[1em]$\text{if}$\Vtextvisiblespace[1em] & left and right \verb|\quad| unless starred \verb|\qif*| $\rightarrow \text{if}$\Vtextvisiblespace[1em] \\
+\verb|\qif| $\rightarrow$\Vtextvisiblespace[1em]$\text{if}$\Vtextvisiblespace[1em] & left and right \verb|\quad| unless starred \verb|\qif*| $\rightarrow \text{if}$\Vtextvisiblespace[1em]
\end{longtable}
\begin{longtable}[l]{ l }
Similar to \verb|\qif|: \\
@@ -130,27 +214,31 @@ Similar to \verb|\qif|: \\
\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 $\rightarrow$ \verb|\usepackage[italicdiff]{physics}|.
\begin{longtable}[l]{ l l p{6cm} }
\verb|\differential| & \verb|\dd| $\rightarrow \dd$ & \\
-& \verb|\dd x| $\rightarrow \dd x$ & no spacing; use in braces, fractions \\
-& \verb|\dd{x}| $\rightarrow \dd{x}$\!\textvisiblespace & proper spacing for typical equations \\
-& \verb|\dd[3]{x}| $\rightarrow \dd[3]{x}$\!\textvisiblespace & optional power \\
+& \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 \\
\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}(x^2+x)| $\displaystyle\rightarrow \dv{x}(x^2+x)$ & long-form; automatic braces, spacing \\
+& \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| \\
\verb|\partialderivative| & \verb|\pderivative{x}| $\displaystyle\rightarrow \pderivative{x}$ & alternate name \\
& \verb|\pdv{x}| $\displaystyle\rightarrow \pdv{x}$ & shorthand name \\
& \verb|\pdv{f}{x}| $\displaystyle\rightarrow \pdv{f}{x}$ & two arguments \\
& \verb|\pdv[n]{f}{x}| $\displaystyle\rightarrow \pdv[n]{f}{x}$ & optional power \\
-& \verb|\pdv{x}(x+y)| $\displaystyle\rightarrow \pdv{x}(x+y)$ & long-form \\
+& \verb|\pdv{x}(\grande)| $\displaystyle\rightarrow \pdv{x}(\grande)$ & long-form \\
& \verb|\pdv{f}{x}{y}| $\displaystyle\rightarrow \pdv{f}{x}{y}$ & mixed partial \\
+& \verb|\pdv*{f}{x}| $\displaystyle\rightarrow \pdv*{f}{x}$ & inline form using \verb|\flatfrac| \\
\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 \\
\verb|\functionalderivative| & \verb|\fdv{g}| $\displaystyle\rightarrow \fdv{g}$ & functional derivative (works like \verb|\dv|) \\
& \verb|\fdv{F}{g}| $\displaystyle\rightarrow \fdv{F}{g}$ & \\
-& \verb|\fdv{V}(E-TS)| $\displaystyle\rightarrow \fdv{V}(E-TS)$ & long-form
+& \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|
\end{longtable}
\subsection{Dirac bra-ket notation}
@@ -167,25 +255,128 @@ On the other hand, the correct output can be generated by sticking to the fundam
\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]{ l l p{6cm} }
-\verb|\ket| & \verb|\ket{\psi}| $\rightarrow \ket{\psi}$ & automatic sizing \\
-& \verb|\ket*{\psi}| $\rightarrow \ket*{\psi}$ & complex conjugate (looks like \verb|\bra| but does not inherit contraction) \\
-\verb|\bra| & \verb|\bra{\psi}| $\rightarrow \bra{\psi}$ & automatic sizing \\
-& \verb|\bra*{\psi}| $\rightarrow \bra*{\psi}$ & complex conjugate (looks like \verb|\ket| but does not inherit contraction) \\
-& \verb|\bra{\phi}\ket{\psi}| $\rightarrow \bra{\phi}\ket{\psi}$ & automatic contraction \\
-\verb|\innerproduct| & \verb|\braket{a}{b}| $\rightarrow \braket{a}{b}$ & two-argument contraction; automatic sizing \\
-& \verb|\braket{a}| $\rightarrow \braket{a}$ & single-argument; produces norm \\
-& \verb|\braket*{a}{b}| $\rightarrow \braket*{a}{b}$ & complex conjugate; swaps arguments \\
-& \verb|\ip{a}{b}| $\rightarrow \ip{a}{b}$ & shorthand name \\
-\verb|\outerproduct| & \verb|\dyad{a}{b}| $\rightarrow \dyad{a}{b}$ & two-argument dyad; automatic sizing \\
-& \verb|\dyad{a}| $\rightarrow \dyad{a}$ & single-argument; produces projector \\
-& \verb|\dyad*{a}{b}| $\rightarrow \dyad*{a}{b}$ & complex conjugate; swaps arguments \\
-& \verb|\ketbra{a}{b}| $\rightarrow \ketbra{a}{b}$ & alternative name \\
-& \verb|\op{a}{b}| $\rightarrow \op{a}{b}$ & shorthand name \\
-\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|\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 \\
+\begin{longtable}[l]{ l L p{6cm} }
+\verb|\ket| & \verb|\ket{\tall}| \rightarrow \ket{\tall} & automatic sizing \\
+& \verb|\ket*{\tall}| \rightarrow \ket*{\tall} & no resize \\
+\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} & \\
+\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 \\
+\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 \\
+\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 \\
+\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
\end{longtable}
+
+\subsection{Matrix macros}
+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 $\smqty{\imat{2}}$ without braces or grouping. This allows the command to also be used within another matrix, as in:
+
+\begin{minipage}{3cm}
+\begin{verbatim}
+\begin{pmatrix}
+\imat{2} \\ a & b
+\end{pmatrix}
+\end{verbatim}
+\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|\matrixquantity| or \verb|\mqty| to effectively convert \verb|\imat{2}| into a single matrix element of a larger matrix:
+
+\begin{minipage}{9cm}
+\begin{verbatim}
+\begin{pmatrix}
+\mqty{\imat{2}} & \mqty{a\\b} \\ \mqty{c & d} & e
+\end{pmatrix}
+\end{verbatim}
+\end{minipage}
+\begin{minipage}{6cm}
+\begin{displaymath}
+\Rightarrow\qquad
+\begin{pmatrix}
+\mqty{\imat{2}} & \mqty{a\\b} \\ \mqty{c & d} & e
+\end{pmatrix}
+\end{displaymath}
+\end{minipage}
+
+The extra \verb|\mqty| groups were required in this case in order to get the $a$ and $b$ elements to behave as a single element, since \verb|\mqty{\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} macro \verb|\mqty()|, allowing the above example to be written on one line:
+
+\begin{minipage}{9cm}
+\begin{verbatim}
+\mqty(\mqty{\imat{2}} & \mqty{a\\b} \\ \mqty{c & d} & e)
+\end{verbatim}
+\end{minipage}
+\begin{minipage}{6cm}
+\begin{displaymath}
+\Rightarrow\qquad
+\mqty(\mqty{\imat{2}} & \mqty{a\\b} \\ \mqty{c & d} & e)
+\end{displaymath}
+\end{minipage}
+
+\begin{longtable}[l]{ l L p{6cm} }
+\verb|\matrixquantity| & \verb|\mqty{a & b \\ c & d}| \rightarrow \mqty{a & b \\ c & d} & groups a set of matrix elements into a single object \\
+& \verb|\mqty(a & b \\ c & d)| \rightarrow {\mqty(a & b \\ c & d)} & parentheses \\
+& \verb|\mqty*(a & b \\ c & d)| \rightarrow {\mqty*(a & b \\ c & d)} & alternate parentheses \\
+& \verb|\mqty[a & b \\ c & d]| \rightarrow {\mqty[a & b \\ c & d]} & square brackets \\
+& \verb|\mqty| \texttt{|} \verb|a & b \\ c & d| \texttt{|} \rightarrow {\mqty|a & b \\ c & d|} & vertical bars \\
+& \verb|\pmqty{}| \leftrightarrow \verb|\mqty()| & \multirow{2}{*}{\parbox{6cm}{alternative syntax; robust and more \LaTeX-friendly}} \\
+& \verb|\Pmqty{}| \leftrightarrow \verb|\mqty*()| & \\
+& \verb|\bmqty{}| \leftrightarrow \verb|\mqty[]| & \\
+& \verb|\vmqty{}| \leftrightarrow \verb+\mqty||+ & \\
+\verb|\smallmatrixquantity| & \verb|\smqty{a & b \\ c & d}| \rightarrow \smqty{a & b \\ c & d} & the \texttt{smallmatrix} form of \verb|\mqty| \\
+& \verb|\smqty()| \qor \verb|\spmqty{}| & small version of \verb|\mqty()| \\
+& \verb|\smqty*()| \qor \verb|\sPmqty{}| & small version of \verb|\mqty*()|\\
+& \verb|\smqty[]| \qor \verb|\sbmqty{}| & small version of \verb|\mqty[]| \\
+& \verb+\smqty||+ \qor \verb|\svmqty{}| & small version of \verb+\mqty||+ \\
+\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 \\
+\verb|\identitymatrix| & \verb|\imat{n}| & elements of $n \times n$ identity matrix \\
+& \verb|\smqty(\imat{3})| \rightarrow \smqty(\imat{3}) & formatted with \verb|\mqty| or \verb|\smqty| \\
+\verb|\xmatrix| & \verb|\xmat{x}{n}{m}| & elements of $n \times m$ matrix filled with $x$ \\
+& \verb|\smqty(\xmat{1}{2}{3})| \rightarrow \smqty(\xmat{1}{2}{3}) & formatted with \verb|\mqty| or \verb|\smqty| \\
+& \verb|\smqty(\xmat*{a}{3}{3})| \rightarrow \smqty(\xmat*{a}{3}{3}) & star for element indices \\
+& \verb|\smqty(\xmat*{a}{3}{1})| \rightarrow \smqty(\xmat*{a}{3}{1}) & as a vector with indices \\
+& \verb|\smqty(\xmat*{a}{1}{3})| \rightarrow \smqty(\xmat*{a}{1}{3}) & \\
+\verb|\zeromatrix| & \verb|\zmat{n}{m}| & $n \times m$ matrix filled with zeros \\
+& \verb|\smqty(\zmat{2}{2})| \rightarrow \smqty(\zmat{2}{2}) & equivalent to \verb|\xmat{0}{n}{m}| \\
+\verb|\paulimatrix| & \verb|\pmat{n}| & $n^\text{th}$ Pauli matrix \\
+& \verb|\smqty(\pmat{0})| \rightarrow \smqty(\pmat{0}) & $n\in \lbrace 0,1,2,3$ or $x,y,z \rbrace$ \\
+& \verb|\smqty(\pmat{1})| \rightarrow \smqty(\pmat{1}) & \\
+& \verb|\smqty(\pmat{2})| \rightarrow \smqty(\pmat{2}) & \\
+& \verb|\smqty(\pmat{3})| \rightarrow \smqty(\pmat{3}) & \\
+\verb|\diagonalmatrix| & \verb|\dmat{a,b,c,...}| & \multirow{2}{*}{\parbox{6cm}{specify up to eight diagonal or block diagonal elements}} \\
+& \verb|\mqty(\dmat{1,2,3})| \rightarrow \mqty(\dmat{1,2,3}) & \\
+& \verb|\mqty(\dmat[0]{1,2})| \rightarrow \mqty(\dmat[0]{1,2}) & optional argument to fill spaces \\
+& \verb|\mqty(\dmat{1,2&3\\4&5})| \rightarrow \mqty(\dmat{1,2&3\\4&5}) & \parbox{6cm}{enter matrix elements for each block as a single diagonal element} \\
+\verb|\antidiagonalmatrix| & \verb|\admat{a,b,c,...}| & same as syntax as \verb|\dmat| \\
+& \verb|\mqty(\admat{1,2,3})| \rightarrow \mqty(\admat{1,2,3}) & \\
+\end{longtable}
+
\end{document} \ No newline at end of file