texlive[54660] Master/texmf-dist: hepunits (10apr20)
commits+karl at tug.org
commits+karl at tug.org
Sun Apr 12 00:24:37 CEST 2020
Revision: 54660
http://tug.org/svn/texlive?view=revision&revision=54660
Author: karl
Date: 2020-04-12 00:24:37 +0200 (Sun, 12 Apr 2020)
Log Message:
-----------
hepunits (10apr20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/hepunits/ChangeLog
trunk/Master/texmf-dist/doc/latex/hepunits/README
trunk/Master/texmf-dist/doc/latex/hepunits/hepunits.pdf
trunk/Master/texmf-dist/doc/latex/hepunits/hepunits.tex
trunk/Master/texmf-dist/tex/latex/hepunits/hepunits.sty
Modified: trunk/Master/texmf-dist/doc/latex/hepunits/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/hepunits/ChangeLog 2020-04-11 22:24:25 UTC (rev 54659)
+++ trunk/Master/texmf-dist/doc/latex/hepunits/ChangeLog 2020-04-11 22:24:37 UTC (rev 54660)
@@ -1,3 +1,24 @@
+2020-04-10 Andy Buckley <andy.buckley at cern.ch>
+
+ * Release version 2.0.0.
+
+ * Update to use siunitx.
+
+ * Refine eV and eV/c kerns, with bold font-series specifialisation.
+
+ * Change 'overc' and 'overcsq' macros to e.g. \MeVc and \MeVcsq.
+
+ * Removing 'inverse eV' units.
+
+ * Make the units non-freestanding by default, and exclude
+ non-essential convenience prefixed macros for SI units unless
+ requsted via a package option.
+
+2009-01-13 Andy Buckley <andy at insectnation.org>
+
+ * Added cross-section units of millibarns and upwards for e.g. LHC
+ total cross-sections.
+
2007-09-27 Andy Buckley <andy at insectnation.org>
* Ready for the momentous 1.1.1 release.
@@ -22,4 +43,3 @@
* Added SIunits options passing.
* Started ChangeLog.
-
Modified: trunk/Master/texmf-dist/doc/latex/hepunits/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/hepunits/README 2020-04-11 22:24:25 UTC (rev 54659)
+++ trunk/Master/texmf-dist/doc/latex/hepunits/README 2020-04-11 22:24:37 UTC (rev 54660)
@@ -2,18 +2,18 @@
by Andy Buckley <andy at 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.
+hepunits is a LaTeX package built on the siunitx package which adds a collection
+of useful HEP units to the existing siunitx set. These include a refined
+definition of the \electronvolt energy unit (accounting for missing kerns),
+convenience derived units \eV, \MeV, \GeV, \TeV, their associated derived
+momentum and mass units \MeVc, \MeVcsq and so on (also with kern corrections),
+and convenience-prefixed cross-section and luminosity units.
-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.
+Additionally, some units are provided (for now) for pure convenience via the
+[sicmds] package option. Please provide feedback if you'd like to see more
+HEP-specific units added.
-This material is subject to the LaTeX Project Public License.
+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.
Modified: trunk/Master/texmf-dist/doc/latex/hepunits/hepunits.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/hepunits/hepunits.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/hepunits/hepunits.tex 2020-04-11 22:24:25 UTC (rev 54659)
+++ trunk/Master/texmf-dist/doc/latex/hepunits/hepunits.tex 2020-04-11 22:24:37 UTC (rev 54660)
@@ -1,8 +1,10 @@
\documentclass[12pt]{article}
-\usepackage{maybemath, xspace, setspace, fancyvrb, a4wide}
-\usepackage{url, relsize, booktabs, ccaption, braket}
-\usepackage{hepunits}
+\usepackage{xspace,setspace,fancyvrb,a4wide}
+\usepackage{url,relsize,booktabs,ccaption,braket}
\usepackage[colorlinks=true,bookmarks=true]{hyperref}
+\usepackage{mathpazo,microtype}
+
+\usepackage[sicmds,freestanding]{hepunits}
\newcommand{\hepunits}{\texttt{hepunits}\xspace}
\let\OldCite\cite
@@ -14,187 +16,192 @@
\author{Andy Buckley, \texttt{andy at 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{\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{\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.
-%
-}
+%\abstract{%
+The \hepunits~v2 package extends the existing (and excellent) \texpkg{siunitx}
+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
+provides particle physicists with a consistent and accurate way to refer to
+dimensionful HEP quantities. It additionally tweaks the often problematic
+character spacing around the \si\eV and \si\eVcsq units, as an ``eV kern''
+is not typically defined in \LaTeX{} fonts. %
+%}
+
+
\section{Recommended usage}
-The basic usage mode for \hepunits is to place
+The basic usage mode for \hepunits is to place |\usepackage{hepunits}|
+% %
+% \begin{snippet}
+% \usepackage{hepunits}
+% \end{snippet}
+% %
+in the preamble of your document.
+
+This loads the \texpkg{amsmath} (for \texcmd{mspace}/\texcmd{mkern}) and
+\texpkg{siunitx} packages, as well as defining new HEP units using the
+\texpkg{siunitx} mechanisms. For convenience, it also sets the \texpkg{siunitx}
+defaults to detect the surrounding text style (include displayed mathematics)
+and to use text-mode rendering of units, again to match the surrounding text
+font for numbers and unit text. If these features aren't wanted, or you want to
+set any of the myriad other \texpkg{siunitx} rendering options, call the
+\texcmd{sisetup} macro \emph{after} the |\usepackage{hepunits}| call.
+
+
+\section{Options}
+\hepunits accepts three optional arguments during import:
%
-\begin{snippet}
-\usepackage{hepunits}
-\end{snippet}
+\begin{description}
+\item[sicmds:] Also define convenience short versions of SI units, e.g.~\texcmd{cm};
+\item[noprefixcmds:] Don't define convenience SI-prefixed versions of HEP units, e.g.~\texcmd{GeV} in addition to \texcmd{eV};
+\item[freestanding:] Make the unit macros also usable outside the \texcmd{SI} and \texcmd{si} macros (equivalent to |\sisetup{free-standing-units=true}|.
+\end{description}
%
-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).
+These can be used as follows: |\usepackage[sicmds,freestanding]{heputils}|.
-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}
+\hepunits requires the \texpkg{siunitx} 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!
+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.
+command like |\SI{1.0}{|\texgen{unit}|}| where \texgen{unit} is one of the unit
+commands listed in the first columns of the tables. Note that standard
+\texpkg{siunitx} parsing extensions like |\SI{1.23e-4}{\GeV}| $\to$
+\SI{1.23e-4}{\GeV}, and significant-digit control, also work but aren't shown
+here in the interests of brevity.
\begin{table}[ht]
-\centering
-\begin{tabular}{ll}
-\toprule
-Unit command & Example \\
+ \centering
+ \begin{tabular}{lllll}
+ \toprule
+ Unit command & Normal & Italic & Bold & Math \\
-\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
+ Lengths \\
+ \texcmd{nm} & \SI{1.0}{\nm} & \textit{\SI{1.0}{\nm}} & \textbf{\SI{1.0}{\nm}} & $x = \SI{1.0}{\nm}$ \\
+ \texcmd{um} & \SI{1.0}{\um} & \textit{\SI{1.0}{\um}} & \textbf{\SI{1.0}{\um}} & $x = \SI{1.0}{\um}$ \\
+ \texcmd{mm} & \SI{1.0}{\mm} & \textit{\SI{1.0}{\mm}} & \textbf{\SI{1.0}{\mm}} & $x = \SI{1.0}{\mm}$ \\
+ \texcmd{cm} & \SI{1.0}{\cm} & \textit{\SI{1.0}{\cm}} & \textbf{\SI{1.0}{\cm}} & $x = \SI{1.0}{\cm}$ \\
+ \texcmd{micron} & \SI{1.0}{\um} & \textit{\SI{1.0}{\um}} & \textbf{\SI{1.0}{\um}} & $x = \SI{1.0}{\um}$ \\
-\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
+ Times \\
+ \texcmd{ns} & \SI{1.0}{\ns} & \textit{\SI{1.0}{\ns}} & \textbf{\SI{1.0}{\ns}} & $x = \SI{1.0}{\ns}$ \\
+ \texcmd{ps} & \SI{1.0}{\ps} & \textit{\SI{1.0}{\ps}} & \textbf{\SI{1.0}{\ps}} & $x = \SI{1.0}{\ps}$ \\
+ \texcmd{fs} & \SI{1.0}{\fs} & \textit{\SI{1.0}{\fs}} & \textbf{\SI{1.0}{\fs}} & $x = \SI{1.0}{\fs}$ \\
+ \texcmd{as} & \SI{1.0}{\as} & \textit{\SI{1.0}{\as}} & \textbf{\SI{1.0}{\as}} & $x = \SI{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
+ Rates \\
+ \texcmd{mHz} & \SI{1.0}{\mHz} & \textit{\SI{1.0}{\mHz}} & \textbf{\SI{1.0}{\mHz}} & $x = \SI{1.0}{\mHz}$ \\
+ \texcmd{Hz} & \SI{1.0}{\Hz} & \textit{\SI{1.0}{\Hz}} & \textbf{\SI{1.0}{\Hz}} & $x = \SI{1.0}{\Hz}$ \\
+ \texcmd{kHz} & \SI{1.0}{\kHz} & \textit{\SI{1.0}{\kHz}} & \textbf{\SI{1.0}{\kHz}} & $x = \SI{1.0}{\kHz}$ \\
+ \texcmd{MHz} & \SI{1.0}{\MHz} & \textit{\SI{1.0}{\MHz}} & \textbf{\SI{1.0}{\MHz}} & $x = \SI{1.0}{\MHz}$ \\
+ \texcmd{GHz} & \SI{1.0}{\GHz} & \textit{\SI{1.0}{\GHz}} & \textbf{\SI{1.0}{\GHz}} & $x = \SI{1.0}{\GHz}$ \\
+ \texcmd{THz} & \SI{1.0}{\THz} & \textit{\SI{1.0}{\THz}} & \textbf{\SI{1.0}{\THz}} & $x = \SI{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}
+ \midrule
+ Misc. \\
+ \texcmd{mrad} & \SI{1.0}{\mrad} & \textit{\SI{1.0}{\mrad}} & \textbf{\SI{1.0}{\mrad}} & $x = \SI{1.0}{\mrad}$ \\
+ \texcmd{gauss} & \SI{1.0}{\gauss} & \textit{\SI{1.0}{\gauss}} & \textbf{\SI{1.0}{\gauss}} & $x = \SI{1.0}{\gauss}$ \\
+ \bottomrule
+ \end{tabular}
+ \caption{List of non-HEP specific units provided by \hepunits. Other than \texttt{\textbackslash{}gauss}, these units are only available via the \texttt{sicmds} package option.}
+ \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} \\
+ \centering
+ \begin{tabular}{lllll}
+ \toprule
+ Unit command & Normal & Italic & Bold & Math \\
+ \midrule
+ Luminosities \\
+ \texcmd{invcmsq} & \SI{1.0}{\invcmsq} & \textit{\SI{1.0}{\invcmsq}} & \textbf{\SI{1.0}{\invcmsq}} & $x = \SI{1.0}{\invcmsq}$ \\
+ \texcmd{invcmsqpersecond} & \SI{1.0}{\invcmsqpersecond} & \textit{\SI{1.0}{\invcmsqpersecond}} & \textbf{\SI{1.0}{\invcmsqpersecond}} & $x = \SI{1.0}{\invcmsqpersecond}$ \\
+ \texcmd{invcmsqpersec} & \SI{1.0}{\invcmsqpersec} & \textit{\SI{1.0}{\invcmsqpersec}} & \textbf{\SI{1.0}{\invcmsqpersec}} & $x = \SI{1.0}{\invcmsqpersec}$ \\
-\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} \\
+ \midrule
+ Cross-sections \\
+ \texcmd{barn} & \SI{1.23e-4}{\barn} & \textit{\SI{1.0}{\barn}} & \textbf{\SI{1.0}{\barn}} & $x = \SI{1.0}{\barn}$ \\
+ \texcmd{invbarn} & \SI{1.0}{\invbarn} & \textit{\SI{1.0}{\invbarn}} & \textbf{\SI{1.0}{\invbarn}} & $x = \SI{1.0}{\invbarn}$ \\
+ \texcmd{nanobarn} & \SI{1.0}{\nanobarn} & \textit{\SI{1.0}{\nanobarn}} & \textbf{\SI{1.0}{\nanobarn}} & $x = \SI{1.0}{\nanobarn}$ \\
+ \texcmd{invnanobarn} / \texcmd{invnb} & \SI{1.0}{\invnanobarn} & \textit{\SI{1.0}{\invnanobarn}} & \textbf{\SI{1.0}{\invnanobarn}} & $x = \SI{1.0}{\invnanobarn}$ \\
+ \texcmd{picobarn} & \SI{1.0}{\picobarn} & \textit{\SI{1.0}{\picobarn}} & \textbf{\SI{1.0}{\picobarn}} & $x = \SI{1.0}{\picobarn}$ \\
+ \texcmd{invpicobarn} / \texcmd{invpb} & \SI{1.0}{\invpicobarn} & \textit{\SI{1.0}{\invpicobarn}} & \textbf{\SI{1.0}{\invpicobarn}} & $x = \SI{1.0}{\invpicobarn}$ \\
+ \texcmd{femtobarn} & \SI{1.0}{\femtobarn} & \textit{\SI{1.0}{\femtobarn}} & \textbf{\SI{1.0}{\femtobarn}} & $x = \SI{1.0}{\femtobarn}$ \\
+ \texcmd{invfemtobarn} / \texcmd{invfb} & \SI{1.0}{\invfemtobarn} & \textit{\SI{1.0}{\invfemtobarn}} & \textbf{\SI{1.0}{\invfemtobarn}} & $x = \SI{1.0}{\invfemtobarn}$ \\
+ \texcmd{attobarn} & \SI{1.0}{\attobarn} & \textit{\SI{1.0}{\attobarn}} & \textbf{\SI{1.0}{\attobarn}} & $x = \SI{1.0}{\attobarn}$ \\
+ \texcmd{invattobarn} / \texcmd{invab} & \SI{1.0}{\invattobarn} & \textit{\SI{1.0}{\invattobarn}} & \textbf{\SI{1.0}{\invattobarn}} & $x = \SI{1.0}{\invattobarn}$ \\
-\bottomrule
-\end{tabular}
-\caption{List of HEP-specific units provided by \hepunits}
-\label{tab:hepunits}
+ \bottomrule
+ \end{tabular}
+ \caption{List of HEP-specific luminosity 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}
+ \centering
+ \begin{tabular}{lllll}
+ \toprule
+ Unit command & Normal & Italic & Bold & Math \\
+ \midrule
+ \eV-based units \\
+ %\multicolumn{4}{\eV-based units} \\
+ \texcmd{eV} & \SI{1.0}{\eV} & \textit{\SI{1.0}{\eV}} & \textbf{\SI{1.0}{\eV}} & $x = \SI{1.0}{\eV}$ \\
+ \texcmd{eVc} & \SI{1.0}{\eVc} & \textit{\SI{1.0}{\eVc}} & \textbf{\SI{1.0}{\eVc}} & $x = \SI{1.0}{\eVc}$ \\
+ \texcmd{eVcsq} & \SI{1.0}{\eVcsq} & \textit{\SI{1.0}{\eVcsq}} & \textbf{\SI{1.0}{\eVcsq}} & $x = \SI{1.0}{\eVcsq}$ \\
+ \texcmd{meV} & \SI{1.0}{\meV} & \textit{\SI{1.0}{\meV}} & \textbf{\SI{1.0}{\meV}} & $x = \SI{1.0}{\meV}$ \\
+ \texcmd{keV} & \SI{1.0}{\keV} & \textit{\SI{1.0}{\keV}} & \textbf{\SI{1.0}{\keV}} & $x = \SI{1.0}{\keV}$ \\
+ \texcmd{MeV} & \SI{1.0}{\MeV} & \textit{\SI{1.0}{\MeV}} & \textbf{\SI{1.0}{\MeV}} & $x = \SI{1.0}{\MeV}$ \\
+ \texcmd{GeV} & \SI{1.0}{\GeV} & \textit{\SI{1.0}{\GeV}} & \textbf{\SI{1.0}{\GeV}} & $x = \SI{1.0}{\GeV}$ \\
+ \texcmd{TeV} & \SI{1.0}{\TeV} & \textit{\SI{1.0}{\TeV}} & \textbf{\SI{1.0}{\TeV}} & $x = \SI{1.0}{\TeV}$ \\
+ \texcmd{meVc} & \SI{1.0}{\meVc} & \textit{\SI{1.0}{\meVc}} & \textbf{\SI{1.0}{\meVc}} & $x = \SI{1.0}{\meVc}$ \\
+ \texcmd{keVc} & \SI{1.0}{\keVc} & \textit{\SI{1.0}{\keVc}} & \textbf{\SI{1.0}{\keVc}} & $x = \SI{1.0}{\keVc}$ \\
+ \texcmd{MeVc} & \SI{1.0}{\MeVc} & \textit{\SI{1.0}{\MeVc}} & \textbf{\SI{1.0}{\MeVc}} & $x = \SI{1.0}{\MeVc}$ \\
+ \texcmd{GeVc} & \SI{1.0}{\GeVc} & \textit{\SI{1.0}{\GeVc}} & \textbf{\SI{1.0}{\GeVc}} & $x = \SI{1.0}{\GeVc}$ \\
+ \texcmd{TeVc} & \SI{1.0}{\TeVc} & \textit{\SI{1.0}{\TeVc}} & \textbf{\SI{1.0}{\TeVc}} & $x = \SI{1.0}{\TeVc}$ \\
+ \texcmd{meVcsq} & \SI{1.0}{\meVcsq} & \textit{\SI{1.0}{\meVcsq}} & \textbf{\SI{1.0}{\meVcsq}} & $x = \SI{1.0}{\meVcsq}$ \\
+ \texcmd{keVcsq} & \SI{1.0}{\keVcsq} & \textit{\SI{1.0}{\keVcsq}} & \textbf{\SI{1.0}{\keVcsq}} & $x = \SI{1.0}{\keVcsq}$ \\
+ \texcmd{MeVcsq} & \SI{1.0}{\MeVcsq} & \textit{\SI{1.0}{\MeVcsq}} & \textbf{\SI{1.0}{\MeVcsq}} & $x = \SI{1.0}{\MeVcsq}$ \\
+ \texcmd{GeVcsq} & \SI{1.0}{\GeVcsq} & \textit{\SI{1.0}{\GeVcsq}} & \textbf{\SI{1.0}{\GeVcsq}} & $x = \SI{1.0}{\GeVcsq}$ \\
+ \texcmd{TeVcsq} & \SI{1.0}{\TeVcsq} & \textit{\SI{1.0}{\TeVcsq}} & \textbf{\SI{1.0}{\TeVcsq}} & $x = \SI{1.0}{\TeVcsq}$ \\
+ \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}
+using the \texpkg{siunitx} prescription for the prefixes. Let's give a demo in
+case you don't know what I'm waffling about\dots the ``usual'' \texpkg{siunitx}
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.
+|\SI{1.0}{\mega\eVc}|. This produces ``\SI{1.0}{\mega\eVc}''
+just like |\SI{1.0}{\MeVc}| 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
@@ -207,13 +214,13 @@
\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.
+look right, with upright \si{\micro}{s}, properly italicised $c$s, and properly
+kerned \eV{s} in the appropriate places. Fortunately most of the work has
+already been done by the marvellous \texpkg{siunitx} 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 at 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.
+send them my way.
\end{document}
Modified: trunk/Master/texmf-dist/tex/latex/hepunits/hepunits.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/hepunits/hepunits.sty 2020-04-11 22:24:25 UTC (rev 54659)
+++ trunk/Master/texmf-dist/tex/latex/hepunits/hepunits.sty 2020-04-11 22:24:37 UTC (rev 54660)
@@ -9,164 +9,129 @@
%% 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}
+\def\fileversion{2.0.0}
+\def\filedate{2020/04/10}
\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{}
+%% Option handling
\def\@yes{yes}
\def\@HEPopt at noprefixcmds{}
-\def\@SIopt at cdot{}
-\def\@SIopt at space{mediumspace}
-\def\@SIopt at qspace{thickqspace}
-\def\@SIopt at amssquare{squaren}
-\def\@SIopt at pstricks{}
-\def\@SIopt at Gray{}
-\def\@SIopt at italian{}
-\def\@SIopt at textstyle{yes}
-\def\@SIopt at binary{}
-\def\@SIopt at noams{}
-\def\@SIopt at derivedinbase{}
-\def\@SIopt at derived{}
-
-%% Option for turning off explicit SI prefix commands
+\def\@HEPopt at sicmds{}
+\def\@HEPopt at freestanding{}
+\DeclareOption{sicmds}{\def\@HEPopt at sicmds{yes}}
\DeclareOption{noprefixcmds}{\def\@HEPopt at noprefixcmds{yes}}
-
-%% Options for passing to SIunits
-\DeclareOption{cdot}{\def\@SIopt at cdot{yes}}
-\DeclareOption{thickspace}{\def\@SIopt at space{thickspace}}
-\DeclareOption{mediumspace}{\def\@SIopt at space{mediumspace}}
-\DeclareOption{thinspace}{\def\@SIopt at space{thinspace}}
-\DeclareOption{thickqspace}{\def\@SIopt at qspace{thickqspace}}
-\DeclareOption{mediumqspace}{\def\@SIopt at qspace{mediumqspace}}
-\DeclareOption{thinqspace}{\def\@SIopt at qspace{thinqspace}}
-\DeclareOption{noamssquareissue}{\def\@SIopt at amssquare{}}
-\DeclareOption{amssymb}{\def\@SIopt at amssquare{amssymb}}
-\DeclareOption{squaren}{\def\@SIopt at amssquare{squaren}}
-\DeclareOption{pstricks}{\def\@SIopt at pstricks{yes}}
-\DeclareOption{Gray}{\def\@SIopt at Gray{yes}}
-\DeclareOption{italian}{\def\@SIopt at italian{yes}}
-\DeclareOption{textstyle}{\def\@SIopt at textstyle{yes}}
-\DeclareOption{notextstyle}{\def\@SIopt at textstyle{}}
-\DeclareOption{binary}{\def\@SIopt at binary{yes}}
-\DeclareOption{noams}{\def\@SIopt at noams{yes}}
-\DeclareOption{derivedinbase}{\def\@SIopt at derivedinbase{yes}}
-\DeclareOption{derived}{\def\@SIopt at derived{yes}}
-%\DeclareOption{noderived}{\def\@SIopt at derived{}}
-
+\DeclareOption{freestanding}{\def\@HEPopt at freestanding{yes}}
\ProcessOptions
+\ifx\@HEPopt at noprefixcmds\@yes\def\@HEPopt at sicmds\@empty\fi
-%% Pass the SIunits yes/no options
-\ifx\@SIopt at cdot\@yes\PassOptionsToPackage{cdot}{SIunits}\fi
-\ifx\@SIopt at pstricks\@yes\PassOptionsToPackage{pstricks}{SIunits}\fi
-\ifx\@SIopt at Gray\@yes\PassOptionsToPackage{Gray}{SIunits}\fi
-\ifx\@SIopt at italian\@yes\PassOptionsToPackage{italian}{SIunits}\fi
-\ifx\@SIopt at textstyle\@yes\PassOptionsToPackage{textstyle}{SIunits}\fi
-\ifx\@SIopt at binary\@yes\PassOptionsToPackage{binary}{SIunits}\fi
-\ifx\@SIopt at noams\@yes\PassOptionsToPackage{noams}{SIunits}\fi
-\ifx\@SIopt at derivedinbase\@yes\PassOptionsToPackage{derivedinbase}{SIunits}\fi
-\ifx\@SIopt at derived\@yes\PassOptionsToPackage{derived}{SIunits}\fi
-%% Pass the SIunits "choice" options
-\ifx\@SIopt at space\@empty\else\PassOptionsToPackage{\@SIopt at space}{SIunits}\fi
-\ifx\@SIopt at qspace\@empty\else\PassOptionsToPackage{\@SIopt at qspace}{SIunits}\fi
-\ifx\@SIopt at amssquare\@empty\else\PassOptionsToPackage{\@SIopt at amssquare}{SIunits}\fi
-%% Get the dependancy packages, now that the options
-%% have been processed
+%% Get the dependency packages
\RequirePackage{amsmath}
-\RequirePackage{xspace}
-\RequirePackage{SIunits}
+\RequirePackage{ifthen}
+\RequirePackage{siunitx}
+%% Pass default config to siunitx
+\sisetup{detect-all, detect-display-math, mode=text}
+\ifx\@HEPopt at freestanding\@yes
+\sisetup{free-standing-units=true}
+\fi
+
+
%% -------------------------------------------------
%% Units defined below here
%% -------------------------------------------------
-\@NewUnit{\Hz}{\hertz}
-\ifx\@HEPopt at noprefixcmds\@empty
+\DeclareSIUnit{\Hz}{\hertz}
+
+\ifx\@HEPopt at sicmds\@yes
%% Lengths
-\@NewUnit{\nm}{\nano\metre}
-\@NewUnit{\micron}{\micro\metre}
-\@NewUnit{\mm}{\milli\metre}
-\@NewUnit{\cm}{\centi\metre}
+\DeclareSIUnit{\fermi}{\femto\metre}
+\DeclareSIUnit{\nm}{\nano\metre}
+\DeclareSIUnit{\micron}{\micro\metre}
+\DeclareSIUnit{\um}{\micro\metre}
+\DeclareSIUnit{\mm}{\milli\metre}
+\DeclareSIUnit{\cm}{\centi\metre}
%% Angles
-\@NewUnit{\mrad}{\milli\rad}
+\DeclareSIUnit{\mrad}{\milli\radian}
%% Times
-\@NewUnit{\as}{\atto\second}
-\@NewUnit{\fs}{\femto\second}
-\@NewUnit{\ps}{\pico\second}
-\@NewUnit{\ns}{\nano\second}
+\DeclareSIUnit{\as}{\atto\second}
+\DeclareSIUnit{\fs}{\femto\second}
+\DeclareSIUnit{\ps}{\pico\second}
+\DeclareSIUnit{\ns}{\nano\second}
%% Rates
-\@NewUnit{\mHz}{\milli\hertz}
-\@NewUnit{\kHz}{\kilo\hertz}
-\@NewUnit{\MHz}{\mega\hertz}
-\@NewUnit{\GHz}{\giga\hertz}
-\@NewUnit{\THz}{\tera\hertz}
+\DeclareSIUnit{\mHz}{\milli\hertz}
+\DeclareSIUnit{\kHz}{\kilo\hertz}
+\DeclareSIUnit{\MHz}{\mega\hertz}
+\DeclareSIUnit{\GHz}{\giga\hertz}
+\DeclareSIUnit{\THz}{\tera\hertz}
\fi
+
%% Fields
-\@NewUnit{\gauss}{G}
+\DeclareSIUnit{\gauss}{G}
%% Luminosity
-\@NewUnit{\invcmsqpersecond}{\rpsquare{\centi\metre}\usk\reciprocal{\second}}
-\@NewUnit{\invcmsqpersec}{\invcmsqpersecond}
-\DeclareRobustCommand{\lumiunits}{\invcmsqpersecond}
+\DeclareSIUnit{\invcmsq}{\centi\metre\tothe{-2}}
+\DeclareSIUnit{\invcmsqpersecond}{\invcmsq\second\tothe{-1}}
+\DeclareSIUnit{\invcmsqpersec}{\invcmsqpersecond}
%% (Inverse) cross-sections
-\@NewUnit{\invbarn}{\reciprocal\barn\xspace}
+\DeclareSIUnit{\invbarn}{\barn\tothe{-1}}
\ifx\@HEPopt at 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}
+\DeclareSIUnit{\millibarn}{\milli\barn}
+\DeclareSIUnit{\microbarn}{\micro\barn}
+\DeclareSIUnit{\nanobarn}{\nano\barn}
+\DeclareSIUnit{\picobarn}{\pico\barn}
+\DeclareSIUnit{\femtobarn}{\femto\barn}
+\DeclareSIUnit{\attobarn}{\atto\barn}
+\DeclareSIUnit{\zeptobarn}{\zepto\barn}
+\DeclareSIUnit{\yoctobarn}{\yocto\barn}
+\DeclareSIUnit{\invnanobarn}{\nano\invbarn}
+\DeclareSIUnit{\invpicobarn}{\pico\invbarn}
+\DeclareSIUnit{\invfemtobarn}{\femto\invbarn}
+\DeclareSIUnit{\invattobarn}{\atto\invbarn}
+\DeclareSIUnit{\invzeptobarn}{\zepto\invbarn}
+\DeclareSIUnit{\invyoctobarn}{\yocto\invbarn}
+\DeclareSIUnit{\invnb}{\invnanobarn}
+\DeclareSIUnit{\invpb}{\invpicobarn}
+\DeclareSIUnit{\invfb}{\invfemtobarn}
+\DeclareSIUnit{\invab}{\invattobarn}
+\DeclareSIUnit{\invzb}{\invzeptobarn}
+\DeclareSIUnit{\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}
+% \DeclareSIUnit{\electronvolt}{\text{e\kern-1.2\scriptspace V}}
+\DeclareSIUnit{\electronvolt}{\text{e\kern-0.15ex V}}
+\DeclareSIUnit{\eV}{\electronvolt}
+\newcommand{\@eVoverc}[1][]{\ensuremath{
+ \eV
+ \ifthenelse{\equal{\f at series}{\bfdefault}}{/}{\mkern-\medmuskip/\mkern-\thinmuskip}
+ \text{\ensuremath{c#1}}
+ }}
+\DeclareSIUnit{\electronvoltc}{\@eVoverc}
+\DeclareSIUnit{\electronvoltcsq}{\@eVoverc[^2]}
+\DeclareSIUnit{\eVc}{\@eVoverc}
+\DeclareSIUnit{\eVcsq}{\@eVoverc[^2]}
\ifx\@HEPopt at 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}
+\DeclareSIUnit{\meV}{\milli\eV}
+\DeclareSIUnit{\keV}{\kilo\eV}
+\DeclareSIUnit{\MeV}{\mega\eV}
+\DeclareSIUnit{\GeV}{\giga\eV}
+\DeclareSIUnit{\TeV}{\tera\eV}
+\DeclareSIUnit{\meVc}{\milli\eVc}
+\DeclareSIUnit{\keVc}{\kilo\eVc}
+\DeclareSIUnit{\MeVc}{\mega\eVc}
+\DeclareSIUnit{\GeVc}{\giga\eVc}
+\DeclareSIUnit{\TeVc}{\tera\eVc}
+\DeclareSIUnit{\meVcsq}{\milli\eVcsq}
+\DeclareSIUnit{\keVcsq}{\kilo\eVcsq}
+\DeclareSIUnit{\MeVcsq}{\mega\eVcsq}
+\DeclareSIUnit{\GeVcsq}{\giga\eVcsq}
+\DeclareSIUnit{\TeVcsq}{\tera\eVcsq}
\fi
More information about the tex-live-commits
mailing list.