Debian Codegraph @

texmf-dist/doc/latex/hepunits/hepunits.tex

raw
1 \documentclass[12pt]{article}
2 \usepackage{xspace,setspace,fancyvrb,a4wide}
3 \usepackage{url,relsize,booktabs,ccaption,braket}
4 \usepackage[colorlinks=true,bookmarks=true]{hyperref}
5 \usepackage{mathpazo,microtype}
6
7 \usepackage[sicmds,freestanding]{hepunits}
8 \newcommand{\hepunits}{\texttt{hepunits}\xspace}
9
10 \let\OldCite\cite
11 \renewcommand{\cite}[1]{\mbox{\!\!\OldCite{#1}}}
12
13 \onehalfspacing
14 \DefineShortVerb{\|}
15
16 \author{Andy Buckley, \texttt{[email protected]}}
17 \title{The \hepunits \LaTeX{} package}
18
19 \newcommand{\texcmd}[1]{\texttt{\char`\\#1}}
20 \newcommand{\texenv}[1]{\texttt{\char`#1}}
21 \newcommand{\texopt}[1]{\texttt{\char`#1}}
22 \newcommand{\texarg}[1]{\texttt{\char`#1}}
23 \newcommand{\texpkg}[1]{\texttt{\char`#1}}
24 \newcommand{\texcls}[1]{\texttt{\char`#1}}
25 \newcommand{\texcommand}[1]{\texcmd{#1}}
26 \newcommand{\texoption}[1]{\texopt{#1}}
27 \newcommand{\texgen}[1]{\ensuremath{\braket{\text{\emph{#1}}}}}
28 \newenvironment{snippet}{\Verbatim}{\endVerbatim}
29
30
31
32 \begin{document}
33 \maketitle
34
35
36 %\abstract{%
37 The \hepunits~v2 package extends the existing (and excellent) \texpkg{siunitx}
38 package to support units commonly used in high-energy physics. HEP uses a
39 rather specialised set of units to describe measurements of energies, masses,
40 momenta, reaction cross-sections, luminosities and so-on. Using this package
41 provides particle physicists with a consistent and accurate way to refer to
42 dimensionful HEP quantities. It additionally tweaks the often problematic
43 character spacing around the \si\eV and \si\eVcsq units, as an ``eV kern''
44 is not typically defined in \LaTeX{} fonts. %
45 %}
46
47
48 \section{Recommended usage}
49 The basic usage mode for \hepunits is to place |\usepackage{hepunits}|
50 % %
51 % \begin{snippet}
52 % \usepackage{hepunits}
53 % \end{snippet}
54 % %
55 in the preamble of your document.
56
57 This loads the \texpkg{amsmath} (for \texcmd{mspace}/\texcmd{mkern}) and
58 \texpkg{siunitx} packages, as well as defining new HEP units using the
59 \texpkg{siunitx} mechanisms. For convenience, it also sets the \texpkg{siunitx}
60 defaults to detect the surrounding text style (include displayed mathematics)
61 and to use text-mode rendering of units, again to match the surrounding text
62 font for numbers and unit text. If these features aren't wanted, or you want to
63 set any of the myriad other \texpkg{siunitx} rendering options, call the
64 \texcmd{sisetup} macro \emph{after} the |\usepackage{hepunits}| call.
65
66
67 \section{Options}
68 \hepunits accepts three optional arguments during import:
69 %
70 \begin{description}
71 \item[sicmds:] Also define convenience short versions of SI units, e.g.~\texcmd{cm};
72 \item[noprefixcmds:] Don't define convenience SI-prefixed versions of HEP units, e.g.~\texcmd{GeV} in addition to \texcmd{eV};
73 \item[freestanding:] Make the unit macros also usable outside the \texcmd{SI} and \texcmd{si} macros (equivalent to |\sisetup{free-standing-units=true}|.
74 \end{description}
75 %
76 These can be used as follows: |\usepackage[sicmds,freestanding]{heputils}|.
77
78
79 \section{Requirements}
80 \hepunits requires the \texpkg{siunitx} and \texpkg{amsmath}
81 packages to be installed as part of your \TeX{} distribution. I don't know of
82 any distributions for which this isn't the case, so chances are you're safe to
83 just install \hepunits and use it right away.
84
85
86 \section{Provided units}
87 The HEP units provided by \hepunits are listed in Tables \ref{tab:normunits} and
88 \ref{tab:hepunits} below. All the example outputs have been produced with a
89 command like |\SI{1.0}{|\texgen{unit}|}| where \texgen{unit} is one of the unit
90 commands listed in the first columns of the tables. Note that standard
91 \texpkg{siunitx} parsing extensions like |\SI{1.23e-4}{\GeV}| $\to$
92 \SI{1.23e-4}{\GeV}, and significant-digit control, also work but aren't shown
93 here in the interests of brevity.
94
95 \begin{table}[ht]
96 \centering
97 \begin{tabular}{lllll}
98 \toprule
99 Unit command & Normal & Italic & Bold & Math \\
100
101 \midrule
102 Lengths \\
103 \texcmd{nm} & \SI{1.0}{\nm} & \textit{\SI{1.0}{\nm}} & \textbf{\SI{1.0}{\nm}} & $x = \SI{1.0}{\nm}$ \\
104 \texcmd{um} & \SI{1.0}{\um} & \textit{\SI{1.0}{\um}} & \textbf{\SI{1.0}{\um}} & $x = \SI{1.0}{\um}$ \\
105 \texcmd{mm} & \SI{1.0}{\mm} & \textit{\SI{1.0}{\mm}} & \textbf{\SI{1.0}{\mm}} & $x = \SI{1.0}{\mm}$ \\
106 \texcmd{cm} & \SI{1.0}{\cm} & \textit{\SI{1.0}{\cm}} & \textbf{\SI{1.0}{\cm}} & $x = \SI{1.0}{\cm}$ \\
107 \texcmd{micron} & \SI{1.0}{\um} & \textit{\SI{1.0}{\um}} & \textbf{\SI{1.0}{\um}} & $x = \SI{1.0}{\um}$ \\
108
109 \midrule
110 Times \\
111 \texcmd{ns} & \SI{1.0}{\ns} & \textit{\SI{1.0}{\ns}} & \textbf{\SI{1.0}{\ns}} & $x = \SI{1.0}{\ns}$ \\
112 \texcmd{ps} & \SI{1.0}{\ps} & \textit{\SI{1.0}{\ps}} & \textbf{\SI{1.0}{\ps}} & $x = \SI{1.0}{\ps}$ \\
113 \texcmd{fs} & \SI{1.0}{\fs} & \textit{\SI{1.0}{\fs}} & \textbf{\SI{1.0}{\fs}} & $x = \SI{1.0}{\fs}$ \\
114 \texcmd{as} & \SI{1.0}{\as} & \textit{\SI{1.0}{\as}} & \textbf{\SI{1.0}{\as}} & $x = \SI{1.0}{\as}$ \\
115
116 \midrule
117 Rates \\
118 \texcmd{mHz} & \SI{1.0}{\mHz} & \textit{\SI{1.0}{\mHz}} & \textbf{\SI{1.0}{\mHz}} & $x = \SI{1.0}{\mHz}$ \\
119 \texcmd{Hz} & \SI{1.0}{\Hz} & \textit{\SI{1.0}{\Hz}} & \textbf{\SI{1.0}{\Hz}} & $x = \SI{1.0}{\Hz}$ \\
120 \texcmd{kHz} & \SI{1.0}{\kHz} & \textit{\SI{1.0}{\kHz}} & \textbf{\SI{1.0}{\kHz}} & $x = \SI{1.0}{\kHz}$ \\
121 \texcmd{MHz} & \SI{1.0}{\MHz} & \textit{\SI{1.0}{\MHz}} & \textbf{\SI{1.0}{\MHz}} & $x = \SI{1.0}{\MHz}$ \\
122 \texcmd{GHz} & \SI{1.0}{\GHz} & \textit{\SI{1.0}{\GHz}} & \textbf{\SI{1.0}{\GHz}} & $x = \SI{1.0}{\GHz}$ \\
123 \texcmd{THz} & \SI{1.0}{\THz} & \textit{\SI{1.0}{\THz}} & \textbf{\SI{1.0}{\THz}} & $x = \SI{1.0}{\THz}$ \\
124
125 \midrule
126 Misc. \\
127 \texcmd{mrad} & \SI{1.0}{\mrad} & \textit{\SI{1.0}{\mrad}} & \textbf{\SI{1.0}{\mrad}} & $x = \SI{1.0}{\mrad}$ \\
128 \texcmd{gauss} & \SI{1.0}{\gauss} & \textit{\SI{1.0}{\gauss}} & \textbf{\SI{1.0}{\gauss}} & $x = \SI{1.0}{\gauss}$ \\
129 \bottomrule
130 \end{tabular}
131 \caption{List of non-HEP specific units provided by \hepunits. Other than \texttt{\textbackslash{}gauss}, these units are only available via the \texttt{sicmds} package option.}
132 \label{tab:normunits}
133 \end{table}
134
135 \begin{table}[ht]
136 \centering
137 \begin{tabular}{lllll}
138 \toprule
139 Unit command & Normal & Italic & Bold & Math \\
140 \midrule
141 Luminosities \\
142 \texcmd{invcmsq} & \SI{1.0}{\invcmsq} & \textit{\SI{1.0}{\invcmsq}} & \textbf{\SI{1.0}{\invcmsq}} & $x = \SI{1.0}{\invcmsq}$ \\
143 \texcmd{invcmsqpersecond} & \SI{1.0}{\invcmsqpersecond} & \textit{\SI{1.0}{\invcmsqpersecond}} & \textbf{\SI{1.0}{\invcmsqpersecond}} & $x = \SI{1.0}{\invcmsqpersecond}$ \\
144 \texcmd{invcmsqpersec} & \SI{1.0}{\invcmsqpersec} & \textit{\SI{1.0}{\invcmsqpersec}} & \textbf{\SI{1.0}{\invcmsqpersec}} & $x = \SI{1.0}{\invcmsqpersec}$ \\
145
146 \midrule
147 Cross-sections \\
148 \texcmd{barn} & \SI{1.23e-4}{\barn} & \textit{\SI{1.0}{\barn}} & \textbf{\SI{1.0}{\barn}} & $x = \SI{1.0}{\barn}$ \\
149 \texcmd{invbarn} & \SI{1.0}{\invbarn} & \textit{\SI{1.0}{\invbarn}} & \textbf{\SI{1.0}{\invbarn}} & $x = \SI{1.0}{\invbarn}$ \\
150 \texcmd{nanobarn} & \SI{1.0}{\nanobarn} & \textit{\SI{1.0}{\nanobarn}} & \textbf{\SI{1.0}{\nanobarn}} & $x = \SI{1.0}{\nanobarn}$ \\
151 \texcmd{invnanobarn} / \texcmd{invnb} & \SI{1.0}{\invnanobarn} & \textit{\SI{1.0}{\invnanobarn}} & \textbf{\SI{1.0}{\invnanobarn}} & $x = \SI{1.0}{\invnanobarn}$ \\
152 \texcmd{picobarn} & \SI{1.0}{\picobarn} & \textit{\SI{1.0}{\picobarn}} & \textbf{\SI{1.0}{\picobarn}} & $x = \SI{1.0}{\picobarn}$ \\
153 \texcmd{invpicobarn} / \texcmd{invpb} & \SI{1.0}{\invpicobarn} & \textit{\SI{1.0}{\invpicobarn}} & \textbf{\SI{1.0}{\invpicobarn}} & $x = \SI{1.0}{\invpicobarn}$ \\
154 \texcmd{femtobarn} & \SI{1.0}{\femtobarn} & \textit{\SI{1.0}{\femtobarn}} & \textbf{\SI{1.0}{\femtobarn}} & $x = \SI{1.0}{\femtobarn}$ \\
155 \texcmd{invfemtobarn} / \texcmd{invfb} & \SI{1.0}{\invfemtobarn} & \textit{\SI{1.0}{\invfemtobarn}} & \textbf{\SI{1.0}{\invfemtobarn}} & $x = \SI{1.0}{\invfemtobarn}$ \\
156 \texcmd{attobarn} & \SI{1.0}{\attobarn} & \textit{\SI{1.0}{\attobarn}} & \textbf{\SI{1.0}{\attobarn}} & $x = \SI{1.0}{\attobarn}$ \\
157 \texcmd{invattobarn} / \texcmd{invab} & \SI{1.0}{\invattobarn} & \textit{\SI{1.0}{\invattobarn}} & \textbf{\SI{1.0}{\invattobarn}} & $x = \SI{1.0}{\invattobarn}$ \\
158
159 \bottomrule
160 \end{tabular}
161 \caption{List of HEP-specific luminosity units provided by \hepunits.}
162 \label{tab:hepunits}
163 \end{table}
164
165
166 \begin{table}[ht]
167 \centering
168 \begin{tabular}{lllll}
169 \toprule
170 Unit command & Normal & Italic & Bold & Math \\
171 \midrule
172 \eV-based units \\
173 %\multicolumn{4}{\eV-based units} \\
174 \texcmd{eV} & \SI{1.0}{\eV} & \textit{\SI{1.0}{\eV}} & \textbf{\SI{1.0}{\eV}} & $x = \SI{1.0}{\eV}$ \\
175 \texcmd{eVc} & \SI{1.0}{\eVc} & \textit{\SI{1.0}{\eVc}} & \textbf{\SI{1.0}{\eVc}} & $x = \SI{1.0}{\eVc}$ \\
176 \texcmd{eVcsq} & \SI{1.0}{\eVcsq} & \textit{\SI{1.0}{\eVcsq}} & \textbf{\SI{1.0}{\eVcsq}} & $x = \SI{1.0}{\eVcsq}$ \\
177 \texcmd{meV} & \SI{1.0}{\meV} & \textit{\SI{1.0}{\meV}} & \textbf{\SI{1.0}{\meV}} & $x = \SI{1.0}{\meV}$ \\
178 \texcmd{keV} & \SI{1.0}{\keV} & \textit{\SI{1.0}{\keV}} & \textbf{\SI{1.0}{\keV}} & $x = \SI{1.0}{\keV}$ \\
179 \texcmd{MeV} & \SI{1.0}{\MeV} & \textit{\SI{1.0}{\MeV}} & \textbf{\SI{1.0}{\MeV}} & $x = \SI{1.0}{\MeV}$ \\
180 \texcmd{GeV} & \SI{1.0}{\GeV} & \textit{\SI{1.0}{\GeV}} & \textbf{\SI{1.0}{\GeV}} & $x = \SI{1.0}{\GeV}$ \\
181 \texcmd{TeV} & \SI{1.0}{\TeV} & \textit{\SI{1.0}{\TeV}} & \textbf{\SI{1.0}{\TeV}} & $x = \SI{1.0}{\TeV}$ \\
182 \texcmd{meVc} & \SI{1.0}{\meVc} & \textit{\SI{1.0}{\meVc}} & \textbf{\SI{1.0}{\meVc}} & $x = \SI{1.0}{\meVc}$ \\
183 \texcmd{keVc} & \SI{1.0}{\keVc} & \textit{\SI{1.0}{\keVc}} & \textbf{\SI{1.0}{\keVc}} & $x = \SI{1.0}{\keVc}$ \\
184 \texcmd{MeVc} & \SI{1.0}{\MeVc} & \textit{\SI{1.0}{\MeVc}} & \textbf{\SI{1.0}{\MeVc}} & $x = \SI{1.0}{\MeVc}$ \\
185 \texcmd{GeVc} & \SI{1.0}{\GeVc} & \textit{\SI{1.0}{\GeVc}} & \textbf{\SI{1.0}{\GeVc}} & $x = \SI{1.0}{\GeVc}$ \\
186 \texcmd{TeVc} & \SI{1.0}{\TeVc} & \textit{\SI{1.0}{\TeVc}} & \textbf{\SI{1.0}{\TeVc}} & $x = \SI{1.0}{\TeVc}$ \\
187 \texcmd{meVcsq} & \SI{1.0}{\meVcsq} & \textit{\SI{1.0}{\meVcsq}} & \textbf{\SI{1.0}{\meVcsq}} & $x = \SI{1.0}{\meVcsq}$ \\
188 \texcmd{keVcsq} & \SI{1.0}{\keVcsq} & \textit{\SI{1.0}{\keVcsq}} & \textbf{\SI{1.0}{\keVcsq}} & $x = \SI{1.0}{\keVcsq}$ \\
189 \texcmd{MeVcsq} & \SI{1.0}{\MeVcsq} & \textit{\SI{1.0}{\MeVcsq}} & \textbf{\SI{1.0}{\MeVcsq}} & $x = \SI{1.0}{\MeVcsq}$ \\
190 \texcmd{GeVcsq} & \SI{1.0}{\GeVcsq} & \textit{\SI{1.0}{\GeVcsq}} & \textbf{\SI{1.0}{\GeVcsq}} & $x = \SI{1.0}{\GeVcsq}$ \\
191 \texcmd{TeVcsq} & \SI{1.0}{\TeVcsq} & \textit{\SI{1.0}{\TeVcsq}} & \textbf{\SI{1.0}{\TeVcsq}} & $x = \SI{1.0}{\TeVcsq}$ \\
192 \bottomrule
193 \end{tabular}
194 \contcaption{List of HEP-specific units provided by \hepunits (cont.)}
195 \label{tab:hepunits2}
196 \end{table}
197
198 Note that a lot of these units have, for convenience, been provided as explicit
199 commands with various SI prefixes, rather than just defining the base unit and
200 using the \texpkg{siunitx} prescription for the prefixes. Let's give a demo in
201 case you don't know what I'm waffling about\dots the ``usual'' \texpkg{siunitx}
202 way of doing things is like this:
203 |\SI{1.0}{\mega\eVc}|. This produces ``\SI{1.0}{\mega\eVc}''
204 just like |\SI{1.0}{\MeVc}| would do.
205
206 I've chosen to provide the explicit prefixed commands for convenience: choose
207 your own favourite way (the same applies even more so for most of the non-HEP
208 units). If you are bothered about the explictly prefixed commands clogging up
209 the \LaTeX{} macro namespace then pass the \texopt{noprefixcmds} option to
210 \hepunits and the offending commands won't be defined at all. This will make
211 life awkward when it comes to inverse cross-sections as used for integrated
212 luminosities, but with suitable use of \texcmd{invbarn} I'm sure you can make
213 do.
214
215 \section{Summary}
216 \hepunits is a handy package for particle physicists who'd like their units to
217 look right, with upright \si{\micro}{s}, properly italicised $c$s, and properly
218 kerned \eV{s} in the appropriate places. Fortunately most of the work has
219 already been done by the marvellous \texpkg{siunitx} package and I've just
220 provided a few more commands and an option passing wrapper on to that excellent
221 piece of work.
222
223 If you have any comments, criticism, huge cash donations etc., then please do
224 send them my way.
225
226 \end{document}