%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                              %
%  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 and \UBZ, \UdBZ (Bel and deciBel)        %
%    - 25/03/2009                                              %
%                                                              %
%  Last Mod.: 25 March 2009 (MG)                               %
%                                                              %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\fileversion{1.05}
\def\filedate{2009/03/25}
\def\docdate {2009/03/25}
\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*{\UW}[1][\empty]{\ensuremath{\USP\text{#1W}}}%%% Watt
\newcommand*{\UPa}[1][\empty]{\ensuremath{\USP\text{#1Pa}}}%%% pascal
  %%%% without preceeding space
\newcommand*{\UNZ}[1][\empty]{\ensuremath{\text{#1N}}}%%% newton
\newcommand*{\UJZ}[1][\empty]{\ensuremath{\text{#1J}}}%%% joule
\newcommand*{\UWZ}[1][\empty]{\ensuremath{\text{#1W}}}%%% Watt
\newcommand*{\UPaZ}[1][\empty]{\ensuremath{\text{#1Pa}}}%%% pascal

%%%%%%%%%% 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*{\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*{\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, Capacity, Resistance
\newcommand*{\UA}[1][\empty]{\ensuremath{\USP\text{#1A}}}%%% ampere
\newcommand*{\UC}[1][\empty]{\ensuremath{\USP\text{#1C}}}%%% coulomb
\newcommand*{\UF}[1][\empty]{\ensuremath{\USP\text{#1F}}}%%% farad
\newcommand*{\UO}[1][\empty]{\ensuremath{\USP\text{#1}\Omega}}%%% ohm
\newcommand*{\US}[1][\empty]{\ensuremath{\USP\text{#1S}}}%%% siemens
\newcommand*{\UV}[1][\empty]{\ensuremath{\USP\text{#1V}}}%%% volt
\newcommand*{\UkV}{\ensuremath{\USP\text{kV}}}%%% kvolt
  %%%% without preceeding space
\newcommand*{\UAZ}[1][\empty]{\ensuremath{\text{#1A}}}%%% ampere
\newcommand*{\UCZ}[1][\empty]{\ensuremath{\text{#1C}}}%%% coulomb
\newcommand*{\UFZ}[1][\empty]{\ensuremath{\text{#1F}}}%%% farad
\newcommand*{\UOZ}[1][\empty]{\ensuremath{\text{#1}\Omega}}%%% ohm
\newcommand*{\USZ}[1][\empty]{\ensuremath{\text{#1S}}}%%% siemens
\newcommand*{\UVZ}[1][\empty]{\ensuremath{\text{#1V}}}%%% volt
\newcommand*{\UkVZ}{\ensuremath{\text{kV}}}%%% kvolt

%%%%%%%%%% 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
  %%%% 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

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

\endinput
