%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                              %
%  CERN package defining abbreviations for units               %
%                                                              %
%  1.0  (13/09/2005)  MG                                       %
%    - Initial version                                         %
%  1.01 small backshift (-2mu instead of -3mu) for GeV/c^2     %
%    - 18/10/2005                                              %
%  1.02 Add parsec and kparsec                                 %
%    - 11/11/2005                                              %
%  1.03 Add Watt                                               %
%    - 14/11/2005                                              %
%  1.04 change UDG to \UDC (degrees Celsius)                   %
%    - 15/12/2005                                              %
%  1.05 Add \UThz and \UTHzZ                                   %
%           \UB, \UdB \UdBm and \UBZ \UdBZ \UdBmZ              %
%           (Bel and deciBel)                                  %
%    - 25/03/2009                                              %
%  1.06 Add Farad, Ampere, ohm units                           %
%           \UmF, \UuF, \UnF, \UpF, \UfF                       %
%           \UmFZ, \UuFZ, \UnFZ, \UpFZ, \UfFZ                  %
%           \UkO, \UMO, \UkOZ, \UMOZ                           %
%           \UmA, \UkA, \UmAZ, \UkAZ                           %
%    - 01/04/2009                                              %
%  1.07 Add Ampere, energy, power, pressue and second subunits %
%           \UuA, \UuAZ, \Uas, \UasZ                           %
%           \UkW, \UkWZ, \UMW, \UMWZ, \UGW, \UGWZ              %
%           \UkJ, \UkJZ, \UMJ, \UMJZ                           %
%           \Ubar, \UbarZ, \Umbar, \UmbarZ                     %
%    - 15/04/2009                                              %
%  1.08 Add msievert                                           %
%           \UmSv, \mSvK, \UGJ, \UGJZ, \Uurad, \UuradZ         %
%    - 12/05/2009                                              %
%                                                              %
%  Last Mod.: 12 May 2009 (MG)                                 %
%                                                              %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\fileversion{1.08}
\def\filedate{2009/05/12}
\def\docdate {2009/05/12}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cernunits}%
    [\filedate\space CERN units LaTeX style components
                            (version\space\fileversion)]
