summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hepunits/hepunits.sty
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/hepunits.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/hepunits/hepunits.sty')
-rw-r--r--macros/latex/contrib/hepunits/hepunits.sty172
1 files changed, 172 insertions, 0 deletions
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