diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/braket |
Initial commit
Diffstat (limited to 'macros/latex/contrib/braket')
-rw-r--r-- | macros/latex/contrib/braket/braket.pdf | bin | 0 -> 222696 bytes | |||
-rw-r--r-- | macros/latex/contrib/braket/braket.sty | 93 | ||||
-rw-r--r-- | macros/latex/contrib/braket/braket.tex | 58 |
3 files changed, 151 insertions, 0 deletions
diff --git a/macros/latex/contrib/braket/braket.pdf b/macros/latex/contrib/braket/braket.pdf Binary files differnew file mode 100644 index 0000000000..6fbf5f51cd --- /dev/null +++ b/macros/latex/contrib/braket/braket.pdf diff --git a/macros/latex/contrib/braket/braket.sty b/macros/latex/contrib/braket/braket.sty new file mode 100644 index 0000000000..b3f338847a --- /dev/null +++ b/macros/latex/contrib/braket/braket.sty @@ -0,0 +1,93 @@ +% braket.sty Macros for Dirac bra-ket <|> notation and sets {|} +% Donald Arseneau asnd@triumf.ca Last modified 12-Sept-2006. +% This is free, unencumbered, unsupported software. +% +% Commands defined are: +% \bra{ } \ket{ } \braket{ } \set{ } (small versions) +% \Bra{ } \Ket{ } \Braket{ } \Set{ } (expanding versions) +% +% The "small versions" use fixed-size brackets independent of their +% contents, whereas the "expanding versions" make the brackets and +% vertical lines expand to envelop their contents (internally using +% the \left and \right commands). You should use the vertical bar +% character "|" to input any extra vertical lines. In \Braket these +% vertical lines will expand to match the arguments, and in \Set the +% first vertical will expand. E.g., +% +% \Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi } +% \Set{ x\in\mathbf{R}^2 | 0<{|x|}<5 } +% +% Likewise, you may make an expandable double-bar using either +% the "\|" command or its local alias "||". +% +% NOT defined is "\ketbra" (for projection operators) because I prefer +% \ket{ } \bra{ }. +% +% Because each definition is so small, it makes no sense to have a +% complicated generic version for many bracket styles. Instead, +% you can just copy the definitions and change \langle or \rangle, +% to what you like. +% +\def\bra#1{\mathinner{\langle{#1}|}} +\def\ket#1{\mathinner{|{#1}\rangle}} +\def\braket#1{\mathinner{\langle{#1}\rangle}} +\def\Bra#1{\left\langle#1\right|} +\def\Ket#1{\left|#1\right\rangle} +% +\let\protect\relax +% +{\catcode`\|=\active + \xdef\Braket{\protect\expandafter\noexpand\csname Braket \endcsname} + \expandafter\gdef\csname Braket \endcsname#1{\begingroup + \ifx\SavedDoubleVert\relax + \let\SavedDoubleVert\|\let\|\BraDoubleVert + \fi + \mathcode`\|32768\let|\BraVert + \left\langle{#1}\right\rangle\endgroup} +} +\def\BraVert{\@ifnextchar|{\|\@gobble}% turn || into \| + {\egroup\,\mid@vertical\,\bgroup}} +\def\BraDoubleVert{\egroup\,\mid@dblvertical\,\bgroup} +\let\SavedDoubleVert\relax + +% The \mid@vertical is \vrule with ordinary TeX but \middle| in eTeX. +% We always avoid a \mathchoice in making the inner vertical lines. +% Note that \right\rangle is used now due to a failing in fourier.sty. +% +% \def\ketbra#1#2{\ket{#1}\bra{#2}} +% \def\Ketbra#1#2{\left|{#1}\vphantom{#2}\right\rangle\left\langle{#2}\vphantom{#1}\right|} + +% \Set{...|...} Only the first | is treated specially. +{\catcode`\|=\active + \xdef\set{\protect\expandafter\noexpand\csname set \endcsname} + \expandafter\gdef\csname set \endcsname#1{\mathinner + {\lbrace\,{\mathcode`\|32768\let|\midvert #1}\,\rbrace}} + \xdef\Set{\protect\expandafter\noexpand\csname Set \endcsname} + \expandafter\gdef\csname Set \endcsname#1{\left\{% + \ifx\SavedDoubleVert\relax \let\SavedDoubleVert\|\fi + \:{\let\|\SetDoubleVert + \mathcode`\|32768\let|\SetVert + #1}\:\right\}} +} +\def\midvert{\egroup\mid\bgroup} +\def\SetVert{\@ifnextchar|{\|\@gobble}% turn || into \| + {\egroup\;\mid@vertical\;\bgroup}} +\def\SetDoubleVert{\egroup\;\mid@dblvertical\;\bgroup} + +% If the user is using e-TeX with its \middle primitive, use that for +% verticals instead of \vrule. +% +\begingroup + \edef\@tempa{\meaning\middle} + \edef\@tempb{\string\middle} +\expandafter \endgroup \ifx\@tempa\@tempb + \def\mid@vertical{\middle|} + \def\mid@dblvertical{\middle\SavedDoubleVert} +\else + \def\mid@vertical{\mskip1mu\vrule\mskip1mu} + \def\mid@dblvertical{\mskip1mu\vrule\mskip2.5mu\vrule\mskip1mu} +\fi + +% May 2005: Double verticals; tweak spacing. +% June 2005: Make robust +% Sept 2006: fourier diff --git a/macros/latex/contrib/braket/braket.tex b/macros/latex/contrib/braket/braket.tex new file mode 100644 index 0000000000..6b4f4a3bd6 --- /dev/null +++ b/macros/latex/contrib/braket/braket.tex @@ -0,0 +1,58 @@ +\documentclass[parskip=half, pagesize=auto, version=last]{scrartcl} + +\usepackage{fixltx2e} +\usepackage{lmodern} +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\usepackage{array} +\usepackage{braket} +\usepackage{microtype} + +\addtokomafont{title}{\rmfamily} + +\title{The \textsf{braket} package} +\subtitle{Macros for Dirac bra--ket $\langle\mid\rangle$ notation and sets $\lbrace\mid\rbrace$} +\author{Donald Arseneau\\\texttt{asnd@triumf.ca}} +\date{12--Sept--2006} + + +\begin{document} + +\maketitle + +Commands defined are: + +\begin{tabular}{@{}*{4}{>{\ttfamily\textbackslash}c<{\{~\}}}>{(}l<{~versions)}@{}} + bra & ket & braket & set & small \\ + Bra & Ket & Braket & Set & expanding +\end{tabular} + +The ``small versions'' use fixed-size brackets independent of their +contents, whereas the ``expanding versions'' make the brackets and +vertical lines expand to envelop their contents (internally using +the \verb+\left+ and \verb+\right+ commands). You should use the vertical bar +character ``\verb+|+'' to input any extra vertical lines. In \verb+\Braket+ these +vertical lines will expand to match the arguments, and in \verb+\Set+ the +first vertical will expand. E.\,g., + +\begingroup +\renewcommand*{\arraystretch}{1.7} +\setlength{\tabcolsep}{10pt} +\begin{tabular}{@{}>{\footnotesize}r>{$\displaystyle}l<{$}@{}} + \verb+\Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi }+ & \Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi } \\ + \verb+\Set{ x\in\mathbf{R}^2 | 0<{|x|}<5 }+ & \Set{ x\in\mathbf{R}^2 | 0<{|x|}<5 } \\ +\end{tabular} +\endgroup + +Likewise, you may make an expandable double-bar using either +the ``\verb+\|+'' command or its local alias ``\verb+||+''. + +NOT defined is ``\verb+\ketbra+'' (for projection operators) because I prefer +\verb+\ket{ } \bra{ }+. + +Because each definition is so small, it makes no sense to have a +complicated generic version for many bracket styles. Instead, +you can just copy the definitions and change \verb+\langle+ or \verb+\rangle+, +to what you like. + +\end{document} |