summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hepunits/hepunits.sty
blob: 50b8adcd48ceb016bdc0a83c7209a9d09713e870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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