\RequirePackage{amsmath,textcomp}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Units                                                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand*{\Unit}[2]{\ensuremath{#1~\text{#2}}}
%% space between digit and unit
\providecommand*\USP{~}
%%%%%%%%%% HEP Energy, momentum, etc.
\newcommand*{\UeV}[1][\empty]{\ensuremath{\USP\text{#1eV}}}%%%eV
\newcommand*{\UkeV}          {\ensuremath{\USP\text{keV}}}
\newcommand*{\UMeV}          {\ensuremath{\USP\text{MeV}}}
\newcommand*{\UGeV}          {\ensuremath{\USP\text{GeV}}}
\newcommand*{\UTeV}          {\ensuremath{\USP\text{TeV}}}
\newcommand*{\UPeV}          {\ensuremath{\USP\text{PeV}}}
\newcommand*{\UeVc}[1][\empty]{\ensuremath{\USP\text{#1eV}\!/\mspace{-2mu}c}}%%%eV
\newcommand*{\UkeVc}          {\ensuremath{\USP\text{keV}\!/\mspace{-2mu}c}}
\newcommand*{\UMeVc}          {\ensuremath{\USP\text{MeV}\!/\mspace{-2mu}c}}
\newcommand*{\UGeVc}          {\ensuremath{\USP\text{GeV}\!/\mspace{-2mu}c}}
\newcommand*{\UTeVc}          {\ensuremath{\USP\text{TeV}\!/\mspace{-2mu}c}}
\newcommand*{\UPeVc}          {\ensuremath{\USP\text{PeV}\!/\mspace{-2mu}c}}
\newcommand*{\UeVcc}[1][\empty]{\ensuremath{\USP\text{#1eV}\!/\mspace{-2mu}c^2}}%%%eV
\newcommand*{\UkeVcc}          {\ensuremath{\USP\text{keV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UMeVcc}          {\ensuremath{\USP\text{MeV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UGeVcc}          {\ensuremath{\USP\text{GeV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UTeVcc}          {\ensuremath{\USP\text{TeV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UPeVcc}          {\ensuremath{\USP\text{PeV}\!/\mspace{-2mu}c^2}}
  %%%% without preceeding space
\newcommand*{\UeVZ}[1][\empty]{\ensuremath{\text{#1eV}}}%%%eV
\newcommand*{\UkeVZ}          {\ensuremath{\text{keV}}}
\newcommand*{\UMeVZ}          {\ensuremath{\text{MeV}}}
\newcommand*{\UGeVZ}          {\ensuremath{\text{GeV}}}
\newcommand*{\UTeVZ}          {\ensuremath{\text{TeV}}}
\newcommand*{\UPeVZ}          {\ensuremath{\text{PeV}}}
\newcommand*{\UeVcZ}[1][\empty]{\ensuremath{\text{#1eV}\!/\mspace{-2mu}c}}%%%eV
\newcommand*{\UkeVcZ}          {\ensuremath{\text{keV}\!/\mspace{-2mu}c}}
\newcommand*{\UMeVcZ}          {\ensuremath{\text{MeV}\!/\mspace{-2mu}c}}
\newcommand*{\UGeVcZ}          {\ensuremath{\text{GeV}\!/\mspace{-2mu}c}}
\newcommand*{\UTeVcZ}          {\ensuremath{\text{TeV}\!/\mspace{-2mu}c}}
\newcommand*{\UPeVcZ}          {\ensuremath{\text{PeV}\!/\mspace{-2mu}c}}
\newcommand*{\UeVccZ}[1][\empty]{\ensuremath{\text{#1eV}\!/\mspace{-2mu}c^2}}%%%eV
\newcommand*{\UkeVccZ}          {\ensuremath{\text{keV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UMeVccZ}          {\ensuremath{\text{MeV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UGeVccZ}          {\ensuremath{\text{GeV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UTeVccZ}          {\ensuremath{\text{TeV}\!/\mspace{-2mu}c^2}}
\newcommand*{\UPeVccZ}          {\ensuremath{\text{PeV}\!/\mspace{-2mu}c^2}}

%%%%%%%%%% Lengths
\newcommand*{\Um}[1][\empty]{\ensuremath{\USP\text{#1m}}}%%% metre
\newcommand*{\Ufm}          {\ensuremath{\USP\text{fm}}}
\newcommand*{\Upm}          {\ensuremath{\USP\text{pm}}}
\newcommand*{\Unm}          {\ensuremath{\USP\text{nm}}}
\newcommand*{\Uum}          {\ensuremath{\USP\text{\textmu m}}}
\newcommand*{\Umm}          {\ensuremath{\USP\text{mm}}}
\newcommand*{\Ucm}          {\ensuremath{\USP\text{cm}}}
\newcommand*{\Udm}          {\ensuremath{\USP\text{dm}}}
\newcommand*{\Ukm}          {\ensuremath{\USP\text{km}}}
\newcommand*{\Upc}          {\ensuremath{\USP\text{pc}}}% parsec
\newcommand*{\Ukpc}         {\ensuremath{\USP\text{kpc}}}% kparsec
\newcommand*{\UMpc}         {\ensuremath{\USP\text{Mpc}}}% Mparsec
  %%%% without preceeding space
\newcommand*{\UmZ}[1][\empty]{\ensuremath{\text{#1m}}}%%% metre
\newcommand*{\UfmZ}          {\ensuremath{\text{fm}}}
\newcommand*{\UpmZ}          {\ensuremath{\text{pm}}}
\newcommand*{\UnmZ}          {\ensuremath{\text{nm}}}
\newcommand*{\UumZ}          {\ensuremath{\text{\textmu m}}}
\newcommand*{\UmmZ}          {\ensuremath{\text{mm}}}
\newcommand*{\UcmZ}          {\ensuremath{\text{cm}}}
\newcommand*{\UdmZ}          {\ensuremath{\text{dm}}}
\newcommand*{\UkmZ}          {\ensuremath{\text{km}}}
\newcommand*{\UpcZ}          {\ensuremath{\text{pc}}}% parsec
\newcommand*{\UkpcZ}         {\ensuremath{\text{kpc}}}% kparsec
\newcommand*{\UMpcZ}         {\ensuremath{\text{Mpc}}}% Mparsec

%%%%%%%%%% Weights
\newcommand*{\Ug}[1][\empty]{\ensuremath{\USP\text{#1g}}}%%% gramme
\newcommand*{\Ung}          {\ensuremath{\USP\text{ng}}}
\newcommand*{\Uug}          {\ensuremath{\USP\text{\textmu g}}}
\newcommand*{\Umg}          {\ensuremath{\USP\text{mg}}}
\newcommand*{\Ukg}          {\ensuremath{\USP\text{kg}}}
  %%%% without preceeding space
\newcommand*{\UgZ}[1][\empty]{\ensuremath{\text{#1g}}}%%% gramme
\newcommand*{\UngZ}          {\ensuremath{\text{ng}}}
\newcommand*{\UugZ}          {\ensuremath{\text{\textmu g}}}
\newcommand*{\UmgZ}          {\ensuremath{\text{mg}}}
\newcommand*{\UkgZ}          {\ensuremath{\text{kg}}}

%%%%%%%%%% Force, energy, power, pressure
\newcommand*{\UN}[1][\empty]{\ensuremath{\USP\text{#1N}}}%%% newton
\newcommand*{\UJ}[1][\empty]{\ensuremath{\USP\text{#1J}}}%%% joule
\newcommand*{\UkJ}          {\ensuremath{\USP\text{kJ}}}%%% kilojoule
\newcommand*{\UMJ}          {\ensuremath{\USP\text{MJ}}}%%% megajoule
\newcommand*{\UGJ}          {\ensuremath{\USP\text{GJ}}}%%% gigajoule
\newcommand*{\UW}[1][\empty]{\ensuremath{\USP\text{#1W}}}%%% Watt
\newcommand*{\UkW}          {\ensuremath{\USP\text{kW}}}%%% kiloWatt
\newcommand*{\UMW}          {\ensuremath{\USP\text{MW}}}%%% megaWatt
\newcommand*{\UGW}          {\ensuremath{\USP\text{GW}}}%%% gigaWatt
\newcommand*{\UPa}[1][\empty]{\ensuremath{\USP\text{#1Pa}}}%%% pascal
\newcommand*{\Ubar}[1][\empty]{\ensuremath{\USP\text{#1mar}}}%%% bar
\newcommand*{\Umbar}          {\ensuremath{\USP\text{mbar}}}%%% mbar
  %%%% without preceeding space
\newcommand*{\UNZ}[1][\empty]{\ensuremath{\text{#1N}}}%%% newton
\newcommand*{\UJZ}[1][\empty]{\ensuremath{\text{#1J}}}%%% joule
\newcommand*{\UkJZ}          {\ensuremath{\text{kJ}}}%%% kilojoule
\newcommand*{\UMJZ}          {\ensuremath{\text{MJ}}}%%% megajoule
\newcommand*{\UGJZ}          {\ensuremath{\text{GJ}}}%%% gigajoule
\newcommand*{\UWZ}[1][\empty]{\ensuremath{\text{#1W}}}%%% Watt
\newcommand*{\UkWZ}          {\ensuremath{\text{kW}}}%%% kiloWatt
\newcommand*{\UMWZ}          {\ensuremath{\text{MW}}}%%% megaWatt
\newcommand*{\UGWZ}          {\ensuremath{\text{GW}}}%%% gigaWatt
\newcommand*{\UPaZ}[1][\empty]{\ensuremath{\text{#1Pa}}}%%% pascal
\newcommand*{\UbarZ}[1][\empty]{\ensuremath{\text{#1mar}}}%%% bar
\newcommand*{\UmbarZ}          {\ensuremath{\text{mbar}}}%%% mbar

%%%%%%%%%% Cross-sections (barn)
\newcommand*{\Ub}[1][\empty]{\ensuremath{\USP\text{#1b}}}%%% barn
\newcommand*{\Ufb}          {\ensuremath{\USP\text{fb}}}
\newcommand*{\Upb}          {\ensuremath{\USP\text{pb}}}
\newcommand*{\Unb}          {\ensuremath{\USP\text{nb}}}
\newcommand*{\Uub}          {\ensuremath{\USP\text{\textmu b}}}
\newcommand*{\Umb}          {\ensuremath{\USP\text{mb}}}
  %%%% without preceeding space
\newcommand*{\UbZ}[1][\empty]{\ensuremath{\text{#1b}}}%%% barn
\newcommand*{\UfbZ}          {\ensuremath{\text{fb}}}
\newcommand*{\UpbZ}          {\ensuremath{\text{pb}}}
\newcommand*{\UnbZ}          {\ensuremath{\text{nb}}}
\newcommand*{\UubZ}          {\ensuremath{\text{\textmu b}}}
\newcommand*{\UmbZ}          {\ensuremath{\text{mb}}}

%%%%%%%%%% Time and frequency
\newcommand*{\Us}[1][\empty]{\ensuremath{\USP\text{#1s}}}%%% second
\newcommand*{\Uas}          {\ensuremath{\USP\text{as}}}%%% attosecond
\newcommand*{\Ufs}          {\ensuremath{\USP\text{fs}}}
\newcommand*{\Ups}          {\ensuremath{\USP\text{ps}}}
\newcommand*{\Uns}          {\ensuremath{\USP\text{ns}}}
\newcommand*{\Uus}          {\ensuremath{\USP\text{\textmu s}}}
\newcommand*{\Ums}          {\ensuremath{\USP\text{ms}}}
\newcommand*{\Uh}[1][\empty]{\ensuremath{\USP\text{#1h}}}%%% hour
\newcommand*{\Uy}[1][\empty]{\ensuremath{\USP\text{#1y}}}%%% year
\newcommand*{\UHz}[1][\empty]{\ensuremath{\USP\text{#1Hz}}}%%% Hertz
\newcommand*{\UkHz}          {\ensuremath{\USP\text{kHz}}}
\newcommand*{\UMHz}          {\ensuremath{\USP\text{MHz}}}
\newcommand*{\UGHz}          {\ensuremath{\USP\text{GHz}}}
\newcommand*{\UTHz}          {\ensuremath{\USP\text{THz}}}
  %%%% without preceeding space
\newcommand*{\UsZ}[1][\empty]{\ensuremath{\text{#1s}}}%%% second
\newcommand*{\UasZ}          {\ensuremath{\text{as}}}%%% attosecond
\newcommand*{\UfsZ}          {\ensuremath{\text{fs}}}
\newcommand*{\UpsZ}          {\ensuremath{\text{ps}}}
\newcommand*{\UnsZ}          {\ensuremath{\text{ns}}}
\newcommand*{\UusZ}          {\ensuremath{\text{\textmu s}}}
\newcommand*{\UmsZ}          {\ensuremath{\text{ms}}}
\newcommand*{\UhZ}[1][\empty]{\ensuremath{\text{#1h}}}%%% hour
\newcommand*{\UyZ}[1][\empty]{\ensuremath{\text{#1y}}}%%% year
\newcommand*{\UHzZ}[1][\empty]{\ensuremath{\text{#1Hz}}}%%% hertz
\newcommand*{\UkHzZ}          {\ensuremath{\text{kHz}}}
\newcommand*{\UMHzZ}          {\ensuremath{\text{MHz}}}
\newcommand*{\UGHzZ}          {\ensuremath{\text{GHz}}}
\newcommand*{\UTHzZ}          {\ensuremath{\text{THz}}}

%%%%%%%%%% Magnetic field
\newcommand*{\UG}[1][\empty]{\ensuremath{\USP\text{#1G}}}%%% gauss
\newcommand*{\UkG}          {\ensuremath{\USP\text{kG}}}
\newcommand*{\UH}[1][\empty]{\ensuremath{\USP\text{#1H}}}%%% henry
\newcommand*{\UT}[1][\empty]{\ensuremath{\USP\text{#1T}}}%%% tesla
\newcommand*{\UWb}[1][\empty]{\ensuremath{\USP\text{#1Wb}}}%%% weber
  %%%% without preceeding space
\newcommand*{\UGZ}[1][\empty]{\ensuremath{\text{#1G}}}%%% gauss
\newcommand*{\UkGZ}          {\ensuremath{\text{kG}}}
\newcommand*{\UHZ}[1][\empty]{\ensuremath{\text{#1H}}}%%% henry
\newcommand*{\UTZ}[1][\empty]{\ensuremath{\text{#1T}}}%%% tesla
\newcommand*{\UWbZ}[1][\empty]{\ensuremath{\text{#1Wb}}}%%% weber

%%%%%%%%%% Current, Voltage, Charge, Capacitance, Resistance
\newcommand*{\UA}[1][\empty]{\ensuremath{\USP\text{#1A}}}%%% ampere
\newcommand*{\UuA}          {\ensuremath{\USP\text{\textmu A}}}%%% micrompere
\newcommand*{\UmA}          {\ensuremath{\USP\text{mA}}}%%% milliampere
\newcommand*{\UkA}          {\ensuremath{\USP\text{kA}}}%%% kiloampere
\newcommand*{\UC}[1][\empty]{\ensuremath{\USP\text{#1C}}}%%% coulomb
\newcommand*{\UF}[1][\empty]{\ensuremath{\USP\text{#1F}}}%%% farad
\newcommand*{\UmF}          {\ensuremath{\USP\text{mF}}}%%% mF
\newcommand*{\UuF}          {\ensuremath{\USP\text{\textmu F}}}%%% microF
\newcommand*{\UnF}          {\ensuremath{\USP\text{nF}}}%%% nF
\newcommand*{\UpF}          {\ensuremath{\USP\text{pF}}}%%% pF
\newcommand*{\UfF}          {\ensuremath{\USP\text{fF}}}%%% fF
\newcommand*{\UO}[1][\empty]{\ensuremath{\USP\text{#1}\Omega}}%%% ohm
\newcommand*{\UkO}          {\ensuremath{\USP\text{k}\Omega}}%%% kiloohm
\newcommand*{\UMO}          {\ensuremath{\USP\text{M}\Omega}}%%% megaohm
\newcommand*{\US}[1][\empty]{\ensuremath{\USP\text{#1S}}}%%% siemens
\newcommand*{\UV}[1][\empty]{\ensuremath{\USP\text{#1V}}}%%% volt
\newcommand*{\UkV}          {\ensuremath{\USP\text{kV}}}%%% kilovolt
\newcommand*{\UMV}          {\ensuremath{\USP\text{MV}}}%%% megavolt
\newcommand*{\UmV}          {\ensuremath{\USP\text{mV}}}%%% millivolt
\newcommand*{\UuV}          {\ensuremath{\USP\text{\textmu V}}}%%% microvolt
  %%%% without preceeding space
\newcommand*{\UAZ}[1][\empty]{\ensuremath{\text{#1A}}}%%% ampere
\newcommand*{\UuAZ}          {\ensuremath{\text{\textmu A}}}%%% micrompere
\newcommand*{\UmAZ}          {\ensuremath{\text{mA}}}%%% milliampere
\newcommand*{\UkAZ}          {\ensuremath{\text{kA}}}%%% kiloampere
\newcommand*{\UCZ}[1][\empty]{\ensuremath{\text{#1C}}}%%% coulomb
\newcommand*{\UFZ}[1][\empty]{\ensuremath{\text{#1F}}}%%% farad
\newcommand*{\UmFZ}          {\ensuremath{\text{mF}}}%%% mF
\newcommand*{\UuFZ}          {\ensuremath{\text{\textmu F}}}%%% microF
\newcommand*{\UnFZ}          {\ensuremath{\text{nF}}}%%% nF
\newcommand*{\UpFZ}          {\ensuremath{\text{pF}}}%%% pF
\newcommand*{\UfFZ}          {\ensuremath{\text{fF}}}%%% fF
\newcommand*{\UOZ}[1][\empty]{\ensuremath{\text{#1}\Omega}}%%% ohm
\newcommand*{\UkOZ}          {\ensuremath{\text{k}\Omega}}%%% kiloohm
\newcommand*{\UMOZ}          {\ensuremath{\text{M}\Omega}}%%% megaohm
\newcommand*{\USZ}[1][\empty]{\ensuremath{\text{#1S}}}%%% siemens
\newcommand*{\UVZ}[1][\empty]{\ensuremath{\text{#1V}}}%%% volt
\newcommand*{\UkVZ}          {\ensuremath{\text{kV}}}%%% kvolt
\newcommand*{\UMVZ}          {\ensuremath{\text{MV}}}%%% megavolt
\newcommand*{\UmVZ}          {\ensuremath{\text{mV}}}%%% millivolt
\newcommand*{\UuVZ}          {\ensuremath{\text{\textmu V}}}%%% microvolt

%%%%%%%%%% Temperature
\newcommand*{\UK}[1][\empty]{\ensuremath{\USP\text{#1K}}}%%% kelvin
\newcommand*{\UDC}          {\ensuremath{{}^{\circ}\text{C}}}%%% degree Celcius
                   %%% \UDC no space preceding symbol
  %%%% without preceeding space
\newcommand*{\UKZ}[1][\empty]{\ensuremath{\text{#1K}}}%%% kelvin
\newcommand*{\UDCZ}          {\ensuremath{{}^{\circ}\text{C}}}%%% degree Celcius

%%%%%%%%%% radiactive doses
\newcommand*{\UBq}[1][\empty]{\ensuremath{\USP\text{#1Bq}}}%%% becquerel
\newcommand*{\UGy}[1][\empty]{\ensuremath{\USP\text{#1Gy}}}%%% gray  
\newcommand*{\USv}[1][\empty]{\ensuremath{\USP\text{#1Sv}}}%%% sievert
\newcommand*{\UmSv}          {\ensuremath{\USP\text{mSv}}}%%% millisievert
  %%%% without preceeding space
\newcommand*{\UBqZ}[1][\empty]{\ensuremath{\text{#1Bq}}}%%% becquerel
\newcommand*{\UGyZ}[1][\empty]{\ensuremath{\text{#1Gy}}}%%% gray  
\newcommand*{\USvZ}[1][\empty]{\ensuremath{\text{#1Sv}}}%%% sievert
\newcommand*{\UmSvZ}          {\ensuremath{\text{mSv}}}%%% millisievert

%%%%%%%%%% Dimensionless units
\newcommand*{\Urad}[1][\empty]{\ensuremath{\USP\text{#1rad}}}%%% radian
\newcommand*{\Umrad}          {\ensuremath{\USP\text{mrad}}}%%% milliradian
\newcommand*{\Uurad}          {\ensuremath{\USP\text{\textmu rad}}}%%% microradian
\newcommand*{\UB}             {\ensuremath{\USP\text{B}}}%%% bel
\newcommand*{\UdB}            {\ensuremath{\USP\text{dB}}}%%% decibel
\newcommand*{\UdBm}           {\ensuremath{\USP\text{dBm}}}%%% decibel
  %%%% without preceeding space
\newcommand*{\UradZ}[1][\empty]{\ensuremath{\text{#1rad}}}%%% radian
\newcommand*{\UmradZ}          {\ensuremath{\text{mrad}}}%%% milliradian
\newcommand*{\UuradZ}          {\ensuremath{\text{\textmu rad}}}%%% microradian
\newcommand*{\UBZ}             {\ensuremath{\text{B}}}%%% bel
\newcommand*{\UdBZ}            {\ensuremath{\text{dB}}}%%% decibel
\newcommand*{\UdBmZ}           {\ensuremath{\text{dBm}}}%%% decibel

\endinput
