summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hepunits
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/hepunits
Initial commit
Diffstat (limited to 'macros/latex/contrib/hepunits')
-rw-r--r--macros/latex/contrib/hepunits/ChangeLog25
-rw-r--r--macros/latex/contrib/hepunits/README20
-rw-r--r--macros/latex/contrib/hepunits/hepunits.pdfbin0 -> 86255 bytes
-rw-r--r--macros/latex/contrib/hepunits/hepunits.sty172
-rw-r--r--macros/latex/contrib/hepunits/hepunits.tex219
5 files changed, 436 insertions, 0 deletions
diff --git a/macros/latex/contrib/hepunits/ChangeLog b/macros/latex/contrib/hepunits/ChangeLog
new file mode 100644
index 0000000000..dfc9c20bff
--- /dev/null
+++ b/macros/latex/contrib/hepunits/ChangeLog
@@ -0,0 +1,25 @@
+2007-09-27 Andy Buckley <andy@insectnation.org>
+
+ * Ready for the momentous 1.1.1 release.
+
+ * Removed "full screen" param from documentation PDF
+ configuration, since this is actually very annoying.
+
+ * Added Makefile to build distribution tarball.
+
+ * Fixed definition of \GeVovercsq, which was missing the second
+ power of c. Thanks to Jeroen Hegeman for the bug report.
+
+2005-12-12 Andy Buckley <andy@insectnation.org>
+
+ * Added noprefixcmds option due to residual guilt about
+ contaminating everyone's command namespace.
+
+ * Made basic manual.
+
+ * Removed "derived" from default SIunits options.
+
+ * Added SIunits options passing.
+
+ * Started ChangeLog.
+
diff --git a/macros/latex/contrib/hepunits/README b/macros/latex/contrib/hepunits/README
new file mode 100644
index 0000000000..08e37bdd12
--- /dev/null
+++ b/macros/latex/contrib/hepunits/README
@@ -0,0 +1,20 @@
+hepunits --- a set of useful units for use in high energy physics
+by Andy Buckley <andy@insectnation.org>
+-----------------------------------------------------------
+
+hepunits is a LaTeX package built on the SIunits package which
+adds a collection of useful HEP units to the existing SIunits set.
+These include the energy units \MeV, \GeV, \TeV and the derived
+momentum and mass units \MeVoverc, \MeVovercsq and so on.
+
+Additionally, some units are added for pure convenience. The
+contents of the package with the exception of the energy units
+mentioned above are subject to deprecation and addition, so please
+provide feedback on which HEP units you'd like added to the
+package.
+
+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.
+
+Author: Andy Buckley <andy@insectnation.org>
diff --git a/macros/latex/contrib/hepunits/hepunits.pdf b/macros/latex/contrib/hepunits/hepunits.pdf
new file mode 100644
index 0000000000..b4f82024fc
--- /dev/null
+++ b/macros/latex/contrib/hepunits/hepunits.pdf
Binary files differ
diff --git a/macros/latex/contrib/hepunits/hepunits.sty b/macros/latex/contrib/hepunits/hepunits.sty
new file mode 100644
index 0000000000..50b8adcd48
--- /dev/null
+++ b/macros/latex/contrib/hepunits/hepunits.sty
@@ -0,0 +1,172 @@
+%% hepunits
+%% High energy physics (HEP) extensions to the SIunits package
+%% Author: Andy Buckley <andy@insectnation.org>
+%%
+%% This material is subject to the LaTeX Project Public License.
+%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+%% or the details of that license.
+%%
+%% Please let me know if you use hepunits and what you think of it.
+%% I'll try to implement any suggested options that seem sensible!
+
+\def\fileversion{1.1.1}
+\def\filedate{2007/09/27}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{hepunits}[\filedate\space High-energy physics units by Andy Buckley (v\fileversion)]
+
+%% Now-redundant wrapper for declaring new units
+\DeclareRobustCommand{\@NewUnit}[2]{\addunit{#1}{#2}}
+
+%% Option handling variables
+\def\@empty{}
+\def\@yes{yes}
+\def\@HEPopt@noprefixcmds{}
+\def\@SIopt@cdot{}
+\def\@SIopt@space{mediumspace}
+\def\@SIopt@qspace{thickqspace}
+\def\@SIopt@amssquare{squaren}
+\def\@SIopt@pstricks{}
+\def\@SIopt@Gray{}
+\def\@SIopt@italian{}
+\def\@SIopt@textstyle{yes}
+\def\@SIopt@binary{}
+\def\@SIopt@noams{}
+\def\@SIopt@derivedinbase{}
+\def\@SIopt@derived{}
+
+%% Option for turning off explicit SI prefix commands
+\DeclareOption{noprefixcmds}{\def\@HEPopt@noprefixcmds{yes}}
+
+%% Options for passing to SIunits
+\DeclareOption{cdot}{\def\@SIopt@cdot{yes}}
+\DeclareOption{thickspace}{\def\@SIopt@space{thickspace}}
+\DeclareOption{mediumspace}{\def\@SIopt@space{mediumspace}}
+\DeclareOption{thinspace}{\def\@SIopt@space{thinspace}}
+\DeclareOption{thickqspace}{\def\@SIopt@qspace{thickqspace}}
+\DeclareOption{mediumqspace}{\def\@SIopt@qspace{mediumqspace}}
+\DeclareOption{thinqspace}{\def\@SIopt@qspace{thinqspace}}
+\DeclareOption{noamssquareissue}{\def\@SIopt@amssquare{}}
+\DeclareOption{amssymb}{\def\@SIopt@amssquare{amssymb}}
+\DeclareOption{squaren}{\def\@SIopt@amssquare{squaren}}
+\DeclareOption{pstricks}{\def\@SIopt@pstricks{yes}}
+\DeclareOption{Gray}{\def\@SIopt@Gray{yes}}
+\DeclareOption{italian}{\def\@SIopt@italian{yes}}
+\DeclareOption{textstyle}{\def\@SIopt@textstyle{yes}}
+\DeclareOption{notextstyle}{\def\@SIopt@textstyle{}}
+\DeclareOption{binary}{\def\@SIopt@binary{yes}}
+\DeclareOption{noams}{\def\@SIopt@noams{yes}}
+\DeclareOption{derivedinbase}{\def\@SIopt@derivedinbase{yes}}
+\DeclareOption{derived}{\def\@SIopt@derived{yes}}
+%\DeclareOption{noderived}{\def\@SIopt@derived{}}
+
+\ProcessOptions
+
+%% Pass the SIunits yes/no options
+\ifx\@SIopt@cdot\@yes\PassOptionsToPackage{cdot}{SIunits}\fi
+\ifx\@SIopt@pstricks\@yes\PassOptionsToPackage{pstricks}{SIunits}\fi
+\ifx\@SIopt@Gray\@yes\PassOptionsToPackage{Gray}{SIunits}\fi
+\ifx\@SIopt@italian\@yes\PassOptionsToPackage{italian}{SIunits}\fi
+\ifx\@SIopt@textstyle\@yes\PassOptionsToPackage{textstyle}{SIunits}\fi
+\ifx\@SIopt@binary\@yes\PassOptionsToPackage{binary}{SIunits}\fi
+\ifx\@SIopt@noams\@yes\PassOptionsToPackage{noams}{SIunits}\fi
+\ifx\@SIopt@derivedinbase\@yes\PassOptionsToPackage{derivedinbase}{SIunits}\fi
+\ifx\@SIopt@derived\@yes\PassOptionsToPackage{derived}{SIunits}\fi
+%% Pass the SIunits "choice" options
+\ifx\@SIopt@space\@empty\else\PassOptionsToPackage{\@SIopt@space}{SIunits}\fi
+\ifx\@SIopt@qspace\@empty\else\PassOptionsToPackage{\@SIopt@qspace}{SIunits}\fi
+\ifx\@SIopt@amssquare\@empty\else\PassOptionsToPackage{\@SIopt@amssquare}{SIunits}\fi
+
+%% Get the dependancy packages, now that the options
+%% have been processed
+\RequirePackage{amsmath}
+\RequirePackage{xspace}
+\RequirePackage{SIunits}
+
+%% -------------------------------------------------
+%% Units defined below here
+%% -------------------------------------------------
+
+\@NewUnit{\Hz}{\hertz}
+\ifx\@HEPopt@noprefixcmds\@empty
+%% Lengths
+\@NewUnit{\nm}{\nano\metre}
+\@NewUnit{\micron}{\micro\metre}
+\@NewUnit{\mm}{\milli\metre}
+\@NewUnit{\cm}{\centi\metre}
+
+%% Angles
+\@NewUnit{\mrad}{\milli\rad}
+
+%% Times
+\@NewUnit{\as}{\atto\second}
+\@NewUnit{\fs}{\femto\second}
+\@NewUnit{\ps}{\pico\second}
+\@NewUnit{\ns}{\nano\second}
+
+%% Rates
+\@NewUnit{\mHz}{\milli\hertz}
+\@NewUnit{\kHz}{\kilo\hertz}
+\@NewUnit{\MHz}{\mega\hertz}
+\@NewUnit{\GHz}{\giga\hertz}
+\@NewUnit{\THz}{\tera\hertz}
+\fi
+
+%% Fields
+\@NewUnit{\gauss}{G}
+
+%% Luminosity
+\@NewUnit{\invcmsqpersecond}{\rpsquare{\centi\metre}\usk\reciprocal{\second}}
+\@NewUnit{\invcmsqpersec}{\invcmsqpersecond}
+\DeclareRobustCommand{\lumiunits}{\invcmsqpersecond}
+
+%% (Inverse) cross-sections
+\@NewUnit{\invbarn}{\reciprocal\barn\xspace}
+\ifx\@HEPopt@noprefixcmds\@empty
+\@NewUnit{\nanobarn}{\nano\barn\xspace}
+\@NewUnit{\picobarn}{\pico\barn\xspace}
+\@NewUnit{\femtobarn}{\femto\barn\xspace}
+\@NewUnit{\attobarn}{\atto\barn\xspace}
+\@NewUnit{\zeptobarn}{\zepto\barn\xspace}
+\@NewUnit{\yoctobarn}{\yocto\barn\xspace}
+\@NewUnit{\invnanobarn}{\nano\invbarn\xspace}
+\@NewUnit{\invpicobarn}{\pico\invbarn\xspace}
+\@NewUnit{\invfemtobarn}{\femto\invbarn\xspace}
+\@NewUnit{\invattobarn}{\atto\invbarn\xspace}
+\@NewUnit{\invzeptobarn}{\zepto\invbarn\xspace}
+\@NewUnit{\invyoctobarn}{\yocto\invbarn\xspace}
+\@NewUnit{\invnb}{\invnanobarn}
+\@NewUnit{\invpb}{\invpicobarn}
+\@NewUnit{\invfb}{\invfemtobarn}
+\@NewUnit{\invab}{\invattobarn}
+\@NewUnit{\invzb}{\invzeptobarn}
+\@NewUnit{\invyb}{\invyoctobarn}
+\fi
+
+%% HEP energy, momentum and mass units
+\DeclareRobustCommand{\clight}{\ensuremath{c}}
+\@NewUnit{\eV}{\electronvolt\xspace}
+\@NewUnit{\inveV}{\reciprocal\electronvolt\xspace}
+\@NewUnit{\eVoverc}{\ensuremath{\eV\!/\clight}\xspace}
+\@NewUnit{\eVovercsq}{\ensuremath{\eV\!/\clight^{2}}\xspace}
+\ifx\@HEPopt@noprefixcmds\@empty
+\@NewUnit{\meV}{\milli\eV}
+\@NewUnit{\keV}{\kilo\eV}
+\@NewUnit{\MeV}{\mega\eV}
+\@NewUnit{\GeV}{\giga\eV}
+\@NewUnit{\TeV}{\tera\eV}
+\@NewUnit{\minveV}{\milli\inveV}
+\@NewUnit{\kinveV}{\kilo\inveV}
+\@NewUnit{\MinveV}{\mega\inveV}
+\@NewUnit{\GinveV}{\giga\inveV}
+\@NewUnit{\TinveV}{\tera\inveV}
+\@NewUnit{\meVoverc}{\ensuremath{\milli\eVoverc}\xspace}
+\@NewUnit{\keVoverc}{\ensuremath{\kilo\eVoverc}\xspace}
+\@NewUnit{\MeVoverc}{\ensuremath{\mega\eVoverc}\xspace}
+\@NewUnit{\GeVoverc}{\ensuremath{\giga\eVoverc}\xspace}
+\@NewUnit{\TeVoverc}{\ensuremath{\tera\eVoverc}\xspace}
+\@NewUnit{\meVovercsq}{\ensuremath{\milli\eVovercsq}\xspace}
+\@NewUnit{\keVovercsq}{\ensuremath{\kilo\eVovercsq}\xspace}
+\@NewUnit{\MeVovercsq}{\ensuremath{\mega\eVovercsq}\xspace}
+\@NewUnit{\GeVovercsq}{\ensuremath{\giga\eVovercsq}\xspace}
+\@NewUnit{\TeVovercsq}{\ensuremath{\tera\eVovercsq}\xspace}
+\fi
diff --git a/macros/latex/contrib/hepunits/hepunits.tex b/macros/latex/contrib/hepunits/hepunits.tex
new file mode 100644
index 0000000000..325ffa1cfc
--- /dev/null
+++ b/macros/latex/contrib/hepunits/hepunits.tex
@@ -0,0 +1,219 @@
+\documentclass[12pt]{article}
+\usepackage{maybemath, xspace, setspace, fancyvrb, a4wide}
+\usepackage{url, relsize, booktabs, ccaption, braket}
+\usepackage{hepunits}
+\usepackage[colorlinks=true,bookmarks=true]{hyperref}
+\newcommand{\hepunits}{\texttt{hepunits}\xspace}
+
+\let\OldCite\cite
+\renewcommand{\cite}[1]{\mbox{\!\!\OldCite{#1}}}
+
+\onehalfspacing
+\DefineShortVerb{\|}
+
+\author{Andy Buckley, \texttt{andy@insectnation.org}}
+\title{The \hepunits \LaTeX{} package}
+
+\newcommand{\Or}{\ensuremath{\vert}\xspace}
+\newcommand{\manifestsAs}{\ensuremath{\Rightarrow\quad}\xspace}
+\newcommand{\texcmd}[1]{\texttt{\char`\\#1}}
+\newcommand{\texenv}[1]{\texttt{\char`#1}}
+\newcommand{\texopt}[1]{\texttt{\char`#1}}
+\newcommand{\texarg}[1]{\texttt{\char`#1}}
+\newcommand{\texpkg}[1]{\texttt{\char`#1}}
+\newcommand{\texcls}[1]{\texttt{\char`#1}}
+\newcommand{\texcommand}[1]{\texcmd{#1}}
+\newcommand{\texoption}[1]{\texopt{#1}}
+\newcommand{\texgen}[1]{\ensuremath{\braket{\text{\emph{#1}}}}}
+\newenvironment{snippet}{\Verbatim}{\endVerbatim}
+
+\begin{document}
+\maketitle
+
+\abstract{%
+ The \hepunits package extends the existing (and excellent) \texpkg{SIunits}
+ package to support units commonly used in high-energy physics. HEP uses a
+ rather specialised set of units to describe measurements of energies, masses,
+ momenta, reaction cross-sections, luminosities and so-on. Using this package
+ will provide particle physicists with a consistent and accurate way to refer
+ to dimensionful HEP quantities.
+%
+}
+
+\section{Recommended usage}
+The basic usage mode for \hepunits is to place
+%
+\begin{snippet}
+\usepackage{hepunits}
+\end{snippet}
+%
+in the preamble of your document. \hepunits also supports the \texpkg{SIunits}
+optional arguments (\texopt{thickspace}, \texopt{amssymb} and so-on), which are
+passed on directly to the \texpkg{SIunits} package. By default the
+\texopt{mediumspace}, \texopt{thickqspace}, \texopt{squaren} and
+\texopt{textstyle} options are passed, but these can be overridden.
+\texopt{amssymb} and \texopt{squaren} are considered to be mutually exclusive
+options, but you can choose to pass neither option to \texpkg{SIunits} by using
+the \hepunits \texopt{noamssquareissue} option. Additionally, the \hepunits
+\texopt{notextstyle} option can be used to turn the \texpkg{SIunits}
+\texopt{textstyle} off. On the whole, though, you should be able to use
+\hepunits with no options in most circumstances and are likely only to need them
+if you want access to the binary or derived units (using \texopt{binary} and
+\texopt{derived}/\texopt{derivedinbase} respectively).
+
+Finally, the only \hepunits-specific option is \texopt{noprefixcmds}. This is
+discussed at the end of the document and is probably only useful for macro
+language pedants!\footnote{No offence intended to macro language pedants, of course\dots}
+
+
+\section{Requirements}
+\hepunits requires the \texpkg{SIunits}, \texpkg{xspace} and \texpkg{amsmath}
+packages to be installed as part of your \TeX{} distribution. I don't know of
+any distributions for which this isn't the case, so chances are you're safe to
+just install \hepunits and use it right away!
+
+
+\section{Provided units}
+The HEP units provided by \hepunits are listed in Tables \ref{tab:normunits} and
+\ref{tab:hepunits} below. All the example outputs have been produced with a
+command like |\unit{1.0}{|\texgen{unit}|}| where \texgen{unit} is one of the
+unit commands listed in the tables.
+
+\begin{table}[ht]
+\centering
+\begin{tabular}{ll}
+\toprule
+Unit command & Example \\
+
+\midrule
+Lengths & \\
+\texcmd{nm} & \unit{1.0}{\nm} \\
+\texcmd{micron} & \unit{1.0}{\micron} \\
+\texcmd{mm} & \unit{1.0}{\mm} \\
+\texcmd{cm} & \unit{1.0}{\cm} \\
+
+\midrule
+Times & \\
+\texcmd{ns} & \unit{1.0}{\ns} \\
+\texcmd{ps} & \unit{1.0}{\ps} \\
+\texcmd{fs} & \unit{1.0}{\fs} \\
+\texcmd{as} & \unit{1.0}{\as} \\
+
+\midrule
+Rates & \\
+\texcmd{mHz} & \unit{1.0}{\mHz} \\
+\texcmd{Hz} & \unit{1.0}{\Hz} \\
+\texcmd{kHz} & \unit{1.0}{\kHz} \\
+\texcmd{MHz} & \unit{1.0}{\MHz} \\
+\texcmd{GHz} & \unit{1.0}{\GHz} \\
+\texcmd{THz} & \unit{1.0}{\THz} \\
+
+\midrule
+Misc. & \\
+\texcmd{mrad} & \unit{1.0}{\mrad} \\
+\texcmd{gauss} & \unit{1.0}{\gauss} \\
+
+\bottomrule
+\end{tabular}
+\caption{List of non-HEP specific units provided by \hepunits}
+\label{tab:normunits}
+\end{table}
+
+\begin{table}[ht]
+\centering
+\begin{tabular}{ll}
+\toprule
+Unit command & Example \\
+\midrule
+Luminosities & \\
+\texcmd{invcmsqpersecond} & \unit{1.0}{\invcmsqpersecond} \\
+\texcmd{invcmsqpersec} & \unit{1.0}{\invcmsqpersec} \\
+\texcmd{lumiunits} & \unit{1.0}{\lumiunits} \\
+
+\midrule
+Cross-sections & \\
+\texcmd{barn} & \unit{1.0}{\barn} \\
+\texcmd{invbarn} & \unit{1.0}{\invbarn} \\
+\texcmd{nanobarn} & \unit{1.0}{\nanobarn} \\
+\texcmd{invnanobarn} / \texcmd{invnb} & \unit{1.0}{\invnanobarn} \\
+\texcmd{picobarn} & \unit{1.0}{\picobarn} \\
+\texcmd{invpicobarn} / \texcmd{invpb} & \unit{1.0}{\invpicobarn} \\
+\texcmd{femtobarn} & \unit{1.0}{\femtobarn} \\
+\texcmd{invfemtobarn} / \texcmd{invfb} & \unit{1.0}{\invfemtobarn} \\
+\texcmd{attobarn} & \unit{1.0}{\attobarn} \\
+\texcmd{invattobarn} / \texcmd{invab} & \unit{1.0}{\invattobarn} \\
+
+\bottomrule
+\end{tabular}
+\caption{List of HEP-specific units provided by \hepunits}
+\label{tab:hepunits}
+\end{table}
+
+
+\begin{table}[ht]
+\centering
+\begin{tabular}{ll}
+\toprule
+Unit command & Example \\
+\midrule
+\eV-based units & \\
+\texcmd{eV} & \unit{1.0}{\eV} \\
+\texcmd{inveV} & \unit{1.0}{\inveV} \\
+\texcmd{eVoverc} & \unit{1.0}{\eVoverc} \\
+\texcmd{eVovercsq} & \unit{1.0}{\eVovercsq} \\
+\texcmd{meV} & \unit{1.0}{\meV} \\
+\texcmd{keV} & \unit{1.0}{\keV} \\
+\texcmd{MeV} & \unit{1.0}{\MeV} \\
+\texcmd{GeV} & \unit{1.0}{\GeV} \\
+\texcmd{TeV} & \unit{1.0}{\TeV} \\
+\texcmd{minveV} & \unit{1.0}{\minveV} \\
+\texcmd{kinveV} & \unit{1.0}{\kinveV} \\
+\texcmd{MinveV} & \unit{1.0}{\MinveV} \\
+\texcmd{GinveV} & \unit{1.0}{\GinveV} \\
+\texcmd{TinveV} & \unit{1.0}{\TinveV} \\
+\texcmd{meVoverc} & \unit{1.0}{\meVoverc} \\
+\texcmd{keVoverc} & \unit{1.0}{\keVoverc} \\
+\texcmd{MeVoverc} & \unit{1.0}{\MeVoverc} \\
+\texcmd{GeVoverc} & \unit{1.0}{\GeVoverc} \\
+\texcmd{TeVoverc} & \unit{1.0}{\TeVoverc} \\
+\texcmd{meVovercsq} & \unit{1.0}{\meVovercsq} \\
+\texcmd{keVovercsq} & \unit{1.0}{\keVovercsq} \\
+\texcmd{MeVovercsq} & \unit{1.0}{\MeVovercsq} \\
+\texcmd{GeVovercsq} & \unit{1.0}{\GeVovercsq} \\
+\texcmd{TeVovercsq} & \unit{1.0}{\TeVovercsq} \\
+
+\bottomrule
+\end{tabular}
+\contcaption{List of HEP-specific units provided by \hepunits (cont.)}
+\label{tab:hepunits2}
+\end{table}
+
+Note that a lot of these units have, for convenience, been provided as explicit
+commands with various SI prefixes, rather than just defining the base unit and
+using the \texpkg{SIunits} prescription for the prefixes. Let's give a demo in
+case you don't know what I'm waffling about\dots the ``usual'' \texpkg{SUunits}
+way of doing things is like this:
+|\unit{1.0}{\mega\eVoverc}|. This produces ``\unit{1.0}{\mega\eVoverc}''
+just like |\unit{1.0}{\MeVoverc}| would do.
+
+I've chosen to provide the explicit prefixed commands for convenience: choose
+your own favourite way (the same applies even more so for most of the non-HEP
+units). If you are bothered about the explictly prefixed commands clogging up
+the \LaTeX{} macro namespace then pass the \texopt{noprefixcmds} option to
+\hepunits and the offending commands won't be defined at all. This will make
+life awkward when it comes to inverse cross-sections as used for integrated
+luminosities, but with suitable use of \texcmd{invbarn} I'm sure you can make
+do.
+
+\section{Summary}
+\hepunits is a handy package for particle physicists who'd like their units to
+look right, with upright \micro{s} and properly italicised $c$s in the
+appropriate places. Fortunately most of the work has already been done by the
+marvellous \texpkg{SIunits} package and I've just provided a few more commands
+and an option passing wrapper on to that excellent piece of work.
+
+If you have any comments, criticism, huge cash donations etc., then please do
+send them my way. Email to |andy@insectnation.org| is preferred, but if you can
+find a way to get your message to me by carrier pigeon I'll be very impressed.
+
+\end{document}