summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/physics
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-11-02 23:33:35 +0000
committerKarl Berry <karl@freefriends.org>2012-11-02 23:33:35 +0000
commit89df75aae9d25e94c83fbf99d633236815f26b0f (patch)
tree40ed2c9876769abf61a4178c264e8ed0a3c5f97e /Master/texmf-dist/tex/latex/physics
parent3c694dfbf7d9902b827affc7e3b0e2c6322550dc (diff)
physics (2nov12)
git-svn-id: svn://tug.org/texlive/trunk@28153 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/physics')
-rw-r--r--Master/texmf-dist/tex/latex/physics/physics.sty253
1 files changed, 188 insertions, 65 deletions
diff --git a/Master/texmf-dist/tex/latex/physics/physics.sty b/Master/texmf-dist/tex/latex/physics/physics.sty
index 30205692737..36c23bf66bc 100644
--- a/Master/texmf-dist/tex/latex/physics/physics.sty
+++ b/Master/texmf-dist/tex/latex/physics/physics.sty
@@ -1,5 +1,5 @@
\ProvidesPackage{physics}
-% physics 1.10
+% physics 1.20
% This material is subject to the LaTeX Project Public License.
% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license.
%
@@ -9,41 +9,12 @@
% The commands defined in this package will silently overwrite previous commands with the same name, if such commands exist
%
% Created by Sergio C. de la Barrera
-% Updated on October 10, 2012
-% Uploaded on October 11, 2012
+% Updated on October 31, 2012
+% Uploaded on November 1, 2012
\RequirePackage{xparse}
\RequirePackage{amsmath}
-% Vector notation
-\DeclareDocumentCommand\vectorbold{ s m }{\IfBooleanTF{#1}{\boldsymbol{#2}}{\mathbf{#2}}} % Vector bold [star for Greek and italic Roman]
-\DeclareDocumentCommand\vb{}{\vectorbold} % Shorthand for \vectorbold
-
-\DeclareDocumentCommand\vectorarrow{ s m }{\IfBooleanTF{#1}{\vec{\boldsymbol{#2}}}{\vec{\mathbf{#2}}}} % Vector arrow + bold [star for Greek and italic Roman]
-\DeclareDocumentCommand\va{}{\vectorarrow} % Shorthand for \vectorarrow
-
-\DeclareDocumentCommand\vectorunit{ s m }{\IfBooleanTF{#1}{\boldsymbol{\hat{#2}}}{\mathbf{\hat{#2}}}} % Unit vector [star for Greek and italic Roman]
-\DeclareDocumentCommand\vu{}{\vectorunit} % Shorthand for \vectorunit
-
-\DeclareDocumentCommand\dotproduct{}{\boldsymbol\cdot} % Vector dot product symbol
-\DeclareDocumentCommand\vdot{}{\dotproduct} % Shorthand for \dotproduct [note that the command sequence \dp is protected]
-
-\DeclareDocumentCommand\crossproduct{}{\boldsymbol\times} % Vector cross product symbol
-\DeclareDocumentCommand\cross{}{\crossproduct} % Shorthand for \crossproduct
-\DeclareDocumentCommand\cp{}{\crossproduct} % Shorthand for \crossproduct
-
-\DeclareDocumentCommand\vnabla{}{\boldsymbol\nabla} % Vector bold \nabla symbol
-\DeclareDocumentCommand\gradient{ s g }{\IfNoValueTF{#2}{\vnabla}{\IfBooleanTF{#1}{\vnabla\!\left(#2\right)}{\vnabla #2}}} % Gradient [star for parentheses]
-\DeclareDocumentCommand\grad{}{\gradient} % Shorthand for \gradient
-
-\DeclareDocumentCommand\divergence{ s g }{\IfNoValueTF{#2}{\vnabla \vdot}{\IfBooleanTF{#1}{\vnabla \vdot \left(#2\right)}{\vnabla \vdot #2}}} % Divergence [star for parentheses]
-\let\divisionsymbol\div % Rename \div [division symbol] in order to free up control sequence for \divergence
-\let\div\relax
-\DeclareDocumentCommand\div{}{\divergence} % Shorthand for \divergence
-
-\DeclareDocumentCommand\curl{ s g }{\IfNoValueTF{#2}{\vnabla \cross}{\IfBooleanTF{#1}{\vnabla \cross \left(#2\right)}{\vnabla \cross #2}}} % Curl [star for parentheses]
-\DeclareDocumentCommand\laplacian{ s g }{\IfNoValueTF{#2}{\nabla^2}{\IfBooleanTF{#1}{\nabla^2\!\left(#2\right)}{\nabla^2 #2}}} % Laplacian [star for parentheses]
-
% Brackets and braces
\DeclareDocumentCommand\quantity{ t\big t\Big t\bigg t\Bigg g o d() d|| }{ % Flexible automatic bracketing of an expression in () or [] or {} or ||
% Handles manual override of sizing
@@ -64,11 +35,11 @@
{()}
{\ltag\lvert{#8}\rtag\rvert}
}
- {\ltag(#7\rtag) \IfNoValueTF{#8}{}{#8}}
+ {\ltag(#7\rtag) \IfNoValueTF{#8}{}{|#8|}}
}
- {\ltag[#6\rtag] \IfNoValueTF{#7}{}{[#7]} \IfNoValueTF{#8}{}{#8}}
+ {\ltag[#6\rtag] \IfNoValueTF{#7}{}{(#7)} \IfNoValueTF{#8}{}{|#8|}}
}
- {\ltag\lbrace#5\rtag\rbrace \IfNoValueTF{#6}{}{|#6|} \IfNoValueTF{#7}{}{[#7]} \IfNoValueTF{#8}{}{#8}}
+ {\ltag\lbrace#5\rtag\rbrace \IfNoValueTF{#6}{}{[#6]} \IfNoValueTF{#7}{}{(#7)} \IfNoValueTF{#8}{}{|#8|}}
}
\DeclareDocumentCommand\qty{}{\quantity} % Shorthand for \quantity
@@ -76,15 +47,40 @@
\IfBooleanTF{#1}{\quantity\big|#5|}{
\IfBooleanTF{#2}{\quantity\Big|#5|}{
\IfBooleanTF{#3}{\quantity\bigg|#5|}{
- \IfBooleanTF{#4}{\let\sizetag\Bigg}{\quantity|#5|}
+ \IfBooleanTF{#4}{\quantity\Bigg|#5|}{\quantity|#5|}
}
}
}
}
\DeclareDocumentCommand\abs{}{\absolutevalue} % Shorthand for \absolutevalue
-\DeclareDocumentCommand\norm{m}{{\left\lVert{#1}\right\rVert}} % Norm
-\DeclareDocumentCommand\order{g}{{\mathcal{O}\IfNoValueTF{#1}{}{\!\left(#1\right)}}} % Order symbol -> O(x^2)
+\DeclareDocumentCommand\norm{ t\big t\Big t\bigg t\Bigg m }{ % Norm
+ \IfBooleanTF{#1}{\bigl\lVert{#5}\bigr\rVert}{
+ \IfBooleanTF{#2}{\Bigl\lVert{#5}\Bigr\rVert}{
+ \IfBooleanTF{#3}{\biggl\lVert{#5}\biggr\rVert}{
+ \IfBooleanTF{#4}{\Biggl\lVert{#5}\Biggr\rVert}{\left\lVert{#5}\right\rVert}
+ }
+ }
+ }
+}
+\DeclareDocumentCommand\order{ t\big t\Big t\bigg t\Bigg m }{ % Order symbol -> O(x^2)
+ \IfBooleanTF{#1}{\mathcal{O}\IfNoValueTF{#5}{}{\!\quantity\big(#5)}}{
+ \IfBooleanTF{#2}{\mathcal{O}\IfNoValueTF{#5}{}{\!\quantity\Big(#5)}}{
+ \IfBooleanTF{#3}{\mathcal{O}\IfNoValueTF{#5}{}{\!\quantity\bigg(#5)}}{
+ \IfBooleanTF{#4}{\mathcal{O}\IfNoValueTF{#5}{}{\!\quantity\Bigg(#5)}}{\mathcal{O}\IfNoValueTF{#5}{}{\!\quantity(#5)}}
+ }
+ }
+ }
+}
+\DeclareDocumentCommand\evaluated{ g d() }{ % Vertical evaluation bar or parentheses
+ \IfNoValueTF{#1}{
+ \IfNoValueTF{#2}
+ {\rvert}
+ {\quantity(#2)}
+ }
+ {\left.{#1}\right\rvert \IfNoValueTF{#2}{}{(#2)}}
+ }
+\DeclareDocumentCommand\eval{}{\evaluated} % Shorthand for evaluated
\DeclareDocumentCommand\poissonbracket{ m m }{{\left\lbrace{#1},{#2}\right\rbrace}} % Poisson bracket [same as anti-commutator]
\DeclareDocumentCommand\pb{}{\poissonbracket} % Shorthand for \poissonbracket
@@ -96,7 +92,96 @@
\DeclareDocumentCommand\acommutator{}{\anticommutator} % Shorthand for \anticommutator
\DeclareDocumentCommand\acomm{}{\anticommutator} % Shorthand for \anticommutator
+% Vector notation
+\DeclareDocumentCommand\vectorbold{ s m }{\IfBooleanTF{#1}{\boldsymbol{#2}}{\mathbf{#2}}} % Vector bold [star for Greek and italic Roman]
+\DeclareDocumentCommand\vb{}{\vectorbold} % Shorthand for \vectorbold
+
+\DeclareDocumentCommand\vectorarrow{ s m }{\IfBooleanTF{#1}{\vec{\boldsymbol{#2}}}{\vec{\mathbf{#2}}}} % Vector arrow + bold [star for Greek and italic Roman]
+\DeclareDocumentCommand\va{}{\vectorarrow} % Shorthand for \vectorarrow
+
+\DeclareDocumentCommand\vectorunit{ s m }{\IfBooleanTF{#1}{\boldsymbol{\hat{#2}}}{\mathbf{\hat{#2}}}} % Unit vector [star for Greek and italic Roman]
+\DeclareDocumentCommand\vu{}{\vectorunit} % Shorthand for \vectorunit
+
+\DeclareDocumentCommand\dotproduct{}{\boldsymbol\cdot} % Vector dot product symbol
+\DeclareDocumentCommand\vdot{}{\dotproduct} % Shorthand for \dotproduct [note that the command sequence \dp is protected]
+
+\DeclareDocumentCommand\crossproduct{}{\boldsymbol\times} % Vector cross product symbol
+\DeclareDocumentCommand\cross{}{\crossproduct} % Shorthand for \crossproduct
+\DeclareDocumentCommand\cp{}{\crossproduct} % Shorthand for \crossproduct
+
+\DeclareDocumentCommand\vnabla{}{\boldsymbol\nabla} % Vector bold \nabla symbol
+\DeclareDocumentCommand\gradient{ g o d() }{ % Gradient
+ \IfNoValueTF{#1}{
+ \IfNoValueTF{#2}{
+ \IfNoValueTF{#3}{\vnabla}{\vnabla\!\quantity(#3)}
+ }
+ {\vnabla\!\quantity[#2] \IfNoValueTF{#3}{}{(#3)}}
+ }
+ {\vnabla #1 \IfNoValueTF{#2}{}{[#2]} \IfNoValueTF{#3}{}{(#3)}}
+ }
+\DeclareDocumentCommand\grad{}{\gradient} % Shorthand for \gradient
+
+\DeclareDocumentCommand\divergence{ g o d() }{ % Divergence
+ \IfNoValueTF{#1}{
+ \IfNoValueTF{#2}{
+ \IfNoValueTF{#3}{\vnabla \vdot}{\vnabla \vdot \quantity(#3)}
+ }
+ {\vnabla \vdot \quantity[#2] \IfNoValueTF{#3}{}{(#3)}}
+ }
+ {\vnabla \vdot #1 \IfNoValueTF{#2}{}{[#2]} \IfNoValueTF{#3}{}{(#3)}}
+ }
+\let\divisionsymbol\div % Rename \div [division symbol] in order to free up control sequence for \divergence
+\let\div\relax
+\DeclareDocumentCommand\div{}{\divergence} % Shorthand for \divergence
+
+\DeclareDocumentCommand\curl{ g o d() }{ % Curl
+ \IfNoValueTF{#1}{
+ \IfNoValueTF{#2}{
+ \IfNoValueTF{#3}{\vnabla \cross}{\vnabla \cross \quantity(#3)}
+ }
+ {\vnabla \cross \quantity[#2] \IfNoValueTF{#3}{}{(#3)}}
+ }
+ {\vnabla \cross #1 \IfNoValueTF{#2}{}{[#2]} \IfNoValueTF{#3}{}{(#3)}}
+ }
+
+\DeclareDocumentCommand\laplacian{ g o d() }{ % Laplacian
+ \IfNoValueTF{#1}{
+ \IfNoValueTF{#2}{
+ \IfNoValueTF{#3}{\nabla^2}{\nabla^2\!\quantity(#3)}
+ }
+ {\nabla^2\!\quantity[#2] \IfNoValueTF{#3}{}{(#3)}}
+ }
+ {\nabla^2 #1 \IfNoValueTF{#2}{}{[#2]} \IfNoValueTF{#3}{}{(#3)}}
+ }
+
% Operators
+\let\sine\sin
+\let\cosine\cos
+\let\tangent\tan
+\let\cosecant\csc
+\let\secant\sec
+\let\cotangent\cot
+\let\arcsine\arcsin
+\let\arccosine\arccos
+\let\arctangent\arctan
+\let\hypsine\sinh
+\let\hypcosine\cosh
+\let\hyptangent\tanh
+\let\hypcotangent\coth
+\DeclareDocumentCommand\sin{ o d() }{\IfNoValueTF{#2}{\sine \IfNoValueTF{#1}{}{[#1]}}{\sine \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\cos{ o d() }{\IfNoValueTF{#2}{\cosine \IfNoValueTF{#1}{}{[#1]}}{\cosine \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\tan{ o d() }{\IfNoValueTF{#2}{\tangent \IfNoValueTF{#1}{}{[#1]}}{\tangent \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\csc{ o d() }{\IfNoValueTF{#2}{\cosecant \IfNoValueTF{#1}{}{[#1]}}{\cosecant \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\sec{ o d() }{\IfNoValueTF{#2}{\secant \IfNoValueTF{#1}{}{[#1]}}{\secant \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\cot{ o d() }{\IfNoValueTF{#2}{\cotangent \IfNoValueTF{#1}{}{[#1]}}{\cotangent \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\arcsin{ o d() }{\IfNoValueTF{#2}{\arcsine \IfNoValueTF{#1}{}{[#1]}}{\arcsine \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\arccos{ o d() }{\IfNoValueTF{#2}{\arccosine \IfNoValueTF{#1}{}{[#1]}}{\arccosine \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\arctan{ o d() }{\IfNoValueTF{#2}{\arctangent \IfNoValueTF{#1}{}{[#1]}}{\arctangent \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\sinh{ o d() }{\IfNoValueTF{#2}{\hypsine \IfNoValueTF{#1}{}{[#1]}}{\hypsine \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\cosh{ o d() }{\IfNoValueTF{#2}{\hypcosine \IfNoValueTF{#1}{}{[#1]}}{\hypcosine \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\tanh{ o d() }{\IfNoValueTF{#2}{\hyptangent \IfNoValueTF{#1}{}{[#1]}}{\hyptangent \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+\DeclareDocumentCommand\coth{ o d() }{\IfNoValueTF{#2}{\hypcotangent \IfNoValueTF{#1}{}{[#1]}}{\hypcotangent \IfNoValueTF{#1}{}{^{#1}} \!\quantity(#2)}}
+
\DeclareMathOperator{\tr}{tr} % Trace and partial trace [w/subscript]
\DeclareMathOperator{\rank}{rank} % Rank of a matrix
\DeclareMathOperator{\erf}{erf} % Gauss error function
@@ -115,6 +200,9 @@
\DeclareDocumentCommand\qunless{s}{\IfBooleanTF{#1}{}{\quad}\text{unless}\quad}
\DeclareDocumentCommand\qgiven{s}{\IfBooleanTF{#1}{}{\quad}\text{given}\quad}
\DeclareDocumentCommand\qusing{s}{\IfBooleanTF{#1}{}{\quad}\text{using}\quad}
+\DeclareDocumentCommand\qassume{s}{\IfBooleanTF{#1}{}{\quad}\text{assume}\quad}
+\DeclareDocumentCommand\qsince{s}{\IfBooleanTF{#1}{}{\quad}\text{since}\quad}
+\DeclareDocumentCommand\qlet{s}{\IfBooleanTF{#1}{}{\quad}\text{let}\quad}
\DeclareDocumentCommand\qfor{s}{\IfBooleanTF{#1}{}{\quad}\text{for}\quad}
\DeclareDocumentCommand\qall{s}{\IfBooleanTF{#1}{}{\quad}\text{all}\quad}
\DeclareDocumentCommand\qeven{s}{\IfBooleanTF{#1}{}{\quad}\text{even}\quad}
@@ -127,48 +215,80 @@
\DeclareDocumentCommand\qcc{s}{\IfBooleanTF{#1}{}{\quad}\text{c.c.}\quad}
% Derivatives
-\DeclareDocumentCommand\differential{ s o g }{{ % Differential 'd'
- % s: star for parentheses as in d(cos x)
+\DeclareDocumentCommand\differential{ o g d() }{ % Differential 'd'
% o: optional n for nth differential
% g: optional argument for readability and to control spacing
- \IfNoValueTF{#3}
- {\mathrm{d}\IfNoValueTF{#2}{}{^{#2}}}
- {\IfBooleanTF{#1}
- {\mathrm{d}\IfNoValueTF{#2}{}{^{#2}}\!\left(#3\right)}
- {\mathrm{d}\IfNoValueTF{#2}{}{^{#2}} #3 \,}
+ % d: long-form as in d(cos x)
+ \IfNoValueTF{#2}{
+ \IfNoValueTF{#3}
+ {\mathrm{d}\IfNoValueTF{#1}{}{^{#1}}}
+ {\mathrm{d}\IfNoValueTF{#1}{}{^{#1}}\!\quantity(#3)}
}
- }}
+ {\mathrm{d}\IfNoValueTF{#1}{}{^{#1}} #2 \,}
+ }
\DeclareDocumentCommand\dd{}{\differential} % Shorthand for \differential
-\DeclareDocumentCommand\derivative{ o m m o }{{ % Total derivatives
+\DeclareDocumentCommand\derivative{ o m g d() }{ % Total derivative
% o: optional n for nth derivative
- % m: mandatory (f in df/dx)
% m: mandatory (x in df/dx)
- % o: optional evaluation point
- \IfNoValueTF{#4}{}{\left.}\frac{\dd \IfNoValueTF{#1}{}{^{#1}} #2}{\dd #3\IfNoValueTF{#1}{}{^{#1}}}\IfNoValueTF{#4}{}{\right\rvert_{#4}}
- }}
+ % g: optional (f in df/dx)
+ % d: long-form d/dx(...)
+ \IfNoValueTF{#3}{
+ \IfNoValueTF{#4}
+ {\frac{\dd \IfNoValueTF{#1}{}{^{#1}}}{\dd #2\IfNoValueTF{#1}{}{^{#1}}}}
+ {\frac{\dd \IfNoValueTF{#1}{}{^{#1}}}{\dd #2\IfNoValueTF{#1}{}{^{#1}}} \!\quantity(#4)}
+ }
+ {\frac{\dd \IfNoValueTF{#1}{}{^{#1}} #2}{\dd #3\IfNoValueTF{#1}{}{^{#1}}}}
+ }
\DeclareDocumentCommand\dv{}{\derivative} % Shorthand for \derivative
-\DeclareDocumentCommand\partialderivative{ s o m m g o }{ % Partial derivatives
- % s: star for shorthand curly-d notation [default is Leibniz mode]
- % o: optional n for nth derivative [Leibniz mode]
- % m: mandatory (f in df/dx) [both modes]
- % m: mandatory (x in df/dx) [both modes]
- % g: optional (y in d^2f/dxdy) [both modes]
- % o: optional evaluation point [Leibniz mode]
- \IfNoValueTF{#5}{
- \IfBooleanTF{#1}
- {\partial_{#4} {#3}}
- {\IfNoValueTF{#6}{}{\left.}\frac{\partial\IfNoValueTF{#2}{}{^{#2}} #3}{\partial #4\IfNoValueTF{#2}{}{^{#2}}}\IfNoValueTF{#6}{}{\right\rvert_{#6}}}
+\DeclareDocumentCommand\partialderivative{ o m g g d() }{ % Partial derivative
+ % o: optional n for nth derivative
+ % m: mandatory (x in df/dx)
+ % g: optional (f in df/dx)
+ % g: optional (y in d^2f/dxdy)
+ % d: long-form d/dx(...)
+ \IfNoValueTF{#3}{
+ \IfNoValueTF{#5}
+ {\frac{\partial \IfNoValueTF{#1}{}{^{#1}}}{\partial #2\IfNoValueTF{#1}{}{^{#1}}}}
+ {\frac{\partial \IfNoValueTF{#1}{}{^{#1}}}{\partial #2\IfNoValueTF{#1}{}{^{#1}}} \!\quantity(#5)}
}{
- \IfBooleanTF{#1}
- {\partial_{{#4}{#5}} {#3}}
- {\IfNoValueTF{#6}{}{\left.}\frac{\partial^2 #3}{\partial #4 \partial #5}\IfNoValueTF{#6}{}{\right\rvert_{#6}}}
+ \IfNoValueTF{#4}
+ {\frac{\partial \IfNoValueTF{#1}{}{^{#1}} #2}{\partial #3\IfNoValueTF{#1}{}{^{#1}}}}
+ {\frac{\partial^2 #2}{\partial #3 \partial #4}}
}
}
\DeclareDocumentCommand\pderivative{}{\partialderivative} % Shorthand for \partialderivative
\DeclareDocumentCommand\pdv{}{\partialderivative} % Shorthand for \partialderivative
+\DeclareDocumentCommand\variation{ o g d() }{ % Functional variation
+ % o: optional n for nth differential
+ % g: optional argument for readability and to control spacing
+ % d: long-form as in d(F(g))
+ \IfNoValueTF{#2}{
+ \IfNoValueTF{#3}
+ {\delta \IfNoValueTF{#1}{}{^{#1}}}
+ {\delta \IfNoValueTF{#1}{}{^{#1}}\!\quantity(#3)}
+ }
+ {\delta \IfNoValueTF{#1}{}{^{#1}} #2 \,}
+ }
+\DeclareDocumentCommand\var{}{\variation} % Shorthand for \variation
+
+\DeclareDocumentCommand\functionalderivative{ o m g d() }{ % Functional derivative
+ % o: optional n for nth derivative
+ % m: mandatory (g in dF/dg)
+ % g: optional (F in dF/dg)
+ % d: long-form d/dx(...)
+ \IfNoValueTF{#3}{
+ \IfNoValueTF{#4}
+ {\frac{\variation \IfNoValueTF{#1}{}{^{#1}}}{\variation #2\IfNoValueTF{#1}{}{^{#1}}}}
+ {\frac{\variation \IfNoValueTF{#1}{}{^{#1}}}{\variation #2\IfNoValueTF{#1}{}{^{#1}}} \!\quantity(#4)}
+ }
+ {\frac{\variation \IfNoValueTF{#1}{}{^{#1}} #2}{\variation #3\IfNoValueTF{#1}{}{^{#1}}}}
+ }
+\DeclareDocumentCommand\fderivative{}{\functionalderivative} % Shorthand for \functionalderivative
+\DeclareDocumentCommand\fdv{}{\functionalderivative} % Shorthand for \functionalderivative
+
% Bra-ket notation
\DeclareDocumentCommand\bra{ s m t\ket{g} }{ % Bra
\IfBooleanTF{#1}
@@ -219,6 +339,9 @@
\DeclareDocumentCommand\matrixelement{ m m m }{\left\langle{#1}\middle\vert{#2}\middle\vert{#3}\right\rangle} % Matrix element
\DeclareDocumentCommand\matrixel{}{\matrixelement} % Shorthand for \matrixelement
\DeclareDocumentCommand\mel{}{\matrixelement} % Shorthand for \matrixelement
+
+% Misc
+\DeclareDocumentCommand\varE{}{\mathcal{E}} % Curly 'E'
\DeclareDocumentCommand\homework{}{ % You can try it
\ensuremath{
\div{\vb{E}}=\frac{\rho}{\epsilon_0} \qc