### Transcription

The physics packageSergio C. de la [email protected] 12, 2012Contents1 Before you start1.1 The purpose of this package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.2 Other required packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.3 Using physics in your LATEX document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11122 List2.12.22.32.42.52.62.72234556711.1of commandsAutomatic bracing . .Vector notation . . . .Operators . . . . . . .Quick quad text . . .Derivatives . . . . . .Dirac bra-ket notationMatrix macros . . . .Before you startThe purpose of this packageThe goal of this package is to make typesetting equations for physics simpler, faster, and more humanreadable. To that end, the commands included in this package have names that make the purpose of eachcommand immediately obvious and remove any ambiguity while reading and editing physics code. From apractical standpoint, it is handy to have a well-defined set of shortcuts for accessing the long-form of each ofthese commands. The commands listed below are therefore defined in terms of their long-form names andthen shown explicitly in terms of the default shorthand command sequences. These shorthand commandsare meant make it easy to remember both the shorthand names and what each one represents.1.2Other required packagesThe physics package requires xparse and amsmath to work properly in your LATEX document. The amsmathpackage comes standard with most LATEX distributions and is loaded by physics for your convenience. Youmay also already have xparse installed on your system as it is a popular package for defining LATEXmacros,however, if you are unsure you can either install it again using your local package manager (comes with mostdistributions) or by visiting the CTAN online package database, or you could even just try to use physics1

without worrying about it. Many modern LATEXcompilers will locate and offer to download missing packagesfor you.1.3Using physics in your LATEX documentTo use the physics package, simply insert \usepackage{physics} in the preamble of your document, before\begin{document} and after nt}22.1List of commandsAutomatic bracing\quantity\qty(\typical) ( )automatic ( ) braces\qty(\tall) \qty(\grande) \qty[\typical] [ ]\qty \typical \qty{\typical} { }\qty\big{} noautomatic [ ] bracesautomatic bracesautomatic { } bracesmanual sizing (works with any of theabove bracket types)\qty\Big{} \qty\bigg{} ()\qty\Bigg{} \absolutevalue \qty() \qty[] \qty \qty{} a alternative syntax; robust and moreLATEX-friendly\abs\Big{a} ainherits manual sizing syntax from de} \normautomatic sizing; equivalent to \qty a star for no resize\norm{a} kakautomatic sizing\norm\Big{a} amanual sizing\norm*{\grande} kkstar for no resize \evaluated\eval{x} 0 \infty xvertical bar for evaluation limits02

\eval(x 0 \infty alternate formx \eval[x 0 \infty x0 alternate form0 "\eval[\venti 0 \infty automatic sizing0 \order\eval*[\venti 0 \infty \order{x 2} O x2 star for no resize0order symbol; automatic sizing andspace handling \order\Big{x 2} O x2\order*{\grande} O(\commutatormanual sizing)star for no resize\comm{A}{B} [A, B]hi\comm\Big{A}{B} A, Bautomatic sizingmanual sizing\comm*{A}{\grande} [A,\anticommutator\poissonbracket2.2]star for no resize\acomm{A}{B} {A, B}\pb{A}{B} {A, B}same as \poissonbracketsame as \anticommutatorVector notation byThe default del symbol used in physics vector notation can be switched to appear with an arrow including the option arrowdel in the document preamble ivergence\curl\vb{a} a\vb*{a}, \vb*{\theta} a, θ\va{a} a\va*{a}, \va*{\theta} a, θ\vu{a} â\vu*{a}, \vu*{\theta} â, θ̂\vdot · as in a · b\cross as in a b\cp as in a b\grad \grad{\Psi} Ψ upright/no Greekitalic/Greekupright/no Greekitalic/Greekupright/no Greekitalic/Greeknote: \dp is a protected TEX primitivealternate nameshorthand namedefault mode\grad(\Psi \tall) Ψ h\grad[\Psi \tall] Ψ \div ·i\div{\vb{a}} · a \div(\vb{a} \tall) · a h\div[\vb{a} \tall] · a \curl \curl{\vb{a}} a \curl(\vb{a} \tall) a 3long-form (like \qty but also handlesspacing)note: amsmath symbol renamed\divisionsymboldefault mode long-formidefault mode long-form

hi\curl[\vb{a} \tall] a \laplacian 2\laplacian{\Psi} 2 Ψ \laplacian(\Psi \tall) 2 Ψ hi\laplacian[\Psi \tall] 2 Ψ \laplacian2.3default modelong-formOperatorsThe standard set of trig functions is redefined in physics to provide automatic braces that behave like\qty(). In addition, an optional power argument is provided. This behavior can be switched off by includingthe option notrig in the preamble \usepackage[notrig]{physics}.Example trig redefinitions:\sin \sin(\grande) sin automatic braces; old \sin renamed \sine2\sin[2](x) sin (x)\sin x sin xoptional powercan still use without an argumentThe full set of available trig functions in physics ) x)atan(x)acsc(x)asec(x)acot(x)The standard trig functions (plus a few that are missing in amsmath) are available without any automaticbracing under a new set of longer osecant\arcsecant\arccotangentSimilar behavior has also been extended to the \exp(\tall) exp \log(\tall) log \ln(\tall)ln old definitions \det(\tall) det \Pr(\tall)PrNew operators:\trace or \tr\Trace or gent\acosecant\asecant\acotangentfollowing determinant\Probability\tr\rho tr ρ also \tr(\tall) tr\Tr\rho Tr ρ\rank M rank M\erf(x) erf(x)\Res[f(z)] Res[f (z)]R\pv{\int f(z) \dd{z}} P fR(z) dz\PV{\int f(z) \dd{z}} P.V. f (z) dz4 trace; same bracing as trig functionsalternatematrix rankGauss error functionresidue; same bracing as trig functionsCauchy principal valuealternate