summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-06-18 18:58:17 +0000
committerKarl Berry <karl@freefriends.org>2008-06-18 18:58:17 +0000
commit5e1a51472611bd034207d3ab83a1c277ab8f959c (patch)
tree5a9675ce25b210aa7c07744928672a33c553684e /Master/texmf-dist
parent9f961a65285a9ab345ee4d3d0c909f842f169812 (diff)
siunitx 1.0 (16jun08)
git-svn-id: svn://tug.org/texlive/trunk@8852 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/bibtex/bib/siunitx/siunitx.bib38
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/README29
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/si-bug.ltx31
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx-manual.pdfbin0 -> 721955 bytes
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx.pdfbin0 -> 1101861 bytes
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx12689
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.ins79
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg27
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg329
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg27
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg27
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg28
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg73
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg39
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg33
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg23
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg30
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg48
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg106
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg39
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg71
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg55
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg27
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg50
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg103
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg87
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg27
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg53
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg233
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty3509
30 files changed, 17910 insertions, 0 deletions
diff --git a/Master/texmf-dist/bibtex/bib/siunitx/siunitx.bib b/Master/texmf-dist/bibtex/bib/siunitx/siunitx.bib
new file mode 100644
index 00000000000..322ed1577a8
--- /dev/null
+++ b/Master/texmf-dist/bibtex/bib/siunitx/siunitx.bib
@@ -0,0 +1,38 @@
+@misc{BIPM:EN,
+ note = {\url{http://www.bipm.org/en/si/}},
+}
+
+@misc{BIPM:FR,
+ note = {\url{http://www.bipm.org/fr/si/}},
+}
+
+@misc{BIPM:PDF,
+ note = {\url{http://www.bipm.org/en/si/si_brochure/}},
+}
+
+@misc{Eijkhout,
+ author = {Victor Eijkhout},
+ note = {\url{http://www.eijkhout.net/tbt/}},
+ title = {{\TeX} by {T}opic},
+ year = {2007},
+}
+
+@misc{fancyunits,
+ author = {Heiko Bauke},
+ note = {\url{http://www.mpi-hd.mpg.de/personalhomes/bauke/LaTeX/Tips_und_Tricks/fancyunits/index.php}},
+ title = {\pkg{fancyunits}},
+ year = 2007,
+}
+
+@misc{IUPAC,
+ note = {\url{http://old.iupac.org/publications/books/gbook/green_book_2ed.pdf}},
+ title = {The \textsc{iupac} {G}reen {B}ook},
+ year = 1993,
+}
+
+@misc{NIST,
+ note = {\url{http://physics.nist.gov/cuu/Units/index.html}},
+}
+\endinput
+%%
+%% End of file `siunitx.bib'.
diff --git a/Master/texmf-dist/doc/latex/siunitx/README b/Master/texmf-dist/doc/latex/siunitx/README
new file mode 100644
index 00000000000..f7a2eb88dc1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/siunitx/README
@@ -0,0 +1,29 @@
+----------------------------------------------------------------
+The siunitx package --- A comprehensive (SI) units package
+Maintained by Joseph Wright
+E-mail: joseph.wright@morningstar2.co.uk
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
+Typesetting values with units requires care to ensure that the
+combined mathematical meaning of the value plus unit combination
+is clear. In particular, the SI units system lays down a
+consistent set of units with rules on how these are to be used.
+However, different countries and publishers have differing
+conventions on the exact appearance of numbers (and units).
+
+The siunitx provides a set of tools for authors to typeset
+numbers and units in a consistent way. The package has an
+extended set of configuration options which make it possible to
+follow varying typographic conventions with the same input
+syntax. The package includes automated processing of numbers
+and units, and the ability to control tabular alignment of
+numbers.
+
+A number of LaTeX packages have been developed in the past for
+formatting units: SIunits, sistyle, unitsdef, unitspkg,
+fancyunits and fancynum. Support for users of all of these
+packages is available as emulation modules in siunitx. In
+addition, siunitx can carry out many of the functions of the
+dcolumn, rccol and numprint packages.
diff --git a/Master/texmf-dist/doc/latex/siunitx/si-bug.ltx b/Master/texmf-dist/doc/latex/siunitx/si-bug.ltx
new file mode 100644
index 00000000000..d437dc2a5ce
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/siunitx/si-bug.ltx
@@ -0,0 +1,31 @@
+%%
+%% This is file `si-bug.ltx',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `bug')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\listfiles
+\documentclass{article}
+\usepackage{siunitx}
+\sisetup{debug}
+\begin{document}
+This is the bug test-case document for the \textsf{siunitx}
+package.\\
+Please put your demonstration here, and e-mail to the package
+author.
+\begin{center}
+ \texttt{joseph.wright@morningtar2.co.uk}
+\end{center}
+\end{document}
+\endinput
+%%
+%% End of file `si-bug.ltx'.
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-manual.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-manual.pdf
new file mode 100644
index 00000000000..876361b294b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/siunitx/siunitx-manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
new file mode 100644
index 00000000000..8b0b8d59923
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
new file mode 100644
index 00000000000..04e9eb37b8e
--- /dev/null
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
@@ -0,0 +1,12689 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2008 by
+% Joseph Wright <joseph.wright@morningstar2.co.uk>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any later
+% version. The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of
+% LaTeX version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The current maintainer of this work is Joseph Wright.
+%
+% This work consists of the source file siunitx.dtx
+% and the derived files siunitx.ins,
+% siunitx.sty,
+% jawltxdoc.sty,
+% si-bug.ltx,
+% si-SIunits.cfg,
+% si-sistyle.cfg,
+% si-unitsdef.cfg,
+% si-units.cfg,
+% si-hepunits.cfg,
+% si-fancynum.cfg,
+% si-fancyunits.cfg,
+% si-prefix.cfg,
+% si-named.cfg,
+% si-prefixed.cfg,
+% si-addn.cfg,
+% si-accepted.cfg,
+% si-physical.cfg,
+% si-abbr.cfg,
+% si-synchem.cfg,
+% si-hep.cfg,
+% si-astro.cfg,
+% si-binary.cfg,
+% si-UK.cfg,
+% si-USA.cfg,
+% si-DE.cfg,
+% si-ZA.cfg,
+% siunitx.bib and
+% siunitx.pdf
+%
+% TDS-ready files:
+% The compressed file siunitx.tds.zip contains an unpacked version
+% of all of the files included here, and pre-compiled
+% documentation in PDF format. Simply decompress siunitx.tds.dtx
+% in your local TeX directory, run your hash program (texhash,
+% initexmf --update-fndb, etc.) and everything will be ready to
+% go. The user documentation for the package is called
+% siunitx-manual.pdf; the file siunitx.pdf includes the user
+% manual and the fully-indexed source code.
+%
+% Unpacking:
+% (a) If siunitx.ins is present:
+% tex siunitx.ins
+% (b) Without siunitx.ins:
+% tex siunitx.dtx
+% (c) If you use LaTeX to generate files:
+% latex \let\install=y\input{siunitx.dtx}
+%
+% Documentation:
+% (a) Without write18 enabled:
+% pdflatex siunitx.dtx
+% bibtex8 --wolfgang siunitx
+% makeindex -s gind.ist siunitx.idx
+% makeindex -s gglo.ist -o siunitx.gls siunitx.glo
+% pdflatex siunitx.dtx
+% pdflatex siunitx.dtx
+% (b) With write18 enabled:
+% pdflatex siunitx.dtx
+% pdflatex siunitx.dtx
+% pdflatex siunitx.dtx
+%
+% Installation:
+% Copy siunitx.sty and the various .cfg files to a location
+% searched by TeX, and if required by your TeX installation,
+% run the appropriate command to build a hash of files
+% (texhash, initexmf --update-fndb, etc.)
+%
+% Note:
+% The jawltxdoc.sty file is not needed for installation,
+% only for building the documentation; it may be deleted
+% after producing the documentation (if necessary).
+%
+%<*ignore>
+% This is all taken verbatim from Heiko Oberdiek's packages
+\begingroup
+ \def\x{LaTeX2e}%
+\expandafter\endgroup
+\ifcase 0\ifx\install y1\fi\expandafter
+ \ifx\csname processbatchFile\endcsname\relax\else1\fi
+ \ifx\fmtname\x\else 1\fi\relax
+\else\csname fi\endcsname
+%</ignore>
+%<*install>
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+ ----------------------------------------------------------------
+ The siunitx package --- A comprehensive (SI) units package
+ Maintained by Joseph Wright
+ E-mail: joseph.wright@morningstar2.co.uk
+ Released under the LaTeX Project Public License v1.3c or later
+ See http://www.latex-project.org/lppl.txt
+ ----------------------------------------------------------------
+
+\endpreamble
+\Msg{Generating siunitx files:}
+\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}}
+}
+\usedir{tex/latex/siunitx}
+\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}
+}
+\usedir{source/latex/siunitx}
+\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}
+}
+\usedir{doc/latex/siunitx}
+\generate{\file{si-bug.ltx}{\from{\jobname.dtx}{bug}}
+}
+\usedir{tex/latex/siunitx/config}
+\generate{\file{si-SIunits.cfg}{\from{\jobname.dtx}{SIunits}}
+ \file{si-sistyle.cfg}{\from{\jobname.dtx}{sistyle}}
+ \file{si-unitsdef.cfg}{\from{\jobname.dtx}{unitsdef}}
+ \file{si-units.cfg}{\from{\jobname.dtx}{units}}
+ \file{si-hepunits.cfg}{\from{\jobname.dtx}{hepunits}}
+ \file{si-fancynum.cfg}{\from{\jobname.dtx}{fancynum}}
+ \file{si-fancyunits.cfg}{\from{\jobname.dtx}{fancyunits}}
+}
+\generate{\file{si-prefix.cfg}{\from{\jobname.dtx}{prefix}}
+ \file{si-named.cfg}{\from{\jobname.dtx}{named}}
+ \file{si-prefixed.cfg}{\from{\jobname.dtx}{prefixed}}
+ \file{si-addn.cfg}{\from{\jobname.dtx}{addn}}
+ \file{si-accepted.cfg}{\from{\jobname.dtx}{accepted}}
+ \file{si-physical.cfg}{\from{\jobname.dtx}{physical}}
+ \file{si-abbr.cfg}{\from{\jobname.dtx}{abbr}}
+}
+\generate{\file{si-synchem.cfg}{\from{\jobname.dtx}{synchem}}
+ \file{si-hep.cfg}{\from{\jobname.dtx}{hep}}
+ \file{si-astro.cfg}{\from{\jobname.dtx}{astro}}
+ \file{si-binary.cfg}{\from{\jobname.dtx}{binary}}
+}
+\generate{\file{si-UK.cfg}{\from{\jobname.dtx}{UK}}
+ \file{si-USA.cfg}{\from{\jobname.dtx}{USA}}
+ \file{si-DE.cfg}{\from{\jobname.dtx}{DE}}
+ \file{si-ZA.cfg}{\from{\jobname.dtx}{ZA}}
+}
+\nopreamble
+\usedir{bibtex/bib/siunitx}
+\generate{\file{\jobname.bib}{\from{\jobname.dtx}{refs}}
+}
+\nopreamble\nopostamble
+\usedir{doc/latex/siunitx}
+\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}
+}
+\endbatchfile
+%</install>
+%<*readme>
+----------------------------------------------------------------
+The siunitx package --- A comprehensive (SI) units package
+Maintained by Joseph Wright
+E-mail: joseph.wright@morningstar2.co.uk
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
+Typesetting values with units requires care to ensure that the
+combined mathematical meaning of the value plus unit combination
+is clear. In particular, the SI units system lays down a
+consistent set of units with rules on how these are to be used.
+However, different countries and publishers have differing
+conventions on the exact appearance of numbers (and units).
+
+The siunitx provides a set of tools for authors to typeset
+numbers and units in a consistent way. The package has an
+extended set of configuration options which make it possible to
+follow varying typographic conventions with the same input
+syntax. The package includes automated processing of numbers
+and units, and the ability to control tabular alignment of
+numbers.
+
+A number of LaTeX packages have been developed in the past for
+formatting units: SIunits, sistyle, unitsdef, unitspkg,
+fancyunits and fancynum. Support for users of all of these
+packages is available as emulation modules in siunitx. In
+addition, siunitx can carry out many of the functions of the
+dcolumn, rccol and numprint packages.
+%</readme>
+%<*ignore>
+\fi
+% Will Robertson's trick
+\immediate\write18{bibtex8 --wolfgang \jobname}
+\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
+\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
+%</ignore>
+%<*driver>
+\PassOptionsToClass{a4paper}{article}
+\documentclass[german,english,UKenglish]{ltxdoc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+%\OnlyDescription
+% Various adjustments are needed to the packages loaded. xfrac is
+% only loaded if it is available. MiKTeX users should note that they
+% will need to download the expl3 and xbase bundles from CTAN to use
+% xfrac; the MiKTeX versions are very old and will cause errors.
+\usepackage[final]{graphicx}
+\IfFileExists{xfrac.sty}
+ {\usepackage{xfrac}}
+ {}
+\usepackage{jawltxdoc}
+\usepackage{textcomp,tikz,pgfplots,tocloft}
+\usepackage[latin1]{inputenc}
+\sisetup{
+ eVcorra=0.1ex,
+ unitsep=cdot,
+ alsoload={synchem,hep,binary,astro},
+ loctolang={UK:UKenglish,DE:german}}
+\setlength{\cftsubsecnumwidth}{2.5em}
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+%\CheckSum{9403}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%\GetFileInfo{\jobname.sty}
+%
+%\DoNotIndex{\@car,\@eha,\@ehc,\@empty,\@firstofone,\@firstoftwo}
+%\DoNotIndex{\@for,\@gobble,\@gobbletwo,\@ifl@aded,\@ifnextchar}
+%\DoNotIndex{\@ifpackagelater,\@ifpackageloaded,\@ifstar}
+%\DoNotIndex{\@ifundefined,\@makeother,\@namedef,\@nameuse,\@ne}
+%\DoNotIndex{\@nil,\@secondoftwo,\@temptokena,\@undefined,\AA}
+%\DoNotIndex{\active,\addto,\addtolength,\advance,\afterassignment}
+%\DoNotIndex{\aftergroup,\AtBeginDocument,\AtEndOfPackage}
+%\DoNotIndex{\begingroup,\bfseries,\bgroup,\boldmath,\box}
+%\DoNotIndex{\capitalring,\catcode,\cdot,\chardef,\check@mathfonts}
+%\DoNotIndex{\circ,\csname,\DeclareFontEncoding,\DeclareFontFamily}
+%\DoNotIndex{\DeclareFontShape,\DeclareFontSubstitution}
+%\DoNotIndex{\DeclareMathSymbol,\DeclareRobustCommand}
+%\DoNotIndex{\DeclareSymbolFont,\DeclareTextSymbol}
+%\DoNotIndex{\DeclareTextSymbolDefault,\def,\define@boolkey}
+%\DoNotIndex{\define@choicekey,\define@cmdkey,\define@cmdkeys}
+%\DoNotIndex{\define@key,\displaystyle,\displaywidth,\divide,\do}
+%\DoNotIndex{\edef,\egroup,\else,\encodingdefault,\end,\endcsname}
+%\DoNotIndex{\endgroup,\endinput,\endtabular,\ensuremath}
+%\DoNotIndex{\expandafter,\f@family,\f@series,\fam,\fi,\font}
+%\DoNotIndex{\fontsize,\frac,\gdef,\global,\hbox,\hfil,\hfill,\hskip}
+%\DoNotIndex{\hspace,\hss,\ifcsname,\ifdim,\iffalse,\IfFileExists}
+%\DoNotIndex{\ifmmode,\ifnum,\ifx,\ignorespaces,\inputencodingname}
+%\DoNotIndex{\InputIfFileExists,\key@ifundefine,\let,\long,\m@ne}
+%\DoNotIndex{\makeatletter,\math@version,\mathchoice,\mathnormal}
+%\DoNotIndex{\mathord,\mathrm,\mathsf,\mathtt,\mdseries}
+%\DoNotIndex{\MessageBreak,\mkern,\mp,\NC@find,\NeedsTeXFormat}
+%\DoNotIndex{\newbox,\newcolumntype,\newcommand,\newcount,\newdimen}
+%\DoNotIndex{\newif,\newlength,\newtoks,\nobreak,\noexpand,\p@}
+%\DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\phantom}
+%\DoNotIndex{\ProcessOptionsX,\protect,\protected@edef,\ProvidesFile}
+%\DoNotIndex{\ProvidesPackage,\Q,\raisebox,\relax,\renewcommand}
+%\DoNotIndex{\RequirePackage,\rlap,\sbox,\scantokens}
+%\DoNotIndex{\scriptscriptstyle,\scriptstyle,\selectfont,\setbox}
+%\DoNotIndex{\setkeys,\setlength,\settoheight,\sf@size,\sfdefault}
+%\DoNotIndex{\sfrac,\skewchar,\sp,\space,\string,\strip@pt}
+%\DoNotIndex{\tabularnewline,\text,\textdegree,\textmu,\textohm}
+%\DoNotIndex{\textsc,\textstyle,\textsuperscript,\the,\thr@@,\times}
+%\DoNotIndex{\ttdefault,\uccode,\unboldmath,\unhbox,\upmu,\Upomega}
+%\DoNotIndex{\uppercase,\upshape,\wd,\xdef,\xspace,\z@}
+%
+%\DoNotIndex{\if,\lowercase,\+,\,,\-,\.,\:,\;,\@argdef,\@cdr}
+%\DoNotIndex{\@ifdefinable,\@testopt,\@yargdef,\color,\endlinechar}
+%\DoNotIndex{\key@ifundefined,\newrobustcmd,\protected,\scriptspace}
+%\DoNotIndex{\usebox,\tw@,\ifinner,\usepackage,\texttt,\textsf}
+%\DoNotIndex{\NC@do,\loop,\l@ngrel@x,\g@addto@macro,\documentclass}
+%\DoNotIndex{\document\,\begin,\=,\@ehb,\\,\listfiles}
+%
+%\DoNotIndex{\pascalsecond,\amperemetresecond,\ohmmetre}
+%\DoNotIndex{\newtonmetre,\newtonmetrenp}
+%\DoNotIndex{\kilogramsquaremetre,\kilogramsquaremetrenp}
+%
+%\changes{v1.0}{2008/06/12}{First official release}
+%
+%\setkeys{lst}{language=[LaTeX]{TeX},moretexcs={sisetup,num,ang,SI,
+% si,newunit,newpower,newprefix,metre,candela,kelvin,ampere,eV,
+% second,mole,per,kilogram,Square,squared,cubed,cubic,kilo,centi,
+% gram,tothe,toprule,midrule,bottomrule,newton,micro,joule,mega,
+% raiseto,deci,mathnormal,numprint,electronvolt,selectlanguage,
+% kibi,byte,molar,Molar,mmHg,mebi,torr,parsec,lightyear,clight,
+% eVperc,addplot,color,milli,cm,Hz,kg,DeclareRobustCommand,
+% pascal,dalton}}
+%
+%\title{\currpkg\ --- A comprehensive (SI) units package^^A
+% \thanks{This file describes version \fileversion, last revised
+% \filedate.}}
+%\author{Joseph Wright^^A
+% \thanks{E-mail: joseph.wright@morningstar2.co.uk}}
+%\date{Released \filedate}
+%
+%\maketitle
+%
+%\newcommand*{\SIunits}{\pkg{SIunits}\xspace}
+%\newcommand*{\SIstyle}{\pkg{SIstyle}\xspace}
+%\newcommand*{\unitsdef}{\pkg{unitsdef}\xspace}
+%\newcommand*{\units}{\pkg{units}\xspace}
+%\newcommand*{\numprint}{\pkg{numprint}\xspace}
+%\begin{abstract}
+% Typesetting values with units requires care to ensure that the
+% combined mathematical meaning of the value plus unit combination is
+% clear. In particular, the SI units system lays down a consistent
+% set of units with rules on how these are to be used. However,
+% different countries and publishers have differing conventions on
+% the exact appearance of numbers (and units).
+%
+% The \currpkg provides a set of tools for authors to typeset numbers
+% and units in a consistent way. The package has an extended set of
+% configuration options which make it possible to follow varying
+% typographic conventions with the same input syntax. The package
+% includes automated processing of numbers and units, and the ability
+% to control tabular alignment of numbers.
+%
+% A number of \LaTeX\ packages have been developed in the past for
+% formatting units: \SIunits, \SIstyle, \unitsdef, \units,
+% \pkg{fancyunits} and \pkg{fancynum}. Support for users of all of
+% these packages is available as emulation modules in \currpkg.
+% In addition, \currpkg can carry out many of the functions of the
+% \pkg{dcolumn}, \pkg{rccol} and \numprint packages.
+%\end{abstract}
+%
+%\begin{multicols}{2}
+% \tableofcontents
+%\end{multicols}
+%
+%\clearpage
+%\part{Introduction}
+% The correct application of units of measurement is very important
+% in technical applications. For this reason, carefully-crafted
+% definitions of a coherent units system have been laid down by the
+% \latin{Conf\'erence G\'en\'erale des Poids et
+% Mesures}\footnote{General Conference on Weights and Measures.}
+% (CGPM): this has resulted in the \latin{Syst\`eme International
+% d'Unit\'es}\footnote{International System of Units.} (SI). At the
+% same time, typographic conventions for correctly displaying both
+% numbers and units exist to ensure that no loss of meaning occurs in
+% printed matter.
+%
+% \currpkg aims to provide a unified method for \LaTeX\ users to
+% typeset units and values correctly and easily. The design
+% philosophy of \currpkg is to follow the agreed rules by default,
+% but to allow variation through option settings. In this way,
+% users can use \currpkg to follow the requirements of publishers,
+% co-authors, universities, \etc without needing to alter the input
+% at all.
+%
+% \currpkg is intended as a complete replacement for \SIunits,
+% \SIstyle, \unitsdef, \units, \pkg{fancyunits} and
+% \pkg{fancynum}. As such, emulation modes are provided for all of
+% these packages. Where possible, conventions from the existing
+% solutions have been used here. For example, the macros \cs{num},
+% \cs{ang} and \cs{SI} act in a very similar fashion to those in
+% existing packages.
+%
+%\clearpage
+%\part{Using the \currpkg package}
+%
+%\section{For the impatient}
+% \currpkg provides the user macros:
+%\begin{itemize}
+% \item \cs{SI}\oarg{options}\marg{value}\oarg{pre-unit}\marg{unit}
+% \item \cs{si}\oarg{options}\marg{unit}
+% \item \cs{num}\oarg{options}\marg{number}
+% \item \cs{ang}\oarg{options}\marg{angle}
+% \item \cs{sisetup}\marg{options}
+%\end{itemize}
+% plus the |S| and |S| column types for decimal alignments and units
+% in tables. These macros are designed for typesetting units and
+% values with control of appearance and with intelligent processing.
+%
+% By default, all text is typeset in the current upright, serif maths
+% font. This can be changes by setting the appropriate package
+% options: \opt{obeyall} will use the current font for typesetting.
+%
+% The package includes a ``unit processor'', which allows the use of
+% named units or literal values. Named units are processed to
+% correctly include powers.
+%\begin{LaTeXexample}
+% \SI{10}{\gram}\\
+% \SI{23.4}{g.cm^3}\\
+% \num{1e34}\\
+% \ang{1;2;3}\\
+% \emph{\SI{16,7}{\metre\per\second}}\\
+% \textbf{\SI{30e3}{\Hz}}\\
+% \SI{1.2 x 3.56 x 9.2}{\milli\metre}\\
+% \sisetup{obeyall}
+% \textbf{\SI{-4.5}{\cm}}\\
+% \si{\joule\per\mole\per\kelvin}\\
+% \si[per=frac]{\joule\per\mole\per\kelvin}\\
+% \num[dp=4]{1.23456}\\
+% \num[dp=4]{9.8}\\
+% \begin{tabular}{S[tabformat=3.2]}
+% \toprule
+% {Heading}\\
+% \midrule
+% 1.3 \\
+% 134.2 \\
+% 3.56 \\
+% 74,7 \\
+% \bottomrule
+% \end{tabular}
+%\end{LaTeXexample}
+%
+%\section{Requirements}
+% \currpkg requires a reasonably up to date \TeX\ system. The
+% package requires \eTeX-extensions, which should be available on
+% most systems.\footnote{If you have an old \LaTeX\, try
+% ``\texttt{elatex}'' rather than ``\texttt{latex}''.} The following
+% packages are also needed:
+%\begin{itemize}
+% \item \pkg{array} and \pkg{xspace}: from the \pkg{tools} bundle,
+% which should be available to everyone;
+% \item \pkg{xkeyval}: this processes the option handling, and needs
+% to be at least v2.5;
+% \item \pkg{amstext}: from the \AMS\TeX\ support bundle (the
+% \AMS\ fonts are also needed to provide the default upright
+% \si{\micro}).
+%\end{itemize}
+% Hopefully most people using the package will have access to all of
+% those items.
+%
+% To use the \opt{fraction=sfrac} option, the \pkg{xfrac} package is
+% needed. This needs various experimental \LaTeX3 packages. As a
+% result, \currpkg does not load \pkg{xfrac}. If you want to use
+% \opt{fraction=sfrac}, \emph{you} need to load \pkg{xfrac} in your
+% preamble before \currpkg.\footnote{This document has been compiled
+% in this way. You have to load \pkg{xfrac} first as otherwise very
+% nasty things happen with \pkg{xkeyval}. MiK\TeX\ users should note
+% that the packaged versions of \pkg{expl3}, \pkg{template} and
+% \pkg{xparse} will not work with \pkg{xfrac}: download copies from
+% \textsc{ctan}!} If the package is not loaded, \opt{fraction=sfrac}
+% falls back on a \pkg{nicefrac}-like method. The interested user
+% should look at the \pkg{xfrac} documentation for reasons this might
+% not be ideal.\footnote{On the other hand, some fractional units
+% will look really bad with \cs{sfrac}. Use this option with
+% caution.}
+%
+%\section{Loading the package}
+% \currpkg is loaded by the usual \LaTeX\ method.
+%\begin{LaTeXexample}[noexample]
+% \usepackage[<options>]{siunitx}
+%\end{LaTeXexample}
+% As is shown in the example, the package can be loaded with one or
+% more options, using the key--value system. The full range of
+% package options are described in Section~\ref{sec:options}; some
+% options are described in the along with the appropriate user
+% macros. Most of the user macros accept the same key--value
+% settings as an optional argument.
+%
+%\section{Numbers}
+%\DescribeMacro{\num}
+% Numbers are automatically formatted by the \cs{num} macro. This
+% takes one optional and one mandatory argument:
+% \cs{num}\oarg{options}\marg{number}. The contents of \meta{number}
+% are automatically formatted, in a similar method to that used by
+% \numprint. The formatter removes ``hard'' spaces (\cs{,} and |~|),
+% automatically identifies exponents (by default marked using |e| or
+% |d|) and adds the appropriate spacing of large numbers. A leading
+% zero is added before a decimal marker, if needed: both ``|.|'' and
+% ``|,|'' are recognised as decimal marker.
+%\begin{LaTeXexample}
+% \num{1} \num{123} \num{1234} \num{12345}\\
+% \num{0.1} \num{0.123} \num{0,1234} \num{.12345}\\
+% \num{1e10} \num{3.45d-4} \num{-e10}
+%\end{LaTeXexample}
+% Various error-checking systems are built into the package, so that
+% if \meta{number} does not contain any numeric characters, a warning
+% is issued. Isolated signs are also detected. The package
+% recognises |(| and |)| as ``extra'' characters, which can be used
+% to indicate the error in a number.\footnote{This is common in
+% chemical crystallography, for example.} The \opt{seperr} causes
+% this data to be given as a separate error value. If the number
+% also contains an exponent, then brackets are re-added after the
+% separation to ensure that meaning is not lost.
+%\begin{LaTeXexample}
+% $\num{1.234(5)} = \num[seperr]{1.234(5)}$\\
+% $\num{1.234(5)e6} = \num[seperr]{1.234(5)e6}$
+%\end{LaTeXexample}
+% The same applies to the unit and value macro \cs{SI}, described
+% later, for example the rest mass of an electron \cite{IUPAC}:
+%\begin{LaTeXexample}
+% $ m_{\mathrm{e}}
+% = \SI{9.1093897(54)e-31}{\kg} $\\
+% $ m_{\mathrm{e}}
+% = \SI[seperr]{9.1093897(54)e-31}{\kg} $
+%\end{LaTeXexample}
+%
+% A number of effects are available as options. These are fully
+% explained in Section~\ref{sec:options}. Some of the more useful
+% options are illustrated here. By default, the output of the
+% package is typeset in maths mode. However, the use of the current
+% text font can be forced.\footnote{This document is typeset using
+% lowercase numbers in text mode, which emphasises the effect here.}
+%\begin{LaTeXexample}
+% \num{1234567890} \num[mode=text]{1234567890}
+%\end{LaTeXexample}
+% \currpkg can automatically add zeros and signs to numbers. This
+% can be altered as desired.
+%\begin{LaTeXexample}
+% \num{1.} \num[padnumber=all]{1.}\\
+% \num{2} \num[addsign=all]{2}\\
+% \num{3e4} \num[addsign=mant]{3e4} \num[addsign=all]{3e4}\\
+% \num{.5} \num[padnumber=none]{.5}
+%\end{LaTeXexample}
+% The separation of digits can be turned on and off, and the output
+% changed.
+%\begin{LaTeXexample}
+% \num{1234} \num[sepfour=true]{1234}\\
+% \num{12345} \num[digitsep=comma]{12345}\\
+% \num[digitsep=none]{12345}
+%\end{LaTeXexample}
+% The formatting of exponents is also customisable.
+%\begin{LaTeXexample}
+% \num{1e10} \num[expproduct=cdot]{1e10}\\
+% \num{2e20} \num[expbase=5]{2e20}\\
+% \num{3e30} \num[expproduct=tighttimes]{3e30}
+%\end{LaTeXexample}
+%
+% \currpkg can automatically add colour to negative numbers, which is
+% often useful for highlighting purposes. This is turned on with the
+% \opt{colourneg} option; the colour used is set by \opt{negcolour}.
+% Both of these are available with the US spellings: \opt{colorneg}
+% and \opt{negcolor}.
+%\begin{LaTeXexample}
+% \num{-1}\\
+% \sisetup{colourneg} \num{-2}\\
+% \num{3e-3}\\
+% \num[negcolour=blue]{-4}
+%\end{LaTeXexample}
+%
+% \currpkg can automatically zero-fill and round to a fixed number of
+% decimal places. This is controlled by two options \opt{fixdp} and
+% \opt{dp}. The later is an integer which specifies how many places
+% to fix to; setting this option automatically sets \opt{fixdp} to
+% \opt{true}. The place-fixing system will only alter pure numbers: for
+% example, any error component will result in the input being left
+% unchanged.
+%\begin{LaTeXexample}
+% \num{1.23456}\\
+% \sisetup{dp=2}
+% \num{1.23456}\\
+% \num{9.8}\\
+% \num{-10.432}\\
+% \num{44.3221(2)}
+%\end{LaTeXexample}
+%
+%\section{Tabular material}
+%\subsection{Aligning numbers}
+% Centring numbers in tabular content is handled by a new column
+% type, the |S| column. This is based closely on the \pkg{dcolumn}
+% method for centring numbers in columns, but adds the functionality
+% of the \cs{num} macro.\footnote{The approach used is actually a
+% combination of \pkg{dcolumn} for centring the material and
+% \numprint for processing it. It will therefore give rather
+% different results than the \texttt{n} and \texttt{N} column types
+% in \numprint.}
+%
+% By default, the decimal marker of the number is placed at the
+% centre of the column, which then resizes to accommodate the width
+% of the contents (\ref{tab:default}). This behaviour is set by the
+% \opt{tabnumalign=centredecimal} option. By setting the
+% \opt{tabnumalign} option to \opt{centre}, the centre of the space
+% reserved for the number is placed at the centre of the column. The
+% space reserved is stored in \opt{tabformat}, which is of the form
+% \texttt{\meta{before}\meta{dec}\meta{after}}, where \meta{before}
+% is the number of characters before the decimal marker and
+% \meta{after} is the number after. Thus in the example,
+% \opt{tabformat=2.4} provides space for two digits before the
+% decimal marker and four after. \opt{tabnumalign} can also be set
+% to \opt{left} and \opt{right}, with the expected results.
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \caption{Behaviour of \texttt{S} column type
+% \label{tab:default}}
+% \centering
+% \begin{tabular}{%
+% S%
+% S[tabnumalign=centre,tabformat=2.4]%
+% S[tabnumalign=right,tabformat=2.4]%
+% S[tabnumalign=centre,tabformat=2.4,decimalsymbol=comma]}
+% \toprule
+% {Some Values} & {Some Values} & {Some Values} & {Some Values} \\
+% \midrule
+% 2.3456 & 2.3456 & 2.3456 & 2.3456 \\
+% 34.2345 & 34.2345 & 34.2345 & 34.2345 \\
+% 56.7835 & 56.7835 & 56.7835 & 56.7835 \\
+% 90.473 & 90.473 & 90.473 & 90.473 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+% The \opt{tabformat} setting can also be used to reserve space for
+% numbers containing exponents. This is given in the same format as
+% above, but with a mantissa and exponent part (\ref{tab:exptab}).
+% Notice that this is designed to expect that numbers will contain a
+% mantissa. Exponents can either be aligned so that the ``$\times$''
+% symbols match up vertically, or the exponent part can be allowed to
+% move across as needed. Space for signs is added by using any sign
+% in the \opt{tabformat}, so for example \opt{tabformat=+2.2} and
+% \opt{tabformat=-2.2} have exactly the same effect. Setting
+% \opt{tabformat} will automatically switch from \opt{tabnumalign}
+% from \opt{centredecimal} to \opt{centre}, if the former is
+% currently set. In other cases, the current alignment option is
+% retained.
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \caption{Exponents in tables
+% \label{tab:exptab}}
+% \centering
+% \begin{tabular}{%
+% S[tabnumalign=right,tabformat=2.2e2]%
+% S[tabnumalign=centre,tabformat=2.2e1.1]%
+% S[tabnumalign=centre,tabformat=2.2e1.1,tabalignexp=false]%
+% S[tabnumalign=centre,tabformat=+2.2]}
+% \toprule
+% {Longer values}
+% & {Longer values}
+% & {Longer values}
+% & {Values} \\
+% \midrule
+% 2.3e1 & 2.34e1 & 2.34e1 & +2.31 \\
+% 34.23e45 & 34.23e45 & 34.23e45 & 34.23 \\
+% 56.78 & 56.78 & 56.78 & -56.78 \\
+% 1.0e34 & 1.0e34 & 1.0e34 & +-1.0 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+%
+% Data not to be processed as a number should be protected by
+% wrapping it in braces: this is most likely to be true for column
+% headers (again as illustrated). By default, the contents of
+% non-numeric cells are centred. This can be altered by setting
+% \opt{tabtextalign}, which can be set to \opt{left}, \opt{right} or
+% \opt{centre}. The use of digit separators in table columns is
+% accounted for: extra space is reserved if digit separators will be
+% added.
+%
+%\subsection{Columns of units}
+% As a complement to the |S| column, \currpkg also provides a second
+% column type, |s|. This is intended for producing columns of units.
+% The letters chosen are intended to be similar to \cs{SI} and
+% \cs{si}, respectively. The alignment of material in |s| columns
+% is governed by the \opt{tabunitalign} option.
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \centering
+% \caption{Number and units in tables}
+% \label{tab:num-unit}
+% \begin{tabular}{%
+% S[tabformat=1.2e-1,tabnumalign=centre]%
+% s[tabunitalign=left]}
+% \toprule
+% {Value} & \multicolumn{1}{c}{Unit} \\
+% \midrule
+% 2.16e-5 & \metre\squared\per\second \\
+% 2.83e-6 & \metre\squared\per\second \\
+% 7.39e3 & \pascal\cubic\metre\per\mole \\
+% 1.0e5 & \pascal \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+%
+%\section{Angles}
+%\DescribeMacro{\ang}
+% Angles can be typeset using the \cs{ang} command. This takes two
+% arguments, \cs{ang}\oarg{options}\marg{angle}, where \meta{options}
+% can be any of the package options to apply only to this value.
+% \meta{angle} can be given either as a decimal number or as a
+% semi-colon separated list of degrees, minutes and seconds, \ie\
+% \cs{ang}\marg{decimal angle} or
+% \cs{ang}|{|\meta{degrees}|;|\meta{minutes}|;|\meta{seconds}|}|. By
+% default, no space is introduced between angles and the degrees,
+% minutes and seconds markers.
+%\begin{LaTeXexample}
+% \ang{10} \ang{12.3} \ang{4,5}\\
+% \ang{1;2;3} \ang{;;1}\\
+% \ang{+10;;} \ang{-0;1;}
+%\end{LaTeXexample}
+%
+% By default, angles with no degrees (or minutes) are zero-filled;
+% angles with degrees but no minutes or seconds are not filled. This
+% behaviour can be altered using the package options.
+%\begin{LaTeXexample}
+% \ang{;;1} \ang[padangle=none]{;;1}\\
+% \ang{2;;} \ang[padangle=all]{2;;}\\
+% \sisetup{padangle=all} \ang{;3;} \ang{4;;} \ang{;;5}
+%\end{LaTeXexample}
+% The \cs{num} macro is used to typeset each number of the angle, so
+% the options for \cs{num} also apply here. The \opt{anglesep} value
+% can be used to separate degrees, minutes and seconds.
+%\begin{LaTeXexample}
+% \ang{1.05} \ang[decimalsymbol=comma]{1.05}\\
+% \ang{3.67890} \ang[digitsep=comma]{3.67890}\\
+% \ang{9;8;7} \ang[anglesep=thin]{9;8;7}
+%\end{LaTeXexample}
+% The degrees, minutes and seconds signs can be placed over the
+% decimal sign using the \opt{astroang} option. This is designed on
+% the assumption that only the last number given has a decimal
+% part.
+%\begin{LaTeXexample}
+% \ang{1.2} \ang[astroang]{1.2}\\
+% \ang{1;2.3;} \ang[astroang]{1;2.3;}\\
+% \ang{1;2;3.4} \ang[astroang]{1;2;3.4}
+%\end{LaTeXexample}
+%
+%\section{Units and values}
+%\DescribeMacro{\SI}
+% The core aim of \currpkg is correctly typesetting values which have
+% units. The main output macro here is \cs{SI}, which has the same
+% syntax as the macros with the same name in \SIstyle and \unitsdef
+% packages. The \cs{SI} macro takes two mandatory arguments, in
+% addition to the optional set up argument, and a second optional
+% argument:
+% \cs{SI}\oarg{options}\marg{number}\oarg{preunit}\marg{unit}. The
+% \meta{number} argument operates in exactly the same manner as the
+% equivalent argument of the \cs{num} macro. \meta{unit} will be
+% typeset with a non-breakable space between it and the preceding
+% number, with font control as outlined earlier. Finally,
+% \meta{preunit} is a unit to be typeset \emph{before} the numerical
+% value (most likely to be a currency). Some examples illustrate the
+% general power of the macro.
+%\begin{LaTeXexample}
+% \SI[mode=text]{1.23}{J.mol^{-1}.K^{-1}}\\
+% \SI{.23e7}{\candela}\\
+% \SI[per=slash]{1.99}[\pounds]{\per\kilogram}\\
+% \SI{70}{\metre\per\second}\\
+% \SI[per=frac,fraction=nice]{1,345}{\ampere\per\mole}
+%\end{LaTeXexample}
+% The use of unit macros outside of the \cs{SI} macro is described
+% later.
+%
+%\subsection{Literal units}
+% Units can be input in two ways, inspired by \SIstyle and \SIunits.
+% The \SIstyle-like method uses literal input. Four characters have
+% a special meaning:
+%\begin{itemize}
+% \item ``|^|'' The superscript character is used without the usual
+% need for surrounding maths characters (|$|);^^A$
+% \item ``|.|'' and ``|,|'': the full stop (point) symbol and comma
+% are made active, and produce the current contents of the
+% \opt{unitsep} option;
+% \item ``|~|'' The contents of the \opt{unitspace} option are typeset
+% by a tilde.
+%\end{itemize}
+% This allows ready input of units.
+%\begin{LaTeXexample}
+% \SI{10}{kg.m.s^{-2}}\\
+% \SI{1.453}{g/cm^3}\\
+% \SI{33.562}{cd~s}\\
+% \SI[unitsep=medium]{100}{m.s^{-2}}
+%\end{LaTeXexample}
+% The literal unit system will correctly typeset input containing the
+% symbols \si{\micro} (micro), \si{\degree} (degree) and
+% \si{\angstrom} (ring-A).\footnote{Currently this works with \XeTeX\
+% and \pkg{inputenc} using the \texttt{latin1}, \texttt{latin5} and
+% \texttt{latin9} encodings.}
+% \begingroup\makeatletter\si@unt@nonlatin
+%\begin{LaTeXexample}
+% \SI{10}{µm}\\
+% \SI{20}{°C}\\
+% \SI{30}{Å}
+%\end{LaTeXexample}
+%\endgroup
+%
+%\subsection{The unit interpreter}
+% The second operation mode for the \cs{SI} macro is based on the
+% behaviour of \SIunits. Here, each unit, SI multiple prefix and
+% power is given a macro name. These are entered in a method very
+% similar to the reading of the unit name in English.
+%\begin{LaTeXexample}
+% \SI{10}{\kilo\gram\metre\per\second\squared}\\
+% \SI{1.453}{\gram\per\cubic\centi\metre}\\
+% \SI{33.562}{\candela\second}\\
+% \SI[unitsep=thin]{100}{\metre\per\Square\second}\\
+% \SI[prefixsymbolic=false]{4.56}{\kilo\metre\per\second}
+%\end{LaTeXexample}
+% On its own, this is very similar to \SIunits, and is less
+% convenient than the direct input method.\footnote{Users of \SIunits
+% should note the lack of need for a \cs{usk}-type macro.} However,
+% the package allows you to define new unit macros; a large number of
+% pre-defined abbreviations are also supplied. More importantly, by
+% defining macros for units, instead of literal values, new
+% functionality is made available. Units may be re-defined to give
+% different output, and handling of reciprocal values can be altered.
+%\begin{LaTeXexample}
+% \SI[per=frac,fraction=frac]{10}{\gram\metre\per\second\squared}\\
+% \SI[per=slash]{1.453}{\gram\per\cubic\centi\metre}\\
+% \SI{33.562}{\candela\second}\\
+% \SI[per=frac,fraction=nice]{100}{\metre\per\Square\second}
+%\end{LaTeXexample}
+% The unit processor will trap \emph{some} errors in the input and
+% give the ``best guess'' result. However, it is down to the user to
+% check the output.
+%
+%\subsection{Powers of units}
+%\DescribeMacro{\Square}
+%\DescribeMacro{\ssquare}
+%\DescribeMacro{\squared}
+%\DescribeMacro{\cubic}
+%\DescribeMacro{\cubed}
+% Including powers in units is handled using a ``natural language''
+% method. Thus preceding a unit by \cs{Square} or \cs{cubic} which
+% raise the unit to the appropriate power, while \cs{squared} or
+% \cs{cubed} follow the unit they apply to. The \cs{Square} macro is
+% capitalised to avoid a name clash with \pkg{pstricks}; the
+% alternative \cs{ssquare} is also provided.
+%\begin{LaTeXexample}
+% \SI{10}{\metre\squared}\\
+% \SI{20}{\Square\metre}\\
+% \SI{30}{\metre\cubed}\\
+% \SI{40}{\cubic\metre}
+%\end{LaTeXexample}
+%
+%\DescribeMacro{\per}
+% The \cs{per} macro intelligently creates reciprocal powers, and
+% also adds the power $-1$ when appropriate.
+%\begin{LaTeXexample}
+% \SI{10}{\per\second\squared}\\
+% \SI{20}{\per\Square\second}\\
+% \SI[per=frac,fraction=nice]{30}{\per\second\cubed}\\
+% \SI[per=slash]{40}{\per\cubic\second}\\
+% \SI{50}{\per\second}\\
+% \SI{60}{\per\metre\Square\candela}
+%\end{LaTeXexample}
+%
+%\DescribeMacro{\tothe}
+%\DescribeMacro{\raiseto}
+% For powers not defined above or with \cs{newpower}, the \cs{tothe}
+% macro can be used ``in line'' to produce a power. As follows from
+% standard English usage, this comes after the unit. \cs{raiseto}
+% achieves the same, but is used \emph{before} a unit to add a power
+% \emph{after}.\footnote{\cs{raiseto} acts in the same way as
+% \cs{tothe} when used in a literal context: the power will be
+% produced where the macro is, rather than moving after the next
+% item.}
+%\begin{LaTeXexample}
+% \SI{16.86}{\metre\tothe{4}}\\
+% \SI{7.895}{\raiseto{-6}\newton}\\
+% \SI{1.34}{\per\kelvin\tothe{7}}
+%\end{LaTeXexample}
+%
+%\subsection{Units with no values}
+%\DescribeMacro{\si}
+% For typesetting the symbol for a unit on its own, with the full
+% font control and without extra spaces, the \cs{si} macro is
+% provided.\footnote{The same effect can be achieved using the
+% \cs{SI} macro with an empty numerical argument.} The macro name
+% avoids a clash with the functionality of the earlier packages, but
+% is similar to \cs{ilu} from the \unitsdef package.
+%\begin{LaTeXexample}
+% \SI{}{kg.m/s^2}\\
+% \si{kg.m/s^2}\\
+% \si[mode=text,unitsep=thin]{\mole\per\cubic\deci\metre}
+%\end{LaTeXexample}
+%
+%\subsection{Free-standing units}
+% Users of the \unitsdef package will be a accustomed to using unit
+% macros on their own (following a value) or with an optional
+% argument containing a number. In both cases, only a single unit
+% macro could be used. \currpkg supports both operation modes, with
+% the limitation that units trailing values loose font control of the
+% value. When used in this way, the units \emph{do not} take an
+% optional \pkg{keyval} argument.
+%\begin{LaTeXexample}
+% \sisetup{prespace,allowoptarg}
+% 123\metre\\
+% \kelvin[123]\\
+% \sisetup{mode=text} \ampere[234]\\
+% 6\second
+%\end{LaTeXexample}
+%
+%\subsection{Pre-defined units, prefixes and powers}
+%\newcommand*{\csindex}[1]{^^A
+% \cs{#1}^^A
+% \expandafter\SpecialUsageIndex\csname#1\endcsname}
+%\newcommand*{\unitinfo}[1]{^^A
+% #1 & \csindex{#1} &
+% \expandafter\si\expandafter{\csname#1\endcsname}}
+%\begin{table}
+% \caption{The seven base SI units}
+% \label{tab:baseunits}
+% \centering
+% \begin{tabular}{lll}
+% \toprule
+% \multicolumn{1}{c}{Unit} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Symbol} \\
+% \midrule
+% \unitinfo{kilogram}\\
+% \unitinfo{metre}\\
+% \unitinfo{second}\\
+% \unitinfo{mole}\\
+% \unitinfo{kelvin}\\
+% \unitinfo{ampere}\\
+% \unitinfo{candela}\\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%\DescribeMacro{\metre}
+%\DescribeMacro{\meter}
+% The package always defines the seven base SI units, irrespective of
+% any package options given (\ref{tab:baseunits}). The kilogram is
+% notable as by default it is a \emph{base} unit with a prefix. Thus,
+% when the package is loaded with the option \opt{load=\{\}},
+% \cs{kilo} and \cs{gram} \emph{are not defined}. As metre is often
+% spelled as ``meter'' in the US, the macro \cs{meter} is provided in
+% addition to the \cs{metre} macro.\footnote{The official SI spelling
+% for the unit is ``metre''.}
+%
+% By default, a number of additional definitions are created by the
+% package. These are controlled by the \opt{load} and \opt{noload}
+% options. Unless specifically requested with the option
+% \opt{noload=prefix}, \currpkg defines the standard prefixes for
+% powers of ten (\ref{tab:prefix}). This leads to the redefinition
+% of \cs{kilogram} as \cs{kilo}\cs{gram}. The macro \cs{deka} is
+% provided, as this is used as an alias for \cs{deca} in some places.
+% The package also defines a number of derived SI units which have
+% assigned names and symbols (\ref{tab:derived}). Note that \cs{Gray}
+% is capitalised to avoid a name clash with the \pkg{pstricks}
+% package.\footnote{The macros \cs{ohm} and \cs{celsius} are not
+% defined by \currpkg if the \pkg{gensymb} package is loaded.}
+%\newcommand*{\prefixunitsym}[1]{\si[prefixsymbolic=false]{#1}}
+%\newcommand*{\prefixinfo}[1]{^^A
+% #1 & \csindex{#1} &
+% \expandafter\prefixunitsym\expandafter{\csname#1\endcsname} &
+% \expandafter\si\expandafter{\csname#1\endcsname}}
+%\begin{table}
+% \caption{The SI prefixes (\opt{load=prefix})}
+% \label{tab:prefix}
+% \centering
+% \begin{tabular}{lllclllc}
+% \toprule
+% \multicolumn{1}{c}{Prefix} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Power} &
+% Symbol &
+% \multicolumn{1}{c}{Prefix} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Power} &
+% Symbol \\
+% \midrule
+% \prefixinfo{yocto} &
+% \prefixinfo{deca} \\
+% \prefixinfo{zepto} &
+% \prefixinfo{hecto} \\
+% \prefixinfo{atto} &
+% \prefixinfo{kilo} \\
+% \prefixinfo{femto} &
+% \prefixinfo{mega} \\
+% \prefixinfo{pico} &
+% \prefixinfo{giga} \\
+% \prefixinfo{nano} &
+% \prefixinfo{tera} \\
+% \prefixinfo{micro} &
+% \prefixinfo{peta} \\
+% \prefixinfo{milli} &
+% \prefixinfo{exa} \\
+% \prefixinfo{centi} &
+% \prefixinfo{zetta} \\
+% \prefixinfo{deci} &
+% \prefixinfo{yotta} \\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%\begin{table}
+% \caption{The derived SI units with defined names
+% (\opt{load=derived})}
+% \label{tab:derived}
+% \centering
+% \begin{tabular}{llllll}
+% \toprule
+% \multicolumn{1}{c}{Unit} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Symbol} &
+% \multicolumn{1}{c}{Unit} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Symbol} \\
+% \midrule
+% \unitinfo{becquerel} &
+% \unitinfo{newton} \\
+% \unitinfo{celsius} &
+% \unitinfo{ohm} \\
+% \unitinfo{coulomb} &
+% \unitinfo{pascal} \\
+% \unitinfo{farad} &
+% \unitinfo{radian} \\
+% \unitinfo{Gray} &
+% \unitinfo{siemens} \\
+% & \csindex{ggray} & \ggray &
+% \unitinfo{sievert} \\
+% \unitinfo{hertz} &
+% \unitinfo{steradian} \\
+% \unitinfo{henry} &
+% \unitinfo{tesla} \\
+% \unitinfo{joule} &
+% \unitinfo{volt} \\
+% \unitinfo{katal} &
+% \unitinfo{watt} \\
+% \unitinfo{lumen} &
+% \unitinfo{weber} \\
+% \unitinfo{lux} \\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%
+% In addition to these units, there are three other groups of units
+% for use with the SI system which do not fit into the above. These
+% are those derived from physical measurements
+% (\ref{tab:experimental}), those considered ``accepted''
+% (\ref{tab:accepted}), and those accepted temporarily
+% (\ref{tab:addn}).\footnote{These are supposed to be replaced over
+% time by SI units.}
+%\DescribeMacro{\litre}
+%\DescribeMacro{\liter}
+% The unit ``litre'' is often spelled ``liter'' in the US; both
+% spellings are provided by \currpkg, with \cs{liter} giving
+% \si{\liter} and \cs{litre} producing \si{\litre}.
+%\begin{table}
+% \caption{Units derived from experiments
+% (\opt{load=physical})}
+% \label{tab:experimental}
+% \centering
+% \begin{tabular}{lll}
+% \toprule
+% \multicolumn{1}{c}{Unit} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Symbol} \\
+% \midrule
+% electron volt & \csindex{electronvolt} & \electronvolt \\
+% unified atomic mass unit
+% & \csindex{atomicmassunit} & \atomicmassunit \\
+% & \csindex{atomicmass} & \atomicmass \\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%\begin{table}
+% \caption{Units accepted for use with SI
+% (\opt{load=accepted})}
+% \label{tab:accepted}
+% \centering
+% \begin{tabular}{lll}
+% \toprule
+% \multicolumn{1}{c}{Unit} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Symbol} \\
+% \midrule
+% \unitinfo{bel} \\
+% day & \csindex{Day} & \Day \\
+% & \csindex{dday} & \dday \\
+% \unitinfo{degree} \\
+% \unitinfo{hour} \\
+% \unitinfo{litre} \\
+% & \csindex{liter} & \liter \\
+% \unitinfo{minute} \\
+% minute (arc) & \csindex{arcmin} & \arcmin \\
+% \unitinfo{neper} \\
+% \unitinfo{percent} \\
+% second (arc) & \csindex{arcsec} & \arcsec \\
+% \unitinfo{tonne} \\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%\begin{table}
+% \centering
+% \caption{Additional (temporary) SI units
+% (\opt{load=addn})}
+% \label{tab:addn}
+% \begin{tabular}{lll}
+% \toprule
+% \multicolumn{1}{c}{Unit} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Symbol} \\
+% \midrule
+% {\aa}ngstr{\"o}m & \csindex{angstrom} & \angstrom \\
+% \unitinfo{are} \\
+% \unitinfo{curie} \\
+% bar & \csindex{BAR} & \BAR \\
+% & \csindex{bbar} & \bbar \\
+% \unitinfo{barn} \\
+% \unitinfo{gal} \\
+% \unitinfo{hectare} \\
+% \unitinfo{millibar} \\
+% \unitinfo{rad} \\
+% \unitinfo{rem} \\
+% \unitinfo{roentgen} \\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%
+%\subsection{Prefixed and abbreviated units}
+% Many basic units have prefixes which are commonly used with the
+% unit, such as centimetre or megahertz. The package therefore
+% defines a number of common prefixed units (\opt{load=prefixed}).
+% Several of these also have obvious abbreviations (such as \cs{MHz}
+% for \cs{megahertz}), which are made available by \opt{load=abbr}.
+% In common with the units discussed above, the prefixed and
+% abbreviated unit definitions are loaded by default.
+%\newcommand*{\tablesubhead}[1]{^^A
+% \addlinespace \emph{#1} \\*}
+%\begin{longtable}{llll}
+% \caption{Prefixed (\opt{load=prefixed}) and abbreviated
+% (\opt{load=abbr}) units\label{tab:abbr}}\\
+% \toprule
+% Unit & Macro & Symbol & Abbreviation \\
+% \midrule
+% \endfirsthead
+% \toprule
+% Unit & Macro & Symbol & Abbreviation \\
+% \midrule
+% \endhead
+% \bottomrule
+% \multicolumn{4}{r}{\emph{Continued on next page}}
+% \endfoot
+% \bottomrule
+% \endlastfoot
+%
+% \tablesubhead{Masses}
+% \unitinfo{kilogram} & \csindex{kg} \\
+% \unitinfo{femtogram} & \csindex{fg} \\
+% \unitinfo{picogram} & \csindex{pg} \\
+% \unitinfo{nanogram} & \csindex{nanog} \\
+% \unitinfo{microgram} & \csindex{micg} \\
+% \unitinfo{milligram} & \csindex{mg} \\
+% atomic mass & \csindex{atomicmass} & \amu & \csindex{amu} \\
+%
+% \tablesubhead{Lengths}
+% \unitinfo{picometre} & \csindex{picom} \\
+% \unitinfo{nanometre} & \csindex{nm} \\
+% \unitinfo{micrometre} & \csindex{micm} \\
+% \unitinfo{millimetre} & \csindex{mm} \\
+% \unitinfo{centimetre} & \csindex{cm} \\
+% \unitinfo{decimetre} & \csindex{dm} \\
+% \unitinfo{kilometre} & \csindex{km} \\
+%
+% \tablesubhead{Times}
+% \unitinfo{second} & \csindex{Sec} \\
+% \unitinfo{attosecond} & \csindex{as} \\
+% \unitinfo{femtosecond} & \csindex{fs} \\
+% \unitinfo{picosecond} & \csindex{ps} \\
+% \unitinfo{nanosecond} & \csindex{ns} \\
+% \unitinfo{microsecond} & \csindex{mics} \\
+% \unitinfo{millisecond} & \csindex{ms} \\
+%
+% \tablesubhead{Moles}
+% \unitinfo{femtomole} & \csindex{fmol} \\
+% \unitinfo{picomole} & \csindex{pmol} \\
+% \unitinfo{nanomole} & \csindex{nmol} \\
+% \unitinfo{micromole} & \csindex{micmol} \\
+% \unitinfo{millimole} & \csindex{mmol} \\
+%
+% \tablesubhead{Currents}
+% \unitinfo{picoampere} & \csindex{pA} \\
+% \unitinfo{nanoampere} & \csindex{nA} \\
+% \unitinfo{microampere} & \csindex{micA} \\
+% \unitinfo{milliampere} & \csindex{mA} \\
+% \unitinfo{kiloampere} & \csindex{kA} \\
+%
+% \tablesubhead{Areas}
+% square centimetre & \csindex{squarecentimetre} &
+% \squarecentimetre & \csindex{cms} \\*
+% & \csindex{centimetresquared} & \centimetresquared \\
+% square metre & \csindex{squaremetre} & \squaremetre \\
+% square kilometre & \csindex{squarekilometre} & \squarekilometre \\
+%
+% \tablesubhead{Volumes}
+% \unitinfo{microlitre} & \csindex{micl} \\
+% \unitinfo{millilitre} & \csindex{ml} \\
+% cubic centimetre & \csindex{cubiccentimetre} &
+% \cubiccentimetre & \csindex{cmc} \\*
+% & \csindex{centimetrecubed} & \centimetrecubed \\
+% cubic decimetre & \csindex{cubicdecimetre} &
+% \cubicdecimetre & \csindex{dmc} \\
+%
+% \tablesubhead{Frequencies}
+% \unitinfo{hertz} & \csindex{Hz} \\
+% \unitinfo{millihertz} & \csindex{mHz} \\
+% \unitinfo{kilohertz} & \csindex{kHz} \\
+% \unitinfo{megahertz} & \csindex{MHz} \\
+% \unitinfo{gigahertz} & \csindex{GHz} \\
+% \unitinfo{terahertz} & \csindex{THz} \\
+%
+% \tablesubhead{Potentials}
+% \unitinfo{millivolt} & \csindex{mV} \\
+% \unitinfo{kilovolt} & \csindex{kV} \\
+%
+% \tablesubhead{Energies}
+% \unitinfo{kilojoule} & \csindex{kJ}\\
+% \unitinfo{electronvolt} & \csindex{eV} \\
+% \unitinfo{millielectronvolt} & \csindex{meV} \\
+% \unitinfo{kiloelectronvolt} & \csindex{keV} \\
+% \unitinfo{megaelectronvolt} & \csindex{MeV} \\
+% \unitinfo{gigaelectronvolt} & \csindex{GeV} \\
+% \unitinfo{teraelectronvolt} & \csindex{TeV} \\
+% \unitinfo{kilowatthour} & \cs{kWh} \\
+%
+% \tablesubhead{Powers}
+% \unitinfo{milliwatt} \\
+% \unitinfo{kilowatt} \\
+% \unitinfo{megawatt} \\
+%
+% \tablesubhead{Capacitances}
+% \unitinfo{femtofarad} \\
+% \unitinfo{picofarad} \\
+% \unitinfo{nanofarad} \\
+% \unitinfo{microfarad} \\
+% \unitinfo{millifarad} \\
+%
+% \tablesubhead{Resistances}
+% \unitinfo{kiloohm} \\
+% \unitinfo{megaohm} \\
+% \unitinfo{gigaohm} \\
+% \unitinfo{millisiemens} \\
+%
+% \tablesubhead{Forces}
+% \unitinfo{millinewton} \\
+% \unitinfo{kilonewton} \\
+%
+% \tablesubhead{Other units}
+% \unitinfo{hectopascal} \\
+% \unitinfo{megabecquerel} \\
+% \unitinfo{millisievert} \\
+%\end{longtable}
+%
+%\subsection{Defining new units}
+%\DescribeMacro{\newunit}
+%\DescribeMacro{\renewunit}
+%\DescribeMacro{\provideunit}
+% New units are produced using the \cs{newunit} macro. This works as
+% might be expected:
+% \cs{newunit}\oarg{options}\marg{unit}\marg{symbol}, where
+% \meta{symbol} can contain literal values, other units, multiple
+% prefixes, powers and \cs{per}. The \meta{options} argument can be
+% any suitable options, and applies the specific unit macro only. The
+% most obvious example for using this macro is the \cs{degree}
+% unit.\footnote{Although the \cs{ang} macro is preferred for this
+% job.} The (first) optional argument to \cs{SI} and \cs{si} can be
+% used to override the settings for the unit. The \cs{renewunit} and
+% \cs{provideunit} macros take the same arguments.
+%\begin{LaTeXexample}
+% \SI{3.1415}{\degree}\\
+% \newunit[valuesep=none]{\oddunit}{XXX}
+% \SI{12345}{\oddunit}
+% \SI[valuesep=thick]{67890}{\oddunit}
+%\end{LaTeXexample}
+%
+% As with the \LaTeX\ commands \cs{newcommand}, \etc, the choice of
+% \cs{newunit}, \cs{renewunit} or \cs{provideunit} depends on the
+% presence of an existing definition. While \cs{newunit} should be
+% used when a unit has not been previously defined, \cs{renewunit}
+% will issue a warning if the named unit does not already exist.
+% \cs{provideunit} defines the unit if it does not exist, and
+% otherwise does nothing at all. The same behaviour is seen with
+% \cs{providepower} and \cs{provideprefix} (\latin{vide infra}).
+%
+% Output that is only valid in maths mode requires \cs{ensuremath},
+% text-only input requires \cs{text}. In the example below,
+% \cs{mathnormal} is used to force the font choice only for the
+% single character.\footnote{The \cs{mathrm} font used for this
+% document has an ``\ss'' at the $\pi$ position.}
+%\begin{LaTeXexample}
+% \newunit{\SIpi}{\ensuremath{\mathnormal{\pi}}}
+% \SI{10}{\metre\per\SIpi\squared}
+%\end{LaTeXexample}
+%
+%\DescribeMacro{\newpower}
+%\DescribeMacro{\renewpower}
+%\DescribeMacro{\providepower}
+% Powers are defined:
+% \cs{newpower}\ofixarg{post}\marg{power}\marg{num}. Here,
+% \meta{power} is the name of the power macro and \meta{num} is the
+% (positive) number it represents. The later argument is always
+% processed internally by \cs{num}, but \emph{must} be a number.
+% Giving the optional argument \opt{post} indicates to the package
+% that the power will come after the unit it applies to; by default
+% it is assumed that it will come before.
+%\begin{LaTeXexample}
+% \newpower{\quartic}{4}
+% \newpower[post]{\totheforth}{4}\\
+% \si{\kilogram\totheforth}\\
+% \si{\quartic\metre}
+%\end{LaTeXexample}
+%
+%\DescribeMacro{\newprefix}
+%\DescribeMacro{\renewprefix}
+%\DescribeMacro{\provideprefix}
+% The standard SI powers of ten are defined by the package, and are
+% described above. However, the user can define new prefixes with
+% \cs{newprefix}. This has syntax
+% \cs{newunit}\ofixarg{binary}\marg{prefix}\marg{symbol}\marg{powers-ten},
+% where \meta{powers-ten} is the number of powers of ten the prefix
+% represents. When the \opt{binary} option is given, the prefix is a
+% power of two. For example, \cs{kilo} and \cs{kibi} are defined:
+%\begin{LaTeXexample}[noexample]
+% \newprefix{\kilo}{k}{3}
+% \newprefix[binary]{\kibi}{Ki}{10}
+%\end{LaTeXexample}
+%
+%\section{Specialist units}
+% In some subject area, there are units which are in common use even
+% though they are outside of the SI system. Unlike the units
+% discussed earlier, these specialist units are not loaded by
+% default. In each case, they should be requested with the option
+% \opt{alsoload=\meta{name}}.
+%
+%\subsection{Binary units (\opt{binary})\label{sec:binary}}
+%\DescribeMacro{\bit}
+%\DescribeMacro{\byte}
+% The binary prefixes, \cs{bit}, \cs{byte} (\ref{tab:binary}) are not
+% formally part of the SI system. They are available by giving the
+% \opt{alsoload=binary} option.
+%\begin{LaTeXexample}
+% \SI{100}{\mebi\byte}
+%\end{LaTeXexample}
+%\begin{table}
+% \caption{Binary prefixes
+% (\opt{alsoload=binary})}
+% \label{tab:binary}
+% \centering
+% \begin{tabular}{lllc}
+% \toprule
+% \multicolumn{1}{c}{Prefix} &
+% \multicolumn{1}{c}{Macro} &
+% \multicolumn{1}{c}{Power} &
+% Symbol \\
+% \midrule
+% \prefixinfo{kibi} \\
+% \prefixinfo{mebi} \\
+% \prefixinfo{gibi} \\
+% \prefixinfo{tebi} \\
+% \prefixinfo{pebi} \\
+% \prefixinfo{exbi} \\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%
+%\subsection{Synthetic chemistry (\opt{synchem})}
+%\DescribeMacro{\mmHg}
+%\DescribeMacro{\molar}
+%\DescribeMacro{\Molar}
+%\DescribeMacro{\torr}
+%\DescribeMacro{\dalton}
+% The \opt{synchem} file adds the common chemistry units \cs{mmHg},
+% \cs{molar}, \cs{Molar}, \cs{torr} and \cs{dalton} to \currpkg. The
+% \cs{Molar} macro is somewhat awkward, as it can be given as either
+% ``\textsc{m}'' or ``M''. The later is obviously easily confused
+% with the sign for the prefix mega. By default, \currpkg uses the
+% UK default of a small-caps symbol. The \cs{dalton} unit is defined
+% here as this name is not recognised by the various international
+% bodies: the symbol \si{\amu} is preferred.
+%\begin{LaTeXexample}
+% \SI{1}{\Molar} HCl\\
+% \SI{760}{\torr}\\
+% \SI{0.01}{\mmHg}\\
+% \SI{3.0}{\molar}\\
+% \SI{106.42}{\dalton}
+%\end{LaTeXexample}
+%
+%\subsection{High-energy physics (\opt{hep})}
+% In contrast to \pkg{hepunits}, \currpkg does not define a long list
+% of compound units for high-energy physics.\footnote{Using the
+% \opt{emulate=hepunits} option will load a file defining those.}
+% Instead, a small selection of new units are defined
+% (\ref{tab:hep}). The mechanisms provided by \currpkg should avoid
+% the need for large numbers of abbreviations. For example, the
+% \pkg{hepunits} \cs{MinveV} can be given as |\per\MeV| in \currpkg,
+% which requires only one more character.
+%\begin{table}
+% \caption{High-energy physics units (\opt{alsoload=hep})}
+% \label{tab:hep}
+% \centering
+% \begin{tabular}{lllc}
+% \toprule
+% Unit & Macro & Symbol & Abbreviation \\
+% \midrule
+% \addlinespace \emph{Areas} \\
+% \unitinfo{yoctobarn} & \csindex{yb} \\
+% \unitinfo{zeptobarn} & \csindex{zb} \\
+% \unitinfo{attobarn} & \csindex{ab} \\
+% \unitinfo{femtobarn} & \csindex{fb} \\
+% \unitinfo{picobarn} & \csindex{pb} \\
+% \unitinfo{nanobarn} & \csindex{nb} \\
+% \addlinespace \emph{Other units} \\
+% \unitinfo{micron} \\
+% millirad & \csindex{mrad} & \mrad \\
+% \unitinfo{gauss} \\
+% \bottomrule
+% \end{tabular}
+%\end{table}
+%
+%\DescribeMacro{\clight}
+%\DescribeMacro{\eVperc}
+% The \opt{hep} option defines two units which are slightly unusual.
+% \cs{clight} gives \clight, which is recognised as a unit when used
+% in the appropriate circumstances. The second unit provided is
+% \cs{eVperc}, which is commonly-used and clear enough for a compound
+% definition. Notice that the value of \opt{eVcorrb} will need to be
+% adjusted when using this unit.
+%\begin{LaTeXexample}
+% \SI[per=slash,eVcorrb=0.4ex]{4.657}{\mega\eVperc\squared}
+%\end{LaTeXexample}
+%
+%\subsection{Astronomy (\opt{astro})}
+%\DescribeMacro{\parsec}
+%\DescribeMacro{\lightyear}
+% For astronomers, the \cs{parsec} and \cs{lightyear} units are
+% available, and give the obvious results.
+%\begin{LaTeXexample}
+% \SI{12}{\parsec}\\
+% \SI{1}{\lightyear}
+%\end{LaTeXexample}
+%
+%\section{Font control}
+% Following the lead of \SIstyle, \currpkg provides control over the
+% font used to typeset output. By default, all text is typeset using
+% the current upright serif maths font, whether the macros are given
+% in text or maths mode. Some examples will show the effect.
+%\begin{LaTeXexample}
+% \num{10} $\num{10}$\\
+% \sffamily \ang{20} $\ang{20}$\\
+% \textbf{\SI{30}{\kilo\gram}}\\
+% \boldmath $\SI{40}{\kilo\gram}$
+% \[ \num{50} \]
+%\end{LaTeXexample}
+%
+% In contrast, by setting \opt{obeyall}, the current font is used:
+% this may be maths or text, depending on the context.
+%\begin{LaTeXexample}
+% \sisetup{obeyall}\\
+% \ang{1;1;1} $\ang{1;1;1}$\\
+% \sffamily \ang{2;2;2} $\ang{2;2;2}$\\
+% \textbf{\ang{3;3;3}} \boldmath $\ang{3;3;3}$\\
+% \emph{\ang{4;4;4}} \emph{$\ang{4;4;4}$}
+% \[ \ang{5;5;5} \]
+%\end{LaTeXexample}
+%
+% Fine control of which elements of the local font are used is
+% available with the \opt{obeyfamily}, \opt{obeybold},
+% \opt{obeyitalic} and \opt{obeymode} options.
+%\begin{LaTeXexample}
+% \sisetup{obeyfamily}\\
+% \ang{1;1;1} $\ang{1;1;1}$\\
+% \sffamily \ang{2;2;2} $\ang{2;2;2}$\\
+% \sisetup{obeybold}
+% \textbf{\ang{3;3;3}} \boldmath $\ang{3;3;3}$\\
+% \emph{\ang{4;4;4}} \emph{$\ang{4;4;4}$}
+% \[ \ang{5;5;5} \]
+%\end{LaTeXexample}
+%
+%\section{Package options\label{sec:options}}
+%\DescribeMacro{\sisetup}
+% The ``native'' options for the package are all given using the
+% key--value method. Most of the package options can be given both
+% when loading the package and at any point in the document. This is
+% achieved using the \cs{sisetup} macro.
+%
+% The package options take a number of different forms.
+%\begin{itemize}
+% \item \opt{option=\meta{bool}} Simple true/false values. These
+% macros all default to \opt{option=true}, meaning that giving the
+% option name along will set the appropriate flag.
+% \item \opt{option=\meta{choice}} Take a single item from a
+% pre-determined list. Depending on the value, one or more
+% internal states will be altered. Values not on the list are
+% ignored (with a warning).
+% \item \opt{option=\meta{choice,literal}} If the given value is a
+% \meta{choice}, then the internal settings for that choice are
+% used. Any other value is used directly.
+% \item \opt{option=\meta{literal}} The given value is used as a
+% literal by the package.
+% \item \opt{option=\meta{csname}} These options expect a command
+% sequence as a value.
+% \item \opt{option=\meta{length}} Requires a \TeX\ length, for
+% example \opt{0.5ex}.
+% \item \opt{option=\meta{list}} Takes a list of one or more items,
+% which are not determined in advance.
+% \item \opt{option=\meta{number}} Takes a number (possibly
+% including an exponent part).
+%\end{itemize}
+%
+% The package has a large range of options, to allow full control of
+% the various features of the package. These control differing
+% aspects of the package, and are given below in groups based on
+% function. Where the key has a default value, it is given in bold.
+%
+%\subsection{Font family and style}
+% The font used when typesetting material can be tightly controlled
+% using \currpkg. A number of options affect how the package matches
+% the surrounding font, and the font families used to achieve this.
+% The default is to use the current upright maths serif font with no
+% variation.
+%
+%\DescribeOption{mode}
+%\DescribeOption{textmode}
+%\DescribeOption{valuemode}
+%\DescribeOption{unitmode}
+%\DescribeOption{obeymode}
+% The output of \currpkg can occur using either text or maths mode.
+% The package option \opt{mode} determines which is used: valid
+% options are \defaultopt{maths} and \opt{text}.\footnote{Here and in
+% all other cases, either UK or US spelling may be used. Thus
+% \opt{mode=maths} or \opt{mode=math} have exactly the same effect.}
+% The shortcut \opt{textmode} is provided for setting \opt{mode=text}
+% quickly. Further refinement is possible using the \opt{valuemode}
+% and \opt{unitmode} options. These apply to numbers (the output of
+% \cs{num} and the first mandatory argument of \cs{SI}) and units
+% (all other output), respectively. By setting the \opt{obeymode}
+% flag, the package will use the local typesetting mode (maths or
+% text).
+%
+%\DescribeOption{obeyall}
+%\DescribeOption{obeyfamily}
+%\DescribeOption{obeybold}
+%\DescribeOption{obeyitalic}
+% The detection and matching of surrounding text can be controlled
+% using a number of Boolean package options. \opt{obeyall} turns on
+% all of the detection. Thus output with \opt{obeyall} in force will
+% always match the local text appearance. \opt{obeyfamily} instructs
+% the package on detecting the surrounding font family (Roman, sans
+% serif, fixed width), but does not detect bold or italic.
+% \opt{obeybold} detects the local bold setting, whilst
+% \opt{obeyitalic} picks up italic fonts.
+%
+% Bold detection is influenced by the value of \opt{inlinebold},
+% which takes values \defaultopt{text} and \opt{maths}. The package
+% can detect the local value of bold for either the surrounding text,
+% or the surrounding inline (|$|\ldots|$|) maths. The
+% \opt{obeyitalic} option does \emph{not} have the same facility
+% (maths is italic anyway).
+%
+%\DescribeOption{mathsrm}
+%\DescribeOption{mathssf}
+%\DescribeOption{mathstt}
+%\SpecialOptionIndex{mathrm}
+%\SpecialOptionIndex{mathsf}
+%\SpecialOptionIndex{mathtt}
+%\DescribeOption{textrm}
+%\DescribeOption{textsf}
+%\DescribeOption{texttt}
+% The font commands used by the package to achieve the above are all
+% available for user modification. The options \opt{mathsrm},
+% \opt{mathssf} and \opt{mathstt} hold the command sequences used in
+% maths mode,\footnote{These can also be set using \opt{mathrm},
+% \opt{mathsf} and \opt{mathtt}} while \opt{textrm}, \opt{textsf} and
+% \opt{texttt} do the same for text mode. By default, these contain
+% the obvious command names, for example \opt{mathsrm=mathrm} and
+% \opt{texttt=ttfamily}. However, they can be set at will: the macro
+% names indicate the nature of the surrounding text detected. For
+% example, the value of \opt{mathssf} is used in maths mode when the
+% surrounding text is sans serif.
+%
+%\SpecialOptionIndex{valuemathsrm}
+%\SpecialOptionIndex{valuemathssf}
+%\SpecialOptionIndex{valuemathstt}
+%\SpecialOptionIndex{valuemathrm}
+%\SpecialOptionIndex{valuemathsf}
+%\SpecialOptionIndex{valuemathtt}
+%\SpecialOptionIndex{unitmathsrm}
+%\SpecialOptionIndex{unitmathssf}
+%\SpecialOptionIndex{unitmathstt}
+%\SpecialOptionIndex{valuetextrm}
+%\SpecialOptionIndex{valuetextsf}
+%\SpecialOptionIndex{valuetexttt}
+%\SpecialOptionIndex{valuetextrm}
+%\SpecialOptionIndex{valuetextsf}
+%\SpecialOptionIndex{valuetexttt}
+%\SpecialOptionIndex{unittextrm}
+%\SpecialOptionIndex{unittextsf}
+%\SpecialOptionIndex{unittexttt}
+% Each of the font options can be given separately for the contents
+% of numbers and units. The option names include \opt{value} or
+% \opt{unit} before the mode name. For example, the \opt{mathsrm}
+% option may be split into \opt{valuemathsrm} and \opt{unitmathsrm}.
+%
+%\DescribeOption{detectdisplay}
+% The font detection system can treat displayed mathematical content
+% in two ways. This is controlled by the \opt{detectdisplay} option.
+% When set to \defaultopt{true}, display mathematics is treated
+% independently from the body of the document. Thus the local
+% \emph{maths} font is checked for matching. In contrast, when set
+% to \opt{false}, display material is treated with the current
+% running text font.
+%\begin{LaTeXexample}
+% \sffamily
+% Some text
+% \sisetup{obeyall}
+% \[ x = \SI{1.2e3}{\kg\kelvin\candela} \]
+% More text
+% \sisetup{detectdisplay=false}
+% \[ y = \SI{3}{\metre\second\mole} \]
+%\end{LaTeXexample}
+%
+%\subsection{Spacing and separators}
+%\DescribeOption{unitsep}
+%\DescribeOption{valuesep}
+%\DescribeOption{digitsep}
+%\DescribeOption{anglesep}
+% The separators between items can all be set using options taking a
+% list of pre-defined items or a literal value. The ``\opt{sep}''
+% options (\opt{unitsep}, \opt{valuesep}, \opt{digitsep} and
+% \opt{anglesep}) all recognise \opt{thin}, \opt{medium}, \opt{med},
+% \opt{thick}, \opt{space}, \opt{cdot}, \opt{times}, \opt{tightcdot},
+% \opt{tighttimes}, \opt{fullstop}, \opt{stop}, \opt{period} and
+% \opt{none}. The named spaces are the normal maths separations,
+% with \opt{space} representing a full (non-breakable text) space,
+% and with the obvious meanings for \opt{cdot} and \opt{times}. The
+% \opt{tight} variants reduce the spacing available. Three possible
+% values are provided for ``|.|'', and \opt{none} yields no space at
+% all. In all cases, other values are treated literally and are
+% typeset in maths mode. The default value is \defaultopt{thin} for
+% all separations except \opt{anglesep}, which is set to
+% \defaultopt{none}.
+%
+%\DescribeOption{unitspace}
+%\DescribeOption{errspace}
+% The \opt{unitspace} and \opt{errspace} options again take a list
+% or literal value, but only the ``real'' spaces \opt{thin},
+% \opt{medium}, \opt{med}, \opt{thick}, \opt{space} and \opt{none}
+% are recognised in the list. The \opt{unitspace} option controls the
+% output generated by an explicit space (|~|) inside a unit macro,
+% while \opt{errspace} is used to separate a bracketed error from the
+% main number.
+%
+%\subsection{Number formatting}
+%\DescribeOption{numdigits}
+%\DescribeOption{numdecimal}
+%\DescribeOption{numexp}
+%\DescribeOption{numsign}
+%\DescribeOption{numaddn}
+%\DescribeOption{numgobble}
+% There are two groups of options for formatting numbers. The first
+% group all begin with ``\opt{num}'', and take literal values used by
+% the package to parse numbers. \opt{numdigits} contains the valid
+% number symbols (\defaultopt{0123456789}), with \opt{numdecimal}
+% containing the decimal markers (\defaultopt{.,}). As in the
+% \numprint package, \opt{numexp} (the list of exponent markers)
+% recognises \defaultopt{deDE} as valid by default. \opt{numsign}
+% contains the sign markers for numbers
+% (\defaultopt{+-\cs{pm}\cs{mp}}). \opt{numaddn} and
+% \opt{numgobble} both control which other characters do not give an
+% error when present in a number. \opt{numaddn} contains valid
+% characters which should be included in the final output ``as is'',
+% whereas \opt{numgobble} lists the characters that are completely
+% ignored. In all cases, the content of the options is a simple
+% string, for example \opt{numdigits=1234567890}.
+%
+%\DescribeOption{decimalsymbol}
+%\DescribeOption{digitsep}
+%\DescribeOption{sepfour}
+% The second group of number options control the output of numbers
+% after parsing. The symbol used by \currpkg as a decimal marker is
+% set by the \opt{decimalsymbol} option, which can take a list of
+% choices or a literal. The valid choices here are
+% \defaultopt{fullstop}, \opt{comma}, \opt{cdot} and
+% \opt{tightcdot}.\footnote{\opt{fullstop} also has aliases
+% \opt{stop} and \opt{period}.} Notice that this does not have to
+% agree with the input marker. The other separator for numerical
+% output is the division of digits into groups of three. The result
+% is dependant on two options. The previously-described
+% \opt{digitsep} option controls the spacing added between groups of
+% three numbers. For numbers consisting of exactly four digits, the
+% \opt{sepfour} Boolean option controls whether separation occurs in
+% these cases. The default is \defaultopt{false}.
+%\begin{LaTeXexample}
+% \num{1234}\\
+% \num[sepfour]{1234}
+%\end{LaTeXexample}
+%
+%\DescribeOption{seperr}
+%\DescribeOption{numopenerr}
+%\DescribeOption{numcloseerr}
+% For numbers given with an error [\eg \num{1.23(4)}], the package
+% can separate out the error part, to give for example
+% \num[seperr]{1.23(4)}. This behaviour is activated by the
+% \opt{seperr} option, and requires that \opt{numopenerr} and
+% \opt{numcloseerr} contain the left- and right-hand delimiters for
+% the error [defaults \opt{numopenerr=(} and \opt{numcloseerr=)}].
+%\begin{LaTeXexample}
+% \sisetup{seperr}\\
+% \num{1.234(5)}\\
+% \num{1.234(5)e6}
+%\end{LaTeXexample}
+%\DescribeOption{trapambigerr}
+%\DescribeOption{openerr}
+%\DescribeOption{closeerr}
+%\DescribeOption{tightpm}
+% If the number has an exponent, or if units are not repeated, then
+% the result can be considered ambiguous. By default, the package
+% adds the markers stored in \opt{openerr} and \opt{closeerr} to
+% remove the ambiguity; the options have the same default values as
+% the input error markers. Detection of a potentially-ambiguous
+% error is controlled by the \opt{trapambigerr} option, although for
+% numbers with units the \opt{repeatunits} option is also important.
+% The spacing around the $\pm$ sign is normally set by \TeX. However,
+% using the \opt{tightpm} option will cause this to be reduced to a
+% minimum.
+%\begin{LaTeXexample}
+% \sisetup{seperr}\\
+% \num[trapambigerr=false]{1.234(5)e6}\\
+% \SI{1.234(5)}{\metre}\\
+% \sisetup{repeatunits=false}
+% \SI{1.234(5)}{\metre}\\
+% \SI[trapambigerr=false]{1.234(5)}{\metre}\\
+% \num[tightpm]{1.234(5)}
+%\end{LaTeXexample}
+%
+%\DescribeOption{numprod}
+%\DescribeOption{repeatunits}
+% The number processor can recognise products in the numerical input;
+% the symbols used for products are stored in \opt{numprod}, with the
+% default value of ``\opt{x}''. By default, the \cs{SI} macro will
+% repeat the units for a number given in this way. This behaviour is
+% altered by the \opt{repeatunits} option, which takes the values
+% \defaultopt{true}, \opt{false} and \opt{power}. The later applies
+% only when providing multiplied numbers with units, and converts the
+% unit to the appropriate power rather than repeating the
+% units.\footnote{This is a very simply option: do not expect it to
+% work with anything except areas and volumes.} Notice that when
+% applied to errors, \opt{repeatunits} takes priority over
+% \opt{trapambigerr}.
+%\begin{LaTeXexample}
+% \num{1 x 2 x 3}\\
+% \SI{4 x 5 x 6}{\metre}\\
+% \sisetup{repeatunits=false}
+% \SI{1.2 x 3.4 x 5.6}{\milli\metre\cubed}\\
+% \SI[seperr]{1.234(5)}{\metre}\\
+% \SI[seperr,
+% trapambigerr=false]
+% {9.1093897(54)e-31}{\kilo\gram}\\
+% \SI[seperr,repeatunits,
+% trapambigerr=false]
+% {9.1093897(54)e-31}{\kilo\gram}\\
+% \SI[repeatunits=power]{1 x 2 x 3}{\metre}
+%\end{LaTeXexample}
+%
+%\DescribeOption{expproduct}
+%\DescribeOption{expbase}
+%\DescribeOption{allowzeroexp}
+% The formatting of exponents is controlled by \opt{expproduct} and
+% \opt{expbase}. \opt{expproduct} sets the symbol used to indicate a
+% product for exponents (\eg the $\times$ in \num{2e2}), while the
+% value of \opt{expbase} sets the power used (the \num{10} in the
+% example). Both options accept a very short list of options:
+% \defaultopt{times}, \opt{tighttimes}, \opt{cdot} and
+% \opt{tightcdot} for the product, and \defaultopt{ten} and \opt{two}
+% for the power.\footnote{The \opt{tighttimes} and \opt{tightcdot}
+% options give the rather questionable results:
+% \num[expproduct=tighttimes]{1e2} and
+% \num[expproduct=tightcdot]{1e2}, as opposed to \num{1e2} and
+% \num[expproduct=cdot]{1e2}.} Other choices are used literally. Also
+% relevant to exponent processing is the \opt{allowzeroexp} option.
+% By default, the package will suppress a zero exponent, but setting
+% the flag will allow the output of \num[allowzeroexp]{e0}.
+%
+%\DescribeOption{addsign}
+%\DescribeOption{sign}
+%\DescribeOption{retainplus}
+% Additions to the input can take the form of implicit signs and
+% padded zeros. The \opt{addsign} option takes a list of potential
+% sites to add a sign: \defaultopt{none}, \opt{mantissa},
+% \opt{exponent} and \opt{both}.\footnote{Aliases are provided:
+% \opt{mant} = \opt{mantissa}, \opt{exp} = \opt{exponent}, \opt{all}
+% = \opt{true} = \opt{both}, \opt{false} = \opt{none}.} If no sign
+% is given in the input, the setting here determines if one is added.
+% The sign to add is stored in \opt{sign}, which takes the list of
+% choices \defaultopt{plus}, \opt{minus}, \opt{pm} and \opt{mp}, or
+% uses the input literally (in maths mode). For positive numbers,
+% the \opt{retainplus} option causes a $+$ sign explicitly in the
+% input to be retained. By default, the package will remove such
+% signs.
+%
+%\DescribeOption{padnumber}
+% The \opt{padnumber} option controls the addition of zeros to the
+% input, to ``pad'' the result. The option takes a list of choices:
+% \defaultopt{leading}, \opt{trailing}, \opt{both} and
+% \opt{none}.\footnote{Aliases: \opt{all} = \opt{true} = \opt{both},
+% \opt{false} = \opt{none}.} No additional precision is added by
+% this option; integer input will not add a decimal point.
+%\begin{LaTeXexample}
+% \num[padnumber=leading]{.1}\\
+% \num[padnumber=leading]{2.}\\
+% \num[padnumber=trailing]{3.}\\
+% \num[padnumber=both]{4.}\\
+% \num[padnumber=both]{.5}\\
+% \num[padnumber=both]{6}\\
+% \num[padnumber=none]{7.}\\
+% \num[padnumber=none]{.8}
+%\end{LaTeXexample}
+%
+%\DescribeOption{fixdp}
+%\DescribeOption{dp}
+% In contrast to the \opt{padnumber} option, the package can alter
+% the precision of the input number if the \opt{fixdp} option is set.
+% The will fix the decimal places of the output to the number stored
+% in the \opt{dp} option. The later should be a positive integer.
+%\begin{LaTeXexample}
+% \sisetup{fixdp,dp=3}
+% \num{1}\\
+% \num{53.9}\\
+% \num{4.56783}\\
+% \num{-1.2942}\\
+% \num{-1.2949}\\
+% \num{9.9999}
+%\end{LaTeXexample}
+%
+%\subsection{Angle formatting}
+%\DescribeOption{padangle}
+%\DescribeOption{strictarc}
+% The angle formatter uses \cs{num} to format numbers: any options
+% for numbers are therefore applicable here. The \opt{padangle}
+% option takes choices \defaultopt{small}, \opt{large}, \opt{all} and
+% \opt{none}, and controls how angles are padded when given in
+% degrees, minutes and seconds.\footnote{Aliases: \opt{all} =
+% \opt{true} = \opt{both}, \opt{false} = \opt{none}.} When giving
+% angles as arcs (in degrees, minutes and seconds), the package can
+% detect if the correct number of semi-colons have been given. This
+% is controlled by the \opt{strictarc} option, which is a Boolean
+% switch with a \defaultopt{true} default. With \opt{strictarc} set
+% to \opt{false}, an incomplete arc is interpreted as degrees and
+% minute, while an over-complete one will drop excess input.
+%\begin{LaTeXexample}
+% \ang[padangle=none]{1;;}\\
+% \ang[padangle=large]{2;;}\\
+% \ang[padangle=small]{3;;}\\
+% \ang[padangle=both]{;4;}\\
+% \ang[padangle=none]{;5;5}\\
+% \ang[strictarc=false]{1;2}\\
+% \ang[strictarc=false]{1;2;3;4;}
+%\end{LaTeXexample}
+%
+%\DescribeOption{angformat}
+% The angle formatting system can convert between decimal angles and
+% those given as degrees, minutes and seconds. This is controlled by
+% the \opt{angformat} option, which takes choices
+% \defaultopt{unchanged}, \opt{decimal} and
+% \opt{arc}.\footnote{Aliases: \opt{decimal} = \opt{dec}, \opt{arc} =
+% \opt{dms}, \opt{unchanged} = \opt{none}.} When set to
+% \opt{unchanged}, nothing is done to the input. The conversion is
+% based on \TeX\ dimensions, and is therefore limited in accuracy.
+% For this reason, the output is automatically rounded: output as a
+% decimal angle is limited to three places, and that as an arc is
+% given to a single decimal place for the seconds component.
+%\begin{LaTeXexample}
+% $\ang{1;2;3} = \ang[angformat=dec]{1;2;3}$\\
+% $\ang{4.56} = \ang[angformat=arc]{4.56}$
+%\end{LaTeXexample}
+%
+%\DescribeOption{astroang}
+% For astronomers, the \opt{astroang} option is provided. This
+% moves the degrees, minutes or seconds symbol (as appropriate)
+% over the decimal marker rather than after the number.
+%\begin{LaTeXexample}
+% \ang{1;2;3.4}\\
+% \ang[astroang]{5;6;7.8}
+%\end{LaTeXexample}
+%
+%\subsection{Tabular material}
+%\DescribeOption{tabnumalign}
+% Material typeset in |S| columns is processed internally by the
+% \cs{num} macro. Thus, as with angles, the number options also
+% apply here. The positioning of tabular material is controlled by
+% the two options \opt{tabnumalign} and \opt{tabformat}.
+% \opt{tabnumalign} takes values \defaultopt{centredecimal},
+% \opt{centre}, \opt{left} and \opt{right}.\footnote{Aliases
+% \opt{centerdecimal} = \opt{centredecimal}; \opt{center} =
+% \opt{centre}.} When using \opt{centredecimal}, the package places
+% the decimal marker of the mantissa at the centre of the column,
+% which then grows to accommodate the widest number given. For equal
+% numbers of digits before and after the decimal sign, this is the
+% easiest option. The other choices use a fixed-width box to store
+% the number; the box is then aligned with the edges of the column.
+%
+%\DescribeOption{tabformat}
+% The \opt{tabformat} option sets the amount of space reserved by
+% \currpkg for the alignment box when not using the
+% \opt{centredecimal} setting of \opt{tabnumalign}. The numerical
+% parts of \opt{tabformat} are interpreted as
+% \texttt{\meta{pre}\meta{dec}\meta{post}}; \meta{pre} and
+% \meta{post} are the number of digits before and after the decimal
+% sign, respectively. Both signs and exponents can be included in
+% \opt{tabformat}, resulting in appropriate space being reserved. The
+% entire \opt{tabformat} input is processed using the \cs{num} macro
+% internally. Thus the decimal and exponent signs used in
+% \opt{tabformat} are checked against \opt{numdecimal} and
+% \opt{numexp}, respectively.
+%
+%\DescribeOption{tabalignexp}
+% When \opt{tabformat} contains exponents, two possibilities are
+% available for alignment. The first method is to place the exponent
+% parts so that the ``$\times 10$'' parts form a column, with
+% whitespace after shorter mantissa components. In the second
+% method, no additional space is added after the mantissa, and the
+% exponents do no line up (\ref{tab:alignexp}). This is controlled
+% by the \opt{tabexpalign} option, which can be set to
+% \defaultopt{true} or \opt{false}.
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \centering
+% \caption{The \opt{tabalignexp} option}
+% \label{tab:alignexp}
+% \sisetup{tabformat=1.3e2,tabnumalign=centre}
+% \begin{tabular}{SS[tabalignexp=false]}
+% \toprule
+% {Header} & {Header} \\
+% \midrule
+% 1.2e3 & 1.2e3 \\
+% 1.234e56 & 1.234e56 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+%
+%\DescribeOption{tabtextalign}
+%\DescribeOption{tabunitalign}
+%\DescribeOption{tabalign}
+% Cells containing no numbers are handled by \currpkg in a manner
+% similar to \cs{multicolumn}. The setting of \opt{tabtextalign} is
+% taken from the list \defaultopt{centre}, \opt{right} and
+% \opt{left}.\footnote{Alias \opt{centre} = \opt{center}.} As would
+% be expected, these settings centre, right- or left-align the cell
+% contents. In |s| columns, all content is treated as input to the
+% \cs{si} macro. The alignment of the contents relative to the cell
+% is controlled by the \opt{tabunitalign} option, which takes options
+% \defaultopt{left}, \opt{right} and \opt{centre}. The settings for
+% \opt{tabnumalign}, \opt{tabtextalign} and \opt{tabunitalign} can be
+% set to the same value in one go with the \opt{tabalign} option.
+%
+%\DescribeOption{tabautofit}
+% The contents of table cells can automatically be rounded or
+% zero-filled to the number of decimal places given in
+% \opt{tabformat}. The is activated by the \opt{tabautofit} Boolean
+% option. As \opt{tabformat} does not apply to columns with alignment
+% \opt{centredecimal}, \opt{tabautofit} is also inactive for these
+% columns (\ref{tab:autofit}).
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \centering
+% \caption{The \opt{tabautofit} option}
+% \label{tab:autofit}
+% \sisetup{tabformat=1.3,tabnumalign=centre}
+% % Notice the overfull hbox which results with
+% % the first column
+% \begin{tabular}{%
+% S%
+% S[tabautofit]%
+% S[tabautofit,tabnumalign=centredecimal]}
+% \toprule
+% {Header} & {Header} & {Header} \\
+% \midrule
+% 1.2 & 1.2 & 1.2 \\
+% 1.2345 & 1.2345 & 1.2345 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+%
+%\subsection{Units}
+%\DescribeOption{per}
+% Most of the unit options are concerned with the processing of named
+% units. The processor for units given as macro names can be
+% influenced to give a variety of output formats. The \opt{per}
+% option defines how the keyword macro \cs{per} is handled. This
+% option takes a choice from the list \defaultopt{reciprocal},
+% \opt{slash} and \opt{fraction}.\footnote{Aliases \opt{reciprocal} =
+% \opt{rp} = \opt{power}, \opt{fraction} = \opt{frac}.} The default
+% option uses \cs{per} to indicate reciprocal powers, whereas
+% \opt{slash} causes the package to use ``$/$'' to show division.
+%
+%\DescribeOption{fraction}
+%\DescribeOption{slash}
+% The \opt{fraction} option defines how \opt{per=fraction} is
+% interpreted. The list of applicable values here is
+% \defaultopt{frac}, \opt{nice}, \opt{ugly} and \opt{sfrac}. In each
+% case, the unit is typeset as a fraction, but the macro use to
+% achieve this varies. \opt{frac} uses the \TeX\ \cs{frac}, macro,
+% while \opt{nice} makes use of a \cs{nicefrac}-like method. The
+% \opt{ugly} option uses a slash in text mode and \cs{frac} in maths
+% mode.\footnote{Similar to the \pkg{ugly} option of the
+% \pkg{nicefrac} package.} Finally, the setting \opt{fraction=sfrac}
+% uses the \cs{sfrac} macro from the \pkg{xfrac} package, when
+% available.\footnote{\pkg{xfrac} is part of the experimental system
+% for \LaTeX3. As it requires a number of additional packages to
+% work, \currpkg does not load \pkg{xfrac}. If it is unavailable, the
+% \opt{sfrac} setting will fall back to using \cs{nicefrac}. See the
+% \pkg{xfrac} documentation for reasons to prefer \cs{sfrac} to
+% \cs{nicefrac}.} The \opt{slash} option sets the symbol used when
+% \opt{per=slash} is in force. This recognises the single keyword
+% \opt{slash}; anything else is used literally.
+%\begin{LaTeXexample}
+% \sisetup{per=fraction}
+% \si[fraction=frac]{\metre\per\second}\\
+% \si[fraction=nice]{\metre\per\second}\\
+% \si[fraction=sfrac]{\metre\per\second}\\
+% \si[per=slash]{\metre\per\second}
+%\end{LaTeXexample}
+%
+%\DescribeOption{stickyper}
+% By default, \cs{per} applies only to the next unit
+% given.\footnote{This is the standard method of reading units in
+% English: for example, \si{\joule\per\mole\per\kelvin} is pronounced
+% ``joules per mole per kelvin''.} By setting the \opt{stickyper}
+% flag, this behaviour is changed so that \cs{per} applies to all
+% subsequent units.\footnote{This is the behaviour in \SIunits.}
+%\begin{LaTeXexample}
+% \si{\kilogram\per\metre\ampere}\\
+% \si[stickyper]{\kilogram\per\metre\ampere}
+%\end{LaTeXexample}
+%
+%\DescribeOption{trapambigfrac}
+%\DescribeOption{openfrac}
+%\DescribeOption{closefrac}
+% When using \opt{per=slash}, multiple units in the denominator will
+% yield a potentially ambiguous result. The \opt{trapambigfrac}
+% determines whether the package checks for this: this takes
+% \defaultopt{true} and \opt{false}. When set, the contents of
+% \opt{openfrac} are inserted before the denominator, and
+% \opt{closefrac} is inserted after.
+%\begin{LaTeXexample}
+% \sisetup{trapambigfrac,openfrac=(,closefrac=),per=slash}\\
+% \si{\metre\per\second\per\kilogram}\\
+% \si[trapambigfrac=false]{\metre\per\second\per\kilogram}
+%\end{LaTeXexample}
+%
+%\DescribeOption{prefixsymbolic}
+%\DescribeOption{prefixbase}
+%\DescribeOption{prefixproduct}
+% The unit prefixes (\cs{kilo}, \etc) are normally given as letters.
+% However, the package can convert these into numerical
+% powers.\footnote{Provided things are not too complex!} This is
+% controlled by the \opt{prefixsymbolic} Boolean option, which by
+% default is \defaultopt{true}. If \opt{prefixsymboli} is set to
+% \opt{false}, the format of the prefix is controlled by
+% \opt{prefixbase} and \opt{prefixproduct}, which work in the same
+% way as \opt{expbase} and \opt{expproduct}.
+%
+%\DescribeOption{prespace}
+%\DescribeOption{xspace}
+%\DescribeOption{allowoptarg}
+% By default, the single unit macros (\eg \cs{metre}) add no space
+% either before or after the unit. Setting the \opt{xspace} flag to
+% true means that the single macros are followed by the \cs{xspace}
+% command (when used outside of \cs{SI}/\cs{si}). For users of
+% \unitsdef, the \opt{prespace} macro changes the behaviour of the
+% unit macros, so that they can immediately follow a number. As a
+% result, the unit macros will \emph{always} be preceded by a fixed
+% space when the \opt{prespace} flag is true: this will be in
+% addition to any other space. Also relevant to users moving from
+% \unitsdef is the \opt{allowoptarg} option. This allows single unit
+% macros to take an optional numerical argument, in the same way that
+% occurs in that package.
+%\begin{LaTeXexample}
+% \metre is the symbol for metres\\
+% \sisetup{xspace}
+% No, \metre is the correct symbol\\
+% \sisetup{prespace}
+% 30\metre\\
+% Do not use \metre in running text\\
+% \sisetup{allowoptarg}
+% \metre[40]
+%\end{LaTeXexample}
+%
+%\subsection{Symbols}
+% User access to control the symbols used for \si{\ohm}, \si{\micro},
+% \si{\degree}, \si{\arcmin}, \si{\arcsec}, \si{\angstrom} and
+% \si{\celsius} is provided here. These are all literal options,
+% which are available in text and maths mode variants. For example,
+% \opt{textmicro} is the code used for the \si{\micro} symbol in text
+% mode. The text mode macros should be safe when forced into text,
+% and the maths ones when forced into maths. The symbols defined in
+% this way are:
+%\newcommand*{\listsymbopt}[1]{\item \opt{#1}\SpecialOptionIndex{#1}}
+%\begin{itemize}
+% \listsymbopt{textOmega};
+% \listsymbopt{mathsOmega};
+% \listsymbopt{textmu};
+% \listsymbopt{mathsmu};
+% \listsymbopt{textdegree};
+% \listsymbopt{mathsdegree};
+% \listsymbopt{textminute};
+% \listsymbopt{mathsminute};
+% \listsymbopt{textsecond};
+% \listsymbopt{mathssecond};
+% \listsymbopt{textringA};
+% \listsymbopt{mathsringA};
+% \listsymbopt{textcelsius};
+% \listsymbopt{mathscelsius}.
+%\end{itemize}
+%
+%\DescribeOption{redefsymbols}
+% When \currpkg is loaded, it can check for the presence of the
+% \pkg{textcomp} and \pkg{upgreek} packages, to provide better
+% symbols for certain items. To prevent this, set the
+% \opt{redefsymbols} option \opt{false} (the default is
+% \defaultopt{true}).
+%
+%\DescribeOption{eVcorra}
+%\DescribeOption{eVcorrb}
+% The \si{\electronvolt} symbol requires some fine-tuning, and so has
+% two options of its own, both \TeX\ lengths. \opt{eVcorra} is the
+% correction applied to the gap between ``e'' and ``V'' of the unit:
+% the default is \defaultopt{0.3ex}. \opt{eVcorrb} is the correction
+% applied to the gap between ``V'' of the unit and whatever follows;
+% the default is \defaultopt{0ex}. The optimal value for these
+% options will depend on the current font settings.\footnote{This
+% document uses \opt{eVcorra=0.1ex}.}
+%\begin{LaTeXexample}
+% \si[per=slash]{\electronvolt\per\metre}\\
+% \si[per=slash,eVcorrb=0.7ex]{\electronvolt\per\metre}
+%\end{LaTeXexample}
+%
+%\subsection{Colour}
+%\DescribeOption{colourall}
+%\DescribeOption{colourunits}
+%\DescribeOption{colourvalues}
+%\SpecialOptionIndex{colorall}
+%\SpecialOptionIndex{colorunit}
+%\SpecialOptionIndex{colorvalue}
+% The package provides internal hooks for applying colour to part or
+% all of the output. This requires the user to load the \pkg{color}
+% or \pkg{xcolor} package to support colour in the output; \currpkg
+% will ignore a colour request if support is unavailable. The Boolean
+% options \opt{colourall}, \opt{colourunits} and \opt{colourvalues}
+% are used to turn application of a given colour on or off for all
+% output, only units and only values, respectively. All three
+% switches are available with US spelling, \eg \opt{colorall} and
+% \opt{colourall} behave in the same way. With colour turned off, no
+% \cs{color} command is issued internally, and output follows the
+% surrounding text.
+%
+%\DescribeOption{colour}
+%\DescribeOption{unitcolour}
+%\DescribeOption{valuecolour}
+%\SpecialOptionIndex{color}
+%\SpecialOptionIndex{unitcolor}
+%\SpecialOptionIndex{valuecolor}
+% The colour names to use for colouring output are set by the
+% \opt{colour}, \opt{unitcolour} and \opt{valuecolour} options (all
+% also available with US spelling). The \opt{colour} option
+% internally sets both \opt{unitcolour} and \opt{valuecolour}.
+%\begin{LaTeXexample}
+% {\color{brown} Text \num{50}}\\
+% \sisetup{colourall,colour=green}
+% \SI{10}{\metre}\\
+% {\color{purple} Text \num{70}}\\
+% \sisetup{colourunits=true,colourvalues=false}
+% \SI{40}{\second}
+%\end{LaTeXexample}
+%
+%\DescribeOption{colourneg}
+%\DescribeOption{negcolour}
+%\SpecialOptionIndex{colorneg}
+%\SpecialOptionIndex{negcolor}
+% \currpkg can automatically add a colour to negative numbers. This
+% is turned on using the \opt{colourneg} switch. The colour used is
+% set by the \opt{negcolour} option; both options are available using
+% US spellings.
+%
+%\subsection{International support}
+%\DescribeOption{locale}
+% \currpkg allows the user to switch between the typographic
+% conventions of different (geographical) areas by using
+% \latin{locales}. Currently, the package is supplied with
+% configurations for locales \opt{UK}, \opt{USA}, \opt{DE} (Germany)
+% and \opt{ZA} (South Africa). The \opt{locale} option is used to
+% switch to a particular locale.
+%\begin{LaTeXexample}
+% \SI{1.234}{\metre}\\
+% \SI[locale=DE]{6.789}{\metre}
+%\end{LaTeXexample}
+%
+%\DescribeOption{loctolang}
+% Locales are distinct from \pkg{babel} languages, as typographic
+% conventions are not tightly integrated with language. However, it
+% is useful to be able to associate a particular locale with a
+% \pkg{babel} language. The option \opt{loctolang} handles this, and
+% expects pairs of values:
+% \opt{loctolang=\meta{locale}:\meta{language}}.
+%\begin{LaTeXexample}
+% \sisetup{loctolang={UK:UKenglish,DE:german}}\\
+% \SI{6.022e23}{\per\mole}\\
+% \selectlanguage{german}\\
+% \SI{6.022e23}{\per\mole}
+%\end{LaTeXexample}
+%
+%\subsection{Package control}
+%\DescribeOption{load}
+%\DescribeOption{noload}
+%\DescribeOption{alsoload}
+% The package keeps most of the unit and abbreviations definitions in
+% files separate from \file{siunitx.sty}. To control what is loaded,
+% three complementary options are provided, all of which take a list
+% of one or more choices. \opt{load} and \opt{alsoload} define which
+% support configuration files are loaded. The list in \opt{load}
+% recognises the value \opt{default}, which is expanded to the normal
+% list before loading. The difference between \opt{load} and
+% \opt{alsoload} is that \opt{load} specifies the \emph{complete}
+% list of files to load, whereas \opt{alsoload} adds to the existing
+% list. To use the \opt{load} option successfully requires knowing
+% everything that is needed. The \opt{noload} option can be used to
+% delete one or more items from the \opt{load} list, without needing
+% to know what is on it.\footnote{\opt{noload} does not prevent the
+% loading of a file needed by one which is loaded. Thus the package
+% may internally override a \opt{noload} value if needed.}
+%
+%\DescribeOption{log}
+%\DescribeOption{debug}
+% To control data written to the \ext{log} file, the \opt{log} option
+% is provided. This takes a value from the list \defaultopt{normal},
+% \opt{none}, \opt{minimal}, \opt{errors} and \opt{debug}. As would
+% be expected, these indicate the amount of detail written to the log
+% file. As a shortcut to \opt{log=debug}, the package also recognises
+% the \opt{debug} option directly.
+%
+%\DescribeOption{strict}
+% Some users will want to stick closely to the official rules for
+% typesetting units. This could be made complicated if the options
+% for non-standards behaviour could not be turned off. The load-time
+% option \opt{strict} resets package behaviour to follow the rules
+% closely, and disables options which deviate from this. If the
+% package is loaded with the \opt{strict} option, all output is made
+% in maths mode using the upright serif font.
+%
+%\subsection{Back-compatibility options}
+%\DescribeOption{emulate}
+% The package can emulate \SIunits, \SIstyle, \unitsdef, \units,
+% \pkg{hepunits}, \pkg{fancyunits} and \pkg{fancynum}. Giving the
+% \opt{emulate=\meta{package}} option will give the desired
+% emulation, and combinations which would be possible with the real
+% packages will also work here. The package will recognise the
+% options of the emulated packages. This will automatically cause
+% emulation to be switched on.
+%
+%\subsection{Summary of all options}
+% \ref{tab:allopt} lists a summary of the package options (excluding
+% those for backward-compatibility). A reminder or the input format
+% is also provided.
+%\begin{longtable}{>{\ttfamily}lll}
+% \caption{All package options\label{tab:allopt}}\\
+% \toprule
+% Option & Type & Description \\
+% \midrule
+% \endfirsthead
+% \toprule
+% Option & Type & Description \\
+% \midrule
+% \endhead
+% \bottomrule
+% \multicolumn{3}{r}{\emph{Continued on next page}}
+% \endfoot
+% \bottomrule
+% \endlastfoot
+% addsign & List & Add sign to number \\
+% allowzeroexp & Boolean & Allow \num[allowzeroexp]{e0} \\
+% angformat & List & Conversion of angle format \\
+% anglesep & List or literal & Space between angle components \\
+% astroang & Boolean & Astronomy-style angles \\
+% closeerr & Literal & Closes potential-ambiguous error \\
+% closefrac & Literal & Closes potential-ambiguous fraction \\
+% color & Literal & Colour used for units and values \\
+% colour & Literal & Colour used for units and values \\
+% colorall & Boolean & Switch for colouring all output \\
+% colourall & Boolean & Switch for colouring all output \\
+% colorneg & Boolean & Colour negative numbers \\
+% colourneg & Boolean & Colour negative numbers \\
+% colorunits & Boolean & Switch for colouring units \\
+% colourunits & Boolean & Switch for colouring units \\
+% colorvalues & Boolean & Switch for colouring values \\
+% colourvalues & Boolean & Switch for colouring values \\
+% decimalsymbol & List or literal & Decimal symbol \\
+% debug & Boolean & Write debugging data to log \\
+% detectdisplay & Boolean & Treat display maths separately \\
+% digitsep & List & Separation of digits in large numbers \\
+% dp & Integer & Number of decimal places to \\
+% & & output numbers to \\
+% emulate & Modules & Emulation modules to load \\
+% errspace & List & Spacing of bracketed error \\
+% eVcorra & Length & Spacing correction in \eV \\
+% eVcorrb & Length & Spacing correction after \eV \\
+% expbase & List or Literal & Base used for exponents \\
+% expproduct & List or literal & Product sign for exponents \\
+% fixdp & Boolean & Switch for fixing decimal \\
+% & & places of numbers \\
+% fraction & List & Method used when setting \opt{per=frac} \\
+% inlinebold & List & Select how inline bold is tested \\
+% load & Modules & Modules to load \\
+% locale & Modules & Locale to follow \\
+% loctolang & Special & Associate locale with \pkg{babel}
+% language \\
+% log & List & Amount of data added to log \\
+% mathOmega & Literal & ``$\makeatletter\si@mathsOmega\makeatother$''
+% symbol in maths mode \\
+% mathcelsius & Literal & ``$\makeatletter\si@mathscelsius\makeatother$''
+% symbol in maths mode \\
+% mathdegree & Literal & ``$\makeatletter\si@mathsdegree\makeatother$''
+% symbol in maths mode \\
+% mathminute & Literal & ``$\makeatletter\si@mathsminute\makeatother$''
+% symbol in maths mode \\
+% mathmu & Literal & ``$\makeatletter\si@mathsmu\makeatother$''
+% symbol in maths mode \\
+% mathringA & Literal & ``$\makeatletter\si@mathsringA\makeatother$''
+% symbol in maths mode \\
+% mathrm & Csname & Roman maths font \\
+% mathsOmega & Literal & ``$\makeatletter\si@mathsOmega\makeatother$''
+% symbol in maths mode \\
+% mathscelsius & Literal & ``$\makeatletter\si@mathscelsius\makeatother$''
+% symbol in maths mode \\
+% mathsdegree & Literal & ``$\makeatletter\si@mathsdegree\makeatother$''
+% symbol in maths mode \\
+% mathsecond & Literal & ``$\makeatletter\si@mathssecond\makeatother$''
+% symbol in maths mode \\
+% mathsf & Csname & Sans serif maths font \\
+% mathsminute & Literal & ``$\makeatletter\si@mathsminute\makeatother$''
+% symbol in maths mode \\
+% mathsmu & Literal & ``$\makeatletter\si@mathsmu\makeatother$''
+% symbol in maths mode \\
+% mathsringA & Literal & ``$\makeatletter\si@mathsringA\makeatother$''
+% symbol in maths mode \\
+% mathsrm & Csname & Roman maths font \\
+% mathssecond & Literal & ``$\makeatletter\si@mathssecond\makeatother$''
+% symbol in maths mode \\
+% mathssf & Csname & Sans serif maths font \\
+% mathstt & Csname & Fixed-width maths font \\
+% mathtt & Csname & Fixed-width maths font \\
+% mode & List & Use text or maths mode for \\
+% & & typesetting \\
+% negcolor & Literal & Colour used for negative numbers \\
+% negcolour & Literal & Colour used for negative numbers \\
+% noload & Modules & Modules not to load \\
+% numaddn & Literal & Additional input allowed in numbers \\
+% numcloseerr & Literal & Character indicating end of \\
+% & & numerical error\\
+% numdecimal & Literal & Decimal symbols in numbers\\
+% numdigits & Literal & Digit characters in numbers \\
+% numexp & Literal & Exponent characters in numbers \\
+% numgobble & Literal & Characters to ignore in numbers \\
+% numopenerr & Literal & Character indicating start of \\
+% & & numerical error\\
+% numprod & Literal & Characters used for a product \\
+% numsign & Literal & Sign characters in numbers \\
+% obeyall & Boolean & Combination of \opt{obeybold}, \\
+% & & \opt{obeyitalic} and \opt{obeymode} \\
+% obeybold & Boolean & Check local bold setting \\
+% obeyitalic & Boolean & Check local italic setting \\
+% obeymode & Boolean & Check local mode (text/maths) \\
+% openerr & Literal & Opens potentially-ambiguous error \\
+% openfrac & Literal & Opens potentially-ambiguous fraction \\
+% padangle & List & Add zeros to blank parts of angles \\
+% padnumber & List & Add zeros to blank parts of numbers \\
+% per & List & Behaviour of \cs{per} \\
+% prefixbase & List or literal & Base used when making prefixes \\
+% & & numerical \\
+% prefixproduct & List or literal & Product sign for prefixes \\
+% prefixsymbolic & Boolean & Behaviour of unit prefixes\\
+% prespace & Boolean & Add space before units \\
+% redefsymbols & Boolean & Use better symbols if available \\
+% repeatunits & List & Repeat units with separated errors \\
+% & & and products \\
+% retainplus & Boolean & Retain explicit plus sign\\
+% seperr & Boolean & Separate number and error \\
+% sepfour & Boolean & Separate four-digit numbers \\
+% sign & List or literal & Sign to add to numbers \\
+% slash & List or literal & Symbol used for ``/'' \\
+% stickyper & Boolean & Require \cs{per} only once \\
+% strict & Boolean & Obey the rules strictly \\
+% strictarc & Boolean & Require exactly zero or \\
+% & & two semi-colons \\
+% tabalign & List & Positioning of all column data \\
+% tabalignexp & Boolean & Alignment of exponents in tables \\
+% tabautofit & Boolean & Switch for rounding numbers to \\
+% & & length given by \opt{tabformat} \\
+% tabformat & Number & Space reserved in table for numbers \\
+% tabnumalign & List & Alignment of |S| column numbers \\
+% tabtextalign & List & Positioning of text in |S| columns \\
+% tabunitalign & List & Positioning of units in |s| columns \\
+% textcelsius & Literal & ``$^{\circ}$C'' symbol in text mode \\
+% textdegree & Literal & ``${\circ}$'' symbol in text mode \\
+% textminute & Literal & ``$'$'' symbol in text mode \\
+% textmu & Literal & ``$\upmu$'' symbol in text mode \\
+% textomega & Literal & ``$\Omega$'' symbol in text mode \\
+% textringa & Literal & ``\AA'' symbol in maths mode \\
+% textrm & Csname & Roman text font \\
+% textsecond & Literal & ``$''$'' symbol in text mode \\
+% textsf & Csname & Sans serif text font \\
+% texttt & Csname & Fixed-width text font \\
+% tightpm & Boolean & Reduce space around $\pm$ \\
+% trapambigerr & Boolean & Check for ambiguous errors \\
+% trapambigfrac & Boolean & Check for ambiguous fractions \\
+% unitcolor & Literal & Switch for colouring units \\
+% unitcolour & Literal & Switch for colouring units \\
+% unitmathrm & Csname & Roman maths font for units \\
+% unitmathsf & Csname & Sans serif maths font for units \\
+% unitmathsrm & Csname & Roman maths font for units \\
+% unitmathssf & Csname & Sans serif maths font for units \\
+% unitmathstt & Csname & Fixed-width maths font for units \\
+% unitmathtt & Csname & Fixed-width maths font for units \\
+% unitmode & List & As \opt{mode}, for units only \\
+% unitsep & List or literal & Separator for units \\
+% unitspace & List or literal & Space used for ``|~|'' in units \\
+% valuecolor & Literal & Switch for colouring value \\
+% valuecolour & Literal & Switch for colouring value \\
+% valuemathrm & Csname & Roman maths font for values \\
+% valuemathsf & Csname & Sans serif maths font for values \\
+% valuemathsrm & Csname & Roman maths font for values \\
+% valuemathssf & Csname & Sans serif maths font for values \\
+% valuemathstt & Csname & Fixed-width maths font for values \\
+% valuemathtt & Csname & Fixed-width maths font for values \\
+% valuemode & List & As \opt{mode}, for values only \\
+% valuesep & List or literal & Separator between value and unit \\
+% xspace & Boolean & Use \pkg{xspace} after units \\
+%\end{longtable}
+%
+%\section{Emulation of other packages}
+% \currpkg has been designed as a replacement for \SIunits, \SIstyle,
+% \unitsdef, \units, \pkg{hepunits}, \pkg{fancyunits} and
+% \pkg{fancynum}. It therefore provides options reproduce the
+% functions of all of these packages. In this way, \currpkg should
+% be usable as a straight replacement for the older
+% packages.\footnote{User macros means that they are described in the
+% package documentation; simply not containing an \texttt{@} does not
+% mean they will have been emulated.} This means for example that
+% the \cs{num} macro takes an optional star when emulating \SIstyle.
+% However, there are some points that should be remembered. In
+% particular, \currpkg validates numerical input, meaning that places
+% where a number is expected in the older packages \emph{require} a
+% number when emulated by \currpkg.
+%
+% The \numprint package has provided many useful ideas for the code
+% used here for number formatting. The basic use of the \cs{numprint}
+% (or \cs{np}) macro can be reproduced using \currpkg. However,
+% \numprint is large and complex, with its own backward-compatibility
+% options. As a result, emulation of \numprint is not provided here.
+% To use an \numprint document with \currpkg, the \cs{numprint} macro
+% could be provided using the following code.
+%^^A Need to deal with \cs{numprint} being defined.
+%\let\numprint\relax
+%\begin{LaTeXexample}
+% \newcommand*{\numprint}[2][]{\SI[obeymode]{#2}{#1}}\\
+% \numprint{-123456} \\
+% \numprint[N/mm^2]{-123456}
+%\end{LaTeXexample}
+%^^A Back to the normal - with \cs{newcommand}
+%\newcommand*{\numprint}{\pkg{numprint}\xspace}
+%
+% \currpkg can be used more-or-less directly to replace both
+% \pkg{dcolumn} and \pkg{rccol}. As is explained in the code
+% section, much of the column-alignment system here is taken from
+% \pkg{dcolumn}, while \pkg{rccol} provided a model for a
+% customisable system. However, neither package has been directly
+% emulated here. The |S| column type can be used to replace both |D|
+% and |R| columns by setting the appropriate package options.
+%
+%\section{Configuration files}
+% \currpkg is a modular package. The unit definitions, abbreviations
+% and locales are all stored in configuration files. These all take
+% names of the form \file{si-\meta{name}.cfg}, where \meta{name} is
+% the part of the filename used as an option in \cs{sisetup} or when
+% loading \currpkg. Producing new configuration files therefore
+% consists of making a suitably-named file and adding it to the path
+% searched by \TeX. The files should normally consist of settings
+% (in \cs{sisetup}) and unit definitions, \etc.
+%
+%\DescribeMacro{\addtolocale}
+% To allow arbitrary macros to be stored in locales, the
+% \cs{addtolocale} macro is provided. This ensures that arbitrary
+% text is only executed when using a locale, not when loading it.
+%
+%\DescribeMacro{\requiresiconfigs}
+% To load one or more configuration files from inside another
+% configuration file, the \cs{requiresiconfigs} macro is provided.
+% This accepts a comma-separated list of configuration names, in the
+% same way as \opt{load} or \opt{noload}.
+%
+% In addition to the various configuration files provided with the
+% package, a local file \file{siunitx.cfg} may be provided. This is
+% read at the end of loading \currpkg, and allows the user to include
+% any local definitions or settings easily.
+%
+%\section{Common questions}
+%\subsection{Why do I need \cs{per} more than once?}
+% The unit engine of \currpkg is based around the English method for
+% reading units out loud. Thus \si{\joule\per\mole\per\kelvin} is
+% pronounced ``joules per mole per kelvin''. Hence by default you
+% need to put \cs{per} before each item in the denominator of a unit.
+% The behaviour can be altered by setting the \opt{stickyper} option.
+%
+%\subsection{Why is the order of my units changed?}
+% Then using \opt{per=reciprocal}, the units are typeset as given.
+% However, when using \opt{per=slash} or \opt{per=fraction}, the
+% package needs to find which ones are in the denominator. It then
+% prints the numerator and denominator separately. So if you give a
+% unit in the denominator \emph{before} one in the numerator, they
+% have to be re-ordered.\footnote{``Double division''
+% (\SI{1}{s/m/kg}) is mathematically incorrect.}
+%\begin{LaTeXexample}
+% \SI{88}{\per\kilogram\metre} \\
+% \SI[per=slash]{66}{\per\kilogram\metre}
+%\end{LaTeXexample}
+%
+%\subsection{Why are compound units not recommended outside of
+% \cs{SI}/\cs{si}?}
+% To fully process units made up of several parts, the processor has
+% to know where the end of the unit is. When the unit macros are
+% used outside of \cs{SI}/\cs{si}, this is not the case. The package
+% therefore does its best, but results may be sub-optimal. To get
+% consistent results, either define a new \emph{single} unit, or keep
+% compound units inside \cs{SI} and \cs{si}.
+%\begin{LaTeXexample}
+% \metre\per\micro\second \\
+% \si{\metre\per\micro\second} \\
+% \newunit{\myunit}{\metre\per\micro\second}
+% \myunit
+% \newunit{\myunittwo}{\kilogram\myunit} \\
+% \myunittwo \\
+% \kilogram\myunit
+%\end{LaTeXexample}
+% Notice the difference in behaviour of \cs{per} in the first two
+% lines, and the spacing error on the last line in the example.
+%
+%\subsection{How do I set superscripts to use lining numbers?}
+% Lowercase (``old style'') numbers are favoured by many people for
+% use in running text. However, this does not necessarily look good
+% in superscripts. The mode used to typeset data can be varied, so
+% that maths mode numbers are used for the unit part of the output.
+%\begin{LaTeXexample}
+% \SI[mode=text]{1234}{\metre\per\second}\\
+% \SI[valuemode=text,unitmode=maths]{1234}{\metre\per\second}
+%\end{LaTeXexample}
+%
+%\subsection{Why do most of the examples use
+% \texorpdfstring{\si{\joule\per\mole\per\kelvin}}{J mol-1 K-1}?}
+% The package author is a chemist, and this is the unit of entropy
+% (disorder). It nicely demonstrates the use of the \cs{per} macro,
+% and so it crops up a lot. It is also in the subsection heading
+% here to act as a test with \pkg{hyperref} and moving arguments!
+%
+%\subsection{What can \numprint do that \currpkg cannot?}
+% \currpkg uses a lot of ideas from \numprint: a reasonable amount of
+% the number-processing code here is based on that in \numprint.
+% However, the two packages have somewhat different aims, and as a
+% result there are things that \numprint can do that \currpkg does
+% not implement. The main features of \numprint not available here
+% are:
+%\begin{itemize}
+% \item General support for numbers with base other than $10$ (see
+% \pkg{nbaseprt});
+% \item Alignment of the decimal marker of powers in tables;
+% \item Alignment of numbers in running text;
+% \item Specific formatting commands for \TeX\ counters and lengths.
+%\end{itemize}
+%
+%\section{Tricks and known issues}
+%
+%\subsection{Ensuring maths mode}
+% Due to the possibility of output in either maths or text mode, any
+% input which requires a particular mode needs to be protected. You
+% cannot use |$|\ldots|$|, as this can get ``caught out'', but also
+% as it may give hard-to-follow errors. Always use \cs{ensuremath}
+% to force maths processing, and \cs{text} (from the \AMS\TeX\
+% bundle) to ensure text mode.
+%
+%\subsection{Limitations of \cs{mathrm}}
+% The package uses the \cs{mathrm} font family by default to typeset
+% output in maths mode. This however has a few side-effects. For
+% example, the Greek alphabet can give odd results.\footnote{This
+% depends on your font setup; this document uses T1 encoding, which
+% shows the issue, whereas using OT1 does not.} The use of the
+% \cs{mathnormal} font \emph{may} get around this issue.
+%\begin{LaTeXexample}
+% \num[numaddn=\pi]{4\pi e-7}\\
+% \num[numaddn=\pi,mathsrm=mathnormal]{4\pi e-7}
+%\end{LaTeXexample}
+% On the other hand, you may want to use text mode, in which case
+% \cs{ensuremath} is needed. Depending on the exact circumstances,
+% the \LaTeX\ protection mechanism (\cs{DeclareRobustCommand}) may be
+% sufficient; in some cases, this will fail and the \eTeX\
+% \cs{protected} system may be required. There are several potential
+% pitfalls in this area; experimentation may well be needed.
+%\begin{LaTeXexample}
+% \DeclareRobustCommand*{\numpi}{\ensuremath{\pi}}
+% \num[numaddn=\numpi,mode=text]{4\numpi e-7}
+%\end{LaTeXexample}
+%
+%\subsection{Entire document in sans serif font}
+% If your entire document is not in a Roman font, using
+% the font detection system is not the most efficient method
+% for setting the \currpkg output. Instead, the \opt{mathrm}
+% and \opt{textrm} package options can be redefined.
+%\begin{LaTeXexample}
+% \sffamily
+% Some text \\
+% \sisetup{obeyfamily=false,mathrm=mathsf,textrm=sffamily}
+% \num{1e2} \\
+% \SI{3}{\newton}
+% \[ \num{4e5} \si{\pascal} \]
+%\end{LaTeXexample}
+%
+%\subsection{Effects of emulation}
+% The package has been designed so that almost everything can be set
+% using the options. In the emulation code, some internal macros are
+% redefined. This is because the legacy packages do odd things,
+% which are deliberately not implemented by \currpkg. Using an
+% emulation file will prevent subsequent loading of the real package.
+% This is to prevent errors or, worse, difficult to diagnose changes
+% to output.
+%
+%\subsection{Centring columns on non-decimal input}
+% The \pkg{dcolumn} manual suggests using that package to align a
+% column on a $\pm$ sign. The same type of output is possible using
+% \currpkg, but some care is needed (\ref{tab:dcolumn}). Odd things
+% may happen: use with care!
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \caption{Non-standard \texttt{S} column}
+% \label{tab:dcolumn}
+% \centering
+% \begin{tabular}{%
+% S[digitsep=none,decimalsymbol={\,\pm\,},
+% numdigits={0123456789.},numdecimal=+]}
+% \toprule
+% {Some Values} \\
+% \midrule
+% 2.3456 + 0.02 \\
+% 34.2345 + 0.001 \\
+% 56.7835 + 0.067 \\
+% 90.473 + 0.021 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+%
+%\subsection{Adding items after the last column of a tabular}
+% If you use an |S| or |s| column as the last one in a tabular, and
+% you use the \pkg{array} ``|<|'' construction to add items after it,
+% the spacing may be wrong. This will occur if the column contents
+% are of differing widths. Changing the \LaTeX\ |\\| line ending for
+% the plain \TeX\ \cs{cr} will give the correct spacing, but does not
+% allow adjustment of inter-row distance (\ref{tab:cr}).\footnote{For
+% the \TeX\ experts, the issue here is that the system to gather up
+% cell contents is added in using the \texttt{<} construction.
+% Normally, this comes after the cell contents and any other
+% \texttt{<} arguments, so collects the user additions. However, in
+% the last cell the contents include \texttt{\bslash\bslash}, which
+% is converted to \cs{cr} before gathering can occur. By using
+% \cs{cr} directly, the gathering process receives all of the cell
+% contents as normal.} In most cases, this should not be a serious
+% issue.
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \caption{Correcting spacing in last \texttt{S} column}
+% \label{tab:cr}
+% \hfil
+% \begin{tabular}{S<{\,\si{\kg}}S<{\,\si{\kg}}}
+% \toprule
+% \multicolumn{1}{c}{Long header} &
+% \multicolumn{1}{c}{Long header} \\
+% \midrule
+% 1.23 & 1.23 \\
+% 4.56 & 4.56 \\
+% 7.8 & 7.8 \\
+% \bottomrule
+% \end{tabular}
+% \hfil
+% \begin{tabular}{S<{\,\si{\kg}}S<{\,\si{\kg}}}
+% \toprule
+% \multicolumn{1}{c}{Long header} &
+% \multicolumn{1}{c}{Long header} \\
+% \midrule
+% 1.23 & 1.23 \cr
+% 4.56 & 4.56 \cr
+% 7.8 & 7.8 \cr
+% \bottomrule
+% \end{tabular}
+% \hfil
+% \end{table}
+%\end{LaTeXexample}
+%
+%\iffalse
+%<*bug>
+%\fi
+%\section{Reporting a problem}
+% \currpkg is quite long and complicated, and works hard to cover all
+% possible eventualities. However, there will be bugs in the code
+% and unexpected interactions with other packages. If you think you
+% have found a bug, please report it. A short test-case
+% demonstrating the problem would be very welcome. The following is
+% a suitable template, and is available as \file{si-bug.ltx} in the
+% \texttt{doc/latex/siunitx} directory or by running the \ext{dtx} or
+% \ext{ins} file through \TeX.
+% \begin{macrocode}
+\listfiles
+\documentclass{article}
+% \end{macrocode}
+% Load other packages needed here.
+% \begin{macrocode}
+\usepackage{siunitx}
+% \end{macrocode}
+% Normally, debugging the load procedure will not be needed; the
+% debug option here means that all run-time information is logged.
+% \begin{macrocode}
+\sisetup{debug}
+\begin{document}
+This is the bug test-case document for the \textsf{siunitx}
+package.\\
+Please put your demonstration here, and e-mail to the package
+author.
+\begin{center}
+ \texttt{joseph.wright@morningtar2.co.uk}
+\end{center}
+\end{document}
+% \end{macrocode}
+%\iffalse
+%</bug>
+%\fi
+%
+%\section{Feature requests}
+% Feature requests for \currpkg are welcome. The package maintainer
+% will consider any ideas within the remit of the package (units and
+% values). If suggesting a new feature, an example of how it should
+% work would be appreciated. If new controls are needed, some
+% suggestions for option names would be welcome.
+%
+%\section{Acknowledgements}
+% Many thanks indeed to Stefan Pinnow, who has made a very large
+% number of suggestions and found numerous bugs in the package. His
+% contribution to the package has been vital. The package author has
+% learned \LaTeX\ tricks from far too many people to thank all of
+% them. However, for this package specific thanks must go to the
+% authors of the existing ``unit'' packages: Danie Els (\SIstyle),
+% Marcel Heldoorn (\SIunits), Patrick Happel (\unitsdef), Axel
+% Reichert (\units) and Harald Harders (\numprint). Will Robertson
+% and Heiko Oberdiek deserve much credit for demonstrating \LaTeX\
+% coding best practice. Victor Eijkhout's excellent (and free)
+% \emph{\TeX\ by Topic} has provided some useful coding hints
+% \cite{Eijkhout}. The idea for combining and extending unit
+% provision in \LaTeX\ was heavily inspired by Philip Lehmann's
+% \pkg{biblatex}. Thanks to the various contributors of ideas for the
+% package: Donald Arseneau, Michele Dondi, Paul Gans, Ben Morrow, Lan
+% Thuy Pham, Alan Ristow, Patrick Heinze, Andrea Blomenhofer, Morten
+% H{\o}gholm, Burkhard Moddemann and Patrick Steegstra.
+%
+%\clearpage
+%\part{Correct application of (SI) units}
+%\section{Background}
+% Consistent and logical units are a necessity for scientific work,
+% and have applicability everywhere. Historically, a number of
+% systems have been used for physical units. SI units were
+% introduced by the \latin{Conf\'erence G\'en\'erale des Poids et
+% Mesures} (CGPM) in 1960. SI units are a coherent system based on
+% seven base units, from which all other units may be derived.
+%
+% At the same time, physical quantities with units are mathematical
+% entities, and as such way that they are typeset is important. In
+% mathematics, changes of type (such as using bold, italic, sans
+% serif typeface and so on) convey information. This means that
+% rules exist not only for the type of units to be used under the SI
+% system, but also the way they should appear in print. Advice on
+% best practice has been made available by the \emph{National
+% Institute of Standards and Technology} (NIST) \cite{NIST}.
+%
+% As befits an agreed international standard, the full rules are
+% detailed. It is not appropriate to reproduce these in totality
+% here; instead, a useful summary of the key points is provided. The
+% full details are available from the \latin{Bureau International des
+% Poids et Mesures} (BIPM) in French \cite{BIPM:FR} and English
+% \cite{BIPM:EN}. They also publish a very useful and detailed guide
+% to using units, values and so on, available online in a number of
+% different formats \cite{BIPM:PDF}.
+%
+% \currpkg takes account of the information given here, so far as is
+% possible. Thus the package defaults follow the recommendations
+% made for typesetting units and values. Spacing and so forth is
+% handled in such a way as to make implementing the rules
+% (relatively) easy.
+%
+%\section{Units}
+%\subsection{SI base units}
+% There are seven base SI units, listed in \ref{tab:baseunits}. Apart
+% from the kilogram, these are defined in terms of a measurable
+% physical quantity needing the definition alone.\footnote{Some base
+% units need others defined first; there is therefore a required
+% order of definition.} The base units have been chosen such that
+% all physical quantities can be expressed using an appropriative
+% combination of these units, needing no others and with no
+% redundancy. The kilogram is slightly different from the other base
+% units as it is still defined in terms of a ``prototype'' held in
+% Paris.\footnote{At the time of writing, this is under review and
+% will be altered.}
+%
+%\subsection{SI derived units}
+% All other units within the SI system are regarded as ``derived''
+% from the seven base units. At the most basic, all other SI units
+% can be expressed as combinations of the base units. However, many
+% units (listed in \ref{tab:derived}, \ref{tab:experimental} and
+% \ref{tab:accepted}) have a special name and symbol.\footnote{The
+% nautical mile has a given name but no agreed symbol, and although
+% accepted by the SI is not provided by \currpkg as a unit macro.}
+% Most of these units are simple combinations of one or more base
+% units (raised to powers as appropriate). A small number of units
+% derived from experimental data are allowed as SI units
+% (\ref{tab:experimental}).
+%
+% Some of these units (in \ref{tab:accepted}) are regarded as only
+% ``temporarily'' accepted, as the use of only the base and
+% fully-consistent derived units in \ref{tab:derived} is encouraged.
+% They are accepted as they are in common use in one or more
+% disciplines; some are still very widespread in the appropriate
+% areas. These units are mainly multiples of base units (for
+% example, a tonne is \SI{1000}{\kilo\gram}).
+%
+% One point to note is that ``unitless ratios'' are regarded as
+% having base units which cancel out. For example, the radian is
+% regarded as having base unit \si{\metre\per\metre}. The result of
+% this division (``$1$'') is therefore regarded as a derived SI unit
+% in this context.
+%
+%\subsection{SI prefixes}
+% A series of SI prefixes for decimal multiples and submultiples are
+% provided, and can be used as modifiers for any SI unit (either base
+% or derived units) with the exception of the kilogram. The prefixes
+% are listed in \ref{tab:prefix}. No space should be used between a
+% prefix and the unit, and only a single prefix should be used. Even
+% the degree Celsius can be given a prefix, for example
+% \SI{1}{\milli\celsius}. The only exception to this rule is for
+% degrees, minutes and seconds of an arc: \ang{1;2;3}.
+%
+% It is important to note that the kilogram is the only SI unit with
+% a prefix as part of its name and symbol. Only single prefix may
+% be used, and so in the case of the kilogram prefix names are used
+% with the unit name ``gram'' and the prefix symbols are used with
+% the unit symbol \si{\gram}. For example $\SI{1e-6}{\kilogram} =
+% \SI{1}{\milli\gram}$.
+%
+%\subsection{Other units}
+% The application of SI units is meant to provide a single set of
+% units which ensure consistency and clarity across all areas.
+% However, other units are common is many areas, and are not without
+% merit. The units provided by \currpkg by default do not included
+% any of these; only units which are part of the SI set or are
+% accepted for use with SI units are defined. However, several other
+% sets of units can be loaded as optional modules. The binary
+% prefixes and units (Section~\ref{sec:binary} and \ref{tab:binary})
+% are the most obvious example. These are \emph{not} part of the SI
+% specifications, but the prefix names are derived from those in
+% \ref{tab:prefix}.
+%
+% Other units (such as those provided by the modules \opt{synchem},
+% \opt{hep} and \opt{astro}) are normally to be avoided where
+% possible. SI units should, in the main, be preferred due to the
+% advantages of clear definition and self-consistency this brings.
+% However, there will probably always be a place for specialist or
+% non-standard units. This is particulary true of units derived from
+% basic physical constants; for example reason, the \opt{hep} module
+% defines the speed of light, \si{\clight}, as a unit. For work in
+% basic science, a small number of physical constants are recognised
+% as units provided the results for comparison with experiment are
+% given in SI units.
+%
+% There are also many areas where non-standard units are used so
+% commonly that to do otherwise is difficult or impossible. For
+% example, most synthetic chemists measure the pressure inside vacuum
+% apparatus in \si{\mmHg}, partly because the most common gauge for
+% the task still uses a column of mercury metal. For these reasons,
+% \currpkg does define non-SI units.
+%
+%\section{Units and values in print}
+%\subsection{Mathematical meaning}
+% As explained earlier, a unit--value combination is a single
+% mathematical entity. This has implications for how both the number
+% and the unit should be printed. Firstly, the two parts should not
+% be separated. With the exception of the symbols for plane angles
+% (\si{\degree}, \si{\arcmin} and \si{\arcsec}), it is usual to have
+% a space between the unit and the value. This should therefore be a
+% non-breaking space between the two. Different geographical areas
+% have different conventions on the size of this space; a ``small''
+% space (|\,|) is the \currpkg default.
+%\begin{LaTeXexample}
+% A space for \SI{10}{\percent}\\
+% and also for \SI{100}{\celsius}\\
+% but not for \ang{1.23}.
+%\end{LaTeXexample}
+%
+% The mathematical meaning of units also means that the shape, weight
+% and family are important. Units are supposed to be typeset in an
+% upright, medium weight serif font. Italic, bold and sans serif are
+% all used mathematically to convey other meanings. \currpkg package
+% defaults again follow this convention: any local settings are
+% ignored, and uses the current upright serif maths font. However,
+% there are occasions where this may not be the most desirable
+% behaviour. A classic example would be in an all-bold section
+% heading. As the surrounding text is bold, some people feel that
+% any units should follow this.
+%\begin{LaTeXexample}
+% Units should \textbf{not be bold: \SI{54}{\farad}}\\
+% \textbf{But perhaps in a running block,\\
+% it might look better: \SI[obeybold]{54}{\farad}}
+%\end{LaTeXexample}
+%
+%\subsection{Unit multiplication and division}
+% Symbols for units formed from other units by multiplication are
+% indicated by means of either a half-height (that is, centred) dot
+% or a (thin) space. This document uses a half-height dot as
+% (\emph{i}) this is the recommendation of \textsc{nist}, amongst
+% others and (\emph{ii}) it avoids potential confusion between unit
+% prefixes and multiplied units.
+%\begin{LaTeXexample}
+% $\si{\metre\second} = \mbox{metre second}$ \\
+% $\si{\milli\second} = \mbox{millisecond}$ \\
+% \sisetup{unitsep=thin}
+% $\si{\metre\second} = \mbox{metre second}$ \\
+% $\si{\milli\second} = \mbox{millisecond}$
+%\end{LaTeXexample}
+% There are some circumstances under which it is permissable to omit
+% any spaces. The classic example is \si{\kWh}, where
+% ``\si[unitsep=thin]{\kWh}'' does not add any useful information.
+% If using such a unit repeatedly, users of \currpkg are advised to
+% create a custom unit to ensure consistency.\footnote{\cs{kWh} and
+% \cs{kilowatthour} are defined by \currpkg in this way.}
+%
+% Symbols for units formed from other units by division are indicated
+% by means of a virgule (oblique stroke, slash, |/|), a horizontal
+% line, or negative exponents.\footnote{Notice that a virgule and a
+% solidus are not the same symbol.} However, to avoid ambiguity, the
+% virgule must not be repeated on the same line unless parentheses
+% are used. This is ensured when using named unit macros in \currpkg,
+% which will ``trap'' repeated division and format it correctly. In
+% complicated cases, negative exponents are to be preferred over
+% other formats.
+%\begin{LaTeXexample}
+% \si{\joule\per\mole\per\kelvin}\\
+% \si[per=fraction]{\joule\per\mole\per\kelvin}\\
+% \si[per=slash]{\joule\per\mole\per\kelvin}
+%\end{LaTeXexample}
+%
+%\subsection{Repeating units}
+% Products and errors should show what unit applies to each value
+% given. Thus \SI{2x3}{\metre} is an ordered set of lengths of a
+% geometric area, whereas \SI[repeatunits=false]{2x3}{\metre} is a
+% length (and equal to \SI{6}{\metre}). Thus, $\times$ is not a
+% product but is a mathematical operator; in the same way, a $2
+% \times 3$ matrix is not a $6$ matrix! In some areas, areas and
+% volumes are given with separated units but a unit raised to the
+% appropriate power: \SI[repeatunits=power]{2 x 3}{\metre}. Although
+% this does display the correct overall units, it is
+% potentially-confusing and is not encouraged.
+%
+%\subsection{Clarity in writing values of quantities}
+% Care must be taken when writing ranges of numbers. For purely
+% numerical values, it is common to use a en-dash between values, for
+% example ``see pages 1--5''. On the other hand, values with units
+% could be misinterpret as negative values if written in this way. As
+% the unit--value combination is a single mathematic entity, writing
+% the values with an en-dash followed by a single unit is also
+% incorrect. As a result, using the word ``to'' is strongly
+% recommended.
+%\begin{LaTeXexample}
+% \SI{1}{\metre} to \SI{5}{\metre} long.
+%\end{LaTeXexample}
+%
+%\subsection{Graphs and tables}
+% In tables and graphs, repetition of the units following each entry
+% or axis mark is confusing and repetitive. It is therefore best to
+% place the unit in the label part of the information. Placing the
+% unit in square brackets is common but mathematically
+% poor.\footnote{For example, for an acceleration $a$, the expression
+% $[a]$ is the dimensions of $a$, \ie length per time squared in this
+% case.} Much better is to show division of all values by the unit,
+% which leaves the entries as unitless ratios. This is illustrated
+% in \ref{tab:label} and \ref{fig:label}.
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \centering
+% \caption{An example of table labelling}
+% \label{tab:label}
+% \begin{tabular}{cS[tabformat=1.4,tabnumalign=centre]}
+% \toprule
+% {Entry} & {Length/\si{\metre}} \\
+% \midrule
+% 1 & 1.1234 \\
+% 2 & 1.1425 \\
+% 3 & 1.7578 \\
+% 4 & 1.9560 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+%\begin{LaTeXexample}[float]
+% \begin{figure}
+% \centering
+% \begin{tikzpicture}
+% \begin{axis}[xlabel=$t/\si{\second}$,ylabel=$d/\si{\metre}$]
+% \addplot[smooth,mark=x]
+% plot coordinates {
+% (0,0)
+% (1,5)
+% (2,8)
+% (3,9)
+% (4,8)
+% (5,5)
+% (6,0)
+% };
+% \end{axis}
+% \end{tikzpicture}
+% \caption{An example of graph labelling}
+% \label{fig:label}
+% \end{figure}
+%\end{LaTeXexample}
+%
+% In most cases, adding exponent values in the body of a table is
+% less desirable than adding a fixed exponent to column headers. An
+% example is shown in \ref{tab:exp}. The use of \cs{multicolumn} is
+% needed here due to the ``|<|''; without \cs{multicolumn}, the
+% titles are followed by ``\si{\kilo\gram}''!
+%\begin{LaTeXexample}[float]
+% \begin{table}
+% \centering
+% \caption{Good and bad columns}
+% \label{tab:exp}
+% \sisetup{tabnumalign=centre}
+% \begin{tabular}{%
+% c%
+% S[tabformat=1.3e1]<{\,\si{\kilogram}}%
+% S[tabformat=2.2]}
+% \toprule
+% Entry & \multicolumn{1}{c}{Mass} &
+% {Mass/\SI{e3}{\kilogram}} \\
+% \midrule
+% 1 & 4.56e3 & 4.56 \\
+% 2 & 2.40e3 & 2.40 \\
+% 3 & 1.345e4 & 13.45 \\
+% 4 & 4.5e2 & 0.45 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXexample}
+%
+%\bibliographystyle{unsrt}
+%\StopEventually{%
+% \clearpage
+% \part{Notes}
+% \PrintChanges
+% \PrintIndex
+% \bibliography{siunitx}}
+%
+% \iffalse
+%<*package>
+% \fi
+%
+%\clearpage
+%\part{Implementation}
+%\section{Main package}
+% Much of the code here is taken, with little or no modification,
+% from the existing packages. These are all released under the LPPL,
+% and so this use is entirely allowed. Rather than confuse the
+% source here with repeated references, note that code here could be
+% copied from \SIstyle, \SIunits, \numprint, \unitsdef or \units.
+% Some ideas have also been borrowed from \pkg{biblatex}; again these
+% will not be specifically noted. Code from other packages will be
+% marked when used.
+%
+% User-space commands (those not containing |@|) defined here should
+% give the same result as macros with the same name in the older
+% packages.\footnote{Although extra optional arguments may be added.}
+% However, internal package macros will behave differently; if the
+% user has redefined internal macros, then compatibility will be
+% impaired.
+%
+% The code used here uses \LaTeX\ rather than \TeX\ commands where
+% possible.\footnote{This applies to \LaTeX\ kernel commands only;
+% for example, \pkg{ifthenelse} is not used.} For example,
+% \cs{newcommand*} is used in place of \cs{def}, unless custom
+% parameters are needed. Hopefully, this will aid future
+% maintenance. Grouping is used where possible to limit the scope of
+% temporary assignments.
+%
+%\subsection{Setup code}
+%\begin{macro}{\si@svn@version}
+%\begin{macro}{\si@svn@id}
+%\begin{macro}{\si@svn@ver}
+% As always, the package starts with identification. This defines a
+% couple of macros for use with \emph{Subversion}, so that everything
+% is nice and clear. This should also make it a bit easier to avoid
+% messing up the revision data! For anyone reading the source, the
+% revision number is also available as well as the release version
+% number, of course.
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\newcommand*{\si@svn@ver}{v1.0}
+\def\si@svn@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${%
+ \newcommand*{\si@svn@version}{%
+ #5/#6/#7\space\si@svn@ver\space}}
+\si@svn@id $Id: siunitx.dtx 76 2008-06-15 08:10:34Z joseph $
+\ProvidesPackage{siunitx}
+ [\si@svn@version A comprehensive (SI) units package]
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The package requires \eTeX, so the usual test is made.
+% \begin{macrocode}
+\begingroup
+ \@ifundefined{eTeXversion}
+ {\PackageError{siunitx}
+ {Not running under e-TeX}
+ {This package requires e-TeX. Try compiling the document
+ with\MessageBreak `elatex' instead of `latex'. When
+ using pdfTeX, try `pdfelatex'\MessageBreak instead of
+ `pdflatex'}%
+ \endgroup\endinput}
+ {\endgroup}
+% \end{macrocode}
+%\begin{macro}{\si@catcodes}
+% There are circumstances under which some odd category codes might
+% be in place. The category codes for |{|, |}|, |[|, |]| and |#| are
+% assumed to be okay; if issues arise, this can be altered. \LaTeX\
+% will have set |@| as a letter on loading \currpkg.
+% \begin{macrocode}
+\edef\si@catcodes{%
+ \catcode\string`\string ` \the\catcode\string`\`\relax
+ \catcode\string`\string = \the\catcode\string`\=\relax
+ \catcode\string`\string ^ \the\catcode\string`\^\relax
+ \catcode\string`\string ~ \the\catcode\string`\~\relax
+ \catcode\string`\string : \the\catcode\string`\:\relax
+ \catcode\string`\string - \the\catcode\string`\-\relax
+ \catcode\string`\string + \the\catcode\string`\+\relax
+ \catcode\string`\string ; \the\catcode\string`\;\relax
+ \catcode\string`\string , \the\catcode\string`\,\relax
+ \catcode\string`\string . \the\catcode\string`\.\relax}
+\catcode\string`\` 12\relax
+\catcode`\= 12\relax
+\catcode`\^ 7\relax
+\catcode`\~ \active\relax
+\@makeother{\:}
+\@makeother{\-}
+\@makeother{\+}
+\@makeother{\;}
+\@makeother{\,}
+\@makeother{\.}
+% \end{macrocode}
+%\end{macro}
+% Packages needed for functionality are loaded. \pkg{xkeyval}
+% handles the package options, while \pkg{amstext} from the \AMS\
+% bundle is needed for \cs{text}. \pkg{array} is needed for the new
+% column type for tabular material. \pkg{xspace} provides ``magic''
+% spacing after macros, if requested.
+% \begin{macrocode}
+\RequirePackage{xkeyval}[2005/05/07]
+\RequirePackage{amstext,array,xspace}
+% \end{macrocode}
+%\begin{macro}{\si@tempa}
+%\begin{macro}{\si@tempb}
+%\begin{macro}{\si@tempc}
+% Some scratch commands are defined; apart from where a known value
+% is carried through, these could contain anything.
+% \begin{macrocode}
+\newcommand*{\si@tempa}{}
+\newcommand*{\si@tempb}{}
+\newcommand*{\si@tempc}{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@switch}
+% Various items will need a switch. To avoid name pollution, a
+% single switch is defined here; grouping will keep the definition
+% local.
+% \begin{macrocode}
+\newif\ifsi@switch
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tempboxa}
+%\begin{macro}{\si@tempboxb}
+%\begin{macro}{\si@tempboxc}
+%\begin{macro}{\si@tempboxd}
+% Some boxes are also needed.
+% \begin{macrocode}
+\newbox\si@tempboxa
+\newbox\si@tempboxb
+\newbox\si@tempboxc
+\newbox\si@tempboxd
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@packagecheck}
+%\begin{macro}{\si@blockpkgs}
+%\begin{macro}{\si@checkpkgs}
+% As \currpkg is intended to replace the other unit-management
+% packages, these are tested for before any further processing. If
+% any are loaded, the package halts compilation; name clashes or
+% unexpected results could occur if this is not tested. Notice that
+% \SIunits and \SIstyle could be loaded with variable capitalisation
+% (at least on Windows); both possibilities are tested.
+% \begin{macrocode}
+\newcommand*{\si@blockpkgs}{SIunits,sistyle,siunits,SIstyle,%
+ unitsdef,fancyunits}
+\newcommand*{\si@checkpkgs}{units,hepunits,fancynum}
+\newcommand*{\si@packagecheck}{%
+ \begingroup
+ \@for\si@tempa:=\si@blockpkgs\do{
+ \@ifpackageloaded{\si@tempa}
+ {\PackageError{siunitx}
+ {Package `\si@tempa' incompatible}
+ {The \si@tempa\space package and siunitx are
+ incompatible.\MessageBreak Use the
+ `emulate=\si@tempa' package option when loading
+ siunitx}}
+ {}}
+% \end{macrocode}
+% Some packages should not cause a clash, but are emulated and would
+% be better handled that way.
+% \begin{macrocode}
+ \@for\si@tempa:=\si@checkpkgs\do{%
+ \@ifpackageloaded{\si@tempa}
+ {\PackageWarning{siunitx}
+ {Consider loading the siunitx package
+ with\MessageBreak option `emulate=\si@tempa', rather
+ than\MessageBreak loading both \si@tempa\space and
+ siunitx}}
+ {}}
+ \endgroup}
+% \end{macrocode}
+% The check is carried out on loading and at the beginning of the
+% document, so that packages loaded both before and after \currpkg
+% are caught.
+% \begin{macrocode}
+\si@packagecheck
+\AtBeginDocument{\si@packagecheck}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ifdefinable}
+% Using \cs{@ifdefinable} to check macro definitions gives a generic
+% error. To give something more helpful, \cs{@ifundefined} is used,
+% but this needs some \cs{expandafter} work. This way it can also be
+% used as a form of \cs{@ifundefined} for macro names.\\
+%\cs{si@ifdefinable}\marg{macro}
+% \begin{macrocode}
+\newcommand*{\si@ifdefinable}[1]{%
+ \expandafter\expandafter\expandafter\@ifundefined%
+ \expandafter\expandafter\expandafter%
+ {\expandafter\@gobble\string#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@addtolist}
+% It is quite useful to be able to add to a comma-separated list
+% of expandable items.\\
+%\cs{si@addtolist}\marg{macro}\marg{items}
+% \begin{macrocode}
+\newcommand*{\si@addtolist}[2]{%
+ \ifx\@empty#1\@empty
+ \edef#1{#2}%
+ \else
+ \edef#1{#1,#2}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@addtocsname}
+%\begin{macro}{\si@temptoks}
+% A second item to add to a command sequence.\\
+%\cs{si@addtocsname}\marg{csname}\marg{tokens}
+% \begin{macrocode}
+\newtoks{\si@temptoks}
+\newcommand*{\si@addtocsname}[2]{%
+ \@ifundefined{#1}
+ {\expandafter\gdef\csname #1\endcsname{#2}}
+ {\si@temptoks\expandafter\expandafter\expandafter{%
+ \csname #1\endcsname#2}%
+ \expandafter\xdef\csname #1\endcsname{\the\si@temptoks}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ifmtarg}
+%\begin{macro}{\si@xifmtarg}
+%\begin{macro}{\si@ifnotmtarg}
+% To keep down dependance on other packages, the very short code
+% block from \pkg{ifmtarg} is copied here with an internal name.
+% \begin{macrocode}
+\begingroup
+ \catcode`\Q=3
+ \long\gdef\si@ifmtarg#1{%
+ \si@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}
+ \long\gdef\si@xifmtarg#1#2Q#3#4#5\@nil{#4}
+ \long\gdef\si@ifnotmtarg#1{%
+ \si@xifmtarg#1QQ\@firstofone\@gobble\@nil}
+\endgroup
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@newrobustcmd}
+%\begin{macro}{\si@newcommand}
+%\begin{macro}{\si@newcmd}
+%\begin{macro}{\si@xargdef}
+% Some more copying, this time from \pkg{etoolbox}. Various macros
+% need to be \emph{really} robust. This is achieved using the \eTeX\
+% \cs{protected} primitive in various places. However, it would be
+% nice to have a \cs{protected} version of \cs{newcommand}.
+% \pkg{etoolbox} has code for that, but to avoid needing to load it,
+% the necessary stuff is copied here. The only changes form the
+% original are names, and the use of \cs{newcommand*} for the
+% \cs{si@newcommand} macro.\\
+%\cs{si@newcommand}\marg{macro}\\
+%\cs{si@newcmd}\marg{macro}\oarg{num-args}\\
+%\cs{si@xargdef}\marg{macro}\oarg{num-args}\oarg{default}\marg{def}
+% \begin{macrocode}
+\@ifpackageloaded{etoolbox}
+ {\let\si@newrobustcmd\newrobustcmd}
+ {\protected\def\si@newrobustcmd{%
+ \@ifstar
+ {\let\l@ngrel@x\protected\si@newcommand}
+ {\def\l@ngrel@x{\protected\long}\si@newcommand}}
+ \newcommand*{\si@newcommand}[1]{\@testopt{\si@newcmd#1}0}
+ \def\si@newcmd#1[#2]{%
+ \@ifnextchar[%]
+ {\si@xargdef#1[#2]}
+ {\@argdef#1[#2]}}
+ \long\def\si@xargdef#1[#2][#3]#4{%
+ \@ifdefinable#1{%
+ \expandafter\protected
+ \expandafter\def
+ \expandafter#1%
+ \expandafter{%
+ \expandafter\@testopt
+ \csname\string#1\endcsname{#3}}%
+ \expandafter\@yargdef
+ \csname\string#1\endcsname\tw@{#2}{#4}}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\subsection{Logging}
+%\begin{macro}{\ifsi@debug}
+%\begin{macro}{\ifsi@logmin}
+%\begin{macro}{\ifsi@lognone}
+% To control logging, some new switches are declared.
+% \begin{macrocode}
+\newif\ifsi@debug
+\newif\ifsi@logmin
+\newif\ifsi@lognone
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@log@err}
+%\begin{macro}{\si@log@warn}
+%\begin{macro}{\si@log@inf}
+% Some handy re-usable macros are defined here. These all take names
+% beginning These pop up in various places. First errors, warnings
+% and information are handled. Package options are used to control
+% how much output is given.\\
+%\cs{si@log@err}\marg{error}\marg{explanation}\\
+%\cs{si@log@warn}\marg{warning}\\
+%\cs{si@log@inf}\marg{information}
+% \begin{macrocode}
+\newcommand*{\si@log@err}[2]{%
+ \ifsi@lognone\else
+ \ifsi@logmin
+ \PackageWarning{siunitx}{#1}%
+ \else
+ \PackageError{siunitx}{#1}{#2}%
+ \fi
+ \fi}
+\newcommand*{\si@log@warn}[1]{%
+ \ifsi@lognone\else
+ \ifsi@logmin\else
+ \PackageWarning{siunitx}{#1}%
+ \fi
+ \fi}
+\newcommand*{\si@log@inf}[1]{%
+ \ifsi@lognone\else
+ \ifsi@logmin\else
+ \PackageInfo{siunitx}{#1}%
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@log@debug}
+% The debug macro only gives output if the appropriate package option
+% is set.\\
+%\cs{si@log@debug}\marg{debug-information}
+% \begin{macrocode}
+\newcommand*{\si@log@debug}[1]{%
+ \ifsi@lognone\else
+ \ifsi@debug
+ \PackageInfo{siunitx}{#1}%
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\subsection{String comparison}
+%\begin{macro}{\si@str@ifchrstr}
+%\begin{macro}{\si@str@chrstr}
+% At various points, the package needs to compare two strings, to
+% find if one occurs in the other. The first test is if a single
+% character is part of a second string; this is used, for example, to
+% check that a character is valid as input. The first argument is
+% not expanded further, but the second is two allow division into
+% individual units.\\
+%\cs{si@str@ifchrstr}\marg{char}\marg{chars}\\
+%\cs{si@str@chrstr}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@str@ifchrstr}[2]{%
+ \begingroup
+ \si@switchfalse
+ \renewcommand*{\si@tempa}{#1}%
+ \protected@edef\si@tempb{#2}%
+ \expandafter\si@str@chrstr\si@tempb\@empty\@empty\@empty
+ \ifsi@switch
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@str@chrstr#1#2\@empty{%
+ \renewcommand*{\si@tempc}{#1}%
+ \ifx\si@tempa\si@tempc
+ \expandafter\si@switchtrue
+ \else
+ \ifx\@empty#2\@empty\else
+ \si@str@chrstr#2\@empty\@empty
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@str@ifonlychrs}
+%\begin{macro}{\si@str@onlychrs}
+% The second test builds on the first. Here, a check is made to see
+% if the first string is made up only of characters from the second
+% string. In this case, the first string is expanded before
+% testing. The second string will be expanded by the internal
+% character by character test.\\
+%\cs{si@str@ifonlychars}\marg{string}\marg{valid-chars}\\
+%\cs{si@str@onlychars}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@str@ifonlychrs}[2]{%
+ \begingroup
+ \si@switchtrue
+ \protected@edef\si@tempa{#1}%
+ \renewcommand*{\si@tempb}{#2}%
+ \expandafter\si@str@onlychrs\si@tempa\@empty\@empty\@empty
+ \ifsi@switch
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@str@onlychrs#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@tempb}
+ {}{\si@switchfalse}%
+ \ifx\@empty#2\@empty\else
+ \si@str@onlychrs#2\@empty\@empty
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+%\subsection{Option handling}
+%\begin{macro}{\sisetup}
+% To allow modification of options at run time, a setup macro is
+% provided.
+% \begin{macrocode}
+\newcommand*{\sisetup}{\setkeys[si]{key}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@opt@key}
+% To aid maintenance, some shortcuts are defined for generating keys.
+% These also allow the debugging messages to be added automatically
+% to every key. First of all the basic key definition.\\
+%\cs{si@opt@key}\marg{keyname}\marg{code}
+% \begin{macrocode}
+\newcommand*{\si@opt@key}[2]{%
+ \define@key[si]{key}{#1}
+ {#2\si@log@debug{Option #1 set to ##1}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@opt@cmdkey}
+%\begin{macro}{\si@opt@cmdkeys}
+% The command versions of the above.\\
+%\cs{si@opt@cmdkey}\oarg{default}\marg{keyname}\marg{function}\\
+%\cs{si@opt@cmdkeys}\oarg{default}\marg{keynames}
+% \begin{macrocode}
+\newcommand*{\si@opt@cmdkey}[3][]{%
+ \define@cmdkey[si]{key}[si@]{#2}[#1]{#3}}
+\newcommand*{\si@opt@cmdkeys}[2][]{%
+ \define@cmdkeys[si]{key}[si@]{#2}[#1]}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@opt@boolkey}
+% Keys which only take switch values; anything other than \opt{true}
+% or \opt{false} will generate a warning from \pkg{xkeyval}.\\
+%\cs{si@opt@boolkey}\oarg{optional-processing}\marg{keyname}
+% \begin{macrocode}
+\newcommand*{\si@opt@boolkey}[2][]{%
+ \define@boolkey[si]{key}[si@]{#2}[true]
+ {#1\si@log@debug{Option #2 set to ##1}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@opt@choicekey}
+% A ``fill in the blanks'' choice key. In all cases, \cs{si@tempa}
+% is used to hold the value given to the key, so that \cs{ifx}
+% testing can occur.\\
+%\cs{si@opt@choicekey}\oarg{default}\marg{keyname}\marg{choices}^^A
+%\marg{in-list}
+% \begin{macrocode}
+\newcommand*{\si@opt@choicekey}[4][]{%
+ \define@choicekey*+[si]{key}{#2}[\si@tempa]{#3}[#1]
+ {#4\si@log@debug{Option #2 set to ##1}}
+ {\si@log@warn{Unknown value `##1' for option #2}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@opt@xchoicekey}
+% Several of the package options can take either a choice from a list
+% of known options, or a value to be interpreted literally. To aid
+% maintenance, the necessary code can be set up here. These keys all
+% define a new macro, which must exist. The \cs{si@opt@xchoicekey}
+% macro therefore ensures that this is defined, as well as setting up
+% the \pkg{xkeyval} key.\\
+%\cs{si@opt@xchoicekey}\marg{keyname}\marg{choices}\marg{initial}
+% \begin{macrocode}
+\newcommand*{\si@opt@xchoicekey}[3]{%
+ \define@choicekey*+[si]{key}{#1}[\si@tempa]{#2}[#1]
+% \end{macrocode}
+% This code will execute if the option is on the list. There will be
+% a ``fixed'' macro with a matching name, which is used for this.
+% \begin{macrocode}
+ {\si@log@debug{Option #1 set to ##1}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@#1\endcsname}{\@nameuse{si@fix@##1}}}
+% \end{macrocode}
+% The user has given something that is not on the list as an
+% argument. It is used literally.
+% \begin{macrocode}
+ {\si@log@debug{Option #1 set to ##1}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@#1\endcsname}{##1}}
+% \end{macrocode}
+% Finally, the initial value of the macro is set up.
+% \begin{macrocode}
+ \expandafter\newcommand\expandafter*\expandafter{%
+ \csname si@#1\endcsname}%
+ {\@nameuse{si@fix@#3}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@opt@compatkey}
+% An all-in-one definition for a back-compatibility key. These
+% should only be used at load time, so are automatically disabled
+% once the package is loaded. Emulation is also automatically turned
+% on.\\
+%\cs{si@opt@compatkey}\marg{package}\marg{keyname}.
+% \begin{macrocode}
+\newcommand*{\si@opt@compatkey}[2]{%
+ \define@boolkey[si]{key}[si@old@]{#2}[true]
+ {\si@log@debug{Emulating #1 package option\MessageBreak #2}%
+ \sisetup{emulate=#1}%
+ \si@log@debug{Option #2 set to ##1}}
+ \AtEndOfPackage{\si@opt@disablekey{#2}
+ {Compatibility option #2 only\MessageBreak
+ available when loading siunitx package}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@opt@disablekey}
+% The ability to disable a key with a meaningful message is a must;
+% the warning will come from \currpkg, and not from \pkg{xkeyval}\\
+%\cs{si@opt@disablekey}\marg{keyname}\marg{warning}
+% \begin{macrocode}
+\newcommand*{\si@opt@disablekey}[2]{%
+ \key@ifundefined[si]{key}{#1}
+ {}
+ {\si@log@debug{Disabling key #1}%
+ \si@opt@key{#1}{\si@log@warn{#2}}}}
+% \end{macrocode}
+%\end{macro}
+%
+% The \pkg{xkeyval} package option for logging is declared. This is
+% then processed to set the switches correctly.
+% \begin{macrocode}
+\si@opt@choicekey[normal]{log}{debug,verbose,normal,errors,none}
+% \end{macrocode}
+% A series of comparisons are made to assign the logging mode. The
+% \opt{normal} option is not tested, as executing the option sets the
+% switches appropriately.
+% \begin{macrocode}
+ {\si@debugfalse
+ \si@logminfalse
+ \si@lognonefalse
+ \renewcommand*{\si@tempb}{none}%
+ \ifx\si@tempa\si@tempb
+ \si@lognonetrue
+ \fi
+ \renewcommand*{\si@tempb}{minimal}%
+ \ifx\si@tempa\si@tempb
+ \si@logmintrue
+ \fi
+ \renewcommand*{\si@tempb}{debug}%
+ \ifx\si@tempa\si@tempb
+ \si@debugtrue
+ \fi
+ \renewcommand*{\si@tempb}{verbose}%
+ \ifx\si@tempa\si@tempb
+ \si@debugtrue
+ \fi}
+% \end{macrocode}
+% A quick method to set \opt{log=debug}.
+% \begin{macrocode}
+\si@opt@boolkey{debug}
+% \end{macrocode}
+%\begin{macro}{\ifsi@strict}
+% It would be useful to be able to disable some keys, when strict
+% interpretation of the rules is desired. This is a load-time
+% option, and has to disable various options.
+% \begin{macrocode}
+\si@opt@boolkey[%
+ \ifsi@strict
+ \sisetup{
+ obeymode=false,
+ obeybold=false,
+ obeyitalic=false,
+ mode=maths,
+ repeatunits=true,
+ trapambigerr=true,
+ trapambigfrac=true}
+ \@for\si@tempa:=obeyall,obeymode,obeyitalic,mode,unitmode,%
+ valuemode,textmode,obeybold,repeatunits,trapambigerr,%
+ trapambigfrac\do{%
+ \begingroup
+ \edef\si@tempb{\endgroup
+ \noexpand\si@opt@disablekey{\si@tempa}
+ {Option `\si@tempa' forbidden in strict mode}}%
+ \si@tempb}
+ \fi]{strict}
+\AtEndOfPackage{
+ \si@opt@disablekey{strict}
+ {Option `strict' only available when\MessageBreak
+ loading package}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@emulate}
+% The \opt{emulate} option is used for back-compatibility mode; the
+% option is only valid when loading \currpkg.
+% \begin{macrocode}
+\newcommand*{\si@emulate}{}
+\si@opt@key{emulate}{\si@addtolist{\si@emulate}{#1}}
+\AtEndOfPackage{
+ \si@opt@disablekey{emulate}
+ {Option `emulate' only available when\MessageBreak
+ loading package}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unitsep}
+%\begin{macro}{\si@unitspace}
+%\begin{macro}{\si@errspace}
+%\begin{macro}{\si@valuesep}
+% The two \opt{\dots sep} options control the size of spaces between
+% the number and the unit (\cs{si@valuesep}), and that used to
+% represent a product (\cs{si@unitsep}). Known values here are
+% \opt{thin}, \opt{med}, \opt{medium}, \opt{thick}, \opt{cdot},
+% \opt{tightcdot}\footnote{Both \cs{cdot}-based options only valid
+% for \opt{unitsep}.} and \opt{none};\footnote{Only valid for
+% \opt{valuesep}.} other entries will be treated as custom spaces.
+% \begin{macrocode}
+\si@opt@xchoicekey{unitsep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{thin}
+\si@opt@xchoicekey{unitspace}{space,thin,med,medium,thick,
+ none}{thin}
+\si@opt@xchoicekey{errspace}{space,thin,med,medium,thick,
+ none}{none}
+\si@opt@xchoicekey{valuesep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{thin}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@digitsep}
+% Separation of digits in large numbers is controlled by the
+% \opt{digitsep} option. As with the other \opt{sep} values, this
+% one has a choice of possible values. The list is quite long, so
+% that a range of options are handled automatically. Notice that
+% \opt{digitsep=none} will be used for no separation at all.
+% \begin{macrocode}
+\si@opt@xchoicekey{digitsep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{thin}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@decimalsymbol}
+% The symbol used for the decimal position is varied here. There are
+% only two real options, but options are given for the name of a full
+% stop.
+% \begin{macrocode}
+\si@opt@xchoicekey{decimalsymbol}{comma,stop,fullstop,period,
+ cdot,tightcdot}{fullstop}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@anglesep}
+% The separator between degrees and minutes, and between minutes and
+% seconds, when using \cs{ang}.
+% \begin{macrocode}
+\si@opt@xchoicekey{anglesep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{none}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@obeymode}
+% The first test for the font control is whether to respect the
+% surrounding maths or text mode.
+% \begin{macrocode}
+\si@opt@boolkey{obeymode}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@numtextmode}
+%\begin{macro}{\ifsi@unittextmode}
+% The output of the package can be typeset using either text or maths
+% mode fonts. Two switches are needed, for numbers and units.
+% \begin{macrocode}
+\newif\ifsi@numtextmode
+\newif\ifsi@unittextmode
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% The \opt{textmode} option has to set both flags.
+% \begin{macrocode}
+\si@opt@choicekey[true]{textmode}{true,false}
+ {\si@numtextmodefalse
+ \si@unittextmodefalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@numtextmodetrue
+ \si@unittextmodetrue
+ \fi}
+% \end{macrocode}
+% The \opt{mode} option applies to numbers and units.
+% \begin{macrocode}
+\si@opt@choicekey{mode}{math,maths,text}
+ {\si@numtextmodefalse
+ \si@unittextmodefalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@numtextmodetrue
+ \si@unittextmodetrue
+ \fi}
+% \end{macrocode}
+% Now the two options for numbers or units alone.
+% \begin{macrocode}
+\si@opt@choicekey{valuemode}{math,maths,text}
+ {\si@numtextmodefalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@numtextmodetrue
+ \fi}
+\si@opt@choicekey{unitmode}{math,maths,text}
+ {\si@unittextmodefalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@unittextmodetrue
+ \fi}
+% \end{macrocode}
+%\begin{macro}{\ifsi@obeyfamily}
+% The package can work to match the font family (serif, sans serif,
+% typewriter) of the surrounding text. This is controlled by a
+% Boolean option.
+% \begin{macrocode}
+\si@opt@boolkey{obeyfamily}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@obeybold}
+% The package can attempt to respect bold, or may ignore it.
+% \begin{macrocode}
+\si@opt@boolkey{obeybold}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@inlinebtext}
+% For inline maths, two options for checking what is bold are
+% available, the maths environment (\ie \cs{boldmath}) and the
+% surrounding text (\cs{textbf} or \cs{bffamily}).
+% \begin{macrocode}
+\newif\ifsi@inlinebtext
+\si@opt@choicekey{inlinebold}{text,maths,math}
+ {\si@inlinebtextfalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@inlinebtexttrue
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@obeyitalic}
+% Italic is slightly different to bold, as there is no convenient
+% switch for maths. Thus a choice key is used, with the appropriate
+% check.
+% \begin{macrocode}
+\si@opt@boolkey{obeyitalic}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@detectdisplay}
+% For handling display mathematics, a setting is needed for whether to
+% treat it differently from other maths.
+% \begin{macrocode}
+\si@opt@boolkey{detectdisplay}
+% \end{macrocode}
+%\end{macro}
+% The option to obey all font switching commands is Boolean-like but
+% needs alternative setup.
+% \begin{macrocode}
+\si@opt@choicekey[true]{obeyall}{true,false}
+ {\si@obeyboldfalse
+ \si@obeyitalicfalse
+ \si@obeymodefalse
+ \si@obeyfamilyfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@obeyboldtrue
+ \si@obeyitalictrue
+ \si@obeymodetrue
+ \si@obeyfamilytrue
+ \fi}
+% \end{macrocode}
+%\begin{macro}{\si@valuemathsrm}
+%\begin{macro}{\si@valuemathssf}
+%\begin{macro}{\si@valuemathstt}
+%\begin{macro}{\si@unitmathsrm}
+%\begin{macro}{\si@unitmathssf}
+%\begin{macro}{\si@unitmathstt}
+% The fonts used by the package default to the obvious \LaTeX\ ones;
+% however, this needs to be exposed to user modification. First the
+% maths mode fonts are sorted out.
+% \begin{macrocode}
+\si@opt@cmdkeys{valuemathsrm,valuemathssf,valuemathstt}
+\si@opt@cmdkeys{unitmathsrm,unitmathssf,unitmathstt}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% To make life easier for the user, US spellings are provided for the
+% maths keys.
+% \begin{macrocode}
+\si@opt@key{valuemathrm}{\sisetup{valuemathsrm=#1}}
+\si@opt@key{valuemathsf}{\sisetup{valuemathssf=#1}}
+\si@opt@key{valuemathtt}{\sisetup{valuemathstt=#1}}
+\si@opt@key{unitmathrm}{\sisetup{unitmathsrm=#1}}
+\si@opt@key{unitmathsf}{\sisetup{unitmathssf=#1}}
+\si@opt@key{unitmathtt}{\sisetup{unitmathstt=#1}}
+% \end{macrocode}
+% The combined options are given, for setting numbers and units
+% at the same time.
+% \begin{macrocode}
+\si@opt@key{mathsrm}{\sisetup{valuemathsrm=#1,unitmathsrm=#1}}
+\si@opt@key{mathssf}{\sisetup{valuemathssf=#1,unitmathssf=#1}}
+\si@opt@key{mathstt}{\sisetup{valuemathstt=#1,unitmathstt=#1}}
+\si@opt@key{mathrm}{\sisetup{valuemathsrm=#1,unitmathsrm=#1}}
+\si@opt@key{mathsf}{\sisetup{valuemathssf=#1,unitmathssf=#1}}
+\si@opt@key{mathtt}{\sisetup{valuemathstt=#1,unitmathstt=#1}}
+% \end{macrocode}
+%\begin{macro}{\si@valuetextrm}
+%\begin{macro}{\si@valuetextsf}
+%\begin{macro}{\si@valuetexttt}
+%\begin{macro}{\si@unittextrm}
+%\begin{macro}{\si@unittextsf}
+%\begin{macro}{\si@unittexttt}
+% The same thing for text mode fonts. Once again the default values
+% are pretty obvious.
+% \begin{macrocode}
+\si@opt@cmdkeys{valuetextrm,valuetextsf,valuetexttt}
+\si@opt@cmdkeys{unittextrm,unittextsf,unittexttt}
+\si@opt@key{textrm}{\sisetup{unittextrm=#1,valuetextrm=#1}}
+\si@opt@key{textsf}{\sisetup{unittextsf=#1,valuetextsf=#1}}
+\si@opt@key{texttt}{\sisetup{unittexttt=#1,valuetexttt=#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@numdigits}
+%\begin{macro}{\si@numdecimal}
+%\begin{macro}{\si@numexp}
+%\begin{macro}{\si@numprod}
+%\begin{macro}{\si@numgobble}
+%\begin{macro}{\si@numsign}
+%\begin{macro}{\si@numcloseerr}
+%\begin{macro}{\si@numopenerr}
+%\begin{macro}{\si@numaddn}
+% The list of possible valid characters for parsing numbers is set
+% up. This is similar to \numprint, but with the \opt{extra} class,
+% and with characters ignored with no output renamed as \opt{gobble}.
+% \begin{macrocode}
+\si@opt@cmdkeys{numdigits,numdecimal,numexp,numgobble,numsign,%
+ numcloseerr,numopenerr,numaddn,numprod}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@numvalid}
+%\begin{macro}{\si@numextra}
+% The various valid characters are collected together in a single
+% macro for later. In common with the above macros, this one starts
+% \cs{si@num\ldots}. The order here is the order the values are
+% tested later on.
+% \begin{macrocode}
+\newcommand*{\si@numextra}{%
+ \si@numopenerr\si@numcloseerr\si@numaddn}
+\newcommand*{\si@numvalid}{\si@numgobble\si@numexp\si@numsign
+ \si@numdecimal\si@numdigits\si@numextra\si@numprod}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@seperr}
+%\begin{macro}{\ifsi@trapambigerr}
+%\begin{macro}{\si@openerr}
+%\begin{macro}{\si@closeerr}
+% An option to control whether numerical error values are printed with
+% or separate from the number.
+% \begin{macrocode}
+\si@opt@boolkey{seperr}
+\si@opt@boolkey{trapambigerr}
+\si@opt@cmdkeys{openerr,closeerr}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@sepfour}
+% With four digits in a number, separating may or may not be desired.
+% Note that this option is the same as one for \numprint.
+% \begin{macrocode}
+\si@opt@boolkey{sepfour}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@retainplus}
+% An option to keep an explicit positive sign.
+% \begin{macrocode}
+\si@opt@boolkey{retainplus}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@expbase}
+%\begin{macro}{\si@expproduct}
+% The options for exponents are set up.
+% \begin{macrocode}
+\si@opt@xchoicekey{expproduct}{times,tighttimes,
+ cdot,tightcdot}{times}
+\si@opt@xchoicekey{expbase}{ten}{ten}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@allowzeroexp}
+% The package normally prevents \num[allowzeroexp]{e0}.
+% \begin{macrocode}
+\si@opt@boolkey{allowzeroexp}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@prefixproduct}
+% The marker for multiplication in prefixes.
+% \begin{macrocode}
+\si@opt@xchoicekey{prefixproduct}{times,tighttimes,cdot,
+ tightcdot,none}{times}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@prefixbase}
+% In the same area, the power for prefixes is variable. Here, two
+% choices ar needed.
+% \begin{macrocode}
+\si@opt@xchoicekey{prefixbase}{ten,two}{ten}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@prefixsymbolic}
+% Unit prefixes can be given as either symbols or numerically.
+% \begin{macrocode}
+\si@opt@boolkey{prefixsymbolic}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@num@padlead}
+%\begin{macro}{\ifsi@num@padtrail}
+% A setting is needed to indicate when to add zeros to decimal
+% numbers, either before the decimal marker (|.1| giving
+% ``\num[padnumber=all]{.1}'') or after (|1.| giving
+% ``\num[padnumber=all]{1.}'').
+% \begin{macrocode}
+\newif\ifsi@num@padlead
+\newif\ifsi@num@padtrail
+\si@opt@choicekey[all]{padnumber}
+ {leading,lead,trailing,trail,all,both,true,none,false}
+ {\si@num@padleadfalse
+ \si@num@padtrailfalse
+ \renewcommand*{\si@tempb}{leading}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \fi
+ \renewcommand*{\si@tempb}{lead}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \fi
+ \renewcommand*{\si@tempb}{trailing}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{trail}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{all}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{both}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \si@num@padtrailtrue
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@sign}
+%\begin{macro}{\ifsi@num@signmant}
+%\begin{macro}{\ifsi@num@signexp}
+% Some new switches for adding signs to numbers
+% \begin{macrocode}
+\newif\ifsi@num@signmant
+\newif\ifsi@num@signexp
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% Signs can be added to numbers by default. Two options are needed
+% here; whether to add a sign by default, and what the sign is.
+% \begin{macrocode}
+\si@opt@xchoicekey{sign}{plus,minus,pm,mp}{plus}
+\si@opt@choicekey[all]{addsign}
+ {mantissa,exponent,mant,exp,all,both,true,none,false}
+% \end{macrocode}
+%\end{macro}
+% The option is now processed.
+% \begin{macrocode}
+ {\si@num@signmantfalse
+ \si@num@signexpfalse
+ \renewcommand*{\si@tempb}{mantissa}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \fi
+ \renewcommand*{\si@tempb}{mant}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \fi
+ \renewcommand*{\si@tempb}{exponent}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{exp}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{all}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{both}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \si@num@signexptrue
+ \fi}
+% \end{macrocode}
+%\begin{macro}{\ifsi@tightpm}
+%\begin{macro}{\si@pm}
+% To reduce spacing, it might be necessary to use a ``tight'' $\pm$
+% sign.
+% \begin{macrocode}
+\si@opt@boolkey{tightpm}
+\newcommand*{\si@pm}{%
+ \ifsi@tightpm
+ \si@fix@tightpm
+ \else
+ \si@fix@pm
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@ang@padsmall}
+%\begin{macro}{\ifsi@ang@padlarge}
+% A switch for determining whether to typeset |\ang{;;1}| as
+% \ang[padangle=both]{;;1} or \ang[padangle=none]{;;1}. First, two
+% new Boolean switches are needed to indicate padding.
+% \begin{macrocode}
+\newif\ifsi@ang@padsmall
+\newif\ifsi@ang@padlarge
+\si@opt@choicekey[all]{padangle}
+ {small,large,all,both,true,none,false}
+ {\si@ang@padsmallfalse
+ \si@ang@padlargefalse
+ \renewcommand*{\si@tempb}{small}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \fi
+ \renewcommand*{\si@tempb}{large}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padlargetrue
+ \fi
+ \renewcommand*{\si@tempb}{all}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \si@ang@padlargetrue
+ \fi
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \si@ang@padlargetrue
+ \fi
+ \renewcommand*{\si@tempb}{both}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \si@ang@padlargetrue
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@ang@toarc}
+%\begin{macro}{\ifsi@ang@todec}
+% To control whether angles are formatted as decimals or
+% degrees--minutes--seconds, a package option plus two switches are
+% needed. The later format is referred to as ``\opt{arc}'' most
+% readily. An option to leave the input unchanged is also provided.
+% \begin{macrocode}
+\newif\ifsi@ang@toarc
+\newif\ifsi@ang@todec
+\si@opt@choicekey[all]{angformat}
+ {dec,decimal,arc,dms,unchanged,none}
+ {\si@ang@toarcfalse
+ \si@ang@todecfalse
+ \renewcommand*{\si@tempb}{dec}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@todectrue
+ \fi
+ \renewcommand*{\si@tempb}{decimal}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@todectrue
+ \fi
+ \renewcommand*{\si@tempb}{arc}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@toarctrue
+ \fi
+ \renewcommand*{\si@tempb}{dms}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@toarctrue
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@astroang}
+% A slightly odd option to allow the method used by astronomers for
+% angles.
+% \begin{macrocode}
+\si@opt@boolkey{astroang}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@strictarc}
+% For the \cs{ang} macro, the default is to require two semi-colons
+% in the input for arc angles. This is controlled here.
+% \begin{macrocode}
+\si@opt@boolkey{strictarc}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@tab@fixed}
+%\begin{macro}{\si@tabnumalign}
+%\begin{macro}{\si@tab@rfill@S}
+%\begin{macro}{\si@tab@lfill@S}
+% To determine the control of table alignment, two options are
+% provided. The \opt{tabnumalign} option controls which centring method
+% is used, and the fills used for achieving this.
+% \begin{macrocode}
+\newif\ifsi@tab@fixed
+\si@opt@choicekey{tabnumalign}
+ {centredecimal,centerdecimal,right,left,centre,center}
+ {\si@tab@fixedtrue
+ \let\si@tab@rfill@S\hfil
+ \let\si@tab@lfill@S\hfil
+ \renewcommand*{\si@tempb}{right}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@lfill@S\hfill
+ \fi
+ \renewcommand*{\si@tempb}{left}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@rfill@S\hfill
+ \fi
+ \renewcommand*{\si@tempb}{centredecimal}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@tab@fixedfalse
+ \fi
+ \renewcommand*{\si@tempb}{centerdecimal}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@tab@fixedfalse
+ \fi}
+\si@opt@key{tabalign}{\sisetup{tabnumalign=#1,tabtextalign=#1,
+ tabunitalign=#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@tabalignexp}
+% A switch for aligning exponents.
+% \begin{macrocode}
+\si@opt@boolkey{tabalignexp}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tab@mantprecnt}
+%\begin{macro}{\si@tab@mantpostcnt}
+%\begin{macro}{\si@tab@expprecnt}
+%\begin{macro}{\si@tab@exppostcnt}
+%\begin{macro}{\ifsi@tab@mantsign}
+%\begin{macro}{\ifsi@tab@expsign}
+% To process the format information, various internal
+% number-processing macros are used. First, some
+% storage areas are created.
+% \begin{macrocode}
+\newcount\si@tab@mantprecnt
+\newcount\si@tab@mantpostcnt
+\newcount\si@tab@expprecnt
+\newcount\si@tab@exppostcnt
+\newif\ifsi@tab@mantsign
+\newif\ifsi@tab@expsign
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The input is split into a mantissa and exponent, then passed to a
+% re-useable macro for further processing.
+% \begin{macrocode}
+\si@opt@cmdkey{tabformat}
+ {\si@num@fixpm
+ \renewcommand*{\si@num@arg}{tabformat data}%
+ \renewcommand*{\si@num@exp}{}%
+ \renewcommand*{\si@num@mant}{}%
+ \si@tab@mantsignfalse
+ \si@tab@expsignfalse
+ \si@switchfalse
+ \si@num@sepmantexp{#1}%
+% \end{macrocode}
+% When checking for a sign, the internal flag for finding but
+% deleting a plus sign is used.
+% \begin{macrocode}
+ \si@num@sepsign{mant}%
+ \ifx\@empty\si@num@mantsign\@empty
+ \ifsi@num@delplus
+ \expandafter\expandafter\expandafter\si@tab@mantsigntrue
+ \fi
+ \else
+ \expandafter\si@tab@mantsigntrue
+ \fi
+ \si@num@sepsign{exp}%
+ \ifx\@empty\si@num@expsign\@empty
+ \ifsi@num@delplus
+ \expandafter\expandafter\expandafter\si@tab@expsigntrue
+ \fi
+ \else
+ \expandafter\si@tab@expsigntrue
+ \fi
+ \si@opt@proctform{mant}%
+ \si@opt@proctform{exp}%
+% \end{macrocode}
+% The \opt{tabformat} input should really have both an integer and
+% decimal part for the mantissa. If neither are present, an error is
+% raised. If just the one part is missing, an warning seems more
+% suitable.
+% \begin{macrocode}
+ \ifnum\si@tab@mantpostcnt=\z@\relax
+ \ifnum\si@tab@mantprecnt=\z@\relax
+ \si@log@err{Empty mantissa argument for tabformat}
+ {The argument `#1' contains no valid entry for
+ a mantissa\MessageBreak It should be of the
+ form `m.n', where m and n are integers}%
+ \else
+ \si@log@warn{Argument of tabformat contains\MessageBreak
+ no decimal part}%
+ \fi
+ \else
+ \ifnum\si@tab@mantprecnt=\z@\relax
+ \si@log@warn{Argument of tabformat contains\MessageBreak
+ no integer part}%
+ \fi
+ \fi
+% \end{macrocode}
+% If \opt{tabformat} has been given with
+% \opt{tabnumalign=centredecimal} active, then the alignment is
+% changed to centred.
+% \begin{macrocode}
+ \ifsi@tab@fixed\else
+ \sisetup{tabnumalign=centre}%
+ \fi
+ \let\pm\si@num@pm
+ \let\mp\si@num@mp}
+% \end{macrocode}
+%\begin{macro}{\si@opt@proctform}
+% Processing the number further uses the \cs{si@num@digits} macro.
+% The results are stored in the appropriate counter.\\
+%\cs{si@opt@proctform}\marg{mant/exp}
+% \begin{macrocode}
+\newcommand*{\si@opt@proctform}[1]{%
+ \renewcommand*{\si@num@predec}{}%
+ \renewcommand*{\si@num@postdec}{}%
+ \si@switchfalse
+ \expandafter\si@ifnotmtarg\expandafter{%
+ \csname si@num@#1\endcsname}
+ {\expandafter\expandafter\expandafter\si@num@digits
+ \csname si@num@#1\endcsname\@empty\@empty}%
+ \csname si@tab@#1precnt\endcsname\z@\relax
+ \csname si@tab@#1postcnt\endcsname\z@\relax
+ \ifx\@empty\si@num@predec\@empty\else
+ \csname si@tab@#1precnt\endcsname\si@num@predec\relax
+ \fi
+ \ifx\@empty\si@num@postdec\@empty\else
+ \csname si@tab@#1postcnt\endcsname\si@num@postdec\relax
+ \fi}
+% \end{macrocode}
+%\end{macro}
+% The alignment of tabular material when not processed by \cs{num}
+% needs to be available.
+% \begin{macrocode}
+\si@opt@choicekey{tabtextalign}{left,right,centre,center}
+% \end{macrocode}
+%\begin{macro}{\si@tab@rfill@t}
+%\begin{macro}{\si@tab@lfill@t}
+% By default, centring happens on both sides of the content of
+% tabular material.
+% \begin{macrocode}
+ {\let\si@tab@rfill@t\hfill
+ \let\si@tab@lfill@t\hfill
+ \renewcommand*{\si@tempb}{right}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@rfill@t\relax
+ \fi
+ \renewcommand*{\si@tempb}{left}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@lfill@t\relax
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% The alignment of unit columns for tabular material has a similar
+% control option.
+% \begin{macrocode}
+\si@opt@choicekey{tabunitalign}{left,right,centre,center}
+% \end{macrocode}
+%\begin{macro}{\si@tab@rfill@s}
+%\begin{macro}{\si@tab@lfill@s}
+% By default, centring happens on both sides of the content of
+% tabular material.
+% \begin{macrocode}
+ {\let\si@tab@rfill@s\hfill
+ \let\si@tab@lfill@s\hfill
+ \renewcommand*{\si@tempb}{right}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@rfill@s\relax
+ \fi
+ \renewcommand*{\si@tempb}{left}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@lfill@s\relax
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@fixdp}
+%\begin{macro}{\si@num@dp}
+% To allow control of rounding, two options are needed. One sets how
+% many fixed digits to use, the second turns this function on and
+% off.
+% \begin{macrocode}
+\si@opt@boolkey{fixdp}
+\newcount\si@num@dp
+\si@opt@key{dp}{%
+ \si@str@ifonlychrs{#1}{0123456789}
+ {}
+ {\si@log@err{Invalid input for dp option}
+ {The dp option must be given a positive integer}}%
+ \si@num@dp#1\relax
+ \si@fixdptrue}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@tabautofit}
+% To apply rounding automatically in a table, a separate option is
+% used.
+% \begin{macrocode}
+\si@opt@boolkey{tabautofit}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@xspace}
+% Unit macros on their own may need \pkg{xpsace}.
+% \begin{macrocode}
+\si@opt@boolkey{xspace}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@prespace}
+% \begin{macrocode}
+\si@opt@boolkey
+ [\si@unt@numfalse
+ \ifsi@prespace
+ \si@unt@numtrue
+ \fi]
+ {prespace}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@allowoptarg}
+% For \unitsdef users, a method to absorb optional arguments is
+% needed.
+% \begin{macrocode}
+\si@opt@boolkey{allowoptarg}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@frac}
+%\begin{macro}{\ifsi@slash}
+%\begin{macro}{\ifsi@stickyper}
+% The option processing for formatting units with \cs{per} in them
+% needs two switches.
+% \begin{macrocode}
+\newif\ifsi@slash
+\newif\ifsi@frac
+\si@opt@boolkey{stickyper}
+\si@opt@choicekey[reciprocal]{per}
+ {reciprocal,rp,power,slash,frac,fraction}
+ {\si@slashfalse
+ \si@fracfalse
+ \renewcommand*{\si@tempb}{slash}%
+ \ifx\si@tempa\si@tempb
+ \si@fractrue
+ \si@slashtrue
+ \let\si@frac\si@frc@slash
+ \fi
+ \renewcommand*{\si@tempb}{frac}%
+ \ifx\si@tempa\si@tempb
+ \si@fractrue
+ \fi
+ \renewcommand*{\si@tempb}{fraction}%
+ \ifx\si@tempa\si@tempb
+ \si@fractrue
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@slash}
+% For the \opt{slash} option, the separator can be customised.
+% \begin{macrocode}
+\si@opt@xchoicekey{slash}{slash}{slash}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@repeatunits}
+%\begin{macro}{\ifsi@addunitpower}
+% An option is needed for cases where units should be repeated.
+% \begin{macrocode}
+\newif\ifsi@repeatunits
+\newif\ifsi@addunitpower
+\si@opt@choicekey[true]{repeatunits}{true,false,power}
+ {\si@repeatunitsfalse
+ \si@addunitpowerfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@repeatunitstrue
+ \fi
+ \renewcommand*{\si@tempb}{power}%
+ \ifx\si@tempa\si@tempb
+ \si@addunitpowertrue
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@trapambigfrac}
+%\begin{macro}{\si@closefrac}
+%\begin{macro}{\si@openfrac}
+% Macros for the right and left brackets added to potentially
+% ambiguous denominators.
+% \begin{macrocode}
+\si@opt@boolkey{trapambigfrac}
+\si@opt@cmdkeys{closefrac,openfrac}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% In the case of fractional handling of the \cs{per} operator,
+% further refinement is available.
+% \begin{macrocode}
+\si@opt@choicekey[frac]{fraction}
+ {frac,nicefrac,nice,sfrac,xfrac,uglyfrac,ugly}
+ {\let\si@frac\si@frc@frac
+ \renewcommand*{\si@tempb}{nicefrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@nice
+ \fi
+ \renewcommand*{\si@tempb}{uglyfrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@ugly
+ \fi
+ \renewcommand*{\si@tempb}{nice}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@nice
+ \fi
+ \renewcommand*{\si@tempb}{sfrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@sfrac
+ \fi
+ \renewcommand*{\si@tempb}{xfrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@sfrac
+ \fi
+ \renewcommand*{\si@tempb}{ugly}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@ugly
+ \fi}
+% \end{macrocode}
+%\begin{macro}{\si@load}
+%\begin{macro}{\si@noload}
+% Loading of support files is controlled by two keys. The first
+% defines a list of files that may be loaded, the second a list that
+% will not. This makes it easy to exclude a single file from a long
+% list.
+% \begin{macrocode}
+\si@opt@cmdkeys{load,noload}
+\si@opt@key{alsoload}{\si@addtolist{\si@load}{#1}}
+\AtEndOfPackage{
+ \si@opt@disablekey{load}
+ {Configuration files can only be used\MessageBreak
+ when loading package}
+ \si@opt@disablekey{noload}
+ {Configuration files can only be used\MessageBreak
+ when loading package}}
+\AtEndOfPackage{
+ \si@opt@key{alsoload}{%
+ \@for\si@tempa:=#1\do{\si@loadfile{\si@tempa}}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@colourunits}
+%\begin{macro}{\ifsi@colourvalues}
+%\begin{macro}{\si@unitcolour}
+%\begin{macro}{\si@valuecolour}
+% Colour is turned on and off using two switches and the appropriate
+% options. US spellings are also provided.
+% \begin{macrocode}
+\si@opt@boolkey{colourunits}
+\si@opt@boolkey{colourvalues}
+\si@opt@choicekey[true]{colorunits}
+ {true,false}
+ {\si@colourunitsfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourunitstrue
+ \fi}
+\si@opt@choicekey[true]{colorvalues}
+ {true,false}
+ {\si@colourvaluesfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourvaluestrue
+ \fi}
+\si@opt@choicekey[true]{colorall}
+ {true,false}
+ {\si@colourvaluesfalse
+ \si@colourunitsfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourunitstrue
+ \si@colourvaluestrue
+ \fi}
+\si@opt@choicekey[true]{colourall}
+ {true,false}
+ {\si@colourvaluesfalse
+ \si@colourunitsfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourunitstrue
+ \si@colourvaluestrue
+ \fi}
+\si@opt@cmdkeys{unitcolour,valuecolour}
+\si@opt@key{unitcolor}{\sisetup{unitcolour=#1}}
+\si@opt@key{valuecolor}{\sisetup{valuecolour=#1}}
+\si@opt@key{colour}{\sisetup{unitcolour=#1,valuecolour=#1}}
+\si@opt@key{color}{\sisetup{unitcolour=#1,valuecolour=#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@colourneg}
+%\begin{macro}{\si@negcolour}
+% The set up for colouring negative numbers is similar.
+% \begin{macrocode}
+\si@opt@boolkey{colourneg}
+\si@opt@choicekey[true]{colorneg}
+ {true,false}
+ {\si@colournegfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colournegtrue
+ \fi}
+\si@opt@cmdkeys{negcolour}
+\si@opt@key{negcolor}{\sisetup{negcolour=#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@textOmega}
+%\begin{macro}{\si@mathsOmega}
+% The various non-Latin symbols need to be handled, and given user interfaces.
+% Some definitions are more complex than others; for \si{\ohm}
+% things are easy.
+% \begin{macrocode}
+\si@opt@cmdkeys{textOmega,mathsOmega}
+\si@opt@key{mathOmega}{\sisetup{mathsOmega=#1}}
+\newcommand*{\si@mathsOmega}{\text{\ensuremath{\Omega}}}
+\newcommand*{\si@textOmega}{\ensuremath{\Omega}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@textmu}
+%\begin{macro}{\si@mathsmu}
+% For the \si{\micro} symbol, some direct loading of symbols is
+% needed as the maths mu sign ($\mu$) is wrong.
+% \begin{macrocode}
+\si@opt@cmdkeys{textmu,mathsmu}
+\si@opt@key{mathmu}{\sisetup{mathsmu=#1}}
+\DeclareFontEncoding{TS1}{}{}
+\DeclareFontSubstitution{TS1}{cmr}{m}{n}
+\DeclareTextSymbol{\si@textmu}{TS1}{181}
+\DeclareTextSymbolDefault{\si@textmu}{TS1}
+\DeclareFontFamily{OML}{eur}{\skewchar\font127}
+\DeclareFontShape{OML}{eur}{m}{n}%
+ {<5> <6> <7> <8> <9> gen * eurm %
+ <10><10.95><12><14.4><17.28><20.74><24.88>eurm10}{}
+\DeclareSymbolFont{greek}{OML}{eur}{m}{n}
+\DeclareMathSymbol{\si@mathsmu}{\mathord}{greek}{"16}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@textdegree}
+%\begin{macro}{\si@mathsdegree}
+%\begin{macro}{\si@textminute}
+%\begin{macro}{\si@mathsminute}
+%\begin{macro}{\si@textsecond}
+%\begin{macro}{\si@mathssecond}
+% The angle signs.
+% \begin{macrocode}
+\si@opt@cmdkeys{textdegree,mathsdegree,textminute,mathsminute,
+ textsecond,mathssecond}
+\si@opt@key{mathdegree}{\sisetup{mathsdegree=#1}}
+\si@opt@key{mathminute}{\sisetup{mathsminute=#1}}
+\si@opt@key{mathsecond}{\sisetup{mathssecond=#1}}
+\newcommand*{\si@textdegree}{\ensuremath{{}^{\circ}}}
+\newcommand*{\si@mathsdegree}{{}^{\circ}}
+\newcommand*{\si@textminute}{\ensuremath{{}^{\prime}}}
+\newcommand*{\si@mathsminute}{{}^{\prime}}
+\newcommand*{\si@textsecond}{\ensuremath{{}^{\prime\prime}}}
+\newcommand*{\si@mathssecond}{{}^{\prime\prime}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@textcelsius}
+%\begin{macro}{\si@mathscelsius}
+% Finally, degrees Celsius, which may need the degree symbol.
+% \begin{macrocode}
+\si@opt@cmdkeys{textcelsius,mathscelsius}
+\si@opt@key{mathcelsius}{\sisetup{mathscelsius=#1}}
+\newcommand*{\si@textcelsius}{%
+ \si@textdegree\kern-\scriptspace C}
+\newcommand*{\si@mathscelsius}{%
+ \si@mathsdegree\kern-\scriptspace\mathrm{C}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@textringA}
+%\begin{macro}{\si@mathsringA}
+% The \si{\angstrom} sign.
+% \begin{macrocode}
+\si@opt@cmdkeys{textringA,mathsringA}
+\si@opt@key{mathringA}{\sisetup{mathsringA=#1}}
+\newcommand*{\si@textringA}{\AA}
+\newcommand*{\si@mathsringA}{\text{\AA}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@redefsymbols}
+% A flag for using \pkg{textcomp} and \pkg{upgreek} to provide better
+% symbols.
+% \begin{macrocode}
+\si@opt@boolkey{redefsymbols}
+\AtBeginDocument{
+ \si@opt@disablekey{redefsymbols}
+ {Symbols can only be redefined\MessageBreak
+ when loading siunitx}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@eVcorra}
+%\begin{macro}{\si@eVcorrb}
+% \begin{macrocode}
+\newlength\si@eVcorra
+\newlength\si@eVcorrb
+\si@opt@key{eVcorra}{\setlength\si@eVcorra{#1}}
+\si@opt@key{eVcorrb}{\setlength\si@eVcorrb{#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@locale}
+%\begin{macro}{\si@loctolang}
+% Handling typographic conventions needs three keys. \opt{locale} is
+% used to set the locale, \opt{loctolang} to bind to \pkg{babel}.
+% \begin{macrocode}
+\si@opt@key{locale}{%
+ \si@loc@load{#1}%
+ \si@loc@set{#1}}%
+\si@opt@key{loctolang}{\si@loc@ltol{#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+%\subsection{Compatibility options}
+%\begin{macro}{\ifsi@old@ugly}
+%\begin{macro}{\ifsi@old@nice}
+%\begin{macro}{\ifsi@old@loose}
+%\begin{macro}{\ifsi@old@tight}
+% With the options for the package set up, the next stage is to
+% provide support for users of the older packages. These all set up
+% switches, but do not do anything. That is left to the emulation
+% files, loaded at the end of the package. First of all, the
+% \units options are dealt with; there are not many.
+% \begin{macrocode}
+\si@opt@compatkey{units}{ugly}
+\si@opt@compatkey{units}{nice}
+\si@opt@compatkey{units}{loose}
+\si@opt@compatkey{units}{tight}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@OHM}
+%\begin{macro}{\ifsi@old@ohm}
+%\begin{macro}{\ifsi@old@redef-gensymb}
+%\begin{macro}{\ifsi@gensymb}
+% The \unitsdef package is unfortunately much more profligate with
+% options. The first set are to do with support for \pkg{gensymb}.
+% \begin{macrocode}
+\si@opt@compatkey{unitsdef}{OHM}
+\si@opt@compatkey{unitsdef}{ohm}
+\si@opt@compatkey{unitsdef}{redef-gensymb}
+\newif\ifsi@gensymb
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@LITER}
+%\begin{macro}{\ifsi@old@liter}
+%\begin{macro}{\ifsi@old@noxspace}
+%\begin{macro}{\ifsi@old@noconfig}
+% The second set are more general functionality.
+% \begin{macrocode}
+\si@opt@compatkey{unitsdef}{LITER}
+\si@opt@compatkey{unitsdef}{liter}
+\si@opt@compatkey{unitsdef}{noxspace}
+\si@opt@compatkey{unitsdef}{noconfig}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@noabbr}
+%\begin{macro}{\ifsi@old@noamperageabbr}
+%\begin{macro}{\ifsi@old@nofrequncyabbr}
+%\begin{macro}{\ifsi@old@nomolabbr}
+%\begin{macro}{\ifsi@old@novoltageabbr}
+%\begin{macro}{\ifsi@old@novolumeabbr}
+%\begin{macro}{\ifsi@old@noweightabbr}
+%\begin{macro}{\ifsi@old@noenergyabbr}
+%\begin{macro}{\ifsi@old@nolengthabbr}
+%\begin{macro}{\ifsi@old@notimeabbr}
+% The final set are for control of abbreviations, and are a good
+% demonstration of why to use \pkg{xkeyval}!
+% \begin{macrocode}
+\si@opt@compatkey{unitsdef}{noabbr}
+\si@opt@compatkey{unitsdef}{noampereageabbr}
+\si@opt@compatkey{unitsdef}{nofrequncyabbr}
+\si@opt@compatkey{unitsdef}{nomolabbr}
+\si@opt@compatkey{unitsdef}{novoltageabbr}
+\si@opt@compatkey{unitsdef}{novolumeabbr}
+\si@opt@compatkey{unitsdef}{noweightabbr}
+\si@opt@compatkey{unitsdef}{noenergyabbr}
+\si@opt@compatkey{unitsdef}{nolengthabbr}
+\si@opt@compatkey{unitsdef}{notimeabbr}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@cdot}
+%\begin{macro}{\ifsi@old@thickspace}
+%\begin{macro}{\ifsi@old@mediumspace}
+%\begin{macro}{\ifsi@old@thinspace}
+%\begin{macro}{\ifsi@old@thickqspace}
+%\begin{macro}{\ifsi@old@mediumqspace}
+%\begin{macro}{\ifsi@old@thinqspace}
+% The \SIunits package has lots of options. These ones are all
+% related to spacing.
+% \begin{macrocode}
+\si@opt@compatkey{SIunits}{cdot}
+\si@opt@compatkey{SIunits}{thickspace}
+\si@opt@compatkey{SIunits}{mediumspace}
+\si@opt@compatkey{SIunits}{thinspace}
+\si@opt@compatkey{SIunits}{thickqspace}
+\si@opt@compatkey{SIunits}{mediumqspace}
+\si@opt@compatkey{SIunits}{thinqspace}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@amssymb}
+%\begin{macro}{\ifsi@old@squaren}
+%\begin{macro}{\ifsi@old@pstricks}
+%\begin{macro}{\ifsi@old@Gray}
+%\begin{macro}{\ifsi@old@italian}
+% These options are used by \SIunits to control clashes with other
+% packages.
+% \begin{macrocode}
+\si@opt@compatkey{SIunits}{amssymb}
+\si@opt@compatkey{SIunits}{squaren}
+\si@opt@compatkey{SIunits}{pstricks}
+\si@opt@compatkey{SIunits}{Gray}
+\si@opt@compatkey{SIunits}{italian}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@textstyle}
+%\begin{macro}{\ifsi@old@binary}
+%\begin{macro}{\ifsi@old@noams}
+%\begin{macro}{\ifsi@old@derivedinbase}
+%\begin{macro}{\ifsi@old@derived}
+% The miscellaneous options.
+% \begin{macrocode}
+\si@opt@compatkey{SIunits}{textstyle}
+\si@opt@compatkey{SIunits}{binary}
+\si@opt@compatkey{SIunits}{noams}
+\si@opt@compatkey{SIunits}{derivedinbase}
+\si@opt@compatkey{SIunits}{derived}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@noprefixcmds}
+% The \pkg{hepunits} package only has one option.
+% \begin{macrocode}
+\si@opt@compatkey{hepunits}{noprefixcmds}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@old@english}
+%\begin{macro}{\ifsi@old@french}
+% \pkg{fancynum} provides a few options. First the rather oddly
+% named \opt{english} and \opt{french} ones.
+% \begin{macrocode}
+\si@opt@compatkey{fancynum}{english}
+\si@opt@compatkey{fancynum}{french}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@tight}
+%\begin{macro}{\ifsi@old@loose}
+% A couple for spacing multiplication.
+% \begin{macrocode}
+\si@opt@compatkey{fancynum}{tight}
+\si@opt@compatkey{fancynum}{loose}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@thinspaces}
+%\begin{macro}{\ifsi@old@commas}
+%\begin{macro}{\ifsi@old@plain}
+% Three for digit separation.
+% \begin{macrocode}
+\si@opt@compatkey{fancynum}{thinspaces}
+\si@opt@compatkey{fancynum}{commas}
+\si@opt@compatkey{fancynum}{plain}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@old@spaceqspace}
+% The \pkg{fancyunits} package provides one option not available with
+% \SIunits.
+% \begin{macrocode}
+\si@opt@compatkey{fancyunits}{spaceqspace}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Constants}
+% A number of macros are needed by the package that provide a
+% non-changing output. These are defined here; the intention is that
+% these should not be macros that the user is likely to need to
+% alter. All of these macros have preface \cs{si@fix@}, to flag that
+% that are intended as constants. The package may rely on the
+% contents of these macros for functionality.
+%
+%\begin{macro}{\si@fix@thin}
+%\begin{macro}{\si@fix@med}
+%\begin{macro}{\si@fix@medium}
+%\begin{macro}{\si@fix@thick}
+%\begin{macro}{\si@fix@space}
+% First, there are the various space macros. To allow both \opt{med}
+% and \opt{medium} to be used as a space description, two macros are
+% needed for the same output.
+% \begin{macrocode}
+\newcommand*{\si@fix@thin}{\,}
+\newcommand*{\si@fix@med}{\:}
+\newcommand*{\si@fix@medium}{\:}
+\newcommand*{\si@fix@thick}{\;}
+\newcommand*{\si@fix@space}{\text{~}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fix@cdot}
+%\begin{macro}{\si@fix@comma}
+%\begin{macro}{\si@fix@stop}
+%\begin{macro}{\si@fix@fullstop}
+%\begin{macro}{\si@fix@period}
+%\begin{macro}{\si@fix@times}
+%\begin{macro}{\si@fix@tighttimes}
+%\begin{macro}{\si@fix@tightcdot}
+% Next there are macros for material that is not simply whitespace.
+% To allow several options, the full-stop gets lots of names.
+% \begin{macrocode}
+\newcommand*{\si@fix@cdot}{{}\cdot{}}
+\newcommand*{\si@fix@comma}{{,}}
+\newcommand*{\si@fix@stop}{{.}}
+\newcommand*{\si@fix@fullstop}{{.}}
+\newcommand*{\si@fix@period}{{.}}
+\newcommand*{\si@fix@times}{\times}
+\newcommand*{\si@fix@tighttimes}{\bgroup\times\egroup}
+\newcommand*{\si@fix@tightcdot}{\bgroup\cdot\egroup}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fix@plus}
+%\begin{macro}{\si@fix@minus}
+%\begin{macro}{\si@fix@pm}
+%\begin{macro}{\si@fix@tightpm}
+%\begin{macro}{\si@fix@mp}
+% Signs for numbers are needed.
+% \begin{macrocode}
+\newcommand*{\si@fix@plus}{+}
+\newcommand*{\si@fix@minus}{-}
+\newcommand*{\si@fix@pm}{\pm}
+\newcommand*{\si@fix@tightpm}{\bgroup\pm\egroup}
+\newcommand*{\si@fix@mp}{\mp}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fix@two}
+%\begin{macro}{\si@fix@ten}
+% The literals ``2'' and ``10'' are needed for exponents.
+% \begin{macrocode}
+\newcommand*{\si@fix@two}{2}
+\newcommand*{\si@fix@ten}{10}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fix@slash}
+% Another optional component that will probably not be used by many
+% people.
+% \begin{macrocode}
+\newcommand*{\si@fix@slash}{/}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@fix@none}
+% Finally for spacing, there is the possibility of nothing at all
+% \begin{macrocode}
+\newcommand*{\si@fix@none}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Symbols}
+%\begin{macro}{\si@symbol}
+% Each of the symbol macros needs to be set up; the options give a
+% maths and text mode sign, but internally a single macro is needed
+% for each.
+% \begin{macrocode}
+\newcommand*{\si@symbol}[1]{%
+ \expandafter\protected\expandafter\def
+ \csname si@sym@#1\endcsname{%
+ \ifmmode
+ \expandafter\csname si@maths#1\expandafter\endcsname
+ \else
+ \expandafter\csname si@text#1\expandafter\endcsname
+ \fi}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@sym@Omega}
+%\begin{macro}{\si@sym@ringA}
+%\begin{macro}{\si@sym@mu}
+%\begin{macro}{\si@sym@degree}
+%\begin{macro}{\si@sym@minute}
+%\begin{macro}{\si@sym@second}
+%\begin{macro}{\si@sym@celsius}
+% The various symbols are now declared.
+% \begin{macrocode}
+\si@symbol{Omega}
+\si@symbol{ringA}
+\si@symbol{mu}
+\si@symbol{degree}
+\si@symbol{minute}
+\si@symbol{second}
+\si@symbol{celsius}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The issue of redefinition of symbols now arises. \currpkg can
+% check for the loading of a number of support package, and can then
+% redefine the appropriate symbols.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifsi@redefsymbols
+ \@ifpackageloaded{textcomp}
+ {\si@log@debug{Redefining symbols using textcomp}%
+ \renewcommand*{\si@textdegree}{\textdegree}%
+ \renewcommand*{\si@mathsdegree}{\text{\textdegree}}%
+% \end{macrocode}
+% \pkg{mathptmx} will give issues with \pkg{textcomp} and the
+% \si{\ohm} sign.
+% \begin{macrocode}
+ \@ifpackageloaded{mathptmx}{}
+ {\renewcommand*{\si@textmu}{\textmu}%
+ \renewcommand*{\si@textOmega}{\textohm}}%
+% \end{macrocode}
+% The \si{\angstrom} symbol is only redefined if the encoding is
+% OT1; other encodings should have a proper glyph used for \cs{AA}.
+% The \cs{encodingdefault} macro is \cs{long} for some reason.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{OT1}%
+ \ifx\si@tempa\encodingdefault
+ \renewcommand*{\si@mathsringA}{%
+ \text{\capitalring{A}}}%
+ \renewcommand*{\si@textringA}{\capitalring{A}}
+ \fi}{}
+ \@ifpackageloaded{upgreek}
+ {\si@log@debug{Redefining symbols using upgreek}%
+ \renewcommand*{\si@mathsmu}{\upmu}%
+ \renewcommand*{\si@mathsOmega}{\Upomega}}{}
+ \fi}
+% \end{macrocode}
+%
+%\subsection{Handling fractions}
+%\begin{macro}{\si@frac}
+%\begin{macro}{\si@frc@hook}
+%\begin{macro}{\si@frc@frac}
+%\begin{macro}{\si@frc@slash}
+%\begin{macro}{\si@frc@nice}
+%\begin{macro}{\si@frc@sfrac}
+% Various methods of handling fractions are provided.
+% \begin{macrocode}
+\newcommand*{\si@frc@frac}[2]{%
+ \ensuremath{\si@frc@hook\frac{%
+ \expandafter\si@unt@out\expandafter{#1}}%
+ {\expandafter\si@unt@out\expandafter{#2}}}}
+\let\si@frac\si@frc@frac
+\newcommand*{\si@frc@hook}{}
+\newcommand*{\si@frc@slash}[2]{%
+ \expandafter\si@unt@out\expandafter{#1}%
+ \si@out{\ensuremath{\si@slash}}%
+ \expandafter\si@unt@out\expandafter{#2}}
+\newcommand*{\si@frc@nice}[2]{%
+ \ensuremath{\si@frc@nicefrac{\expandafter\si@unt@out%
+ \expandafter{#1}}{\expandafter\si@unt@out\expandafter
+ {#2}}}}
+\newcommand*{\si@frc@sfrac}[2]{%
+ \sfrac{\expandafter\si@unt@out\expandafter{#1}}%
+ {\expandafter\si@unt@out\expandafter{#2}}}
+\AtBeginDocument{
+ \@ifpackageloaded{xfrac}
+ {}
+ {\si@log@inf{xfrac package unavailable\MessageBreak
+ using `fraction=sfrac' will fall back on\MessageBreak
+ nicefrac-like method}%
+ \renewcommand*{\si@frc@sfrac}[2]{%
+ \si@log@warn{xfrac package unavailable}%
+ \si@frc@nice{#1}{#2}}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@frc@nicefrac}
+%\begin{macro}{\si@frc@displen}
+%\begin{macro}{\si@frc@textlen}
+%\begin{macro}{\si@frc@suplen}
+%\begin{macro}{\si@frc@ssuplen}
+% To avoid needing \units installed, the \cs{nicefrac} macro needs
+% to be emulated here. The code is taken (with permission) from
+% \kg{nicefrac}.\footnote{The original is licensed under the GPL;
+% thanks to the author Axel Reichert for permission to copy the code
+% here.}
+% \begin{macrocode}
+\newlength\si@frc@displen
+\newlength\si@frc@textlen
+\newlength\si@frc@suplen
+\newlength\si@frc@ssuplen
+\newcommand*{\si@frc@nicefrac}{%
+ \ifmmode
+ \expandafter\si@frc@mathsnf
+ \else
+ \expandafter\si@frc@textnf
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@frc@mathsnf}
+% The maths mode system.\\
+%\cs{si@frc@mathsnf}\marg{numerator}\marg{denominator}
+% \begin{macrocode}
+\newcommand*{\si@frc@mathsnf}[2]{%
+ \begingroup
+ \settoheight{\si@frc@displen}{\ensuremath{%
+ \displaystyle{M}}}%
+ \settoheight{\si@frc@textlen}{\ensuremath{%
+ \textstyle{M}}}%
+ \settoheight{\si@frc@suplen}{\ensuremath{%
+ \scriptstyle{M}}}%
+ \settoheight{\si@frc@ssuplen}{%
+ \ensuremath{\scriptscriptstyle{M}}}%
+ \addtolength{\si@frc@displen}{-\si@frc@ssuplen}%
+ \addtolength{\si@frc@textlen}{-\si@frc@ssuplen}%
+ \addtolength{\si@frc@suplen}{-\si@frc@ssuplen}%
+ \mathchoice
+ {\raisebox{\si@frc@displen}{\ensuremath{%
+ \scriptstyle{#1}}}}%
+ {\raisebox{\si@frc@textlen}{\ensuremath{%
+ \scriptstyle{#1}}}}%
+ {\raisebox{\si@frc@suplen}%
+ {\ensuremath{\scriptscriptstyle{#1}}}}%
+ {\raisebox{\si@frc@ssuplen}%
+ {\ensuremath{\scriptscriptstyle{#1}}}}%
+ \mkern-2mu\relax/\mkern-1mu\relax
+ \bgroup
+ \mathchoice
+ {\scriptstyle}%
+ {\scriptstyle}%
+ {\scriptscriptstyle}%
+ {\scriptscriptstyle}%
+ {#2}%
+ \egroup
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@frc@textnf}
+% A stripped down version of the \pkg{nicefrac} system for text mode.\\
+%\cs{si@frc@textnf}\marg{numerator}\marg{denominator}
+% \begin{macrocode}
+\newcommand*{\si@frc@textnf}[2]{%
+ \begingroup
+ \settoheight{\si@frc@textlen}{M}%
+ \settoheight{\si@frc@ssuplen}{\fontsize\sf@size\z@\relax
+ \selectfont{M}}%
+ \addtolength{\si@frc@textlen}{-\si@frc@ssuplen}%
+ \raisebox{\si@frc@textlen}{\fontsize\sf@size\z@\relax
+ \selectfont{#1}}%
+ \hspace{-0.25ex}/\hspace{-0.25ex}%
+ \hbox{\fontsize\sf@size\z@\selectfont{#2}}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@frc@ugly}
+% The \cs{si@frc@ugly} macro is needed to emulate the \opt{ugly}
+% option in \units, where output depends on the current mode.\\
+%\cs{si@frc@ugly}\marg{numerator}
+% \begin{macrocode}
+\newcommand*{\si@frc@ugly}[1]{%
+ \renewcommand*{\si@tempa}{#1}%
+ \ifmmode
+ \expandafter\si@frc@frac
+ \else
+ \renewcommand*{\si@tempb}{1}%
+ \ifx\si@tempa\si@tempb
+% \end{macrocode}
+% The slash switch cannot be used, so the possibility of the
+% numerator being one is handled here.
+% \begin{macrocode}
+ \setbox\si@tempboxa=\hbox{\ensuremath{\si@valuesep}}%
+ \hskip-\wd\si@tempboxa\relax
+ \renewcommand*{\si@tempa}{}%
+ \fi
+ \expandafter\si@frc@slash
+ \fi
+ {\si@tempa}}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Font control}
+% A number of controls and tests are needed to control the font used
+% for output. Underlying all of this is the \AMS\ package
+% \pkg{amstext} package, providing the \cs{text} command. Much of
+% the font control system here is taken more or less verbatim from
+% \SIstyle; modifications have been made to fit the \currpkg
+% interface.
+%
+%\begin{macro}{\si@fam@sf}
+%\begin{macro}{\si@fam@tt}
+% The package needs to know the maths font families in use. This is
+% set right at the start of the document, after any changes can have
+% been made by, for example, \pkg{fontspec}.
+% \begin{macrocode}
+\g@addto@macro{\document}{%
+ \ifdefined\mathsf
+ \setbox\si@tempboxa=\hbox{%
+ $\mathsf{\global\chardef\si@fam@sf=\fam}$}%
+ \else
+ \si@log@inf{\string\mathsf not found}%
+ \global\chardef\si@fam@sf=99\relax
+ \fi
+ \ifdefined\mathtt
+ \setbox\si@tempboxa=\hbox{%
+ $\mathtt{\global\chardef\si@fam@tt=\fam}$}%
+ \else
+ \si@log@inf{\string\mathtt not found}%
+ \global\chardef\si@fam@tt=99\relax
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fam@ifbtext}
+%\begin{macro}{\si@fam@ifbmaths}
+% These tests check for bold in text and maths mode, respectively.\\
+%\cs{si@fam@ifbtext}\marg{code}\\
+%\cs{si@fam@ifbmaths}\marg{code}
+% \begin{macrocode}
+\newcommand*{\si@fam@ifbtext}[1]{%
+ \if b\expandafter\@car\f@series\@nil
+ #1\fi}
+\newcommand*{\si@fam@ifbmaths}[1]{%
+ \renewcommand*{\si@tempa}{bold}%
+ \ifx\math@version\si@tempa
+ #1\fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fam@ifbinline}
+% For compatibility with \units, a method to change the behaviour
+% when in inline maths is needed for the bold detector.
+% \begin{macrocode}
+\newcommand*{\si@fam@ifbinline}{%
+ \ifsi@inlinebtext
+ \expandafter\si@fam@ifbtext
+ \else
+ \expandafter\si@fam@ifbmaths
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@fam@ifitext}
+% This test check for italic or slanted text in text mode, by
+% negation (upright text is |n|).\\
+%\cs{si@fam@ifitext}\marg{code}
+% \begin{macrocode}
+\newcommand*{\si@fam@ifitext}[1]{%
+ \if n\expandafter\@car\f@series\@nil\else
+ #1\fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@fam@mode}
+% Detection of the current mode needs to happen``early'' (before any
+% change of \cs{ensuremath}). So a short macro is provided to do the
+% job.
+% \begin{macrocode}
+\newcommand*{\si@fam@mode}{%
+ \ifsi@obeymode
+ \ifmmode
+ \sisetup{mode=maths}%
+ \else
+ \sisetup{mode=text}%
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@fam@colourcmd}
+% The colour command is set up.
+% \begin{macrocode}
+\AtBeginDocument{
+ \@ifpackageloaded{color}
+ {\let\si@fam@colourcmd\color}
+ {\let\si@fam@colourcmd\@gobble}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\ifsi@fam@set}
+%\begin{macro}{\ifsi@textmode}
+% A marker is set up to check if font-matching has been taken place.
+% A second flag is used to track the use of text mode.
+% \begin{macrocode}
+\newif\ifsi@fam@set
+\newif\ifsi@textmode
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fam@set}
+% Using the code from \SIstyle as a base, a set of tests are used to
+% set the current font families and weights. To begin with, the
+% mode to use is set up.
+% \begin{macrocode}
+\newcommand*{\si@fam@set}{%
+ \ifsi@out@num
+ \ifsi@numtextmode
+ \expandafter\expandafter\expandafter\si@textmodetrue
+ \else
+ \expandafter\expandafter\expandafter\si@textmodefalse
+ \fi
+ \else
+ \ifsi@unittextmode
+ \expandafter\expandafter\expandafter\si@textmodetrue
+ \else
+ \expandafter\expandafter\expandafter\si@textmodefalse
+ \fi
+ \fi
+% \end{macrocode}
+%\begin{macro}{\si@mathsrm}
+%\begin{macro}{\si@mathssf}
+%\begin{macro}{\si@mathstt}
+%\begin{macro}{\si@textrm}
+%\begin{macro}{\si@textsf}
+%\begin{macro}{\si@texttt}
+%\begin{macro}{\si@colourcmd}
+%\begin{macro}{\si@colour}
+% The appropriate font macros are now established, if necessary.
+% \begin{macrocode}
+ \ifsi@fam@set\else
+ \let\si@colourcmd\@gobble
+ \ifsi@out@num
+ \let\si@mathsrm\si@valuemathsrm
+ \let\si@mathssf\si@valuemathssf
+ \let\si@mathstt\si@valuemathstt
+ \let\si@textrm\si@valuetextrm
+ \let\si@textsf\si@valuetextsf
+ \let\si@texttt\si@valuetexttt
+ \ifsi@colourvalues
+ \let\si@colourcmd\si@fam@colourcmd
+ \fi
+ \let\si@colour\si@valuecolour
+ \else
+ \let\si@mathsrm\si@unitmathsrm
+ \let\si@mathssf\si@unitmathssf
+ \let\si@mathstt\si@unitmathstt
+ \let\si@textrm\si@unittextrm
+ \let\si@textsf\si@unittextsf
+ \let\si@texttt\si@unittexttt
+ \ifsi@colourunits
+ \let\si@colourcmd\si@fam@colourcmd
+ \fi
+ \let\si@colour\si@unitcolour
+ \fi
+ \fi
+ \si@fam@settrue
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The temporary macros are needed for the \cs{ifx} tests, which need to
+% be expanded once.
+% \begin{macrocode}
+ \edef\si@tempa{\sfdefault}%
+ \edef\si@tempb{\ttdefault}%
+% \end{macrocode}
+%\begin{macro}{\si@fam@maths}
+%\begin{macro}{\si@fam@text}
+% The surrounding font family is only tested if matching is
+% requested. First, the defaults are set up assuming no detection
+% takes place.
+% \begin{macrocode}
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathsrm\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textrm\endcsname
+ \ifsi@obeyfamily
+ \si@log@debug{Font detection: checking font}%
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% The detection code has to check the mode currently in operation.
+% Display mathematics can be handled in two ways, so this means some
+% code is repeated: it is spun out to separate routines.
+% \begin{macrocode}
+ \ifmmode
+ \ifinner
+ \si@log@debug{Font detection: inline maths}%
+ \si@fam@dettext
+ \else
+ \si@log@debug{Font detection: display maths}%
+ \ifsi@detectdisplay
+ \si@fam@detmaths
+ \else
+ \si@fam@dettext
+ \fi
+ \fi
+ \else
+ \si@log@debug{Font detection: text}%
+ \si@fam@dettext
+ \fi
+ \else
+ \si@log@debug{Font detection: inactive}%
+ \fi
+% \end{macrocode}
+%\begin{macro}{\si@fam@bold}
+% With the font family set, the next check is for bold text. This
+% again needs to examine the current mode. Things are a bit more
+% complex than in \SIstyle as it is possible to be typesetting in
+% either text or maths mode. The bold command is set up with
+% \cs{def}, as nested calls can occur.
+% \begin{macrocode}
+ \def\si@fam@bold{\unboldmath\mdseries}%
+ \ifsi@obeybold
+ \si@log@debug{Weight detection: checking weight}%
+ \ifmmode
+ \ifdim\displaywidth>0pt\relax
+ \ifsi@detectdisplay
+ \expandafter\si@fam@ifbmaths
+ \else
+ \expandafter\si@fam@ifbtext
+ \fi
+ \si@fam@setbold
+ \else
+ \si@fam@ifbinline\si@fam@setbold
+ \fi
+ \else
+ \si@fam@ifbtext\si@fam@setbold
+ \fi
+ \fi
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@fam@italic}
+% The value of \opt{obeyitalic} is now tested; as this does nothing
+% in maths mode, a reminder is added to the log.
+% \begin{macrocode}
+ \let\si@fam@italic\upshape
+ \ifsi@obeyitalic
+ \si@log@debug{Italic detection: checking italic}%
+ \si@fam@ifitext
+ {\let\si@fam@italic\relax
+ \si@log@debug{Italic detection: italic}}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fam@detmaths}
+%\begin{macro}{\si@fam@dettext}
+% Two detection macros are needed for maths and text mode. This
+% allows handling of the various combinations without needing too
+% many code lines.
+% \begin{macrocode}
+\newcommand*{\si@fam@detmaths}{%
+ \ifnum\the\fam=\si@fam@sf
+ \si@log@debug{Font detection: sf}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathssf\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textsf\endcsname
+ \else
+ \ifnum\the\fam=\si@fam@tt
+ \si@log@debug{Font detection: tt}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathstt\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@texttt\endcsname
+ \else
+ \si@log@debug{Font detection: rm}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathsrm\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textrm\endcsname
+ \fi
+ \fi}
+\newcommand*{\si@fam@dettext}{%
+ \ifx\f@family\si@tempa
+ \si@log@debug{Font detection: sf}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathssf\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textsf\endcsname
+ \else
+ \ifx\f@family\si@tempb
+ \si@log@debug{Font detection: tt}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathstt\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@texttt\endcsname
+ \else
+ \si@log@debug{Font detection: rm}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathsrm\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textrm\endcsname
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@fam@setbold}
+%\begin{macro}{\si@fam@boldify}
+% For setting bold, a couple of control macros are needed.
+% \begin{macrocode}
+\newcommand*{\si@fam@setbold}{%
+ \si@log@debug{Weight detection: bold weight}%
+ \let\si@fam@bold\si@fam@boldify}
+\newcommand*{\si@fam@boldify}{\boldmath\bfseries}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+%\subsection{Formatting numbers}
+%\begin{macro}{\num}
+% The system used here is modelled on that in \numprint; the
+% input is broken down into single tokens, each one is examined and
+% the result is re-assembled into an output number. However, various
+% changes have been made to the system used, and so the macros here
+% are not simply renamed copies of those in \numprint. The user
+% macro \cs{num} sets any local keys, then calls the number
+% formatting macro on the processed number.\\
+%\cs{num}\oarg{options}\marg{num}
+% \begin{macrocode}
+\si@newrobustcmd*{\num}[2][]{%
+ \begingroup
+ \sisetup{#1}%
+ \si@fam@mode
+ \si@num@intabfalse
+ \si@log@debug{Processing \string\num\space input `#2'}%
+ \expandafter\si@out@num\expandafter{\si@num{#2}}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@num@intab}
+% A flag for processing inside a table is needed.
+% \begin{macrocode}
+\newif\ifsi@num@intab
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num}
+% This is the main processing macro. Unlike the related macro in
+% \numprint, the output of this macro is not subjected to any font
+% changes. That is left to one of the \cs{si@out@\ldots} macros. No
+% grouping is applied here; any call to \cs{si@num} (or any of the
+% sub-macros) must be within a group as the definitions used rely on
+% this. Grouping is not applied here so that other macros can get
+% the various separated parts of the input.\\
+%\cs{si@num}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@num}[1]{%
+% \end{macrocode}
+% The argument of the macro is fully expanded before any processing.
+% By using \cs{scantokens}, any odd problems from packages with
+% active characters can be avoided.
+% \begin{macrocode}
+ \si@num@fixpm
+ \begingroup
+ \makeatletter
+ \@makeother{\,}%
+ \@makeother{\.}%
+ \@makeother{\+}%
+ \@makeother{\-}%
+ \def~{}%
+ \def\,{}%
+ \catcode`\~=\active\relax
+ \catcode`\^=\active\relax
+ \everyeof{\noexpand}%
+ \endlinechar\m@ne
+ \protected@xdef\si@tempa{\scantokens{#1}}%
+ \endgroup
+% \end{macrocode}
+% Processing only takes place if there is actually something in the
+% argument. This is tested once ``hard'' spaces have been stripped
+% out; if there is input other than spaces, the processor first
+% checks the validity of the input, then moves on to format it.
+% \begin{macrocode}
+ \si@ifnotmtarg{\si@tempa}
+ {\si@num@ifvalid{\si@tempa}
+ {\si@num@format{\si@tempa}}
+% \end{macrocode}
+% The parser has to bailed-out, and so no further processing of
+% the input is done. Instead, whatever was passed to the macro is
+% returned as supplied.
+% \begin{macrocode}
+ {\si@log@err{Invalid character `#1' in numerical input}%
+ {Only characters from the list
+ `\si@numvalid'\MessageBreak should be present in the
+ argument of the \string\num\space macro\MessageBreak
+ (or derivative such as an `s' column)}%
+ {#1}}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@fixpm}
+%\begin{macro}{\si@num@pm}
+%\begin{macro}{\si@num@mp}
+%\begin{macro}{\pm}
+%\begin{macro}{\mp}
+% With certain packages loaded, there can be issues with \cs{pm} and
+% \cs{mp}. To avoid this, the \eTeX\ \cs{protected} system is
+% employed; this is only used within local groups.
+% \begin{macrocode}
+\newcommand*{\si@num@fixpm}{%
+ \let\si@num@pm\pm
+ \let\si@num@mp\mp
+ \protected\def\pm{\si@num@pm}%
+ \protected\def\mp{\si@num@mp}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@ifvalid}
+%\begin{macro}{\si@num@valid}
+% Assuming that there is a non-space argument to \cs{si@num}, every
+% character is checked to ensure it is valid in the context, so that
+% further processing can occur without sanity checks. If the
+% character is valid, recursion occurs.\\
+%\cs{si@num@ifvalid}\marg{chars}\\
+%\cs{si@num@valid}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@ifvalid}[1]{%
+ \begingroup
+ \si@switchtrue
+ \expandafter\si@num@valid#1\@empty\@empty
+ \ifsi@switch
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@num@valid#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numvalid}
+ {\ifx\@empty#2\@empty\else
+ \si@num@valid#2\@empty\@empty\@empty
+ \fi}
+ {\si@switchfalse}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@in}
+%\begin{macro}{\si@num@out}
+%\begin{macro}{\si@num@exp}
+%\begin{macro}{\si@num@expsign}
+%\begin{macro}{\si@num@mant}
+%\begin{macro}{\si@num@mantsign}
+%\begin{macro}{\si@num@err}
+%\begin{macro}{\si@num@xpart}
+%\begin{macro}{\si@num@ambig}
+%\begin{macro}{\si@tab@out}
+%\begin{macro}{\si@tab@expout}
+% Various storage macros are needed.
+% \begin{macrocode}
+\newcommand*{\si@num@in}{}
+\newcommand*{\si@num@out}{}
+\newcommand*{\si@num@exp}{}
+\newcommand*{\si@num@expsign}{}
+\newcommand*{\si@num@mant}{}
+\newcommand*{\si@num@mantsign}{}
+\newcommand*{\si@num@err}{}
+\newcommand*{\si@num@xpart}{}
+\newcommand*{\si@num@ambig}{}
+\newcommand*{\si@tab@out}{}
+\newcommand*{\si@tab@expout}{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@num@erropen}
+% A flag is set up for tracking unclosed errors.
+% \begin{macrocode}
+\newif\ifsi@num@erropen
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@format}
+%\begin{macro}{\si@num@arg}
+% The number processor starts by saving |#1| (odd things happen
+% otherwise). A hook is also provided to allow modifications by
+% other macros.\\
+%\cs{si@num@format}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@num@arg}{}
+\newcommand*{\si@num@format}[1]{%
+ \protected@edef\si@num@arg{#1}%
+ \si@log@debug{Formatting number `\si@num@arg'}%
+% \end{macrocode}
+%\end{macro}
+% The storage areas are emptied.
+% \begin{macrocode}
+ \renewcommand*{\si@num@in}{}%
+ \renewcommand*{\si@num@exp}{}%
+ \renewcommand*{\si@num@expsign}{}%
+ \renewcommand*{\si@num@mant}{}%
+ \renewcommand*{\si@num@mantsign}{}%
+ \renewcommand*{\si@num@err}{}%
+ \renewcommand*{\si@num@xpart}{}%
+% \end{macrocode}
+% Any ``x-part'' is now found, leaving the first number in
+% \cs{si@num@in} and anything else in \cs{si@num@xpart}.
+% \begin{macrocode}
+ \si@switchfalse
+ \expandafter\si@num@findxpart\si@num@arg\@empty\@empty
+% \end{macrocode}
+% The input is split into an mantissa and an exponent; the flag is
+% used here to indicate if an exponent is found. The mantissa will
+% end up in \cs{si@num@mant}, and the exponent in \cs{si@num@exp}.
+% \begin{macrocode}
+ \si@switchfalse
+ \si@num@sepmantexp{\si@num@in}%
+% \end{macrocode}
+% The sign and value of the mantissa and exponent are separated; the
+% mantissa is done after the exponent as this makes life easier when
+% using the table-formatting fork. Checks are then needed, as a sign
+% with no value is potentially-valid for the mantissa (for example
+% \num{-e10}).
+% \begin{macrocode}
+ \si@num@sepsign{exp}%
+ \si@num@sepsign{mant}%
+ \ifx\@empty\si@num@exp\@empty
+ \ifx\@empty\si@num@expsign\@empty\else
+ \si@log@warn{Sign but no number for `\si@num@arg'}%
+ \fi
+ \let\si@num@expsign\@empty
+ \fi
+ \ifx\@empty\si@num@mant\@empty
+ \ifx\@empty\si@num@mantsign\@empty\else
+ \ifx\@empty\si@num@exp\@empty
+ \si@log@warn{Sign but no number for `\si@num@arg'}%
+ \let\si@num@mantsign\@empty
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% A check for negative mantissa values is made, to allow some
+% colour-based trickery.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{{-}}%
+ \ifx\si@num@mantsign\si@tempa
+ \ifsi@colourneg
+ \expandafter\expandafter\expandafter\si@fam@colourcmd
+ \else
+ \expandafter\expandafter\expandafter\@gobble
+ \fi
+ \else
+ \expandafter\@gobble
+ \fi
+ {\si@negcolour}%
+% \end{macrocode}
+% The next stage is to process the remaining data, to find the
+% decimal marker and reformat correctly. These two macros control
+% this entire process. The exponent is processed first as this makes
+% life easier when the system is used to typeset tabular
+% material.\footnote{The contents of \cs{si@num@predec} and
+% \cs{si@num@postdec} are needed for the mantissa.}
+% \begin{macrocode}
+ \si@num@procnum{exp}%
+ \si@num@procnum{mant}%
+% \end{macrocode}
+% If the exponent is zero, then if might need to be deleted.
+% \begin{macrocode}
+ \si@str@ifonlychrs{\si@num@exp}{0\si@numdecimal}
+ {\ifsi@allowzeroexp\else
+ \renewcommand*{\si@num@exp}{}%
+ \ifx\@empty\si@num@mant\@empty
+ \renewcommand*{\si@num@mant}{1}%
+ \fi
+ \fi}{}%
+% \end{macrocode}
+% To build up the number for typesetting, a rather complex series
+% of tests is needed. First, the ``ambiguous error'' flag is
+% set if there is an exponent and the package has been asked to check
+% this. The same flag will already be true if a unit is present and
+% checking is active.
+% \begin{macrocode}
+ \ifx\@empty\si@num@exp\@empty\else
+ \ifsi@trapambigerr
+ \expandafter\expandafter\expandafter\si@num@ambigerrtrue
+ \fi
+ \fi
+% \end{macrocode}
+%\begin{macro}{\si@num@out}
+%\begin{macro}{\si@tab@out}
+%\begin{macro}{\si@tab@expout}
+% Processing now divides, as when used with the |S| column some extra
+% steps are needed. Inside a table, the macro \cs{si@tab@out} holds
+% the part of the mantissa before the decimal sign. The post-decimal
+% part then ends up in \cs{i@num@out}. On the other hand, under
+% normal circumstances the entire mantissa should be copied to
+% \cs{si@num@out}.
+% \begin{macrocode}
+ \protected@edef\si@num@out{%
+ \ensuremath{{\si@num@mantsign}}\si@num@mant}%
+ \renewcommand*{\si@tempa}{num}%
+ \ifsi@num@intab
+ \protected@edef\si@tab@out{%
+ \ensuremath{{\si@num@mantsign}}\si@num@predec}%
+ \protected@edef\si@num@out{\si@num@postdec}%
+ \renewcommand*{\si@tempa}{tab}%
+ \fi
+% \end{macrocode}
+% Now there is the error part to handle. For tables, a check has to
+% be made so the error ends up in the correct part of the number. The
+% value of \cs{si@tempa} is used to track this., and so is set up
+% here.
+% \begin{macrocode}
+ \ifx\@empty\si@num@postdec\@empty\else
+ \renewcommand*{\si@tempa}{num}%
+ \fi
+ \ifx\@empty\si@num@err\@empty\else
+% \end{macrocode}
+% If there is an error, and it is begin separated, the problem arises
+% of the potential for ambiguous values. This can only apply outside
+% of a table, as \opt{seperr} is disabled in tabular material.
+% \begin{macrocode}
+ \ifsi@seperr
+ \ifsi@num@ambigerr
+ \protected@edef\si@num@out{%
+ \ensuremath{\si@openerr}\si@num@out}%
+ \si@repeatunitsfalse
+ \expandafter\si@num@erropentrue
+ \else
+% \end{macrocode}
+% If there is an exponential part and an error, errors are being
+% separated and ambiguous errors are not trapped, then there is work
+% to do. The exponent part is added to the \emph{error}, and deleted
+% from the mantissa if necessary.
+% \begin{macrocode}
+ \ifsi@trapambigerr\else
+ \ifx\@empty\si@num@exp\@empty\else
+ \protected@edef\si@num@err{%
+ \si@num@err\expandafter\@car\si@numexp\@nil
+ \si@num@expsign\si@num@exp}%
+ \ifsi@repeatunits\else
+ \renewcommand*{\si@num@exp}{}%
+ \renewcommand*{\si@num@expsign}{}%
+ \fi
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% If \opt{seperr} is not in force, the error and mantissa have to be
+% recombined. This is handled so that the same macro deals with
+% tables and normal processing.
+% \begin{macrocode}
+ \else
+ \expandafter\protected@edef\csname
+ si@\si@tempa @out\endcsname{%
+ \si@num@out\ensuremath{\si@errspace}\ensuremath
+ {\si@openerr}\si@num@err\ensuremath{\si@closeerr}}%
+ \renewcommand*{\si@num@err}{}%
+ \fi
+ \fi
+% \end{macrocode}
+% The main reconstruction can now occur. This performs various
+% checks on the validity of the input, and adds the necessary
+% ``filler'' between the supplied data.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{num@out}%
+ \ifsi@num@erropen
+ \renewcommand*{\si@tempa}{num@ambig}%
+ \fi
+ \ifsi@num@intab
+ \renewcommand*{\si@tempa}{tab@expout}%
+ \fi
+ \ifx\@empty\si@num@exp\@empty
+ \ifx\@empty\si@num@mant\@empty
+ \si@log@err{Invalid number format `\si@num@arg'}
+ {Something is wrong with the number format; does it
+ contain \MessageBreak any numbers (from the list
+ `\si@numdigits')?}%
+ \renewcommand*\si@num@out{}%
+ \fi
+ \else
+ \ifx\@empty\si@num@mant\@empty\else
+ \expandafter\protected@edef\csname
+ si@\si@tempa\endcsname{%
+ \csname si@\si@tempa\endcsname\ensuremath{{}%
+ \si@expproduct{}}}%
+ \fi
+ \expandafter\protected@edef\csname
+ si@\si@tempa\endcsname{%
+ \csname si@\si@tempa\endcsname\si@expbase
+ \textsuperscript{\ensuremath{\si@num@expsign}%
+ \si@num@exp}}%
+ \fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% With everything done, the result is output.
+% \begin{macrocode}
+ \ifsi@num@intab\else
+ \expandafter\si@num@out
+ \fi
+% \end{macrocode}
+% If there is anything inside the ``x-part'', then there is now
+% more work to do.
+% \begin{macrocode}
+ \ifx\@empty\si@num@err\@empty\else
+ \expandafter\si@num@procerr
+ \fi
+ \ifsi@num@erropen
+ \expandafter\si@out@num\expandafter{%
+ \ensuremath{\si@closeerr}}%
+ \ifx\@empty\si@num@ambig\@empty\else
+ \expandafter\si@out@num\expandafter{\si@num@ambig}%
+ \renewcommand*{\si@num@ambig}{}%
+ \fi
+ \fi
+ \si@num@erropenfalse
+ \ifx\@empty\si@num@xpart\@empty\else
+ \expandafter\si@num@sepxpart
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@findxpart}
+% Before processing the number, any multiplied parts have to be found
+% and removed. As there can be more than one product sign, the
+% building process here has no error checking.
+% \begin{macrocode}
+\def\si@num@findxpart#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numprod}
+ {\si@switchtrue\si@seperrfalse}{}%
+ \ifsi@switch
+ \protected@edef\si@num@xpart{\si@num@xpart#1}%
+ \else
+ \protected@edef\si@num@in{\si@num@in#1}%
+ \fi
+ \ifx\@empty#2\@empty\else
+ \si@num@findxpart#2\@empty
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@sepmantexp}
+%\begin{macro}{\si@num@mantexp}
+% Splitting the mantissa and exponent first checks for characters to
+% gobble, which are simply thrown away. For any other input, there
+% are two possibilities. If the character is an exponent marker,
+% then the package switches from collecting the mantissa to
+% collecting the exponent (after a sanity check). All other
+% characters are added to either the mantissa or the exponent, as
+% appropriate.\\
+%\cs{si@num@sepmantexp}\marg{num}\\
+%\cs{si@num@mantexp}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@sepmantexp}[1]{%
+ \expandafter\si@num@mantexp#1\@empty\@empty}
+\def\si@num@mantexp#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numgobble}
+ {\si@log@debug{Gobbling `#1' in \si@num@arg}}
+ {\si@str@ifchrstr{#1}{\si@numexp}
+ {\ifsi@switch
+ \si@log@err{Duplicate exponent marker found}
+ {Only a single exponent character \MessageBreak
+ (from the list `\si@numexp')\MessageBreak may
+ occur in a numerical argument}%
+ \else
+ \si@log@debug{Exponent marker `#1' found in
+ `\si@num@arg'}%
+ \fi
+ \si@switchtrue}%
+ {\ifsi@switch
+ \expandafter\si@num@addexp
+ \else
+ \expandafter\si@num@addmnt
+ \fi
+ {#1}}}%
+% \end{macrocode}
+% If the recursion has not bottomed out, another loop occurs.
+% \begin{macrocode}
+ \ifx\@empty#2\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@sepmantexp
+ \fi
+ {#2}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@addmnt}
+%\begin{macro}{\si@num@addexp}
+%\begin{macro}{\si@num@addmntexp}
+% To allow \cs{expandafter} use in the above, the actual addition to the
+% appropriate macro is handled here.\\
+%\cs{si@num@addmnt}\marg{char}\\
+%\cs{si@num@addexp}\marg{char}\\
+%\cs{si@num@addmntexp}\marg{char}\marg{mant/exp}\marg{text}
+% \begin{macrocode}
+\newcommand*{\si@num@addmnt}[1]{%
+ \si@num@addmntexp{#1}{mant}{mantissa}}
+\newcommand*{\si@num@addexp}[1]{%
+ \si@num@addmntexp{#1}{exp}{exponent}}
+\newcommand*{\si@num@addmntexp}[3]{%
+ \si@log@debug{Adding `#1' to #3 for `\si@num@arg'}%
+ \expandafter\protected@edef\csname si@num@#2\endcsname{%
+ \csname si@num@#2\endcsname#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@sepsign}
+% The input is now tested for a sign. If one exists, it is
+% transferred into the \cs{si@num@}|#1sign| storage macro, with the
+% remained of the number in \cs{si@num@}|#1|. The only check made
+% directly here is that there is something to process.\\
+%\cs{si@num@sepsign}\marg{mant/exp}
+% \begin{macrocode}
+\newcommand*{\si@num@sepsign}[1]{%
+ \expandafter\ifx\expandafter\@empty
+ \csname si@num@#1\endcsname\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@gensign
+ \fi
+ {#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@gensign}
+% The sign generator starts by calling the procedure to check if the
+% input contains a valid one- or two-digit sign. The results are
+% returned as \cs{si@num@sign} and \cs{si@num@value}.\\
+%\cs{si@num@gensign}\marg{mant/exp}
+% \begin{macrocode}
+\newcommand*{\si@num@gensign}[1]{%
+ \expandafter\expandafter\expandafter\si@num@findsign
+ \csname si@num@#1\endcsname\@empty\@empty
+% \end{macrocode}
+% If no sign has been found, then there may be a need to add one
+% anyway.
+% \begin{macrocode}
+ \ifx\@empty\si@num@sign\@empty
+ \ifx\@empty\si@num@value\@empty
+ \expandafter\expandafter\expandafter\@gobble
+ \else
+ \expandafter\expandafter\expandafter\si@num@addsign
+ \fi
+ \else
+ \expandafter\@gobble
+ \fi
+ {#1}%
+% \end{macrocode}
+% The appropriate storage areas are now assigned.
+% \begin{macrocode}
+ \expandafter\let\csname si@num@#1sign\endcsname\si@num@sign
+ \expandafter\let\csname si@num@#1\endcsname\si@num@value}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@findsign}
+%\begin{macro}{\si@num@sign}
+%\begin{macro}{\si@num@value}
+% The first one or two characters of the mantissa or exponent may
+% contain a sign. To test for this, the first two characters of the
+% number are split off, and examined. Two characters are used so
+% that \cs{pm} and \cs{mp} can be represented by |+-| and |-+|,
+% respectively. To allow the user to alter the valid signs, but
+% retain this conversion, the generic character test is used before
+% checking specific matches.\\
+%\cs{si@num@findsign}\meta{char}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@sign}{}
+\def\si@num@findsign#1#2#3\@empty{%
+ \si@num@delplusfalse
+ \si@str@ifchrstr{#1}{\si@numsign}{%
+ \si@str@ifchrstr{#2}{\si@numsign}{%
+ \if +#1%
+ \if -#2%
+ \si@log@debug{Found sign combination +- for
+ `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{{\si@pm}}%
+ \else
+ \si@log@inf{Unknown sign combination `#1#2'}%
+ \renewcommand*{\si@num@sign}{{#1#2}}%
+ \fi
+ \else
+ \if -#1%
+ \if +#2%
+ \si@log@debug{Found sign combination -+ for
+ `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{{\mp}}%
+ \else
+ \si@log@inf{Unknown sign combination `#1#2'}%
+ \renewcommand*{\si@num@sign}{{#1#2}}%
+ \fi
+ \else
+ \si@log@inf{Unknown sign combination `#1#2'}%
+ \renewcommand*{\si@num@sign}{{#1#2}}%
+ \fi
+ \fi
+ \protected@edef\si@num@value{#3}}%
+% \end{macrocode}
+% Only one valid sign character.
+% \begin{macrocode}
+ {\si@log@debug{Found single sign character `#1' for
+ `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{{#1}}%
+ \if +#1%
+ \ifsi@retainplus\else
+ \expandafter\expandafter\expandafter\si@num@killsign
+ \fi
+ \fi
+ \protected@edef\si@num@value{#2#3}}}%
+% \end{macrocode}
+% No valid sign, so \cs{@empty} is returned for the sign .
+% \begin{macrocode}
+ {\si@log@debug{No sign found for `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{}%
+ \protected@edef\si@num@value{#1#2#3}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@num@delplus}
+%\begin{macro}{\si@num@killsign}
+% A simple spin-out to remove a plus sign. A flag is set as it might
+% be useful to know this.
+% \begin{macrocode}
+\newif\ifsi@num@delplus
+\newcommand*{\si@num@killsign}{%
+ \si@num@delplustrue
+ \renewcommand*{\si@num@sign}{}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@addsign}
+%\begin{macro}{\si@num@asign}
+% The macro to add a sign to an unsigned number has to check whether
+% this is a mantissa or an exponent. The result is still placed in
+% \cs{si@num@sign} for ease of processing later.\\
+%\cs{si@num@addsign}\marg{mant/exp}\\
+%\cs{si@num@asign}\marg{mantissa/exponent}
+% \begin{macrocode}
+\newcommand*{\si@num@addsign}[1]{%
+ \begingroup
+ \renewcommand*{\si@tempa}{#1}%
+ \renewcommand*{\si@tempb}{mant}%
+ \ifx\si@tempa\si@tempb
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup
+ {\ifsi@num@signmant
+ \expandafter\si@num@asign
+ \else
+ \expandafter\@gobble
+ \fi
+ {mantissa}}
+ {\ifsi@num@signexp
+ \expandafter\si@num@asign
+ \else
+ \expandafter\@gobble
+ \fi
+ {exponent}}}
+\newcommand*{\si@num@asign}[1]{%
+ \let\si@num@sign\si@sign
+ \si@log@debug{Adding sign \si@sign\space to #1 for
+ `\si@num@arg'}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@procnum}
+% The control macro for processing the number (plus any extra
+% characters).
+%\cs{si@num@finddigits}\marg{mant/exp}
+% \begin{macrocode}
+\newcommand*{\si@num@procnum}[1]{%
+ \expandafter\ifx\expandafter\@empty
+ \csname si@num@#1\endcsname\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@finddigits
+ \fi
+ {#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@predec}
+%\begin{macro}{\si@num@postdec}
+% Two new storage areas are defined.
+% \begin{macrocode}
+\newcommand*{\si@num@predec}{}
+\newcommand*{\si@num@postdec}{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@finddigits}
+% The core digit processor divides the number into the parts before
+% and after the decimal point marker. The temporary switch is used
+% to indicate finding a decimal marker.\\
+%\cs{si@num@finddigits}\marg{mant/exp}
+% \begin{macrocode}
+\newcommand*{\si@num@finddigits}[1]{%
+ \renewcommand*{\si@num@predec}{}%
+ \renewcommand*{\si@num@postdec}{}%
+ \si@switchfalse
+ \expandafter\expandafter\expandafter\si@num@digits
+ \csname si@num@#1\endcsname\@empty\@empty
+% \end{macrocode}
+% Tests are now made to see if padding zeros are needed. The
+% trailing test needs to verify if a decimal marker was found, as
+% well as if a zero is needed.
+% \begin{macrocode}
+ \ifx\@empty\si@num@predec\@empty
+ \ifsi@num@padlead
+ \expandafter\expandafter\expandafter\si@num@addprezero
+ \fi
+ \fi
+ \ifx\@empty\si@num@postdec\@empty
+ \ifsi@num@padtrail
+ \ifsi@switch
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \si@num@addpostzero
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% The next checks to make concern input validity in a more
+% mathematical sense. First, if the number is zero, then no sign
+% should be given under any circumstances. Then leading zeros need
+% to be removed from the input. This is slightly complicated by the
+% potential presence of ``extra'' characters.
+% \begin{macrocode}
+ \si@num@unsign{#1}%
+ \ifx\@empty\si@num@predec\@empty
+ \else
+ \expandafter\si@num@nozero
+ \fi
+% \end{macrocode}
+% A sanity check is made to ensure that the supplied number consisted
+% of more than a decimal marker.
+% \begin{macrocode}
+ \ifx\@empty\si@num@predec\@empty
+ \ifx\@empty\si@num@postdec\@empty
+ \expandafter\expandafter\expandafter\@gobble
+ \else
+ \expandafter\expandafter\expandafter\si@num@sepdigits
+ \fi
+ \else
+ \expandafter\si@num@sepdigits
+ \fi
+ {#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@digits}
+%\begin{macro}{\si@num@pre}
+%\begin{macro}{\si@num@post}
+%\begin{macro}{\si@num@prepost}
+% The \cs{si@num@digits} macro compares each character in the input
+% against the list of characters valid at this stage: numbers,
+% decimal markers and ``extra'' characters.
+%\cs{si@num@digits}\meta{char}\meta{chars}\cs{@empty}\\
+%\cs{si@num@pre}\marg{num}\\
+%\cs{si@num@pre}\marg{num}\\
+%\cs{si@num@prepost}\marg{num}\marg{pre/post}\marg{text}
+% \begin{macrocode}
+\def\si@num@digits#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numdecimal}
+ {\ifsi@switch
+ \si@log@err{Duplicate decimal marker in `\si@num@arg'}
+ {Only a single decimal marker (from the list
+ `\si@numdecimal')\MessageBreak may occur in a
+ numerical argument}%
+ \else
+ \si@log@debug{Found decimal marker `#1' in
+ `\si@num@arg'}%
+ \expandafter\si@switchtrue
+ \fi}
+% \end{macrocode}
+% The earlier code only checks for a sign at the start of the text. A
+% check is therefore needed for a sign after the first two
+% characters; if one is found, it is ignored.
+% \begin{macrocode}
+ {\si@str@ifchrstr{#1}{\si@numsign}
+ {\si@log@err{Misplaced sign character
+ `#1' in `\si@num@arg'}
+ {Sign characters `\si@numsign' can only
+ occur\MessageBreak at the start of a number}}
+% \end{macrocode}
+% The current character is added to the appropriate stack; this is
+% ``spun out'' to avoid problems with expansion of the switch code.
+% \begin{macrocode}
+ {\ifsi@switch
+ \expandafter\si@num@post
+ \else
+ \expandafter\si@num@pre
+ \fi
+ {#1}}}%
+ \ifx\@empty#2\@empty\else
+ \si@num@digits#2\@empty\@empty
+ \fi}
+\newcommand*{\si@num@pre}[1]{%
+ \si@num@prepost{#1}{pre}{integer}}
+\newcommand*{\si@num@post}[1]{%
+ \si@num@prepost{#1}{post}{decimal}}
+\newcommand*{\si@num@prepost}[3]{%
+ \expandafter\protected@edef\csname si@num@#2dec\endcsname{%
+ \csname si@num@#2dec\endcsname#1}%
+ \si@log@debug{Adding `#1' to #3 part for `\si@num@arg'}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@addprezero}
+%\begin{macro}{\si@num@addpostzero}
+%\begin{macro}{\si@num@addpzero}
+% A similar set of macros are used for the padding zeros.\\
+%\cs{si@num@addpzero}\marg{pre/post}\marg{text}
+% \begin{macrocode}
+\newcommand*{\si@num@addprezero}{%
+ \si@num@addpzero{pre}{leading}}
+\newcommand*{\si@num@addpostzero}{%
+ \si@num@addpzero{post}{trailing}}
+\newcommand*{\si@num@addpzero}[2]{%
+ \si@log@debug{Adding #2 zero for `\si@num@arg'}%
+ \@namedef{si@num@#1dec}{0}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@unsign}
+%\begin{macro}{\si@num@nosign}
+% The trap for a sign with zero numerical input is made. First, a
+% check is made to see if there is a sign to worry about. The pre-
+% and post-decimal parts are then examined, to see if they contain
+% something other than ``0'' or an extra character.\\
+%\cs{si@num@unsign}\marg{mant/exp}\\
+%\cs{si@num@nosign}\marg{mant/exp}
+% \begin{macrocode}
+\newcommand*{\si@num@unsign}[1]{%
+ \expandafter\ifx\expandafter\@empty
+ \csname si@num@#1sign\endcsname\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@nosign
+ \fi
+ {#1}}
+\newcommand*{\si@num@nosign}[1]{%
+ \begingroup
+ \si@switchtrue
+ \si@str@ifonlychrs{\si@num@predec\si@num@postdec}{0}
+ {\si@switchfalse}{}%
+ \ifsi@switch
+ \aftergroup\@gobble
+ \else
+ \aftergroup\@firstofone
+ \fi
+ \endgroup
+ {\si@log@debug{Zero value: removing any sign}%
+ \ifsi@ang@sign\else
+ \@namedef{si@num@#1sign}{}%
+ \fi}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@nozero}
+% A very short test for a totally zero pre-decimal component.
+% \begin{macrocode}
+\newcommand*{\si@num@nozero}{%
+ \si@str@ifonlychrs{\si@num@predec}{0}
+ {\renewcommand*{\si@num@predec}{0}}{}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@decimalhook}
+% A hook is needed to attach things inside the group to happen
+% afterwards, if the number is a decimal.
+% \begin{macrocode}
+\newcommand*{\si@num@decimalhook}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@sepdigits}
+% The \cs{si@num@sepdigits} macro is only called if at least one of
+% the mantissa and exponent contain something to output.\\
+%\cs{si@num@sepdigits}\marg{mant/exp}
+% \begin{macrocode}
+\newcommand*{\si@num@sepdigits}[1]{%
+% \end{macrocode}
+% First an overall check is needed for additional characters. By
+% altering the contents of \cs{si@numextra}, the same code can be
+% shared by two different checks.
+% \begin{macrocode}
+ \begingroup
+ \let\si@numextra\si@numaddn
+ \protected@edef\si@tempa{\si@num@predec\si@num@postdec}%
+ \si@num@ifextra{\si@tempa}
+ {\aftergroup\@gobble}
+ {\aftergroup\@firstofone}%
+ \endgroup
+% \end{macrocode}
+% Separation of the error in a number from the number itself is only
+% attempted for the mantissa.
+% \begin{macrocode}
+ {\renewcommand*{\si@tempb}{mant}%
+ \renewcommand*{\si@tempc}{#1}%
+ \ifx\si@tempb\si@tempc
+ \expandafter\si@num@checkerr
+ \fi}%
+% \end{macrocode}
+% If both parts of the number contain only digits, then any rounding
+% can be attempted if there is no error part. Otherwise, the input
+% must be left alone.
+% \begin{macrocode}
+ \protected@edef\si@tempa{\si@num@predec\si@num@postdec}%
+ \expandafter\si@str@ifonlychrs\expandafter{\si@tempa}
+ {0123456789}
+ {\ifx\@empty\si@num@err\@empty
+ \ifsi@fixdp
+ \expandafter\expandafter\expandafter\si@num@fixdp
+ \fi
+ \fi}{}%
+% \end{macrocode}
+% If the pre-decimal part contains nothing except numbers, then
+% digit separation is carried out.
+% \begin{macrocode}
+ \si@num@ifextra{\si@num@predec}{}
+ {\expandafter\si@num@int\expandafter{\si@num@predec}}%
+% \end{macrocode}
+% A decision is made about the decimal sign, then digit separation
+% occurs on the post-decimal part of the number.
+% \begin{macrocode}
+ \renewcommand*{\si@tempc}{}%
+ \ifx\@empty\si@num@postdec\@empty\else
+ \si@num@decimalhook
+ \renewcommand*{\si@tempc}{%
+ \ensuremath{{\si@decimalsymbol}}}%
+ \si@num@ifextra{\si@num@postdec}{}
+ {\expandafter\si@num@dec\expandafter{\si@num@postdec}}%
+ \fi
+% \end{macrocode}
+% The construction is finalised by re-combining the number.
+% \begin{macrocode}
+ \expandafter\protected@edef\csname si@num@#1\endcsname
+ {\si@num@predec\si@tempc\si@num@postdec}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@ifextra}
+%\begin{macro}{\si@num@extra}
+% A relatively simple test for ``extra'' characters. Once again, a
+% bit of group trickery is used.\\
+%\cs{si@num@ifextra}\marg{integer}\\
+%\cs{si@num@extra}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@ifextra}[1]{%
+ \begingroup
+ \si@switchfalse
+ \expandafter\si@num@extra#1\@empty\@empty
+ \ifsi@switch
+ \si@log@debug{Found `extra' characters in `#1'}%
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@num@extra#1#2\@empty{%
+ \ifx\@empty#1\@empty\else
+ \si@str@ifchrstr{#1}{\si@numextra}{\si@switchtrue}{}%
+ \ifx\@empty#2\@empty\else
+ \si@num@extra#2\@empty\@empty
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@num@ambigerr}
+%\begin{macro}{\si@num@checkerr}
+% When separating out an error from a number, the first step is to
+% see if there is a decimal part to the number. If so, any error
+% must be in that part of the decimal part; it is not possible to
+% have an error starting in the integer part and continuing into the
+% decimal part.
+% \begin{macrocode}
+\newif\ifsi@num@ambigerr
+\newcommand*{\si@num@checkerr}{%
+ \ifx\@empty\si@num@postdec\@empty
+ \expandafter\si@num@preerr
+ \else
+ \expandafter\si@num@posterr
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@preerr}
+% Errors in integers are easy to handle. After finding the error,
+% the result is simply stored in the error macro \cs{si@num@err}.
+% \begin{macrocode}
+\newcommand*{\si@num@preerr}{%
+ \si@num@seperr{pre}%
+ \ifx\@empty\si@tempb\@empty\else
+ \expandafter\renewcommand\expandafter*\expandafter
+ \si@num@err\expandafter{\si@tempb}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@posterr}
+%\begin{macro}{\si@num@psterr}
+% Life is more complex for an error in the decimal part. This is
+% found, then it may need zero-filling or the insertion of a decimal
+% point. This depends on whether the number of error digits is
+% larger than the number of post-decimal digits.
+% \begin{macrocode}
+\newcommand*{\si@num@posterr}{%
+ \si@num@seperr{post}%
+ \ifx\@empty\si@tempb\@empty\else
+ \ifsi@seperr
+ \expandafter\expandafter\expandafter\si@num@psterr
+ \else
+ \let\si@num@err\si@tempb
+ \fi
+ \fi}
+\newcommand*{\si@num@psterr}{%
+ \si@num@cntdigits{\si@tempb}%
+ \si@tempcntb\si@tempcnta\relax
+ \si@num@cntdigits{\si@num@postdec}%
+ \ifnum\si@tempcnta<\si@tempcntb\relax
+ \expandafter\si@num@largeerr
+ \else
+ \expandafter\si@num@smallerr
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@seperr}
+%\begin{macro}{\si@num@finderr}
+% The usual hand-off is made for searching for an error.\\
+%\cs{si@num@seperr}\marg{pre/post}\\
+%\cs{si@num@finderr}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@seperr}[1]{%
+ \si@switchfalse
+ \renewcommand*{\si@tempa}{}%
+ \renewcommand*{\si@tempb}{}%
+ \expandafter\expandafter\expandafter\si@num@finderr
+ \csname si@num@#1dec\endcsname\@empty\@empty
+ \ifx\@empty\si@tempb\@empty\else
+ \expandafter\let\csname si@num@#1dec\endcsname\si@tempa
+ \fi}
+\def\si@num@finderr#1#2\@empty{%
+% \end{macrocode}
+% First a check for the opening character of an error.
+% \begin{macrocode}
+ \si@str@ifchrstr{#1}{\si@numopenerr}
+% \end{macrocode}
+% If the switch is set when an error is found, then something is
+% wrong.
+% \begin{macrocode}
+ {\ifsi@switch
+ \si@log@err{Invalid error in number}
+ {The numerical argument \si@num@arg\space has two (or
+ more)\MessageBreak error-opening characters}%
+ \else
+ \expandafter\si@switchtrue
+ \fi}
+% \end{macrocode}
+% The end-of-error character has to be the last item of the input,
+% and an error needs to start before it ends.
+% \begin{macrocode}
+ {\si@str@ifchrstr{#1}{\si@numcloseerr}
+ {\ifsi@switch
+ \ifx\@empty#2\@empty\else
+ \si@log@err{Invalid error in number}
+ {The numerical argument \si@num@arg\space has an
+ error-closing before the last character}%
+ \fi
+ \else
+ \si@log@err{Invalid error in number}
+ {The numerical argument \si@num@arg\space has an
+ error-closing character\MessageBreak but no
+ error-opening one}%
+ \fi}
+% \end{macrocode}
+% The input must be a digit. It is stored in the appropriate area.
+% \begin{macrocode}
+ {\ifsi@switch
+ \expandafter\si@num@addtmpb
+ \else
+ \expandafter\si@num@addtmpa
+ \fi
+ {#1}}}%
+ \ifx\@empty#2\@empty\else
+ \si@num@finderr#2\@empty
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@addtmpa}
+%\begin{macro}{\si@num@addtmpb}
+%\begin{macro}{\si@num@addtmp}
+% Some quick methods for adding to the temporary macros with \cs{if}
+% expansion.\\
+%\cs{si@num@addtmpa}\marg{num}\\
+%\cs{si@num@addtmpb}\marg{num}\\
+%\cs{si@num@addtmp}\marg{a/b}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@num@addtmpa}[1]{\si@num@addtmp{a}{#1}}
+\newcommand*{\si@num@addtmpb}[1]{\si@num@addtmp{b}{#1}}
+\newcommand*{\si@num@addtmp}[2]{%
+ \expandafter\protected@edef\csname si@temp#1\endcsname{%
+ \csname si@temp#1\endcsname#2}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@cntdigits}
+%\begin{macro}{\si@num@cntdgt}
+% A recursive system for counting the number of characters in a given
+% input; only used here to count digits in a number.\\
+%\cs{si@num@cntdigits}\marg{num}\\
+%\cs{si@num@cntdgt}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@cntdigits}[1]{%
+ \si@tempcnta\z@\relax
+ \expandafter\si@num@cntdgt#1\@empty\@empty}
+\def\si@num@cntdgt#1#2\@empty{%
+ \ifx\@empty#1\@empty\else
+ \advance\si@tempcnta\@ne\relax
+ \fi
+ \ifx\@empty#2\@empty\else
+ \expandafter\si@num@cntdgt#2\@empty
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@smallerr}
+%\begin{macro}{\si@num@serr}
+% For handling an error with no more digits than the post-decimal
+% part of a number, zero-padding is undertaken before adding a
+% decimal sign and (possibly) leading zero.
+% \begin{macrocode}
+\newcommand*{\si@num@smallerr}{%
+ \si@tempcntb\si@tempcnta\relax
+ \si@num@serr
+ \protected@edef\si@num@err{%
+ \ifsi@num@padlead0\fi\expandafter\@car\si@numdecimal\@nil
+ \si@tempb}}
+\newcommand*{\si@num@serr}{%
+ \si@num@cntdigits{\si@tempb}%
+ \ifnum\si@tempcnta=\si@tempcntb\relax\else
+ \protected@edef\si@tempb{0\si@tempb}%
+ \expandafter\si@num@serr
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@largeerr}
+%\begin{macro}{\si@num@lerr}
+%\begin{macro}{\si@num@movedigit}
+% When the error has more digits than the decimal part, some
+% shuffling is needed.\\
+%\cs{si@num@movedigit}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@largeerr}{%
+ \renewcommand*{\si@tempa}{}%
+ \si@tempcntb\si@tempcnta\relax
+ \si@num@lerr
+ \protected@edef\si@num@err{%
+ \si@tempa\ensuremath{\si@decimalsymbol}\si@tempb}}
+\newcommand*{\si@num@lerr}{%
+ \si@num@cntdigits{\si@tempb}%
+ \ifnum\si@tempcnta=\si@tempcntb\relax\else
+ \expandafter\si@num@movedigit\si@tempb\@empty\@empty
+ \si@num@lerr
+ \fi}
+\def\si@num@movedigit#1#2\@empty{%
+ \protected@edef\si@tempa{\si@tempa#1}%
+ \protected@edef\si@tempb{#2}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@fixdp}
+% The test for fixing decimal places starts by counting up the number
+% of decimal digits. The number is then padded, rounded or left
+% alone.
+% \begin{macrocode}
+\newcommand*{\si@num@fixdp}{%
+ \si@num@cntdigits{\si@num@postdec}%
+ \ifx\@empty\si@num@postdec\@empty
+ \si@tempcnta\z@\relax
+ \fi
+ \ifnum\si@tempcnta>\si@num@dp\relax
+ \expandafter\si@num@round
+ \else
+ \ifnum\si@tempcnta<\si@num@dp\relax
+ \expandafter\expandafter\expandafter\si@num@pad
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@pad}
+%\begin{macro}{\si@num@pd}
+% Padding a number is a relatively easy matter. The number of digits
+% is increased by adding ``$0$'' recursively.
+% \begin{macrocode}
+\newcommand*{\si@num@pad}{%
+ \si@log@debug{Padding to \the\si@num@dp\space digits}%
+ \loop\ifnum\si@tempcnta<\si@num@dp\si@num@pd\repeat}
+\newcommand*{\si@num@pd}{%
+ \advance\si@tempcnta\@ne\relax
+ \protected@edef\si@num@postdec{\si@num@postdec0}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@round}
+%\begin{macro}{\si@num@prernd}
+%\begin{macro}{\si@num@postrnd}
+%\begin{macro}{\si@num@reverse}
+%\begin{macro}{\si@num@rev}
+% Rounding a number is more complicated. The main macro here relies
+% on several others. The initial stage is to reverse the entire
+% number, to make life easier. This is then undone by the other
+% macros as the output is constructed.\\
+%\cs{si@num@reverse}\marg{macro}\\
+%\cs{si@num@rev}\meta{char}\meta{chars}\cs{@empty}
+% \begin{macrocode}
+\newcommand*{\si@num@prernd}{}
+\newcommand*{\si@num@postrnd}{}
+\newcommand*{\si@num@round}{%
+ \si@log@debug{Rounding to \the\si@num@dp\space digits}%
+ \si@num@reverse{\si@num@postdec}%
+ \si@num@reverse{\si@num@predec}%
+ \let\si@num@prernd\si@num@predec
+ \let\si@num@postrnd\si@num@postdec
+ \renewcommand*{\si@num@predec}{}%
+ \renewcommand*{\si@num@postdec}{}%
+ \si@switchfalse
+ \si@num@rnd}
+\newcommand*{\si@num@reverse}[1]{%
+ \renewcommand*{\si@tempa}{}%
+ \expandafter\si@num@rev#1\@empty\@empty
+ \let#1\si@tempa}
+\def\si@num@rev#1#2\@empty{%
+ \edef\si@tempa{#1\si@tempa}%
+ \ifx\@empty#2\@empty\else
+ \si@num@rev#2\@empty\@empty
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@rnd}
+%\begin{macro}{\si@num@rndpre}
+%\begin{macro}{\si@num@rndpost}
+% The core looping macro of the system simply divides the flow
+% between rounding before and after the decimal. The two routines
+% are quite similar, but have subtly different requirements. Both
+% take one character at a time from the input, increment if there is
+% a carry digit, check its value, and add to the output string.
+% \begin{macrocode}
+\newcommand*{\si@num@rnd}{%
+ \ifnum\si@tempcnta>\z@\relax
+ \expandafter\si@num@rndpost
+ \else
+ \expandafter\si@num@rndpre
+ \fi}
+\newcommand*{\si@num@rndpre}{%
+ \expandafter\edef\expandafter\si@tempa\expandafter{%
+ \expandafter\@car\si@num@prernd\@nil}%
+ \expandafter\edef\expandafter\si@num@prernd\expandafter{%
+ \expandafter\@cdr\si@num@prernd\@nil}%
+ \si@tempcntb\si@tempa\relax
+ \ifsi@switch
+ \advance\si@tempcntb\@ne\relax
+ \fi
+ \si@switchfalse
+ \ifnum\si@tempcntb=10\relax
+ \si@tempcntb\z@\relax
+ \expandafter\expandafter\expandafter\si@switchtrue
+ \fi
+ \edef\si@num@predec{\the\si@tempcntb\si@num@predec}%
+ \ifx\@empty\si@num@prernd\@empty
+ \ifsi@switch
+ \edef\si@num@predec{1\si@num@predec}%
+ \fi
+ \else
+ \expandafter\si@num@rnd
+ \fi}
+\newcommand*{\si@num@rndpost}{%
+ \expandafter\edef\expandafter\si@tempa\expandafter{%
+ \expandafter\@car\si@num@postrnd\@nil}%
+ \expandafter\edef\expandafter\si@num@postrnd\expandafter{%
+ \expandafter\@cdr\si@num@postrnd\@nil}%
+ \si@tempcntb\si@tempa\relax
+ \ifsi@switch
+ \advance\si@tempcntb\@ne\relax
+ \fi
+ \si@switchfalse
+ \ifnum\si@tempcnta>\si@num@dp\relax
+ \ifnum\si@tempcntb>4\relax
+ \expandafter\expandafter\expandafter\si@switchtrue
+ \fi
+ \else
+ \ifnum\si@tempcntb=10\relax
+ \si@tempcntb\z@\relax
+ \expandafter\expandafter\expandafter\si@switchtrue
+ \fi
+ \edef\si@num@postdec{\the\si@tempcntb\si@num@postdec}%
+ \fi
+ \advance\si@tempcnta\m@ne\relax
+ \si@num@rnd}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@int}
+% The formatting code for separating thousands is taken more-or-less
+% directly from \SIstyle. A few changes are made to fit the various
+% conventions here. Following on from the code above, \cs{si@tempa}
+% is used to store the integer part of the number, and \cs{si@tempb}
+% is used for the decimal part.\\
+%\cs{si@num@int}\marg{integer-part}
+% \begin{macrocode}
+\newcommand*{\si@num@int}[1]{%
+ \renewcommand*{\si@num@predec}{}%
+ \ifsi@sepfour
+ \si@num@intfmt{}#1\@empty\@empty\@empty
+ \else
+ \si@num@iffive{#1}
+ {\si@num@intfmt{}#1\@empty\@empty\@empty}
+ {\renewcommand*{\si@num@predec}{#1}}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@iffive}
+%\begin{macro}{\si@num@five}
+% A test is needed for the presence of more than four characters.\\
+%\cs{si@num@iffive}\marg{num}\\
+%\cs{si@num@five}\meta{char}\meta{char}\meta{char}\meta{char}^^A
+%\meta{chars}\cs{end}
+% \begin{macrocode}
+\newcommand*{\si@num@iffive}[1]{%
+ \si@num@five#1\@empty\@empty\@empty\@empty\@empty\end}
+\def\si@num@five#1#2#3#4#5\end{%
+ \ifx\@empty#5\@empty
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@intfmt}
+%\begin{macro}{\si@num@fiint}
+% The business end of the integer formatter.\\
+%\cs{si@num@intfmt}\marg{char}\marg{char}\marg{char}\marg{char}\\
+%\cs{si@num@fiint}\meta{chars}\cs{fi}\cs{fi}\cs{fi}
+% \begin{macrocode}
+\newcommand*{\si@num@intfmt}[4]{%
+ \ifx\@empty#2\@empty
+ \si@num@intsep#1\relax
+ \else
+ \ifx\@empty#3\@empty
+ \si@num@intsep\@empty\@empty#1#2\relax
+ \else
+ \ifx\@empty#4\@empty
+ \si@num@intsep\@empty#1#2#3\relax
+ \else
+ \si@num@fiint{#1#2#3#4}%
+ \fi
+ \fi
+ \fi}
+\def\si@num@fiint#1\fi\fi\fi{\fi\fi\fi\si@num@intfmt{#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@intsep}
+% For adding separation to integers, an extra function is needed.\\
+%\cs{si@num@intsep}\marg{char}\marg{char}\marg{char}\marg{char}
+% \begin{macrocode}
+\newcommand*{\si@num@intsep}[4]{%
+ \protected@edef\si@num@predec{\si@num@predec#1#2#3}%
+ \if\relax#4\relax\else
+ \protected@edef\si@num@predec{%
+ \si@num@predec\ensuremath{\noexpand\si@digitsep}}%
+ \expandafter\si@num@intsep\expandafter#4%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@dec}
+%\begin{macro}{\si@num@decfmt}
+% Formatting a decimal uses a similar mechanism, but with a few
+% alterations needed.\\
+%\cs{si@num@dec}\marg{decimal-part}\\
+%\cs{si@num@decfmt}\marg{char}\marg{char}\marg{char}\marg{char}
+% \begin{macrocode}
+\newcommand*{\si@num@dec}[1]{%
+ \renewcommand*{\si@num@postdec}{}%
+ \ifsi@sepfour
+ \si@num@decfmt#1\@empty\@empty\@empty\@empty
+ \else
+ \si@num@iffive{#1}
+ {\si@num@decfmt#1\@empty\@empty\@empty\@empty}
+ {\protected@edef\si@num@postdec{\si@num@postdec#1}}%
+ \fi}
+\newcommand*{\si@num@decfmt}[4]{%
+ \protected@edef\si@num@postdec{\si@num@postdec#1#2#3}%
+ \ifx\@empty#4\@empty%
+ \else
+ \protected@edef\si@num@postdec{%
+ \si@num@postdec\ensuremath{\noexpand\si@digitsep}}%
+ \expandafter\si@num@decfmt\expandafter#4%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@procerr}
+% Any error is recycled to to formatted correctly. The $\pm$ sign,
+% and any unit, are also added.
+% \begin{macrocode}
+\newcommand*{\si@num@procerr}{%
+ \si@num@addunit
+ \ensuremath{\si@pm}%
+ \expandafter\si@num\expandafter{\si@num@err}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@sepxpart}
+% A similar approach for numbers containing products, except the
+% first token of the input has to be deleted.
+% \begin{macrocode}
+\newcommand*{\si@num@sepxpart}{%
+ \si@num@addunit
+ \ensuremath{\times}%
+ \expandafter\expandafter\expandafter\si@num\expandafter
+ \expandafter\expandafter{%
+ \expandafter\@cdr\si@num@xpart\@nil}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@addunit}
+% A short macro to add units if needed.
+% \begin{macrocode}
+\newcommand*{\si@num@addunit}{%
+ \si@unt@numtrue
+ \ifx\@empty\si@unt@unitarg\@empty\else
+ \ifsi@repeatunits
+ \si@unt@printunit{\si@unt@unitarg}%
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Formatting angles}
+%\begin{macro}{\ang}
+% The approach used here is similar to that in \SIstyle, but has been
+% modified in a few ways.\\
+%\cs{ang}\oarg{options}\marg{decimal-angle}\\
+%\cs{ang}\oarg{options}|{|\meta{deg};\meta{min};\meta{sec}|}|
+% \begin{macrocode}
+\si@newrobustcmd*{\ang}[2][]{%
+ \begingroup
+ \sisetup{#1}%
+ \si@fam@mode
+ \si@log@debug{Processing \string\ang\space input `#2'}%
+ \@makeother{\;}%
+ \makeatletter
+ \scantokens{\si@ang@parse#2;;;\@nil}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@ang@parse}
+% With the correct catcodes in place, processing can take place strip
+% out the semi-colons. Here, the input must either contain no
+% semi-colons or two semi-colons.\\
+%\cs{si@ang@parse}\meta{num}|;|\meta{num}|;|\meta{num}|;|^^A
+%\meta{chars}\cs{@nil}
+% \begin{macrocode}
+\def\si@ang@parse#1;#2;#3;#4\@nil{%
+ \let\ifsi@ang@fixdp\ifsi@fixdp
+ \si@fixdpfalse
+ \si@ifmtarg{#4}
+ {\si@log@debug{Angle argument contains no
+ semi-colons:\MessageBreak decimal angle}%
+ \si@ang@dec{#1}{}{}}
+ {\si@log@debug{Angle argument contains
+ semi-colons:\MessageBreak degree-minute-second angle}%
+ \renewcommand*{\si@tempa}{#4}%
+ \renewcommand*{\si@tempb}{;;}%
+ \ifx\si@tempa\si@tempb\else
+ \ifsi@strictarc
+ \renewcommand*{\si@tempb}{;}%
+ \ifx\si@tempa\si@tempb
+ \si@log@err{Insufficient semi-colons in argument
+ of \string\ang}{The argument of
+ \string\ang\space must contain either no
+ semi-colons or exactly two}%
+ \else
+ \si@log@err{Excess semi-colons in argument of
+ \string\ang}{The argument of \string\ang\space
+ must contain either no semi-colons or exactly
+ two}%
+ \fi
+ \fi
+ \fi
+ \si@ang@arc{#1}{#2}{#3}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@ang@dec}
+%\begin{macro}{\si@ang@arc}
+% Two tests are needed, in case the input format requires conversion.
+% \begin{macrocode}
+\newcommand*{\si@ang@dec}{%
+ \let\si@ang@fix\@gobble
+ \ifsi@ang@toarc
+ \expandafter\si@ang@dectoarc
+ \else
+ \sisetup{padangle=none}\expandafter\si@ang@typeset
+ \fi}
+\newcommand*{\si@ang@arc}{%
+ \let\si@ang@fix\si@ang@arcfix
+ \ifsi@ang@todec
+ \expandafter\si@ang@arctodec
+ \else
+ \expandafter\si@ang@typeset
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@ang@fixdp}
+%\begin{macro}{\si@ang@fix}
+%\begin{macro}{\si@ang@arcfix}
+% A check is needed so that rounding and zero filling are only
+% applied to the seconds of an arc angle.
+%\cs{si@ang@fix}\marg{degree/minute/second}\\
+%\cs{si@ang@arcfix}\marg{degree/minute/second}
+% \begin{macrocode}
+\newif\ifsi@ang@fixdp
+\newcommand*{\si@ang@fix}[1]{}
+\newcommand*{\si@ang@arcfix}[1]{%
+ \renewcommand*{\si@tempa}{second}%
+ \renewcommand*{\si@tempb}{#1}%
+ \ifx\si@tempa\si@tempb
+ \ifsi@ang@fixdp
+ \expandafter\expandafter\expandafter\si@fixdptrue
+ \else
+ \expandafter\expandafter\expandafter\si@fixdpfalse
+ \fi
+ \else
+ \expandafter\si@fixdpfalse
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ang@ifnum}
+% A test is required to check that the provided data consists of
+% numbers which can actually be processed by \TeX. This is achieved
+% by using \cs{si@num@ifvalid} with a fixed list of valid
+% characters.\\
+%\cs{si@ang@ifnum}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@ang@ifnum}[1]{%
+ \begingroup
+ \renewcommand*{\si@numvalid}{0123456789,.+-}%
+ \ifx\@empty#1\@empty
+ \aftergroup\@firstoftwo
+ \else
+ \si@num@ifvalid{#1}
+ {\aftergroup\@firstoftwo}
+ {\aftergroup\@secondoftwo}%
+ \fi
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@ang@arctodec}
+% The business end of converting arcs to decimal angles is relatively
+% straight-forward, as it only needs one calculation. This has to be
+% divided up, so that disaster does not strike if there are empty
+% arguments; a check is also needed for the sign of the angle,
+% so that the maths makes sense.\\
+%\cs{si@ang@arctodec}\marg{dec}\marg{min}\marg{sec}
+% \begin{macrocode}
+\newcommand*{\si@ang@arctodec}[3]{%
+ \let\si@ang@fix\@gobble
+ \ifnum\si@num@dp>\thr@@\relax
+ \si@num@dp\thr@@\relax
+ \fi
+ \si@fixdptrue
+ \si@ang@ifnum{#1}
+ {\si@ang@ifnum{#2}
+ {\si@ang@ifnum{#3}
+ {\si@tempdima\z@\relax
+ \renewcommand*{\si@tempa}{+}%
+ \ifx\@empty#1\@empty\else
+ \si@tempdima #1pt\relax
+ \fi
+ \ifdim\si@tempdima<\z@\relax
+ \renewcommand*{\si@tempa}{-}%
+ \fi
+ \ifx\@empty#2\@empty\else
+ \si@tempdima\dimexpr\si@tempdima\si@tempa
+ #2pt/60\relax
+ \fi
+ \ifdim\si@tempdima<\z@\relax
+ \renewcommand*{\si@tempa}{-}%
+ \else
+ \fi
+ \ifx\@empty#3\@empty\else
+ \si@tempdima\dimexpr\si@tempdima\si@tempa
+ #3pt/3600\relax
+ \fi
+ \sisetup{numdecimal=.}%
+ \expandafter\si@ang@typeset\expandafter{%
+ \strip@pt\si@tempdima}{}{}}
+ {\si@ang@notnum{#1}{#2}{#3}}}
+ {\si@ang@notnum{#1}{#2}{#3}}}
+ {\si@ang@notnum{#1}{#2}{#3}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@ang@dectoarc}
+%\begin{macro}{\si@ang@arcdeg}
+%\begin{macro}{\si@ang@arcmin}
+%\begin{macro}{\si@ang@arcsec}
+% The conversion macros for decimal to arc angles. Life is more
+% complex here than above, even without the need for checks on the
+% input. A number of separation steps are needed, each of which
+% needs a separate macro.\\
+%\cs{si@ang@dectoarc}\marg{angle}
+% \begin{macrocode}
+\newcommand*{\si@ang@dectoarc}[1]{%
+ \let\si@ang@fix\si@ang@arcfix
+ \si@ang@fixdptrue
+ \ifnum\si@num@dp>\@ne\relax
+ \si@num@dp\@ne\relax
+ \fi
+ \si@ang@ifnum{#1}
+ {\si@tempdima\z@\relax
+ \ifx\@empty#1\@empty\else
+ \si@tempdima #1pt\relax
+ \fi
+ \si@ang@sepint{deg}%
+ \si@tempdima\dimexpr\si@tempdima *60\relax
+ \si@ang@sepint{min}%
+ \edef\si@tempa{\the\dimexpr\si@tempdima *60\relax}%
+ \expandafter\newcommand\expandafter*\expandafter{%
+ \expandafter\si@ang@arcsec\expandafter}\expandafter{%
+ \expandafter\si@ang@strippt\si@tempa}%
+% \end{macrocode}
+% A check is made for ``0.0'' seconds, which should be converted to
+% simply ``0''.
+% \begin{macrocode}
+ \si@tempdima\z@\relax
+ \edef\si@tempa{\the\si@tempdima}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \expandafter\si@tempa\expandafter}\expandafter{%
+ \expandafter\si@ang@strippt\si@tempa}%
+ \ifx\si@tempa\si@ang@arcsec
+ \renewcommand*{\si@ang@arcsec}{0}%
+ \fi
+% \end{macrocode}
+% To avoid adding zeros where they are not required, each part of the
+% angle is now checked.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{0}%
+ \ifx\si@ang@arcdeg\si@tempa
+ \si@temptoks{{}}%
+ \else
+ \si@temptoks{{\si@ang@arcdeg}}%
+ \fi
+ \ifx\si@ang@arcmin\si@tempa
+ \si@temptoks\expandafter{\the\si@temptoks{}}%
+ \else
+ \si@temptoks\expandafter{\the\si@temptoks{%
+ \si@ang@arcmin}}%
+ \fi
+ \ifx\si@ang@arcsec\si@tempa
+ \si@temptoks\expandafter{\the\si@temptoks{}}%
+ \else
+ \si@temptoks\expandafter{\the\si@temptoks{%
+ \si@ang@arcsec}}%
+ \fi
+ \expandafter\si@ang@typeset\the\si@temptoks}
+ {\si@ang@notnum{#1}{}{}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ang@sepint}
+%\begin{macro}{\si@ang@sint}
+%\begin{macro}{\si@ang@strippt}
+% Support macros for the conversion from decimal to arc angles.\\
+%\cs{si@ang@sepint}\marg{deg/min}\\
+%\cs{si@ang@sint}\meta{chars}.\meta{chars}\cs{@empty}\\
+%\cs{si@ang@strippt}\meta{chars}\texttt{pt}
+% \begin{macrocode}
+\newcommand*{\si@ang@sepint}[1]{%
+ \expandafter\si@ang@sint\the\si@tempdima\@empty
+ \expandafter\let\csname si@ang@arc#1\endcsname\si@tempa}
+\def\si@ang@sint#1.#2\@empty{%
+ \renewcommand*{\si@tempa}{#1}%
+ \si@tempdima 0.#2\relax}
+\begingroup
+ \catcode`P=12
+ \catcode`T=12
+ \lowercase{
+ \renewcommand*{\si@tempa}{%
+ \def\si@ang@strippt##1PT{##1}}}
+ \expandafter\endgroup
+\si@tempa
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ang@notnum}
+% Not a \TeX\ number: complain.\\
+%\cs{si@ang@notnum}\marg{dec}\marg{min}\marg{sec}
+% \begin{macrocode}
+\newcommand*{\si@ang@notnum}[3]{%
+ \si@log@warn{Angle `#1;#2;#3' is not a pure
+ number:\MessageBreak output will be as given}%
+ \si@ang@typeset{#1}{#2}{#3}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@ang@sign}
+% A flag is needed to leave signs along for angles, where
+% a zero value may still need a sign.
+% \begin{macrocode}
+\newif\ifsi@ang@sign
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@ang@typeset}
+% The \cs{si@ang@set} macro does the work of assigning the degrees,
+% minutes and seconds, and actually typesetting the result.\\
+%\cs{si@ang@typeset}\marg{num}\marg{num}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@ang@typeset}[3]{%
+% \end{macrocode}
+%\begin{macro}{\si@ang@degs}
+%\begin{macro}{\si@ang@mins}
+%\begin{macro}{\si@ang@secs}
+% First, the three macros that will contain the measures must exist.
+% \begin{macrocode}
+ \ifsi@ang@padlarge
+ \newcommand*{\si@ang@degs}{0\si@sym@degree}%
+ \newcommand*{\si@ang@mins}{0\si@sym@minute}%
+ \newcommand*{\si@ang@secs}{0\si@sym@second}%
+ \else
+ \newcommand*{\si@ang@degs}{}%
+ \newcommand*{\si@ang@mins}{}%
+ \newcommand*{\si@ang@secs}{}%
+ \fi
+ \protected@edef\si@ang@decimalsymbol{\si@decimalsymbol}%
+% \end{macrocode}
+%\begin{macro}{\si@ang@movesign}
+% Either the signs need to be moved, or this needs to be killed off.
+% \begin{macrocode}
+ \ifsi@astroang
+ \let\si@ang@movesign\si@ang@astrosign
+ \else
+ \let\si@ang@movesign\@gobble
+ \fi
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@ang@secnum}
+%\begin{macro}{\si@ang@minnum}
+% The arguments are now examined in reverse order. If they are
+% empty, then nothing is done. Otherwise, the larger measures are
+% zero-filled, if this has been requested. Some steps are needed
+% to allow for addition of signs to numbers.
+% \begin{macrocode}
+ \newcommand*{\si@ang@secnum}{\si@ang@num{second}}%
+ \newcommand*{\si@ang@minnum}{\si@ang@num{minute}}%
+ \si@ifnotmtarg{#3}
+ {\si@log@debug{Found seconds `#3'}%
+ \si@ang@ifnum{#3}
+ {\ifdim #3 pt=\z@\relax\else
+ \si@ang@signtrue
+ \fi}{}%
+ \renewcommand*{\si@ang@secs}
+ {\si@ang@secnum{#3}\si@sym@second}%
+ \renewcommand*{\si@ang@mins}
+ {\si@ang@pad{0\si@sym@minute}}%
+ \renewcommand*{\si@ang@degs}
+ {\si@ang@pad{0\si@sym@degree}}}%
+ \si@ifnotmtarg{#2}
+ {\si@log@debug{Found minutes `#2'}%
+ \si@ang@ifnum{#2}
+ {\ifdim #2 pt=\z@\relax\else
+ \si@ang@signtrue
+ \fi}{}%
+ \renewcommand*{\si@ang@secnum}{%
+ \si@ang@signlessnum{second}}%
+ \renewcommand*{\si@ang@mins}
+ {\si@ang@minnum{#2}\si@sym@minute}%
+ \renewcommand*{\si@ang@degs}
+ {\si@ang@pad{0\si@sym@degree}}}%
+ \si@ifnotmtarg{#1}
+ {\si@log@debug{Found degrees `#1'}%
+ \renewcommand*{\si@ang@secnum}{%
+ \si@ang@signlessnum{second}}%
+ \renewcommand*{\si@ang@minnum}{%
+ \si@ang@signlessnum{minute}}%
+ \renewcommand*{\si@ang@degs}
+% \end{macrocode}
+% The group here is needed to get the mechanism to move the symbol to
+% work properly.
+% \begin{macrocode}
+ {\si@ang@num{degree}{#1}%
+ \si@sym@degree}}%
+ \si@out@num
+ {\si@ang@degs\si@anglesep\si@ang@mins\si@anglesep
+ \si@ang@secs}%
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% The group opened by \cs{ang} is closed.
+% \begin{macrocode}
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ang@pad}
+% Padding is only added if requested; the zero is a literal.\\
+%\cs{si@ang@pad}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@ang@pad}[1]{\ifsi@ang@padsmall #1\fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@ang@num}
+%\begin{macro}{\si@ang@signlessnum}
+% Modified versions of \cs{num}, one to typeset angles without a
+% leading sign and the other with.\\
+%\cs{si@ang@num}\marg{degree/minute/second}\marg{num}\\
+%\cs{si@ang@signlessnum}\marg{degree/minute/second}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@ang@num}[2]{%
+ \begingroup
+ \si@ang@fix{#1}%
+ \si@ang@movesign{#1}%
+ \si@num{#2}%
+ \endgroup}
+\newcommand*{\si@ang@signlessnum}[2]{%
+ \begingroup
+ \si@ang@fix{#1}%
+ \si@ang@movesign{#1}%
+ \sisetup{addsign=none}%
+ \si@num{#2}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ang@killdegree}
+%\begin{macro}{\si@ang@killminute}
+%\begin{macro}{\si@ang@killsecond}
+%\begin{macro}{\si@ang@astrosign}
+%\begin{macro}{\si@ang@decimalsymbol}
+% A mechanism is needed to handle moving the angle unit signs for the
+% \opt{astroang} option. This requires two steps, producing the sign
+% over the decimal sign and preventing duplicate symbols appearing.
+% This is based on a suggestion from Morten H{\o}gholm, but using
+% \TeX\ internals as \cs{makebox} does not work here. Note the need
+% to correct for \cs{scriptspace} (thanks to Donald Arseneau for
+% that).\\
+%\cs{si@ang@astrosign}\marg{degree/minute/second}
+% \begin{macrocode}
+\newcommand*{\si@ang@killdegree}{\let\si@sym@degree\relax}
+\newcommand*{\si@ang@killminute}{\let\si@sym@minute\relax}
+\newcommand*{\si@ang@killsecond}{\let\si@sym@second\relax}
+\newcommand*{\si@ang@astrosign}[1]{%
+ \renewcommand*{\si@decimalsymbol}{%
+ \setbox\si@tempboxa=\hbox{%
+ \ensuremath{{\si@ang@decimalsymbol}}}%
+ \si@tempdima\wd\si@tempboxa\relax
+ \setbox\si@tempboxb=\hbox to\z@{%
+ \hss\unhbox\si@tempboxa\hss}%
+ \setbox\si@tempboxa=\hbox{%
+ \csname si@sym@#1\endcsname\hskip-\scriptspace}%
+ \si@tempdimb\wd\si@tempboxa\relax
+ \setbox\si@tempboxc=\hbox to\z@{%
+ \hss\unhbox\si@tempboxa\hss}%
+ \setbox\si@tempboxd=\hbox{%
+ \usebox\si@tempboxb\usebox\si@tempboxc}%
+ \ifdim\si@tempdima>\si@tempdimb\relax
+ \setbox\si@tempboxa=\hbox to\si@tempdima{%
+ \hss\unhbox\si@tempboxd\hss}%
+ \else
+ \setbox\si@tempboxa=\hbox to\si@tempdimb{%
+ \hss\unhbox\si@tempboxd\hss}%
+ \fi
+ \usebox\si@tempboxa%
+ \ifdim\si@tempdima>\si@tempdimb\relax\else
+ \hskip\scriptspace
+ \fi}%
+ \renewcommand*{\si@num@decimalhook}{\expandafter\aftergroup
+ \csname si@ang@kill#1\endcsname}}%
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\subsection{Tabular material}
+% The automatic formatting and alignment of numerical data in columns
+% is handled here. The various other packages that work in this area
+% are basically ripped-off here. The letters |D|, |N| and |R| are
+% already taken by the other packages for numerical alignment, and so
+% |S| ($=$ \currpkg) is chosen for the alignment of numerical
+% material. The package also provides a second column type, |s|, for
+% units (the letter is taken from \cs{si}).
+%
+%\begin{macro}{\NC@list}
+% The first part of the job is to create the basic apparatus for the
+% columns using the \pkg{array} package. To prevent any issues with
+% the content of optional arguments to the new columns, so
+% rearrangement is needed. The \currpkg columns have to come
+% \emph{before} any other column definitions. This is achieved by
+% saving \cs{NC@list}, creating the columns then restoring the list
+% with the appropriate extra parts.
+% \begin{macrocode}
+\edef\si@tempa{%
+ \noexpand\NC@do S\noexpand\NC@do s\the\NC@list}
+\newcolumntype{S}{}
+\newcolumntype{s}{}
+\NC@list\expandafter{\si@tempa}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\NC@rewrite@S}
+%\begin{macro}{\NC@rewrite@s}
+% Following the \numprint approach, the \cs{NC@rewrite@\ldots} macros
+% are rewritten to collect the cell contents. This means messing
+% with the internal macros of another package, but there is no other
+% way to do this. As \pkg{array} is a standard package from the
+% \pkg{tools} bundle, this should be reasonably safe. Here the begin
+% and end code needed is added to the existing list if
+% \cs{@temptokena}, with the start and end macros unexpanded.
+% Argument |#1| contains any user setup options for this column.
+% Passing an argument at this stage will cause issues, so each column
+% type needs its own \texttt{begin} and \texttt{end} macros.\\
+%\cs{NC@rewrite@S}\oarg{options}
+%\cs{NC@rewrite@s}\oarg{options}
+% \begin{macrocode}
+\renewcommand*{\NC@rewrite@S}[1][]{%
+ \edef\si@tempa{\the\@temptokena
+ >{\noexpand\si@tab@begin@S[#1]}c%
+ <{\noexpand\si@tab@end@S}}%
+ \@temptokena\expandafter{\si@tempa}%
+ \NC@find}
+\renewcommand*{\NC@rewrite@s}[1][]{%
+ \edef\si@tempa{\the\@temptokena
+ >{\noexpand\si@tab@begin@s[#1]}c%
+ <{\noexpand\si@tab@end@s}}%
+ \@temptokena\expandafter{\si@tempa}%
+ \NC@find}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@begin@S}
+%\begin{macro}{\si@tab@begin@s}
+%\begin{macro}{\si@tab@gettok}
+% At this stage, the appropriate token gathering macro is activated,
+% and the common starting macro is called. For the |S| column, the
+% \opt{seperr} is turned off, and an error is set to be raised by any
+% ``x-part'' input.\\
+%\cs{si@tab@begin@S}\oarg{options}\\
+%\cs{si@tab@begin@s}\oarg{options}
+% \begin{macrocode}
+\newcommand*{\si@tab@begin@S}[1][]{%
+ \si@log@debug{Processing S column cell contents}%
+ \let\si@tab@gettok\si@tab@gettok@S
+ \si@seperrfalse
+ \renewcommand*{\si@num@sepxpart}{%
+ \si@log@err{Multiple numbers not allowed in
+ tables\MessageBreak Only the first number used}
+ \@ehb}%
+ \si@tab@begin[#1]}
+\newcommand*{\si@tab@begin@s}[1][]{%
+ \si@log@debug{Processing s column cell contents}%
+ \let\si@tab@gettok\si@tab@gettok@s
+ \si@tab@begin[#1]}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@toks}
+%\begin{macro}{\si@tab@pretoks}
+%\begin{macro}{\si@tab@posttoks}
+% Some storage is needed for the data to build up. In common with
+% \pkg{rccol} and \numprint, token registers are used for this (thus
+% leaving problematic input to be handled later).
+% \begin{macrocode}
+\newtoks\si@tab@toks
+\newtoks\si@tab@pretoks
+\newtoks\si@tab@posttoks
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@begin}
+% The macro for gathering up input is common to both column types. It
+% uses the method for \pkg{rccol}; the cell contents are collected by
+% a second macro, which then stores all of the data in an appropriate
+% token store.\\
+%\cs{si@tab@begin}\oarg{options}
+% \begin{macrocode}
+\newcommand*{\si@tab@begin}[1][]{%
+ \begingroup
+ \sisetup{#1}%
+ \si@tab@toks{}%
+ \si@tab@pretoks{}%
+ \si@tab@posttoks{}%
+ \si@switchfalse
+ \si@tab@gettok}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tab@gettok@S}
+%\begin{macro}{\si@tab@othertok}
+%\begin{macro}{\si@tab@gettok@s}
+%\begin{macro}{\si@tab@next}
+% The two collection macros are very similar. Both compare the
+% current input with a list of possible fixed values; this is pretty
+% much a direct copy of \numprint. If the input is not on the list
+% of choices, it is processed as data for \currpkg to handle. The
+% |S| column does an additional check, to allow division of a number
+% from any text. For the |s| column, everything gets added to
+% \cs{si@tab@toks} for later processing. Two separate macros are
+% needed here as the fixed values are dependant on the column type,
+% and awkward errors pop up if a combined approach is tried.\\
+%\cs{si@tab@gettok@S}\marg{cell-contents}\\
+%\cs{si@tab@othertok}\marg{chars}\\
+%\cs{si@tab@gettok@s}\marg{cell-contents}
+% \begin{macrocode}
+\newcommand*{\si@tab@gettok@S}[1]{%
+ \ifx\tabularnewline#1\relax
+ \let\si@tab@next\si@tab@newline@S
+ \else
+ \ifx\end#1\relax
+ \let\si@tab@next\end
+ \else
+ \ifx\si@tab@end@S#1\relax
+ \let\si@tab@next\si@tab@end@S
+ \else
+ \ifx\endtabular#1\relax
+ \let\si@tab@next\endtabular
+ \else
+ \ifx\csname#1\relax
+ \let\si@tab@next\csname
+ \else
+ \ifx\relax#1\relax
+ \let\si@tab@next\relax
+ \else
+ \let\si@tab@next\si@tab@gettok@S
+ \si@str@ifchrstr{#1}{\si@numvalid}
+ {\si@switchtrue
+ \si@log@debug{Found numerical cell
+ contents `#1'}%
+ \si@tab@toks=\expandafter{%
+ \the\si@tab@toks#1}}
+ {\si@log@debug{Found other cell contents
+ \string#1}%
+ \si@tab@othertok{#1}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \si@tab@next}
+\newcommand*{\si@tab@othertok}[1]{%
+ \ifsi@switch
+ \si@tab@posttoks=\expandafter{\the\si@tab@posttoks#1}%
+ \else
+ \si@tab@pretoks=\expandafter{\the\si@tab@pretoks#1}%
+ \fi}
+\newcommand*{\si@tab@gettok@s}[1]{%
+ \ifx\tabularnewline#1\relax
+ \let\si@tab@next\si@tab@newline@s
+ \else
+ \ifx\end#1\relax
+ \let\si@tab@next\end
+ \else
+ \ifx\si@tab@end@s#1\relax
+ \let\si@tab@next\si@tab@end@s
+ \else
+ \ifx\endtabular#1\relax
+ \let\si@tab@next\endtabular
+ \else
+ \ifx\csname#1\relax
+ \let\si@tab@next\csname
+ \else
+ \ifx\relax#1\relax
+ \let\si@tab@next\relax
+ \else
+ \let\si@tab@next\si@tab@gettok@s
+ \si@tab@toks=\expandafter{%
+ \the\si@tab@toks#1}%
+ \si@log@debug{Found cell contents `#1'}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \si@tab@next}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@end@S}
+%\begin{macro}{\si@tab@rfill}
+%\begin{macro}{\si@tab@lfill}
+%\begin{macro}{\si@tab@end@s}
+% The end macros are similar, but with some minor differences. In
+% both cases, the appropriate filling is carried out. For the |S|
+% column, this depends on the cell contents, whereas for the |s|
+% column the fill is always the same. Output of a number in an |S|
+% column is only attempted if one was found, otherwise the cell
+% contents will all be in \cs{si@tab@pretoks}.
+% \begin{macrocode}
+\newcommand*{\si@tab@end@S}{%
+ \ifsi@switch
+ \let\si@tab@lfill\si@tab@lfill@S
+ \let\si@tab@rfill\si@tab@rfill@S
+ \else
+ \let\si@tab@rfill\si@tab@rfill@t
+ \let\si@tab@lfill\si@tab@lfill@t
+ \fi
+ \si@tab@lfill\relax
+ \the\si@tab@pretoks
+ \ifsi@switch
+ \expandafter\si@tab@numout
+ \fi
+ \the\si@tab@posttoks
+ \si@tab@rfill\relax
+ \endgroup}
+\newcommand*{\si@tab@end@s}{%
+ \si@tab@lfill@s\relax
+ \expandafter\si\expandafter{\the\si@tab@toks}%
+ \si@tab@rfill@s\relax
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@newline@S}
+%\begin{macro}{\si@tab@newline@s}
+%\begin{macro}{\si@tab@end}
+% If the column is the final one read, then some work is needed with
+% the \cs{tabularnewline} macro. Output has to happen \emph{before}
+% the new line, then the ending macro is made safe before calling the
+% \LaTeX\ line end. If the user makes use of the primitive \cs{cr}
+% then this problem does not arise as \cs{si@tab@end@\ldots} is
+% called correctly.
+% \begin{macrocode}
+\newcommand*{\si@tab@newline@S}{%
+ \si@tab@end@S
+ \hfil\relax
+ \let\si@tab@end\si@tab@end@S
+ \renewcommand*{\si@tab@end@S}{\let\si@tab@end@S\si@tab@end}%
+ \tabularnewline}
+\newcommand*{\si@tab@newline@s}{%
+ \si@tab@end@s
+ \hfil\relax
+ \let\si@tab@end\si@tab@end@s
+ \renewcommand*{\si@tab@end@s}{\let\si@tab@end@s\si@tab@end}%
+ \tabularnewline}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\begin{macro}{\si@tempcnta}
+%\begin{macro}{\si@tempcntb}
+% The second part of the tabular code is concerned with typesetting
+% numbers in |S| columns with the appropriate alignment. Counters are
+% needed for the digit-counting system.
+% \begin{macrocode}
+\newcount\si@tempcnta
+\newcount\si@tempcntb
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@numout}
+% If a number is found, then some secondary processing is needed to
+% format it correctly.
+% \begin{macrocode}
+\newcommand*{\si@tab@numout}{%
+ \si@num@intabtrue
+ \ifsi@tab@fixed
+ \ifsi@tabautofit
+ \si@num@dp\si@tab@mantpostcnt\relax
+ \expandafter\expandafter\expandafter\si@fixdptrue
+ \fi
+ \fi
+ \expandafter\si@num\expandafter{\the\si@tab@toks}%
+ \si@tab@format}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tab@prebox}
+%\begin{macro}{\si@tab@postbox}
+%\begin{macro}{\si@tab@midbox}
+%\begin{macro}{\si@tab@expbox}
+% The various boxes needed for the column centring are declared
+% Unlike the \pkg{dcolumn} original, private boxes are used here.
+% \cs{si@tempboxa} is used when a space to measure one of the
+% constituents is needed; it is never used for output.
+% \begin{macrocode}
+\newbox\si@tab@prebox
+\newbox\si@tab@midbox
+\newbox\si@tab@postbox
+\newbox\si@tab@expbox
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@format}
+% The formatting set up is taken from \pkg{dcolumn}, but with
+% control of the output form the stored information. The choice
+% of a variable (decimal-centred) column or fixed width boxes is
+% made.
+% \begin{macrocode}
+\newcommand*{\si@tab@format}{%
+ \ifsi@tab@fixed
+ \expandafter\si@tab@fixed
+ \else
+ \expandafter\si@tab@unfixed
+ \fi
+% \end{macrocode}
+% A hack to get the correct colour everywhere without too much work.
+% \begin{macrocode}
+ \ifsi@colourvalues
+ \si@fam@colourcmd{\si@valuecolour}%
+ \fi
+ \box\si@tab@prebox\box\si@tab@midbox\box\si@tab@postbox%
+ \box\si@tab@expbox}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tab@unfixed}
+% When the width of the contents is not fixed, the system creates a
+% block in which the decimal marker is always at the centre. This is
+% achieved by placing the pre- and post-decimal parts of the number
+% in boxes. The wider one is then used to set up the column width,
+% by resizing the other one.
+% \begin{macrocode}
+\newcommand*\si@tab@unfixed{%
+ \si@log@debug{Using variable width S column}%
+ \protected@edef\si@num@out{\si@num@out\si@tab@expout}%
+ \setbox\si@tab@prebox=\hbox
+ {\expandafter\si@out@num\expandafter{\si@tab@out}}%
+ \ifx\@empty\si@num@out\@empty
+ \setbox\si@tab@midbox=\hbox
+ {\phantom{\ensuremath{{\si@decimalsymbol}}}}%
+ \else
+ \setbox\si@tab@midbox=\hbox
+ {\ensuremath{{\si@decimalsymbol}}}%
+ \fi
+ \setbox\si@tab@postbox=\hbox
+ {\expandafter\si@out@num\expandafter{\si@num@out}}%
+ \ifdim\wd\si@tab@prebox>\wd\si@tab@postbox\relax
+ \setbox\si@tab@postbox=\hbox to\wd\si@tab@prebox%
+ {\unhbox\si@tab@postbox\hfill}%
+ \else
+ \setbox\si@tab@prebox=\hbox to\wd\si@tab@postbox%
+ {\hfill\unhbox\si@tab@prebox}%
+ \fi
+ \setbox\si@tab@expbox=\hbox{}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tab@predim}
+%\begin{macro}{\si@tab@postdim}
+%\begin{macro}{\si@tab@expdim}
+%\begin{macro}{\si@tempdima}
+%\begin{macro}{\si@tempdimb}
+% Some storage dimensions are declared.
+% \begin{macrocode}
+\newdimen\si@tab@predim
+\newdimen\si@tab@postdim
+\newdimen\si@tab@expdim
+\newdimen\si@tempdima
+\newdimen\si@tempdimb
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tab@sp}
+% A short macro to control superscript.
+% \begin{macrocode}
+\newcommand*{\si@tab@sp}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tab@fixed}
+% The column is not centred on the decimal marker; the user specifies
+% how many characters on each side are allowed for. First, the width
+% of a character is measured, and stored.
+% \begin{macrocode}
+\newcommand*{\si@tab@fixed}{%
+ \si@log@debug{Using fixed-width S column}%
+ \let\si@tab@sp\relax
+ \setbox\si@tab@midbox=\hbox{}%
+ \setbox\si@tab@expbox=\hbox{}%
+ \setbox\si@tempboxa=\hbox{\si@out@num{1}}%
+ \si@tempdima\wd\si@tempboxa\relax
+% \end{macrocode}
+% The width for the two output boxes is set up.
+% \begin{macrocode}
+ \si@tab@predim\the\si@tab@mantprecnt\si@tempdima\relax
+ \si@tab@sepcorr{mantpre}{pre}%
+ \si@tab@postdim\si@tab@mantpostcnt\si@tempdima\relax
+ \setbox\si@tempboxa=\hbox{\ensuremath{{\si@decimalsymbol}}}%
+ \advance\si@tab@postdim\wd\si@tempboxa\relax
+ \si@tab@sepcorr{mantpost}{post}%
+% \end{macrocode}
+% If space is needed for an exponent, it needs to be allowed for in
+% the exponent box dimension. First, the digits of the two parts are
+% checked for; the width of a character is altered to be superscript.
+% \begin{macrocode}
+ \setbox\si@tempboxa=\hbox{\si@out@num{^{1}}}%
+ \si@tempdima\wd\si@tempboxa\relax
+ \ifnum\si@tab@expprecnt>\z@\relax
+ \si@tab@expdim\si@tab@expprecnt\si@tempdima\relax
+ \si@tab@sepcorr{exppre}{exp}%
+ \fi
+ \let\si@tab@sp\sp
+ \ifnum\si@tab@exppostcnt>\z@\relax
+ \advance\si@tab@expdim\si@tab@exppostcnt\si@tempdima\relax
+ \setbox\si@tempboxa=\hbox{%
+ \ensuremath{^{\si@decimalsymbol}}}%
+ \advance\si@tab@expdim\wd\si@tempboxa\relax
+ \si@tab@sepcorr{exppost}{exp}%
+ \fi
+% \end{macrocode}
+% Space is reserved for signs.
+% \begin{macrocode}
+ \setbox\si@tempboxa=\hbox{\ensuremath{-}}%
+ \ifsi@tab@mantsign
+ \advance\si@tab@predim\wd\si@tempboxa\relax
+ \fi
+ \setbox\si@tempboxa=\hbox{\ensuremath{^{-}}}%
+ \ifsi@tab@expsign
+ \advance\si@tab@expdim\wd\si@tempboxa\relax
+ \fi
+% \end{macrocode}
+% Now, if there is space to be saved for an exponent under any
+% circumstances, the space for the ``$\times 10$'' part is needed.
+% This is done by adding both counters together, then using this
+% result for the logic.
+% \begin{macrocode}
+ \si@tempcnta\si@tab@expprecnt\relax
+ \advance\si@tempcnta\si@tab@exppostcnt\relax
+ \ifnum\si@tempcnta>\z@\relax
+ \setbox\si@tempboxa=\hbox{\ensuremath{%
+ {}\si@expproduct{}\si@expbase}}%
+ \advance\si@tab@expdim\wd\si@tempboxa\relax
+ \fi
+% \end{macrocode}
+% Finally for the box dimensions, if the exponent is not aligned,
+% the space reserved for it is added to the post box.
+% \begin{macrocode}
+ \ifsi@tabalignexp\else
+ \advance\si@tab@postdim\si@tab@expdim\relax
+ \fi
+% \end{macrocode}
+% With the boxes set up, the contents can be sorted out. A bit of
+% shuffling may be needed, depending on the treatment of exponents.
+% \begin{macrocode}
+ \setbox\si@tab@prebox=\hbox to\si@tab@predim{\hss\hfill
+ \expandafter\si@out@num\expandafter{\si@tab@out}}%
+ \ifx\@empty\si@num@out\@empty
+ \setbox\si@tab@postbox=\hbox to\si@tab@postdim
+ {\expandafter\si@out@num\expandafter{\si@num@out}\hfil}%
+ \else
+ \ifsi@tabalignexp\else
+ \protected@edef\si@num@out{\si@num@out\si@tab@expout}%
+ \fi
+ \setbox\si@tab@postbox=\hbox to\si@tab@postdim
+ {\ensuremath{{\si@decimalsymbol}}\expandafter\si@out@num
+ \expandafter{\si@num@out}\hfil}%
+ \fi
+ \ifx\@empty\si@tab@expout\@empty
+ \ifsi@tabalignexp
+ \setbox\si@tab@expbox=\hbox to\si@tab@expdim{\hfil}%
+ \fi
+ \else
+ \ifsi@tabalignexp
+ \setbox\si@tab@expbox=\hbox to\si@tab@expdim
+ {\expandafter\si@out@num\expandafter{\si@tab@expout}%
+ \hfil}%
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@tab@sepcorr}
+% A spacing correction is needed \emph{if} the number of digits to be
+% allowed for will lead to the introduction of a separator. A counter
+% and dimension are needed for the testing.\\
+%\cs{si@tab@sepcorr}\marg{count}\marg{dimen}
+% \begin{macrocode}
+\newcommand*{\si@tab@sepcorr}[2]{%
+ \expandafter\si@tempcnta\expandafter\the
+ \csname si@tab@#1cnt\endcsname\relax
+% \end{macrocode}
+% Calculate how many groups of three there are, then allow for not
+% separating four characters if \cs{ifsi@sepfour} is false.
+% \begin{macrocode}
+ \divide\si@tempcnta\thr@@\relax
+ \ifsi@sepfour\else
+ \expandafter\ifnum\expandafter\the
+ \csname si@tab@#1cnt\endcsname=4\relax
+ \si@tempcnta\z@\relax
+ \fi
+ \fi
+% \end{macrocode}
+% The width of the separators is measured, and the correct number of
+% separator widths are added to the box dimension.
+% \begin{macrocode}
+ \setbox\si@tempboxa=\hbox{%
+ \ensuremath{\si@tab@sp{\si@digitsep}}}%
+ \expandafter\advance\csname si@tab@#2dim\endcsname
+ \si@tempcnta\wd\si@tempboxa}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Units}
+%\begin{macro}{\SI}
+%\begin{macro}{\si}
+% There are two types of user macros for the units system; those for
+% defining new units, prefixes and powers, and those for using them.
+% There are two macros for using units, \cs{SI} and \cs{si},
+% which work in very similar ways. \cs{si} is just an alias for
+% \cs{SI} with no number; everything is handed off into an internal
+% macro. The internal macro also handles the optional prefix
+% argument to \cs{SI}\\
+%\cs{SI}\oarg{options}\marg{num}
+%\cs{si}\oarg{options}\marg{unit}
+% \begin{macrocode}
+\si@newrobustcmd*{\SI}[2][]{%
+ \@ifnextchar[%]
+ {\si@SI[#1]{#2}}
+ {\si@SI[#1]{#2}[]}}
+\si@newrobustcmd*{\si}[2][]{\si@SI[#1]{}[]{#2}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\newunit}
+%\begin{macro}{\renewunit}
+%\begin{macro}{\provideunit}
+% The \cs{newunit} and \cs{renewunit} macros create the new unit
+% macros. To allow a mechanism for checking an existing definition,
+% these macros simply carry out the appropriate tests, before handing
+% off to the internal macro. \cs{@ifdefinable} is not used here as a
+% customised error is desirable. Other than that, the code here gives
+% very similar results to \cs{newcommand} and \cs{renewcommand}.
+% Finally, \cs{provideunit} adds the unit definition only if it does
+% not already exist.\\
+%\cs{newunit}\oarg{options}\marg{unit}\marg{symbol}\\
+%\cs{renewunit}\oarg{options}\marg{unit}\marg{symbol}\\
+%\cs{provideunit}\oarg{options}\marg{unit}\marg{symbol}
+% \begin{macrocode}
+\newcommand*{\newunit}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defunit[#1]{#2}{#3}}
+ {\si@log@err{Unit \string#2 already defined!}\@eha}}
+\newcommand*{\renewunit}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@log@err{Unit \string#2 undefined}\@ehc
+ \si@unt@defunit[#1]{#2}{#3}}
+ {\si@log@inf{Redefining unit \string#2}%
+ \si@unt@defunit[#1]{#2}{#3}}}
+\newcommand*{\provideunit}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defunit[#1]{#2}{#3}}
+ {}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\newprefix}
+%\begin{macro}{\renewprefix}
+%\begin{macro}{\provideprefix}
+% The multiples of units are defined here; very similar code is used
+% to the \cs{newunit}, \etc., macros. The multiple prefixes cannot take
+% an optional argument, and must represent some power. Hence the arguments
+% required are different.
+%\cs{newprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
+% \marg{symbol}\\
+%\cs{renewprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
+% \marg{symbol}\\
+%\cs{provideprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
+% \marg{symbol}
+% \begin{macrocode}
+\newcommand*{\newprefix}[4][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defprefix[#1]{#2}{#3}{#4}}
+ {\si@log@err{Prefix \string#2 already defined!}\@eha}}
+\newcommand*{\renewprefix}[4][]{%
+ \si@ifdefinable{#2}
+ {\si@log@err{Prefix \string#2 undefined}\@ehc
+ \si@unt@defprefix[#1]{#2}{#3}{#4}}
+ {\si@log@inf{Redefining prefix \string#2}%
+ \si@unt@defprefix[#1]{#2}{#3}{#4}}}
+\newcommand*{\provideprefix}[4][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defprefix[#1]{#2}{#3}{#4}}
+ {}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\newpower}
+%\begin{macro}{\renewpower}
+%\begin{macro}{\providepower}
+% Here power multiples for units are set up. As with units and
+% multiples, a layered approach is used to keep things easy to
+% maintain. The optional argument here is \emph{not} a \pkg{keyval}
+% one: only \opt{post} is a valid value.\\
+%\cs{newpower}\oarg{post}\marg{num}\marg{power}\\
+%\cs{renewpower}\oarg{post}\marg{num}\marg{power}\\
+%\cs{providepower}\oarg{post}\marg{num}\marg{power}
+% \begin{macrocode}
+\newcommand*{\newpower}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defpower[#1]{#2}{#3}}
+ {\si@log@err{Power \string#2 already defined!}\@eha}}
+\newcommand*{\renewpower}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@log@err{Power \string#2 undefined}\@ehc
+ \si@unt@defpower[#1]{#2}{#3}}
+ {\si@log@inf{Redefining power \string#2}%
+ \si@unt@defpower[#1]{#2}{#3}}}
+\newcommand*{\providepower}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defpower[#1]{#2}{#3}}
+ {}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@unt@num}
+% A flag is needed to tell the processor whether there is a number,
+% to get the correct spacing.
+% \begin{macrocode}
+\newif\ifsi@unt@num
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@unitarg}
+% A storage macro for the argument of the unit macro.
+% \begin{macrocode}
+\newcommand*{\si@unt@unitarg}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@SI}
+%\begin{macro}{\si@unt@SIopts}
+% The internal processing starts with \cs{si@SI}, which processes the
+% second optional argument to \cs{SI} (which is empty for
+% \cs{si}). Everything is set up in a group, and processing
+% begins by handling the options.\\
+%\cs{si@SI}\oarg{options}\marg{unit}\oarg{preunit}\marg{unit}
+% \begin{macrocode}
+\newcommand*{\si@unt@SIopts}{}
+\def\si@SI[#1]#2[#3]#4{%
+ \begingroup
+ \si@ifnotmtarg{#1}
+ {\sisetup{#1}%
+ \renewcommand*{\si@unt@SIopts}{#1}}%
+% \end{macrocode}
+%\end{macro}
+% The prefix unit is handled before any processing of the number; the
+% flags are set to get spacing correct.
+% \begin{macrocode}
+ \si@unt@numfalse
+ \si@xspacefalse
+ \si@ifnotmtarg{#3}
+ {\si@log@debug{Prefix unit found}%
+ \si@unt@printunit{#3}}%
+% \end{macrocode}
+% The numerical argument may be empty, in which case no extra space
+% should be produced.
+% \begin{macrocode}
+ \si@ifnotmtarg{#4}
+ {\renewcommand*{\si@unt@unitarg}{#4}}%
+ \si@ifnotmtarg{#2}
+ {\si@log@debug{Number found in \string\SI\space
+ argument}%
+ \ifsi@repeatunits\else
+ \ifsi@trapambigerr
+ \expandafter\expandafter\expandafter
+ \si@num@ambigerrtrue
+ \fi
+ \fi
+ \num{#2}%
+ \si@unt@numtrue}%
+% \end{macrocode}
+% If there is a unit, a check is needed in case the units need to
+% have a power added.
+% \begin{macrocode}
+ \si@ifnotmtarg{#4}
+ {\si@ifmtarg{#2}
+ {\si@unt@printunit{#4}}
+ {\si@tempcnta\z@\relax
+ \ifsi@addunitpower
+ \si@unt@countx{#2}%
+ \fi
+ \ifnum\si@tempcnta>\z@\relax
+ \advance\si@tempcnta\@ne\relax
+ \edef\si@tempa{\noexpand\tothe{\si@tempcnta}}%
+ \renewcommand*{\si@tempb}{#4}%
+ \expandafter\expandafter\expandafter
+ \si@unt@printunit\expandafter\expandafter
+ \expandafter{%
+ \expandafter\si@tempb\si@tempa}%
+ \else
+ \si@unt@printunit{#4}%
+ \fi}}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@countx}
+% A short macro to count up any multiplication in numerical input.
+% \begin{macrocode}
+\newcommand*{\si@unt@countx}[1]{%
+ \si@tempcnta\z@\relax
+ \expandafter\si@unt@cntx#1\@empty\@empty}
+\def\si@unt@cntx#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numprod}
+ {\advance\si@tempcnta\@ne\relax}
+ {}%
+ \ifx\@empty#2\@empty\else
+ \si@unt@cntx#2\@empty\@empty
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@ifliteral}
+%\begin{macro}{\ifsi@unt@littest}
+% The next stage of the processor is to determine whether or not the
+% argument of the unit macro is processable. For literal arguments,
+% this is not the case, and the argument is typeset ``as is''. On
+% the other hand, any units, \etc., declared by the package will work
+% with the processor, and so need to be executed before typesetting
+% the result.\\
+%\cs{si@unt@ifliteral}\marg{text}
+% \begin{macrocode}
+\newif\ifsi@unt@littest
+\newcommand*{\si@unt@ifliteral}[1]{%
+ \begingroup
+ \si@unt@littesttrue
+% \end{macrocode}
+% The test relies on any non-processable test having some width;
+% hopefully, this should be the case.
+% \begin{macrocode}
+ \setbox\si@tempboxa=\hbox{\si@unt@out{#1}}%
+ \ifdim\wd\si@tempboxa>\z@\relax
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ifsi@unt@litout}
+%\begin{macro}{\si@unt@printunit}
+% The printing macro uses the above test to determine how to act. It
+% then carries out the appropriate action: either typesetting or
+% executing. A flag is also provided so that any macro units inside
+% a partially-literal argument will work (this is also needed to
+% emulate \unitsdef).\\
+%\cs{si@unt@printunit}\marg{unit}
+% \begin{macrocode}
+\newif\ifsi@unt@litout
+\newcommand*{\si@unt@printunit}[1]{%
+ \si@unt@ifliteral{#1}
+% \end{macrocode}
+% The unit includes one or more literal items; typeset using the
+% unit typesetting macro.
+% \begin{macrocode}
+ {\si@log@debug{Literal items found in unit
+ argument:\MessageBreak outputting without further
+ processing}%
+ \si@unt@litouttrue
+ \si@unt@addvaluesep
+ \si@unt@out{#1}}
+% \end{macrocode}
+% For processable output, the argument is executed; the macros are
+% all designed for this.
+% \begin{macrocode}
+ {\si@log@debug{Macro unit found:\MessageBreak
+ processing to format output}%
+ \si@unt@init
+ \advance\si@unt@depthcnt\@ne\relax
+ #1%
+ \si@unt@final}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@addvaluesep}
+%\begin{macro}{\si@unt@addvalsep}
+%\begin{macro}{\si@unt@litvalsep}
+%\begin{macro}{\si@unt@stackvalsep}
+% To ensure no problems pop up with expansion, adding the value--unit
+% space is handled by a macro.
+% \begin{macrocode}
+\newcommand*{\si@unt@addvaluesep}{%
+ \ifsi@unt@num
+ \expandafter\si@unt@addvalsep
+ \fi}
+\newcommand*{\si@unt@addvalsep}{%
+ \ifsi@unt@litout
+ \expandafter\si@unt@litvalsep
+ \else
+ \expandafter\si@unt@stackvalsep
+ \fi}
+\newcommand*{\si@unt@stackvalsep}{%
+ \protected@edef\si@unt@spstack{\si@valuesep}}
+\newcommand*{\si@unt@litvalsep}{%
+ \nobreak\ensuremath{\si@valuesep}\nobreak}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@spstack}
+%\begin{macro}{\si@unt@stacka}
+%\begin{macro}{\si@unt@stackb}
+%\begin{macro}{\si@unt@unitcnta}
+%\begin{macro}{\si@unt@unitcntb}
+%\begin{macro}{\si@unt@depthcnt}
+%\begin{macro}{\ifsi@unt@first}
+%\begin{macro}{\ifsi@unt@first}
+%\begin{macro}{\si@unt@init}
+% The initialisation macro sets up the various switches, and clears
+% the storage areas for the formatted output. There are two stacks,
+% as when typesetting as fractions, the two parts of the number have
+% to be stored separately. The depth counter is used to tell when
+% recursion ends in the processor. The ``first'' switch is needed as
+% the depth counter will not be at one for items processed by
+% \cs{SI}.
+% \begin{macrocode}
+\newcommand*{\si@unt@spstack}{}
+\newcommand*{\si@unt@stacka}{}
+\newcommand*{\si@unt@stackb}{}
+\newcount\si@unt@unitcnta
+\newcount\si@unt@unitcntb
+\newcount\si@unt@depthcnt
+\newif\ifsi@unt@first
+\si@unt@depthcnt\m@ne\relax
+\newcommand*{\si@unt@init}{%
+ \begingroup
+ \si@unt@litoutfalse
+ \si@unt@litprefixfalse
+ \si@unt@firsttrue
+ \si@unt@perfalse
+ \si@unt@perseenfalse
+ \si@unt@prepowerfalse
+ \si@unt@depthcnt\z@\relax
+ \si@unt@powerdim\z@\relax
+ \si@unt@unitcnta\z@\relax
+ \si@unt@unitcntb\z@\relax
+ \si@unt@prefixcnt\z@\relax
+ \renewcommand*{\si@unt@spstack}{}%
+ \renewcommand*{\si@unt@stacka}{}%
+ \renewcommand*{\si@unt@stackb}{}%
+ \renewcommand*{\si@unt@holdstacka}{}%
+ \renewcommand*{\si@unt@holdstackb}{}%
+ \renewcommand*{\si@unt@lastadda}{space}%
+ \renewcommand*{\si@unt@lastaddb}{space}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@final}
+% The finalisation macro finishes off the output and resets the flags.
+% \begin{macrocode}
+\newcommand*{\si@unt@final}{%
+ \si@unt@third
+ \si@unt@stackout
+ \endgroup
+ \ifsi@xspace
+ \expandafter\expandafter\expandafter\xspace
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@defunit}
+% The internal macro for defining a unit does not check for
+% redefinition; that is done by the user macros.\\
+%\cs{si@unt@defunit}\oarg{options}\marg{unit}\marg{symbol}
+% \begin{macrocode}
+\newcommand*{\si@unt@defunit}[3][]{%
+ \si@log@debug{Declaring unit \string#2 with \MessageBreak
+ meaning \string#3}%
+% \end{macrocode}
+% The optional argument needs to be saved. The macro name is reversed
+% so that life is easier with the expansions here.
+% \begin{macrocode}
+ \si@ifnotmtarg{#1}
+ {\expandafter\@namedef\expandafter{%
+ \expandafter\@gobble\string#2@opt@unt@si}{#1}}%
+% \end{macrocode}
+% The unit macro itself is now defined. The definition simply
+% selects the correct path for the rest of the processing to go down.
+% \begin{macrocode}
+ \protected\def#2{%
+ \ifsi@allowoptarg
+ \expandafter\si@unt@withopt
+ \else
+ \expandafter\si@unt@noopt
+ \fi
+ {#2}{#3}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@withopt}
+%\begin{macro}{\si@unt@noopt}
+% To allow the correct expansion, the potential optional argument to
+% a unit macro has to come last. So \cs{@ifnextchar} is needed to
+% detect it and pass data through. To keep variation down, when the
+% argument is not allowed, the empty |[]| is supplied.\\
+%\cs{si@unt@withopt}\marg{unit}\marg{symbol}\\
+%\cs{si@unt@noopt}\marg{unit}\marg{symbol}
+% \begin{macrocode}
+\newcommand*{\si@unt@withopt}[2]{%
+ \@ifnextchar[%]
+ {\si@unt@opt{#1}{#2}}
+ {\si@unt@opt{#1}{#2}[]}}
+\newcommand*{\si@unt@noopt}[2]{\si@unt@opt{#1}{#2}[]}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@opt}
+% The optional argument to the unit macro (if present) is converted
+% to a normal one for ease. The correct route for processing is then
+% picked.\\
+%\cs{si@unt@opt}\marg{unit}\marg{symbol}\oarg{num}
+% \begin{macrocode}
+\def\si@unt@opt#1#2[#3]{%
+ \ifsi@unt@littest
+ \expandafter\si@gobblethree
+ \else
+% \end{macrocode}
+% For literal output, the second argument is all that is needed.
+% \begin{macrocode}
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\si@unt@unit
+ \fi
+ \fi
+ {#3}{#1}{#2}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@gobblethree}
+% \LaTeX\ does not have a \cs{@gobblethree} macro, but one is needed.
+% \begin{macrocode}
+\long\def\si@gobblethree #1#2#3{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@defprefix}
+%\begin{macro}{\ifsi@unt@litprefix}
+% As with units, multiples are defined by an internal macro.\\
+%\cs{si@unt@defprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
+% \marg{symbol}
+% \begin{macrocode}
+\newif\ifsi@unt@litprefix
+\si@unt@litprefixtrue
+\newcommand*{\si@unt@defprefix}[4][]{%
+ \si@log@debug{Declaring multiple \string#1 with\MessageBreak
+ meaning \string#4}%
+% \end{macrocode}
+% The optional argument is saved, using \cs{def} as no check is made
+% on an existing definition of the storage macro.
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\def\expandafter
+ \csname\expandafter\@gobble\string#2@opt@si\endcsname{#1}%
+ \protected\def#2{%
+ \ifsi@unt@littest
+ \expandafter\si@gobblethree
+ \else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \ifsi@unt@litprefix
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@unt@prefix
+ \fi
+ \fi
+ \fi
+ {#2}{#3}{#4}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@defpower}
+% The definition of powers is complicated by the need to handle both
+% those given before units (such as \cs{cubic}) and those given after
+% (\eg~\cs{cubed}). This means that an optional argument is
+% needed.\\
+%\cs{si@unt@defpower}\oarg{post}\marg{power}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@unt@defpower}[3][]{%
+ \si@log@debug{Declaring power \string#2 with\MessageBreak
+ meaning \string#3}%
+% \end{macrocode}
+% Once again the optional argument is saved.
+% \begin{macrocode}
+ \expandafter\expandafter\expandafter\def\expandafter
+ \csname\expandafter\@gobble\string#2@opt@si\endcsname{#1}%
+ \protected\def#2{%
+ \ifsi@unt@littest
+ \expandafter\@gobbletwo
+ \else
+% \end{macrocode}
+% The literal output here does not need to gobble anything.
+% \begin{macrocode}
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\si@unt@litpower
+ \else
+ \expandafter\expandafter\expandafter\si@unt@power
+ \fi
+ \fi
+ {#2}{#3}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@unithook}
+%\begin{macro}{\si@unt@unit}
+% The macro for units is actually a processor, rather than
+% typesetting anything, which is handled elsewhere. The first
+% argument to the macro is optional, but does not have square
+% brackets to keep things simple with gobbling.\\
+%\cs{si@unt@unit}\marg{num}\marg{unit}\marg{symbol}
+% \begin{macrocode}
+\newcommand*{\si@unt@unithook}{}
+\newcommand*{\si@unt@unit}[3]{%
+% \end{macrocode}
+% When the count is minus one at the start of the processor, then the
+% unit is begin used on its own: initialisation occurs.
+% \begin{macrocode}
+ \ifnum\si@unt@depthcnt=\m@ne\relax
+ \expandafter\si@unt@init
+ \fi
+ \advance\si@unt@depthcnt\@ne\relax
+ \si@log@debug{Unit processing: level \the\si@unt@depthcnt,
+ \MessageBreak unit \string#2}%
+ \si@unt@firstorsecond{#1}{#2}%
+% \end{macrocode}
+% The core of the \cs{si@unt@unit} macro is testing if the symbol for
+% the unit is a literal value or another macro. Depending on the
+% result, the symbol is either used as a literal or executed.
+% \begin{macrocode}
+ \si@unt@ifliteral{#3}
+ {\si@unt@addtostack{unit}{#3}%
+ \ifsi@unt@prepower
+ \expandafter\si@unt@stkpower
+ \fi}
+ {#3}%
+% \end{macrocode}
+% The counter is now stepped down, before checking if this is
+% the end of a compound unit.
+% \begin{macrocode}
+ \advance\si@unt@depthcnt\m@ne\relax
+ \ifnum\si@unt@depthcnt=\z@\relax
+ \expandafter\si@unt@final
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@firstorsecond}
+% At this stage, the flag will be set for the first item to be
+% processed whichever route the unit has been called by.\\
+%\cs{si@unt@firstorsecond}\marg{num}\marg{macro}
+% \begin{macrocode}
+\newcommand*{\si@unt@firstorsecond}[2]{%
+ \ifsi@unt@first
+ \expandafter\si@unt@first
+ \else
+ \expandafter\si@unt@second
+ \fi
+ {#1}{#2}}%
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@first}
+% For the first unit in the input, some extra tasks are needed.
+% First, the optional argument for the unit macro needs to be
+% tested.\\
+%\cs{si@unt@first}\marg{num}\marg{unit}
+% \begin{macrocode}
+\newcommand*{\si@unt@first}[2]{%
+ \si@ifnotmtarg{#1}
+ {\num{#1}%
+ \si@unt@numtrue}%
+ \si@unt@unithook
+% \end{macrocode}
+% To avoid filling up the macro list with useless values, the \eTeX\
+% primitive \cs{ifcsname} is employed here (it also avoids complex
+% expansion issues). If some options exist, they are set.
+% \begin{macrocode}
+ \ifcsname\expandafter\@gobble\string#2@opt@unt@si\endcsname
+ \expandafter\si@unt@setopts
+ \else
+ \expandafter\@gobble
+ \fi
+ {#2}%
+ \si@unt@addvaluesep
+ \si@unt@firstfalse}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@setopts}
+%\begin{macro}{\si@unt@setSIopts}
+% A rather long set of \cs{expandafter} commands to get the options
+% to set safely.\\
+%\cs{si@unt@setopts}\marg{unit}
+% \begin{macrocode}
+\newcommand*{\si@unt@setopts}[1]{%
+ \expandafter\expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\si@temptoks\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter{\expandafter%
+ \csname\expandafter\@gobble\string#1@opt@unt@si%
+ \endcsname}%
+ \expandafter\sisetup\expandafter{\the\si@temptoks}%
+ \si@log@debug{Applying options `\the\si@temptoks'
+ for\MessageBreak unit \string#1}%
+% \end{macrocode}
+% The user options are reloaded, if defined, to ensure that they
+% still work as expected.
+% \begin{macrocode}
+ \@ifundefined{si@unt@SIopts}{}
+ {\ifx\@empty\si@unt@SIopts\@empty\else
+ \expandafter\expandafter\si@unt@setSIopts
+ \fi}}
+\newcommand*{\si@unt@setSIopts}{%
+ \expandafter\si@temptoks\expandafter{\si@unt@SIopts}%
+ \expandafter\sisetup\expandafter{\the\si@temptoks}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@second}
+%\begin{macro}{\si@unt@third}
+% For everything apart from the first item to be processed, spacing
+% may need to be added to separated different units. The macro is
+% divided into two, so that everything except the space can be added
+% in finalisation.\\
+%\cs{si@unt@second}\marg{num}\marg{unit}
+% \begin{macrocode}
+\newcommand*{\si@unt@second}[2]{%
+ \si@ifnotmtarg{#1}
+ {\si@log@warn{Optional argument to unit macro\MessageBreak
+ allowed only for outer unit}}%
+ \si@unt@third
+ \si@unt@addtostack{space}{\ensuremath{\si@unitsep}}}
+\newcommand*{\si@unt@third}{%
+ \ifsi@unt@prepower\else
+ \expandafter\si@unt@stkpower
+ \fi
+% \end{macrocode}
+% A check is made to avoid adding $-1$ to prefixes. If \opt{frac} is
+% active, then the |b| stack will be in use, otherwise it will be
+% |a|.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{prefix}%
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname\si@tempa
+ \else
+ \expandafter\si@unt@spacecheck
+ \fi
+ \ifsi@unt@per
+ \expandafter\si@unt@perseentrue
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@spacecheck}
+% A check to prevent adding $-1$ at the very beginning of the unit,
+% where there is a space on the stack.
+% \begin{macrocode}
+\newcommand*{\si@unt@spacecheck}{%
+ \renewcommand*{\si@tempa}{space}%
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname\si@tempa
+ \else
+ \expandafter\si@unt@reciptest
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@prefix}
+% Actual output of the prefixes.\\
+%\cs{si@unt@prefix}\marg{multiple}\marg{powers-ten}\marg{symbol}
+% \begin{macrocode}
+\newcommand*{\si@unt@prefix}[3]{%
+ \si@unt@firstorsecond{}{#1}%
+ \ifsi@prefixsymbolic
+ \expandafter\si@unt@addprefix
+ \else
+ \expandafter\si@unt@countprefix
+ \fi
+ {#1}{#2}{#3}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@addprefix}
+% To add the prefix, a little translation is needed.\\
+%\cs{si@unt@countprefix}\marg{gobble}\marg{gobble}\marg{symbol}
+% \begin{macrocode}
+\newcommand*{\si@unt@addprefix}[3]{%
+ \si@unt@addtostack{prefix}{#3}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@prefixcnt}
+%\begin{macro}{\si@unt@countprefix}
+%\begin{macro}{\si@unt@invprefix}
+% On the other hand, to count the prefix numeral, the symbol is
+% thrown away.\\
+%\cs{si@unt@countprefix}\marg{multiple}\marg{powers-ten}\marg{gobble}
+% \begin{macrocode}
+\newcount\si@unt@prefixcnt
+\newcommand*{\si@unt@countprefix}[3]{%
+% \end{macrocode}
+% A check is made for binary units.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{binary}%
+ \expandafter\expandafter\expandafter\ifx\expandafter
+ \csname\expandafter\@gobble\string#1@opt@si\endcsname
+ \si@tempa
+ \expandafter\sisetup
+ \else
+ \expandafter\@gobble
+ \fi
+ {prefixbase=two}%
+ \si@tempcnta#2\relax
+ \ifsi@unt@per
+ \expandafter\si@unt@invprefix
+ \fi
+ \advance\si@unt@prefixcnt\si@tempcnta\relax}
+\newcommand*{\si@unt@invprefix}{%
+ \si@tempcntb\si@tempcnta\relax
+ \si@tempcnta -\si@tempcntb\relax}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@litpower}
+% For literal power output, the number can't simply be dumped, so
+% a macro is needed.\\
+%\cs{si@unt@litpower}\marg{gobble}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@unt@litpower}[2]{\textsuperscript{#2}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@unt@prepower}
+%\begin{macro}{\si@unt@power}
+% The handling of powers starts by ensuring that ``pre'' powers
+% follow \cs{per} cleanly. Then a check is needed for inversion.\\
+%\cs{si@unt@power}\marg{power}\marg{num}
+% \begin{macrocode}
+\newif\ifsi@unt@prepower
+\newcommand*{\si@unt@power}[2]{%
+ \renewcommand*{\si@tempa}{post}%
+ \expandafter\expandafter\expandafter\ifx\expandafter
+ \csname\expandafter\@gobble\string#1@opt@si\endcsname
+ \si@tempa
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\si@unt@firstorsecond
+ \fi
+ {}{\power}%
+ \si@unt@powerdim #2 pt\relax
+ \ifsi@frac\else
+ \ifsi@unt@per
+ \expandafter\expandafter\expandafter\si@unt@invpower
+ \fi
+ \fi
+ \renewcommand*{\si@tempa}{post}%
+ \si@unt@prepowertrue
+ \expandafter\expandafter\expandafter\ifx\expandafter
+ \csname\expandafter\@gobble\string#1@opt@si\endcsname
+ \si@tempa
+ \expandafter\si@unt@stackpower
+ \else
+ \si@log@debug{Power \strip@pt\si@unt@powerdim\space saved
+ to be added after\MessageBreak next unit}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@powerdim}
+% To do sign-inversion on the power, a dimension is used (this allows
+% non-integer values to be handled).
+% \begin{macrocode}
+\newdimen\si@unt@powerdim
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@stackpower}
+%\begin{macro}{\si@unt@stkpower}
+%\begin{macro}{\si@unt@stkpwr}
+% Adding powers to the stack should also clear the power list. If
+% the number is already zero, then of course nothing happens.
+% \begin{macrocode}
+\newcommand*{\si@unt@stackpower}{%
+ \si@unt@prepowerfalse
+% \end{macrocode}
+% A trap is used for $-1$ added to the denominator of a fraction.
+% \begin{macrocode}
+ \si@unt@stkpower
+ \ifsi@stickyper\else
+ \si@unt@perfalse
+ \si@unt@perseenfalse
+ \fi}
+% \end{macrocode}
+% The \cs{si@unt@stkpower} macro needs to be called from a few
+% places, so is spun out from the above.
+% \begin{macrocode}
+\newcommand*{\si@unt@stkpower}{%
+ \ifdim\si@unt@powerdim=\m@ne pt\relax
+ \ifsi@frac\else
+ \expandafter\expandafter\expandafter\si@unt@stkpwr
+ \fi
+ \else
+ \expandafter\si@unt@stkpwr
+ \fi}
+% \end{macrocode}
+% Finally, the actual adding (set up to avoid problems with the
+% \cs{if} above).
+% \begin{macrocode}
+\newcommand*{\si@unt@stkpwr}{%
+ \ifdim\si@unt@powerdim=\z@\relax\else
+ \renewcommand*{\si@tempa}{unit}%
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname
+ \si@tempa
+ \si@log@debug{Adding power
+ \strip@pt\si@unt@powerdim\space to output stack}%
+ \si@unt@addtostack{power}{^{\num{%
+ \strip@pt\si@unt@powerdim}}}%
+ \fi
+ \fi
+ \si@unt@powerdim\z@\relax}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@invpower}
+% A macro to change the sign of the current power.
+% \begin{macrocode}
+\newcommand*{\si@unt@invpower}{%
+ \si@tempdima\si@unt@powerdim\relax
+ \si@unt@powerdim -\si@tempdima\relax
+% \end{macrocode}
+% The power might end up as ``1'', which is not wanted. So it is
+% chucked away.
+% \begin{macrocode}
+ \ifdim\si@unt@powerdim=\p@\relax
+ \si@unt@powerdim\z@\relax
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@unt@per}
+%\begin{macro}{\ifsi@unt@perseen}
+%\begin{macro}{\per}
+%\begin{macro}{\si@per}
+%\begin{macro}{\si@unt@per}
+% The \cs{per} macro sets the correct flags; almost everything else
+% is done elsewhere. There is always the case of two \cs{per}
+% instructions; so the flag is flipped rather than set arbitrarily.
+% The second flag is needed so that \cs{per} can give powers of $-1$
+% properly.
+% \begin{macrocode}
+\newif\ifsi@unt@per
+\newif\ifsi@unt@perseen
+\si@newrobustcmd*{\si@per}{%
+ \ifsi@unt@littest\else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter /%
+ \else
+ \ifsi@unt@litprefix
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter /%
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@unt@per
+ \fi
+ \fi
+ \fi}
+\newcommand*{\si@unt@per}{%
+ \si@unt@firstorsecond{}{\per}%
+ \ifsi@unt@per
+ \ifsi@stickyper\else
+ \expandafter\expandafter\expandafter\si@unt@perfalse
+ \fi
+ \else
+ \expandafter\si@unt@pertrue
+ \fi}
+\let\per\si@per
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@reciptest}
+%\begin{macro}{\si@unt@recip}
+% A test is needed for adding $-1$ when needed. The second macro is
+% fired only if the power should be reciprocal.
+% \begin{macrocode}
+\newcommand*{\si@unt@reciptest}{%
+ \ifsi@unt@per
+ \ifsi@unt@perseen
+ \expandafter\expandafter\expandafter\si@unt@recip
+ \fi
+ \fi}
+\newcommand*{\si@unt@recip}{%
+ \si@unt@powerdim\m@ne pt\relax
+ \si@unt@stackpower}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@lastadda}
+%\begin{macro}{\si@unt@lastaddb}
+%\begin{macro}{\si@unt@addtostack}
+% Items cannot be added directly to the stacks (except the spacing
+% stack, a) as the fractional handling may need to add the item to
+% either storage area. By indicating the type of data to be added to
+% the stack, problems can be avoided.\\
+%\cs{si@unt@addtostack}\marg{type}\marg{token}
+% \begin{macrocode}
+\newcommand*{\si@unt@lastadda}{}
+\newcommand*{\si@unt@lastaddb}{}
+\newcommand*{\si@unt@addtostack}[2]{%
+ \renewcommand*{\si@tempa}{#1}%
+% \end{macrocode}
+% Two consecutive items cannot be of the same type; there must be spaces
+% between units, units between prefixes, \etc.
+% \begin{macrocode}
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname\si@tempa
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\si@unt@preplussp
+ \fi
+ {#1}{#2}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@preplussp}
+% The space added after a prefix needs to be ignored.\\
+%\cs{si@unt@preplussp}\marg{type}\marg{stack}\marg{token}^^A
+% \marg{gobble}
+% \begin{macrocode}
+\newcommand*{\si@unt@preplussp}[2]{%
+ \renewcommand*{\si@tempa}{prefix+space}%
+ \edef\si@tempb{%
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname+#1}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\si@unt@stack
+ \fi
+ {#1}{#2}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@stack}
+% The macro for actually doing the stacking up.\\
+%\cs{si@unt@stack}\marg{type}\marg{tokens}
+% \begin{macrocode}
+\newcommand*{\si@unt@stack}[2]{%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname}{#1}%
+% \end{macrocode}
+% A count is kept of the number of \emph{units} added to each stack.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{#1}%
+ \renewcommand*{\si@tempb}{unit}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@unt@inccnt
+ \fi
+% \end{macrocode}
+% If a space is added, it is actually held until the next add.
+% \begin{macrocode}
+ \renewcommand*{\si@tempb}{space}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@unt@holdspace
+ \else
+ \expandafter\si@unt@addstack
+ \fi
+ {#2}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@inccnt}
+% The appropriate counter is added to.
+% \begin{macrocode}
+\newcommand*{\si@unt@inccnt}{%
+ \expandafter\advance
+ \csname si@unt@unitcnt\si@unt@checkstack\endcsname
+ \@ne\relax}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@holdspace}
+%\begin{macro}{\si@unt@addstack}
+%\begin{macro}{\si@unt@holdstacka}
+%\begin{macro}{\si@unt@holdstackb}
+% Depending on the nature of the addition, it is either held or added
+% to the stack. For the ``b'' space stack, a check is made to ensure
+% that a space cannot be added before the first item.\\
+%\cs{si@unt@holdspace}\marg{tokens}\\
+%\cs{si@unt@addstack}\marg{tokens}
+% \begin{macrocode}
+\newcommand*{\si@unt@holdstacka}{}
+\newcommand*{\si@unt@holdstackb}{}
+\newcommand*{\si@unt@holdspace}[1]{%
+ \renewcommand*{\si@tempa}{b}%
+ \edef\si@tempb{\si@unt@checkstack}%
+ \ifx\si@tempa\si@tempb
+ \ifx\@empty\si@unt@stackb\@empty
+ \else
+ \expandafter\protected@edef
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname{#1}%
+ \fi
+ \else
+ \expandafter\protected@edef
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname{#1}%
+ \fi}
+\newcommand*{\si@unt@addstack}[1]{%
+ \expandafter\protected@edef
+ \csname si@unt@stack\si@unt@checkstack\endcsname
+ {\csname si@unt@stack\si@unt@checkstack\endcsname
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname#1}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname}{}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@stackout}
+% The stack contents are actually typeset here. First the spacing
+% between units and values is added.
+% \begin{macrocode}
+\newcommand*{\si@unt@stackout}{%
+ \si@unt@litouttrue
+ \ifsi@frac
+ \expandafter\si@unt@fracout
+ \else
+ \expandafter\si@unt@normout
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@checkstack}
+% Which stack is in use needs to be tested.
+% \begin{macrocode}
+\newcommand*{\si@unt@checkstack}{%
+ \ifsi@frac
+ \ifsi@unt@per
+ \expandafter\expandafter\expandafter b%
+ \else
+ \expandafter\expandafter\expandafter a%
+ \fi
+ \else
+ \expandafter a%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@spaceout}
+% The space before a unit might not be needed, so it crops up a few
+% times in the output routine.
+% \begin{macrocode}
+\newcommand*{\si@unt@spaceout}{%
+ \ensuremath{\si@unt@spstack}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@prefixout}
+% If the prefix counter is not zero, then there is something to
+% typeset.
+% \begin{macrocode}
+\newcommand*{\si@unt@prefixout}{%
+ \ifnum\si@unt@prefixcnt=\z@\relax\else
+ \ifsi@unt@num
+ \si@out{\ensuremath{{}\si@prefixproduct{}}}%
+ \fi
+ \si@unt@stackvalsep
+ \let\si@expbase\si@prefixbase
+ \num{e\the\si@unt@prefixcnt}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@normout}
+% The normal output mode is set up here; nothing much needs to be
+% done as there is no need for complex checks.
+% \begin{macrocode}
+\newcommand*{\si@unt@normout}{%
+ \si@unt@prefixout
+ \si@unt@spaceout
+ \expandafter\si@unt@out\expandafter{\si@unt@stacka}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@fracout}
+% For fractions, some checks are needed.
+% \begin{macrocode}
+\newcommand*{\si@unt@fracout}{%
+ \si@unt@notambig
+ \ifx\@empty\si@unt@stacka\@empty
+ \ifx\@empty\si@unt@stackb\@empty
+ \ifsi@unt@litout\else
+ \si@log@err{Empty fractional unit}{The unit
+ argument\MessageBreak given does not contain any
+ symbols}%
+ \fi
+ \else
+% \end{macrocode}
+% With an empty numerator, no space is added
+% \begin{macrocode}
+ \ifsi@slash
+ \si@unt@prefixout
+ \si@frac{}{\si@unt@stackb}%
+ \else
+ \si@unt@prefixout
+ \si@unt@spaceout
+ \si@frac{1}{\si@unt@stackb}%
+ \fi
+ \fi
+ \else
+% \end{macrocode}
+% If the denominator is empty, then the usual output system can be
+% used.
+% \begin{macrocode}
+ \ifx\@empty\si@unt@stackb\@empty
+ \si@unt@normout
+ \else
+ \si@unt@prefixout
+ \si@unt@spaceout
+ \si@frac{\si@unt@stacka}{\si@unt@stackb}%
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@notambig}
+%\begin{macro}{\si@unt@notabg}
+% A trap is set for adding brackets to units using a slash, when more
+% than one unit is in the denominator.
+% \begin{macrocode}
+\newcommand*{\si@unt@notambig}{%
+ \ifnum\si@unt@unitcntb>\@ne\relax
+ \ifsi@slash
+ \ifsi@trapambigfrac
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@unt@notabg
+ \fi
+ \fi
+ \fi}
+\newcommand*{\si@unt@notabg}{%
+ \protected@edef\si@unt@stackb{\si@openfrac\si@unt@stackb
+ \si@closefrac}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+%\begin{macro}{\si@unt@out}
+% The final part of the units system is the output routine. This has
+% to cope with units not only as macros but also as direct input
+% (\SIstyle-type input). Non-Latin characters are also handled
+% cleanly. As usual, \cs{scantokens} is used to make life easier.\\
+%\cs{si@unt@out}\marg{unit}
+% \begin{macrocode}
+\begingroup
+ \catcode`\~=\active
+ \catcode`\.=\active
+ \gdef\si@unt@out#1{%
+ \begingroup
+ \si@unt@nonlatin
+ \makeatletter
+ \catcode`\~=\active
+ \catcode`\.=\active
+ \def~{\ensuremath{\si@unitspace}}%
+ \def.{\ensuremath{\si@unitsep}}%
+ \endlinechar\m@ne
+ \si@out{\scantokens{#1}}%
+ \endgroup}
+\endgroup
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@nonlatin}
+% To handle non-Latin symbols in the input, a single macro is
+% provided. If \XeTeX\ is in use, this can be detected immediately.
+% \begin{macrocode}
+\newcommand*{\si@unt@nonlatin}{}
+\ifdefined\XeTeXrevision
+ \renewcommand*{\si@unt@nonlatin}{%
+ \catcode176=\active
+ \catcode181=\active
+ \catcode197=\active
+ \si@unt@sym{176}{\si@sym@degree}%
+ \si@unt@sym{181}{\si@sym@mu}%
+ \si@unt@sym{197}{\si@sym@ringA}}%
+\fi
+% \end{macrocode}
+% If \pkg{inputenc} has been loaded, then a check is made that the
+% encoding is correct. If all is well, the non-Latin symbols are
+% handled. The degree symbol is character 176, the micro
+% symbol is character 181 and ring capital A is character 197 in
+% latin1.
+% \begin{macrocode}
+\AtBeginDocument{
+ \@ifpackageloaded{inputenc}
+ {\@for\si@tempa:=latin1,latin5,latin9\do{
+ \ifx\inputencodingname\si@tempa
+ \renewcommand*{\si@unt@nonlatin}{%
+ \catcode176=\active
+ \catcode181=\active
+ \catcode197=\active
+ \si@unt@sym{176}{\si@sym@degree}%
+ \si@unt@sym{181}{\si@sym@mu}%
+ \si@unt@sym{197}{\si@sym@ringA}}%
+ \fi}}
+ {}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@unt@sym}
+% A macro for declaring symbols: a copy of \cs{DeclareInputMath} from
+% \pkg{inputenc}.\\
+%\cs{si@unt@sym}\marg{charcode}
+% \begin{macrocode}
+\newcommand*{\si@unt@sym}[1]{%
+ \bgroup
+ \uccode`\~#1%
+ \uppercase{%
+ \egroup
+ \def~}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\kilogram}
+%\begin{macro}{\metre}
+%\begin{macro}{\meter}
+%\begin{macro}{\mole}
+%\begin{macro}{\kelvin}
+%\begin{macro}{\candela}
+%\begin{macro}{\second}
+%\begin{macro}{\ampere}
+% With the system set up, the basic unit macros are implemented. The
+% only units defined whatever options are given are the base SI
+% units.
+% \begin{macrocode}
+\newunit{\kilogram}{kg}
+\newunit{\metre}{m}
+\newunit{\meter}{\metre}
+\newunit{\mole}{mol}
+\newunit{\second}{s}
+\newunit{\ampere}{A}
+\newunit{\kelvin}{K}
+\newunit{\candela}{cd}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\Square}
+%\begin{macro}{\ssquare}
+%\begin{macro}{\squared}
+%\begin{macro}{\cubic}
+%\begin{macro}{\cubed}
+% Unlike multiples (which can be skipped if needed), the basic powers
+% are also always defined.
+% \begin{macrocode}
+\newpower{\Square}{2}
+\newpower{\ssquare}{2}
+\newpower[post]{\squared}{2}
+\newpower{\cubic}{3}
+\newpower[post]{\cubed}{3}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\tothe}
+%\begin{macro}{\si@tothe}
+%\begin{macro}{\raiseto}
+%\begin{macro}{\tothe@opt@si}
+%\begin{macro}{\raiseto@opt@si}
+% A macro for arbitrary powers, which comes after the unit and so
+% needs to be marked as such.\\
+%\cs{tothe}\marg{num}\\
+%\cs{raiseto}\marg{num}
+% \begin{macrocode}
+\newcommand*{\tothe}{\si@tothe{\tothe}}
+\newcommand*{\raiseto}{\si@tothe{\raiseto}}
+\newcommand*{\si@tothe}[2]{%
+ \ifsi@unt@littest
+ \expandafter\@gobbletwo
+ \else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\si@unt@litpower
+ \else
+ \expandafter\expandafter\expandafter\si@unt@power
+ \fi
+ \fi
+ {#1}{#2}}
+\newcommand*{\tothe@opt@si}{post}
+\newcommand*{\raiseto@opt@si}{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\subsection{Locales}
+%\begin{macro}{\si@loc@load}
+%\begin{macro}{\si@loc@sisetup}
+% When loading a locale, the setup is saved rather than applied.
+% Anything other than simple settings should be inside
+% \cs{addtolocale}, which is already defined.\\
+%\cs{si@loc@load}\marg{locale}
+% \begin{macrocode}
+\newcommand*{\si@loc@load}[1]{%
+ \let\si@loc@sisetup\sisetup
+ \renewcommand*{\sisetup}[1]{%
+ \expandafter\gdef\csname si@loc@#1\endcsname{##1}}
+ \si@loadfile{#1}%
+ \let\sisetup\si@loc@sisetup}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@loc@set}
+% Setting the locale transfers the settings to \cs{sisetup}, and runs
+% any extra macros.\\
+%\cs{si@loc@set}\marg{locale}
+% \begin{macrocode}
+\newcommand*{\si@loc@set}[1]{%
+ \ifcsname si@loc@#1\endcsname
+ \si@log@inf{Setting locale to `#1'}%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@temptoks
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter{%
+ \expandafter\csname si@loc@#1\endcsname}%
+ \expandafter\sisetup\expandafter{\the\si@temptoks}%
+ \ifcsname si@loc@#1@extra\endcsname
+ \csname si@loc@#1@extra\endcsname
+ \fi
+ \else
+ \ifcsname si@loc@#1@extra\endcsname
+ \si@log@inf{Setting locale to `#1'}%
+ \csname si@loc@#1@extra\endcsname
+ \else
+ \si@log@warn{Unknown locale `#1'}%
+ \fi
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@loc@ltol}
+% \begin{macrocode}
+\newcommand*{\si@loc@ltol}[1]{%
+ \def\si@tempa##1:##2\@nil{\si@loc@load{##1}}
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb:\@nil}
+ \AtBeginDocument{
+ \@ifpackageloaded{babel}
+ {\def\si@tempa##1:##2:##3\@nil{%
+ \expandafter\addto\expandafter{%
+ \csname extras##2\endcsname}%
+ {\si@loc@set{##1}}}%
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb::\@nil}}
+ {\si@log@warn{babel not loaded \MessageBreak
+ loctolang option ignored}}}}
+\AtBeginDocument{
+ \@ifpackageloaded{babel}
+ {\renewcommand*{\si@loc@ltol}[1]{%
+ \def\si@tempa##1:##2\@nil{\si@loc@load{##1}}%
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb:\@nil}%
+ \def\si@tempa##1:##2:##3\@nil{%
+ \expandafter\addto\expandafter{%
+ \csname extras##2\endcsname}%
+ {\si@loc@set{##1}}}%
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb::\@nil}}}
+ {\renewcommand*{\si@loc@ltol}[1]{%
+ \si@log@warn{babel not loaded \MessageBreak
+ loctolang option ignored}}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\addtolocale}
+% Arbitrary macros may need to be added to the locale.\\
+%\cs{addtolocale}\marg{locale}\marg{commands}
+% \begin{macrocode}
+\newcommand*{\addtolocale}[2]{%
+ \si@addtocsname{si@loc@#1@extra}{#2}}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Output routine}
+%\begin{macro}{\si@out}
+% With all of the setup done, the text can finally be typeset. This
+% is done inside a \cs{text} block, which takes care of
+% \cs{ensuremath}, \etc. First of all, the various catcode settings
+% needed to get maths-in-text mode are made. \cs{makeatletter} is
+% needed so that \cs{scantokens} still allows internal macros to
+% work.\\
+%\cs{si@out}\marg{text}
+% \begin{macrocode}
+\begingroup
+ \catcode`\^=\active\relax
+ \catcode`\-=\active\relax
+ \gdef\si@out#1{%
+ \begingroup
+ \catcode`\^=\active\relax
+ \makeatletter
+ \endlinechar\m@ne
+% \end{macrocode}
+% The various font families can now be set up. First a check is made
+% in case there are nested calls to \cs{si@out@text}.
+% \begin{macrocode}
+ \ifsi@fam@set\else
+ \expandafter\si@fam@set
+ \fi
+ \si@colourcmd{\si@colour}%
+ \text{\si@fam@italic\si@fam@bold\si@fam@text
+% \end{macrocode}
+% The correct mode is selected, and the input is handed off for
+% typesetting.
+% \begin{macrocode}
+ \ifsi@textmode
+ \expandafter\si@out@text
+ \else
+ \expandafter\si@out@maths
+ \fi
+ {\scantokens{#1}}}%
+ \endgroup
+ \check@mathfonts}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@out@text}
+%\begin{macro}{\si@out@maths}
+% Output occurs with the correct changes to superscript behaviour.\\
+%\cs{si@out@text}\marg{text}\\
+%\cs{si@out@maths}\marg{text}
+% \begin{macrocode}
+ \gdef\si@out@text#1{%
+ \let^\si@out@sp
+ \let\textsuperscript\si@out@sp
+ \catcode`\-=\active\relax
+ \let-\si@out@minus
+ #1}
+ \gdef\si@out@maths#1{%
+ \let^\sp
+ \let\textsuperscript\sp
+ $\si@fam@maths{#1}$}
+\endgroup
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@out@sp}
+% \cs{textsuperscript} gives slightly different alignment of numbers
+% to using |^| in text mode. To avoid this, a slightly different
+% definition is used. Elsewhere \cs{textsuperscript} is used, as
+% the code above sorts out the text/maths mode issues.\\
+%\cs{si@out@sp}\marg{text}
+% \begin{macrocode}
+\newcommand*{\si@out@sp}[1]{\ensuremath{^{\text{#1}}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@out@minus}
+% An active minus sign is needed.
+% \begin{macrocode}
+\newcommand*{\si@out@minus}{\ensuremath{-}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ifsi@out@num}
+% A flag is needed to control output settings. This will be
+% false unless inside \cs{si@out@num}.
+% \begin{macrocode}
+\newif\ifsi@out@num
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@out@num}
+% For numerical output, the default fonts are controlled slightly
+% differently to text output.\\
+%\cs{si@out@num}\marg{num}
+% \begin{macrocode}
+\newcommand*{\si@out@num}[1]{%
+ \begingroup
+ \si@out@numtrue
+ \si@out{#1}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Finalisation}
+%\begin{macro}{\si@extension}
+%\begin{macro}{\si@fileprefix}
+% To keep the code easy to maintain, the reusable filename components
+% are macros rather than literals.
+% \begin{macrocode}
+\newcommand*{\si@extension}{cfg}
+\newcommand*{\si@fileprefix}{si-}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ifl@aded}
+%\begin{macro}{\si@ifloaded}
+% A bit of borrowing from the \LaTeX\ kernel. A copy of \cs{@ifl@aded}
+% is needed as things aren't always done in the preamble by
+% \currpkg.\\
+%\cs{si@ifloaded}\marg{package}
+% \begin{macrocode}
+\newcommand*{\si@ifl@aded}{}
+\let\si@ifl@aded\@ifl@aded
+\newcommand*{\si@ifloaded}[1]{%
+ \si@ifl@aded\si@extension{\si@fileprefix#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@loadfile}
+% Loading configuration files is handled here.\\
+%\cs{si@loadfile}\marg{file}
+% \begin{macrocode}
+\newcommand*{\si@loadfile}[1]{%
+ \si@ifloaded{#1}{}
+ {\InputIfFileExists{\si@fileprefix#1.\si@extension}
+ {}
+ {\si@log@err{Failed to load file
+ \si@fileprefix#1.\si@extension}
+ {The configuration file requested could not be
+ found}}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\requiresiconfigs}
+% The configuration files depend on each other.\\
+%\cs{requiresiconfigs}\marg{cfg-file}
+% \begin{macrocode}
+\newcommand*{\requiresiconfigs}[1]{%
+ \@for\si@tempb:=#1\do{\si@loadfile{\si@tempb}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@loademfile}
+% For emulation files, an additional check is made.\\
+%\cs{si@loademfile}\marg{file}
+% \begin{macrocode}
+\newcommand*{\si@loademfile}[1]{%
+ \@ifpackageloaded{#1}
+ {\si@log@err{Emulation clash for package `#1'}
+ {You have asked for emulation of package
+ `#1'\MessageBreak
+ (perhaps by giving siunitx a back-compatibility
+ option)\MessageBreak but the package is already
+ loaded!}}
+ {\si@loadfile{#1}}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@emclash}
+% A macro for emulation clashes.\\
+%\cs{si@emclash}\marg{package}\marg{package}
+% \begin{macrocode}
+\newcommand*{\si@emclash}[2]{%
+ \si@log@err{Emulation clash: `#1' and `#2'}
+ {You have asked for emulation of package `#1'\MessageBreak
+ but have already loaded emulation of `#2'}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@emulating}
+% For packages that are emulated, the \LaTeX\ mechanism to prevent
+% re-loading is used. The list of packages to check at the start
+% of the document also has to be altered.\\
+%\cs{si@emulating}\marg{package}\marg{version}
+% \begin{macrocode}
+\newcommand*{\si@emulating}[2]{%
+ \@namedef{ver@#1.sty}{#2 siunitx emulation of #1}%
+ \let\si@tempa\si@blockpkgs
+ \renewcommand*{\si@blockpkgs}{}%
+ \@for\si@tempb:=\si@tempa\do{%
+ \renewcommand*{\si@tempa}{#1}%
+ \ifx\si@tempa\si@tempb\else
+ \lowercase{\edef\si@tempa{#1}}%
+ \lowercase{\edef\si@tempc{\si@tempb}}%
+ \ifx\si@tempa\si@tempc
+ \@namedef{ver@\si@tempc.sty}{#2 siunitx emulation of
+ #1}%
+ \else
+ \si@addtolist{\si@blockpkgs}{\si@tempb}%
+ \fi
+ \fi}%
+ \let\si@tempa\si@checkpkgs
+ \renewcommand*{\si@checkpkgs}{}%
+ \renewcommand*{\si@tempb}{#1}%
+ \@for\si@tempc:=\si@tempa\do{%
+ \ifx\si@tempb\si@tempc\else
+ \si@addtolist{\si@checkpkgs}{\si@tempc}%
+ \fi}}
+% \end{macrocode}
+%\end{macro}
+% With the \currpkg kernel macros defined, the package can now run
+% through finalisation. First, the default key values are set. The
+% user options are then processed.
+% \begin{macrocode}
+\sisetup{
+ addsign=none,
+ allowzeroexp=false,
+ angformat=unchanged,
+ astroang=false,%(
+ closeerr=),%(
+ closefrac=),
+ colour=black,
+ colourall=false,
+ colourneg=false,
+ decimalsymbol=fullstop,
+ detectdisplay=true,
+ digitsep=thin,
+ dp=3,
+ eVcorra=0.3ex,
+ eVcorrb=0ex,
+ errspace=none,
+ fixdp=false,
+ inlinebold=text,
+ load=default,
+ mathsrm=mathrm,
+ mathssf=mathsf,
+ mathstt=mathtt,
+ mode=maths,
+ negcolour=red,
+ noload={},
+ numaddn={},%(
+ numcloseerr=),%
+ numdecimal={.,},
+ numdigits=0123456789,
+ numexp=eEdD,
+ numgobble={},
+ numopenerr=(,%)
+ numprod=x,
+ numsign=+-\pm\mp,
+ obeybold=false,
+ obeyitalic=false,
+ obeymode=false,
+ openerr=(,%)
+ openfrac=(,%)
+ padangle=small,
+ padnumber=lead,
+ per=reciprocal,
+ prefixbase=ten,
+ prefixproduct=times,
+ prefixsymbolic=true,
+ prespace=false,
+ redefsymbols=true,
+ repeatunits=true,
+ retainplus=false,
+ seperr=false,
+ sepfour=false,
+ sign=plus,
+ slash=slash,
+ stickyper=false,
+ strictarc=true,
+ tabalignexp=true,
+ tabautofit=false,
+ tabformat=3.2,
+ tabnumalign=centredecimal,
+ tabtextalign=centre,
+ tabunitalign=left,
+ textrm=rmfamily,
+ textsf=sffamily,
+ texttt=ttfamily,
+ tightpm=false,
+ trapambigerr=true,
+ trapambigfrac=true,
+ unitsep=thin,
+ valuesep=thin,
+ xspace=false}
+\ProcessOptionsX[si]<key>
+% \end{macrocode}
+% A check is now made so that emulation takes place one file at a
+% time, and that each file is loaded only once.
+% \begin{macrocode}
+\ifx\@empty\si@emulate\@empty\else
+ \@for\si@tempa:=\si@emulate\do{%
+ \si@loademfile{\si@tempa}}
+\fi
+% \end{macrocode}
+%\begin{macro}{\si@expanddefault}
+% For turning the list of default choices into a loadable list.
+% \begin{macrocode}
+\newcommand*{\si@expanddefault}[2]{%
+ \expandafter\ifx\expandafter\@empty\csname si@#1\endcsname
+ \@empty
+ \else
+ \renewcommand*{\si@tempb}{default}%
+ \renewcommand*{\si@tempc}{}%
+ \expandafter\@for\expandafter\si@tempa\expandafter
+ :\expandafter=\csname si@#1\endcsname\do{%
+ \ifx\si@tempa\si@tempb
+ \si@addtolist{\si@tempc}{#2}%
+ \else
+ \si@addtolist{\si@tempc}{\si@tempa}%
+ \fi}
+ \expandafter\edef\csname si@#1\endcsname{\si@tempc}%
+ \expandafter\si@addtolist\expandafter{%
+ \csname si@no#1\endcsname}%
+ {default}%
+ \renewcommand*{\si@tempc}{}%
+ \expandafter\@for\expandafter\si@tempa\expandafter
+ :\expandafter=\csname si@#1\endcsname\do{%
+ \si@switchfalse
+ \expandafter\@for\expandafter\si@tempb\expandafter
+ :\expandafter=\csname si@no#1\endcsname\do{%
+ \ifx\si@tempa\si@tempb
+ \si@switchtrue
+ \fi
+ \ifsi@switch\else
+ \si@addtolist{\si@tempc}{\si@tempa}%
+ \fi}}
+ \@for\si@tempa:=\si@tempc\do{%
+ \si@loadfile{\si@tempa}}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+% The configuration and abbreviation files are loaded.
+% \begin{macrocode}
+\si@expanddefault{load}{prefix,named,addn,prefixed,accepted,%
+ physical,abbr}
+% \end{macrocode}
+% The very last job is to load a local configuration file, if one
+% exists, and restore catcodes.
+% \begin{macrocode}
+\IfFileExists{siunitx.cfg}
+ {\si@log@inf{Local configuration file found}%
+ \InputIfFileExists{siunitx.cfg}{}{}}
+ {}
+\si@catcodes
+% \end{macrocode}
+%
+%\iffalse
+%</package>
+%\fi
+%
+%\section{Loadable modules}
+% To keep the package relatively clear, and to make maintenance
+% easier, the only units defined in the package itself are the base
+% units. Everything else is a loadable module (similar to the
+% approach in \unitsdef).
+%
+%\iffalse
+%<*prefix>
+%\fi
+%\subsection{Multiple prefixes}
+%\begin{macro}{\yocto}
+%\begin{macro}{\zepto}
+%\begin{macro}{\atto}
+%\begin{macro}{\femto}
+%\begin{macro}{\pico}
+%\begin{macro}{\nano}
+%\begin{macro}{\micro}
+%\begin{macro}{\Micro}
+%\begin{macro}{\milli}
+%\begin{macro}{\centi}
+%\begin{macro}{\deci}
+% The various SI multiple prefixes are defined here. First the small
+% powers.
+% \begin{macrocode}
+\ProvidesFile{si-prefix.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Multiple prefixes]
+\newprefix{\yocto}{-24}{y}
+\newprefix{\zepto}{-21}{z}
+\newprefix{\atto}{-18}{a}
+\newprefix{\femto}{-15}{f}
+\newprefix{\pico}{-12}{p}
+\newprefix{\nano}{-9}{n}
+% \end{macrocode}
+% Some testing is needed for \unitsdef compatibility.
+% \begin{macrocode}
+\ifsi@old@OHM
+ \newprefix{\Micro}{-6}{\si@sym@mu}
+\else
+ \ifsi@gensymb\else
+ \newprefix{\micro}{-6}{\si@sym@mu}
+ \fi
+\fi
+\newprefix{\milli}{-3}{m}
+\newprefix{\centi}{-2}{c}
+\newprefix{\deci}{-1}{d}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\deca}
+%\begin{macro}{\hecto}
+%\begin{macro}{\kilo}
+%\begin{macro}{\mega}
+%\begin{macro}{\giga}
+%\begin{macro}{\tera}
+%\begin{macro}{\peta}
+%\begin{macro}{\exa}
+%\begin{macro}{\zetta}
+%\begin{macro}{\yotta}
+% Now the large ones.
+% \begin{macrocode}
+\newprefix{\deca}{1}{da}
+\newprefix{\hecto}{2}{h}
+\newprefix{\kilo}{3}{k}
+\newprefix{\mega}{6}{M}
+\newprefix{\giga}{9}{G}
+\newprefix{\tera}{12}{T}
+\newprefix{\peta}{15}{P}
+\newprefix{\exa}{18}{E}
+\newprefix{\zetta}{21}{Z}
+\newprefix{\yotta}{24}{Y}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\deka}
+% Apparently, ``deka'' is common in the US for deca.
+% \begin{macrocode}
+\newprefix{\deka}{1}{da}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\gram}
+%\begin{macro}{\kilogram}
+% As the base unit of mass is the kilogram, rather than the gram, a
+% bit of extra work is needed; by default the package only defines
+% \cs{kilogram}, but with the prefixes available, this is altered to
+% be \cs{kilo}\cs{gram}. For that, the \cs{gram} must be defined first.
+% \begin{macrocode}
+\newunit{\gram}{g}
+\renewunit{\kilogram}{\kilo\gram}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</prefix>
+%<*named>
+%\fi
+%\subsection{Derived units with specific names}
+%\begin{macro}{\becquerel}
+%\begin{macro}{\coulomb}
+%\begin{macro}{\farad}
+%\begin{macro}{\Gray}
+%\begin{macro}{\ggray}
+%\begin{macro}{\hertz}
+%\begin{macro}{\henry}
+%\begin{macro}{\joule}
+%\begin{macro}{\katal}
+%\begin{macro}{\lumen}
+%\begin{macro}{\lux}
+%\begin{macro}{\newton}
+% Derived units with specific names and symbols are defined. Litre
+% is an awkward one, but here the UK standard is used.
+% \begin{macrocode}
+\ProvidesFile{si-named.cfg}
+ [\csname si@svn@version\endcsname siunitx: SI Named units]
+\newunit{\becquerel}{Bq}
+\newunit{\coulomb}{C}
+\newunit{\farad}{F}
+\newunit{\Gray}{Gy}
+\newunit{\ggray}{Gy}
+\newunit{\hertz}{Hz}
+\newunit{\henry}{H}
+\newunit{\joule}{J}
+\newunit{\katal}{kat}
+\newunit{\lumen}{lm}
+\newunit{\lux}{lx}
+\newunit{\newton}{N}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ohm}
+%\begin{macro}{\Ohm}
+%\begin{macro}{\pascal}
+%\begin{macro}{\siemens}
+%\begin{macro}{\sievert}
+%\begin{macro}{\tesla}
+%\begin{macro}{\volt}
+%\begin{macro}{\watt}
+%\begin{macro}{\weber}
+% Some testing is needed for \unitsdef compatibility.
+% \begin{macrocode}
+\ifsi@old@OHM
+ \newunit{\Ohm}{\si@sym@Omega}
+\else
+ \ifsi@gensymb\else
+% \end{macrocode}
+% To be on the safe side, use \cs{provideunit}.
+% \begin{macrocode}
+ \provideunit{\ohm}{\si@sym@Omega}
+ \fi
+\fi
+\newunit{\pascal}{Pa}
+\newunit{\siemens}{S}
+\newunit{\sievert}{Sv}
+\newunit{\tesla}{T}
+\newunit{\volt}{V}
+\newunit{\watt}{W}
+\newunit{\weber}{Wb}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\celsius}
+%\begin{macro}{\Celsius}
+% The degree celsius is a named unit.
+% \begin{macrocode}
+\ifsi@old@OHM
+ \newunit{\Celsius}{\si@sym@celsius}
+\else
+ \ifsi@gensymb\else
+ \newunit{\celsius}{\si@sym@celsius}
+ \fi
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\radian}
+%\begin{macro}{\steradian}
+% The radian and steradian are officially derived units.
+% \begin{macrocode}
+\newunit{\radian}{rad}
+\newunit{\steradian}{sr}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</named>
+%<*prefixed>
+%\fi
+%\subsection{Units with prefixes}
+% As in \unitsdef, some commonly used prefixed units are set up.
+% This requires \file{si-prefix.cfg} and \file{si-named.cfg}.
+% \begin{macrocode}
+\ProvidesFile{si-prefixed.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Prefixed units]
+\requiresiconfigs{prefix,named,accepted,physical}
+% \end{macrocode}
+%\begin{macro}{\picometre}
+%\begin{macro}{\nanometre}
+%\begin{macro}{\micrometre}
+%\begin{macro}{\millimetre}
+%\begin{macro}{\centimetre}
+%\begin{macro}{\decimetre}
+%\begin{macro}{\kilometre}
+% Extra distances.
+% \begin{macrocode}
+\newunit{\picometre}{\pico\metre}
+\newunit{\nanometre}{\nano\metre}
+\newunit{\micrometre}{\micro\metre}
+\newunit{\millimetre}{\milli\metre}
+\newunit{\centimetre}{\centi\metre}
+\newunit{\decimetre}{\deci\metre}
+\newunit{\kilometre}{\kilo\metre}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\femtogram}
+%\begin{macro}{\picogram}
+%\begin{macro}{\nanogram}
+%\begin{macro}{\microgram}
+%\begin{macro}{\milligram}
+% Extra masses.
+% \begin{macrocode}
+\newunit{\femtogram}{\femto\gram}
+\newunit{\picogram}{\pico\gram}
+\newunit{\nanogram}{\nano\gram}
+\newunit{\microgram}{\micro\gram}
+\newunit{\milligram}{\milli\gram}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\femtomole}
+%\begin{macro}{\picomole}
+%\begin{macro}{\nanomole}
+%\begin{macro}{\micromole}
+%\begin{macro}{\millimole}
+% Now some moles.
+% \begin{macrocode}
+\newunit{\femtomole}{\femto\mole}
+\newunit{\picomole}{\pico\mole}
+\newunit{\nanomole}{\nano\mole}
+\newunit{\micromole}{\micro\mole}
+\newunit{\millimole}{\milli\mole}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\attosecond}
+%\begin{macro}{\femtosecond}
+%\begin{macro}{\picosecond}
+%\begin{macro}{\nanosecond}
+%\begin{macro}{\microsecond}
+%\begin{macro}{\millisecond}
+% Prefixed seconds.
+% \begin{macrocode}
+\newunit{\attosecond}{\atto\second}
+\newunit{\femtosecond}{\femto\second}
+\newunit{\picosecond}{\pico\second}
+\newunit{\nanosecond}{\nano\second}
+\newunit{\microsecond}{\micro\second}
+\newunit{\millisecond}{\milli\second}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\picoampere}
+%\begin{macro}{\nanoampere}
+%\begin{macro}{\microampere}
+%\begin{macro}{\milliampere}
+%\begin{macro}{\kiloampere}
+% The last prefixed base units are amperes.
+% \begin{macrocode}
+\newunit{\picoampere}{\pico\ampere}
+\newunit{\nanoampere}{\nano\ampere}
+\newunit{\microampere}{\micro\ampere}
+\newunit{\milliampere}{\milli\ampere}
+\newunit{\kiloampere}{\kilo\ampere}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\millivolt}
+%\begin{macro}{\kilovolt}
+%\begin{macro}{\milliwatt}
+%\begin{macro}{\kilowatt}
+%\begin{macro}{\megawatt}
+%\begin{macro}{\femtofarad}
+%\begin{macro}{\picofarad}
+%\begin{macro}{\nanofarad}
+%\begin{macro}{\microfarad}
+%\begin{macro}{\millifarad}
+%\begin{macro}{\millisiemens}
+% More electricity-related units.
+% \begin{macrocode}
+\newunit{\millivolt}{\milli\volt}
+\newunit{\kilovolt}{\kilo\volt}
+\newunit{\milliwatt}{\milli\watt}
+\newunit{\kilowatt}{\kilo\watt}
+\newunit{\megawatt}{\mega\watt}
+\newunit{\femtofarad}{\femto\farad}
+\newunit{\picofarad}{\pico\farad}
+\newunit{\nanofarad}{\nano\farad}
+\newunit{\microfarad}{\micro\farad}
+\newunit{\millifarad}{\milli\farad}
+\newunit{\millisiemens}{\milli\siemens}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\kiloohm}
+%\begin{macro}{\megaohm}
+%\begin{macro}{\gigaohm}
+% For resistance, checks are needed again for the definition of
+% \cs{ohm}.
+% \begin{macrocode}
+\ifsi@old@OHM
+ \newunit{\kiloohm}{\kilo\Ohm}
+ \newunit{\megaohm}{\mega\Ohm}
+ \newunit{\gigaohm}{\giga\Ohm}
+\else
+ \ifsi@gensymb\else
+ \newunit{\kiloohm}{\kilo\ohm}
+ \newunit{\megaohm}{\mega\ohm}
+ \newunit{\gigaohm}{\giga\ohm}
+ \fi
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\microlitre}
+%\begin{macro}{\millilitre}
+%\begin{macro}{\cubicmetre}
+%\begin{macro}{\cubiccentimetre}
+%\begin{macro}{\centimetrecubed}
+%\begin{macro}{\cubicmicrometre}
+%\begin{macro}{\cubicmillimetre}
+%\begin{macro}{\cubicdecimetre}
+% Volumes (unlike \unitsdef, with litre and metre spelled
+% correctly). \cs{millilitre} and \cs{microlitre} are defined
+% as they are the two officially-sanctioned prefixes for the litre.
+% \begin{macrocode}
+\newunit{\microlitre}{\micro\litre}
+\newunit{\millilitre}{\milli\litre}
+\newunit{\cubicmetre}{\metre\cubed}
+\newunit{\cubiccentimetre}{\centi\metre\cubed}
+\newunit{\centimetrecubed}{\centi\metre\cubed}
+\newunit{\cubicmicrometre}{\micro\metre\cubed}
+\newunit{\cubicmillimetre}{\milli\metre\cubed}
+\newunit{\cubicdecimetre}{\cubic\deci\metre}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\squaremetre}
+%\begin{macro}{\squarecentimetre}
+%\begin{macro}{\centimetresquared}
+%\begin{macro}{\squarekilometre}
+% Areas, with metre spelled corrected; \cs{are} and \cs{hectare} are
+% in the ``temporarily accepted'' file.
+% \begin{macrocode}
+\newunit{\squaremetre}{\Square\metre}
+\newunit{\squarecentimetre}{\Square\centi\metre}
+\newunit{\centimetresquared}{\centi\metre\squared}
+\newunit{\squarekilometre}{\Square\kilo\metre}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\millijoule}
+%\begin{macro}{\kilojoule}
+%\begin{macro}{\megajoule}
+%\begin{macro}{\millielectronvolt}
+%\begin{macro}{\kiloelectronvolt}
+%\begin{macro}{\megaelectronvolt}
+%\begin{macro}{\gigaelectronvolt}
+%\begin{macro}{\teraelectronvolt}
+%\begin{macro}{\kilowatthour}
+% Some energy is needed by now! Notice the definition of
+% \cs{kilowatthour}
+% \begin{macrocode}
+\newunit{\millijoule}{\milli\joule}
+\newunit{\kilojoule}{\kilo\joule}
+\newunit{\megajoule}{\mega\joule}
+\newunit{\millielectronvolt}{\milli\electronvolt}
+\newunit{\kiloelectronvolt}{\kilo\electronvolt}
+\newunit{\megaelectronvolt}{\mega\electronvolt}
+\newunit{\gigaelectronvolt}{\giga\electronvolt}
+\newunit{\teraelectronvolt}{\tera\electronvolt}
+\newunit[unitsep=none]{\kilowatthour}{\kilo\watt\hour}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\millihertz}
+%\begin{macro}{\kilohertz}
+%\begin{macro}{\megahertz}
+%\begin{macro}{\gigahertz}
+%\begin{macro}{\terahertz}
+% Frequencies.
+% \begin{macrocode}
+\newunit{\millihertz}{\milli\hertz}
+\newunit{\kilohertz}{\kilo\hertz}
+\newunit{\megahertz}{\mega\hertz}
+\newunit{\gigahertz}{\giga\hertz}
+\newunit{\terahertz}{\tera\hertz}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\millinewton}
+%\begin{macro}{\kilonewton}
+%\begin{macro}{\hectopascal}
+%\begin{macro}{\megabecquerel}
+%\begin{macro}{\millisievert}
+% A few more from various areas.
+% \begin{macrocode}
+\newunit{\millinewton}{\milli\newton}
+\newunit{\kilonewton}{\kilo\newton}
+\newunit{\hectopascal}{\hecto\pascal}
+\newunit{\megabecquerel}{\mega\becquerel}
+\newunit{\millisievert}{\milli\sievert}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</prefixed>
+%<*abbr>
+%\fi
+%\subsection{Abbreviated units}
+%\begin{macro}{\pA}
+%\begin{macro}{\nA}
+%\begin{macro}{\micA}
+%\begin{macro}{\mA}
+%\begin{macro}{\kA}
+% The abbreviated units are sorted in one file. To allow
+% back-compatibility with \unitsdef, each one is inside an \cs{if}
+% block for the appropriate option. First currents.
+% \begin{macrocode}
+\ProvidesFile{si-abbr.cfg}
+ [\csname si@svn@version\endcsname siunitx: Abbreviated units]
+\requiresiconfigs{prefix,named,accepted,physical}
+\newunit{\pA}{\pico\ampere}
+\newunit{\nA}{\nano\ampere}
+\newunit{\micA}{\micro\ampere}
+\newunit{\mA}{\milli\ampere}
+\newunit{\kA}{\kilo\ampere}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\Hz}
+%\begin{macro}{\mHz}
+%\begin{macro}{\kHz}
+%\begin{macro}{\MHz}
+%\begin{macro}{\GHz}
+%\begin{macro}{\THz}
+% Then frequencies.
+% \begin{macrocode}
+\newunit{\Hz}{\hertz}
+\newunit{\mHz}{\milli\hertz}
+\newunit{\kHz}{\kilo\hertz}
+\newunit{\MHz}{\mega\hertz}
+\newunit{\GHz}{\giga\hertz}
+\newunit{\THz}{\tera\hertz}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\fmol}
+%\begin{macro}{\pmol}
+%\begin{macro}{\nmol}
+%\begin{macro}{\micmol}
+%\begin{macro}{\mmol}
+% Amounts of substance.
+% \begin{macrocode}
+\newunit{\fmol}{\femto\mole}
+\newunit{\pmol}{\pico\mole}
+\newunit{\nmol}{\nano\mole}
+\newunit{\micmol}{\micro\mole}
+\newunit{\mmol}{\milli\mole}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\kV}
+%\begin{macro}{\mV}
+% Potentials.
+% \begin{macrocode}
+\newunit{\kV}{\kilo\volt}
+\newunit{\mV}{\milli\volt}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ml}
+%\begin{macro}{\micl}
+%\begin{macro}{\cmc}
+%\begin{macro}{\dmc}
+%\begin{macro}{\cms}
+% Volumes and areas
+% \begin{macrocode}
+\provideunit{\ml}{\milli\litre}
+\provideunit{\micl}{\micro\litre}
+\newunit{\cmc}{\centi\metre\cubed}
+\newunit{\dmc}{\deci\metre\cubed}
+\newunit{\cms}{\centi\metre\squared}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\kg}
+%\begin{macro}{\fg}
+%\begin{macro}{\pg}
+%\begin{macro}{\nanog}
+%\begin{macro}{\micg}
+%\begin{macro}{\mg}
+%\begin{macro}{\amu}
+% Masses.
+% \begin{macrocode}
+\newunit{\kg}{\kilo\gram}
+% \end{macrocode}
+% There is a name clash with \pkg{babel} here in French; hopefully
+% there will not be too many complaints.
+% \begin{macrocode}
+\provideunit{\fg}{\femto\gram}
+\newunit{\pg}{\pico\gram}
+\newunit{\nanog}{\nano\gram}
+\newunit{\micg}{\micro\gram}
+\newunit{\mg}{\milli\gram}
+\newunit{\amu}{\atomicmass}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\kJ}
+%\begin{macro}{\eV}
+%\begin{macro}{\meV}
+%\begin{macro}{\keV}
+%\begin{macro}{\MeV}
+%\begin{macro}{\GeV}
+%\begin{macro}{\TeV}
+%\begin{macro}{\kWh}
+% Energies.
+% \begin{macrocode}
+\newunit{\kJ}{\kilo\joule}
+\newunit{\eV}{\electronvolt}
+\newunit{\meV}{\milli\electronvolt}
+\newunit{\keV}{\kilo\electronvolt}
+\newunit{\MeV}{\mega\electronvolt}
+\newunit{\GeV}{\giga\electronvolt}
+\newunit{\TeV}{\tera\electronvolt}
+\newunit[unitsep=none]{\kWh}{\kilo\watt\hour}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\picom}
+%\begin{macro}{\nm}
+%\begin{macro}{\micm}
+%\begin{macro}{\mm}
+%\begin{macro}{\cm}
+%\begin{macro}{\dm}
+%\begin{macro}{\km}
+% Lengths.
+% \begin{macrocode}
+\newunit{\picom}{\pico\metre}
+\newunit{\nm}{\nano\metre}
+\newunit{\micm}{\micro\metre}
+\newunit{\mm}{\milli\metre}
+\newunit{\cm}{\centi\metre}
+\newunit{\dm}{\deci\metre}
+\newunit{\km}{\kilo\metre}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\Sec}
+%\begin{macro}{\as}
+%\begin{macro}{\fs}
+%\begin{macro}{\ps}
+%\begin{macro}{\ns}
+%\begin{macro}{\mics}
+%\begin{macro}{\ms}
+% Finally, times.
+% \begin{macrocode}
+\newunit{\Sec}{\second}
+\newunit{\as}{\atto\second}
+\newunit{\fs}{\femto\second}
+% \end{macrocode}
+% The letter class (and others) define \cs{ps} for postscripts, so
+% \cs{provideunit} is best here.
+% \begin{macrocode}
+\provideunit{\ps}{\pico\second}
+\newunit{\ns}{\nano\second}
+\newunit{\mics}{\micro\second}
+\newunit{\ms}{\milli\second}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</abbr>
+%<*addn>
+%\fi
+%\subsection{Additional (temporary) SI units}
+%\begin{macro}{\angstrom}
+%\begin{macro}{\are}
+%\begin{macro}{\hectare}
+%\begin{macro}{\barn}
+%\begin{macro}{\BAR}
+%\begin{macro}{\bbar}
+%\begin{macro}{\millibar}
+%\begin{macro}{\gal}
+%\begin{macro}{\curie}
+%\begin{macro}{\roentgen}
+%\begin{macro}{\rad}
+%\begin{macro}{\rem}
+% Some units are ``temporarily'' acceptable for use in the SI system.
+% These are defined here, although some are in very general use.
+% \begin{macrocode}
+\ProvidesFile{si-addn.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Additional units]
+\newunit{\angstrom}{\si@sym@ringA}
+\newunit{\are}{a}
+\newunit{\hectare}{\hecto\are}
+\newunit{\barn}{b}
+\newunit{\BAR}{bar}
+\newunit{\bbar}{bar}
+\newunit{\millibar}{\milli\BAR}
+\newunit{\gal}{Gal}
+\newunit{\curie}{Ci}
+\newunit{\roentgen}{R}
+\newunit{\rad}{rad}
+\newunit{\rem}{rem}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</addn>
+%<*accepted>
+%\fi
+%\subsection{Units accepted for use with SI}
+% The units which are accepted but do not fit in the above, plus
+% \cs{percent} which seems to fit into this category.
+%\begin{macro}{\minute}
+%\begin{macro}{\hour}
+%\begin{macro}{\Day}
+%\begin{macro}{\dday}
+%\begin{macro}{\degree}
+%\begin{macro}{\Degree}
+%\begin{macro}{\arcmin}
+%\begin{macro}{\arcsec}
+%\begin{macro}{\litre}
+%\begin{macro}{\liter}
+%\begin{macro}{\tonne}
+%\begin{macro}{\neper}
+%\begin{macro}{\bel}
+%\begin{macro}{\percent}
+% \begin{macrocode}
+\ProvidesFile{si-accepted.cfg}
+ [\csname si@svn@version\endcsname siunitx: SI Accepted units]
+\newunit{\minute}{min}
+\newunit{\hour}{h}
+\newunit{\Day}{d}
+\newunit{\dday}{d}
+\ifsi@old@OHM
+ \newunit[valuesep=none]{\Degree}{\si@sym@degree}
+\else
+ \ifsi@gensymb\else
+ \newunit[valuesep=none]{\degree}{\si@sym@degree}
+ \fi
+\fi
+\newunit[valuesep=none]{\arcmin}{\si@sym@minute}
+\newunit[valuesep=none]{\arcsec}{\si@sym@second}
+\newunit{\litre}{l}
+\newunit{\liter}{L}
+\newunit{\tonne}{t}
+\newunit{\neper}{Np}
+\newunit{\bel}{B}
+\newunit{\percent}{\%}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</accepted>
+%<*physical>
+%\fi
+%\subsection{Units based on physical measurements}
+%\begin{macro}{\si@eVspacea}
+%\begin{macro}{\si@eVspaceb}
+%\begin{macro}{\electronvolt}
+%\begin{macro}{\atomicmassunit}
+%\begin{macro}{\atomicmass}
+% A few units based on physical measurements exist. For \cs{eV}, the need
+% for a negative kern does make things a bit complicated.
+% \begin{macrocode}
+\ProvidesFile{si-physical.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Physically-measured units]
+\newcommand*{\si@eVspacea}{\text{\kern-\si@eVcorra}}%
+\newcommand*{\si@eVspaceb}{\text{\kern-\si@eVcorrb}}%
+\newunit{\electronvolt}{e\protect\si@eVspacea V\protect%
+ \si@eVspaceb}
+\newunit{\atomicmass}{u}
+\newunit{\atomicmassunit}{u}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</physical>
+%\fi
+%
+%\section{Additional configurations}
+% To provide flexibility for people in specific areas, specialised
+% units can be set up. These are then stored separately to ease use.
+%
+%\iffalse
+%<*synchem>
+%\fi
+%\subsection{Synthetic chemistry}
+%\begin{macro}{\mmHg}
+%\begin{macro}{\molar}
+%\begin{macro}{\Molar}
+%\begin{macro}{\torr}
+%\begin{macro}{\dalton}
+% Some useful units for synthetic chemists; although \cs{mmHg} and
+% \cs{Molar} are outside of the SI system, they are used a lot.
+% These are set up using \cs{provideunit} as people may have their
+% own definitions.
+% \begin{macrocode}
+\ProvidesFile{si-synchem.cfg}
+ [\csname si@svn@version\endcsname siunitx: Units for
+ synthetic chemists]
+\requiresiconfigs{prefix}
+\newunit{\mmHg}{mmHg}
+\newunit{\molar}{\mole\per\cubic\deci\metre}
+\newunit{\Molar}{\textsc{m}}
+\newunit{\torr}{Torr}
+\newunit{\dalton}{Da}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</synchem>
+%<*hep>
+%\fi
+%\subsection{High-energy physics}
+% Some units inspired by \pkg{hepunits}.
+% \begin{macrocode}
+\ProvidesFile{si-hep.cfg}
+ [\csname si@svn@version\endcsname siunitx: Units for
+ high-energy physics]
+\requiresiconfigs{prefix,named}
+% \end{macrocode}
+%\begin{macro}{\micron}
+%\begin{macro}{\mrad}
+%\begin{macro}{\gauss}
+% These specific to high-energy physics, but are not defined
+% elsewhere in \currpkg.\footnote{It is not clear from
+% \pkg{hepunits}, but the assumption is that \cs{mrad} represents
+% millirad and not milliradian.}
+% \begin{macrocode}
+\provideunit{\micron}{\micro\metre}
+\newunit{\mrad}{\milli\rad}
+\newunit{\gauss}{G}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\clight}
+%\begin{macro}{\eVperc}
+% The speed of light is used in units for the area, although of
+% course it is not strictly a unit. However, this makes it easier to
+% use in other units.
+% \begin{macrocode}
+\newunit{\clight}{\ensuremath{\mathnormal{c}}}
+\newunit{\eVperc}{\eV\per\clight}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\nanobarn}
+%\begin{macro}{\picobarn}
+%\begin{macro}{\femtobarn}
+%\begin{macro}{\attobarn}
+%\begin{macro}{\zeptobarn}
+%\begin{macro}{\yoctobarn}
+% Various prefixed barns.
+% \begin{macrocode}
+\newunit{\nanobarn}{\nano\barn}
+\newunit{\picobarn}{\pico\barn}
+\newunit{\femtobarn}{\femto\barn}
+\newunit{\attobarn}{\atto\barn}
+\newunit{\zeptobarn}{\zepto\barn}
+\newunit{\yoctobarn}{\yocto\barn}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\nb}
+%\begin{macro}{\pb}
+%\begin{macro}{\fb}
+%\begin{macro}{\ab}
+%\begin{macro}{\zb}
+%\begin{macro}{\yb}
+% Abbreviations for the same, but using \cs{provideunit} to avoid any
+% clashes.
+% \begin{macrocode}
+\provideunit{\nb}{\nano\barn}
+\provideunit{\pb}{\pico\barn}
+\provideunit{\fb}{\femto\barn}
+\provideunit{\ab}{\atto\barn}
+\provideunit{\zb}{\zepto\barn}
+\provideunit{\yb}{\yocto\barn}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</hep>
+%<*astro>
+%\fi
+%\subsection{Astronomy}
+%\begin{macro}{\parsec}
+%\begin{macro}{\lightyear}
+% For astronomy, the \cs{parsec} unit is needed.
+% \begin{macrocode}
+\ProvidesFile{si-astro.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ Units for astronomy]
+\newunit{\parsec}{pc}
+\newunit{\lightyear}{ly}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</astro>
+%<*binary>
+%\fi
+%\subsection{Binary units}
+%\begin{macro}{\kibi}
+%\begin{macro}{\mebi}
+%\begin{macro}{\gibi}
+%\begin{macro}{\tebi}
+%\begin{macro}{\pebi}
+%\begin{macro}{\exbi}
+%\begin{macro}{\zebi}
+%\begin{macro}{\yobi}
+% The binary units, as specified by the IEC and made available by
+% \SIunits. First, the binary prefixes.
+% \begin{macrocode}
+\ProvidesFile{si-binary.cfg}
+ [\csname si@svn@version\endcsname siunitx: Binary units]
+\newprefix[binary]{\kibi}{10}{Ki}
+\newprefix[binary]{\mebi}{20}{Mi}
+\newprefix[binary]{\gibi}{30}{Gi}
+\newprefix[binary]{\tebi}{40}{Ti}
+\newprefix[binary]{\pebi}{50}{Pi}
+\newprefix[binary]{\exbi}{60}{Ei}
+\newprefix[binary]{\zebi}{70}{Zi}
+\newprefix[binary]{\yobi}{80}{Yi}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\bit}
+%\begin{macro}{\byte}
+% Now the units.
+% \begin{macrocode}
+\newunit{\bit}{bit}
+\newunit{\byte}{B}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+%\iffalse
+%</binary>
+%\fi
+%
+%\section{Loadable locales}
+% Some short files to provide the correct settings for various places.
+%
+%\iffalse
+%<*UK>
+%\fi
+%\subsection{United Kingdom}
+% This is identical to the USA locale, and contains the package
+% default values.\footnote{The package author is in the UK.}
+% \begin{macrocode}
+\ProvidesFile{si-UK.cfg}
+ [\csname si@svn@version\endcsname siunitx: UK locale]
+\sisetup{
+ unitsep=thin,
+ expproduct=times,
+ valuesep=thin,
+ decimalsymbol=fullstop,
+ digitsep=thin,
+ sepfour=false}
+% \end{macrocode}
+%\iffalse
+%</UK>
+%<*USA>
+%\fi
+%\subsection{United States}
+% The same as for the UK.
+% \begin{macrocode}
+\ProvidesFile{si-USA.cfg}
+ [\csname si@svn@version\endcsname siunitx: USA locale]
+\sisetup{
+ unitsep=thin,
+ expproduct=times,
+ valuesep=thin,
+ decimalsymbol=fullstop,
+ digitsep=thin,
+ sepfour=false}
+% \end{macrocode}
+%\iffalse
+%</USA>
+%<*DE>
+%\fi
+%\subsection{Germany}
+% Germany, hopefully.
+% \begin{macrocode}
+\ProvidesFile{si-DE.cfg}
+ [\csname si@svn@version\endcsname siunitx: Germany locale]
+\sisetup{
+ unitsep=cdot,
+ valuesep=thin,
+ decimalsymbol=comma,
+ expproduct=cdot,
+ digitsep=thin,
+ sepfour=false}
+% \end{macrocode}
+%\iffalse
+%</DE>
+%<*ZA>
+%\fi
+%\subsection{South Africa}
+% Design decisions taken from the same section of \SIstyle.
+% \begin{macrocode}
+\ProvidesFile{si-ZA.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ South Africa locale]
+\sisetup{
+ unitsep=cdot,
+ valuesep=thin,
+ expproduct=times,
+ decimalsymbol=comma,
+ digitsep=thin,
+ sepfour=false}
+% \end{macrocode}
+%\iffalse
+%</ZA>
+%\fi
+%
+%\section{Emulation code}
+% Each emulation mode loads an appropriate definition file. This
+% then alters the package defaults, and defines new macros provided
+% by the emulated package.
+%
+%\iffalse
+%<*units>
+%\fi
+%\subsection{\units}
+% The very first thing to do here is a reload check, as things
+% could go wrong with \unitsdef emulation.
+% \begin{macrocode}
+\si@ifloaded{units}{\endinput}{}
+% \end{macrocode}
+% The \units package is quite easy to emulate, as it only has a
+% few options and macros. There is also no error checking in
+% \units for conflicting options, so users probably expect none.
+% \begin{macrocode}
+\ProvidesFile{si-units.cfg}
+ [\csname si@svn@version\endcsname siunitx: Emulation of units]
+\si@emulating{units}{1998/08/04 v0.9b}
+\si@ifloaded{SIunits}
+ {\si@emclash{units}{SIunits}\endinput}{}
+\si@ifloaded{sistyle}
+ {\si@emclash{units}{sistyle}\endinput}{}
+% \end{macrocode}
+% To emulate \units, \cs{per} must give fractions.
+% \begin{macrocode}
+\sisetup{per=fraction,fraction=nice,obeybold,inlinebold=maths,
+ ,obeymode}
+\ifsi@old@tight
+ \sisetup{valuesep=thin}
+\fi
+\ifsi@old@loose
+ \sisetup{valuesep=space}
+\fi
+\ifsi@old@ugly
+ \sisetup{fraction=ugly}
+\fi
+% \end{macrocode}
+%\begin{macro}{\unit}
+% The \units version of \cs{unit} is similar to \cs{SI}. Here and
+% in \cs{unitfrac} the \cs{num} macro is used; thus the number given
+% really has to be a number. However, if users are using \currpkg
+% rather than \units they should expect more checking of input. As
+% the \units package uses the current mode, this has to be
+% detected.\\
+%\cs{unit}\oarg{num}\marg{unit}
+% \begin{macrocode}
+\si@newrobustcmd*{\unit}[2][]{%
+ \ifmmode
+ \SI{#1}{#2}%
+ \else
+ \SI[obeyfamily,obeyitalic]{#1}{#2}%
+ \fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\unitfrac}
+% \cs{unitfrac} is a bit more of a hack.\\
+%\cs{unitfrac}\oarg{num}\marg{numerator}\marg{denominator}
+% \begin{macrocode}
+\si@newrobustcmd*{\unitfrac}[3][]{%
+ \begingroup
+ \si@fam@mode%
+ \ifmmode\else
+ \sisetup{obeyfamily,obeyitalic}%
+ \fi
+ \si@ifnotmtarg{#1}
+ {\num{#1}\ensuremath{\si@valuesep}}%
+ \si@frac{#2}{#3}
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\iffalse
+%</units>
+%\fi
+%\iffalse
+%<*unitsdef>
+%\fi
+%\subsection{\unitsdef}
+% The package begins with the usual identification of what is
+% happening. Although \file{si-units.cfg} makes the same checks,
+% the error will make more sense if it comes here, in the event of a
+% clash.
+% \begin{macrocode}
+\ProvidesFile{si-unitsdef.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ Emulation of unitsdef]
+\si@emulating{unitsdef}{2005/01/04 v0.2}
+\si@ifloaded{SIunits}
+ {\si@emclash{unitsdef}{SIunits}\endinput}{}
+\si@ifloaded{sistyle}
+ {\si@emclash{unitsdef}{sistyle}\endinput}{}
+% \end{macrocode}
+% Emulation of \units is needed for \unitsdef to work.
+% \begin{macrocode}
+\requiresiconfigs{units}
+% \end{macrocode}
+% The \unitsdef package loads some packages that \currpkg does not.
+% In particular, it loads \pkg{textcomp} and \pkg{fontenc}. This
+% could be important for output, and so the same is done here.
+% \begin{macrocode}
+\RequirePackage{textcomp}
+\RequirePackage[T1]{fontenc}
+% \end{macrocode}
+% The multitude of package options for \unitsdef need to be handled.
+% \begin{macrocode}
+\sisetup{mode=text,allowoptarg,prespace}
+\ifsi@old@noxspace
+ \sisetup{xspace=false}
+\fi
+% \end{macrocode}
+% The various options for loading unit abbreviations have to be
+% handled. Here, any request to avoid abbreviations prevents any
+% loading.
+% \begin{macrocode}
+\ifsi@old@noabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@nofrequncyabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@nomolabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@novoltageabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@novolumeabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@noweightabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@noenergyabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@nolengthabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@notimeabbr
+ \sisetup{noload=abbr}
+\fi
+% \end{macrocode}
+%\begin{macro}{\unitvaluesep}
+% To emulate the \cs{unitvaluesep} macro, a hack is needed of the original
+% \pkg{xkeyval} macro for \opt{valuesep}, as well of course as a definition
+% of the macro itself.
+% \begin{macrocode}
+\newcommand*{\unitvaluesep}{\,}
+\renewcommand*{\si@valuesep}{\text{\unitvaluesep}}
+\define@choicekey*+[si]{key}{valuesep}[\si@tempa]
+ {space,thin,med,medium,thick,none}
+ {\renewcommand*\unitvaluesep\@nameuse{si@fix@##1}%
+ \si@log@debug{Option valuesep set to ##1}}
+ {\si@log@debug{Option valuesep set to ##1}%
+ \renewcommand*\unitvaluesep{##1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\unitsignonly}
+%\begin{macro}{\ilu}
+%\begin{macro}{\arc}
+% Some rather straight-forward definitions, with just a bit of fun to
+% get the spacing correct.
+% \begin{macrocode}
+\let\unitsignonly\si
+\si@newrobustcmd*{\ilu}[2][]{%
+ \begingroup
+ #1\unitvaluesep%
+ \unit{#2}%
+ \endgroup}
+\let\arc\ang
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\unitSIdef}
+%\begin{macro}{\si@unitSIdef}
+% The \unitsdef package uses a different approach to setting the font
+% inside its version of \cs{SI}. The problem is the same as for
+% \cs{unitvaluesep}, but with the added problem that \currpkg uses
+% \cs{csname} \ldots \cs{endcsname}.
+% \begin{macrocode}
+\newcommand*{\unitSIdef}{\upshape}
+\newcommand*{\si@unitSIdef}{\unitSIdef\selectfont}
+\sisetup{textrm=si@unitSIdef}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\per}
+% Rather awkwardly, \unitsdef uses \cs{per} in a different way to
+% \currpkg.
+% \begin{macrocode}
+\let\per\relax
+\si@newrobustcmd*{\per}[2]{%
+ \begingroup
+ \si@xspacefalse
+ \renewcommand*{\unitvaluesep}{}%
+ \unitfrac{#1}{#2}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\unittimes}
+%\begin{macro}{\unitsep}
+%\begin{macro}{\unitsuperscript}
+% Some pretty straight-forward stuff again; notice that the automatic
+% analyser for units has to be turned off for this to work.
+% \begin{macrocode}
+\newcommand*{\unittimes}{\ensuremath{\cdot}}
+\newcommand*{\unitsep}{\,}
+\renewcommand*{\si@unt@unithook}{\si@unt@litouttrue}
+\sisetup{unitsep=none}
+\newcommand*{\unitsuperscript}{\tothe}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\newnosepunit}
+%\begin{macro}{\renewnosepunit}
+% Simple aliases.
+% \begin{macrocode}
+\newcommand*{\newnosepunit}{\newunit[valuesep=none]}
+\newcommand*{\renewnosepunit}{\renewunit[valuesep=none]}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\setTextOmega}
+%\begin{macro}{\setMathOmega}
+%\begin{macro}{\setTextmu}
+%\begin{macro}{\setMathmu}
+%\begin{macro}{\setTextCelsius}
+%\begin{macro}{\setMathCelsius}
+%\begin{macro}{\setMathDegree}
+%\begin{macro}{\setTextDegree}
+% Controlling symbols is a simple translation job; as only one
+% setting is used by \currpkg in text mode, a bit of extra work is
+% needed.
+% \begin{macrocode}
+\newcommand*{\setTextOmega}[2]{%
+ \renewcommand*{\si@textOmega}{%
+ \begingroup
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setMathOmega}[1]{\sisetup{mathsOmega=#1}}
+\newcommand*{\setTextmu}[2]{%
+ \renewcommand*{\si@textmu}{%
+ \begingroup
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setMathmu}[1]{\sisetup{mathsmu=#1}}
+\newcommand*{\setTextCelsius}[2]{%
+ \renewcommand*{\si@textcelsius}{%
+ \begingroup
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setMathCelsius}[1]{\sisetup{mathscelsius=#1}}
+\newcommand*{\setMathDegree}[2]{%
+ \renewcommand*{\si@textdegree}{%
+ \begingroup%
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setTextDegree}[1]{\sisetup{textdegree=#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The \opt{ohm} and \opt{OHM} options are checked, and some sanity is
+% ensured. This needs to happen before loading the configuration
+% files.
+% \begin{macrocode}
+\ifsi@old@OHM
+ \ifsi@old@ohm
+ \si@log@inf{Both `ohm' and `OHM' options given\MessageBreak
+ Using default behaviour for unitsdef}
+ \expandafter\expandafter\expandafter\si@old@OHMfalse
+ \fi
+\fi
+% \end{macrocode}
+%\begin{macro}{\liter}
+%\begin{macro}{\ton}
+%\begin{macro}{\days}
+% Tonne is spelled as ``ton'' by \unitsdef, which is wrong in the UK
+% at least (\SI{1}{ton} $=$ \SI{40}{cwt} $=$ \SI{2240}{lb}!).
+% \begin{macrocode}
+\ifsi@old@liter
+ \ifsi@old@LITER
+ \si@log@inf{Both `liter' and `LITER' options
+ given\MessageBreak Using default behaviour for unitsdef}
+ \else
+ \renewunit{\liter}{l}
+ \fi
+\fi
+\newunit{\ton}{t}
+\newunit{\days}{d}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\picometer}
+%\begin{macro}{\nanometer}
+%\begin{macro}{\micrometer}
+%\begin{macro}{\millimeter}
+%\begin{macro}{\centimeter}
+%\begin{macro}{\decimeter}
+%\begin{macro}{\kilometer}
+% Extra distances.
+% \begin{macrocode}
+\newunit{\picometer}{\pico\meter}
+\newunit{\nanometer}{\nano\meter}
+\newunit{\micrometer}{\micro\meter}
+\newunit{\millimeter}{\milli\meter}
+\newunit{\centimeter}{\centi\meter}
+\newunit{\decimeter}{\deci\meter}
+\newunit{\kilometer}{\kilo\meter}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\femtoliter}
+%\begin{macro}{\picoliter}
+%\begin{macro}{\nanoliter}
+%\begin{macro}{\microliter}
+%\begin{macro}{\milliliter}
+%\begin{macro}{\centiliter}
+%\begin{macro}{\deciliter}
+%\begin{macro}{\hectoliter}
+%\begin{macro}{\cubicmeter}
+%\begin{macro}{\cubicmicrometer}
+%\begin{macro}{\cubicmillimeter}
+% Volumes with US spellings.
+% \begin{macrocode}
+\newunit{\femtoliter}{\femto\liter}
+\newunit{\picoliter}{\pico\liter}
+\newunit{\nanoliter}{\nano\liter}
+\newunit{\microliter}{\micro\liter}
+\newunit{\milliliter}{\milli\liter}
+\newunit{\centiliter}{\centi\liter}
+\newunit{\deciliter}{\deci\liter}
+\newunit{\hectoliter}{\hecto\liter}
+\newunit{\cubicmeter}{\meter\cubed}
+\newunit{\cubicmicrometer}{\micro\meter\cubed}
+\newunit{\cubicmillimeter}{\milli\meter\cubed}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\squaremeter}
+%\begin{macro}{\squarecentimeter}
+%\begin{macro}{\squarekilometer}
+%\begin{macro}{\ar}
+%\begin{macro}{\hectar}
+% Areas, including the mis-spellings for \cs{are} and
+% \cs{hectare}.
+% \begin{macrocode}
+\newunit{\squaremeter}{\Square\meter}
+\newunit{\squarecentimeter}{\Square\centi\meter}
+\newunit{\squarekilometer}{\Square\kilo\meter}
+\newunit{\ar}{a}
+\newunit{\hectar}{\hecto\ar}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\kv}
+%\begin{macro}{\mv}
+% The code for \unitsdef has the capitalisation wrong for \cs{kV} and
+% \cs{mV}.
+% \begin{macrocode}
+\ifsi@old@noabbr
+\else
+ \ifsi@old@novoltageabbr\else
+ \newunit{\kv}{\kilo\volt}
+ \newunit{\mv}{\milli\volt}
+ \fi
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\sek}
+%\begin{macro}{\fg}
+%\begin{macro}{\fl}
+%\begin{macro}{\pl}
+%\begin{macro}{\nl}
+%\begin{macro}{\micl}
+%\begin{macro}{\ml}
+%\begin{macro}{\cl}
+%\begin{macro}{\dl}
+%\begin{macro}{\hl}
+% There are some slightly different abbreviations, plus some which
+% are not officially allowed.
+% \begin{macrocode}
+\ifsi@old@noabbr\else
+ \ifsi@old@notimeabbr\else
+ \newunit{\sek}{\second}
+ \fi
+ \ifsi@old@noweightabbr\else
+ \newunit{\fg}{\femto\gram}
+ \fi
+ \ifsi@old@novolumeabbr\else
+ \newunit{\fl}{\femto\liter}
+ \newunit{\pl}{\pico\liter}
+ \newunit{\nl}{\nano\liter}
+ \newunit{\micl}{\micro\liter}
+ \newunit{\ml}{\milli\liter}
+ \newunit{\cl}{\centi\liter}
+ \newunit{\dl}{\deci\liter}
+ \newunit{\hl}{\hecto\liter}
+ \fi
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\calory}
+%\begin{macro}{\kilocalory}
+% \unitsdef spells calorie incorrectly, and it is also not an SI unit.
+% \begin{macrocode}
+\newunit{\calory}{cal}
+\newunit{\kilocalory}{\kilo\calory}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\uBar}
+% \unitsdef uses \cs{ubar} for bar.
+% \begin{macrocode}
+\newunit{\uBar}{ba}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\gensymbohm}
+%\begin{macro}{\gensymbcelsius}
+%\begin{macro}{\gensymbmicro}
+%\begin{macro}{\gensymbdegree}
+% If the options relating to \pkg{gensymb} are given, then the
+% package \emph{has} to be loaded. The definitions are then renamed;
+% a slight awkward feature is that the hyphen character needs to be a
+% letter. To avoid needing to worry about this again, a second
+% switch is set up.
+% \begin{macrocode}
+\catcode`\-=11\relax
+\ifsi@old@redef-gensymb
+ \expandafter\si@gensymbtrue
+\fi
+\catcode`\-=12\relax
+\ifsi@gensymb
+ \RequirePackage{gensymb}
+ \AtBeginDocument{
+ \let\gensymbohm\ohm
+ \let\gensymbcelsius\celsius
+ \let\gensymbmicro\micro
+ \let\gensymbdegree\degree
+ \let\ohm\@undefined
+ \let\celsius\@undefined
+ \let\micro\@undefined
+ \let\degree\@undefined
+ \ifsi@old@OHM\else
+ \newunit{\ohm}{\si@sym@Omega}
+ \newunit{\celsius}{\si@sym@celsius}
+ \newprefix{\micro}{\si@sym@mu}{-6}
+ \newunit{\degree}{\si@sym@degree}
+ \fi}
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The configuration files can now be loaded.
+% \begin{macrocode}
+\requiresiconfigs{prefix,named,addn,accepted}
+% \end{macrocode}
+% The \opt{noconfig} option could be ignored, but it costs little to
+% let is be used.
+% \begin{macrocode}
+\ifsi@old@noconfig\else
+ \InputIfFileExists{unitsdef.cfg}
+ {\si@log@inf{unitsdef config file loaded}}
+ {\si@log@inf{unitsdef config file not found}}
+\fi
+% \end{macrocode}
+%
+%\iffalse
+%</unitsdef>
+%<*sistyle>
+%\fi
+%\subsection{\SIstyle}
+% After setting the necessary defaults, the emulation code defines
+% the macros in \SIstyle as given in the manual for that package.
+% \begin{macrocode}
+\ProvidesFile{si-sistyle.cfg}
+ [\csname si@svn@version\endcsname siunitx: Emulation of
+ SIstyle]
+\si@emulating{sistyle}{2006/12/20 v2.3}
+\sisetup{%
+ sepfour=true,
+ obeyfamily,
+ obeyitalic=true,
+ numsign=+-,
+ strictarc=false,
+ unitsep=cdot}
+% \end{macrocode}
+%\begin{macro}{\SIobeyboldtrue}
+%\begin{macro}{\SIobeyboldfalse}
+% Some simple switches, but not using \cs{newif}.
+% \begin{macrocode}
+\newcommand*{\SIobeyboldtrue}{\sisetup{obeybold=true}}
+\newcommand*{\SIobeyboldfalse}{\sisetup{obeybold=false}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\num}
+%\begin{macro}{\si@sis@num}
+%\begin{macro}{\si@sis@numstar}
+% To get the correct behaviour for \cs{num}, some redefinitions are
+% needed to handle to optional |*|.
+% \begin{macrocode}
+\let\num\relax
+\si@newrobustcmd*{\num}{%
+ \@ifstar
+ {\si@sis@numstar}
+ {\si@sis@num}}
+\newcommand*{\si@sis@num}[2][]{%
+ \begingroup%
+ \sisetup{#1}%
+ \expandafter\si@out@num\expandafter{\si@num{#2}}%
+ \endgroup}
+\newcommand*{\si@sis@numstar}[2][]{%
+ \begingroup%
+ \sisetup{mode=text,obeybold}%
+ \sisetup{#1}%
+ \expandafter\si@out@num\expandafter{\si@num{#2}}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\pnt}
+% The \cs{pnt} macro is needed as |.| is active inside \cs{SI}. The
+% name is exactly the same as in \SIstyle, but the implementation is
+% different. This is not defined by the main package as there are
+% better ways of including numbers in the output than this.
+% \begin{macrocode}
+\newcommand*{\pnt}{\ensuremath{\si@decimalsymbol}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\SIgroupfourtrue}
+%\begin{macro}{\SIgroupfourfalse}
+% Switches for grouping four characters.
+% \begin{macrocode}
+\newcommand*{\SIgroupfourtrue}{\sisetup{sepfour=true}}
+\newcommand*{\SIgroupfourfalse}{\sisetup{sepfour=false}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\SIunitsep}
+%\begin{macro}{\SIunitspace}
+%\begin{macro}{\SIunitdot}
+% Whatever is given here is passed through to \cs{sisetup}.
+% \begin{macrocode}
+\newcommand*{\SIunitsep}[1]{\sisetup{valuesep={#1}}}
+\newcommand*{\SIunitspace}[1]{\sisetup{unitspace={#1}}}
+\newcommand*{\SIunitdot}[1]{\sisetup{unitsep={#1}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\SIdecimalsymbol}
+%\begin{macro}{\SIthousandsep}
+%\begin{macro}{\SIproductsign}
+%\begin{macro}{\SIdecimalsign}
+% The same is true here, with the appropriate translation.
+% \begin{macrocode}
+\newcommand*{\SIdecimalsymbol}[1]{\sisetup{decimalsymbol={#1}}}
+\newcommand*{\SIthousandsep}[1]{\sisetup{digitsep={#1}}}
+\newcommand*{\SIproductsign}[1]{\sisetup{expproduct={#1}}}
+\newcommand*{\SIdecimalsign}[1]{\sisetup{decimalsymbol={#1}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@sis@savefont}
+% The font definitions need a bit of extra work doing. As both
+% settings here have |@| as a letter, all should be fine.\\
+%\cs{si@sis@savefont}\marg{setting}\marg{argument}
+% \begin{macrocode}
+\newcommand*{\si@sis@savefont}[2]{%
+ \@namedef{si@sis@#1}{#2}%
+ \sisetup{#1=si@sis@#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\SImathrm}
+%\begin{macro}{\SImathsf}
+%\begin{macro}{\SImathtt}
+% The font control macros have to ensure that a macro name is passed
+% to \cs{sisetup}.
+% \begin{macrocode}
+\newcommand*{\SImathrm}[1]{\si@sis@savefont{mathrm}{#1}}
+\newcommand*{\SImathsf}[1]{\si@sis@savefont{mathsf}{#1}}
+\newcommand*{\SImathtt}[1]{\si@sis@savefont{mathtt}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\SIdefaultMfam}
+%\begin{macro}{\SIdefaultNfam}
+%\begin{macro}{\SIdefaultTfam}
+% The same for the default keys.
+% \begin{macrocode}
+\newcommand*{\SIdefaultMfam}[1]{\si@sis@savefont{mathrm}{#1}}
+\newcommand*{\SIdefaultNfam}[1]{\si@sis@savefont{mathnumrm}{#1}}
+\newcommand*{\SIdefaultTfam}[1]{\si@sis@savefont{textrm}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\ensureupmath}
+% The \cs{ensureupmath} command guarantees processing by the
+% font-matching system. The argument cannot be processed here, so
+% care is needed.
+% \begin{macrocode}
+\si@newrobustcmd*{\ensureupmath}[1]{%
+ \begingroup
+ \sisetup{mode=maths,obeyitalic=false}%
+ \si@out{#1}%
+ \endgroup}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\degC}
+%\begin{macro}{\degF}
+%\begin{macro}{\arcdeg}
+% A few extra symbol names are needed.
+% \begin{macrocode}
+\newcommand*{\degC}{\si@sym@celsius}
+\newcommand*{\arcdeg}{\si@sym@degree}
+\newcommand*{\degF}{\si@sym@degree F}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\AddToSIstyle}
+%\begin{macro}{\SIstyle}
+%\begin{macro}{\SIstyleToLang}
+%\begin{macro}{\si@sis@addtolocale}
+% Finally, the locale control.
+% \begin{macrocode}
+\newcommand*{\SIstyle}[1]{\sisetup{locale=#1}}
+\newcommand*{\SIstyleToLang}[2]{\sisetup{loctolang=#1:#2}}
+\newcommand*{\AddToSIstyle}{%
+ \si@switchfalse
+ \@ifstar
+ {\si@switchtrue
+ \si@sis@addtolocale}
+ {\si@sis@addtolocale}}
+\newcommand*{\si@sis@addtolocale}[2]{%
+ \ifsi@switch
+ \expandafter\let\csname si@loc@#1@extra\endcsname\relax
+ \fi
+ \addtolocale{#1}{#2}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\iffalse
+%</sistyle>
+%<*SIunits>
+%\fi
+%\subsection{\SIunits}
+% \SIunits emulation starts in much the same way.
+% \begin{macrocode}
+\ProvidesFile{si-SIunits.cfg}
+ [\csname si@svn@version\endcsname siunitx: Emulation of
+ SIunits]
+\si@emulating{SIunits}{2007/12/02 v1.36}
+\sisetup{
+ unitsep=thick,
+ valuesep=thick,
+ prefixproduct=\si@valuesep,
+ trapambigfrac=false,
+ stickyper}
+\requiresiconfigs{prefix,named,accepted,physical}
+% \end{macrocode}
+%\begin{macro}{\reciprocal}
+%\begin{macro}{\rp}
+%\begin{macro}{\per}
+%\begin{macro}{\usk}
+%\begin{macro}{\power}
+%\begin{macro}{\rpsquare}
+%\begin{macro}{\rpcubic}
+%\begin{macro}{\fourth}
+%\begin{macro}{\rpfourth}
+% A few very simple translations, using the internal version of
+% \cs{per} to allow changes of output style.
+% \begin{macrocode}
+\newcommand*{\reciprocal}{\sisetup{per=reciprocal}\si@per}
+\let\rp\reciprocal
+\renewcommand*{\per}{\sisetup{per=slash}\si@per}
+\newcommand*{\usk}{}
+\newcommand*{\power}[1]{#1\tothe}
+\newcommand*{\rpsquare}{\sisetup{per=reciprocal}\si@per\Square}
+\newcommand*{\rpcubic}{\sisetup{per=reciprocal}\si@per\cubic}
+\newpower{\fourth}{4}
+\newcommand*{\rpfourth}{\sisetup{per=reciprocal}\si@per\fourth}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\rpsquared}
+%\begin{macro}{\rpcubed}
+% Here, some low-level switch changing is needed.
+% \begin{macrocode}
+\newcommand*{\rpsquared}{%
+ \sisetup{per=reciprocal}\si@unt@pertrue\si@unt@perseentrue%
+ \squared}
+\newcommand*{\rpcubed}{%
+ \sisetup{per=reciprocal}\si@unt@pertrue\cubed}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\SIsetup}
+%\begin{macro}{\si@siu@setup}
+% The various package spacing options are processed. They also have
+% to be correctly handled by the \cs{SIsetup} macro.
+% \begin{macrocode}
+\newcommand*{\SIsetup}[1]{%
+ \@for\si@tempa:=#1\do{%
+ \@ifundefined{ifsi@old@#1}
+ {\si@log@warn{Unknown SIunits option `#1'}}
+ {\csname si@old@#1true\endcsname}}
+ \si@siu@setup}
+\newcommand*{\si@siu@setup}{%
+ \ifsi@old@cdot
+ \sisetup{unitsep=cdot}%
+ \fi
+ \ifsi@old@thickspace
+ \sisetup{unitsep=thick}%
+ \fi
+ \ifsi@old@mediumspace
+ \sisetup{unitsep=medium}%
+ \fi
+ \ifsi@old@thinspace
+ \sisetup{unitsep=thin}%
+ \fi
+ \ifsi@old@thickqspace
+ \sisetup{valuesep=thick}%
+ \fi
+ \ifsi@old@mediumqspace
+ \sisetup{valuesep=medium}%
+ \fi
+ \ifsi@old@thinqspace
+ \sisetup{valuesep=thin}%
+ \fi}
+\si@siu@setup
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\square}
+%\begin{macro}{\squaren}
+% \SIunits does slightly different things about the clash with
+% \cs{square}, and either redefines this macro or provides
+% \cs{squaren}.
+% \begin{macrocode}
+\ifsi@old@squaren
+ \newpower{\squaren}{2}
+\fi
+\AtBeginDocument{%
+ \@ifundefined{square}
+ {\newpower{\square}{2}}
+ {\ifsi@old@amssymb
+ \renewpower{\square}{2}
+ \else
+ \ifsi@old@squaren\else
+ \si@log@warn{\string\square\space already
+ defined\MessageBreak SIunits mode may cause
+ errors}%
+ \fi
+ \fi}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\gray}
+% The potential clash with \pkg{PStricks} is also handled
+% differently; here, \cs{Gray} will already be defined by the
+% \currpkg kernel.
+% \begin{macrocode}
+\AtBeginDocument{
+ \@ifundefined{gray}
+ {\newunit{\gray}{Gy}}
+ {\ifsi@old@pstricks
+ \renewunit{\gray}{Gy}
+ \else
+ \ifsi@old@Gray\else
+ \si@log@warn{\string\gray\space already
+ defined\MessageBreak SIunits mode may cause
+ errors}%
+ \fi
+ \fi}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\unit}
+%\begin{macro}{\unita}
+% The \cs{unit} macro is defined.
+% \begin{macrocode}
+\ifsi@old@italian
+ \let\unita\SI
+\else
+ \let\unit\SI
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% The miscellaneous options are moped up.
+% \begin{macrocode}
+\ifsi@old@textstyle
+ \sisetup{mode=text}
+\fi
+\ifsi@old@binary
+ \sisetup{alsoload=binary}
+\fi
+\ifsi@old@noams
+ \AtBeginDocument{%
+ \renewcommand*{\si@textmu}{\ensuremath\si@mathsmu}}
+\fi
+% \end{macrocode}
+%\begin{macro}{\arcminute}
+%\begin{macro}{\arcsecond}
+%\begin{macro}{\rperminute}
+%\begin{macro}{\ton}
+%\begin{macro}{\degreecelsius}
+% The unit macros defined by \SIunits that are not defined by
+% \currpkg (by default).
+% \begin{macrocode}
+\newunit[valuesep=none]{\arcminute}{\si@sym@minute}
+\newunit[valuesep=none]{\arcsecond}{\si@sym@second}
+\newunit{\rperminute}{r/min}
+\newunit{\ton}{t}
+\newunit{\degreecelsius}{\celsius}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\addunit}
+% This is an alias for \cs{newunit}.
+% \begin{macrocode}
+\let\addunit\newunit
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\addprefix}
+% A little more work for \cs{addprefix}.
+% \begin{macrocode}
+\newcommand*{\addprefix}[2]{\newprefix{#1}{#2}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@siu@newunit}
+%\begin{macro}{\si@siu@power}
+%\begin{macro}{\si@siu@newunithook}
+% To save some code, making new units which need a \texttt{\ldots np}
+% variant is handled by a dedicated macro.\\
+%\cs{si@siu@addunit}\oarg{power}\marg{pre}\marg{post}
+% \begin{macrocode}
+\newcommand*{\si@siu@newunit}[3][]{%
+% \end{macrocode}
+% A test is needed to sort out \cs{square}.
+% \begin{macrocode}
+ \renewcommand*{\si@tempa}{#1}%
+ \renewcommand*{\si@tempb}{square}%
+ \renewcommand*{\si@siu@power}{}%
+ \ifx\@empty\si@tempa\@empty\else
+ \ifx\si@tempa\si@tempb
+ \renewcommand*{\si@siu@power}{\ssquare}%
+ \else
+ \edef\si@siu@power{%
+ \expandafter\noexpand\csname #1\endcsname}%
+ \fi
+ \fi
+% \end{macrocode}
+% The necessary information is now stored in temporary macros.
+% \begin{macrocode}
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3\endcsname}%
+ \edef\si@tempb{%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\per
+ \expandafter\noexpand\si@siu@power
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter%
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempb}
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3np\endcsname}%
+ \edef\si@tempb{%
+ \expandafter\noexpand\csname #2\endcsname\noexpand
+ \reciprocal\expandafter\noexpand\si@siu@power
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempb}%
+ \si@siu@newunithook[#1]{#2}{#3}}
+\providecommand*{\si@siu@newunithook}[3][]{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The basic units are now defined; these only have a single csname in
+% each of the numerator and denominator.
+% \begin{macrocode}
+\si@siu@newunit{gray}{second}
+\si@siu@newunit[square]{metre}{second}
+\si@siu@newunit{joule}{mole}
+\si@siu@newunit[cubic]{mole}{metre}
+\si@siu@newunit[square]{radian}{second}
+\si@siu@newunit{radian}{second}
+\si@siu@newunit[cubic]{squaremetre}{metre}
+\si@siu@newunit[cubic]{katal}{metre}
+\si@siu@newunit{coulomb}{mol}
+\si@siu@newunit[square]{ampere}{metre}
+\si@siu@newunit[cubic]{kilogram}{metre}
+\si@siu@newunit[cubic]{coulomb}{metre}
+\si@siu@newunit{volt}{metre}
+\si@siu@newunit[square]{coulomb}{squaremetre}
+\si@siu@newunit{farad}{metre}
+\si@siu@newunit[square]{watt}{metre}
+\si@siu@newunit[square]{joule}{metre}
+\si@siu@newunit[cubic]{newton}{metre}
+\si@siu@newunit{newton}{kilogram}
+\si@siu@newunit{joule}{kelvin}
+\si@siu@newunit{joule}{kilogram}
+\si@siu@newunit{coulomb}{kilogram}
+\si@siu@newunit{squaremetre}{second}
+\si@siu@newunit[square]{squaremetre}{second}
+\si@siu@newunit[square]{candela}{metre}
+\si@siu@newunit{ampere}{metre}
+\si@siu@newunit{joule}{tesla}
+\si@siu@newunit{henry}{metre}
+\si@siu@newunit{kilogram}{second}
+\si@siu@newunit[square]{kilogram}{metre}
+\si@siu@newunit{kilogram}{metre}
+\si@siu@newunit[square]{newton}{metre}
+\si@siu@newunit{watt}{kilogram}
+\si@siu@newunit[cubic]{watt}{metre}
+\si@siu@newunit{squaremetre}{kilogram}
+\si@siu@newunit{cubicmetre}{kilogram}
+\si@siu@newunit{newton}{metre}
+\si@siu@newunit[cubic]{squaremetre}{second}
+\si@siu@newunit{metre}{second}
+\si@siu@newunit[cubic]{joule}{metre}
+\si@siu@newunit{cubicmetre}{second}
+% \end{macrocode}
+%\begin{macro}{\si@siu@newunitx}
+%\begin{macro}{\si@siu@newunitxhook}
+% For the more complex units, a slightly different approach is used;
+% four arguments are required, and have to cover everything.
+% \begin{macrocode}
+\newcommand*{\si@siu@newunitx}[4]{%
+ \expandafter\newunit\expandafter{\csname #1per#2\endcsname}
+ {#3\per#4}%
+ \expandafter\newunit\expandafter{\csname #1per#2np\endcsname}
+ {#3\reciprocal#4}
+ \si@siu@newunitxhook{#1}{#2}{#3}{#4}}
+\providecommand*{\si@siu@newunitxhook}[4]{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% The units are defined.
+% \begin{macrocode}
+\si@siu@newunitx{kilogramsquaremetre}{second}
+ {\kilogram\squaremetre}{\second}
+\si@siu@newunitx{squaremetre}{newtonsecond}{\squaremetre}
+ {\newton\second}
+\si@siu@newunitx{kilogrammetre}{second}{\kilogram\metre}
+ {\second}
+\si@siu@newunitx{kilogram}{squaremetresecond}{\kilogram}
+ {\squaremetre\second}
+\si@siu@newunitx{joule}{molekelvin}{\joule}{\mole\kelvin}
+\si@siu@newunitx{kilogram}{kilomole}{\kilogram}{\kilo\mole}
+\si@siu@newunitx{kilogrammetre}{squaresecond}{\kilogram\metre}
+ {\second\squared}
+\si@siu@newunitx{watt}{squaremetresteradian}{\watt}
+ {\squaremetre\steradian}
+\si@siu@newunitx{joule}{kilogramkelvin}{\joule}
+ {\kilogram\kelvin}
+\si@siu@newunitx{watt}{metrekelvin}{\watt}{\metre\kelvin}
+\si@siu@newunitx{kilogram}{cubicmetrecoulomb}{\kilogram}
+ {\cubic\metre\coulomb}
+\si@siu@newunitx{kilogram}{secondcubicmetre}{\kilogram}
+ {\second\cubicmetre}
+% \end{macrocode}
+%\begin{macro}{\si@siu@unity}
+% A bit of cleverness to get the ``1'' correct; to avoid any clash, the unit
+% is given an internal name.
+% \begin{macrocode}
+\newunit{\si@siu@unity}{1}
+\si@siu@newunitx{}{squaremetresecond}{\si@siu@unity}
+ {\squaremetre\second}
+% \end{macrocode}
+%\end{macro}
+% A few compound units that are best defined directly.
+% \begin{macrocode}
+\newunit{\pascalsecond}{\pascal\second}
+\newunit{\amperemetresecond}{\ampere\metre\second}
+\newunit{\ohmmetre}{\ohm\metre}
+\newunit{\newtonmetre}{\newton\metre}
+\let\newtonmetrenp\newtonmetre
+\newunit{\kilogramsquaremetre}{\kilogram\squaremetre}
+\let\kilogramsquaremetrenp\kilogramsquaremetre
+% \end{macrocode}
+%\begin{macro}{\si@siu@newprefix}
+% To generate the prefixes correctly, a small saving in repetition.\\
+%\cs{si@siu@newprefix}\marg{prefix}
+% \begin{macrocode}
+\newcommand*{\si@siu@newprefix}[1]{%
+ \edef\si@tempa{\expandafter\noexpand\csname #1d\endcsname}%
+ \edef\si@tempb{\expandafter\noexpand\csname #1\endcsname}%
+ \expandafter\expandafter\expandafter\newcommand\expandafter
+ \expandafter\expandafter*\expandafter\expandafter
+ \expandafter{\expandafter\si@tempa\expandafter}\expandafter
+ {\expandafter\si@prefixsymbolicfalse\si@tempb}}
+% \end{macrocode}
+%\end{macro}
+% This is now implemented.
+% \begin{macrocode}
+\si@siu@newprefix{yocto}
+\si@siu@newprefix{zepto}
+\si@siu@newprefix{atto}
+\si@siu@newprefix{femto}
+\si@siu@newprefix{pico}
+\si@siu@newprefix{nano}
+\si@siu@newprefix{micro}
+\si@siu@newprefix{milli}
+\si@siu@newprefix{centi}
+\si@siu@newprefix{deca}
+\si@siu@newprefix{deka}
+\si@siu@newprefix{hecto}
+\si@siu@newprefix{kilo}
+\si@siu@newprefix{mega}
+\si@siu@newprefix{giga}
+\si@siu@newprefix{tera}
+\si@siu@newprefix{peta}
+\si@siu@newprefix{exa}
+\si@siu@newprefix{zetta}
+\si@siu@newprefix{yotta}
+\ifsi@old@binary
+ \si@siu@newprefix{kibi}
+ \si@siu@newprefix{mebi}
+ \si@siu@newprefix{gibi}
+ \si@siu@newprefix{tebi}
+ \si@siu@newprefix{pebi}
+ \si@siu@newprefix{exbi}
+\fi
+% \end{macrocode}
+%\begin{macro}{\derradian}
+%\begin{macro}{\dersteradian}
+%\begin{macro}{\derhertz}
+%\begin{macro}{\dernewton}
+%\begin{macro}{\derpascal}
+%\begin{macro}{\derjoule}
+%\begin{macro}{\derwatt}
+%\begin{macro}{\dercoulomb}
+%\begin{macro}{\dervolt}
+%\begin{macro}{\derfarad}
+%\begin{macro}{\derohm}
+% The derived units may need to be defined.
+% \begin{macrocode}
+\ifsi@old@derived
+ \newunit{\derradian}{\metre\reciprocal\metre}
+ \newunit{\dersteradian}{\squaremetre\rpsquare\metre}
+ \newunit{\derhertz}{\reciprocal\second}
+ \newunit{\dernewton}{\metre\kilogram\second\rpsquared}
+ \newunit{\derpascal}{\newton\rpsquare\metre}
+ \newunit{\derjoule}{\newton\metre}
+ \newunit{\derwatt}{\joule\reciprocal\second}
+ \newunit{\dercoulomb}{\ampere\second}
+ \newunit{\dervolt}{\watt\reciprocal\ampere}
+ \newunit{\derfarad}{\coulomb\reciprocal\volt}
+ \newunit{\derohm}{\volt\reciprocal\ampere}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\dersiemens}
+%\begin{macro}{\derweber}
+%\begin{macro}{\dertesla}
+%\begin{macro}{\derhenry}
+%\begin{macro}{\dercelsius}
+%\begin{macro}{\derlumen}
+%\begin{macro}{\derlux}
+%\begin{macro}{\derbecquerel}
+%\begin{macro}{\dergray}
+%\begin{macro}{\dersievert}
+%\begin{macro}{\derkatal}
+% In two blocks!
+% \begin{macrocode}
+ \newunit{\dersiemens}{\ampere\reciprocal\volt}
+ \newunit{\derweber}
+ {\squaremetre\kilogram\second\rpsquared\reciprocal\ampere}
+ \newunit{\dertesla}{\weber\rpsquare\metre}
+ \newunit{\derhenry}{\weber\reciprocal\ampere}
+ \newunit{\dercelsius}{\kelvin}
+ \newunit{\derlumen}{\candela\steradian}
+ \newunit{\derlux}{\lumen\rpsquare\metre}
+ \newunit{\derbecquerel}{\derhertz}
+ \newunit{\dergray}{\joule\reciprocal\kilogram}
+ \newunit{\dersievert}{\dergray}
+ \newunit{\derkatal}{\rp\second\usk\mole}
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\radianbase}
+%\begin{macro}{\steradianbase}
+%\begin{macro}{\hertzbase}
+%\begin{macro}{\newtonbase}
+%\begin{macro}{\pascalbase}
+%\begin{macro}{\joulebase}
+%\begin{macro}{\wattbase}
+%\begin{macro}{\coulombbase}
+%\begin{macro}{\voltbase}
+%\begin{macro}{\faradbase}
+%\begin{macro}{\ohmbase}
+% Also the ``derived-in-base''.
+% \begin{macrocode}
+\ifsi@old@derivedinbase
+ \newunit{\radianbase}{\metre\reciprocal\metre}
+ \newunit{\steradianbase}{\squaremetre\rpsquare\metre}
+ \newunit{\hertzbase}{\reciprocal\second}
+ \newunit{\newtonbase}{\metre\kilogram\second\rpsquared}
+ \newunit{\pascalbase}{\reciprocal\metre\kilogram\second%
+ \rpsquared}
+ \newunit{\joulebase}{\squaremetre\kilogram\second\rpsquared}
+ \newunit{\wattbase}{\squaremetre\kilogram\rpcubic\second}
+ \newunit{\coulombbase}{\ampere\second}
+ \newunit{\voltbase}
+ {\squaremetre\kilogram\rpcubic\second\reciprocal\ampere}
+ \newunit{\faradbase}
+ {\rpsquare\metre\reciprocal\kilogram\fourth\second\ampere%
+ \squared}
+ \newunit{\ohmbase}
+ {\squaremetre\kilogram\rpcubic\second\rpsquare\ampere}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\siemensbase}
+%\begin{macro}{\weberbase}
+%\begin{macro}{\teslabase}
+%\begin{macro}{\henrybase}
+%\begin{macro}{\celsiusbase}
+%\begin{macro}{\lumenbase}
+%\begin{macro}{\luxbase}
+%\begin{macro}{\becquerelbase}
+%\begin{macro}{\graybase}
+%\begin{macro}{\sievertbase}
+%\begin{macro}{\katalbase}
+% Also in two blocks.
+% \begin{macrocode}
+ \newunit{\siemensbase}
+ {\rpsquare\metre\reciprocal\kilogram\cubic\second\ampere%
+ \squared}
+ \newunit{\weberbase}
+ {\squaremetre\kilogram\second\rpsquared\reciprocal\ampere}
+ \newunit{\teslabase}{\kilogram\second\rpsquared\reciprocal%
+ \ampere}
+ \newunit{\henrybase}
+ {\squaremetre\kilogram\second\rpsquared\rpsquare\ampere}
+ \newunit{\celsiusbase}{\kelvin}
+ \newunit{\lumenbase}{\candela\squaremetre\rpsquare\metre}
+ \newunit{\luxbase}{\candela\squaremetre\rpfourth\metre}
+ \newunit{\becquerelbase}{\hertzbase}
+ \newunit{\graybase}{\squaremetre\second\rpsquared}
+ \newunit{\sievertbase}{\graybase}
+ \newunit{\katalbase}{\rp\second\mole}
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% Any configuration file is used if found.
+% \begin{macrocode}
+\InputIfFileExists{SIunits.cfg}
+ {\si@log@inf{SIunits config file loaded}}
+ {\si@log@inf{SIunits config file not found}}
+% \end{macrocode}
+%\iffalse
+%</SIunits>
+%<*hepunits>
+%\fi
+%\subsection{\pkg{hepunits}}
+% The \pkg{hepunits} package provides some rather odd unit names,
+% which are not really to be encouraged.
+% \begin{macrocode}
+\ProvidesFile{si-hepunits.cfg}
+ [\csname si@svn@version\endcsname Emulation of siunitx:
+ hepunits]
+\si@emulating{hepunits}{2007/09/27}
+\requiresiconfigs{SIunits,accepted,prefix,hep}
+% \end{macrocode}
+%\begin{macro}{\invbarn}
+%\begin{macro}{\invnanobarn}
+%\begin{macro}{\invpicobarn}
+%\begin{macro}{\invfemtobarn}
+%\begin{macro}{\invattobarn}
+%\begin{macro}{\invzeptobarn}
+%\begin{macro}{\invyoctobarn}
+% Inverses barn units.
+% \begin{macrocode}
+\ifsi@old@noprefixcmds\else
+ \newunit{\invbarn}{\per\barn}
+ \newunit{\invnanobarn}{\per\nano\barn}
+ \newunit{\invpicobarn}{\per\pico\barn}
+ \newunit{\invfemtobarn}{\per\femto\barn}
+ \newunit{\invattobarn}{\per\atto\barn}
+ \newunit{\invzeptobarn}{\per\zepto\barn}
+ \newunit{\invyoctobarn}{\per\yocto\barn}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\invnb}
+%\begin{macro}{\invpb}
+%\begin{macro}{\invfb}
+%\begin{macro}{\invab}
+%\begin{macro}{\invzb}
+%\begin{macro}{\invyb}
+% Also available abbreviated.
+% \begin{macrocode}
+ \newunit{\invnb}{\per\nano\barn}
+ \newunit{\invpb}{\per\pico\barn}
+ \newunit{\invfb}{\per\femto\barn}
+ \newunit{\invab}{\per\atto\barn}
+ \newunit{\invzb}{\per\zepto\barn}
+ \newunit{\invyb}{\per\yocto\barn}
+\fi
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\invcmsqpersecond}
+%\begin{macro}{\invcmsqpersec}
+%\begin{macro}{\lumiunits}
+% Luminosity.
+% \begin{macrocode}
+\newunit{\invcmsqpersecond}{\per\Square\centi\metre\per\second}
+\newunit{\invcmsqpersec}{\per\Square\centi\metre\per\second}
+\newunit{\lumiunits}{\per\Square\centi\metre\per\second}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\inveV}
+%\begin{macro}{\minveV}
+%\begin{macro}{\minveV}
+%\begin{macro}{\kinveV}
+%\begin{macro}{\MinveV}
+%\begin{macro}{\GinveV}
+%\begin{macro}{\TinveV}
+% The inverse of an electron-volt, plus prefixes.
+% \begin{macrocode}
+\newunit{\inveV}{\per\electronvolt}
+\newunit{\minveV}{\per\milli\electronvolt}
+\newunit{\kinveV}{\per\kilo\electronvolt}
+\newunit{\MinveV}{\per\mega\electronvolt}
+\newunit{\GinveV}{\per\giga\electronvolt}
+\newunit{\TinveV}{\per\tera\electronvolt}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\eVoverc}
+%\begin{macro}{\eVovercsq}
+% Some combinations of electron-volts and the speed of light. As
+% these are called |over|, they are set with a slash. The
+% \opt{eVcorrb} values have been set for Computer Modern.
+% \begin{macrocode}
+\newunit[per=slash,eVcorrb=0.6ex]{\eVoverc}
+ {\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\eVovercsq}
+ {\electronvolt\per\Square\clight}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\meVoverc}
+%\begin{macro}{\keVoverc}
+%\begin{macro}{\MeVoverc}
+%\begin{macro}{\GeVoverc}
+%\begin{macro}{\TeVoverc}
+% Prefixed combinations, first of the speed of light.
+% \begin{macrocode}
+\newunit[per=slash,eVcorrb=0.6ex]{\meVoverc}
+ {\milli\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\keVoverc}
+ {\kilo\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\MeVoverc}
+ {\mega\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\GeVoverc}
+ {\giga\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\TeVoverc}
+ {\tera\electronvolt\per\clight}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\meVovercsq}
+%\begin{macro}{\keVovercsq}
+%\begin{macro}{\MeVovercsq}
+%\begin{macro}{\GeVovercsq}
+%\begin{macro}{\TeVovercsq}
+% Then of the square.
+% \begin{macrocode}
+\newunit[per=slash,eVcorrb=0.6ex]{\meVovercsq}
+ {\milli\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\keVovercsq}
+ {\kilo\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\MeVovercsq}
+ {\mega\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\GeVovercsq}
+ {\giga\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\TeVovercsq}
+ {\tera\electronvolt\per\Square\clight}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\iffalse
+%</hepunits>
+%<*fancynum>
+%\fi
+%\subsection{\pkg{fancynum}}
+% \pkg{fancynum} only does things with numbers, so there is only
+% a little emulation and a few macros needed.
+% \begin{macrocode}
+\ProvidesFile{si-fancynum.cfg}
+ [\csname si@svn@version\endcsname Emulation of siunitx:
+ fancynum]
+\si@emulating{fancynum}{2000/08/08 0.92}
+\sisetup{decimalsymbol=cdot,digitsep=comma}
+% \end{macrocode}
+%\begin{macro}{\fnum}
+% The \cs{fnum} macro is rather restricted, but this is not
+% reproduced. Instead, it is \cs{let} as an alias to the \cs{num}
+% macro.
+% \begin{macrocode}
+\let\fnum\num
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\setfnumdsym}
+%\begin{macro}{\setfnumgsym}
+%\begin{macro}{\setfnummsym}
+% The control macros are defined.
+% \begin{macrocode}
+\newcommand*{\setfnumdsym}[1]{\sisetup{decimalsymbol={#1}}}
+\newcommand*{\setfnumgsym}[1]{\sisetup{digitsep={#1}}}
+\newcommand*{\setfnummsym}[1]{\sisetup{expproduct={#1}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+% The various package options are now processed if necessary.
+% \begin{macrocode}
+\ifsi@old@english
+ \sisetup{decimalsymbol=cdot,digitsep=comma}
+\fi
+\ifsi@old@french
+ \sisetup{decimalsymbol=comma,digitsep=fullstop}
+\fi
+\ifsi@old@tight
+ \sisetup{expproduct=tighttimes}
+\fi
+\ifsi@old@loose
+ \sisetup{expproduct=times}
+\fi
+\ifsi@old@thinspaces
+ \sisetup{digitsep=thin}
+\fi
+\ifsi@old@commas
+ \sisetup{digitsep=comma}
+\fi
+\ifsi@old@plain
+ \sisetup{digitsep=none}
+\fi
+% \end{macrocode}
+%
+%\iffalse
+%</fancynum>
+%<*fancyunits>
+%\fi
+%\subsection{\pkg{fancyunits}}
+% The \pkg{fancyunits} package is not available on \textsc{ctan}, but
+% is available from its authors homepage \cite{fancyunits}. It is
+% similar to \SIunits, and so most of the code is shared here.
+% However, a few bits of set up occur first, and an emulation-clash
+% test is needed.
+% \begin{macrocode}
+\ProvidesFile{si-fancyunits.cfg}
+ [\csname si@svn@version\endcsname Emulation of siunitx:
+ fancyunits]
+\si@emulating{fancyunits}{2007/02/01 v1.0.1}
+\si@ifloaded{SIunits}
+ {\si@log@err{SIunits emulation loaded\MessageBreak before
+ fancyunits emulation}{You need to load the fancyunits
+ emualtion\MessageBreak code before that for
+ SIunits.\MessageBreak Try emulate=fancyunits as the first
+ option when\MessageBreak loading siunitx}}{}
+% \end{macrocode}
+%\begin{macro}{\si@siu@newunithook}
+%\begin{macro}{\si@siu@newunitxhook}
+% To create the extra macros provided by \pkg{fancyunits}, the
+% \SIunits emulation code is changed to add the ``\texttt{uf}''
+% variants.
+% \begin{macrocode}
+\newcommand*{\si@siu@newunithook}[3][]{%
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3uf\endcsname}%
+ \renewcommand*{\si@tempb}{stickyper,per=fraction,
+ fraction=nice}%
+ \edef\si@tempc{%
+ \noexpand\sisetup{\si@tempb}%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\si@per%
+ \expandafter\noexpand\si@siu@power%
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempc}%
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3Uf\endcsname}%
+ \renewcommand*{\si@tempb}{stickyper,per=fraction,
+ fraction=frac}%
+ \edef\si@tempc{%
+ \noexpand\sisetup{\si@tempb}%
+ \noexpand\def\noexpand\si@frc@hook{\noexpand\textstyle}%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\si@per%
+ \expandafter\noexpand\si@siu@power%
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempc}%
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3UF\endcsname}%
+ \edef\si@tempc{%
+ \noexpand\sisetup{\si@tempb}%
+ \noexpand\def\noexpand\si@frc@hook{\noexpand\displaystyle}%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\si@per%
+ \expandafter\noexpand\si@siu@power%
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempc}}
+\newcommand*{\si@siu@newunitxhook}[4]{%
+ \expandafter\newunit\expandafter{\csname #1per#2uf\endcsname}
+ {\sisetup{stickyper,per=fraction,fraction=nice}%
+ #3\si@per#4}%
+ \expandafter\newunit\expandafter{\csname #1per#2Uf\endcsname}
+ {\sisetup{stickyper,per=fraction,fraction=frac}%
+ \renewcommand*{\si@frc@hook}{\textstyle}%
+ #3\si@per#4}%
+ \expandafter\newunit\expandafter{\csname #1per#2UF\endcsname}
+ {\sisetup{stickyper,per=fraction,fraction=frac}%
+ \renewcommand*{\si@frc@hook}{\displaystyle}%
+ #3\si@per#4}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% With that done, the emulation modules can be loaded.
+% \begin{macrocode}
+\requiresiconfigs{SIunits,addn,astro}
+\sisetup{obeyall}
+% \end{macrocode}
+% There is one \pkg{fancyunits}-specific option to handle. The other
+% options all get sent through to the \SIunits system.\footnote{As
+% \SIunits is rather more widely known than \pkg{fancyunits}, any
+% other options which could be for either are assumed to be for
+% \SIunits.}
+% \begin{macrocode}
+\ifsi@old@spaceqspace
+ \sisetup{valuesep=space}
+\fi
+% \end{macrocode}
+%\begin{macro}{\paminute}
+%\begin{macro}{\parsecond}
+%\begin{macro}{\AstroE}
+%\begin{macro}{\oersted}
+%\begin{macro}{\ton}
+% \pkg{fancyunits} provides some extra units, plus tonne spelled
+% incorrectly (again).
+% \begin{macrocode}
+\newunit{\paminute}{'}
+\newunit{\parsecond}{''}
+\newunit{\AstroE}{AE}
+\newunit{\oersted}{OE}
+\provideunit{\ton}{t}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\decaD}
+% An additional prefix.
+% \begin{macrocode}
+\let\decaD\decad
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\ufrac}
+%\begin{macro}{\Ufrac}
+%\begin{macro}{\UFrac}
+% The fractional unit macros need to be reproduced.
+% \begin{macrocode}
+\newcommand*{\ufrac}[2]{%
+ \si[stickyper,per=fraction,fraction=nice]{#1\si@per#2}}
+\newcommand*{\Ufrac}[2]{%
+ \ensuremath{\textstyle{%
+ \si[stickyper,per=fraction,fraction=frac]{#1\si@per#2}}}}
+\newcommand*{\UFrac}[2]{%
+ \ensuremath{\displaystyle{%
+ \si[stickyper,per=fraction,fraction=frac]{#1\si@per#2}}}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\pow}
+% A slightly-shorted named \cs{power}.
+% \begin{macrocode}
+\let\pow\power
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Squaremetre}
+% An alias for \cs{squaremetre}.
+% \begin{macrocode}
+\let\Squaremetre\squaremetre
+% \end{macrocode}
+%\end{macro}
+% As with \SIunits, there is now a list of compound units to add.
+% Only a few are not covered by the \SIunits emulation.
+% \begin{macrocode}
+\si@siu@newunit{Gray}{second}
+\si@siu@newunit[square]{Squaremetre}{metre}
+\si@siu@newunitx{Squaremetre}{newtonsecond}{\Square\metre}
+ {\newton\second}
+\si@siu@newunit{Squaremetre}{second}
+\si@siu@newunit[square]{Squaremetre}{squaresecond}
+\si@siu@newunit{Squaremetre}{kilogram}
+\si@siu@newunit[cubic]{Squaremetre}{second}
+% \end{macrocode}
+%\iffalse
+%</fancyunits>
+%\fi
+%
+%\Finale
+%\iffalse
+%<*refs>
+@misc{BIPM:EN,
+ note = {\url{http://www.bipm.org/en/si/}},
+}
+
+@misc{BIPM:FR,
+ note = {\url{http://www.bipm.org/fr/si/}},
+}
+
+@misc{BIPM:PDF,
+ note = {\url{http://www.bipm.org/en/si/si_brochure/}},
+}
+
+@misc{Eijkhout,
+ author = {Victor Eijkhout},
+ note = {\url{http://www.eijkhout.net/tbt/}},
+ title = {{\TeX} by {T}opic},
+ year = {2007},
+}
+
+@misc{fancyunits,
+ author = {Heiko Bauke},
+ note = {\url{http://www.mpi-hd.mpg.de/personalhomes/bauke/LaTeX/Tips_und_Tricks/fancyunits/index.php}},
+ title = {\pkg{fancyunits}},
+ year = 2007,
+}
+
+@misc{IUPAC,
+ note = {\url{http://old.iupac.org/publications/books/gbook/green_book_2ed.pdf}},
+ title = {The \textsc{iupac} {G}reen {B}ook},
+ year = 1993,
+}
+
+@misc{NIST,
+ note = {\url{http://physics.nist.gov/cuu/Units/index.html}},
+}
+%</refs>
+%<*jawltxdoc>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{jawltxdoc}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage[final]{listings,graphicx,microtype}
+\usepackage[scaled=0.95]{helvet}
+\usepackage[version=3]{mhchem}
+\usepackage[osf]{mathpazo}
+\usepackage{booktabs,array,url,courier,xspace,etoolbox,varioref}
+\usepackage{upgreek,ifpdf,float,caption,longtable,babel}
+\floatstyle{plaintop}
+\restylefloat{table}
+\labelformat{figure}{\figurename~#1}
+\labelformat{table}{\tablename~#1}
+\ifpdf
+ \usepackage{embedfile}
+ \embedfile[%
+ stringmethod=escape,%
+ mimetype=plain/text,%
+ desc={LaTeX docstrip source archive for package `\jobname'}%
+ ]{\jobname.dtx}
+\fi
+\IfFileExists{\jobname.sty}
+ {\usepackage{\jobname}}{}
+\usepackage[numbered]{hypdoc}
+\setcounter{IndexColumns}{2}
+\newlength\LaTeXwidth
+\newlength\LaTeXoutdent
+\newlength\LaTeXgap
+\setlength\LaTeXgap{1em}
+\setlength\LaTeXoutdent{-0.15\textwidth}
+\newbox\lst@samplebox
+\edef\LaTeXexamplefile{\jobname.tmp}
+\lst@RequireAspects{writefile}
+\lstnewenvironment{LaTeXexample}[1][example]{%
+ \global\let\lst@intname\@empty
+ \ifcsname LaTeXcode#1\endcsname
+ \expandafter\let\expandafter\LaTeXcode
+ \csname LaTeXcode#1\endcsname
+ \expandafter\let\expandafter\LaTeXcodeend
+ \csname LaTeXcode#1end\endcsname
+ \else
+ \PackageError{jawltxdoc}
+ {Undefined example type `#1'}
+ \@ehd
+ \let\LaTeXcode\relax
+ \let\LaTeXcodeend\relax
+ \fi
+ \LaTeXcode}
+ {\lst@EndWriteFile
+ \LaTeXcodeend}
+\newcommand*{\LaTeXcodeexample}{%
+ \setbox\lst@samplebox=\hbox\bgroup
+ \LaTeXcodefloat}
+\newcommand*{\LaTeXcodeexampleend}{%
+ \egroup
+ \setlength\LaTeXwidth{\wd\lst@samplebox}%
+ \begin{list}{}{%
+ \setlength\itemindent{0pt}
+ \setlength\leftmargin\LaTeXoutdent
+ \setlength\rightmargin{0pt}}%
+ \item
+ \setlength\LaTeXoutdent{-0.15\textwidth}
+ \begin{minipage}[c]{%
+ \textwidth-\LaTeXwidth-\LaTeXoutdent-\LaTeXgap}
+ \LaTeXcodefloatend
+ \end{minipage}%
+ \hfill
+ \begin{minipage}[c]{\LaTeXwidth}%
+ \hbox to\linewidth{\box\lst@samplebox\hss}%
+ \end{minipage}%
+ \end{list}}
+\let\LaTeXcodenoexample\LaTeXcodeexample
+\newcommand*{\LaTeXcodenoexampleend}{%
+ \egroup
+ \setlength\LaTeXwidth{\wd\lst@samplebox}%
+ \begin{list}{}{%
+ \setlength\itemindent{0pt}
+ \setlength\leftmargin{0pt}
+ \setlength\rightmargin{0pt}}%
+ \item
+ \begin{minipage}[c]{\LaTeXwidth}
+ \hbox to\linewidth{\box\lst@samplebox\hss}%
+ \end{minipage}%
+ \end{list}}
+\newcommand*{\LaTeXcodefloat}{%
+ \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt,
+ basicstyle=\small\ttfamily,basewidth=0.51em,
+ keywordstyle=\color{blue}}%
+ \lst@BeginAlsoWriteFile{\LaTeXexamplefile}}
+\newcommand*{\LaTeXcodefloatend}{%
+ \MakePercentComment\catcode`\^^M=10\relax
+ \small
+ {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}%
+ {\lst@ProcessTabulator}}%
+ \leavevmode \input{\LaTeXexamplefile}}%
+ \MakePercentIgnore}
+\lstnewenvironment{BibTeXexample}{%
+ \global\let\lst@intname\@empty
+ \setbox\lst@samplebox=\hbox\bgroup
+ \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt,
+ basicstyle=\small\ttfamily,basewidth=0.51em,
+ keywordstyle=\color{black}}
+ \lst@BeginAlsoWriteFile{\LaTeXexamplefile}}
+ {\lst@EndWriteFile
+ \LaTeXcodeexampleend}
+\newcommand*{\DescribeOption}{%
+ \leavevmode\@bsphack\begingroup\MakePrivateLetters
+ \Describe@Option}
+\newcommand*{\Describe@Option}[1]{\endgroup
+ \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
+ \SpecialOptionIndex{#1}\@esphack\ignorespaces}
+\newcommand*{\SpecialOptionIndex}[1]{\@bsphack
+ \index{#1\actualchar{\protect\ttfamily#1}
+ (option)\encapchar usage}%
+ \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}%
+ \encapchar usage}\@esphack}
+\newcommand*{\indexopt}[1]{\DescribeOption{#1}\opt{#1}}
+\newcommand*{\DescribeOptionInfo}[2]{%
+ \DescribeOption{#1}%
+ \opt{#1=\meta{#2}}\xspace}
+\newcommand*{\ofixarg}[1]{%
+ {\ttfamily[}%
+ \ifmmode \expandafter \nfss@text \fi
+ {%
+ \meta@font@select
+ \edef\meta@hyphen@restore{%
+ \hyphenchar\the\font\the\hyphenchar\font}%
+ \hyphenchar\font\m@ne
+ \language\l@nohyphenation
+ #1\/%
+ \meta@hyphen@restore
+ }%
+ {\ttfamily]}}
+\newcommand*{\pkg}[1]{\textsf{#1}}
+\newcommand*{\currpkg}{\pkg{\jobname}\xspace}
+\newcommand*{\opt}[1]{\texttt{#1}}
+\newcommand*{\defaultopt}[1]{\opt{\textbf{#1}}}
+\newcommand*{\file}[1]{\texttt{#1}}
+\newcommand*{\ext}[1]{\file{.#1}}
+\newcommand*{\latin}[1]{\emph{#1}}
+\newcommand*{\etc}{%
+ \@ifnextchar.
+ {\latin{etc}}
+ {\latin{etc}.\xspace}}
+\newcommand*{\eg}{%
+ \@ifnextchar.
+ {\latin{e.g}}
+ {\latin{e.g}.\xspace}}
+\newcommand*{\ie}{%
+ \@ifnextchar.
+ {\latin{i.e}}
+ {\latin{i.e}.\xspace}}
+\newcommand*{\AMS}{{\protect\usefont{OMS}{cmsy}{m}{n}%
+ A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
+\providecommand*{\eTeX}{\ensuremath{\varepsilon}-\TeX}
+\DeclareRobustCommand*{\XeTeX}
+ {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX}
+\providecommand*{\CTAN}{\textsc{ctan}}
+\patchcmd{\@addmarginpar}
+ {\@latex@warning@no@line {Marginpar on page \thepage\space moved}}
+ {\relax}{}{}
+%</jawltxdoc>
+%\fi
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.ins b/Master/texmf-dist/source/latex/siunitx/siunitx.ins
new file mode 100644
index 00000000000..60b954530c6
--- /dev/null
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.ins
@@ -0,0 +1,79 @@
+%%
+%% This is file `siunitx.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `install')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+ ----------------------------------------------------------------
+ The siunitx package --- A comprehensive (SI) units package
+ Maintained by Joseph Wright
+ E-mail: joseph.wright@morningstar2.co.uk
+ Released under the LaTeX Project Public License v1.3c or later
+ See http://www.latex-project.org/lppl.txt
+ ----------------------------------------------------------------
+
+\endpreamble
+\Msg{Generating siunitx files:}
+\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}}
+}
+\usedir{tex/latex/siunitx}
+\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}
+}
+\usedir{source/latex/siunitx}
+\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}
+}
+\usedir{doc/latex/siunitx}
+\generate{\file{si-bug.ltx}{\from{\jobname.dtx}{bug}}
+}
+\usedir{tex/latex/siunitx/config}
+\generate{\file{si-SIunits.cfg}{\from{\jobname.dtx}{SIunits}}
+ \file{si-sistyle.cfg}{\from{\jobname.dtx}{sistyle}}
+ \file{si-unitsdef.cfg}{\from{\jobname.dtx}{unitsdef}}
+ \file{si-units.cfg}{\from{\jobname.dtx}{units}}
+ \file{si-hepunits.cfg}{\from{\jobname.dtx}{hepunits}}
+ \file{si-fancynum.cfg}{\from{\jobname.dtx}{fancynum}}
+ \file{si-fancyunits.cfg}{\from{\jobname.dtx}{fancyunits}}
+}
+\generate{\file{si-prefix.cfg}{\from{\jobname.dtx}{prefix}}
+ \file{si-named.cfg}{\from{\jobname.dtx}{named}}
+ \file{si-prefixed.cfg}{\from{\jobname.dtx}{prefixed}}
+ \file{si-addn.cfg}{\from{\jobname.dtx}{addn}}
+ \file{si-accepted.cfg}{\from{\jobname.dtx}{accepted}}
+ \file{si-physical.cfg}{\from{\jobname.dtx}{physical}}
+ \file{si-abbr.cfg}{\from{\jobname.dtx}{abbr}}
+}
+\generate{\file{si-synchem.cfg}{\from{\jobname.dtx}{synchem}}
+ \file{si-hep.cfg}{\from{\jobname.dtx}{hep}}
+ \file{si-astro.cfg}{\from{\jobname.dtx}{astro}}
+ \file{si-binary.cfg}{\from{\jobname.dtx}{binary}}
+}
+\generate{\file{si-UK.cfg}{\from{\jobname.dtx}{UK}}
+ \file{si-USA.cfg}{\from{\jobname.dtx}{USA}}
+ \file{si-DE.cfg}{\from{\jobname.dtx}{DE}}
+ \file{si-ZA.cfg}{\from{\jobname.dtx}{ZA}}
+}
+\nopreamble
+\usedir{bibtex/bib/siunitx}
+\generate{\file{\jobname.bib}{\from{\jobname.dtx}{refs}}
+}
+\nopreamble\nopostamble
+\usedir{doc/latex/siunitx}
+\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}
+}
+\endbatchfile
+\endinput
+%%
+%% End of file `siunitx.ins'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg
new file mode 100644
index 00000000000..2f7b9d01d04
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-DE.cfg
@@ -0,0 +1,27 @@
+%%
+%% This is file `si-DE.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `DE')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-DE.cfg}
+ [\csname si@svn@version\endcsname siunitx: Germany locale]
+\sisetup{
+ unitsep=cdot,
+ valuesep=thin,
+ decimalsymbol=comma,
+ expproduct=cdot,
+ digitsep=thin,
+ sepfour=false}
+\endinput
+%%
+%% End of file `si-DE.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg
new file mode 100644
index 00000000000..d6237983a9c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-SIunits.cfg
@@ -0,0 +1,329 @@
+%%
+%% This is file `si-SIunits.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `SIunits')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-SIunits.cfg}
+ [\csname si@svn@version\endcsname siunitx: Emulation of
+ SIunits]
+\si@emulating{SIunits}{2007/12/02 v1.36}
+\sisetup{
+ unitsep=thick,
+ valuesep=thick,
+ prefixproduct=\si@valuesep,
+ trapambigfrac=false,
+ stickyper}
+\requiresiconfigs{prefix,named,accepted,physical}
+\newcommand*{\reciprocal}{\sisetup{per=reciprocal}\si@per}
+\let\rp\reciprocal
+\renewcommand*{\per}{\sisetup{per=slash}\si@per}
+\newcommand*{\usk}{}
+\newcommand*{\power}[1]{#1\tothe}
+\newcommand*{\rpsquare}{\sisetup{per=reciprocal}\si@per\Square}
+\newcommand*{\rpcubic}{\sisetup{per=reciprocal}\si@per\cubic}
+\newpower{\fourth}{4}
+\newcommand*{\rpfourth}{\sisetup{per=reciprocal}\si@per\fourth}
+\newcommand*{\rpsquared}{%
+ \sisetup{per=reciprocal}\si@unt@pertrue\si@unt@perseentrue%
+ \squared}
+\newcommand*{\rpcubed}{%
+ \sisetup{per=reciprocal}\si@unt@pertrue\cubed}
+\newcommand*{\SIsetup}[1]{%
+ \@for\si@tempa:=#1\do{%
+ \@ifundefined{ifsi@old@#1}
+ {\si@log@warn{Unknown SIunits option `#1'}}
+ {\csname si@old@#1true\endcsname}}
+ \si@siu@setup}
+\newcommand*{\si@siu@setup}{%
+ \ifsi@old@cdot
+ \sisetup{unitsep=cdot}%
+ \fi
+ \ifsi@old@thickspace
+ \sisetup{unitsep=thick}%
+ \fi
+ \ifsi@old@mediumspace
+ \sisetup{unitsep=medium}%
+ \fi
+ \ifsi@old@thinspace
+ \sisetup{unitsep=thin}%
+ \fi
+ \ifsi@old@thickqspace
+ \sisetup{valuesep=thick}%
+ \fi
+ \ifsi@old@mediumqspace
+ \sisetup{valuesep=medium}%
+ \fi
+ \ifsi@old@thinqspace
+ \sisetup{valuesep=thin}%
+ \fi}
+\si@siu@setup
+\ifsi@old@squaren
+ \newpower{\squaren}{2}
+\fi
+\AtBeginDocument{%
+ \@ifundefined{square}
+ {\newpower{\square}{2}}
+ {\ifsi@old@amssymb
+ \renewpower{\square}{2}
+ \else
+ \ifsi@old@squaren\else
+ \si@log@warn{\string\square\space already
+ defined\MessageBreak SIunits mode may cause
+ errors}%
+ \fi
+ \fi}}
+\AtBeginDocument{
+ \@ifundefined{gray}
+ {\newunit{\gray}{Gy}}
+ {\ifsi@old@pstricks
+ \renewunit{\gray}{Gy}
+ \else
+ \ifsi@old@Gray\else
+ \si@log@warn{\string\gray\space already
+ defined\MessageBreak SIunits mode may cause
+ errors}%
+ \fi
+ \fi}}
+\ifsi@old@italian
+ \let\unita\SI
+\else
+ \let\unit\SI
+\fi
+\ifsi@old@textstyle
+ \sisetup{mode=text}
+\fi
+\ifsi@old@binary
+ \sisetup{alsoload=binary}
+\fi
+\ifsi@old@noams
+ \AtBeginDocument{%
+ \renewcommand*{\si@textmu}{\ensuremath\si@mathsmu}}
+\fi
+\newunit[valuesep=none]{\arcminute}{\si@sym@minute}
+\newunit[valuesep=none]{\arcsecond}{\si@sym@second}
+\newunit{\rperminute}{r/min}
+\newunit{\ton}{t}
+\newunit{\degreecelsius}{\celsius}
+\let\addunit\newunit
+\newcommand*{\addprefix}[2]{\newprefix{#1}{#2}}
+\newcommand*{\si@siu@newunit}[3][]{%
+ \renewcommand*{\si@tempa}{#1}%
+ \renewcommand*{\si@tempb}{square}%
+ \renewcommand*{\si@siu@power}{}%
+ \ifx\@empty\si@tempa\@empty\else
+ \ifx\si@tempa\si@tempb
+ \renewcommand*{\si@siu@power}{\ssquare}%
+ \else
+ \edef\si@siu@power{%
+ \expandafter\noexpand\csname #1\endcsname}%
+ \fi
+ \fi
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3\endcsname}%
+ \edef\si@tempb{%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\per
+ \expandafter\noexpand\si@siu@power
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter%
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempb}
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3np\endcsname}%
+ \edef\si@tempb{%
+ \expandafter\noexpand\csname #2\endcsname\noexpand
+ \reciprocal\expandafter\noexpand\si@siu@power
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempb}%
+ \si@siu@newunithook[#1]{#2}{#3}}
+\providecommand*{\si@siu@newunithook}[3][]{}
+\si@siu@newunit{gray}{second}
+\si@siu@newunit[square]{metre}{second}
+\si@siu@newunit{joule}{mole}
+\si@siu@newunit[cubic]{mole}{metre}
+\si@siu@newunit[square]{radian}{second}
+\si@siu@newunit{radian}{second}
+\si@siu@newunit[cubic]{squaremetre}{metre}
+\si@siu@newunit[cubic]{katal}{metre}
+\si@siu@newunit{coulomb}{mol}
+\si@siu@newunit[square]{ampere}{metre}
+\si@siu@newunit[cubic]{kilogram}{metre}
+\si@siu@newunit[cubic]{coulomb}{metre}
+\si@siu@newunit{volt}{metre}
+\si@siu@newunit[square]{coulomb}{squaremetre}
+\si@siu@newunit{farad}{metre}
+\si@siu@newunit[square]{watt}{metre}
+\si@siu@newunit[square]{joule}{metre}
+\si@siu@newunit[cubic]{newton}{metre}
+\si@siu@newunit{newton}{kilogram}
+\si@siu@newunit{joule}{kelvin}
+\si@siu@newunit{joule}{kilogram}
+\si@siu@newunit{coulomb}{kilogram}
+\si@siu@newunit{squaremetre}{second}
+\si@siu@newunit[square]{squaremetre}{second}
+\si@siu@newunit[square]{candela}{metre}
+\si@siu@newunit{ampere}{metre}
+\si@siu@newunit{joule}{tesla}
+\si@siu@newunit{henry}{metre}
+\si@siu@newunit{kilogram}{second}
+\si@siu@newunit[square]{kilogram}{metre}
+\si@siu@newunit{kilogram}{metre}
+\si@siu@newunit[square]{newton}{metre}
+\si@siu@newunit{watt}{kilogram}
+\si@siu@newunit[cubic]{watt}{metre}
+\si@siu@newunit{squaremetre}{kilogram}
+\si@siu@newunit{cubicmetre}{kilogram}
+\si@siu@newunit{newton}{metre}
+\si@siu@newunit[cubic]{squaremetre}{second}
+\si@siu@newunit{metre}{second}
+\si@siu@newunit[cubic]{joule}{metre}
+\si@siu@newunit{cubicmetre}{second}
+\newcommand*{\si@siu@newunitx}[4]{%
+ \expandafter\newunit\expandafter{\csname #1per#2\endcsname}
+ {#3\per#4}%
+ \expandafter\newunit\expandafter{\csname #1per#2np\endcsname}
+ {#3\reciprocal#4}
+ \si@siu@newunitxhook{#1}{#2}{#3}{#4}}
+\providecommand*{\si@siu@newunitxhook}[4]{}
+\si@siu@newunitx{kilogramsquaremetre}{second}
+ {\kilogram\squaremetre}{\second}
+\si@siu@newunitx{squaremetre}{newtonsecond}{\squaremetre}
+ {\newton\second}
+\si@siu@newunitx{kilogrammetre}{second}{\kilogram\metre}
+ {\second}
+\si@siu@newunitx{kilogram}{squaremetresecond}{\kilogram}
+ {\squaremetre\second}
+\si@siu@newunitx{joule}{molekelvin}{\joule}{\mole\kelvin}
+\si@siu@newunitx{kilogram}{kilomole}{\kilogram}{\kilo\mole}
+\si@siu@newunitx{kilogrammetre}{squaresecond}{\kilogram\metre}
+ {\second\squared}
+\si@siu@newunitx{watt}{squaremetresteradian}{\watt}
+ {\squaremetre\steradian}
+\si@siu@newunitx{joule}{kilogramkelvin}{\joule}
+ {\kilogram\kelvin}
+\si@siu@newunitx{watt}{metrekelvin}{\watt}{\metre\kelvin}
+\si@siu@newunitx{kilogram}{cubicmetrecoulomb}{\kilogram}
+ {\cubic\metre\coulomb}
+\si@siu@newunitx{kilogram}{secondcubicmetre}{\kilogram}
+ {\second\cubicmetre}
+\newunit{\si@siu@unity}{1}
+\si@siu@newunitx{}{squaremetresecond}{\si@siu@unity}
+ {\squaremetre\second}
+\newunit{\pascalsecond}{\pascal\second}
+\newunit{\amperemetresecond}{\ampere\metre\second}
+\newunit{\ohmmetre}{\ohm\metre}
+\newunit{\newtonmetre}{\newton\metre}
+\let\newtonmetrenp\newtonmetre
+\newunit{\kilogramsquaremetre}{\kilogram\squaremetre}
+\let\kilogramsquaremetrenp\kilogramsquaremetre
+\newcommand*{\si@siu@newprefix}[1]{%
+ \edef\si@tempa{\expandafter\noexpand\csname #1d\endcsname}%
+ \edef\si@tempb{\expandafter\noexpand\csname #1\endcsname}%
+ \expandafter\expandafter\expandafter\newcommand\expandafter
+ \expandafter\expandafter*\expandafter\expandafter
+ \expandafter{\expandafter\si@tempa\expandafter}\expandafter
+ {\expandafter\si@prefixsymbolicfalse\si@tempb}}
+\si@siu@newprefix{yocto}
+\si@siu@newprefix{zepto}
+\si@siu@newprefix{atto}
+\si@siu@newprefix{femto}
+\si@siu@newprefix{pico}
+\si@siu@newprefix{nano}
+\si@siu@newprefix{micro}
+\si@siu@newprefix{milli}
+\si@siu@newprefix{centi}
+\si@siu@newprefix{deca}
+\si@siu@newprefix{deka}
+\si@siu@newprefix{hecto}
+\si@siu@newprefix{kilo}
+\si@siu@newprefix{mega}
+\si@siu@newprefix{giga}
+\si@siu@newprefix{tera}
+\si@siu@newprefix{peta}
+\si@siu@newprefix{exa}
+\si@siu@newprefix{zetta}
+\si@siu@newprefix{yotta}
+\ifsi@old@binary
+ \si@siu@newprefix{kibi}
+ \si@siu@newprefix{mebi}
+ \si@siu@newprefix{gibi}
+ \si@siu@newprefix{tebi}
+ \si@siu@newprefix{pebi}
+ \si@siu@newprefix{exbi}
+\fi
+\ifsi@old@derived
+ \newunit{\derradian}{\metre\reciprocal\metre}
+ \newunit{\dersteradian}{\squaremetre\rpsquare\metre}
+ \newunit{\derhertz}{\reciprocal\second}
+ \newunit{\dernewton}{\metre\kilogram\second\rpsquared}
+ \newunit{\derpascal}{\newton\rpsquare\metre}
+ \newunit{\derjoule}{\newton\metre}
+ \newunit{\derwatt}{\joule\reciprocal\second}
+ \newunit{\dercoulomb}{\ampere\second}
+ \newunit{\dervolt}{\watt\reciprocal\ampere}
+ \newunit{\derfarad}{\coulomb\reciprocal\volt}
+ \newunit{\derohm}{\volt\reciprocal\ampere}
+ \newunit{\dersiemens}{\ampere\reciprocal\volt}
+ \newunit{\derweber}
+ {\squaremetre\kilogram\second\rpsquared\reciprocal\ampere}
+ \newunit{\dertesla}{\weber\rpsquare\metre}
+ \newunit{\derhenry}{\weber\reciprocal\ampere}
+ \newunit{\dercelsius}{\kelvin}
+ \newunit{\derlumen}{\candela\steradian}
+ \newunit{\derlux}{\lumen\rpsquare\metre}
+ \newunit{\derbecquerel}{\derhertz}
+ \newunit{\dergray}{\joule\reciprocal\kilogram}
+ \newunit{\dersievert}{\dergray}
+ \newunit{\derkatal}{\rp\second\usk\mole}
+\fi
+\ifsi@old@derivedinbase
+ \newunit{\radianbase}{\metre\reciprocal\metre}
+ \newunit{\steradianbase}{\squaremetre\rpsquare\metre}
+ \newunit{\hertzbase}{\reciprocal\second}
+ \newunit{\newtonbase}{\metre\kilogram\second\rpsquared}
+ \newunit{\pascalbase}{\reciprocal\metre\kilogram\second%
+ \rpsquared}
+ \newunit{\joulebase}{\squaremetre\kilogram\second\rpsquared}
+ \newunit{\wattbase}{\squaremetre\kilogram\rpcubic\second}
+ \newunit{\coulombbase}{\ampere\second}
+ \newunit{\voltbase}
+ {\squaremetre\kilogram\rpcubic\second\reciprocal\ampere}
+ \newunit{\faradbase}
+ {\rpsquare\metre\reciprocal\kilogram\fourth\second\ampere%
+ \squared}
+ \newunit{\ohmbase}
+ {\squaremetre\kilogram\rpcubic\second\rpsquare\ampere}
+ \newunit{\siemensbase}
+ {\rpsquare\metre\reciprocal\kilogram\cubic\second\ampere%
+ \squared}
+ \newunit{\weberbase}
+ {\squaremetre\kilogram\second\rpsquared\reciprocal\ampere}
+ \newunit{\teslabase}{\kilogram\second\rpsquared\reciprocal%
+ \ampere}
+ \newunit{\henrybase}
+ {\squaremetre\kilogram\second\rpsquared\rpsquare\ampere}
+ \newunit{\celsiusbase}{\kelvin}
+ \newunit{\lumenbase}{\candela\squaremetre\rpsquare\metre}
+ \newunit{\luxbase}{\candela\squaremetre\rpfourth\metre}
+ \newunit{\becquerelbase}{\hertzbase}
+ \newunit{\graybase}{\squaremetre\second\rpsquared}
+ \newunit{\sievertbase}{\graybase}
+ \newunit{\katalbase}{\rp\second\mole}
+\fi
+\InputIfFileExists{SIunits.cfg}
+ {\si@log@inf{SIunits config file loaded}}
+ {\si@log@inf{SIunits config file not found}}
+\endinput
+%%
+%% End of file `si-SIunits.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg
new file mode 100644
index 00000000000..98aff00edb6
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-UK.cfg
@@ -0,0 +1,27 @@
+%%
+%% This is file `si-UK.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `UK')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-UK.cfg}
+ [\csname si@svn@version\endcsname siunitx: UK locale]
+\sisetup{
+ unitsep=thin,
+ expproduct=times,
+ valuesep=thin,
+ decimalsymbol=fullstop,
+ digitsep=thin,
+ sepfour=false}
+\endinput
+%%
+%% End of file `si-UK.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg
new file mode 100644
index 00000000000..b8c5a064809
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-USA.cfg
@@ -0,0 +1,27 @@
+%%
+%% This is file `si-USA.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `USA')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-USA.cfg}
+ [\csname si@svn@version\endcsname siunitx: USA locale]
+\sisetup{
+ unitsep=thin,
+ expproduct=times,
+ valuesep=thin,
+ decimalsymbol=fullstop,
+ digitsep=thin,
+ sepfour=false}
+\endinput
+%%
+%% End of file `si-USA.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg
new file mode 100644
index 00000000000..f2f0e09f749
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-ZA.cfg
@@ -0,0 +1,28 @@
+%%
+%% This is file `si-ZA.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `ZA')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-ZA.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ South Africa locale]
+\sisetup{
+ unitsep=cdot,
+ valuesep=thin,
+ expproduct=times,
+ decimalsymbol=comma,
+ digitsep=thin,
+ sepfour=false}
+\endinput
+%%
+%% End of file `si-ZA.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg
new file mode 100644
index 00000000000..bf409115351
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-abbr.cfg
@@ -0,0 +1,73 @@
+%%
+%% This is file `si-abbr.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `abbr')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-abbr.cfg}
+ [\csname si@svn@version\endcsname siunitx: Abbreviated units]
+\requiresiconfigs{prefix,named,accepted,physical}
+\newunit{\pA}{\pico\ampere}
+\newunit{\nA}{\nano\ampere}
+\newunit{\micA}{\micro\ampere}
+\newunit{\mA}{\milli\ampere}
+\newunit{\kA}{\kilo\ampere}
+\newunit{\Hz}{\hertz}
+\newunit{\mHz}{\milli\hertz}
+\newunit{\kHz}{\kilo\hertz}
+\newunit{\MHz}{\mega\hertz}
+\newunit{\GHz}{\giga\hertz}
+\newunit{\THz}{\tera\hertz}
+\newunit{\fmol}{\femto\mole}
+\newunit{\pmol}{\pico\mole}
+\newunit{\nmol}{\nano\mole}
+\newunit{\micmol}{\micro\mole}
+\newunit{\mmol}{\milli\mole}
+\newunit{\kV}{\kilo\volt}
+\newunit{\mV}{\milli\volt}
+\provideunit{\ml}{\milli\litre}
+\provideunit{\micl}{\micro\litre}
+\newunit{\cmc}{\centi\metre\cubed}
+\newunit{\dmc}{\deci\metre\cubed}
+\newunit{\cms}{\centi\metre\squared}
+\newunit{\kg}{\kilo\gram}
+\provideunit{\fg}{\femto\gram}
+\newunit{\pg}{\pico\gram}
+\newunit{\nanog}{\nano\gram}
+\newunit{\micg}{\micro\gram}
+\newunit{\mg}{\milli\gram}
+\newunit{\amu}{\atomicmass}
+\newunit{\kJ}{\kilo\joule}
+\newunit{\eV}{\electronvolt}
+\newunit{\meV}{\milli\electronvolt}
+\newunit{\keV}{\kilo\electronvolt}
+\newunit{\MeV}{\mega\electronvolt}
+\newunit{\GeV}{\giga\electronvolt}
+\newunit{\TeV}{\tera\electronvolt}
+\newunit[unitsep=none]{\kWh}{\kilo\watt\hour}
+\newunit{\picom}{\pico\metre}
+\newunit{\nm}{\nano\metre}
+\newunit{\micm}{\micro\metre}
+\newunit{\mm}{\milli\metre}
+\newunit{\cm}{\centi\metre}
+\newunit{\dm}{\deci\metre}
+\newunit{\km}{\kilo\metre}
+\newunit{\Sec}{\second}
+\newunit{\as}{\atto\second}
+\newunit{\fs}{\femto\second}
+\provideunit{\ps}{\pico\second}
+\newunit{\ns}{\nano\second}
+\newunit{\mics}{\micro\second}
+\newunit{\ms}{\milli\second}
+\endinput
+%%
+%% End of file `si-abbr.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg
new file mode 100644
index 00000000000..ffe8a8ca0ab
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-accepted.cfg
@@ -0,0 +1,39 @@
+%%
+%% This is file `si-accepted.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `accepted')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-accepted.cfg}
+ [\csname si@svn@version\endcsname siunitx: SI Accepted units]
+\newunit{\minute}{min}
+\newunit{\hour}{h}
+\newunit{\Day}{d}
+\newunit{\dday}{d}
+\ifsi@old@OHM
+ \newunit[valuesep=none]{\Degree}{\si@sym@degree}
+\else
+ \ifsi@gensymb\else
+ \newunit[valuesep=none]{\degree}{\si@sym@degree}
+ \fi
+\fi
+\newunit[valuesep=none]{\arcmin}{\si@sym@minute}
+\newunit[valuesep=none]{\arcsec}{\si@sym@second}
+\newunit{\litre}{l}
+\newunit{\liter}{L}
+\newunit{\tonne}{t}
+\newunit{\neper}{Np}
+\newunit{\bel}{B}
+\newunit{\percent}{\%}
+\endinput
+%%
+%% End of file `si-accepted.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg
new file mode 100644
index 00000000000..89dc4487117
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-addn.cfg
@@ -0,0 +1,33 @@
+%%
+%% This is file `si-addn.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `addn')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-addn.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Additional units]
+\newunit{\angstrom}{\si@sym@ringA}
+\newunit{\are}{a}
+\newunit{\hectare}{\hecto\are}
+\newunit{\barn}{b}
+\newunit{\BAR}{bar}
+\newunit{\bbar}{bar}
+\newunit{\millibar}{\milli\BAR}
+\newunit{\gal}{Gal}
+\newunit{\curie}{Ci}
+\newunit{\roentgen}{R}
+\newunit{\rad}{rad}
+\newunit{\rem}{rem}
+\endinput
+%%
+%% End of file `si-addn.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg
new file mode 100644
index 00000000000..de516883511
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-astro.cfg
@@ -0,0 +1,23 @@
+%%
+%% This is file `si-astro.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `astro')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-astro.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ Units for astronomy]
+\newunit{\parsec}{pc}
+\newunit{\lightyear}{ly}
+\endinput
+%%
+%% End of file `si-astro.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg
new file mode 100644
index 00000000000..110791abbcc
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-binary.cfg
@@ -0,0 +1,30 @@
+%%
+%% This is file `si-binary.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `binary')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-binary.cfg}
+ [\csname si@svn@version\endcsname siunitx: Binary units]
+\newprefix[binary]{\kibi}{10}{Ki}
+\newprefix[binary]{\mebi}{20}{Mi}
+\newprefix[binary]{\gibi}{30}{Gi}
+\newprefix[binary]{\tebi}{40}{Ti}
+\newprefix[binary]{\pebi}{50}{Pi}
+\newprefix[binary]{\exbi}{60}{Ei}
+\newprefix[binary]{\zebi}{70}{Zi}
+\newprefix[binary]{\yobi}{80}{Yi}
+\newunit{\bit}{bit}
+\newunit{\byte}{B}
+\endinput
+%%
+%% End of file `si-binary.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg
new file mode 100644
index 00000000000..b60266bbc01
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-fancynum.cfg
@@ -0,0 +1,48 @@
+%%
+%% This is file `si-fancynum.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `fancynum')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-fancynum.cfg}
+ [\csname si@svn@version\endcsname Emulation of siunitx:
+ fancynum]
+\si@emulating{fancynum}{2000/08/08 0.92}
+\sisetup{decimalsymbol=cdot,digitsep=comma}
+\let\fnum\num
+\newcommand*{\setfnumdsym}[1]{\sisetup{decimalsymbol={#1}}}
+\newcommand*{\setfnumgsym}[1]{\sisetup{digitsep={#1}}}
+\newcommand*{\setfnummsym}[1]{\sisetup{expproduct={#1}}}
+\ifsi@old@english
+ \sisetup{decimalsymbol=cdot,digitsep=comma}
+\fi
+\ifsi@old@french
+ \sisetup{decimalsymbol=comma,digitsep=fullstop}
+\fi
+\ifsi@old@tight
+ \sisetup{expproduct=tighttimes}
+\fi
+\ifsi@old@loose
+ \sisetup{expproduct=times}
+\fi
+\ifsi@old@thinspaces
+ \sisetup{digitsep=thin}
+\fi
+\ifsi@old@commas
+ \sisetup{digitsep=comma}
+\fi
+\ifsi@old@plain
+ \sisetup{digitsep=none}
+\fi
+\endinput
+%%
+%% End of file `si-fancynum.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg
new file mode 100644
index 00000000000..b784816341a
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-fancyunits.cfg
@@ -0,0 +1,106 @@
+%%
+%% This is file `si-fancyunits.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `fancyunits')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-fancyunits.cfg}
+ [\csname si@svn@version\endcsname Emulation of siunitx:
+ fancyunits]
+\si@emulating{fancyunits}{2007/02/01 v1.0.1}
+\si@ifloaded{SIunits}
+ {\si@log@err{SIunits emulation loaded\MessageBreak before
+ fancyunits emulation}{You need to load the fancyunits
+ emualtion\MessageBreak code before that for
+ SIunits.\MessageBreak Try emulate=fancyunits as the first
+ option when\MessageBreak loading siunitx}}{}
+\newcommand*{\si@siu@newunithook}[3][]{%
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3uf\endcsname}%
+ \renewcommand*{\si@tempb}{stickyper,per=fraction,
+ fraction=nice}%
+ \edef\si@tempc{%
+ \noexpand\sisetup{\si@tempb}%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\si@per%
+ \expandafter\noexpand\si@siu@power%
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempc}%
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3Uf\endcsname}%
+ \renewcommand*{\si@tempb}{stickyper,per=fraction,
+ fraction=frac}%
+ \edef\si@tempc{%
+ \noexpand\sisetup{\si@tempb}%
+ \noexpand\def\noexpand\si@frc@hook{\noexpand\textstyle}%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\si@per%
+ \expandafter\noexpand\si@siu@power%
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempc}%
+ \edef\si@tempa{%
+ \expandafter\noexpand\csname #2per#1#3UF\endcsname}%
+ \edef\si@tempc{%
+ \noexpand\sisetup{\si@tempb}%
+ \noexpand\def\noexpand\si@frc@hook{\noexpand\displaystyle}%
+ \expandafter\noexpand\csname #2\endcsname\noexpand\si@per%
+ \expandafter\noexpand\si@siu@power%
+ \expandafter\noexpand\csname #3\endcsname}%
+ \expandafter\expandafter\expandafter\newunit\expandafter
+ \expandafter\expandafter{\expandafter\si@tempa\expandafter}%
+ \expandafter{\si@tempc}}
+\newcommand*{\si@siu@newunitxhook}[4]{%
+ \expandafter\newunit\expandafter{\csname #1per#2uf\endcsname}
+ {\sisetup{stickyper,per=fraction,fraction=nice}%
+ #3\si@per#4}%
+ \expandafter\newunit\expandafter{\csname #1per#2Uf\endcsname}
+ {\sisetup{stickyper,per=fraction,fraction=frac}%
+ \renewcommand*{\si@frc@hook}{\textstyle}%
+ #3\si@per#4}%
+ \expandafter\newunit\expandafter{\csname #1per#2UF\endcsname}
+ {\sisetup{stickyper,per=fraction,fraction=frac}%
+ \renewcommand*{\si@frc@hook}{\displaystyle}%
+ #3\si@per#4}}
+\requiresiconfigs{SIunits,addn,astro}
+\sisetup{obeyall}
+\ifsi@old@spaceqspace
+ \sisetup{valuesep=space}
+\fi
+\newunit{\paminute}{'}
+\newunit{\parsecond}{''}
+\newunit{\AstroE}{AE}
+\newunit{\oersted}{OE}
+\provideunit{\ton}{t}
+\let\decaD\decad
+\newcommand*{\ufrac}[2]{%
+ \si[stickyper,per=fraction,fraction=nice]{#1\si@per#2}}
+\newcommand*{\Ufrac}[2]{%
+ \ensuremath{\textstyle{%
+ \si[stickyper,per=fraction,fraction=frac]{#1\si@per#2}}}}
+\newcommand*{\UFrac}[2]{%
+ \ensuremath{\displaystyle{%
+ \si[stickyper,per=fraction,fraction=frac]{#1\si@per#2}}}}
+\let\pow\power
+\let\Squaremetre\squaremetre
+\si@siu@newunit{Gray}{second}
+\si@siu@newunit[square]{Squaremetre}{metre}
+\si@siu@newunitx{Squaremetre}{newtonsecond}{\Square\metre}
+ {\newton\second}
+\si@siu@newunit{Squaremetre}{second}
+\si@siu@newunit[square]{Squaremetre}{squaresecond}
+\si@siu@newunit{Squaremetre}{kilogram}
+\si@siu@newunit[cubic]{Squaremetre}{second}
+\endinput
+%%
+%% End of file `si-fancyunits.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg
new file mode 100644
index 00000000000..4e33ed98e37
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-hep.cfg
@@ -0,0 +1,39 @@
+%%
+%% This is file `si-hep.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `hep')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-hep.cfg}
+ [\csname si@svn@version\endcsname siunitx: Units for
+ high-energy physics]
+\requiresiconfigs{prefix,named}
+\provideunit{\micron}{\micro\metre}
+\newunit{\mrad}{\milli\rad}
+\newunit{\gauss}{G}
+\newunit{\clight}{\ensuremath{\mathnormal{c}}}
+\newunit{\eVperc}{\eV\per\clight}
+\newunit{\nanobarn}{\nano\barn}
+\newunit{\picobarn}{\pico\barn}
+\newunit{\femtobarn}{\femto\barn}
+\newunit{\attobarn}{\atto\barn}
+\newunit{\zeptobarn}{\zepto\barn}
+\newunit{\yoctobarn}{\yocto\barn}
+\provideunit{\nb}{\nano\barn}
+\provideunit{\pb}{\pico\barn}
+\provideunit{\fb}{\femto\barn}
+\provideunit{\ab}{\atto\barn}
+\provideunit{\zb}{\zepto\barn}
+\provideunit{\yb}{\yocto\barn}
+\endinput
+%%
+%% End of file `si-hep.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg
new file mode 100644
index 00000000000..42b38b74b46
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-hepunits.cfg
@@ -0,0 +1,71 @@
+%%
+%% This is file `si-hepunits.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `hepunits')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-hepunits.cfg}
+ [\csname si@svn@version\endcsname Emulation of siunitx:
+ hepunits]
+\si@emulating{hepunits}{2007/09/27}
+\requiresiconfigs{SIunits,accepted,prefix,hep}
+\ifsi@old@noprefixcmds\else
+ \newunit{\invbarn}{\per\barn}
+ \newunit{\invnanobarn}{\per\nano\barn}
+ \newunit{\invpicobarn}{\per\pico\barn}
+ \newunit{\invfemtobarn}{\per\femto\barn}
+ \newunit{\invattobarn}{\per\atto\barn}
+ \newunit{\invzeptobarn}{\per\zepto\barn}
+ \newunit{\invyoctobarn}{\per\yocto\barn}
+ \newunit{\invnb}{\per\nano\barn}
+ \newunit{\invpb}{\per\pico\barn}
+ \newunit{\invfb}{\per\femto\barn}
+ \newunit{\invab}{\per\atto\barn}
+ \newunit{\invzb}{\per\zepto\barn}
+ \newunit{\invyb}{\per\yocto\barn}
+\fi
+\newunit{\invcmsqpersecond}{\per\Square\centi\metre\per\second}
+\newunit{\invcmsqpersec}{\per\Square\centi\metre\per\second}
+\newunit{\lumiunits}{\per\Square\centi\metre\per\second}
+\newunit{\inveV}{\per\electronvolt}
+\newunit{\minveV}{\per\milli\electronvolt}
+\newunit{\kinveV}{\per\kilo\electronvolt}
+\newunit{\MinveV}{\per\mega\electronvolt}
+\newunit{\GinveV}{\per\giga\electronvolt}
+\newunit{\TinveV}{\per\tera\electronvolt}
+\newunit[per=slash,eVcorrb=0.6ex]{\eVoverc}
+ {\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\eVovercsq}
+ {\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\meVoverc}
+ {\milli\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\keVoverc}
+ {\kilo\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\MeVoverc}
+ {\mega\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\GeVoverc}
+ {\giga\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\TeVoverc}
+ {\tera\electronvolt\per\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\meVovercsq}
+ {\milli\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\keVovercsq}
+ {\kilo\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\MeVovercsq}
+ {\mega\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\GeVovercsq}
+ {\giga\electronvolt\per\Square\clight}
+\newunit[per=slash,eVcorrb=0.6ex]{\TeVovercsq}
+ {\tera\electronvolt\per\Square\clight}
+\endinput
+%%
+%% End of file `si-hepunits.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg
new file mode 100644
index 00000000000..ef8fe1c3f06
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-named.cfg
@@ -0,0 +1,55 @@
+%%
+%% This is file `si-named.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `named')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-named.cfg}
+ [\csname si@svn@version\endcsname siunitx: SI Named units]
+\newunit{\becquerel}{Bq}
+\newunit{\coulomb}{C}
+\newunit{\farad}{F}
+\newunit{\Gray}{Gy}
+\newunit{\ggray}{Gy}
+\newunit{\hertz}{Hz}
+\newunit{\henry}{H}
+\newunit{\joule}{J}
+\newunit{\katal}{kat}
+\newunit{\lumen}{lm}
+\newunit{\lux}{lx}
+\newunit{\newton}{N}
+\ifsi@old@OHM
+ \newunit{\Ohm}{\si@sym@Omega}
+\else
+ \ifsi@gensymb\else
+ \provideunit{\ohm}{\si@sym@Omega}
+ \fi
+\fi
+\newunit{\pascal}{Pa}
+\newunit{\siemens}{S}
+\newunit{\sievert}{Sv}
+\newunit{\tesla}{T}
+\newunit{\volt}{V}
+\newunit{\watt}{W}
+\newunit{\weber}{Wb}
+\ifsi@old@OHM
+ \newunit{\Celsius}{\si@sym@celsius}
+\else
+ \ifsi@gensymb\else
+ \newunit{\celsius}{\si@sym@celsius}
+ \fi
+\fi
+\newunit{\radian}{rad}
+\newunit{\steradian}{sr}
+\endinput
+%%
+%% End of file `si-named.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg
new file mode 100644
index 00000000000..f0f9b580d6e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-physical.cfg
@@ -0,0 +1,27 @@
+%%
+%% This is file `si-physical.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `physical')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-physical.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Physically-measured units]
+\newcommand*{\si@eVspacea}{\text{\kern-\si@eVcorra}}%
+\newcommand*{\si@eVspaceb}{\text{\kern-\si@eVcorrb}}%
+\newunit{\electronvolt}{e\protect\si@eVspacea V\protect%
+ \si@eVspaceb}
+\newunit{\atomicmass}{u}
+\newunit{\atomicmassunit}{u}
+\endinput
+%%
+%% End of file `si-physical.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg
new file mode 100644
index 00000000000..882b6985870
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-prefix.cfg
@@ -0,0 +1,50 @@
+%%
+%% This is file `si-prefix.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `prefix')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-prefix.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Multiple prefixes]
+\newprefix{\yocto}{-24}{y}
+\newprefix{\zepto}{-21}{z}
+\newprefix{\atto}{-18}{a}
+\newprefix{\femto}{-15}{f}
+\newprefix{\pico}{-12}{p}
+\newprefix{\nano}{-9}{n}
+\ifsi@old@OHM
+ \newprefix{\Micro}{-6}{\si@sym@mu}
+\else
+ \ifsi@gensymb\else
+ \newprefix{\micro}{-6}{\si@sym@mu}
+ \fi
+\fi
+\newprefix{\milli}{-3}{m}
+\newprefix{\centi}{-2}{c}
+\newprefix{\deci}{-1}{d}
+\newprefix{\deca}{1}{da}
+\newprefix{\hecto}{2}{h}
+\newprefix{\kilo}{3}{k}
+\newprefix{\mega}{6}{M}
+\newprefix{\giga}{9}{G}
+\newprefix{\tera}{12}{T}
+\newprefix{\peta}{15}{P}
+\newprefix{\exa}{18}{E}
+\newprefix{\zetta}{21}{Z}
+\newprefix{\yotta}{24}{Y}
+\newprefix{\deka}{1}{da}
+\newunit{\gram}{g}
+\renewunit{\kilogram}{\kilo\gram}
+\endinput
+%%
+%% End of file `si-prefix.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg
new file mode 100644
index 00000000000..5dce06ba0c8
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-prefixed.cfg
@@ -0,0 +1,103 @@
+%%
+%% This is file `si-prefixed.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `prefixed')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-prefixed.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ SI Prefixed units]
+\requiresiconfigs{prefix,named,accepted,physical}
+\newunit{\picometre}{\pico\metre}
+\newunit{\nanometre}{\nano\metre}
+\newunit{\micrometre}{\micro\metre}
+\newunit{\millimetre}{\milli\metre}
+\newunit{\centimetre}{\centi\metre}
+\newunit{\decimetre}{\deci\metre}
+\newunit{\kilometre}{\kilo\metre}
+\newunit{\femtogram}{\femto\gram}
+\newunit{\picogram}{\pico\gram}
+\newunit{\nanogram}{\nano\gram}
+\newunit{\microgram}{\micro\gram}
+\newunit{\milligram}{\milli\gram}
+\newunit{\femtomole}{\femto\mole}
+\newunit{\picomole}{\pico\mole}
+\newunit{\nanomole}{\nano\mole}
+\newunit{\micromole}{\micro\mole}
+\newunit{\millimole}{\milli\mole}
+\newunit{\attosecond}{\atto\second}
+\newunit{\femtosecond}{\femto\second}
+\newunit{\picosecond}{\pico\second}
+\newunit{\nanosecond}{\nano\second}
+\newunit{\microsecond}{\micro\second}
+\newunit{\millisecond}{\milli\second}
+\newunit{\picoampere}{\pico\ampere}
+\newunit{\nanoampere}{\nano\ampere}
+\newunit{\microampere}{\micro\ampere}
+\newunit{\milliampere}{\milli\ampere}
+\newunit{\kiloampere}{\kilo\ampere}
+\newunit{\millivolt}{\milli\volt}
+\newunit{\kilovolt}{\kilo\volt}
+\newunit{\milliwatt}{\milli\watt}
+\newunit{\kilowatt}{\kilo\watt}
+\newunit{\megawatt}{\mega\watt}
+\newunit{\femtofarad}{\femto\farad}
+\newunit{\picofarad}{\pico\farad}
+\newunit{\nanofarad}{\nano\farad}
+\newunit{\microfarad}{\micro\farad}
+\newunit{\millifarad}{\milli\farad}
+\newunit{\millisiemens}{\milli\siemens}
+\ifsi@old@OHM
+ \newunit{\kiloohm}{\kilo\Ohm}
+ \newunit{\megaohm}{\mega\Ohm}
+ \newunit{\gigaohm}{\giga\Ohm}
+\else
+ \ifsi@gensymb\else
+ \newunit{\kiloohm}{\kilo\ohm}
+ \newunit{\megaohm}{\mega\ohm}
+ \newunit{\gigaohm}{\giga\ohm}
+ \fi
+\fi
+\newunit{\microlitre}{\micro\litre}
+\newunit{\millilitre}{\milli\litre}
+\newunit{\cubicmetre}{\metre\cubed}
+\newunit{\cubiccentimetre}{\centi\metre\cubed}
+\newunit{\centimetrecubed}{\centi\metre\cubed}
+\newunit{\cubicmicrometre}{\micro\metre\cubed}
+\newunit{\cubicmillimetre}{\milli\metre\cubed}
+\newunit{\cubicdecimetre}{\cubic\deci\metre}
+\newunit{\squaremetre}{\Square\metre}
+\newunit{\squarecentimetre}{\Square\centi\metre}
+\newunit{\centimetresquared}{\centi\metre\squared}
+\newunit{\squarekilometre}{\Square\kilo\metre}
+\newunit{\millijoule}{\milli\joule}
+\newunit{\kilojoule}{\kilo\joule}
+\newunit{\megajoule}{\mega\joule}
+\newunit{\millielectronvolt}{\milli\electronvolt}
+\newunit{\kiloelectronvolt}{\kilo\electronvolt}
+\newunit{\megaelectronvolt}{\mega\electronvolt}
+\newunit{\gigaelectronvolt}{\giga\electronvolt}
+\newunit{\teraelectronvolt}{\tera\electronvolt}
+\newunit[unitsep=none]{\kilowatthour}{\kilo\watt\hour}
+\newunit{\millihertz}{\milli\hertz}
+\newunit{\kilohertz}{\kilo\hertz}
+\newunit{\megahertz}{\mega\hertz}
+\newunit{\gigahertz}{\giga\hertz}
+\newunit{\terahertz}{\tera\hertz}
+\newunit{\millinewton}{\milli\newton}
+\newunit{\kilonewton}{\kilo\newton}
+\newunit{\hectopascal}{\hecto\pascal}
+\newunit{\megabecquerel}{\mega\becquerel}
+\newunit{\millisievert}{\milli\sievert}
+\endinput
+%%
+%% End of file `si-prefixed.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg
new file mode 100644
index 00000000000..aca37d6e003
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-sistyle.cfg
@@ -0,0 +1,87 @@
+%%
+%% This is file `si-sistyle.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `sistyle')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-sistyle.cfg}
+ [\csname si@svn@version\endcsname siunitx: Emulation of
+ SIstyle]
+\si@emulating{sistyle}{2006/12/20 v2.3}
+\sisetup{%
+ sepfour=true,
+ obeyfamily,
+ obeyitalic=true,
+ numsign=+-,
+ strictarc=false,
+ unitsep=cdot}
+\newcommand*{\SIobeyboldtrue}{\sisetup{obeybold=true}}
+\newcommand*{\SIobeyboldfalse}{\sisetup{obeybold=false}}
+\let\num\relax
+\si@newrobustcmd*{\num}{%
+ \@ifstar
+ {\si@sis@numstar}
+ {\si@sis@num}}
+\newcommand*{\si@sis@num}[2][]{%
+ \begingroup%
+ \sisetup{#1}%
+ \expandafter\si@out@num\expandafter{\si@num{#2}}%
+ \endgroup}
+\newcommand*{\si@sis@numstar}[2][]{%
+ \begingroup%
+ \sisetup{mode=text,obeybold}%
+ \sisetup{#1}%
+ \expandafter\si@out@num\expandafter{\si@num{#2}}%
+ \endgroup}
+\newcommand*{\pnt}{\ensuremath{\si@decimalsymbol}}
+\newcommand*{\SIgroupfourtrue}{\sisetup{sepfour=true}}
+\newcommand*{\SIgroupfourfalse}{\sisetup{sepfour=false}}
+\newcommand*{\SIunitsep}[1]{\sisetup{valuesep={#1}}}
+\newcommand*{\SIunitspace}[1]{\sisetup{unitspace={#1}}}
+\newcommand*{\SIunitdot}[1]{\sisetup{unitsep={#1}}}
+\newcommand*{\SIdecimalsymbol}[1]{\sisetup{decimalsymbol={#1}}}
+\newcommand*{\SIthousandsep}[1]{\sisetup{digitsep={#1}}}
+\newcommand*{\SIproductsign}[1]{\sisetup{expproduct={#1}}}
+\newcommand*{\SIdecimalsign}[1]{\sisetup{decimalsymbol={#1}}}
+\newcommand*{\si@sis@savefont}[2]{%
+ \@namedef{si@sis@#1}{#2}%
+ \sisetup{#1=si@sis@#1}}
+\newcommand*{\SImathrm}[1]{\si@sis@savefont{mathrm}{#1}}
+\newcommand*{\SImathsf}[1]{\si@sis@savefont{mathsf}{#1}}
+\newcommand*{\SImathtt}[1]{\si@sis@savefont{mathtt}{#1}}
+\newcommand*{\SIdefaultMfam}[1]{\si@sis@savefont{mathrm}{#1}}
+\newcommand*{\SIdefaultNfam}[1]{\si@sis@savefont{mathnumrm}{#1}}
+\newcommand*{\SIdefaultTfam}[1]{\si@sis@savefont{textrm}{#1}}
+\si@newrobustcmd*{\ensureupmath}[1]{%
+ \begingroup
+ \sisetup{mode=maths,obeyitalic=false}%
+ \si@out{#1}%
+ \endgroup}
+\newcommand*{\degC}{\si@sym@celsius}
+\newcommand*{\arcdeg}{\si@sym@degree}
+\newcommand*{\degF}{\si@sym@degree F}
+\newcommand*{\SIstyle}[1]{\sisetup{locale=#1}}
+\newcommand*{\SIstyleToLang}[2]{\sisetup{loctolang=#1:#2}}
+\newcommand*{\AddToSIstyle}{%
+ \si@switchfalse
+ \@ifstar
+ {\si@switchtrue
+ \si@sis@addtolocale}
+ {\si@sis@addtolocale}}
+\newcommand*{\si@sis@addtolocale}[2]{%
+ \ifsi@switch
+ \expandafter\let\csname si@loc@#1@extra\endcsname\relax
+ \fi
+ \addtolocale{#1}{#2}}
+\endinput
+%%
+%% End of file `si-sistyle.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg
new file mode 100644
index 00000000000..05f3f96d111
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-synchem.cfg
@@ -0,0 +1,27 @@
+%%
+%% This is file `si-synchem.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `synchem')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-synchem.cfg}
+ [\csname si@svn@version\endcsname siunitx: Units for
+ synthetic chemists]
+\requiresiconfigs{prefix}
+\newunit{\mmHg}{mmHg}
+\newunit{\molar}{\mole\per\cubic\deci\metre}
+\newunit{\Molar}{\textsc{m}}
+\newunit{\torr}{Torr}
+\newunit{\dalton}{Da}
+\endinput
+%%
+%% End of file `si-synchem.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg
new file mode 100644
index 00000000000..d1514fdc9e4
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-units.cfg
@@ -0,0 +1,53 @@
+%%
+%% This is file `si-units.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `units')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\si@ifloaded{units}{\endinput}{}
+\ProvidesFile{si-units.cfg}
+ [\csname si@svn@version\endcsname siunitx: Emulation of units]
+\si@emulating{units}{1998/08/04 v0.9b}
+\si@ifloaded{SIunits}
+ {\si@emclash{units}{SIunits}\endinput}{}
+\si@ifloaded{sistyle}
+ {\si@emclash{units}{sistyle}\endinput}{}
+\sisetup{per=fraction,fraction=nice,obeybold,inlinebold=maths,
+ ,obeymode}
+\ifsi@old@tight
+ \sisetup{valuesep=thin}
+\fi
+\ifsi@old@loose
+ \sisetup{valuesep=space}
+\fi
+\ifsi@old@ugly
+ \sisetup{fraction=ugly}
+\fi
+\si@newrobustcmd*{\unit}[2][]{%
+ \ifmmode
+ \SI{#1}{#2}%
+ \else
+ \SI[obeyfamily,obeyitalic]{#1}{#2}%
+ \fi}
+\si@newrobustcmd*{\unitfrac}[3][]{%
+ \begingroup
+ \si@fam@mode%
+ \ifmmode\else
+ \sisetup{obeyfamily,obeyitalic}%
+ \fi
+ \si@ifnotmtarg{#1}
+ {\num{#1}\ensuremath{\si@valuesep}}%
+ \si@frac{#2}{#3}
+ \endgroup}
+\endinput
+%%
+%% End of file `si-units.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg b/Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg
new file mode 100644
index 00000000000..6d1575dd091
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/config/si-unitsdef.cfg
@@ -0,0 +1,233 @@
+%%
+%% This is file `si-unitsdef.cfg',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `unitsdef')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\ProvidesFile{si-unitsdef.cfg}
+ [\csname si@svn@version\endcsname siunitx:
+ Emulation of unitsdef]
+\si@emulating{unitsdef}{2005/01/04 v0.2}
+\si@ifloaded{SIunits}
+ {\si@emclash{unitsdef}{SIunits}\endinput}{}
+\si@ifloaded{sistyle}
+ {\si@emclash{unitsdef}{sistyle}\endinput}{}
+\requiresiconfigs{units}
+\RequirePackage{textcomp}
+\RequirePackage[T1]{fontenc}
+\sisetup{mode=text,allowoptarg,prespace}
+\ifsi@old@noxspace
+ \sisetup{xspace=false}
+\fi
+\ifsi@old@noabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@nofrequncyabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@nomolabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@novoltageabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@novolumeabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@noweightabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@noenergyabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@nolengthabbr
+ \sisetup{noload=abbr}
+\fi
+\ifsi@old@notimeabbr
+ \sisetup{noload=abbr}
+\fi
+\newcommand*{\unitvaluesep}{\,}
+\renewcommand*{\si@valuesep}{\text{\unitvaluesep}}
+\define@choicekey*+[si]{key}{valuesep}[\si@tempa]
+ {space,thin,med,medium,thick,none}
+ {\renewcommand*\unitvaluesep\@nameuse{si@fix@##1}%
+ \si@log@debug{Option valuesep set to ##1}}
+ {\si@log@debug{Option valuesep set to ##1}%
+ \renewcommand*\unitvaluesep{##1}}
+\let\unitsignonly\si
+\si@newrobustcmd*{\ilu}[2][]{%
+ \begingroup
+ #1\unitvaluesep%
+ \unit{#2}%
+ \endgroup}
+\let\arc\ang
+\newcommand*{\unitSIdef}{\upshape}
+\newcommand*{\si@unitSIdef}{\unitSIdef\selectfont}
+\sisetup{textrm=si@unitSIdef}
+\let\per\relax
+\si@newrobustcmd*{\per}[2]{%
+ \begingroup
+ \si@xspacefalse
+ \renewcommand*{\unitvaluesep}{}%
+ \unitfrac{#1}{#2}%
+ \endgroup}
+\newcommand*{\unittimes}{\ensuremath{\cdot}}
+\newcommand*{\unitsep}{\,}
+\renewcommand*{\si@unt@unithook}{\si@unt@litouttrue}
+\sisetup{unitsep=none}
+\newcommand*{\unitsuperscript}{\tothe}
+\newcommand*{\newnosepunit}{\newunit[valuesep=none]}
+\newcommand*{\renewnosepunit}{\renewunit[valuesep=none]}
+\newcommand*{\setTextOmega}[2]{%
+ \renewcommand*{\si@textOmega}{%
+ \begingroup
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setMathOmega}[1]{\sisetup{mathsOmega=#1}}
+\newcommand*{\setTextmu}[2]{%
+ \renewcommand*{\si@textmu}{%
+ \begingroup
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setMathmu}[1]{\sisetup{mathsmu=#1}}
+\newcommand*{\setTextCelsius}[2]{%
+ \renewcommand*{\si@textcelsius}{%
+ \begingroup
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setMathCelsius}[1]{\sisetup{mathscelsius=#1}}
+\newcommand*{\setMathDegree}[2]{%
+ \renewcommand*{\si@textdegree}{%
+ \begingroup%
+ \edef\si@tempa{\sfdefault}%
+ \ifx\f@family\si@tempa
+ \expandafter#2%
+ \else
+ \expandafter#1%
+ \fi
+ \endgroup}}
+\newcommand*{\setTextDegree}[1]{\sisetup{textdegree=#1}}
+\ifsi@old@OHM
+ \ifsi@old@ohm
+ \si@log@inf{Both `ohm' and `OHM' options given\MessageBreak
+ Using default behaviour for unitsdef}
+ \expandafter\expandafter\expandafter\si@old@OHMfalse
+ \fi
+\fi
+\ifsi@old@liter
+ \ifsi@old@LITER
+ \si@log@inf{Both `liter' and `LITER' options
+ given\MessageBreak Using default behaviour for unitsdef}
+ \else
+ \renewunit{\liter}{l}
+ \fi
+\fi
+\newunit{\ton}{t}
+\newunit{\days}{d}
+\newunit{\picometer}{\pico\meter}
+\newunit{\nanometer}{\nano\meter}
+\newunit{\micrometer}{\micro\meter}
+\newunit{\millimeter}{\milli\meter}
+\newunit{\centimeter}{\centi\meter}
+\newunit{\decimeter}{\deci\meter}
+\newunit{\kilometer}{\kilo\meter}
+\newunit{\femtoliter}{\femto\liter}
+\newunit{\picoliter}{\pico\liter}
+\newunit{\nanoliter}{\nano\liter}
+\newunit{\microliter}{\micro\liter}
+\newunit{\milliliter}{\milli\liter}
+\newunit{\centiliter}{\centi\liter}
+\newunit{\deciliter}{\deci\liter}
+\newunit{\hectoliter}{\hecto\liter}
+\newunit{\cubicmeter}{\meter\cubed}
+\newunit{\cubicmicrometer}{\micro\meter\cubed}
+\newunit{\cubicmillimeter}{\milli\meter\cubed}
+\newunit{\squaremeter}{\Square\meter}
+\newunit{\squarecentimeter}{\Square\centi\meter}
+\newunit{\squarekilometer}{\Square\kilo\meter}
+\newunit{\ar}{a}
+\newunit{\hectar}{\hecto\ar}
+\ifsi@old@noabbr
+\else
+ \ifsi@old@novoltageabbr\else
+ \newunit{\kv}{\kilo\volt}
+ \newunit{\mv}{\milli\volt}
+ \fi
+\fi
+\ifsi@old@noabbr\else
+ \ifsi@old@notimeabbr\else
+ \newunit{\sek}{\second}
+ \fi
+ \ifsi@old@noweightabbr\else
+ \newunit{\fg}{\femto\gram}
+ \fi
+ \ifsi@old@novolumeabbr\else
+ \newunit{\fl}{\femto\liter}
+ \newunit{\pl}{\pico\liter}
+ \newunit{\nl}{\nano\liter}
+ \newunit{\micl}{\micro\liter}
+ \newunit{\ml}{\milli\liter}
+ \newunit{\cl}{\centi\liter}
+ \newunit{\dl}{\deci\liter}
+ \newunit{\hl}{\hecto\liter}
+ \fi
+\fi
+\newunit{\calory}{cal}
+\newunit{\kilocalory}{\kilo\calory}
+\newunit{\uBar}{ba}
+\catcode`\-=11\relax
+\ifsi@old@redef-gensymb
+ \expandafter\si@gensymbtrue
+\fi
+\catcode`\-=12\relax
+\ifsi@gensymb
+ \RequirePackage{gensymb}
+ \AtBeginDocument{
+ \let\gensymbohm\ohm
+ \let\gensymbcelsius\celsius
+ \let\gensymbmicro\micro
+ \let\gensymbdegree\degree
+ \let\ohm\@undefined
+ \let\celsius\@undefined
+ \let\micro\@undefined
+ \let\degree\@undefined
+ \ifsi@old@OHM\else
+ \newunit{\ohm}{\si@sym@Omega}
+ \newunit{\celsius}{\si@sym@celsius}
+ \newprefix{\micro}{\si@sym@mu}{-6}
+ \newunit{\degree}{\si@sym@degree}
+ \fi}
+\fi
+\requiresiconfigs{prefix,named,addn,accepted}
+\ifsi@old@noconfig\else
+ \InputIfFileExists{unitsdef.cfg}
+ {\si@log@inf{unitsdef config file loaded}}
+ {\si@log@inf{unitsdef config file not found}}
+\fi
+\endinput
+%%
+%% End of file `si-unitsdef.cfg'.
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
new file mode 100644
index 00000000000..a51067b4669
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
@@ -0,0 +1,3509 @@
+%%
+%% This is file `siunitx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% siunitx.dtx (with options: `package')
+%% ----------------------------------------------------------------
+%% The siunitx package --- A comprehensive (SI) units package
+%% Maintained by Joseph Wright
+%% E-mail: joseph.wright@morningstar2.co.uk
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\NeedsTeXFormat{LaTeX2e}
+\newcommand*{\si@svn@ver}{v1.0}
+\def\si@svn@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${%
+ \newcommand*{\si@svn@version}{%
+ #5/#6/#7\space\si@svn@ver\space}}
+\si@svn@id $Id: siunitx.dtx 76 2008-06-15 08:10:34Z joseph $
+\ProvidesPackage{siunitx}
+ [\si@svn@version A comprehensive (SI) units package]
+\begingroup
+ \@ifundefined{eTeXversion}
+ {\PackageError{siunitx}
+ {Not running under e-TeX}
+ {This package requires e-TeX. Try compiling the document
+ with\MessageBreak `elatex' instead of `latex'. When
+ using pdfTeX, try `pdfelatex'\MessageBreak instead of
+ `pdflatex'}%
+ \endgroup\endinput}
+ {\endgroup}
+\edef\si@catcodes{%
+ \catcode\string`\string ` \the\catcode\string`\`\relax
+ \catcode\string`\string = \the\catcode\string`\=\relax
+ \catcode\string`\string ^ \the\catcode\string`\^\relax
+ \catcode\string`\string ~ \the\catcode\string`\~\relax
+ \catcode\string`\string : \the\catcode\string`\:\relax
+ \catcode\string`\string - \the\catcode\string`\-\relax
+ \catcode\string`\string + \the\catcode\string`\+\relax
+ \catcode\string`\string ; \the\catcode\string`\;\relax
+ \catcode\string`\string , \the\catcode\string`\,\relax
+ \catcode\string`\string . \the\catcode\string`\.\relax}
+\catcode\string`\` 12\relax
+\catcode`\= 12\relax
+\catcode`\^ 7\relax
+\catcode`\~ \active\relax
+\@makeother{\:}
+\@makeother{\-}
+\@makeother{\+}
+\@makeother{\;}
+\@makeother{\,}
+\@makeother{\.}
+\RequirePackage{xkeyval}[2005/05/07]
+\RequirePackage{amstext,array,xspace}
+\newcommand*{\si@tempa}{}
+\newcommand*{\si@tempb}{}
+\newcommand*{\si@tempc}{}
+\newif\ifsi@switch
+\newbox\si@tempboxa
+\newbox\si@tempboxb
+\newbox\si@tempboxc
+\newbox\si@tempboxd
+\newcommand*{\si@blockpkgs}{SIunits,sistyle,siunits,SIstyle,%
+ unitsdef,fancyunits}
+\newcommand*{\si@checkpkgs}{units,hepunits,fancynum}
+\newcommand*{\si@packagecheck}{%
+ \begingroup
+ \@for\si@tempa:=\si@blockpkgs\do{
+ \@ifpackageloaded{\si@tempa}
+ {\PackageError{siunitx}
+ {Package `\si@tempa' incompatible}
+ {The \si@tempa\space package and siunitx are
+ incompatible.\MessageBreak Use the
+ `emulate=\si@tempa' package option when loading
+ siunitx}}
+ {}}
+ \@for\si@tempa:=\si@checkpkgs\do{%
+ \@ifpackageloaded{\si@tempa}
+ {\PackageWarning{siunitx}
+ {Consider loading the siunitx package
+ with\MessageBreak option `emulate=\si@tempa', rather
+ than\MessageBreak loading both \si@tempa\space and
+ siunitx}}
+ {}}
+ \endgroup}
+\si@packagecheck
+\AtBeginDocument{\si@packagecheck}
+\newcommand*{\si@ifdefinable}[1]{%
+ \expandafter\expandafter\expandafter\@ifundefined%
+ \expandafter\expandafter\expandafter%
+ {\expandafter\@gobble\string#1}}
+\newcommand*{\si@addtolist}[2]{%
+ \ifx\@empty#1\@empty
+ \edef#1{#2}%
+ \else
+ \edef#1{#1,#2}%
+ \fi}
+\newtoks{\si@temptoks}
+\newcommand*{\si@addtocsname}[2]{%
+ \@ifundefined{#1}
+ {\expandafter\gdef\csname #1\endcsname{#2}}
+ {\si@temptoks\expandafter\expandafter\expandafter{%
+ \csname #1\endcsname#2}%
+ \expandafter\xdef\csname #1\endcsname{\the\si@temptoks}}}
+\begingroup
+ \catcode`\Q=3
+ \long\gdef\si@ifmtarg#1{%
+ \si@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}
+ \long\gdef\si@xifmtarg#1#2Q#3#4#5\@nil{#4}
+ \long\gdef\si@ifnotmtarg#1{%
+ \si@xifmtarg#1QQ\@firstofone\@gobble\@nil}
+\endgroup
+\@ifpackageloaded{etoolbox}
+ {\let\si@newrobustcmd\newrobustcmd}
+ {\protected\def\si@newrobustcmd{%
+ \@ifstar
+ {\let\l@ngrel@x\protected\si@newcommand}
+ {\def\l@ngrel@x{\protected\long}\si@newcommand}}
+ \newcommand*{\si@newcommand}[1]{\@testopt{\si@newcmd#1}0}
+ \def\si@newcmd#1[#2]{%
+ \@ifnextchar[%]
+ {\si@xargdef#1[#2]}
+ {\@argdef#1[#2]}}
+ \long\def\si@xargdef#1[#2][#3]#4{%
+ \@ifdefinable#1{%
+ \expandafter\protected
+ \expandafter\def
+ \expandafter#1%
+ \expandafter{%
+ \expandafter\@testopt
+ \csname\string#1\endcsname{#3}}%
+ \expandafter\@yargdef
+ \csname\string#1\endcsname\tw@{#2}{#4}}}}
+\newif\ifsi@debug
+\newif\ifsi@logmin
+\newif\ifsi@lognone
+\newcommand*{\si@log@err}[2]{%
+ \ifsi@lognone\else
+ \ifsi@logmin
+ \PackageWarning{siunitx}{#1}%
+ \else
+ \PackageError{siunitx}{#1}{#2}%
+ \fi
+ \fi}
+\newcommand*{\si@log@warn}[1]{%
+ \ifsi@lognone\else
+ \ifsi@logmin\else
+ \PackageWarning{siunitx}{#1}%
+ \fi
+ \fi}
+\newcommand*{\si@log@inf}[1]{%
+ \ifsi@lognone\else
+ \ifsi@logmin\else
+ \PackageInfo{siunitx}{#1}%
+ \fi
+ \fi}
+\newcommand*{\si@log@debug}[1]{%
+ \ifsi@lognone\else
+ \ifsi@debug
+ \PackageInfo{siunitx}{#1}%
+ \fi
+ \fi}
+\newcommand*{\si@str@ifchrstr}[2]{%
+ \begingroup
+ \si@switchfalse
+ \renewcommand*{\si@tempa}{#1}%
+ \protected@edef\si@tempb{#2}%
+ \expandafter\si@str@chrstr\si@tempb\@empty\@empty\@empty
+ \ifsi@switch
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@str@chrstr#1#2\@empty{%
+ \renewcommand*{\si@tempc}{#1}%
+ \ifx\si@tempa\si@tempc
+ \expandafter\si@switchtrue
+ \else
+ \ifx\@empty#2\@empty\else
+ \si@str@chrstr#2\@empty\@empty
+ \fi
+ \fi}
+\newcommand*{\si@str@ifonlychrs}[2]{%
+ \begingroup
+ \si@switchtrue
+ \protected@edef\si@tempa{#1}%
+ \renewcommand*{\si@tempb}{#2}%
+ \expandafter\si@str@onlychrs\si@tempa\@empty\@empty\@empty
+ \ifsi@switch
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@str@onlychrs#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@tempb}
+ {}{\si@switchfalse}%
+ \ifx\@empty#2\@empty\else
+ \si@str@onlychrs#2\@empty\@empty
+ \fi}
+\newcommand*{\sisetup}{\setkeys[si]{key}}
+\newcommand*{\si@opt@key}[2]{%
+ \define@key[si]{key}{#1}
+ {#2\si@log@debug{Option #1 set to ##1}}}
+\newcommand*{\si@opt@cmdkey}[3][]{%
+ \define@cmdkey[si]{key}[si@]{#2}[#1]{#3}}
+\newcommand*{\si@opt@cmdkeys}[2][]{%
+ \define@cmdkeys[si]{key}[si@]{#2}[#1]}
+\newcommand*{\si@opt@boolkey}[2][]{%
+ \define@boolkey[si]{key}[si@]{#2}[true]
+ {#1\si@log@debug{Option #2 set to ##1}}}
+\newcommand*{\si@opt@choicekey}[4][]{%
+ \define@choicekey*+[si]{key}{#2}[\si@tempa]{#3}[#1]
+ {#4\si@log@debug{Option #2 set to ##1}}
+ {\si@log@warn{Unknown value `##1' for option #2}}}
+\newcommand*{\si@opt@xchoicekey}[3]{%
+ \define@choicekey*+[si]{key}{#1}[\si@tempa]{#2}[#1]
+ {\si@log@debug{Option #1 set to ##1}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@#1\endcsname}{\@nameuse{si@fix@##1}}}
+ {\si@log@debug{Option #1 set to ##1}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@#1\endcsname}{##1}}
+ \expandafter\newcommand\expandafter*\expandafter{%
+ \csname si@#1\endcsname}%
+ {\@nameuse{si@fix@#3}}}
+\newcommand*{\si@opt@compatkey}[2]{%
+ \define@boolkey[si]{key}[si@old@]{#2}[true]
+ {\si@log@debug{Emulating #1 package option\MessageBreak #2}%
+ \sisetup{emulate=#1}%
+ \si@log@debug{Option #2 set to ##1}}
+ \AtEndOfPackage{\si@opt@disablekey{#2}
+ {Compatibility option #2 only\MessageBreak
+ available when loading siunitx package}}}
+\newcommand*{\si@opt@disablekey}[2]{%
+ \key@ifundefined[si]{key}{#1}
+ {}
+ {\si@log@debug{Disabling key #1}%
+ \si@opt@key{#1}{\si@log@warn{#2}}}}
+\si@opt@choicekey[normal]{log}{debug,verbose,normal,errors,none}
+ {\si@debugfalse
+ \si@logminfalse
+ \si@lognonefalse
+ \renewcommand*{\si@tempb}{none}%
+ \ifx\si@tempa\si@tempb
+ \si@lognonetrue
+ \fi
+ \renewcommand*{\si@tempb}{minimal}%
+ \ifx\si@tempa\si@tempb
+ \si@logmintrue
+ \fi
+ \renewcommand*{\si@tempb}{debug}%
+ \ifx\si@tempa\si@tempb
+ \si@debugtrue
+ \fi
+ \renewcommand*{\si@tempb}{verbose}%
+ \ifx\si@tempa\si@tempb
+ \si@debugtrue
+ \fi}
+\si@opt@boolkey{debug}
+\si@opt@boolkey[%
+ \ifsi@strict
+ \sisetup{
+ obeymode=false,
+ obeybold=false,
+ obeyitalic=false,
+ mode=maths,
+ repeatunits=true,
+ trapambigerr=true,
+ trapambigfrac=true}
+ \@for\si@tempa:=obeyall,obeymode,obeyitalic,mode,unitmode,%
+ valuemode,textmode,obeybold,repeatunits,trapambigerr,%
+ trapambigfrac\do{%
+ \begingroup
+ \edef\si@tempb{\endgroup
+ \noexpand\si@opt@disablekey{\si@tempa}
+ {Option `\si@tempa' forbidden in strict mode}}%
+ \si@tempb}
+ \fi]{strict}
+\AtEndOfPackage{
+ \si@opt@disablekey{strict}
+ {Option `strict' only available when\MessageBreak
+ loading package}}
+\newcommand*{\si@emulate}{}
+\si@opt@key{emulate}{\si@addtolist{\si@emulate}{#1}}
+\AtEndOfPackage{
+ \si@opt@disablekey{emulate}
+ {Option `emulate' only available when\MessageBreak
+ loading package}}
+\si@opt@xchoicekey{unitsep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{thin}
+\si@opt@xchoicekey{unitspace}{space,thin,med,medium,thick,
+ none}{thin}
+\si@opt@xchoicekey{errspace}{space,thin,med,medium,thick,
+ none}{none}
+\si@opt@xchoicekey{valuesep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{thin}
+\si@opt@xchoicekey{digitsep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{thin}
+\si@opt@xchoicekey{decimalsymbol}{comma,stop,fullstop,period,
+ cdot,tightcdot}{fullstop}
+\si@opt@xchoicekey{anglesep}
+ {thin,med,medium,thick,none,comma,stop,fullstop,period,
+ times,tighttimes,cdot,tightcdot}{none}
+\si@opt@boolkey{obeymode}
+\newif\ifsi@numtextmode
+\newif\ifsi@unittextmode
+\si@opt@choicekey[true]{textmode}{true,false}
+ {\si@numtextmodefalse
+ \si@unittextmodefalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@numtextmodetrue
+ \si@unittextmodetrue
+ \fi}
+\si@opt@choicekey{mode}{math,maths,text}
+ {\si@numtextmodefalse
+ \si@unittextmodefalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@numtextmodetrue
+ \si@unittextmodetrue
+ \fi}
+\si@opt@choicekey{valuemode}{math,maths,text}
+ {\si@numtextmodefalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@numtextmodetrue
+ \fi}
+\si@opt@choicekey{unitmode}{math,maths,text}
+ {\si@unittextmodefalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@unittextmodetrue
+ \fi}
+\si@opt@boolkey{obeyfamily}
+\si@opt@boolkey{obeybold}
+\newif\ifsi@inlinebtext
+\si@opt@choicekey{inlinebold}{text,maths,math}
+ {\si@inlinebtextfalse
+ \renewcommand*{\si@tempb}{text}%
+ \ifx\si@tempa\si@tempb
+ \si@inlinebtexttrue
+ \fi}
+\si@opt@boolkey{obeyitalic}
+\si@opt@boolkey{detectdisplay}
+\si@opt@choicekey[true]{obeyall}{true,false}
+ {\si@obeyboldfalse
+ \si@obeyitalicfalse
+ \si@obeymodefalse
+ \si@obeyfamilyfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@obeyboldtrue
+ \si@obeyitalictrue
+ \si@obeymodetrue
+ \si@obeyfamilytrue
+ \fi}
+\si@opt@cmdkeys{valuemathsrm,valuemathssf,valuemathstt}
+\si@opt@cmdkeys{unitmathsrm,unitmathssf,unitmathstt}
+\si@opt@key{valuemathrm}{\sisetup{valuemathsrm=#1}}
+\si@opt@key{valuemathsf}{\sisetup{valuemathssf=#1}}
+\si@opt@key{valuemathtt}{\sisetup{valuemathstt=#1}}
+\si@opt@key{unitmathrm}{\sisetup{unitmathsrm=#1}}
+\si@opt@key{unitmathsf}{\sisetup{unitmathssf=#1}}
+\si@opt@key{unitmathtt}{\sisetup{unitmathstt=#1}}
+\si@opt@key{mathsrm}{\sisetup{valuemathsrm=#1,unitmathsrm=#1}}
+\si@opt@key{mathssf}{\sisetup{valuemathssf=#1,unitmathssf=#1}}
+\si@opt@key{mathstt}{\sisetup{valuemathstt=#1,unitmathstt=#1}}
+\si@opt@key{mathrm}{\sisetup{valuemathsrm=#1,unitmathsrm=#1}}
+\si@opt@key{mathsf}{\sisetup{valuemathssf=#1,unitmathssf=#1}}
+\si@opt@key{mathtt}{\sisetup{valuemathstt=#1,unitmathstt=#1}}
+\si@opt@cmdkeys{valuetextrm,valuetextsf,valuetexttt}
+\si@opt@cmdkeys{unittextrm,unittextsf,unittexttt}
+\si@opt@key{textrm}{\sisetup{unittextrm=#1,valuetextrm=#1}}
+\si@opt@key{textsf}{\sisetup{unittextsf=#1,valuetextsf=#1}}
+\si@opt@key{texttt}{\sisetup{unittexttt=#1,valuetexttt=#1}}
+\si@opt@cmdkeys{numdigits,numdecimal,numexp,numgobble,numsign,%
+ numcloseerr,numopenerr,numaddn,numprod}
+\newcommand*{\si@numextra}{%
+ \si@numopenerr\si@numcloseerr\si@numaddn}
+\newcommand*{\si@numvalid}{\si@numgobble\si@numexp\si@numsign
+ \si@numdecimal\si@numdigits\si@numextra\si@numprod}
+\si@opt@boolkey{seperr}
+\si@opt@boolkey{trapambigerr}
+\si@opt@cmdkeys{openerr,closeerr}
+\si@opt@boolkey{sepfour}
+\si@opt@boolkey{retainplus}
+\si@opt@xchoicekey{expproduct}{times,tighttimes,
+ cdot,tightcdot}{times}
+\si@opt@xchoicekey{expbase}{ten}{ten}
+\si@opt@boolkey{allowzeroexp}
+\si@opt@xchoicekey{prefixproduct}{times,tighttimes,cdot,
+ tightcdot,none}{times}
+\si@opt@xchoicekey{prefixbase}{ten,two}{ten}
+\si@opt@boolkey{prefixsymbolic}
+\newif\ifsi@num@padlead
+\newif\ifsi@num@padtrail
+\si@opt@choicekey[all]{padnumber}
+ {leading,lead,trailing,trail,all,both,true,none,false}
+ {\si@num@padleadfalse
+ \si@num@padtrailfalse
+ \renewcommand*{\si@tempb}{leading}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \fi
+ \renewcommand*{\si@tempb}{lead}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \fi
+ \renewcommand*{\si@tempb}{trailing}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{trail}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{all}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \si@num@padtrailtrue
+ \fi
+ \renewcommand*{\si@tempb}{both}%
+ \ifx\si@tempa\si@tempb
+ \si@num@padleadtrue
+ \si@num@padtrailtrue
+ \fi}
+\newif\ifsi@num@signmant
+\newif\ifsi@num@signexp
+\si@opt@xchoicekey{sign}{plus,minus,pm,mp}{plus}
+\si@opt@choicekey[all]{addsign}
+ {mantissa,exponent,mant,exp,all,both,true,none,false}
+ {\si@num@signmantfalse
+ \si@num@signexpfalse
+ \renewcommand*{\si@tempb}{mantissa}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \fi
+ \renewcommand*{\si@tempb}{mant}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \fi
+ \renewcommand*{\si@tempb}{exponent}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{exp}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{all}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \si@num@signexptrue
+ \fi
+ \renewcommand*{\si@tempb}{both}%
+ \ifx\si@tempa\si@tempb
+ \si@num@signmanttrue
+ \si@num@signexptrue
+ \fi}
+\si@opt@boolkey{tightpm}
+\newcommand*{\si@pm}{%
+ \ifsi@tightpm
+ \si@fix@tightpm
+ \else
+ \si@fix@pm
+ \fi}
+\newif\ifsi@ang@padsmall
+\newif\ifsi@ang@padlarge
+\si@opt@choicekey[all]{padangle}
+ {small,large,all,both,true,none,false}
+ {\si@ang@padsmallfalse
+ \si@ang@padlargefalse
+ \renewcommand*{\si@tempb}{small}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \fi
+ \renewcommand*{\si@tempb}{large}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padlargetrue
+ \fi
+ \renewcommand*{\si@tempb}{all}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \si@ang@padlargetrue
+ \fi
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \si@ang@padlargetrue
+ \fi
+ \renewcommand*{\si@tempb}{both}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@padsmalltrue
+ \si@ang@padlargetrue
+ \fi}
+\newif\ifsi@ang@toarc
+\newif\ifsi@ang@todec
+\si@opt@choicekey[all]{angformat}
+ {dec,decimal,arc,dms,unchanged,none}
+ {\si@ang@toarcfalse
+ \si@ang@todecfalse
+ \renewcommand*{\si@tempb}{dec}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@todectrue
+ \fi
+ \renewcommand*{\si@tempb}{decimal}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@todectrue
+ \fi
+ \renewcommand*{\si@tempb}{arc}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@toarctrue
+ \fi
+ \renewcommand*{\si@tempb}{dms}%
+ \ifx\si@tempa\si@tempb
+ \si@ang@toarctrue
+ \fi}
+\si@opt@boolkey{astroang}
+\si@opt@boolkey{strictarc}
+\newif\ifsi@tab@fixed
+\si@opt@choicekey{tabnumalign}
+ {centredecimal,centerdecimal,right,left,centre,center}
+ {\si@tab@fixedtrue
+ \let\si@tab@rfill@S\hfil
+ \let\si@tab@lfill@S\hfil
+ \renewcommand*{\si@tempb}{right}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@lfill@S\hfill
+ \fi
+ \renewcommand*{\si@tempb}{left}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@rfill@S\hfill
+ \fi
+ \renewcommand*{\si@tempb}{centredecimal}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@tab@fixedfalse
+ \fi
+ \renewcommand*{\si@tempb}{centerdecimal}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@tab@fixedfalse
+ \fi}
+\si@opt@key{tabalign}{\sisetup{tabnumalign=#1,tabtextalign=#1,
+ tabunitalign=#1}}
+\si@opt@boolkey{tabalignexp}
+\newcount\si@tab@mantprecnt
+\newcount\si@tab@mantpostcnt
+\newcount\si@tab@expprecnt
+\newcount\si@tab@exppostcnt
+\newif\ifsi@tab@mantsign
+\newif\ifsi@tab@expsign
+\si@opt@cmdkey{tabformat}
+ {\si@num@fixpm
+ \renewcommand*{\si@num@arg}{tabformat data}%
+ \renewcommand*{\si@num@exp}{}%
+ \renewcommand*{\si@num@mant}{}%
+ \si@tab@mantsignfalse
+ \si@tab@expsignfalse
+ \si@switchfalse
+ \si@num@sepmantexp{#1}%
+ \si@num@sepsign{mant}%
+ \ifx\@empty\si@num@mantsign\@empty
+ \ifsi@num@delplus
+ \expandafter\expandafter\expandafter\si@tab@mantsigntrue
+ \fi
+ \else
+ \expandafter\si@tab@mantsigntrue
+ \fi
+ \si@num@sepsign{exp}%
+ \ifx\@empty\si@num@expsign\@empty
+ \ifsi@num@delplus
+ \expandafter\expandafter\expandafter\si@tab@expsigntrue
+ \fi
+ \else
+ \expandafter\si@tab@expsigntrue
+ \fi
+ \si@opt@proctform{mant}%
+ \si@opt@proctform{exp}%
+ \ifnum\si@tab@mantpostcnt=\z@\relax
+ \ifnum\si@tab@mantprecnt=\z@\relax
+ \si@log@err{Empty mantissa argument for tabformat}
+ {The argument `#1' contains no valid entry for
+ a mantissa\MessageBreak It should be of the
+ form `m.n', where m and n are integers}%
+ \else
+ \si@log@warn{Argument of tabformat contains\MessageBreak
+ no decimal part}%
+ \fi
+ \else
+ \ifnum\si@tab@mantprecnt=\z@\relax
+ \si@log@warn{Argument of tabformat contains\MessageBreak
+ no integer part}%
+ \fi
+ \fi
+ \ifsi@tab@fixed\else
+ \sisetup{tabnumalign=centre}%
+ \fi
+ \let\pm\si@num@pm
+ \let\mp\si@num@mp}
+\newcommand*{\si@opt@proctform}[1]{%
+ \renewcommand*{\si@num@predec}{}%
+ \renewcommand*{\si@num@postdec}{}%
+ \si@switchfalse
+ \expandafter\si@ifnotmtarg\expandafter{%
+ \csname si@num@#1\endcsname}
+ {\expandafter\expandafter\expandafter\si@num@digits
+ \csname si@num@#1\endcsname\@empty\@empty}%
+ \csname si@tab@#1precnt\endcsname\z@\relax
+ \csname si@tab@#1postcnt\endcsname\z@\relax
+ \ifx\@empty\si@num@predec\@empty\else
+ \csname si@tab@#1precnt\endcsname\si@num@predec\relax
+ \fi
+ \ifx\@empty\si@num@postdec\@empty\else
+ \csname si@tab@#1postcnt\endcsname\si@num@postdec\relax
+ \fi}
+\si@opt@choicekey{tabtextalign}{left,right,centre,center}
+ {\let\si@tab@rfill@t\hfill
+ \let\si@tab@lfill@t\hfill
+ \renewcommand*{\si@tempb}{right}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@rfill@t\relax
+ \fi
+ \renewcommand*{\si@tempb}{left}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@lfill@t\relax
+ \fi}
+\si@opt@choicekey{tabunitalign}{left,right,centre,center}
+ {\let\si@tab@rfill@s\hfill
+ \let\si@tab@lfill@s\hfill
+ \renewcommand*{\si@tempb}{right}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@rfill@s\relax
+ \fi
+ \renewcommand*{\si@tempb}{left}%
+ \ifx\si@tempa\si@tempb
+ \let\si@tab@lfill@s\relax
+ \fi}
+\si@opt@boolkey{fixdp}
+\newcount\si@num@dp
+\si@opt@key{dp}{%
+ \si@str@ifonlychrs{#1}{0123456789}
+ {}
+ {\si@log@err{Invalid input for dp option}
+ {The dp option must be given a positive integer}}%
+ \si@num@dp#1\relax
+ \si@fixdptrue}
+\si@opt@boolkey{tabautofit}
+\si@opt@boolkey{xspace}
+\si@opt@boolkey
+ [\si@unt@numfalse
+ \ifsi@prespace
+ \si@unt@numtrue
+ \fi]
+ {prespace}
+\si@opt@boolkey{allowoptarg}
+\newif\ifsi@slash
+\newif\ifsi@frac
+\si@opt@boolkey{stickyper}
+\si@opt@choicekey[reciprocal]{per}
+ {reciprocal,rp,power,slash,frac,fraction}
+ {\si@slashfalse
+ \si@fracfalse
+ \renewcommand*{\si@tempb}{slash}%
+ \ifx\si@tempa\si@tempb
+ \si@fractrue
+ \si@slashtrue
+ \let\si@frac\si@frc@slash
+ \fi
+ \renewcommand*{\si@tempb}{frac}%
+ \ifx\si@tempa\si@tempb
+ \si@fractrue
+ \fi
+ \renewcommand*{\si@tempb}{fraction}%
+ \ifx\si@tempa\si@tempb
+ \si@fractrue
+ \fi}
+\si@opt@xchoicekey{slash}{slash}{slash}
+\newif\ifsi@repeatunits
+\newif\ifsi@addunitpower
+\si@opt@choicekey[true]{repeatunits}{true,false,power}
+ {\si@repeatunitsfalse
+ \si@addunitpowerfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@repeatunitstrue
+ \fi
+ \renewcommand*{\si@tempb}{power}%
+ \ifx\si@tempa\si@tempb
+ \si@addunitpowertrue
+ \fi}
+\si@opt@boolkey{trapambigfrac}
+\si@opt@cmdkeys{closefrac,openfrac}
+\si@opt@choicekey[frac]{fraction}
+ {frac,nicefrac,nice,sfrac,xfrac,uglyfrac,ugly}
+ {\let\si@frac\si@frc@frac
+ \renewcommand*{\si@tempb}{nicefrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@nice
+ \fi
+ \renewcommand*{\si@tempb}{uglyfrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@ugly
+ \fi
+ \renewcommand*{\si@tempb}{nice}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@nice
+ \fi
+ \renewcommand*{\si@tempb}{sfrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@sfrac
+ \fi
+ \renewcommand*{\si@tempb}{xfrac}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@sfrac
+ \fi
+ \renewcommand*{\si@tempb}{ugly}%
+ \ifx\si@tempa\si@tempb
+ \let\si@frac\si@frc@ugly
+ \fi}
+\si@opt@cmdkeys{load,noload}
+\si@opt@key{alsoload}{\si@addtolist{\si@load}{#1}}
+\AtEndOfPackage{
+ \si@opt@disablekey{load}
+ {Configuration files can only be used\MessageBreak
+ when loading package}
+ \si@opt@disablekey{noload}
+ {Configuration files can only be used\MessageBreak
+ when loading package}}
+\AtEndOfPackage{
+ \si@opt@key{alsoload}{%
+ \@for\si@tempa:=#1\do{\si@loadfile{\si@tempa}}}}
+\si@opt@boolkey{colourunits}
+\si@opt@boolkey{colourvalues}
+\si@opt@choicekey[true]{colorunits}
+ {true,false}
+ {\si@colourunitsfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourunitstrue
+ \fi}
+\si@opt@choicekey[true]{colorvalues}
+ {true,false}
+ {\si@colourvaluesfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourvaluestrue
+ \fi}
+\si@opt@choicekey[true]{colorall}
+ {true,false}
+ {\si@colourvaluesfalse
+ \si@colourunitsfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourunitstrue
+ \si@colourvaluestrue
+ \fi}
+\si@opt@choicekey[true]{colourall}
+ {true,false}
+ {\si@colourvaluesfalse
+ \si@colourunitsfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colourunitstrue
+ \si@colourvaluestrue
+ \fi}
+\si@opt@cmdkeys{unitcolour,valuecolour}
+\si@opt@key{unitcolor}{\sisetup{unitcolour=#1}}
+\si@opt@key{valuecolor}{\sisetup{valuecolour=#1}}
+\si@opt@key{colour}{\sisetup{unitcolour=#1,valuecolour=#1}}
+\si@opt@key{color}{\sisetup{unitcolour=#1,valuecolour=#1}}
+\si@opt@boolkey{colourneg}
+\si@opt@choicekey[true]{colorneg}
+ {true,false}
+ {\si@colournegfalse
+ \renewcommand*{\si@tempb}{true}%
+ \ifx\si@tempa\si@tempb
+ \si@colournegtrue
+ \fi}
+\si@opt@cmdkeys{negcolour}
+\si@opt@key{negcolor}{\sisetup{negcolour=#1}}
+\si@opt@cmdkeys{textOmega,mathsOmega}
+\si@opt@key{mathOmega}{\sisetup{mathsOmega=#1}}
+\newcommand*{\si@mathsOmega}{\text{\ensuremath{\Omega}}}
+\newcommand*{\si@textOmega}{\ensuremath{\Omega}}
+\si@opt@cmdkeys{textmu,mathsmu}
+\si@opt@key{mathmu}{\sisetup{mathsmu=#1}}
+\DeclareFontEncoding{TS1}{}{}
+\DeclareFontSubstitution{TS1}{cmr}{m}{n}
+\DeclareTextSymbol{\si@textmu}{TS1}{181}
+\DeclareTextSymbolDefault{\si@textmu}{TS1}
+\DeclareFontFamily{OML}{eur}{\skewchar\font127}
+\DeclareFontShape{OML}{eur}{m}{n}%
+ {<5> <6> <7> <8> <9> gen * eurm %
+ <10><10.95><12><14.4><17.28><20.74><24.88>eurm10}{}
+\DeclareSymbolFont{greek}{OML}{eur}{m}{n}
+\DeclareMathSymbol{\si@mathsmu}{\mathord}{greek}{"16}
+\si@opt@cmdkeys{textdegree,mathsdegree,textminute,mathsminute,
+ textsecond,mathssecond}
+\si@opt@key{mathdegree}{\sisetup{mathsdegree=#1}}
+\si@opt@key{mathminute}{\sisetup{mathsminute=#1}}
+\si@opt@key{mathsecond}{\sisetup{mathssecond=#1}}
+\newcommand*{\si@textdegree}{\ensuremath{{}^{\circ}}}
+\newcommand*{\si@mathsdegree}{{}^{\circ}}
+\newcommand*{\si@textminute}{\ensuremath{{}^{\prime}}}
+\newcommand*{\si@mathsminute}{{}^{\prime}}
+\newcommand*{\si@textsecond}{\ensuremath{{}^{\prime\prime}}}
+\newcommand*{\si@mathssecond}{{}^{\prime\prime}}
+\si@opt@cmdkeys{textcelsius,mathscelsius}
+\si@opt@key{mathcelsius}{\sisetup{mathscelsius=#1}}
+\newcommand*{\si@textcelsius}{%
+ \si@textdegree\kern-\scriptspace C}
+\newcommand*{\si@mathscelsius}{%
+ \si@mathsdegree\kern-\scriptspace\mathrm{C}}
+\si@opt@cmdkeys{textringA,mathsringA}
+\si@opt@key{mathringA}{\sisetup{mathsringA=#1}}
+\newcommand*{\si@textringA}{\AA}
+\newcommand*{\si@mathsringA}{\text{\AA}}
+\si@opt@boolkey{redefsymbols}
+\AtBeginDocument{
+ \si@opt@disablekey{redefsymbols}
+ {Symbols can only be redefined\MessageBreak
+ when loading siunitx}}
+\newlength\si@eVcorra
+\newlength\si@eVcorrb
+\si@opt@key{eVcorra}{\setlength\si@eVcorra{#1}}
+\si@opt@key{eVcorrb}{\setlength\si@eVcorrb{#1}}
+\si@opt@key{locale}{%
+ \si@loc@load{#1}%
+ \si@loc@set{#1}}%
+\si@opt@key{loctolang}{\si@loc@ltol{#1}}
+\si@opt@compatkey{units}{ugly}
+\si@opt@compatkey{units}{nice}
+\si@opt@compatkey{units}{loose}
+\si@opt@compatkey{units}{tight}
+\si@opt@compatkey{unitsdef}{OHM}
+\si@opt@compatkey{unitsdef}{ohm}
+\si@opt@compatkey{unitsdef}{redef-gensymb}
+\newif\ifsi@gensymb
+\si@opt@compatkey{unitsdef}{LITER}
+\si@opt@compatkey{unitsdef}{liter}
+\si@opt@compatkey{unitsdef}{noxspace}
+\si@opt@compatkey{unitsdef}{noconfig}
+\si@opt@compatkey{unitsdef}{noabbr}
+\si@opt@compatkey{unitsdef}{noampereageabbr}
+\si@opt@compatkey{unitsdef}{nofrequncyabbr}
+\si@opt@compatkey{unitsdef}{nomolabbr}
+\si@opt@compatkey{unitsdef}{novoltageabbr}
+\si@opt@compatkey{unitsdef}{novolumeabbr}
+\si@opt@compatkey{unitsdef}{noweightabbr}
+\si@opt@compatkey{unitsdef}{noenergyabbr}
+\si@opt@compatkey{unitsdef}{nolengthabbr}
+\si@opt@compatkey{unitsdef}{notimeabbr}
+\si@opt@compatkey{SIunits}{cdot}
+\si@opt@compatkey{SIunits}{thickspace}
+\si@opt@compatkey{SIunits}{mediumspace}
+\si@opt@compatkey{SIunits}{thinspace}
+\si@opt@compatkey{SIunits}{thickqspace}
+\si@opt@compatkey{SIunits}{mediumqspace}
+\si@opt@compatkey{SIunits}{thinqspace}
+\si@opt@compatkey{SIunits}{amssymb}
+\si@opt@compatkey{SIunits}{squaren}
+\si@opt@compatkey{SIunits}{pstricks}
+\si@opt@compatkey{SIunits}{Gray}
+\si@opt@compatkey{SIunits}{italian}
+\si@opt@compatkey{SIunits}{textstyle}
+\si@opt@compatkey{SIunits}{binary}
+\si@opt@compatkey{SIunits}{noams}
+\si@opt@compatkey{SIunits}{derivedinbase}
+\si@opt@compatkey{SIunits}{derived}
+\si@opt@compatkey{hepunits}{noprefixcmds}
+\si@opt@compatkey{fancynum}{english}
+\si@opt@compatkey{fancynum}{french}
+\si@opt@compatkey{fancynum}{tight}
+\si@opt@compatkey{fancynum}{loose}
+\si@opt@compatkey{fancynum}{thinspaces}
+\si@opt@compatkey{fancynum}{commas}
+\si@opt@compatkey{fancynum}{plain}
+\si@opt@compatkey{fancyunits}{spaceqspace}
+\newcommand*{\si@fix@thin}{\,}
+\newcommand*{\si@fix@med}{\:}
+\newcommand*{\si@fix@medium}{\:}
+\newcommand*{\si@fix@thick}{\;}
+\newcommand*{\si@fix@space}{\text{~}}
+\newcommand*{\si@fix@cdot}{{}\cdot{}}
+\newcommand*{\si@fix@comma}{{,}}
+\newcommand*{\si@fix@stop}{{.}}
+\newcommand*{\si@fix@fullstop}{{.}}
+\newcommand*{\si@fix@period}{{.}}
+\newcommand*{\si@fix@times}{\times}
+\newcommand*{\si@fix@tighttimes}{\bgroup\times\egroup}
+\newcommand*{\si@fix@tightcdot}{\bgroup\cdot\egroup}
+\newcommand*{\si@fix@plus}{+}
+\newcommand*{\si@fix@minus}{-}
+\newcommand*{\si@fix@pm}{\pm}
+\newcommand*{\si@fix@tightpm}{\bgroup\pm\egroup}
+\newcommand*{\si@fix@mp}{\mp}
+\newcommand*{\si@fix@two}{2}
+\newcommand*{\si@fix@ten}{10}
+\newcommand*{\si@fix@slash}{/}
+\newcommand*{\si@fix@none}{}
+\newcommand*{\si@symbol}[1]{%
+ \expandafter\protected\expandafter\def
+ \csname si@sym@#1\endcsname{%
+ \ifmmode
+ \expandafter\csname si@maths#1\expandafter\endcsname
+ \else
+ \expandafter\csname si@text#1\expandafter\endcsname
+ \fi}}
+\si@symbol{Omega}
+\si@symbol{ringA}
+\si@symbol{mu}
+\si@symbol{degree}
+\si@symbol{minute}
+\si@symbol{second}
+\si@symbol{celsius}
+\AtBeginDocument{%
+ \ifsi@redefsymbols
+ \@ifpackageloaded{textcomp}
+ {\si@log@debug{Redefining symbols using textcomp}%
+ \renewcommand*{\si@textdegree}{\textdegree}%
+ \renewcommand*{\si@mathsdegree}{\text{\textdegree}}%
+ \@ifpackageloaded{mathptmx}{}
+ {\renewcommand*{\si@textmu}{\textmu}%
+ \renewcommand*{\si@textOmega}{\textohm}}%
+ \renewcommand*{\si@tempa}{OT1}%
+ \ifx\si@tempa\encodingdefault
+ \renewcommand*{\si@mathsringA}{%
+ \text{\capitalring{A}}}%
+ \renewcommand*{\si@textringA}{\capitalring{A}}
+ \fi}{}
+ \@ifpackageloaded{upgreek}
+ {\si@log@debug{Redefining symbols using upgreek}%
+ \renewcommand*{\si@mathsmu}{\upmu}%
+ \renewcommand*{\si@mathsOmega}{\Upomega}}{}
+ \fi}
+\newcommand*{\si@frc@frac}[2]{%
+ \ensuremath{\si@frc@hook\frac{%
+ \expandafter\si@unt@out\expandafter{#1}}%
+ {\expandafter\si@unt@out\expandafter{#2}}}}
+\let\si@frac\si@frc@frac
+\newcommand*{\si@frc@hook}{}
+\newcommand*{\si@frc@slash}[2]{%
+ \expandafter\si@unt@out\expandafter{#1}%
+ \si@out{\ensuremath{\si@slash}}%
+ \expandafter\si@unt@out\expandafter{#2}}
+\newcommand*{\si@frc@nice}[2]{%
+ \ensuremath{\si@frc@nicefrac{\expandafter\si@unt@out%
+ \expandafter{#1}}{\expandafter\si@unt@out\expandafter
+ {#2}}}}
+\newcommand*{\si@frc@sfrac}[2]{%
+ \sfrac{\expandafter\si@unt@out\expandafter{#1}}%
+ {\expandafter\si@unt@out\expandafter{#2}}}
+\AtBeginDocument{
+ \@ifpackageloaded{xfrac}
+ {}
+ {\si@log@inf{xfrac package unavailable\MessageBreak
+ using `fraction=sfrac' will fall back on\MessageBreak
+ nicefrac-like method}%
+ \renewcommand*{\si@frc@sfrac}[2]{%
+ \si@log@warn{xfrac package unavailable}%
+ \si@frc@nice{#1}{#2}}}}
+\newlength\si@frc@displen
+\newlength\si@frc@textlen
+\newlength\si@frc@suplen
+\newlength\si@frc@ssuplen
+\newcommand*{\si@frc@nicefrac}{%
+ \ifmmode
+ \expandafter\si@frc@mathsnf
+ \else
+ \expandafter\si@frc@textnf
+ \fi}
+\newcommand*{\si@frc@mathsnf}[2]{%
+ \begingroup
+ \settoheight{\si@frc@displen}{\ensuremath{%
+ \displaystyle{M}}}%
+ \settoheight{\si@frc@textlen}{\ensuremath{%
+ \textstyle{M}}}%
+ \settoheight{\si@frc@suplen}{\ensuremath{%
+ \scriptstyle{M}}}%
+ \settoheight{\si@frc@ssuplen}{%
+ \ensuremath{\scriptscriptstyle{M}}}%
+ \addtolength{\si@frc@displen}{-\si@frc@ssuplen}%
+ \addtolength{\si@frc@textlen}{-\si@frc@ssuplen}%
+ \addtolength{\si@frc@suplen}{-\si@frc@ssuplen}%
+ \mathchoice
+ {\raisebox{\si@frc@displen}{\ensuremath{%
+ \scriptstyle{#1}}}}%
+ {\raisebox{\si@frc@textlen}{\ensuremath{%
+ \scriptstyle{#1}}}}%
+ {\raisebox{\si@frc@suplen}%
+ {\ensuremath{\scriptscriptstyle{#1}}}}%
+ {\raisebox{\si@frc@ssuplen}%
+ {\ensuremath{\scriptscriptstyle{#1}}}}%
+ \mkern-2mu\relax/\mkern-1mu\relax
+ \bgroup
+ \mathchoice
+ {\scriptstyle}%
+ {\scriptstyle}%
+ {\scriptscriptstyle}%
+ {\scriptscriptstyle}%
+ {#2}%
+ \egroup
+ \endgroup}
+\newcommand*{\si@frc@textnf}[2]{%
+ \begingroup
+ \settoheight{\si@frc@textlen}{M}%
+ \settoheight{\si@frc@ssuplen}{\fontsize\sf@size\z@\relax
+ \selectfont{M}}%
+ \addtolength{\si@frc@textlen}{-\si@frc@ssuplen}%
+ \raisebox{\si@frc@textlen}{\fontsize\sf@size\z@\relax
+ \selectfont{#1}}%
+ \hspace{-0.25ex}/\hspace{-0.25ex}%
+ \hbox{\fontsize\sf@size\z@\selectfont{#2}}%
+ \endgroup}
+\newcommand*{\si@frc@ugly}[1]{%
+ \renewcommand*{\si@tempa}{#1}%
+ \ifmmode
+ \expandafter\si@frc@frac
+ \else
+ \renewcommand*{\si@tempb}{1}%
+ \ifx\si@tempa\si@tempb
+ \setbox\si@tempboxa=\hbox{\ensuremath{\si@valuesep}}%
+ \hskip-\wd\si@tempboxa\relax
+ \renewcommand*{\si@tempa}{}%
+ \fi
+ \expandafter\si@frc@slash
+ \fi
+ {\si@tempa}}
+\g@addto@macro{\document}{%
+ \ifdefined\mathsf
+ \setbox\si@tempboxa=\hbox{%
+ $\mathsf{\global\chardef\si@fam@sf=\fam}$}%
+ \else
+ \si@log@inf{\string\mathsf not found}%
+ \global\chardef\si@fam@sf=99\relax
+ \fi
+ \ifdefined\mathtt
+ \setbox\si@tempboxa=\hbox{%
+ $\mathtt{\global\chardef\si@fam@tt=\fam}$}%
+ \else
+ \si@log@inf{\string\mathtt not found}%
+ \global\chardef\si@fam@tt=99\relax
+ \fi}
+\newcommand*{\si@fam@ifbtext}[1]{%
+ \if b\expandafter\@car\f@series\@nil
+ #1\fi}
+\newcommand*{\si@fam@ifbmaths}[1]{%
+ \renewcommand*{\si@tempa}{bold}%
+ \ifx\math@version\si@tempa
+ #1\fi}
+\newcommand*{\si@fam@ifbinline}{%
+ \ifsi@inlinebtext
+ \expandafter\si@fam@ifbtext
+ \else
+ \expandafter\si@fam@ifbmaths
+ \fi}
+\newcommand*{\si@fam@ifitext}[1]{%
+ \if n\expandafter\@car\f@series\@nil\else
+ #1\fi}
+\newcommand*{\si@fam@mode}{%
+ \ifsi@obeymode
+ \ifmmode
+ \sisetup{mode=maths}%
+ \else
+ \sisetup{mode=text}%
+ \fi
+ \fi}
+\AtBeginDocument{
+ \@ifpackageloaded{color}
+ {\let\si@fam@colourcmd\color}
+ {\let\si@fam@colourcmd\@gobble}}
+\newif\ifsi@fam@set
+\newif\ifsi@textmode
+\newcommand*{\si@fam@set}{%
+ \ifsi@out@num
+ \ifsi@numtextmode
+ \expandafter\expandafter\expandafter\si@textmodetrue
+ \else
+ \expandafter\expandafter\expandafter\si@textmodefalse
+ \fi
+ \else
+ \ifsi@unittextmode
+ \expandafter\expandafter\expandafter\si@textmodetrue
+ \else
+ \expandafter\expandafter\expandafter\si@textmodefalse
+ \fi
+ \fi
+ \ifsi@fam@set\else
+ \let\si@colourcmd\@gobble
+ \ifsi@out@num
+ \let\si@mathsrm\si@valuemathsrm
+ \let\si@mathssf\si@valuemathssf
+ \let\si@mathstt\si@valuemathstt
+ \let\si@textrm\si@valuetextrm
+ \let\si@textsf\si@valuetextsf
+ \let\si@texttt\si@valuetexttt
+ \ifsi@colourvalues
+ \let\si@colourcmd\si@fam@colourcmd
+ \fi
+ \let\si@colour\si@valuecolour
+ \else
+ \let\si@mathsrm\si@unitmathsrm
+ \let\si@mathssf\si@unitmathssf
+ \let\si@mathstt\si@unitmathstt
+ \let\si@textrm\si@unittextrm
+ \let\si@textsf\si@unittextsf
+ \let\si@texttt\si@unittexttt
+ \ifsi@colourunits
+ \let\si@colourcmd\si@fam@colourcmd
+ \fi
+ \let\si@colour\si@unitcolour
+ \fi
+ \fi
+ \si@fam@settrue
+ \edef\si@tempa{\sfdefault}%
+ \edef\si@tempb{\ttdefault}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathsrm\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textrm\endcsname
+ \ifsi@obeyfamily
+ \si@log@debug{Font detection: checking font}%
+ \ifmmode
+ \ifinner
+ \si@log@debug{Font detection: inline maths}%
+ \si@fam@dettext
+ \else
+ \si@log@debug{Font detection: display maths}%
+ \ifsi@detectdisplay
+ \si@fam@detmaths
+ \else
+ \si@fam@dettext
+ \fi
+ \fi
+ \else
+ \si@log@debug{Font detection: text}%
+ \si@fam@dettext
+ \fi
+ \else
+ \si@log@debug{Font detection: inactive}%
+ \fi
+ \def\si@fam@bold{\unboldmath\mdseries}%
+ \ifsi@obeybold
+ \si@log@debug{Weight detection: checking weight}%
+ \ifmmode
+ \ifdim\displaywidth>0pt\relax
+ \ifsi@detectdisplay
+ \expandafter\si@fam@ifbmaths
+ \else
+ \expandafter\si@fam@ifbtext
+ \fi
+ \si@fam@setbold
+ \else
+ \si@fam@ifbinline\si@fam@setbold
+ \fi
+ \else
+ \si@fam@ifbtext\si@fam@setbold
+ \fi
+ \fi
+ \let\si@fam@italic\upshape
+ \ifsi@obeyitalic
+ \si@log@debug{Italic detection: checking italic}%
+ \si@fam@ifitext
+ {\let\si@fam@italic\relax
+ \si@log@debug{Italic detection: italic}}%
+ \fi}
+\newcommand*{\si@fam@detmaths}{%
+ \ifnum\the\fam=\si@fam@sf
+ \si@log@debug{Font detection: sf}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathssf\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textsf\endcsname
+ \else
+ \ifnum\the\fam=\si@fam@tt
+ \si@log@debug{Font detection: tt}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathstt\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@texttt\endcsname
+ \else
+ \si@log@debug{Font detection: rm}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathsrm\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textrm\endcsname
+ \fi
+ \fi}
+\newcommand*{\si@fam@dettext}{%
+ \ifx\f@family\si@tempa
+ \si@log@debug{Font detection: sf}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathssf\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textsf\endcsname
+ \else
+ \ifx\f@family\si@tempb
+ \si@log@debug{Font detection: tt}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathstt\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@texttt\endcsname
+ \else
+ \si@log@debug{Font detection: rm}%
+ \expandafter\let\expandafter\si@fam@maths
+ \csname\si@mathsrm\endcsname
+ \expandafter\let\expandafter\si@fam@text
+ \csname\si@textrm\endcsname
+ \fi
+ \fi}
+\newcommand*{\si@fam@setbold}{%
+ \si@log@debug{Weight detection: bold weight}%
+ \let\si@fam@bold\si@fam@boldify}
+\newcommand*{\si@fam@boldify}{\boldmath\bfseries}
+\si@newrobustcmd*{\num}[2][]{%
+ \begingroup
+ \sisetup{#1}%
+ \si@fam@mode
+ \si@num@intabfalse
+ \si@log@debug{Processing \string\num\space input `#2'}%
+ \expandafter\si@out@num\expandafter{\si@num{#2}}%
+ \endgroup}
+\newif\ifsi@num@intab
+\newcommand*{\si@num}[1]{%
+ \si@num@fixpm
+ \begingroup
+ \makeatletter
+ \@makeother{\,}%
+ \@makeother{\.}%
+ \@makeother{\+}%
+ \@makeother{\-}%
+ \def~{}%
+ \def\,{}%
+ \catcode`\~=\active\relax
+ \catcode`\^=\active\relax
+ \everyeof{\noexpand}%
+ \endlinechar\m@ne
+ \protected@xdef\si@tempa{\scantokens{#1}}%
+ \endgroup
+ \si@ifnotmtarg{\si@tempa}
+ {\si@num@ifvalid{\si@tempa}
+ {\si@num@format{\si@tempa}}
+ {\si@log@err{Invalid character `#1' in numerical input}%
+ {Only characters from the list
+ `\si@numvalid'\MessageBreak should be present in the
+ argument of the \string\num\space macro\MessageBreak
+ (or derivative such as an `s' column)}%
+ {#1}}}}
+\newcommand*{\si@num@fixpm}{%
+ \let\si@num@pm\pm
+ \let\si@num@mp\mp
+ \protected\def\pm{\si@num@pm}%
+ \protected\def\mp{\si@num@mp}}
+\newcommand*{\si@num@ifvalid}[1]{%
+ \begingroup
+ \si@switchtrue
+ \expandafter\si@num@valid#1\@empty\@empty
+ \ifsi@switch
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@num@valid#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numvalid}
+ {\ifx\@empty#2\@empty\else
+ \si@num@valid#2\@empty\@empty\@empty
+ \fi}
+ {\si@switchfalse}}
+\newcommand*{\si@num@in}{}
+\newcommand*{\si@num@out}{}
+\newcommand*{\si@num@exp}{}
+\newcommand*{\si@num@expsign}{}
+\newcommand*{\si@num@mant}{}
+\newcommand*{\si@num@mantsign}{}
+\newcommand*{\si@num@err}{}
+\newcommand*{\si@num@xpart}{}
+\newcommand*{\si@num@ambig}{}
+\newcommand*{\si@tab@out}{}
+\newcommand*{\si@tab@expout}{}
+\newif\ifsi@num@erropen
+\newcommand*{\si@num@arg}{}
+\newcommand*{\si@num@format}[1]{%
+ \protected@edef\si@num@arg{#1}%
+ \si@log@debug{Formatting number `\si@num@arg'}%
+ \renewcommand*{\si@num@in}{}%
+ \renewcommand*{\si@num@exp}{}%
+ \renewcommand*{\si@num@expsign}{}%
+ \renewcommand*{\si@num@mant}{}%
+ \renewcommand*{\si@num@mantsign}{}%
+ \renewcommand*{\si@num@err}{}%
+ \renewcommand*{\si@num@xpart}{}%
+ \si@switchfalse
+ \expandafter\si@num@findxpart\si@num@arg\@empty\@empty
+ \si@switchfalse
+ \si@num@sepmantexp{\si@num@in}%
+ \si@num@sepsign{exp}%
+ \si@num@sepsign{mant}%
+ \ifx\@empty\si@num@exp\@empty
+ \ifx\@empty\si@num@expsign\@empty\else
+ \si@log@warn{Sign but no number for `\si@num@arg'}%
+ \fi
+ \let\si@num@expsign\@empty
+ \fi
+ \ifx\@empty\si@num@mant\@empty
+ \ifx\@empty\si@num@mantsign\@empty\else
+ \ifx\@empty\si@num@exp\@empty
+ \si@log@warn{Sign but no number for `\si@num@arg'}%
+ \let\si@num@mantsign\@empty
+ \fi
+ \fi
+ \fi
+ \renewcommand*{\si@tempa}{{-}}%
+ \ifx\si@num@mantsign\si@tempa
+ \ifsi@colourneg
+ \expandafter\expandafter\expandafter\si@fam@colourcmd
+ \else
+ \expandafter\expandafter\expandafter\@gobble
+ \fi
+ \else
+ \expandafter\@gobble
+ \fi
+ {\si@negcolour}%
+ \si@num@procnum{exp}%
+ \si@num@procnum{mant}%
+ \si@str@ifonlychrs{\si@num@exp}{0\si@numdecimal}
+ {\ifsi@allowzeroexp\else
+ \renewcommand*{\si@num@exp}{}%
+ \ifx\@empty\si@num@mant\@empty
+ \renewcommand*{\si@num@mant}{1}%
+ \fi
+ \fi}{}%
+ \ifx\@empty\si@num@exp\@empty\else
+ \ifsi@trapambigerr
+ \expandafter\expandafter\expandafter\si@num@ambigerrtrue
+ \fi
+ \fi
+ \protected@edef\si@num@out{%
+ \ensuremath{{\si@num@mantsign}}\si@num@mant}%
+ \renewcommand*{\si@tempa}{num}%
+ \ifsi@num@intab
+ \protected@edef\si@tab@out{%
+ \ensuremath{{\si@num@mantsign}}\si@num@predec}%
+ \protected@edef\si@num@out{\si@num@postdec}%
+ \renewcommand*{\si@tempa}{tab}%
+ \fi
+ \ifx\@empty\si@num@postdec\@empty\else
+ \renewcommand*{\si@tempa}{num}%
+ \fi
+ \ifx\@empty\si@num@err\@empty\else
+ \ifsi@seperr
+ \ifsi@num@ambigerr
+ \protected@edef\si@num@out{%
+ \ensuremath{\si@openerr}\si@num@out}%
+ \si@repeatunitsfalse
+ \expandafter\si@num@erropentrue
+ \else
+ \ifsi@trapambigerr\else
+ \ifx\@empty\si@num@exp\@empty\else
+ \protected@edef\si@num@err{%
+ \si@num@err\expandafter\@car\si@numexp\@nil
+ \si@num@expsign\si@num@exp}%
+ \ifsi@repeatunits\else
+ \renewcommand*{\si@num@exp}{}%
+ \renewcommand*{\si@num@expsign}{}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \else
+ \expandafter\protected@edef\csname
+ si@\si@tempa @out\endcsname{%
+ \si@num@out\ensuremath{\si@errspace}\ensuremath
+ {\si@openerr}\si@num@err\ensuremath{\si@closeerr}}%
+ \renewcommand*{\si@num@err}{}%
+ \fi
+ \fi
+ \renewcommand*{\si@tempa}{num@out}%
+ \ifsi@num@erropen
+ \renewcommand*{\si@tempa}{num@ambig}%
+ \fi
+ \ifsi@num@intab
+ \renewcommand*{\si@tempa}{tab@expout}%
+ \fi
+ \ifx\@empty\si@num@exp\@empty
+ \ifx\@empty\si@num@mant\@empty
+ \si@log@err{Invalid number format `\si@num@arg'}
+ {Something is wrong with the number format; does it
+ contain \MessageBreak any numbers (from the list
+ `\si@numdigits')?}%
+ \renewcommand*\si@num@out{}%
+ \fi
+ \else
+ \ifx\@empty\si@num@mant\@empty\else
+ \expandafter\protected@edef\csname
+ si@\si@tempa\endcsname{%
+ \csname si@\si@tempa\endcsname\ensuremath{{}%
+ \si@expproduct{}}}%
+ \fi
+ \expandafter\protected@edef\csname
+ si@\si@tempa\endcsname{%
+ \csname si@\si@tempa\endcsname\si@expbase
+ \textsuperscript{\ensuremath{\si@num@expsign}%
+ \si@num@exp}}%
+ \fi
+ \ifsi@num@intab\else
+ \expandafter\si@num@out
+ \fi
+ \ifx\@empty\si@num@err\@empty\else
+ \expandafter\si@num@procerr
+ \fi
+ \ifsi@num@erropen
+ \expandafter\si@out@num\expandafter{%
+ \ensuremath{\si@closeerr}}%
+ \ifx\@empty\si@num@ambig\@empty\else
+ \expandafter\si@out@num\expandafter{\si@num@ambig}%
+ \renewcommand*{\si@num@ambig}{}%
+ \fi
+ \fi
+ \si@num@erropenfalse
+ \ifx\@empty\si@num@xpart\@empty\else
+ \expandafter\si@num@sepxpart
+ \fi}
+\def\si@num@findxpart#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numprod}
+ {\si@switchtrue\si@seperrfalse}{}%
+ \ifsi@switch
+ \protected@edef\si@num@xpart{\si@num@xpart#1}%
+ \else
+ \protected@edef\si@num@in{\si@num@in#1}%
+ \fi
+ \ifx\@empty#2\@empty\else
+ \si@num@findxpart#2\@empty
+ \fi}
+\newcommand*{\si@num@sepmantexp}[1]{%
+ \expandafter\si@num@mantexp#1\@empty\@empty}
+\def\si@num@mantexp#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numgobble}
+ {\si@log@debug{Gobbling `#1' in \si@num@arg}}
+ {\si@str@ifchrstr{#1}{\si@numexp}
+ {\ifsi@switch
+ \si@log@err{Duplicate exponent marker found}
+ {Only a single exponent character \MessageBreak
+ (from the list `\si@numexp')\MessageBreak may
+ occur in a numerical argument}%
+ \else
+ \si@log@debug{Exponent marker `#1' found in
+ `\si@num@arg'}%
+ \fi
+ \si@switchtrue}%
+ {\ifsi@switch
+ \expandafter\si@num@addexp
+ \else
+ \expandafter\si@num@addmnt
+ \fi
+ {#1}}}%
+ \ifx\@empty#2\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@sepmantexp
+ \fi
+ {#2}}
+\newcommand*{\si@num@addmnt}[1]{%
+ \si@num@addmntexp{#1}{mant}{mantissa}}
+\newcommand*{\si@num@addexp}[1]{%
+ \si@num@addmntexp{#1}{exp}{exponent}}
+\newcommand*{\si@num@addmntexp}[3]{%
+ \si@log@debug{Adding `#1' to #3 for `\si@num@arg'}%
+ \expandafter\protected@edef\csname si@num@#2\endcsname{%
+ \csname si@num@#2\endcsname#1}}
+\newcommand*{\si@num@sepsign}[1]{%
+ \expandafter\ifx\expandafter\@empty
+ \csname si@num@#1\endcsname\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@gensign
+ \fi
+ {#1}}
+\newcommand*{\si@num@gensign}[1]{%
+ \expandafter\expandafter\expandafter\si@num@findsign
+ \csname si@num@#1\endcsname\@empty\@empty
+ \ifx\@empty\si@num@sign\@empty
+ \ifx\@empty\si@num@value\@empty
+ \expandafter\expandafter\expandafter\@gobble
+ \else
+ \expandafter\expandafter\expandafter\si@num@addsign
+ \fi
+ \else
+ \expandafter\@gobble
+ \fi
+ {#1}%
+ \expandafter\let\csname si@num@#1sign\endcsname\si@num@sign
+ \expandafter\let\csname si@num@#1\endcsname\si@num@value}
+\newcommand*{\si@num@sign}{}
+\def\si@num@findsign#1#2#3\@empty{%
+ \si@num@delplusfalse
+ \si@str@ifchrstr{#1}{\si@numsign}{%
+ \si@str@ifchrstr{#2}{\si@numsign}{%
+ \if +#1%
+ \if -#2%
+ \si@log@debug{Found sign combination +- for
+ `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{{\si@pm}}%
+ \else
+ \si@log@inf{Unknown sign combination `#1#2'}%
+ \renewcommand*{\si@num@sign}{{#1#2}}%
+ \fi
+ \else
+ \if -#1%
+ \if +#2%
+ \si@log@debug{Found sign combination -+ for
+ `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{{\mp}}%
+ \else
+ \si@log@inf{Unknown sign combination `#1#2'}%
+ \renewcommand*{\si@num@sign}{{#1#2}}%
+ \fi
+ \else
+ \si@log@inf{Unknown sign combination `#1#2'}%
+ \renewcommand*{\si@num@sign}{{#1#2}}%
+ \fi
+ \fi
+ \protected@edef\si@num@value{#3}}%
+ {\si@log@debug{Found single sign character `#1' for
+ `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{{#1}}%
+ \if +#1%
+ \ifsi@retainplus\else
+ \expandafter\expandafter\expandafter\si@num@killsign
+ \fi
+ \fi
+ \protected@edef\si@num@value{#2#3}}}%
+ {\si@log@debug{No sign found for `\si@num@arg'}%
+ \renewcommand*{\si@num@sign}{}%
+ \protected@edef\si@num@value{#1#2#3}}}
+\newif\ifsi@num@delplus
+\newcommand*{\si@num@killsign}{%
+ \si@num@delplustrue
+ \renewcommand*{\si@num@sign}{}}
+\newcommand*{\si@num@addsign}[1]{%
+ \begingroup
+ \renewcommand*{\si@tempa}{#1}%
+ \renewcommand*{\si@tempb}{mant}%
+ \ifx\si@tempa\si@tempb
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup
+ {\ifsi@num@signmant
+ \expandafter\si@num@asign
+ \else
+ \expandafter\@gobble
+ \fi
+ {mantissa}}
+ {\ifsi@num@signexp
+ \expandafter\si@num@asign
+ \else
+ \expandafter\@gobble
+ \fi
+ {exponent}}}
+\newcommand*{\si@num@asign}[1]{%
+ \let\si@num@sign\si@sign
+ \si@log@debug{Adding sign \si@sign\space to #1 for
+ `\si@num@arg'}}
+\newcommand*{\si@num@procnum}[1]{%
+ \expandafter\ifx\expandafter\@empty
+ \csname si@num@#1\endcsname\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@finddigits
+ \fi
+ {#1}}
+\newcommand*{\si@num@predec}{}
+\newcommand*{\si@num@postdec}{}
+\newcommand*{\si@num@finddigits}[1]{%
+ \renewcommand*{\si@num@predec}{}%
+ \renewcommand*{\si@num@postdec}{}%
+ \si@switchfalse
+ \expandafter\expandafter\expandafter\si@num@digits
+ \csname si@num@#1\endcsname\@empty\@empty
+ \ifx\@empty\si@num@predec\@empty
+ \ifsi@num@padlead
+ \expandafter\expandafter\expandafter\si@num@addprezero
+ \fi
+ \fi
+ \ifx\@empty\si@num@postdec\@empty
+ \ifsi@num@padtrail
+ \ifsi@switch
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \si@num@addpostzero
+ \fi
+ \fi
+ \fi
+ \si@num@unsign{#1}%
+ \ifx\@empty\si@num@predec\@empty
+ \else
+ \expandafter\si@num@nozero
+ \fi
+ \ifx\@empty\si@num@predec\@empty
+ \ifx\@empty\si@num@postdec\@empty
+ \expandafter\expandafter\expandafter\@gobble
+ \else
+ \expandafter\expandafter\expandafter\si@num@sepdigits
+ \fi
+ \else
+ \expandafter\si@num@sepdigits
+ \fi
+ {#1}}
+\def\si@num@digits#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numdecimal}
+ {\ifsi@switch
+ \si@log@err{Duplicate decimal marker in `\si@num@arg'}
+ {Only a single decimal marker (from the list
+ `\si@numdecimal')\MessageBreak may occur in a
+ numerical argument}%
+ \else
+ \si@log@debug{Found decimal marker `#1' in
+ `\si@num@arg'}%
+ \expandafter\si@switchtrue
+ \fi}
+ {\si@str@ifchrstr{#1}{\si@numsign}
+ {\si@log@err{Misplaced sign character
+ `#1' in `\si@num@arg'}
+ {Sign characters `\si@numsign' can only
+ occur\MessageBreak at the start of a number}}
+ {\ifsi@switch
+ \expandafter\si@num@post
+ \else
+ \expandafter\si@num@pre
+ \fi
+ {#1}}}%
+ \ifx\@empty#2\@empty\else
+ \si@num@digits#2\@empty\@empty
+ \fi}
+\newcommand*{\si@num@pre}[1]{%
+ \si@num@prepost{#1}{pre}{integer}}
+\newcommand*{\si@num@post}[1]{%
+ \si@num@prepost{#1}{post}{decimal}}
+\newcommand*{\si@num@prepost}[3]{%
+ \expandafter\protected@edef\csname si@num@#2dec\endcsname{%
+ \csname si@num@#2dec\endcsname#1}%
+ \si@log@debug{Adding `#1' to #3 part for `\si@num@arg'}}
+\newcommand*{\si@num@addprezero}{%
+ \si@num@addpzero{pre}{leading}}
+\newcommand*{\si@num@addpostzero}{%
+ \si@num@addpzero{post}{trailing}}
+\newcommand*{\si@num@addpzero}[2]{%
+ \si@log@debug{Adding #2 zero for `\si@num@arg'}%
+ \@namedef{si@num@#1dec}{0}}
+\newcommand*{\si@num@unsign}[1]{%
+ \expandafter\ifx\expandafter\@empty
+ \csname si@num@#1sign\endcsname\@empty
+ \expandafter\@gobble
+ \else
+ \expandafter\si@num@nosign
+ \fi
+ {#1}}
+\newcommand*{\si@num@nosign}[1]{%
+ \begingroup
+ \si@switchtrue
+ \si@str@ifonlychrs{\si@num@predec\si@num@postdec}{0}
+ {\si@switchfalse}{}%
+ \ifsi@switch
+ \aftergroup\@gobble
+ \else
+ \aftergroup\@firstofone
+ \fi
+ \endgroup
+ {\si@log@debug{Zero value: removing any sign}%
+ \ifsi@ang@sign\else
+ \@namedef{si@num@#1sign}{}%
+ \fi}}
+\newcommand*{\si@num@nozero}{%
+ \si@str@ifonlychrs{\si@num@predec}{0}
+ {\renewcommand*{\si@num@predec}{0}}{}}
+\newcommand*{\si@num@decimalhook}{}
+\newcommand*{\si@num@sepdigits}[1]{%
+ \begingroup
+ \let\si@numextra\si@numaddn
+ \protected@edef\si@tempa{\si@num@predec\si@num@postdec}%
+ \si@num@ifextra{\si@tempa}
+ {\aftergroup\@gobble}
+ {\aftergroup\@firstofone}%
+ \endgroup
+ {\renewcommand*{\si@tempb}{mant}%
+ \renewcommand*{\si@tempc}{#1}%
+ \ifx\si@tempb\si@tempc
+ \expandafter\si@num@checkerr
+ \fi}%
+ \protected@edef\si@tempa{\si@num@predec\si@num@postdec}%
+ \expandafter\si@str@ifonlychrs\expandafter{\si@tempa}
+ {0123456789}
+ {\ifx\@empty\si@num@err\@empty
+ \ifsi@fixdp
+ \expandafter\expandafter\expandafter\si@num@fixdp
+ \fi
+ \fi}{}%
+ \si@num@ifextra{\si@num@predec}{}
+ {\expandafter\si@num@int\expandafter{\si@num@predec}}%
+ \renewcommand*{\si@tempc}{}%
+ \ifx\@empty\si@num@postdec\@empty\else
+ \si@num@decimalhook
+ \renewcommand*{\si@tempc}{%
+ \ensuremath{{\si@decimalsymbol}}}%
+ \si@num@ifextra{\si@num@postdec}{}
+ {\expandafter\si@num@dec\expandafter{\si@num@postdec}}%
+ \fi
+ \expandafter\protected@edef\csname si@num@#1\endcsname
+ {\si@num@predec\si@tempc\si@num@postdec}}
+\newcommand*{\si@num@ifextra}[1]{%
+ \begingroup
+ \si@switchfalse
+ \expandafter\si@num@extra#1\@empty\@empty
+ \ifsi@switch
+ \si@log@debug{Found `extra' characters in `#1'}%
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\def\si@num@extra#1#2\@empty{%
+ \ifx\@empty#1\@empty\else
+ \si@str@ifchrstr{#1}{\si@numextra}{\si@switchtrue}{}%
+ \ifx\@empty#2\@empty\else
+ \si@num@extra#2\@empty\@empty
+ \fi
+ \fi}
+\newif\ifsi@num@ambigerr
+\newcommand*{\si@num@checkerr}{%
+ \ifx\@empty\si@num@postdec\@empty
+ \expandafter\si@num@preerr
+ \else
+ \expandafter\si@num@posterr
+ \fi}
+\newcommand*{\si@num@preerr}{%
+ \si@num@seperr{pre}%
+ \ifx\@empty\si@tempb\@empty\else
+ \expandafter\renewcommand\expandafter*\expandafter
+ \si@num@err\expandafter{\si@tempb}%
+ \fi}
+\newcommand*{\si@num@posterr}{%
+ \si@num@seperr{post}%
+ \ifx\@empty\si@tempb\@empty\else
+ \ifsi@seperr
+ \expandafter\expandafter\expandafter\si@num@psterr
+ \else
+ \let\si@num@err\si@tempb
+ \fi
+ \fi}
+\newcommand*{\si@num@psterr}{%
+ \si@num@cntdigits{\si@tempb}%
+ \si@tempcntb\si@tempcnta\relax
+ \si@num@cntdigits{\si@num@postdec}%
+ \ifnum\si@tempcnta<\si@tempcntb\relax
+ \expandafter\si@num@largeerr
+ \else
+ \expandafter\si@num@smallerr
+ \fi}
+\newcommand*{\si@num@seperr}[1]{%
+ \si@switchfalse
+ \renewcommand*{\si@tempa}{}%
+ \renewcommand*{\si@tempb}{}%
+ \expandafter\expandafter\expandafter\si@num@finderr
+ \csname si@num@#1dec\endcsname\@empty\@empty
+ \ifx\@empty\si@tempb\@empty\else
+ \expandafter\let\csname si@num@#1dec\endcsname\si@tempa
+ \fi}
+\def\si@num@finderr#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numopenerr}
+ {\ifsi@switch
+ \si@log@err{Invalid error in number}
+ {The numerical argument \si@num@arg\space has two (or
+ more)\MessageBreak error-opening characters}%
+ \else
+ \expandafter\si@switchtrue
+ \fi}
+ {\si@str@ifchrstr{#1}{\si@numcloseerr}
+ {\ifsi@switch
+ \ifx\@empty#2\@empty\else
+ \si@log@err{Invalid error in number}
+ {The numerical argument \si@num@arg\space has an
+ error-closing before the last character}%
+ \fi
+ \else
+ \si@log@err{Invalid error in number}
+ {The numerical argument \si@num@arg\space has an
+ error-closing character\MessageBreak but no
+ error-opening one}%
+ \fi}
+ {\ifsi@switch
+ \expandafter\si@num@addtmpb
+ \else
+ \expandafter\si@num@addtmpa
+ \fi
+ {#1}}}%
+ \ifx\@empty#2\@empty\else
+ \si@num@finderr#2\@empty
+ \fi}
+\newcommand*{\si@num@addtmpa}[1]{\si@num@addtmp{a}{#1}}
+\newcommand*{\si@num@addtmpb}[1]{\si@num@addtmp{b}{#1}}
+\newcommand*{\si@num@addtmp}[2]{%
+ \expandafter\protected@edef\csname si@temp#1\endcsname{%
+ \csname si@temp#1\endcsname#2}}
+\newcommand*{\si@num@cntdigits}[1]{%
+ \si@tempcnta\z@\relax
+ \expandafter\si@num@cntdgt#1\@empty\@empty}
+\def\si@num@cntdgt#1#2\@empty{%
+ \ifx\@empty#1\@empty\else
+ \advance\si@tempcnta\@ne\relax
+ \fi
+ \ifx\@empty#2\@empty\else
+ \expandafter\si@num@cntdgt#2\@empty
+ \fi}
+\newcommand*{\si@num@smallerr}{%
+ \si@tempcntb\si@tempcnta\relax
+ \si@num@serr
+ \protected@edef\si@num@err{%
+ \ifsi@num@padlead0\fi\expandafter\@car\si@numdecimal\@nil
+ \si@tempb}}
+\newcommand*{\si@num@serr}{%
+ \si@num@cntdigits{\si@tempb}%
+ \ifnum\si@tempcnta=\si@tempcntb\relax\else
+ \protected@edef\si@tempb{0\si@tempb}%
+ \expandafter\si@num@serr
+ \fi}
+\newcommand*{\si@num@largeerr}{%
+ \renewcommand*{\si@tempa}{}%
+ \si@tempcntb\si@tempcnta\relax
+ \si@num@lerr
+ \protected@edef\si@num@err{%
+ \si@tempa\ensuremath{\si@decimalsymbol}\si@tempb}}
+\newcommand*{\si@num@lerr}{%
+ \si@num@cntdigits{\si@tempb}%
+ \ifnum\si@tempcnta=\si@tempcntb\relax\else
+ \expandafter\si@num@movedigit\si@tempb\@empty\@empty
+ \si@num@lerr
+ \fi}
+\def\si@num@movedigit#1#2\@empty{%
+ \protected@edef\si@tempa{\si@tempa#1}%
+ \protected@edef\si@tempb{#2}}
+\newcommand*{\si@num@fixdp}{%
+ \si@num@cntdigits{\si@num@postdec}%
+ \ifx\@empty\si@num@postdec\@empty
+ \si@tempcnta\z@\relax
+ \fi
+ \ifnum\si@tempcnta>\si@num@dp\relax
+ \expandafter\si@num@round
+ \else
+ \ifnum\si@tempcnta<\si@num@dp\relax
+ \expandafter\expandafter\expandafter\si@num@pad
+ \fi
+ \fi}
+\newcommand*{\si@num@pad}{%
+ \si@log@debug{Padding to \the\si@num@dp\space digits}%
+ \loop\ifnum\si@tempcnta<\si@num@dp\si@num@pd\repeat}
+\newcommand*{\si@num@pd}{%
+ \advance\si@tempcnta\@ne\relax
+ \protected@edef\si@num@postdec{\si@num@postdec0}}
+\newcommand*{\si@num@prernd}{}
+\newcommand*{\si@num@postrnd}{}
+\newcommand*{\si@num@round}{%
+ \si@log@debug{Rounding to \the\si@num@dp\space digits}%
+ \si@num@reverse{\si@num@postdec}%
+ \si@num@reverse{\si@num@predec}%
+ \let\si@num@prernd\si@num@predec
+ \let\si@num@postrnd\si@num@postdec
+ \renewcommand*{\si@num@predec}{}%
+ \renewcommand*{\si@num@postdec}{}%
+ \si@switchfalse
+ \si@num@rnd}
+\newcommand*{\si@num@reverse}[1]{%
+ \renewcommand*{\si@tempa}{}%
+ \expandafter\si@num@rev#1\@empty\@empty
+ \let#1\si@tempa}
+\def\si@num@rev#1#2\@empty{%
+ \edef\si@tempa{#1\si@tempa}%
+ \ifx\@empty#2\@empty\else
+ \si@num@rev#2\@empty\@empty
+ \fi}
+\newcommand*{\si@num@rnd}{%
+ \ifnum\si@tempcnta>\z@\relax
+ \expandafter\si@num@rndpost
+ \else
+ \expandafter\si@num@rndpre
+ \fi}
+\newcommand*{\si@num@rndpre}{%
+ \expandafter\edef\expandafter\si@tempa\expandafter{%
+ \expandafter\@car\si@num@prernd\@nil}%
+ \expandafter\edef\expandafter\si@num@prernd\expandafter{%
+ \expandafter\@cdr\si@num@prernd\@nil}%
+ \si@tempcntb\si@tempa\relax
+ \ifsi@switch
+ \advance\si@tempcntb\@ne\relax
+ \fi
+ \si@switchfalse
+ \ifnum\si@tempcntb=10\relax
+ \si@tempcntb\z@\relax
+ \expandafter\expandafter\expandafter\si@switchtrue
+ \fi
+ \edef\si@num@predec{\the\si@tempcntb\si@num@predec}%
+ \ifx\@empty\si@num@prernd\@empty
+ \ifsi@switch
+ \edef\si@num@predec{1\si@num@predec}%
+ \fi
+ \else
+ \expandafter\si@num@rnd
+ \fi}
+\newcommand*{\si@num@rndpost}{%
+ \expandafter\edef\expandafter\si@tempa\expandafter{%
+ \expandafter\@car\si@num@postrnd\@nil}%
+ \expandafter\edef\expandafter\si@num@postrnd\expandafter{%
+ \expandafter\@cdr\si@num@postrnd\@nil}%
+ \si@tempcntb\si@tempa\relax
+ \ifsi@switch
+ \advance\si@tempcntb\@ne\relax
+ \fi
+ \si@switchfalse
+ \ifnum\si@tempcnta>\si@num@dp\relax
+ \ifnum\si@tempcntb>4\relax
+ \expandafter\expandafter\expandafter\si@switchtrue
+ \fi
+ \else
+ \ifnum\si@tempcntb=10\relax
+ \si@tempcntb\z@\relax
+ \expandafter\expandafter\expandafter\si@switchtrue
+ \fi
+ \edef\si@num@postdec{\the\si@tempcntb\si@num@postdec}%
+ \fi
+ \advance\si@tempcnta\m@ne\relax
+ \si@num@rnd}
+\newcommand*{\si@num@int}[1]{%
+ \renewcommand*{\si@num@predec}{}%
+ \ifsi@sepfour
+ \si@num@intfmt{}#1\@empty\@empty\@empty
+ \else
+ \si@num@iffive{#1}
+ {\si@num@intfmt{}#1\@empty\@empty\@empty}
+ {\renewcommand*{\si@num@predec}{#1}}%
+ \fi}
+\newcommand*{\si@num@iffive}[1]{%
+ \si@num@five#1\@empty\@empty\@empty\@empty\@empty\end}
+\def\si@num@five#1#2#3#4#5\end{%
+ \ifx\@empty#5\@empty
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+\newcommand*{\si@num@intfmt}[4]{%
+ \ifx\@empty#2\@empty
+ \si@num@intsep#1\relax
+ \else
+ \ifx\@empty#3\@empty
+ \si@num@intsep\@empty\@empty#1#2\relax
+ \else
+ \ifx\@empty#4\@empty
+ \si@num@intsep\@empty#1#2#3\relax
+ \else
+ \si@num@fiint{#1#2#3#4}%
+ \fi
+ \fi
+ \fi}
+\def\si@num@fiint#1\fi\fi\fi{\fi\fi\fi\si@num@intfmt{#1}}
+\newcommand*{\si@num@intsep}[4]{%
+ \protected@edef\si@num@predec{\si@num@predec#1#2#3}%
+ \if\relax#4\relax\else
+ \protected@edef\si@num@predec{%
+ \si@num@predec\ensuremath{\noexpand\si@digitsep}}%
+ \expandafter\si@num@intsep\expandafter#4%
+ \fi}
+\newcommand*{\si@num@dec}[1]{%
+ \renewcommand*{\si@num@postdec}{}%
+ \ifsi@sepfour
+ \si@num@decfmt#1\@empty\@empty\@empty\@empty
+ \else
+ \si@num@iffive{#1}
+ {\si@num@decfmt#1\@empty\@empty\@empty\@empty}
+ {\protected@edef\si@num@postdec{\si@num@postdec#1}}%
+ \fi}
+\newcommand*{\si@num@decfmt}[4]{%
+ \protected@edef\si@num@postdec{\si@num@postdec#1#2#3}%
+ \ifx\@empty#4\@empty%
+ \else
+ \protected@edef\si@num@postdec{%
+ \si@num@postdec\ensuremath{\noexpand\si@digitsep}}%
+ \expandafter\si@num@decfmt\expandafter#4%
+ \fi}
+\newcommand*{\si@num@procerr}{%
+ \si@num@addunit
+ \ensuremath{\si@pm}%
+ \expandafter\si@num\expandafter{\si@num@err}}
+\newcommand*{\si@num@sepxpart}{%
+ \si@num@addunit
+ \ensuremath{\times}%
+ \expandafter\expandafter\expandafter\si@num\expandafter
+ \expandafter\expandafter{%
+ \expandafter\@cdr\si@num@xpart\@nil}}
+\newcommand*{\si@num@addunit}{%
+ \si@unt@numtrue
+ \ifx\@empty\si@unt@unitarg\@empty\else
+ \ifsi@repeatunits
+ \si@unt@printunit{\si@unt@unitarg}%
+ \fi
+ \fi}
+\si@newrobustcmd*{\ang}[2][]{%
+ \begingroup
+ \sisetup{#1}%
+ \si@fam@mode
+ \si@log@debug{Processing \string\ang\space input `#2'}%
+ \@makeother{\;}%
+ \makeatletter
+ \scantokens{\si@ang@parse#2;;;\@nil}}
+\def\si@ang@parse#1;#2;#3;#4\@nil{%
+ \let\ifsi@ang@fixdp\ifsi@fixdp
+ \si@fixdpfalse
+ \si@ifmtarg{#4}
+ {\si@log@debug{Angle argument contains no
+ semi-colons:\MessageBreak decimal angle}%
+ \si@ang@dec{#1}{}{}}
+ {\si@log@debug{Angle argument contains
+ semi-colons:\MessageBreak degree-minute-second angle}%
+ \renewcommand*{\si@tempa}{#4}%
+ \renewcommand*{\si@tempb}{;;}%
+ \ifx\si@tempa\si@tempb\else
+ \ifsi@strictarc
+ \renewcommand*{\si@tempb}{;}%
+ \ifx\si@tempa\si@tempb
+ \si@log@err{Insufficient semi-colons in argument
+ of \string\ang}{The argument of
+ \string\ang\space must contain either no
+ semi-colons or exactly two}%
+ \else
+ \si@log@err{Excess semi-colons in argument of
+ \string\ang}{The argument of \string\ang\space
+ must contain either no semi-colons or exactly
+ two}%
+ \fi
+ \fi
+ \fi
+ \si@ang@arc{#1}{#2}{#3}}}
+\newcommand*{\si@ang@dec}{%
+ \let\si@ang@fix\@gobble
+ \ifsi@ang@toarc
+ \expandafter\si@ang@dectoarc
+ \else
+ \sisetup{padangle=none}\expandafter\si@ang@typeset
+ \fi}
+\newcommand*{\si@ang@arc}{%
+ \let\si@ang@fix\si@ang@arcfix
+ \ifsi@ang@todec
+ \expandafter\si@ang@arctodec
+ \else
+ \expandafter\si@ang@typeset
+ \fi}
+\newif\ifsi@ang@fixdp
+\newcommand*{\si@ang@fix}[1]{}
+\newcommand*{\si@ang@arcfix}[1]{%
+ \renewcommand*{\si@tempa}{second}%
+ \renewcommand*{\si@tempb}{#1}%
+ \ifx\si@tempa\si@tempb
+ \ifsi@ang@fixdp
+ \expandafter\expandafter\expandafter\si@fixdptrue
+ \else
+ \expandafter\expandafter\expandafter\si@fixdpfalse
+ \fi
+ \else
+ \expandafter\si@fixdpfalse
+ \fi}
+\newcommand*{\si@ang@ifnum}[1]{%
+ \begingroup
+ \renewcommand*{\si@numvalid}{0123456789,.+-}%
+ \ifx\@empty#1\@empty
+ \aftergroup\@firstoftwo
+ \else
+ \si@num@ifvalid{#1}
+ {\aftergroup\@firstoftwo}
+ {\aftergroup\@secondoftwo}%
+ \fi
+ \endgroup}
+\newcommand*{\si@ang@arctodec}[3]{%
+ \let\si@ang@fix\@gobble
+ \ifnum\si@num@dp>\thr@@\relax
+ \si@num@dp\thr@@\relax
+ \fi
+ \si@fixdptrue
+ \si@ang@ifnum{#1}
+ {\si@ang@ifnum{#2}
+ {\si@ang@ifnum{#3}
+ {\si@tempdima\z@\relax
+ \renewcommand*{\si@tempa}{+}%
+ \ifx\@empty#1\@empty\else
+ \si@tempdima #1pt\relax
+ \fi
+ \ifdim\si@tempdima<\z@\relax
+ \renewcommand*{\si@tempa}{-}%
+ \fi
+ \ifx\@empty#2\@empty\else
+ \si@tempdima\dimexpr\si@tempdima\si@tempa
+ #2pt/60\relax
+ \fi
+ \ifdim\si@tempdima<\z@\relax
+ \renewcommand*{\si@tempa}{-}%
+ \else
+ \fi
+ \ifx\@empty#3\@empty\else
+ \si@tempdima\dimexpr\si@tempdima\si@tempa
+ #3pt/3600\relax
+ \fi
+ \sisetup{numdecimal=.}%
+ \expandafter\si@ang@typeset\expandafter{%
+ \strip@pt\si@tempdima}{}{}}
+ {\si@ang@notnum{#1}{#2}{#3}}}
+ {\si@ang@notnum{#1}{#2}{#3}}}
+ {\si@ang@notnum{#1}{#2}{#3}}}
+\newcommand*{\si@ang@dectoarc}[1]{%
+ \let\si@ang@fix\si@ang@arcfix
+ \si@ang@fixdptrue
+ \ifnum\si@num@dp>\@ne\relax
+ \si@num@dp\@ne\relax
+ \fi
+ \si@ang@ifnum{#1}
+ {\si@tempdima\z@\relax
+ \ifx\@empty#1\@empty\else
+ \si@tempdima #1pt\relax
+ \fi
+ \si@ang@sepint{deg}%
+ \si@tempdima\dimexpr\si@tempdima *60\relax
+ \si@ang@sepint{min}%
+ \edef\si@tempa{\the\dimexpr\si@tempdima *60\relax}%
+ \expandafter\newcommand\expandafter*\expandafter{%
+ \expandafter\si@ang@arcsec\expandafter}\expandafter{%
+ \expandafter\si@ang@strippt\si@tempa}%
+ \si@tempdima\z@\relax
+ \edef\si@tempa{\the\si@tempdima}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \expandafter\si@tempa\expandafter}\expandafter{%
+ \expandafter\si@ang@strippt\si@tempa}%
+ \ifx\si@tempa\si@ang@arcsec
+ \renewcommand*{\si@ang@arcsec}{0}%
+ \fi
+ \renewcommand*{\si@tempa}{0}%
+ \ifx\si@ang@arcdeg\si@tempa
+ \si@temptoks{{}}%
+ \else
+ \si@temptoks{{\si@ang@arcdeg}}%
+ \fi
+ \ifx\si@ang@arcmin\si@tempa
+ \si@temptoks\expandafter{\the\si@temptoks{}}%
+ \else
+ \si@temptoks\expandafter{\the\si@temptoks{%
+ \si@ang@arcmin}}%
+ \fi
+ \ifx\si@ang@arcsec\si@tempa
+ \si@temptoks\expandafter{\the\si@temptoks{}}%
+ \else
+ \si@temptoks\expandafter{\the\si@temptoks{%
+ \si@ang@arcsec}}%
+ \fi
+ \expandafter\si@ang@typeset\the\si@temptoks}
+ {\si@ang@notnum{#1}{}{}}}
+\newcommand*{\si@ang@sepint}[1]{%
+ \expandafter\si@ang@sint\the\si@tempdima\@empty
+ \expandafter\let\csname si@ang@arc#1\endcsname\si@tempa}
+\def\si@ang@sint#1.#2\@empty{%
+ \renewcommand*{\si@tempa}{#1}%
+ \si@tempdima 0.#2\relax}
+\begingroup
+ \catcode`P=12
+ \catcode`T=12
+ \lowercase{
+ \renewcommand*{\si@tempa}{%
+ \def\si@ang@strippt##1PT{##1}}}
+ \expandafter\endgroup
+\si@tempa
+\newcommand*{\si@ang@notnum}[3]{%
+ \si@log@warn{Angle `#1;#2;#3' is not a pure
+ number:\MessageBreak output will be as given}%
+ \si@ang@typeset{#1}{#2}{#3}}
+\newif\ifsi@ang@sign
+\newcommand*{\si@ang@typeset}[3]{%
+ \ifsi@ang@padlarge
+ \newcommand*{\si@ang@degs}{0\si@sym@degree}%
+ \newcommand*{\si@ang@mins}{0\si@sym@minute}%
+ \newcommand*{\si@ang@secs}{0\si@sym@second}%
+ \else
+ \newcommand*{\si@ang@degs}{}%
+ \newcommand*{\si@ang@mins}{}%
+ \newcommand*{\si@ang@secs}{}%
+ \fi
+ \protected@edef\si@ang@decimalsymbol{\si@decimalsymbol}%
+ \ifsi@astroang
+ \let\si@ang@movesign\si@ang@astrosign
+ \else
+ \let\si@ang@movesign\@gobble
+ \fi
+ \newcommand*{\si@ang@secnum}{\si@ang@num{second}}%
+ \newcommand*{\si@ang@minnum}{\si@ang@num{minute}}%
+ \si@ifnotmtarg{#3}
+ {\si@log@debug{Found seconds `#3'}%
+ \si@ang@ifnum{#3}
+ {\ifdim #3 pt=\z@\relax\else
+ \si@ang@signtrue
+ \fi}{}%
+ \renewcommand*{\si@ang@secs}
+ {\si@ang@secnum{#3}\si@sym@second}%
+ \renewcommand*{\si@ang@mins}
+ {\si@ang@pad{0\si@sym@minute}}%
+ \renewcommand*{\si@ang@degs}
+ {\si@ang@pad{0\si@sym@degree}}}%
+ \si@ifnotmtarg{#2}
+ {\si@log@debug{Found minutes `#2'}%
+ \si@ang@ifnum{#2}
+ {\ifdim #2 pt=\z@\relax\else
+ \si@ang@signtrue
+ \fi}{}%
+ \renewcommand*{\si@ang@secnum}{%
+ \si@ang@signlessnum{second}}%
+ \renewcommand*{\si@ang@mins}
+ {\si@ang@minnum{#2}\si@sym@minute}%
+ \renewcommand*{\si@ang@degs}
+ {\si@ang@pad{0\si@sym@degree}}}%
+ \si@ifnotmtarg{#1}
+ {\si@log@debug{Found degrees `#1'}%
+ \renewcommand*{\si@ang@secnum}{%
+ \si@ang@signlessnum{second}}%
+ \renewcommand*{\si@ang@minnum}{%
+ \si@ang@signlessnum{minute}}%
+ \renewcommand*{\si@ang@degs}
+ {\si@ang@num{degree}{#1}%
+ \si@sym@degree}}%
+ \si@out@num
+ {\si@ang@degs\si@anglesep\si@ang@mins\si@anglesep
+ \si@ang@secs}%
+ \endgroup}
+\newcommand*{\si@ang@pad}[1]{\ifsi@ang@padsmall #1\fi}
+\newcommand*{\si@ang@num}[2]{%
+ \begingroup
+ \si@ang@fix{#1}%
+ \si@ang@movesign{#1}%
+ \si@num{#2}%
+ \endgroup}
+\newcommand*{\si@ang@signlessnum}[2]{%
+ \begingroup
+ \si@ang@fix{#1}%
+ \si@ang@movesign{#1}%
+ \sisetup{addsign=none}%
+ \si@num{#2}%
+ \endgroup}
+\newcommand*{\si@ang@killdegree}{\let\si@sym@degree\relax}
+\newcommand*{\si@ang@killminute}{\let\si@sym@minute\relax}
+\newcommand*{\si@ang@killsecond}{\let\si@sym@second\relax}
+\newcommand*{\si@ang@astrosign}[1]{%
+ \renewcommand*{\si@decimalsymbol}{%
+ \setbox\si@tempboxa=\hbox{%
+ \ensuremath{{\si@ang@decimalsymbol}}}%
+ \si@tempdima\wd\si@tempboxa\relax
+ \setbox\si@tempboxb=\hbox to\z@{%
+ \hss\unhbox\si@tempboxa\hss}%
+ \setbox\si@tempboxa=\hbox{%
+ \csname si@sym@#1\endcsname\hskip-\scriptspace}%
+ \si@tempdimb\wd\si@tempboxa\relax
+ \setbox\si@tempboxc=\hbox to\z@{%
+ \hss\unhbox\si@tempboxa\hss}%
+ \setbox\si@tempboxd=\hbox{%
+ \usebox\si@tempboxb\usebox\si@tempboxc}%
+ \ifdim\si@tempdima>\si@tempdimb\relax
+ \setbox\si@tempboxa=\hbox to\si@tempdima{%
+ \hss\unhbox\si@tempboxd\hss}%
+ \else
+ \setbox\si@tempboxa=\hbox to\si@tempdimb{%
+ \hss\unhbox\si@tempboxd\hss}%
+ \fi
+ \usebox\si@tempboxa%
+ \ifdim\si@tempdima>\si@tempdimb\relax\else
+ \hskip\scriptspace
+ \fi}%
+ \renewcommand*{\si@num@decimalhook}{\expandafter\aftergroup
+ \csname si@ang@kill#1\endcsname}}%
+\edef\si@tempa{%
+ \noexpand\NC@do S\noexpand\NC@do s\the\NC@list}
+\newcolumntype{S}{}
+\newcolumntype{s}{}
+\NC@list\expandafter{\si@tempa}
+\renewcommand*{\NC@rewrite@S}[1][]{%
+ \edef\si@tempa{\the\@temptokena
+ >{\noexpand\si@tab@begin@S[#1]}c%
+ <{\noexpand\si@tab@end@S}}%
+ \@temptokena\expandafter{\si@tempa}%
+ \NC@find}
+\renewcommand*{\NC@rewrite@s}[1][]{%
+ \edef\si@tempa{\the\@temptokena
+ >{\noexpand\si@tab@begin@s[#1]}c%
+ <{\noexpand\si@tab@end@s}}%
+ \@temptokena\expandafter{\si@tempa}%
+ \NC@find}
+\newcommand*{\si@tab@begin@S}[1][]{%
+ \si@log@debug{Processing S column cell contents}%
+ \let\si@tab@gettok\si@tab@gettok@S
+ \si@seperrfalse
+ \renewcommand*{\si@num@sepxpart}{%
+ \si@log@err{Multiple numbers not allowed in
+ tables\MessageBreak Only the first number used}
+ \@ehb}%
+ \si@tab@begin[#1]}
+\newcommand*{\si@tab@begin@s}[1][]{%
+ \si@log@debug{Processing s column cell contents}%
+ \let\si@tab@gettok\si@tab@gettok@s
+ \si@tab@begin[#1]}
+\newtoks\si@tab@toks
+\newtoks\si@tab@pretoks
+\newtoks\si@tab@posttoks
+\newcommand*{\si@tab@begin}[1][]{%
+ \begingroup
+ \sisetup{#1}%
+ \si@tab@toks{}%
+ \si@tab@pretoks{}%
+ \si@tab@posttoks{}%
+ \si@switchfalse
+ \si@tab@gettok}
+\newcommand*{\si@tab@gettok@S}[1]{%
+ \ifx\tabularnewline#1\relax
+ \let\si@tab@next\si@tab@newline@S
+ \else
+ \ifx\end#1\relax
+ \let\si@tab@next\end
+ \else
+ \ifx\si@tab@end@S#1\relax
+ \let\si@tab@next\si@tab@end@S
+ \else
+ \ifx\endtabular#1\relax
+ \let\si@tab@next\endtabular
+ \else
+ \ifx\csname#1\relax
+ \let\si@tab@next\csname
+ \else
+ \ifx\relax#1\relax
+ \let\si@tab@next\relax
+ \else
+ \let\si@tab@next\si@tab@gettok@S
+ \si@str@ifchrstr{#1}{\si@numvalid}
+ {\si@switchtrue
+ \si@log@debug{Found numerical cell
+ contents `#1'}%
+ \si@tab@toks=\expandafter{%
+ \the\si@tab@toks#1}}
+ {\si@log@debug{Found other cell contents
+ \string#1}%
+ \si@tab@othertok{#1}}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \si@tab@next}
+\newcommand*{\si@tab@othertok}[1]{%
+ \ifsi@switch
+ \si@tab@posttoks=\expandafter{\the\si@tab@posttoks#1}%
+ \else
+ \si@tab@pretoks=\expandafter{\the\si@tab@pretoks#1}%
+ \fi}
+\newcommand*{\si@tab@gettok@s}[1]{%
+ \ifx\tabularnewline#1\relax
+ \let\si@tab@next\si@tab@newline@s
+ \else
+ \ifx\end#1\relax
+ \let\si@tab@next\end
+ \else
+ \ifx\si@tab@end@s#1\relax
+ \let\si@tab@next\si@tab@end@s
+ \else
+ \ifx\endtabular#1\relax
+ \let\si@tab@next\endtabular
+ \else
+ \ifx\csname#1\relax
+ \let\si@tab@next\csname
+ \else
+ \ifx\relax#1\relax
+ \let\si@tab@next\relax
+ \else
+ \let\si@tab@next\si@tab@gettok@s
+ \si@tab@toks=\expandafter{%
+ \the\si@tab@toks#1}%
+ \si@log@debug{Found cell contents `#1'}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \si@tab@next}
+\newcommand*{\si@tab@end@S}{%
+ \ifsi@switch
+ \let\si@tab@lfill\si@tab@lfill@S
+ \let\si@tab@rfill\si@tab@rfill@S
+ \else
+ \let\si@tab@rfill\si@tab@rfill@t
+ \let\si@tab@lfill\si@tab@lfill@t
+ \fi
+ \si@tab@lfill\relax
+ \the\si@tab@pretoks
+ \ifsi@switch
+ \expandafter\si@tab@numout
+ \fi
+ \the\si@tab@posttoks
+ \si@tab@rfill\relax
+ \endgroup}
+\newcommand*{\si@tab@end@s}{%
+ \si@tab@lfill@s\relax
+ \expandafter\si\expandafter{\the\si@tab@toks}%
+ \si@tab@rfill@s\relax
+ \endgroup}
+\newcommand*{\si@tab@newline@S}{%
+ \si@tab@end@S
+ \hfil\relax
+ \let\si@tab@end\si@tab@end@S
+ \renewcommand*{\si@tab@end@S}{\let\si@tab@end@S\si@tab@end}%
+ \tabularnewline}
+\newcommand*{\si@tab@newline@s}{%
+ \si@tab@end@s
+ \hfil\relax
+ \let\si@tab@end\si@tab@end@s
+ \renewcommand*{\si@tab@end@s}{\let\si@tab@end@s\si@tab@end}%
+ \tabularnewline}
+\newcount\si@tempcnta
+\newcount\si@tempcntb
+\newcommand*{\si@tab@numout}{%
+ \si@num@intabtrue
+ \ifsi@tab@fixed
+ \ifsi@tabautofit
+ \si@num@dp\si@tab@mantpostcnt\relax
+ \expandafter\expandafter\expandafter\si@fixdptrue
+ \fi
+ \fi
+ \expandafter\si@num\expandafter{\the\si@tab@toks}%
+ \si@tab@format}
+\newbox\si@tab@prebox
+\newbox\si@tab@midbox
+\newbox\si@tab@postbox
+\newbox\si@tab@expbox
+\newcommand*{\si@tab@format}{%
+ \ifsi@tab@fixed
+ \expandafter\si@tab@fixed
+ \else
+ \expandafter\si@tab@unfixed
+ \fi
+ \ifsi@colourvalues
+ \si@fam@colourcmd{\si@valuecolour}%
+ \fi
+ \box\si@tab@prebox\box\si@tab@midbox\box\si@tab@postbox%
+ \box\si@tab@expbox}
+\newcommand*\si@tab@unfixed{%
+ \si@log@debug{Using variable width S column}%
+ \protected@edef\si@num@out{\si@num@out\si@tab@expout}%
+ \setbox\si@tab@prebox=\hbox
+ {\expandafter\si@out@num\expandafter{\si@tab@out}}%
+ \ifx\@empty\si@num@out\@empty
+ \setbox\si@tab@midbox=\hbox
+ {\phantom{\ensuremath{{\si@decimalsymbol}}}}%
+ \else
+ \setbox\si@tab@midbox=\hbox
+ {\ensuremath{{\si@decimalsymbol}}}%
+ \fi
+ \setbox\si@tab@postbox=\hbox
+ {\expandafter\si@out@num\expandafter{\si@num@out}}%
+ \ifdim\wd\si@tab@prebox>\wd\si@tab@postbox\relax
+ \setbox\si@tab@postbox=\hbox to\wd\si@tab@prebox%
+ {\unhbox\si@tab@postbox\hfill}%
+ \else
+ \setbox\si@tab@prebox=\hbox to\wd\si@tab@postbox%
+ {\hfill\unhbox\si@tab@prebox}%
+ \fi
+ \setbox\si@tab@expbox=\hbox{}}
+\newdimen\si@tab@predim
+\newdimen\si@tab@postdim
+\newdimen\si@tab@expdim
+\newdimen\si@tempdima
+\newdimen\si@tempdimb
+\newcommand*{\si@tab@sp}{}
+\newcommand*{\si@tab@fixed}{%
+ \si@log@debug{Using fixed-width S column}%
+ \let\si@tab@sp\relax
+ \setbox\si@tab@midbox=\hbox{}%
+ \setbox\si@tab@expbox=\hbox{}%
+ \setbox\si@tempboxa=\hbox{\si@out@num{1}}%
+ \si@tempdima\wd\si@tempboxa\relax
+ \si@tab@predim\the\si@tab@mantprecnt\si@tempdima\relax
+ \si@tab@sepcorr{mantpre}{pre}%
+ \si@tab@postdim\si@tab@mantpostcnt\si@tempdima\relax
+ \setbox\si@tempboxa=\hbox{\ensuremath{{\si@decimalsymbol}}}%
+ \advance\si@tab@postdim\wd\si@tempboxa\relax
+ \si@tab@sepcorr{mantpost}{post}%
+ \setbox\si@tempboxa=\hbox{\si@out@num{^{1}}}%
+ \si@tempdima\wd\si@tempboxa\relax
+ \ifnum\si@tab@expprecnt>\z@\relax
+ \si@tab@expdim\si@tab@expprecnt\si@tempdima\relax
+ \si@tab@sepcorr{exppre}{exp}%
+ \fi
+ \let\si@tab@sp\sp
+ \ifnum\si@tab@exppostcnt>\z@\relax
+ \advance\si@tab@expdim\si@tab@exppostcnt\si@tempdima\relax
+ \setbox\si@tempboxa=\hbox{%
+ \ensuremath{^{\si@decimalsymbol}}}%
+ \advance\si@tab@expdim\wd\si@tempboxa\relax
+ \si@tab@sepcorr{exppost}{exp}%
+ \fi
+ \setbox\si@tempboxa=\hbox{\ensuremath{-}}%
+ \ifsi@tab@mantsign
+ \advance\si@tab@predim\wd\si@tempboxa\relax
+ \fi
+ \setbox\si@tempboxa=\hbox{\ensuremath{^{-}}}%
+ \ifsi@tab@expsign
+ \advance\si@tab@expdim\wd\si@tempboxa\relax
+ \fi
+ \si@tempcnta\si@tab@expprecnt\relax
+ \advance\si@tempcnta\si@tab@exppostcnt\relax
+ \ifnum\si@tempcnta>\z@\relax
+ \setbox\si@tempboxa=\hbox{\ensuremath{%
+ {}\si@expproduct{}\si@expbase}}%
+ \advance\si@tab@expdim\wd\si@tempboxa\relax
+ \fi
+ \ifsi@tabalignexp\else
+ \advance\si@tab@postdim\si@tab@expdim\relax
+ \fi
+ \setbox\si@tab@prebox=\hbox to\si@tab@predim{\hss\hfill
+ \expandafter\si@out@num\expandafter{\si@tab@out}}%
+ \ifx\@empty\si@num@out\@empty
+ \setbox\si@tab@postbox=\hbox to\si@tab@postdim
+ {\expandafter\si@out@num\expandafter{\si@num@out}\hfil}%
+ \else
+ \ifsi@tabalignexp\else
+ \protected@edef\si@num@out{\si@num@out\si@tab@expout}%
+ \fi
+ \setbox\si@tab@postbox=\hbox to\si@tab@postdim
+ {\ensuremath{{\si@decimalsymbol}}\expandafter\si@out@num
+ \expandafter{\si@num@out}\hfil}%
+ \fi
+ \ifx\@empty\si@tab@expout\@empty
+ \ifsi@tabalignexp
+ \setbox\si@tab@expbox=\hbox to\si@tab@expdim{\hfil}%
+ \fi
+ \else
+ \ifsi@tabalignexp
+ \setbox\si@tab@expbox=\hbox to\si@tab@expdim
+ {\expandafter\si@out@num\expandafter{\si@tab@expout}%
+ \hfil}%
+ \fi
+ \fi}
+\newcommand*{\si@tab@sepcorr}[2]{%
+ \expandafter\si@tempcnta\expandafter\the
+ \csname si@tab@#1cnt\endcsname\relax
+ \divide\si@tempcnta\thr@@\relax
+ \ifsi@sepfour\else
+ \expandafter\ifnum\expandafter\the
+ \csname si@tab@#1cnt\endcsname=4\relax
+ \si@tempcnta\z@\relax
+ \fi
+ \fi
+ \setbox\si@tempboxa=\hbox{%
+ \ensuremath{\si@tab@sp{\si@digitsep}}}%
+ \expandafter\advance\csname si@tab@#2dim\endcsname
+ \si@tempcnta\wd\si@tempboxa}
+\si@newrobustcmd*{\SI}[2][]{%
+ \@ifnextchar[%]
+ {\si@SI[#1]{#2}}
+ {\si@SI[#1]{#2}[]}}
+\si@newrobustcmd*{\si}[2][]{\si@SI[#1]{}[]{#2}}
+\newcommand*{\newunit}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defunit[#1]{#2}{#3}}
+ {\si@log@err{Unit \string#2 already defined!}\@eha}}
+\newcommand*{\renewunit}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@log@err{Unit \string#2 undefined}\@ehc
+ \si@unt@defunit[#1]{#2}{#3}}
+ {\si@log@inf{Redefining unit \string#2}%
+ \si@unt@defunit[#1]{#2}{#3}}}
+\newcommand*{\provideunit}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defunit[#1]{#2}{#3}}
+ {}}
+\newcommand*{\newprefix}[4][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defprefix[#1]{#2}{#3}{#4}}
+ {\si@log@err{Prefix \string#2 already defined!}\@eha}}
+\newcommand*{\renewprefix}[4][]{%
+ \si@ifdefinable{#2}
+ {\si@log@err{Prefix \string#2 undefined}\@ehc
+ \si@unt@defprefix[#1]{#2}{#3}{#4}}
+ {\si@log@inf{Redefining prefix \string#2}%
+ \si@unt@defprefix[#1]{#2}{#3}{#4}}}
+\newcommand*{\provideprefix}[4][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defprefix[#1]{#2}{#3}{#4}}
+ {}}
+\newcommand*{\newpower}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defpower[#1]{#2}{#3}}
+ {\si@log@err{Power \string#2 already defined!}\@eha}}
+\newcommand*{\renewpower}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@log@err{Power \string#2 undefined}\@ehc
+ \si@unt@defpower[#1]{#2}{#3}}
+ {\si@log@inf{Redefining power \string#2}%
+ \si@unt@defpower[#1]{#2}{#3}}}
+\newcommand*{\providepower}[3][]{%
+ \si@ifdefinable{#2}
+ {\si@unt@defpower[#1]{#2}{#3}}
+ {}}
+\newif\ifsi@unt@num
+\newcommand*{\si@unt@unitarg}{}
+\newcommand*{\si@unt@SIopts}{}
+\def\si@SI[#1]#2[#3]#4{%
+ \begingroup
+ \si@ifnotmtarg{#1}
+ {\sisetup{#1}%
+ \renewcommand*{\si@unt@SIopts}{#1}}%
+ \si@unt@numfalse
+ \si@xspacefalse
+ \si@ifnotmtarg{#3}
+ {\si@log@debug{Prefix unit found}%
+ \si@unt@printunit{#3}}%
+ \si@ifnotmtarg{#4}
+ {\renewcommand*{\si@unt@unitarg}{#4}}%
+ \si@ifnotmtarg{#2}
+ {\si@log@debug{Number found in \string\SI\space
+ argument}%
+ \ifsi@repeatunits\else
+ \ifsi@trapambigerr
+ \expandafter\expandafter\expandafter
+ \si@num@ambigerrtrue
+ \fi
+ \fi
+ \num{#2}%
+ \si@unt@numtrue}%
+ \si@ifnotmtarg{#4}
+ {\si@ifmtarg{#2}
+ {\si@unt@printunit{#4}}
+ {\si@tempcnta\z@\relax
+ \ifsi@addunitpower
+ \si@unt@countx{#2}%
+ \fi
+ \ifnum\si@tempcnta>\z@\relax
+ \advance\si@tempcnta\@ne\relax
+ \edef\si@tempa{\noexpand\tothe{\si@tempcnta}}%
+ \renewcommand*{\si@tempb}{#4}%
+ \expandafter\expandafter\expandafter
+ \si@unt@printunit\expandafter\expandafter
+ \expandafter{%
+ \expandafter\si@tempb\si@tempa}%
+ \else
+ \si@unt@printunit{#4}%
+ \fi}}%
+ \endgroup}
+\newcommand*{\si@unt@countx}[1]{%
+ \si@tempcnta\z@\relax
+ \expandafter\si@unt@cntx#1\@empty\@empty}
+\def\si@unt@cntx#1#2\@empty{%
+ \si@str@ifchrstr{#1}{\si@numprod}
+ {\advance\si@tempcnta\@ne\relax}
+ {}%
+ \ifx\@empty#2\@empty\else
+ \si@unt@cntx#2\@empty\@empty
+ \fi}
+\newif\ifsi@unt@littest
+\newcommand*{\si@unt@ifliteral}[1]{%
+ \begingroup
+ \si@unt@littesttrue
+ \setbox\si@tempboxa=\hbox{\si@unt@out{#1}}%
+ \ifdim\wd\si@tempboxa>\z@\relax
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup}
+\newif\ifsi@unt@litout
+\newcommand*{\si@unt@printunit}[1]{%
+ \si@unt@ifliteral{#1}
+ {\si@log@debug{Literal items found in unit
+ argument:\MessageBreak outputting without further
+ processing}%
+ \si@unt@litouttrue
+ \si@unt@addvaluesep
+ \si@unt@out{#1}}
+ {\si@log@debug{Macro unit found:\MessageBreak
+ processing to format output}%
+ \si@unt@init
+ \advance\si@unt@depthcnt\@ne\relax
+ #1%
+ \si@unt@final}}
+\newcommand*{\si@unt@addvaluesep}{%
+ \ifsi@unt@num
+ \expandafter\si@unt@addvalsep
+ \fi}
+\newcommand*{\si@unt@addvalsep}{%
+ \ifsi@unt@litout
+ \expandafter\si@unt@litvalsep
+ \else
+ \expandafter\si@unt@stackvalsep
+ \fi}
+\newcommand*{\si@unt@stackvalsep}{%
+ \protected@edef\si@unt@spstack{\si@valuesep}}
+\newcommand*{\si@unt@litvalsep}{%
+ \nobreak\ensuremath{\si@valuesep}\nobreak}
+\newcommand*{\si@unt@spstack}{}
+\newcommand*{\si@unt@stacka}{}
+\newcommand*{\si@unt@stackb}{}
+\newcount\si@unt@unitcnta
+\newcount\si@unt@unitcntb
+\newcount\si@unt@depthcnt
+\newif\ifsi@unt@first
+\si@unt@depthcnt\m@ne\relax
+\newcommand*{\si@unt@init}{%
+ \begingroup
+ \si@unt@litoutfalse
+ \si@unt@litprefixfalse
+ \si@unt@firsttrue
+ \si@unt@perfalse
+ \si@unt@perseenfalse
+ \si@unt@prepowerfalse
+ \si@unt@depthcnt\z@\relax
+ \si@unt@powerdim\z@\relax
+ \si@unt@unitcnta\z@\relax
+ \si@unt@unitcntb\z@\relax
+ \si@unt@prefixcnt\z@\relax
+ \renewcommand*{\si@unt@spstack}{}%
+ \renewcommand*{\si@unt@stacka}{}%
+ \renewcommand*{\si@unt@stackb}{}%
+ \renewcommand*{\si@unt@holdstacka}{}%
+ \renewcommand*{\si@unt@holdstackb}{}%
+ \renewcommand*{\si@unt@lastadda}{space}%
+ \renewcommand*{\si@unt@lastaddb}{space}}
+\newcommand*{\si@unt@final}{%
+ \si@unt@third
+ \si@unt@stackout
+ \endgroup
+ \ifsi@xspace
+ \expandafter\expandafter\expandafter\xspace
+ \fi}
+\newcommand*{\si@unt@defunit}[3][]{%
+ \si@log@debug{Declaring unit \string#2 with \MessageBreak
+ meaning \string#3}%
+ \si@ifnotmtarg{#1}
+ {\expandafter\@namedef\expandafter{%
+ \expandafter\@gobble\string#2@opt@unt@si}{#1}}%
+ \protected\def#2{%
+ \ifsi@allowoptarg
+ \expandafter\si@unt@withopt
+ \else
+ \expandafter\si@unt@noopt
+ \fi
+ {#2}{#3}}}
+\newcommand*{\si@unt@withopt}[2]{%
+ \@ifnextchar[%]
+ {\si@unt@opt{#1}{#2}}
+ {\si@unt@opt{#1}{#2}[]}}
+\newcommand*{\si@unt@noopt}[2]{\si@unt@opt{#1}{#2}[]}
+\def\si@unt@opt#1#2[#3]{%
+ \ifsi@unt@littest
+ \expandafter\si@gobblethree
+ \else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\si@unt@unit
+ \fi
+ \fi
+ {#3}{#1}{#2}}
+\long\def\si@gobblethree #1#2#3{}
+\newif\ifsi@unt@litprefix
+\si@unt@litprefixtrue
+\newcommand*{\si@unt@defprefix}[4][]{%
+ \si@log@debug{Declaring multiple \string#1 with\MessageBreak
+ meaning \string#4}%
+ \expandafter\expandafter\expandafter\def\expandafter
+ \csname\expandafter\@gobble\string#2@opt@si\endcsname{#1}%
+ \protected\def#2{%
+ \ifsi@unt@littest
+ \expandafter\si@gobblethree
+ \else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \ifsi@unt@litprefix
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@unt@prefix
+ \fi
+ \fi
+ \fi
+ {#2}{#3}{#4}}}
+\newcommand*{\si@unt@defpower}[3][]{%
+ \si@log@debug{Declaring power \string#2 with\MessageBreak
+ meaning \string#3}%
+ \expandafter\expandafter\expandafter\def\expandafter
+ \csname\expandafter\@gobble\string#2@opt@si\endcsname{#1}%
+ \protected\def#2{%
+ \ifsi@unt@littest
+ \expandafter\@gobbletwo
+ \else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\si@unt@litpower
+ \else
+ \expandafter\expandafter\expandafter\si@unt@power
+ \fi
+ \fi
+ {#2}{#3}}}
+\newcommand*{\si@unt@unithook}{}
+\newcommand*{\si@unt@unit}[3]{%
+ \ifnum\si@unt@depthcnt=\m@ne\relax
+ \expandafter\si@unt@init
+ \fi
+ \advance\si@unt@depthcnt\@ne\relax
+ \si@log@debug{Unit processing: level \the\si@unt@depthcnt,
+ \MessageBreak unit \string#2}%
+ \si@unt@firstorsecond{#1}{#2}%
+ \si@unt@ifliteral{#3}
+ {\si@unt@addtostack{unit}{#3}%
+ \ifsi@unt@prepower
+ \expandafter\si@unt@stkpower
+ \fi}
+ {#3}%
+ \advance\si@unt@depthcnt\m@ne\relax
+ \ifnum\si@unt@depthcnt=\z@\relax
+ \expandafter\si@unt@final
+ \fi}
+\newcommand*{\si@unt@firstorsecond}[2]{%
+ \ifsi@unt@first
+ \expandafter\si@unt@first
+ \else
+ \expandafter\si@unt@second
+ \fi
+ {#1}{#2}}%
+\newcommand*{\si@unt@first}[2]{%
+ \si@ifnotmtarg{#1}
+ {\num{#1}%
+ \si@unt@numtrue}%
+ \si@unt@unithook
+ \ifcsname\expandafter\@gobble\string#2@opt@unt@si\endcsname
+ \expandafter\si@unt@setopts
+ \else
+ \expandafter\@gobble
+ \fi
+ {#2}%
+ \si@unt@addvaluesep
+ \si@unt@firstfalse}
+\newcommand*{\si@unt@setopts}[1]{%
+ \expandafter\expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\si@temptoks\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter{\expandafter%
+ \csname\expandafter\@gobble\string#1@opt@unt@si%
+ \endcsname}%
+ \expandafter\sisetup\expandafter{\the\si@temptoks}%
+ \si@log@debug{Applying options `\the\si@temptoks'
+ for\MessageBreak unit \string#1}%
+ \@ifundefined{si@unt@SIopts}{}
+ {\ifx\@empty\si@unt@SIopts\@empty\else
+ \expandafter\expandafter\si@unt@setSIopts
+ \fi}}
+\newcommand*{\si@unt@setSIopts}{%
+ \expandafter\si@temptoks\expandafter{\si@unt@SIopts}%
+ \expandafter\sisetup\expandafter{\the\si@temptoks}}
+\newcommand*{\si@unt@second}[2]{%
+ \si@ifnotmtarg{#1}
+ {\si@log@warn{Optional argument to unit macro\MessageBreak
+ allowed only for outer unit}}%
+ \si@unt@third
+ \si@unt@addtostack{space}{\ensuremath{\si@unitsep}}}
+\newcommand*{\si@unt@third}{%
+ \ifsi@unt@prepower\else
+ \expandafter\si@unt@stkpower
+ \fi
+ \renewcommand*{\si@tempa}{prefix}%
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname\si@tempa
+ \else
+ \expandafter\si@unt@spacecheck
+ \fi
+ \ifsi@unt@per
+ \expandafter\si@unt@perseentrue
+ \fi}
+\newcommand*{\si@unt@spacecheck}{%
+ \renewcommand*{\si@tempa}{space}%
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname\si@tempa
+ \else
+ \expandafter\si@unt@reciptest
+ \fi}
+\newcommand*{\si@unt@prefix}[3]{%
+ \si@unt@firstorsecond{}{#1}%
+ \ifsi@prefixsymbolic
+ \expandafter\si@unt@addprefix
+ \else
+ \expandafter\si@unt@countprefix
+ \fi
+ {#1}{#2}{#3}}
+\newcommand*{\si@unt@addprefix}[3]{%
+ \si@unt@addtostack{prefix}{#3}}
+\newcount\si@unt@prefixcnt
+\newcommand*{\si@unt@countprefix}[3]{%
+ \renewcommand*{\si@tempa}{binary}%
+ \expandafter\expandafter\expandafter\ifx\expandafter
+ \csname\expandafter\@gobble\string#1@opt@si\endcsname
+ \si@tempa
+ \expandafter\sisetup
+ \else
+ \expandafter\@gobble
+ \fi
+ {prefixbase=two}%
+ \si@tempcnta#2\relax
+ \ifsi@unt@per
+ \expandafter\si@unt@invprefix
+ \fi
+ \advance\si@unt@prefixcnt\si@tempcnta\relax}
+\newcommand*{\si@unt@invprefix}{%
+ \si@tempcntb\si@tempcnta\relax
+ \si@tempcnta -\si@tempcntb\relax}
+\newcommand*{\si@unt@litpower}[2]{\textsuperscript{#2}}
+\newif\ifsi@unt@prepower
+\newcommand*{\si@unt@power}[2]{%
+ \renewcommand*{\si@tempa}{post}%
+ \expandafter\expandafter\expandafter\ifx\expandafter
+ \csname\expandafter\@gobble\string#1@opt@si\endcsname
+ \si@tempa
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\si@unt@firstorsecond
+ \fi
+ {}{\power}%
+ \si@unt@powerdim #2 pt\relax
+ \ifsi@frac\else
+ \ifsi@unt@per
+ \expandafter\expandafter\expandafter\si@unt@invpower
+ \fi
+ \fi
+ \renewcommand*{\si@tempa}{post}%
+ \si@unt@prepowertrue
+ \expandafter\expandafter\expandafter\ifx\expandafter
+ \csname\expandafter\@gobble\string#1@opt@si\endcsname
+ \si@tempa
+ \expandafter\si@unt@stackpower
+ \else
+ \si@log@debug{Power \strip@pt\si@unt@powerdim\space saved
+ to be added after\MessageBreak next unit}%
+ \fi}
+\newdimen\si@unt@powerdim
+\newcommand*{\si@unt@stackpower}{%
+ \si@unt@prepowerfalse
+ \si@unt@stkpower
+ \ifsi@stickyper\else
+ \si@unt@perfalse
+ \si@unt@perseenfalse
+ \fi}
+\newcommand*{\si@unt@stkpower}{%
+ \ifdim\si@unt@powerdim=\m@ne pt\relax
+ \ifsi@frac\else
+ \expandafter\expandafter\expandafter\si@unt@stkpwr
+ \fi
+ \else
+ \expandafter\si@unt@stkpwr
+ \fi}
+\newcommand*{\si@unt@stkpwr}{%
+ \ifdim\si@unt@powerdim=\z@\relax\else
+ \renewcommand*{\si@tempa}{unit}%
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname
+ \si@tempa
+ \si@log@debug{Adding power
+ \strip@pt\si@unt@powerdim\space to output stack}%
+ \si@unt@addtostack{power}{^{\num{%
+ \strip@pt\si@unt@powerdim}}}%
+ \fi
+ \fi
+ \si@unt@powerdim\z@\relax}
+\newcommand*{\si@unt@invpower}{%
+ \si@tempdima\si@unt@powerdim\relax
+ \si@unt@powerdim -\si@tempdima\relax
+ \ifdim\si@unt@powerdim=\p@\relax
+ \si@unt@powerdim\z@\relax
+ \fi}
+\newif\ifsi@unt@per
+\newif\ifsi@unt@perseen
+\si@newrobustcmd*{\si@per}{%
+ \ifsi@unt@littest\else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter /%
+ \else
+ \ifsi@unt@litprefix
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter /%
+ \else
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@unt@per
+ \fi
+ \fi
+ \fi}
+\newcommand*{\si@unt@per}{%
+ \si@unt@firstorsecond{}{\per}%
+ \ifsi@unt@per
+ \ifsi@stickyper\else
+ \expandafter\expandafter\expandafter\si@unt@perfalse
+ \fi
+ \else
+ \expandafter\si@unt@pertrue
+ \fi}
+\let\per\si@per
+\newcommand*{\si@unt@reciptest}{%
+ \ifsi@unt@per
+ \ifsi@unt@perseen
+ \expandafter\expandafter\expandafter\si@unt@recip
+ \fi
+ \fi}
+\newcommand*{\si@unt@recip}{%
+ \si@unt@powerdim\m@ne pt\relax
+ \si@unt@stackpower}
+\newcommand*{\si@unt@lastadda}{}
+\newcommand*{\si@unt@lastaddb}{}
+\newcommand*{\si@unt@addtostack}[2]{%
+ \renewcommand*{\si@tempa}{#1}%
+ \expandafter\ifx
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname\si@tempa
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\si@unt@preplussp
+ \fi
+ {#1}{#2}}
+\newcommand*{\si@unt@preplussp}[2]{%
+ \renewcommand*{\si@tempa}{prefix+space}%
+ \edef\si@tempb{%
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname+#1}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\si@unt@stack
+ \fi
+ {#1}{#2}}
+\newcommand*{\si@unt@stack}[2]{%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@unt@lastadd\si@unt@checkstack\endcsname}{#1}%
+ \renewcommand*{\si@tempa}{#1}%
+ \renewcommand*{\si@tempb}{unit}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@unt@inccnt
+ \fi
+ \renewcommand*{\si@tempb}{space}%
+ \ifx\si@tempa\si@tempb
+ \expandafter\si@unt@holdspace
+ \else
+ \expandafter\si@unt@addstack
+ \fi
+ {#2}}
+\newcommand*{\si@unt@inccnt}{%
+ \expandafter\advance
+ \csname si@unt@unitcnt\si@unt@checkstack\endcsname
+ \@ne\relax}
+\newcommand*{\si@unt@holdstacka}{}
+\newcommand*{\si@unt@holdstackb}{}
+\newcommand*{\si@unt@holdspace}[1]{%
+ \renewcommand*{\si@tempa}{b}%
+ \edef\si@tempb{\si@unt@checkstack}%
+ \ifx\si@tempa\si@tempb
+ \ifx\@empty\si@unt@stackb\@empty
+ \else
+ \expandafter\protected@edef
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname{#1}%
+ \fi
+ \else
+ \expandafter\protected@edef
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname{#1}%
+ \fi}
+\newcommand*{\si@unt@addstack}[1]{%
+ \expandafter\protected@edef
+ \csname si@unt@stack\si@unt@checkstack\endcsname
+ {\csname si@unt@stack\si@unt@checkstack\endcsname
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname#1}%
+ \expandafter\renewcommand\expandafter*\expandafter{%
+ \csname si@unt@holdstack\si@unt@checkstack\endcsname}{}}
+\newcommand*{\si@unt@stackout}{%
+ \si@unt@litouttrue
+ \ifsi@frac
+ \expandafter\si@unt@fracout
+ \else
+ \expandafter\si@unt@normout
+ \fi}
+\newcommand*{\si@unt@checkstack}{%
+ \ifsi@frac
+ \ifsi@unt@per
+ \expandafter\expandafter\expandafter b%
+ \else
+ \expandafter\expandafter\expandafter a%
+ \fi
+ \else
+ \expandafter a%
+ \fi}
+\newcommand*{\si@unt@spaceout}{%
+ \ensuremath{\si@unt@spstack}}
+\newcommand*{\si@unt@prefixout}{%
+ \ifnum\si@unt@prefixcnt=\z@\relax\else
+ \ifsi@unt@num
+ \si@out{\ensuremath{{}\si@prefixproduct{}}}%
+ \fi
+ \si@unt@stackvalsep
+ \let\si@expbase\si@prefixbase
+ \num{e\the\si@unt@prefixcnt}%
+ \fi}
+\newcommand*{\si@unt@normout}{%
+ \si@unt@prefixout
+ \si@unt@spaceout
+ \expandafter\si@unt@out\expandafter{\si@unt@stacka}}
+\newcommand*{\si@unt@fracout}{%
+ \si@unt@notambig
+ \ifx\@empty\si@unt@stacka\@empty
+ \ifx\@empty\si@unt@stackb\@empty
+ \ifsi@unt@litout\else
+ \si@log@err{Empty fractional unit}{The unit
+ argument\MessageBreak given does not contain any
+ symbols}%
+ \fi
+ \else
+ \ifsi@slash
+ \si@unt@prefixout
+ \si@frac{}{\si@unt@stackb}%
+ \else
+ \si@unt@prefixout
+ \si@unt@spaceout
+ \si@frac{1}{\si@unt@stackb}%
+ \fi
+ \fi
+ \else
+ \ifx\@empty\si@unt@stackb\@empty
+ \si@unt@normout
+ \else
+ \si@unt@prefixout
+ \si@unt@spaceout
+ \si@frac{\si@unt@stacka}{\si@unt@stackb}%
+ \fi
+ \fi}
+\newcommand*{\si@unt@notambig}{%
+ \ifnum\si@unt@unitcntb>\@ne\relax
+ \ifsi@slash
+ \ifsi@trapambigfrac
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@unt@notabg
+ \fi
+ \fi
+ \fi}
+\newcommand*{\si@unt@notabg}{%
+ \protected@edef\si@unt@stackb{\si@openfrac\si@unt@stackb
+ \si@closefrac}}
+\begingroup
+ \catcode`\~=\active
+ \catcode`\.=\active
+ \gdef\si@unt@out#1{%
+ \begingroup
+ \si@unt@nonlatin
+ \makeatletter
+ \catcode`\~=\active
+ \catcode`\.=\active
+ \def~{\ensuremath{\si@unitspace}}%
+ \def.{\ensuremath{\si@unitsep}}%
+ \endlinechar\m@ne
+ \si@out{\scantokens{#1}}%
+ \endgroup}
+\endgroup
+\newcommand*{\si@unt@nonlatin}{}
+\ifdefined\XeTeXrevision
+ \renewcommand*{\si@unt@nonlatin}{%
+ \catcode176=\active
+ \catcode181=\active
+ \catcode197=\active
+ \si@unt@sym{176}{\si@sym@degree}%
+ \si@unt@sym{181}{\si@sym@mu}%
+ \si@unt@sym{197}{\si@sym@ringA}}%
+\fi
+\AtBeginDocument{
+ \@ifpackageloaded{inputenc}
+ {\@for\si@tempa:=latin1,latin5,latin9\do{
+ \ifx\inputencodingname\si@tempa
+ \renewcommand*{\si@unt@nonlatin}{%
+ \catcode176=\active
+ \catcode181=\active
+ \catcode197=\active
+ \si@unt@sym{176}{\si@sym@degree}%
+ \si@unt@sym{181}{\si@sym@mu}%
+ \si@unt@sym{197}{\si@sym@ringA}}%
+ \fi}}
+ {}}
+\newcommand*{\si@unt@sym}[1]{%
+ \bgroup
+ \uccode`\~#1%
+ \uppercase{%
+ \egroup
+ \def~}}
+\newunit{\kilogram}{kg}
+\newunit{\metre}{m}
+\newunit{\meter}{\metre}
+\newunit{\mole}{mol}
+\newunit{\second}{s}
+\newunit{\ampere}{A}
+\newunit{\kelvin}{K}
+\newunit{\candela}{cd}
+\newpower{\Square}{2}
+\newpower{\ssquare}{2}
+\newpower[post]{\squared}{2}
+\newpower{\cubic}{3}
+\newpower[post]{\cubed}{3}
+\newcommand*{\tothe}{\si@tothe{\tothe}}
+\newcommand*{\raiseto}{\si@tothe{\raiseto}}
+\newcommand*{\si@tothe}[2]{%
+ \ifsi@unt@littest
+ \expandafter\@gobbletwo
+ \else
+ \ifsi@unt@litout
+ \expandafter\expandafter\expandafter\si@unt@litpower
+ \else
+ \expandafter\expandafter\expandafter\si@unt@power
+ \fi
+ \fi
+ {#1}{#2}}
+\newcommand*{\tothe@opt@si}{post}
+\newcommand*{\raiseto@opt@si}{}
+\newcommand*{\si@loc@load}[1]{%
+ \let\si@loc@sisetup\sisetup
+ \renewcommand*{\sisetup}[1]{%
+ \expandafter\gdef\csname si@loc@#1\endcsname{##1}}
+ \si@loadfile{#1}%
+ \let\sisetup\si@loc@sisetup}
+\newcommand*{\si@loc@set}[1]{%
+ \ifcsname si@loc@#1\endcsname
+ \si@log@inf{Setting locale to `#1'}%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\si@temptoks
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter{%
+ \expandafter\csname si@loc@#1\endcsname}%
+ \expandafter\sisetup\expandafter{\the\si@temptoks}%
+ \ifcsname si@loc@#1@extra\endcsname
+ \csname si@loc@#1@extra\endcsname
+ \fi
+ \else
+ \ifcsname si@loc@#1@extra\endcsname
+ \si@log@inf{Setting locale to `#1'}%
+ \csname si@loc@#1@extra\endcsname
+ \else
+ \si@log@warn{Unknown locale `#1'}%
+ \fi
+ \fi}
+\newcommand*{\si@loc@ltol}[1]{%
+ \def\si@tempa##1:##2\@nil{\si@loc@load{##1}}
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb:\@nil}
+ \AtBeginDocument{
+ \@ifpackageloaded{babel}
+ {\def\si@tempa##1:##2:##3\@nil{%
+ \expandafter\addto\expandafter{%
+ \csname extras##2\endcsname}%
+ {\si@loc@set{##1}}}%
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb::\@nil}}
+ {\si@log@warn{babel not loaded \MessageBreak
+ loctolang option ignored}}}}
+\AtBeginDocument{
+ \@ifpackageloaded{babel}
+ {\renewcommand*{\si@loc@ltol}[1]{%
+ \def\si@tempa##1:##2\@nil{\si@loc@load{##1}}%
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb:\@nil}%
+ \def\si@tempa##1:##2:##3\@nil{%
+ \expandafter\addto\expandafter{%
+ \csname extras##2\endcsname}%
+ {\si@loc@set{##1}}}%
+ \@for\si@tempb:=#1\do{%
+ \expandafter\si@tempa\si@tempb::\@nil}}}
+ {\renewcommand*{\si@loc@ltol}[1]{%
+ \si@log@warn{babel not loaded \MessageBreak
+ loctolang option ignored}}}}
+\newcommand*{\addtolocale}[2]{%
+ \si@addtocsname{si@loc@#1@extra}{#2}}
+\begingroup
+ \catcode`\^=\active\relax
+ \catcode`\-=\active\relax
+ \gdef\si@out#1{%
+ \begingroup
+ \catcode`\^=\active\relax
+ \makeatletter
+ \endlinechar\m@ne
+ \ifsi@fam@set\else
+ \expandafter\si@fam@set
+ \fi
+ \si@colourcmd{\si@colour}%
+ \text{\si@fam@italic\si@fam@bold\si@fam@text
+ \ifsi@textmode
+ \expandafter\si@out@text
+ \else
+ \expandafter\si@out@maths
+ \fi
+ {\scantokens{#1}}}%
+ \endgroup
+ \check@mathfonts}
+ \gdef\si@out@text#1{%
+ \let^\si@out@sp
+ \let\textsuperscript\si@out@sp
+ \catcode`\-=\active\relax
+ \let-\si@out@minus
+ #1}
+ \gdef\si@out@maths#1{%
+ \let^\sp
+ \let\textsuperscript\sp
+ $\si@fam@maths{#1}$}
+\endgroup
+\newcommand*{\si@out@sp}[1]{\ensuremath{^{\text{#1}}}}
+\newcommand*{\si@out@minus}{\ensuremath{-}}
+\newif\ifsi@out@num
+\newcommand*{\si@out@num}[1]{%
+ \begingroup
+ \si@out@numtrue
+ \si@out{#1}%
+ \endgroup}
+\newcommand*{\si@extension}{cfg}
+\newcommand*{\si@fileprefix}{si-}
+\newcommand*{\si@ifl@aded}{}
+\let\si@ifl@aded\@ifl@aded
+\newcommand*{\si@ifloaded}[1]{%
+ \si@ifl@aded\si@extension{\si@fileprefix#1}}
+\newcommand*{\si@loadfile}[1]{%
+ \si@ifloaded{#1}{}
+ {\InputIfFileExists{\si@fileprefix#1.\si@extension}
+ {}
+ {\si@log@err{Failed to load file
+ \si@fileprefix#1.\si@extension}
+ {The configuration file requested could not be
+ found}}}}
+\newcommand*{\requiresiconfigs}[1]{%
+ \@for\si@tempb:=#1\do{\si@loadfile{\si@tempb}}}
+\newcommand*{\si@loademfile}[1]{%
+ \@ifpackageloaded{#1}
+ {\si@log@err{Emulation clash for package `#1'}
+ {You have asked for emulation of package
+ `#1'\MessageBreak
+ (perhaps by giving siunitx a back-compatibility
+ option)\MessageBreak but the package is already
+ loaded!}}
+ {\si@loadfile{#1}}}
+\newcommand*{\si@emclash}[2]{%
+ \si@log@err{Emulation clash: `#1' and `#2'}
+ {You have asked for emulation of package `#1'\MessageBreak
+ but have already loaded emulation of `#2'}}
+\newcommand*{\si@emulating}[2]{%
+ \@namedef{ver@#1.sty}{#2 siunitx emulation of #1}%
+ \let\si@tempa\si@blockpkgs
+ \renewcommand*{\si@blockpkgs}{}%
+ \@for\si@tempb:=\si@tempa\do{%
+ \renewcommand*{\si@tempa}{#1}%
+ \ifx\si@tempa\si@tempb\else
+ \lowercase{\edef\si@tempa{#1}}%
+ \lowercase{\edef\si@tempc{\si@tempb}}%
+ \ifx\si@tempa\si@tempc
+ \@namedef{ver@\si@tempc.sty}{#2 siunitx emulation of
+ #1}%
+ \else
+ \si@addtolist{\si@blockpkgs}{\si@tempb}%
+ \fi
+ \fi}%
+ \let\si@tempa\si@checkpkgs
+ \renewcommand*{\si@checkpkgs}{}%
+ \renewcommand*{\si@tempb}{#1}%
+ \@for\si@tempc:=\si@tempa\do{%
+ \ifx\si@tempb\si@tempc\else
+ \si@addtolist{\si@checkpkgs}{\si@tempc}%
+ \fi}}
+\sisetup{
+ addsign=none,
+ allowzeroexp=false,
+ angformat=unchanged,
+ astroang=false,%(
+ closeerr=),%(
+ closefrac=),
+ colour=black,
+ colourall=false,
+ colourneg=false,
+ decimalsymbol=fullstop,
+ detectdisplay=true,
+ digitsep=thin,
+ dp=3,
+ eVcorra=0.3ex,
+ eVcorrb=0ex,
+ errspace=none,
+ fixdp=false,
+ inlinebold=text,
+ load=default,
+ mathsrm=mathrm,
+ mathssf=mathsf,
+ mathstt=mathtt,
+ mode=maths,
+ negcolour=red,
+ noload={},
+ numaddn={},%(
+ numcloseerr=),%
+ numdecimal={.,},
+ numdigits=0123456789,
+ numexp=eEdD,
+ numgobble={},
+ numopenerr=(,%)
+ numprod=x,
+ numsign=+-\pm\mp,
+ obeybold=false,
+ obeyitalic=false,
+ obeymode=false,
+ openerr=(,%)
+ openfrac=(,%)
+ padangle=small,
+ padnumber=lead,
+ per=reciprocal,
+ prefixbase=ten,
+ prefixproduct=times,
+ prefixsymbolic=true,
+ prespace=false,
+ redefsymbols=true,
+ repeatunits=true,
+ retainplus=false,
+ seperr=false,
+ sepfour=false,
+ sign=plus,
+ slash=slash,
+ stickyper=false,
+ strictarc=true,
+ tabalignexp=true,
+ tabautofit=false,
+ tabformat=3.2,
+ tabnumalign=centredecimal,
+ tabtextalign=centre,
+ tabunitalign=left,
+ textrm=rmfamily,
+ textsf=sffamily,
+ texttt=ttfamily,
+ tightpm=false,
+ trapambigerr=true,
+ trapambigfrac=true,
+ unitsep=thin,
+ valuesep=thin,
+ xspace=false}
+\ProcessOptionsX[si]<key>
+\ifx\@empty\si@emulate\@empty\else
+ \@for\si@tempa:=\si@emulate\do{%
+ \si@loademfile{\si@tempa}}
+\fi
+\newcommand*{\si@expanddefault}[2]{%
+ \expandafter\ifx\expandafter\@empty\csname si@#1\endcsname
+ \@empty
+ \else
+ \renewcommand*{\si@tempb}{default}%
+ \renewcommand*{\si@tempc}{}%
+ \expandafter\@for\expandafter\si@tempa\expandafter
+ :\expandafter=\csname si@#1\endcsname\do{%
+ \ifx\si@tempa\si@tempb
+ \si@addtolist{\si@tempc}{#2}%
+ \else
+ \si@addtolist{\si@tempc}{\si@tempa}%
+ \fi}
+ \expandafter\edef\csname si@#1\endcsname{\si@tempc}%
+ \expandafter\si@addtolist\expandafter{%
+ \csname si@no#1\endcsname}%
+ {default}%
+ \renewcommand*{\si@tempc}{}%
+ \expandafter\@for\expandafter\si@tempa\expandafter
+ :\expandafter=\csname si@#1\endcsname\do{%
+ \si@switchfalse
+ \expandafter\@for\expandafter\si@tempb\expandafter
+ :\expandafter=\csname si@no#1\endcsname\do{%
+ \ifx\si@tempa\si@tempb
+ \si@switchtrue
+ \fi
+ \ifsi@switch\else
+ \si@addtolist{\si@tempc}{\si@tempa}%
+ \fi}}
+ \@for\si@tempa:=\si@tempc\do{%
+ \si@loadfile{\si@tempa}}%
+ \fi}
+\si@expanddefault{load}{prefix,named,addn,prefixed,accepted,%
+ physical,abbr}
+\IfFileExists{siunitx.cfg}
+ {\si@log@inf{Local configuration file found}%
+ \InputIfFileExists{siunitx.cfg}{}{}}
+ {}
+\si@catcodes
+\endinput
+%%
+%% End of file `siunitx.sty'.