summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-04-13 23:04:19 +0000
committerKarl Berry <karl@freefriends.org>2011-04-13 23:04:19 +0000
commit6470270a312bdbe3f58c8c38d6816a070353f45a (patch)
treeb7b32517524a951306cd07bf851e749f05aad6b8 /Master/texmf-dist
parentfd7e3be3872bf1a2c79d93843ba6f38549740093 (diff)
siunitx 2.2 (13apr11)
git-svn-id: svn://tug.org/texlive/trunk@22076 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/README6
-rw-r--r--Master/texmf-dist/doc/latex/siunitx/siunitx.pdfbin523621 -> 544100 bytes
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx8352
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.ins6
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg9
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg5
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg89
-rw-r--r--Master/texmf-dist/tex/latex/siunitx/siunitx.sty942
8 files changed, 5333 insertions, 4076 deletions
diff --git a/Master/texmf-dist/doc/latex/siunitx/README b/Master/texmf-dist/doc/latex/siunitx/README
index a104e81e305..b733662a20d 100644
--- a/Master/texmf-dist/doc/latex/siunitx/README
+++ b/Master/texmf-dist/doc/latex/siunitx/README
@@ -30,8 +30,8 @@ The package is supplied in dtx format and as a pre-extracted zip
file, siunitx.tds.zip. The later is most convenient for most
users: simply unzip this in your local texmf directory and run
texhash to update the database of file locations. If you want to
-unpack the dtx yourself, running 'tex siunitx.dtx' will extract
-the package whereas 'latex siunitx.dtx will extract it and also
+unpack the dtx yourself, running "tex siunitx.dtx" will extract
+the package whereas "latex siunitx.dtx" will extract it and also
typeset the documentation.
The package requires LaTeX3 support as provided in the expl3
@@ -49,12 +49,14 @@ text. To compile the documentation without error, you will
need the packages:
- amsmath
- booktabs
+ - cancel
- caption
- cleveref
- csquotes
- datatool
- helvet
- mathpazo
+ - multirow
- listings
- pgfplots
- xcolor
diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
index 5e6daae647d..092dbf74abc 100644
--- a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
+++ 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
index 6b78479d6f0..640c97b8c57 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
@@ -20,9 +20,9 @@ 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 package provides a set of tools for authors to
+The siunitx package provides a set of tools for authors to
typeset quantities in a consistent way. The package has
-an extended set of configuration options which make it possible
+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
@@ -32,38 +32,40 @@ Installation
------------
The package is supplied in dtx format and as a pre-extracted zip
-file, siunitx.tds.zip. The later is most convenient for most
-users: simply unzip this in your local texmf directory and run
+file, siunitx.tds.zip. The later is most convenient for most
+users: simply unzip this in your local texmf directory and run
texhash to update the database of file locations. If you want to
-unpack the dtx yourself, running 'tex siunitx.dtx' will extract
-the package whereas 'latex siunitx.dtx will extract it and also
+unpack the dtx yourself, running "tex siunitx.dtx" will extract
+the package whereas "latex siunitx.dtx" will extract it and also
typeset the documentation.
-The package requires LaTeX3 support as provided in the expl3
+The package requires LaTeX3 support as provided in the expl3
and xpackages bundles. Both of these are available on CTAN
(http://www.ctan.org/) as ready-to-install zip files. Suitable
-versions are available in MiKTeX 2.9 and TeX Live 2010
-(updating the relevant packages online may be necessary).
-LaTeX3, and so siunitx, requires the e-TeX extensions: these
+versions are available in MiKTeX 2.9 and TeX Live 2010
+(updating the relevant packages online may be necessary).
+LaTeX3, and so siunitx, requires the e-TeX extensions: these
are available on all modern TeX systems.
Typesetting the documentation requires a number of packages in
-addition to those needed to use the package. This is mainly
-because of the number of demonstration items included in the
-text. To compile the documentation without error, you will
+addition to those needed to use the package. This is mainly
+because of the number of demonstration items included in the
+text. To compile the documentation without error, you will
need the packages:
- amsmath
- booktabs
+ - cancel
- caption
- cleveref
- csquotes
- datatool
- helvet
- mathpazo
+ - multirow
- listings
- pgfplots
- xcolor
-The xfrac package is also loaded if available, but is not
+The xfrac package is also loaded if available, but is not
required to typeset the documentation.
%</readme>
%<*internal>
@@ -88,7 +90,6 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-
Copyright (C) 2008-2011 by
Joseph Wright <joseph.wright@morningstar2.co.uk>
@@ -96,9 +97,7 @@ It may be distributed and/or modified under the conditions of
the LaTeX Project Public License (LPPL), either version 1.3c of
this license or (at your option) any later version. The latest
version of this license is in the file:
-
http://www.latex-project.org/lppl.txt
-
This work is "maintained" (as per LPPL maintenance status) by
Joseph Wright.
@@ -113,7 +112,7 @@ This work consists of the file siunitx.dtx
\file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
\usedir{tex/latex/siunitx/config}
-\generate{
+\generate{
\file{siunitx-abbreviations.cfg}
{\from{\jobname.dtx}{config,abbreviations}}
\file{siunitx-binary.cfg}{\from{\jobname.dtx}{config,binary}}
@@ -143,14 +142,14 @@ This work consists of the file siunitx.dtx
%<*driver>
\documentclass[german,french,english,UKenglish]{l3doc}
-\usepackage{amsmath,babel,booktabs,caption,colortbl,csquotes,datatool}
-\usepackage{helvet,pgfplots,siunitx,xcolor,xtab}
+\usepackage{amsmath,babel,booktabs,cancel,caption,colortbl,csquotes}
+\usepackage{datatool,helvet,multirow,pgfplots,siunitx,xcolor,xtab}
\IfFileExists{xfrac.sty}
{\usepackage{xfrac}}
{%
\PackageWarningNoLine{siunitx}
{%
- xfrac unavailable: \string\sfrac\space fraction \MessageBreak
+ xfrac unavailable: \string\sfrac\space fraction\MessageBreak
will have wrong appearance%
}
}
@@ -161,11 +160,10 @@ This work consists of the file siunitx.dtx
% Silence annoying fp package messages
\FPmessagesfalse
-
\pgfplotsset{compat = newest}
\sisetup{
- load-configurations =
+ load-configurations =
{
abbreviations,
binary,
@@ -177,19 +175,21 @@ This work consists of the file siunitx.dtx
\DeclareSIQualifier\catalyst{cat}
\DeclareSIQualifier\isotropic{i}
\DeclareSIQualifier\polymer{pol}
+
+\newlength\mylength
%\DisableImplementation
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
-%
+%
%\makeatletter
%
%^^A Some short cuts for the tables
%\NewDocumentCommand\DescribePrefix{m}{^^A
% \expandafter\SpecialUsageIndex\expandafter{\csname #1\endcsname}^^A
-% #1 & \cs{#1} & \expandafter\si\expandafter{\csname #1\endcsname}
+% #1 & \cs{#1} & \expandafter\si\expandafter{\csname #1\endcsname}
%}
%\NewDocumentCommand\DescribeUnit{m}{^^A
% \expandafter\SpecialUsageIndex\expandafter{\csname #1\endcsname}^^A
@@ -230,7 +230,7 @@ This work consists of the file siunitx.dtx
% gobble = 3,
% keywordstyle = \color{blue},
% language = [LaTeX]{TeX},
-% moretexcs =
+% moretexcs =
% {
% addto,
% ampere,
@@ -241,6 +241,7 @@ This work consists of the file siunitx.dtx
% bit,
% bottomrule,
% byte,
+% cancel,
% candela,
% centi,
% color,
@@ -258,7 +259,6 @@ This work consists of the file siunitx.dtx
% DeclareSIPrePower,
% DeclareSIQualifier,
% DeclareSIUnit,
-% DeclareSIUnitWithOptions,
% DTLdisplaydb,
% DTLforeach,
% DTLiffirstrow,
@@ -270,6 +270,7 @@ This work consists of the file siunitx.dtx
% gram,
% gray,
% henry,
+% highlight,
% hour,
% Hz,
% joule,
@@ -277,6 +278,7 @@ This work consists of the file siunitx.dtx
% kibi,
% kilo,
% kilogram,
+% kWh,
% litre,
% lumen,
% lux,
@@ -288,6 +290,7 @@ This work consists of the file siunitx.dtx
% milli,
% mm,
% mole,
+% multirow,
% num,
% numlist,
% numrange,
@@ -305,23 +308,24 @@ This work consists of the file siunitx.dtx
% SendSettingsToPgf,
% si,
% SI,
-% sievert,
% SIlist,
% SIrange,
+% sievert,
% sisetup,
% SIUnitSymbolDegree,
% square,
% squared,
+% tablenum,
% tesla,
% texorpdfstring,
% text,
% toprule,
% tothe,
% translate,
+% unit,
% volt,
-% kWh,
% }
-% }^^A
+% }^^A
%}
%\newcommand*\LaTeXdemo@input{^^A
% \MakePercentComment
@@ -332,7 +336,7 @@ This work consists of the file siunitx.dtx
% {
% SelectCharTable=\lst@ReplaceInput{\^\^I}{\lst@ProcessTabulator}
% }^^A
-% \leavevmode
+% \leavevmode
% \input{\jobname.tmp}^^A
% \endgroup
% \MakePercentIgnore
@@ -372,7 +376,7 @@ This work consists of the file siunitx.dtx
%}
%\LaTeXdemo@new{code only}
% {\LaTeXdemo@common}{}
-%
+%
%^^A Turning of the marginpar warnings is a bit awkward.
%^^A It is achieved by temporarily disabling \@latex@warning@no@line
%\let\latex@addmarginpar\@addmarginpar
@@ -388,7 +392,7 @@ This work consists of the file siunitx.dtx
%\makeatother
%
%\GetFileInfo{\jobname.sty}
-%
+%
%\title{^^A
% \textsf{siunitx} --- A comprehensive (SI) units package\thanks{^^A
% This file describes \fileversion, last revised \filedate.^^A
@@ -405,69 +409,43 @@ This work consists of the file siunitx.dtx
%\changes{v1.0}{2008/06/15}{First official release}
%\changes{v1.1}{2008/09/28}{Package extended to a greater range of unit
% types}
-%\changes{v1.2}{2009/01/22}{Correct handling for ranges of numbers
+%\changes{v1.2}{2009/01/22}{Correct handling for ranges of numbers
% added}
%\changes{v1.3}{2009/09/20}{Better definition for micro symbol}
%\changes{v1.4}{2010/01/16}{Detect entire document in non-serif font}
%\changes{v2.0}{2010/05/23}{Complete re-write of package to add many new
% features}
-%\changes{v2.0}{2010/05/23}{Introduced \cs{numlist} and \cs{SIlist}
-% functions}
-%\changes{v2.0a}{2010/05/28}{Make \cs{SendSettingsToPgf} available
-% in document body}
-%\changes{v2.0a}{2010/05/28}{Fix various errors in \file{version-1}
-% configuration file}
-%\changes{v2.0a}{2010/05/28}{Detect use of version 1 options and
-% automatically load appropriate configuration file}
-%\changes{v2.0a}{2010/05/28}{Include high energy physics units in
-% discussion of old configurations and in \file{version-1}
-% configuration file}
-%\changes{v2.0b}{2010/06/01}{Further improvements to \file{version-1}
-% configuration file}
%\changes{v2.0c}{2010/06/07}{Mixed literal and macro units now print
% more reliably}
-%\changes{v2.0d}{2010/06/10}{Document special case situations for last
-% cell in table row}
%\changes{v2.0d}{2010/06/10}{Fix error in \opt{table-format} option
% concerning exponent signs}
%\changes{v2.0e}{2010/06/20}{Correct behaviour of \cs{pm} in numbers
-% when \texttt{abbreviations} configuration is loaded: problem
+% when \texttt{abbreviations} configuration is loaded: problem
% introduced in v2.0c}
%\changes{v2.0f}{2010/06/27}{Fix issue with spacing of multiplication
% sign in text mode}
-%\changes{v2.0g}{2010/06/28}{Fix issue with complex numbers in
+%\changes{v2.0g}{2010/06/28}{Fix issue with complex numbers in
% quotients}
%\changes{v2.0g}{2010/06/28}{Repair broken \opt{bracket-numbers}
% option}
%\changes{v2.0g}{2010/06/28}{Improve handling of complex root token}
%\changes{v2.0g}{2010/06/28}{Introduce localisation for text values}
-%\changes{v2.0h}{2010/06/29}{Actually get localisation into the
+%\changes{v2.0h}{2010/06/29}{Actually get localisation into the
% code}
-%\changes{v2.0i}{2010/06/29}{Correct behaviour of \cs{of} function
-% so it actually works (bug introduced in v2.0d)}
-%\changes{v2.0j}{2010/06/30}{Correct \cs{hartree} unit appearance}
-%\changes{v2.0j}{2010/06/30}{Ensure symbols specified in
+%\changes{v2.0j}{2010/06/30}{Ensure symbols specified in
% \opt{input-symbols} are always printed in math mode}
%\changes{v2.0k}{2010/07/04}{Fix for \pkg{babel} French settings with
% \cs{fg} in tabular material}
%\changes{v2.0l}{2010/07/07}{Further adjustments to \pkg{babel} support}
-%\changes{v2.0m}{2010/07/09}{Re-introduce \opt{locale} option}
-%\changes{v2.0n}{2010/07/15}{More abbreviated units}
-%\changes{v2.0o}{2010/07/21}{Extend \opt{detect-italic} option
-% to other shapes, renaming as \opt{detect-shape} as a result}
%\changes{v2.0p}{2010/07/28}{Actually get change from v2.0o working}
%\changes{v2.0q}{2010/07/29}{Errors with free-standing unit code fixed}
%\changes{v2.0q}{2010/07/29}{Deal with bad definition of \cs{color}
% by \pkg{textpos} package}
-%\changes{v2.0r}{2010/08/02}{Error in definition for old
-% \opt{decimalsymbol} option corrected}
-%\changes{v2.0s}{2010/08/08}{Correct errors in rounding code when
+%\changes{v2.0s}{2010/08/08}{Correct errors in rounding code when
% precision requested is zero decimal places}
-%\changes{v2.0s}{2010/08/12}{Document how to do mixed bold and normal
-% numbers in tables}
%\changes{v2.0t}{2010/08/24}{Replace \cs{exp_afer:wN} in code for
% \cs{per} with \cs{exp_after:wN}}
-%\changes{v2.0u}{2010/09/14}{Fix second possible issue with
+%\changes{v2.0u}{2010/09/14}{Fix second possible issue with
% \pkg{textpos} package and \cs{color}}
%\changes{v2.0u}{2010/09/14}{Prevent infinite loop if \cs{SI} function
% is used with an empty number}
@@ -477,27 +455,6 @@ This work consists of the file siunitx.dtx
% REV\TeX\ in tables}
%\changes{v2.0x}{2010/10/05}{Fix bug when detecting single prefixes
% and converting prefixes to numbers}
-%\changes{v2.0y}{2010/10/09}{Error with \opt{tight-spacing} option
-% and exponents corrected}
-%\changes{v2.1}{2010/10/02}{New \opt{copy-complex-root} option for
-% moving input complex root to output}
-%\changes{v2.1}{2010/10/12}{New \opt{table-align-exponent} and
-% \opt{table-align-uncertainty} options for additional choices of
-% table formatting}
-%\changes{v2.1}{2010/10/12}{New \opt{power-font} option for controlling
-% whether superscript powers are treated as numbers or units}
-%\changes{v2.1}{2010/10/13}{New \opt{scientific-notation} option
-% for to use exponent form for numbers in all cases}
-%\changes{v2.1}{2010/10/13}{New \opt{table-omit-exponent} option
-% for simplifying tables}
-%\changes{v2.1}{2010/10/25}{New \opt{round-integer-to-decimal} option
-% to convert integers to decimals on rounding}
-%\changes{v2.1}{2010/10/26}{New \opt{input-comparators} option
-% for numbers greater than, less than and so on}
-%\changes{v2.1}{2010/10/26}{New \opt{table-comparator} option
-% for reserving space for comparators in tables}
-%\changes{v2.1}{2010/10/27}{New \opt{round-minimum} option
-% to set a floor for rounding numbers downward}
%\changes{v2.1a}{2010/11/05}{Ensure that output of list separators is
% in text mode}
%\changes{v2.1a}{2010/11/05}{Print prefixes correctly in text mode
@@ -508,37 +465,20 @@ This work consists of the file siunitx.dtx
% sorted}
%\changes{v2.1c}{2010/11/11}{Discourage line break between number and
% unit even when it is permitted}
-%\changes{v2.1c}{2010/11/13}{New \opt{text} choice for
-% \opt{qualifier-mode} option}
%\changes{v2.1c}{2010/11/14}{After reviewing internals, \cs{numlist},
% \cs{numrange}, \cs{SIlist} and \cs{SIrange} are documented as
% requiring text mode due to issues with spacing and line breaks}
%\changes{v2.1c}{2010/11/14}{Auto-detect math mode in tables and
% correct output accordingly}
-%\changes{v2.1d}{2010/11/14}{Apply unit options when
-% \opt{free-standing-units} is active}
-%\changes{v2.1d}{2010/11/14}{Error with definition of version 1 option
-% \opt{xspace} corrected}
-%\changes{v2.1e}{2010/11/22}{Further corrections when applying unit
-% options when \opt{free-standing-units} is active}
%\changes{v2.1e}{2010/11/22}{Fix issues with text mode symbols and
% \pkg{fontspec} package}
-%\changes{v2.1f}{2010/11/24}{Typo in definition for
-% \opt{unit-optional-argument} implementation corrected}
%\changes{v2.1g}{2010/12/21}{Checks on the versions of \pkg{expl3} and
% \pkg{xparse} installed}
%\changes{v2.1h}{2011/01/18}{Detect AMS display-like environments}
-%\changes{v2.1i}{2011/01/27}{Improved logic for
-% \opt{per-mode} setting \opt{symbol-or-fraction}}
%\changes{v2.1j}{2011/02/01}{Allow for loading of \pkg{inputenc} package
% with no options}
-%\changes{v2.1k}{2011/02/09}{Remove \opt{combined} choice for option
-% \opt{detect-inline-weight}}
-%\changes{v2.1k}{2011/02/09}{New option \opt{detect-inline-family}}
%\changes{v2.1k}{2011/02/09}{Bug fix when printing superscript minus
% signs and using \pkg{fontspec} package}
-%\changes{v2.1l}{2011/02/10}{Error in font family detection introduced
-% in v2.1k corrected}
%\changes{v2.1m}{2011/03/18}{Avoid expansion of erroneous literal
% units when these are forbidden}
%\changes{v2.1m}{2011/03/20}{Ensure some output occurs in all cases
@@ -554,7 +494,7 @@ This work consists of the file siunitx.dtx
% contain comparators fixed}
%\changes{v2.1p}{2011/04/04}{Poor position of comparators in
% numbers fixed}
-%
+%
%\begin{abstract}
% Physical quantities have both numbers and units, and each physical
% quantity should be expressed as the product of a number and a unit.
@@ -567,8 +507,8 @@ This work consists of the file siunitx.dtx
%
% The \pkg{siunitx} package provides a set of tools for authors
% to typeset quantities 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.
+% 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.
%\end{abstract}
@@ -583,61 +523,64 @@ This work consists of the file siunitx.dtx
% in technical applications. For this reason, carefully-crafted
% definitions of a coherent units system have been laid down by the
% \emph{Conf\'erence G\'en\'erale des Poids et
-% Mesures} (CGPM): this has resulted in the \emph{Syst\`eme
-% International d'Unit\'es} (SI). At the same time, typographic
+% Mesures} (CGPM): this has resulted in the \emph{Syst\`eme
+% International d'Unit\'es} (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.
%
% \pkg{siunitx} aims to provide a unified method for \LaTeX\ users to
% typeset numbers and units correctly and easily. The design
-% philosophy of \pkg{siunitx} is to follow the agreed rules by
+% philosophy of \pkg{siunitx} is to follow the agreed rules by
% default, but to allow variation through option settings. In this way,
-% users can use \pkg{siunitx} to follow the requirements of
-% publishers, co-authors, universities, \emph{etc}.~without needing to
+% users can use \pkg{siunitx} to follow the requirements of
+% publishers, co-authors, universities, \emph{etc}.~without needing to
% alter the input at all.
-%
+%
%\section{Installation}
%
% The package is supplied in \file{dtx} format and as a pre-extracted
% zip file, \file{\jobname.tds.zip}. The later is most convenient for
% most users: simply unzip this in your local texmf directory and
% run \texttt{texhash} to update the database of file locations. If
-% you want to unpack the \file{dtx} yourself, running
+% you want to unpack the \file{dtx} yourself, running
% \texttt{tex \jobname.dtx} will extract the package whereas
% \texttt{latex \jobname.dtx} will extract it and also typeset the
% documentation.
%
-% The package requires \LaTeX3 support as provided in the
+% The package requires \LaTeX3 support as provided in the
% \pkg{expl3} and \pkg{xpackages} bundles. Both of these are available
% on \href{http://www.ctan.org}{\textsc{ctan}} as ready-to-install
% zip files. Suitable versions are available in MiK\TeX~2.9 and
% \TeX~Live 2010 (updating the relevant packages online may be
% necessary). \LaTeX3, and so \pkg{siunitx}, requires the \eTeX\
% extensions: these are available on all modern \TeX\ systems.
-%
+%
% Typesetting the documentation requires a number of packages in
-% addition to those needed to use the package. This is mainly
+% addition to those needed to use the package. This is mainly
% because of the number of demonstration items included in the text. To
% compile the documentation without error, you will need the packages:
-%\begin{itemize}
+%\begin{itemize}
% \item \pkg{amsmath}
% \item \pkg{booktabs}
+% \item \pkg{cancel}
% \item \pkg{caption}
% \item \pkg{cleveref}
% \item \pkg{csquotes}
% \item \pkg{helvet}
% \item \pkg{mathpazo}
+% \item \pkg{multirow}
% \item \pkg{listings}
% \item \pkg{pgfplots}
% \item \pkg{xcolor}
%\end{itemize}
-% The \pkg{xfrac} package is also loaded if available, but is not
+% The \pkg{xfrac} package is also loaded if available, but is not
% required to typeset the documentation.
-%
+%
%\section{\pkg{siunitx} for the impatient}
%
% The package provides the user macros:
%\begin{itemize}
+% \item \cs{ang}\oarg{options}\marg{angle}
% \item \cs{num}\oarg{options}\marg{number}
% \item \cs{si}\oarg{options}\marg{unit}
% \item \cs{SI}\oarg{options}\marg{number}\oarg{pre-unit}\marg{unit}
@@ -646,14 +589,14 @@ This work consists of the file siunitx.dtx
% \item \cs{SIlist}\oarg{options}\marg{numbers}\marg{unit}
% \item \cs{SIrange}\oarg{options}\marg{number1}\marg{number2}^^A
% \marg{unit}
-% \item \cs{ang}\oarg{options}\marg{angle}
% \item \cs{sisetup}\marg{options}
+% \item \cs{tablenum}\oarg{options}\marg{number}
%\end{itemize}
-% plus the \texttt{S} and \texttt{s} column types for decimal
-% alignments and units in tables. These macros are designed for
-% typesetting numbers and units with control of appearance and with
+% plus the \texttt{S} and \texttt{s} column types for decimal
+% alignments and units in tables. These macros are designed for
+% typesetting numbers and units with control of appearance and with
% intelligent processing.
-%
+%
% Numbers are processed with understanding of exponents, complex numbers
% and multiplication.
%\begin{LaTeXdemo}
@@ -661,7 +604,7 @@ This work consists of the file siunitx.dtx
% \num{1+-2i} \\
% \num{.3e45} \\
% \num{1.654 x 2.34 x 3.430}
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
%
% The unit system can interpret units given as text to be used directly
% or as macro-based units. In the later case, different formatting is
@@ -672,7 +615,7 @@ This work consists of the file siunitx.dtx
% \si[per-mode=symbol]
% {\kilogram\metre\per\second} \\
% \si[per-mode=symbol]
-% {\kilogram\metre\per\ampere\per\second}
+% {\kilogram\metre\per\ampere\per\second}
%\end{LaTeXdemo}
%
% Simple lists and ranges of numbers can be handled.
@@ -682,11 +625,11 @@ This work consists of the file siunitx.dtx
% \numrange{10}{20} \\
% \SIrange{0.13}{0.67}{\milli\metre}
%\end{LaTeXdemo}
-%
+%
% By default, all text is typeset in the current upright, serif math
-% font. This can be changed by setting the appropriate options:
+% font. This can be changed by setting the appropriate options:
% "\sisetup{detect-all}" will use the current font for typesetting.
-%
+%
%\section{Using the \pkg{siunitx} package}
%
%\subsection{Loading the package}
@@ -694,12 +637,12 @@ This work consists of the file siunitx.dtx
% The package should be loaded in the usual \LaTeXe\ way.
%\begin{LaTeXdemo}[code only]
% \usepackage{siunitx}
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
% The key--value options described later in this document can be used
% when loading the package, for example
%\begin{LaTeXdemo}[code only]
% \usepackage[load-configurations = version-1]{siunitx}
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
% to use options from version 1 of the package.
%
%\subsection{Numbers}
@@ -710,13 +653,13 @@ This work consists of the file siunitx.dtx
%\end{syntax}
% Numbers are automatically formatted by the \cs{num} macro. This
% takes one optional argument, \meta{options}, and one mandatory one,
-% \meta{number}. The contents of \meta{number} are automatically
-% formatted. The formatter removes \enquote{hard} spaces
-% (\cs{,} and "~"), automatically identifies exponents (by default
-% marked using \texttt{e}, \texttt{E}, \texttt{d} or \texttt{D}) and
+% \meta{number}. The contents of \meta{number} are automatically
+% formatted. The formatter removes \enquote{hard} spaces
+% (\cs{,} and "~"), automatically identifies exponents (by default
+% marked using \texttt{e}, \texttt{E}, \texttt{d} or \texttt{D}) and
% adds the appropriate spacing of large numbers. With the standard
-% settings a leading zero is added before a decimal marker, if needed:
-% both \enquote{\texttt{.}} and \enquote{\texttt{,}} are recognised as
+% settings a leading zero is added before a decimal marker, if needed:
+% both \enquote{\texttt{.}} and \enquote{\texttt{,}} are recognised as
% decimal markers.
%\begin{LaTeXdemo}
% \num{123} \\
@@ -728,19 +671,21 @@ This work consists of the file siunitx.dtx
% \num{3.45d-4} \\
% \num{-e10}
%\end{LaTeXdemo}
-% Note that numbers are parsed before typesetting, which does
+% Note that numbers are parsed before typesetting, which does
% have a performance overhead (only obvious with very large amounts
% of numerical input). The parser understands a range of input syntaxes,
% as demonstrated above.
-%
+%
%\DescribeMacro{\numlist}
%\begin{syntax}
% \cs{numlist}\oarg{options}\marg{numbers}
%\end{syntax}
+%\changes{v2.0}{2010/05/23}{Introduced \cs{numlist} and \cs{SIlist}
+% functions}
% Lists of numbers may be processed using the \cs{numlist} function.
% Each \meta{number} is given within the list of \meta{numbers} within
% a brace pair, as the list can have a flexible length. This function
-% should be used in text mode, a common feature of all of the list and
+% should be used in text mode, a common feature of all of the list and
% range functions provided by \pkg{siunitx}.\footnote{The reason for
% this restriction is that the separators between items may involve
% text-mode spaces which must be able to vanish at line breaks. It is
@@ -754,7 +699,7 @@ This work consists of the file siunitx.dtx
% \cs{numrange}\oarg{options}\marg{number1}\marg{number2}
%\end{syntax}
% Simple ranges of numbers can be handled using the \cs{numrange}
-% function. This acts in the same way as \cs{num}, but inserts a
+% function. This acts in the same way as \cs{num}, but inserts a
% phrase or other text between the two entries. This function should
% be used in text mode.
%\begin{LaTeXdemo}
@@ -767,8 +712,8 @@ This work consists of the file siunitx.dtx
%\end{syntax}
% Angles can be typeset using the \cs{ang} command. The
% \meta{angle} can be given either as a decimal number or as a
-% semi-colon separated list of degrees, minutes and seconds, which
-% is called \enquote{arc format} in this document. The numbers which
+% semi-colon separated list of degrees, minutes and seconds, which
+% is called \enquote{arc format} in this document. The numbers which
% make up an angle are processed using the same system as other numbers.
%\begin{LaTeXdemo}
% \ang{10} \\
@@ -786,29 +731,29 @@ This work consists of the file siunitx.dtx
%\begin{syntax}
% \cs{si}\oarg{options}\marg{unit}
%\end{syntax}
-% The symbol for a unit can be typeset using the \cs{si} macro: this
+% The symbol for a unit can be typeset using the \cs{si} macro: this
% provides full control over output format for the unit. Like the
-% \cs{num} macro, \cs{si} takes one optional and one mandatory
-% argument. The unit formatting system can accept two types of input.
-% When the \meta{unit} contains literal items (for example letters or
+% \cs{num} macro, \cs{si} takes one optional and one mandatory
+% argument. The unit formatting system can accept two types of input.
+% When the \meta{si} contains literal items (for example letters or
% numbers) then \pkg{siunitx} converts \texttt{.} and "~" into
-% inter-unit separators and correctly positions sub- and superscripts
+% inter-unit product and correctly positions sub- and superscripts
% specified using "_" and "^". The formatting methods will work with
% both math and text mode.
%\begin{LaTeXdemo}
% \si{kg.m/s^2} \\
% \si{g_{polymer}~mol_{cat}.s^{-1}}
%\end{LaTeXdemo}
-% The second operation mode for the \cs{si} macro is an
-% \enquote{interpreted} system, Here, each unit, SI multiple prefix and
-% power is given a macro name. These are entered in a method very
+% The second operation mode for the \cs{si} macro is an
+% \enquote{interpreted} system, 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{LaTeXdemo}
% \si{\kilo\gram\metre\per\square\second} \\
% \si{\gram\per\cubic\centi\metre} \\
% \si{\square\volt\cubic\lumen\per\farad} \\
% \si{\metre\squared\per\gray\cubic\lux} \\
-% \si{\henry\second}
+% \si{\henry\second}
%\end{LaTeXdemo}
% On its own, this is less convenient than the direct method, although
% it does use meaning rather than appearance for input. However, the
@@ -816,7 +761,7 @@ This work consists of the file siunitx.dtx
% pre-defined abbreviations are also supplied. More importantly, by
% defining macros for units, instead of literal input, new
% functionality is made available. By altering the settings used by the
-% package, the same input can yield a variety of different output
+% package, the same input can yield a variety of different output
% formats. For example, the \cs{per} macro can give reciprocal powers,
% slashes or be used to construct units as fractions.
%
@@ -828,9 +773,9 @@ This work consists of the file siunitx.dtx
% value of a quantity is the product of the number and the unit, the
% space being regarded as a multiplication sign \cite{SI:5.3.3}. The
% \cs{SI} macro combines the functionality of \cs{num} and
-% \cs{si}, and makes this both possible and easy. The \meta{number} and
-% \meta{unit} arguments work exactly like those for the \cs{num} and
-% \cs{si} macros, respectively. \meta{preunit} is a unit to be typeset
+% \cs{si}, and makes this both possible and easy. The \meta{number}
+% and \meta{si} arguments work exactly like those for the \cs{num} and
+% \cs{si} macros, respectively. \meta{preunit} is a unit to be typeset
% \emph{before} the numerical value (most likely to be a currency).
%\begin{LaTeXdemo}
% \SI[mode=text]{1.23}{J.mol^{-1}.K^{-1}} \\
@@ -840,15 +785,15 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
% It is possible to set up the unit macros to be available outside of
-% the \cs{SI} and \cs{si} functions. This is not the standard behaviour
-% as there is the risk of name clashes (for example, \cs{bar} is used
-% by other packages, and several packages define \cs{degree}). Full
-% details of using \enquote{stand alone} units are found in
+% the \cs{SI} and \cs{si} functions. This is not the standard
+% behaviour as there is the risk of name clashes (for example, \cs{bar}
+% is used by other packages, and several packages define \cs{degree}).
+% Full details of using \enquote{stand alone} units are found in
% \cref{sec:units:creating}.
-%
+%
%\DescribeMacro{\SIlist}
%\begin{syntax}
-% \cs{SIlist}\oarg{options}\marg{numbers}\marg{unit}
+% \cs{SIlist}\oarg{options}\marg{numbers}\marg{unit}
%\end{syntax}
% Lists of numbers with units can be handled using the \cs{SIlist}
% function. The behaviour of this function is similar to \cs{numlist},
@@ -857,10 +802,10 @@ This work consists of the file siunitx.dtx
%\begin{LaTeXdemo}
% \SIlist{10;30;45}{\metre}
%\end{LaTeXdemo}
-%
+%
%\DescribeMacro{\SIrange}
%\begin{syntax}
-% \cs{SIrange}\oarg{options}\marg{number1}\marg{number2}\marg{unit}
+% \cs{SIrange}\oarg{options}\marg{number1}\marg{number2}\marg{unit}
%\end{syntax}
% Ranges of numbers with units can be handled using the \cs{SIrange}
% function. The behaviour of this function is similar to \cs{numrange},
@@ -875,14 +820,14 @@ This work consists of the file siunitx.dtx
% The package always defines the basic set of SI units with macro names.
% This includes the base SI units, the derived units with special names
% and the prefixes. A small number of powers are also given pre-defined
-% names. Full details of units in the SI are available
+% names. Full details of units in the SI are available
% on-line~\cite{BIPM}.
-%
+%
%\DescribeMacro{\meter}
-% The seven base SI units are always defined
+% The seven base SI units are always defined
% (\cref{tab:unit:base}). In addition, the macro \cs{meter} is
% available as an alias for \cs{metre}, for users of US spellings.
-% The full details of the base units are given in the SI
+% The full details of the base units are given in the SI
% Brochure~\cite{SI:2.1}.
%\begin{table}
% \caption{SI base units.}
@@ -895,21 +840,21 @@ This work consists of the file siunitx.dtx
% \DescribeUnit{ampere} \\
% \DescribeUnit{candela} \\
% \DescribeUnit{kelvin} \\
-% \DescribeUnit{kilogram} \\
+% \DescribeUnit{kilogram} \\
% \DescribeUnit{metre} \\
% \DescribeUnit{mole} \\
-% \DescribeUnit{second} \\
+% \DescribeUnit{second} \\
% \bottomrule
% \end{tabular}
%\end{table}
%
%\DescribeMacro{\celsius}
-% The SI also lists a number of units which have special names and
-% symbols \cite{SI:2.2.2}: these are listed in
+% The SI also lists a number of units which have special names and
+% symbols \cite{SI:2.2.2}: these are listed in
% \cref{tab:unit:derived}. As a short-cut for the degree Celsius,
% the unit \cs{celsius} is defined equivalent to \cs{degreeCelsius} .
%\begin{table}
-% \caption{Coherent derived units in the SI with special names and
+% \caption{Coherent derived units in the SI with special names and
% symbols.}
% \label{tab:unit:derived}
% \centering
@@ -918,7 +863,7 @@ This work consists of the file siunitx.dtx
% Unit & Macro & Symbol & Unit & Macro & Symbol \\
% \midrule
% \DescribeUnit{becquerel} &
-% \DescribeUnit{newton} \\
+% \DescribeUnit{newton} \\
% \DescribeNamedUnit{degree Celsius}{degreeCelsius} &
% \DescribeUnit{ohm} \\
% \DescribeUnit{coulomb} &
@@ -945,15 +890,15 @@ This work consists of the file siunitx.dtx
%
% In addition to the official SI units, \pkg{siunitx} also provides
% macros for a number of units which are accepted for use in the SI
-% although they are not SI units. \cref{tab:unit:accepted} lists
-% the \enquote{accepted} units \cite{SI:4.1.T6}. Some units are
-% fundamental physical quantities, and these are non-SI but can be used
-% within the SI (\cref{tab:unit:physical}, \cite{SI:4.1.T7}).
-% There are also a set of non-SI units which are used in certain
-% defined circumstances (\cref{tab:unit:other}), although they are
+% although they are not SI units. \cref{tab:unit:accepted} lists
+% the \enquote{accepted} units \cite{SI:4.1.T6}. Some units are
+% fundamental physical quantities, and these are non-SI but can be used
+% within the SI (\cref{tab:unit:physical}, \cite{SI:4.1.T7}).
+% There are also a set of non-SI units which are used in certain
+% defined circumstances (\cref{tab:unit:other}), although they are
% not necessarily official sanctioned \cite{SI:4.1.T8}.
%\begin{table}
-% \caption{Non-SI units accepted for use with the
+% \caption{Non-SI units accepted for use with the
% International System of Units.}
% \label{tab:unit:accepted}
% \centering
@@ -966,17 +911,18 @@ This work consists of the file siunitx.dtx
% \DescribeUnit{hectare} \\
% \DescribeUnit{hour} \\
% \DescribeUnit{litre} \\
-% \SpecialUsageIndex{\liter}^^A
+% \SpecialUsageIndex{\liter}^^A
% & \cs{liter} & \si{\liter} \\
-% \DescribeNamedUnit{minute (plane angle)}{arcminute} \\
+% \DescribeNamedUnit{minute (plane angle)}{arcminute} \\
% \DescribeNamedUnit{minute (time)}{minute} \\
-% \DescribeNamedUnit{second (plane angle)}{arcsecond} \\
+% \DescribeNamedUnit{second (plane angle)}{arcsecond} \\
% \DescribeUnit{tonne} \\
% \bottomrule
% \end{tabular}
%\end{table}
%\begin{table}
-% \caption{Non-SI units whose values in SI units must be obtained
+% \changes{v2.0j}{2010/06/30}{Correct \cs{hartree} unit appearance}
+% \caption{Non-SI units whose values in SI units must be obtained
% experimentally.}
% \label{tab:unit:physical}
% \centering
@@ -993,7 +939,7 @@ This work consists of the file siunitx.dtx
% \DescribeUnit{electronvolt} \\
% \DescribeNamedUnit{elementary charge}{elementarycharge} \\
% \DescribeUnit{hartree} \\
-% \DescribeNamedUnit{reduced Planck constant}{planckbar} \\
+% \DescribeNamedUnit{reduced Planck constant}{planckbar} \\
% \bottomrule
% \end{tabular}
%\end{table}
@@ -1012,17 +958,17 @@ This work consists of the file siunitx.dtx
% \DescribeUnit{decibel} \\
% \DescribeUnit{knot} \\
% \DescribeNamedUnit{millimetre of mercury}{mmHg} \\
-% \DescribeNamedUnit{nautical mile}{nauticalmile} \\
+% \DescribeNamedUnit{nautical mile}{nauticalmile} \\
% \DescribeUnit{neper} \\
% \bottomrule
% \end{tabular}
%\end{table}
%
%\DescribeMacro{\deka}
-% In addition to the units themselves, \pkg{siunitx} provides
-% pre-defined macros for all of the SI prefixes
+% In addition to the units themselves, \pkg{siunitx} provides
+% pre-defined macros for all of the SI prefixes
% (\cref{tab:unit:prefix}, \cite{SI:3.1}). The spelling
-% \enquote{\cs{deka}} is provided for US users as an alternative to
+% \enquote{\cs{deka}} is provided for US users as an alternative to
% \cs{deca}.
%\begin{table}
% \caption{SI prefixes.}
@@ -1030,7 +976,7 @@ This work consists of the file siunitx.dtx
% \centering
% \begin{tabular}{llc>{$}l<{$}>{\qquad}llc>{$}l<{$}}
% \toprule
-% Prefix & Macro & Symbol & \multicolumn{1}{l}{Power} &
+% Prefix & Macro & Symbol & \multicolumn{1}{l}{Power} &
% Prefix & Macro & Symbol & \multicolumn{1}{l}{Power} \\
% \midrule
% \DescribePrefix{yocto} & -24 &
@@ -1061,10 +1007,10 @@ This work consists of the file siunitx.dtx
%\DescribeMacro{\squared}
%\DescribeMacro{\cubic}
%\DescribeMacro{\cubed}
-% A small number of pre-defined powers are provided as macros.
+% A small number of pre-defined powers are provided as macros.
% \cs{square} and \cs{cubic} are intended for use before units, with
% \cs{squared} and \cs{cubed} going after the unit.
-%\begin{LaTeXdemo}
+%\begin{LaTeXdemo}
% \si{\square\becquerel} \\
% \si{\joule\squared\per\lumen} \\
% \si{\cubic\lux\volt\tesla\cubed}
@@ -1074,7 +1020,7 @@ This work consists of the file siunitx.dtx
% Generic powers can be inserted on a one-off basis using the \cs{tothe}
% and \cs{raiseto} macros. These are the only macros for units which
% take an argument:
-%\begin{LaTeXdemo}
+%\begin{LaTeXdemo}
% \si{\henry\tothe{5}} \\
% \si{\raiseto{4.5}\radian}
%\end{LaTeXdemo}
@@ -1082,77 +1028,98 @@ This work consists of the file siunitx.dtx
% Reciprocal powers are indicated using the \cs{per} macro. This applies
% to the next unit only, unless the \opt{sticky-per} option
% is turned on.
-%\begin{LaTeXdemo}
+%\begin{LaTeXdemo}
% \si{\joule\per\mole\per\kelvin} \\
% \si{\joule\per\mole\kelvin} \\
% \si{\per\henry\tothe{5}} \\
-% \si{\per\square\becquerel}
+% \si{\per\square\becquerel}
%\end{LaTeXdemo}
%\DescribeMacro{\of}
+%\changes{v2.0i}{2010/06/29}{Correct behaviour of \cs{of} function
+% so it actually works (bug introduced in v2.0d)}
% As for generic powers, generic qualifiers are also available using
% the \cs{of} function:
-%\begin{LaTeXdemo}
+%\begin{LaTeXdemo}
% \si{\kilogram\of{metal}} \\
% \SI[qualifier-mode = brackets]
% {0.1}{\milli\mole\of{cat}\per\kilogram\of{prod}}
%\end{LaTeXdemo}
%
+%\DescribeMacro{\cancel}
+%\DescribeMacro{\highlight}
+%\changes{v2.2}{2011/04/05}{Support use of \cs{cancel} macro in units}
+%\changes{v2.2}{2011/04/06}{New \cs{highlight} macro for selective
+% colour in units}
+% If the \pkg{cancel} package is loaded, it is possible to
+% \enquote{cancel out} units using the \cs{cancel} macro. This applies
+% to the next unit, in a similar manner to a prefix. The \cs{highlight}
+% macro is also available to selectively colour units. Both \cs{cancel}
+% and \cs{highlight} are of course outside of the normal semantic
+% meaning of units, but are provided as they may be useful in some
+% cases.
+%\begin{LaTeXdemo}
+% \si[per-mode = fraction]
+% {\cancel\kilogram\metre\per\cancel\kilogram\per\second} \\
+% \si{\highlight{red}\kilogram\metre\per\second} \\
+% \si[unit-color = purple]
+% {\highlight{red}\kilogram\metre\per\second}
+%\end{LaTeXdemo}
+%
% When using the unit macros, the package is able to validate the
% input given. As part of this, stand-alone unit prefixes can be used
% with the \cs{si} macro
-%\begin{LaTeXdemo}
+%\begin{LaTeXdemo}
% \si{\kilo} \\
% \si{\micro} \\
% \si[prefixes-as-symbols = false]{\kilo}
%\end{LaTeXdemo}
% However, the package only allows a single prefix to be used in this
-% way: multiple prefixes will give an error, as will trying to give
+% way: multiple prefixes will give an error, as will trying to give
% a number without a unit. So the following will raise errors:
-%\begin{LaTeXdemo}[code only]
+%\begin{LaTeXdemo}[code only]
% \si{\kilo\gram\micro} \\
% \SI{10}{\micro}
%\end{LaTeXdemo}
-%
+%
%\subsection{Creating new macros}
%
% The various macro components of a unit have to be defined before
% they can be used. The package supplies a number of common definitions,
% but new definitions are also possible. As the definition of a logical
% unit should remain the same in a single document, these creation
-% functions are all preamble-only.
+% functions are all preamble-only.
%
%\DescribeMacro{\DeclareSIUnit}
-%\DescribeMacro{\DeclareSIUnitWithOptions}
+%\changes{v2.2}{2011/04/01}{Extend \cs{DeclareSIUnit} to take
+% optional argument}
%\begin{syntax}
-% \cs{DeclareSIUnit}\marg{unit}\marg{symbol}
-% \cs{DeclareSIUnitWithOptions}\marg{unit}\marg{symbol}\marg{options}
+% \cs{DeclareSIUnit}\oarg{options}\marg{unit}\marg{symbol}
%\end{syntax}
-% New units are produced using the \cs{DeclareSIUnit} macro.
+% New units are produced using the \cs{DeclareSIUnit} macro.
% \meta{symbol} can contain literal input, other units, multiple
% prefixes, powers and \cs{per}, although literal text should not be
-% intermixed with unit macros. Units can be created with options
-% using the \cs{DeclareSIUnitWithOptions} function, where the
-% \meta{options} argument can be any suitable options, and applies the
-% specific unit macro only. The (first) optional argument to \cs{SI}
-% and \cs{si} can be used to override the settings for the unit. A
+% intermixed with unit macros. Units can be created with \meta{options}
+% from the usual list understood by \pkg{siuntix}, and apply the
+% specific unit macro only. The (first) optional argument to \cs{SI}
+% and \cs{si} can be used to override the settings for the unit. A
% typical example is the \cs{degree} unit.
%\begin{LaTeXdemo}
% \SI{3.1415}{\degree}
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
% This is declared in the package as:
%\begin{LaTeXdemo}[code only]
-% \DeclareSIUnitWithOptions\degree{\SIUnitSymbolDegree}
-% {number-unit-separator={}}
+% \DeclareSIUnit[number-unit-product = {}]
+% \degree{\SIUnitSymbolDegree}
%\end{LaTeXdemo}
% The spacing can still be altered at point of use:
%\begin{LaTeXdemo}
% \SI{67890}{\degree} \\
-% \SI[number-unit-separator = \;]{67890}{\degree}
+% \SI[number-unit-product = \;]{67890}{\degree}
%\end{LaTeXdemo}
% The meaning of a pre-defined unit can be altered by using
% \cs{DeclareSIUnit} after loading \pkg{siunitx}. This will overwrite
% the original definition with the newer version.
-%
+%
%\DescribeMacro{\DeclareSIPrefix}
%\DescribeMacro{\DeclareBinaryPrefix}
%\begin{syntax}
@@ -1162,8 +1129,8 @@ This work consists of the file siunitx.dtx
% The standard SI powers of ten are defined by the package, and are
% described above. However, the user can define new prefixes with
% \cs{DeclareSIPrefix}. The \cs{DeclareBinaryPrefix} function is also
-% available for creating binary prefixes, with the same syntax
-% (\meta{powers-ten} being replaced by \meta{powers-two}). For
+% available for creating binary prefixes, with the same syntax
+% (\meta{powers-ten} being replaced by \meta{powers-two}). For
% example, \cs{kilo} and \cs{kibi} are defined:
%\begin{LaTeXdemo}[code only]
% \DeclareSIPrefix\kilo{k}{3}
@@ -1208,7 +1175,7 @@ This work consists of the file siunitx.dtx
%
% Aligning numbers in tabular content is handled by a new column
% type, the \texttt{S} column. This new column type can align material
-% using a number of different strategies, with the aim of flexibility
+% using a number of different strategies, with the aim of flexibility
% of output without needing to alter the input. The method used
% as standard is to place the decimal marker in the number at the
% centre of the cell and to align the material appropriately
@@ -1234,17 +1201,17 @@ This work consists of the file siunitx.dtx
% \end{tabular}
% \end{table}
%\end{LaTeXdemo}
-%
-% The \texttt{S} column will attempt to automatically detect
+%
+% The \texttt{S} column will attempt to automatically detect
% material which should be placed before or after a number, and will
-% maintain the alignment of the numerical data
+% maintain the alignment of the numerical data
% (\cref{tab:S:extras}). If the material could be mistaken for
% part of a number, it should be protected by braces. The use of
% \cs{color} in a table cell will also be detected an will override any
% general colour applied by \pkg{siunitx}.
%\begin{LaTeXdemo}[code and float]
% \begin{table}
-% \caption{Detection of surrounding material in an \texttt{S}
+% \caption{Detection of surrounding material in an \texttt{S}
% column.}
% \label{tab:S:extras}
% \centering
@@ -1260,11 +1227,53 @@ This work consists of the file siunitx.dtx
% \end{table}
%\end{LaTeXdemo}
%
+%\DescribeMacro{\tablenum}
+%\begin{syntax}
+% \cs{tablenum}\oarg{options}\marg{number}
+%\end{syntax}
+%\changes{v2.2}{2011/03/20}{Add new \cs{tablenum} macro to allow
+% complex table alignments}
+% Within more complex tables, aligned numbers may be desirable within
+% the argument of \cs{multicolumn} or
+% \cs{multirow}.\footnote{Provided by the \pkg{multirow} package} The
+% \cs{tablenum} function is available to achieve alignment in these
+% situations: this is in effect a macro version of the \texttt{S} macro
+% (\cref{tab:tablenum}).
+%\begin{LaTeXdemo}[code and float]
+% \begin{table}
+% \caption{Controlling complex alignment with the \cs{tablenum}
+% macro.}
+% \label{tab:tablenum}
+% \centering
+% \begin{tabular}{lr}
+% \toprule
+% Heading & Heading \\
+% \midrule
+% Info & More info \\
+% Info & More info \\
+% \multicolumn{2}{c}{\tablenum[table-format = 4.4]{12,34}} \\
+% \multicolumn{2}{c}{\tablenum[table-format = 4.4]{333.5567}} \\
+% \multicolumn{2}{c}{\tablenum[table-format = 4.4]{4563.21}} \\
+% \bottomrule
+% \end{tabular}
+% \hfil
+% \begin{tabular}{lr}
+% \toprule
+% Heading & Heading \\
+% \midrule
+% \multirow{2}*{\tablenum{88,999}} & aaa \\
+% & bbb \\
+% \multirow{2}*{\tablenum{33,435}} & ccc \\
+% & ddd \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXdemo}
+%
% As a complement to the \texttt{S} column, \pkg{siunitx} also provides
-% a second column type, \texttt{s}. This is intended for producing
-% columns of units. The letters chosen are intended to be similar to
-% \cs{SI} and \cs{si}, respectively. This allows both macro-based and
-% explicit units to be printed easily (\cref{tab:s:demo}).
+% a second column type, \texttt{s}. This is intended for producing
+% columns of units. This allows both macro-based and explicit units to
+% be printed easily (\cref{tab:s:demo}).
%\begin{LaTeXdemo}[code and float]
% \begin{table}
% \centering
@@ -1284,7 +1293,7 @@ This work consists of the file siunitx.dtx
%
% As the \cs{si} macro can take literal or macro input, the \texttt{s}
% column cannot validate the input. \emph{Everything} in an \texttt{s}
-% column is therefore passed to the \cs{si} macro for processing. To
+% column is therefore passed to the \cs{si} macro for processing. To
% prevent this, you have to use \cs{multicolumn}, as is shown in
% \cref{tab:s:processing}. Notice that the braces do not prevent
% processing and colouring of the cell contents.
@@ -1294,12 +1303,12 @@ This work consists of the file siunitx.dtx
% \caption{The \texttt{s} column processes everything.}
% \label{tab:s:processing}
% \sisetup{color = orange}
-% \begin{tabular}{ss}
+% \begin{tabular}{ss}
% \toprule
-% {Unit} & \multicolumn{1}{c}{Unit}\\
+% {Unit} & \multicolumn{1}{c}{Unit}\\
% \midrule
% {\si{m^3}} & \multicolumn{1}{c}{\si{m^3}} \\
-% \kilogram & \kilogram \\
+% \kilogram & \kilogram \\
% \bottomrule
% \end{tabular}
% \end{table}
@@ -1308,30 +1317,33 @@ This work consists of the file siunitx.dtx
%\section{The key--value control system}
%
%\DescribeMacro{\sisetup}
-% The behaviour of the \pkg{siunitx} package is controlled by a
+% The behaviour of the \pkg{siunitx} package is controlled by a
% number of key--value options. These can be given globally using
% the \cs{sisetup} function or locally as the optional argument to the
-% user macros.
-%
+% user macros.
+%
% The package uses a range of different key types:
%\begin{description}
-% \item[\texttt{Choice}] Takes a limited number of choices, which
-% are described separately for each key.
+% \item[\texttt{Choice}] Takes a limited number of choices, which
+% are described separately for each key.
% \item[\texttt{Integer}] Requires a number as the argument.
+% \item[\texttt{Length}] Requires a length, either as a literal
+% value such as "2.0 cm", or stored as a \LaTeX{} length, or
+% \TeX{} dimension.
% \item[\texttt{Literal}] A key which uses the value(s) given directly,
% either to check input (for example the \texttt{input-digits} key)
% or in output.
% \item[\texttt{Math}] Similar to a \texttt{literal} option, but the
-% input is always used in math mode, irrespective of other
+% input is always used in math mode, irrespective of other
% \pkg{siunitx} settings. Thus to text-mode only input must be
% placed inside the argument of a \cs{text} macro.
-% \item[\texttt{Macro}] Requires a macro, which may need a single
+% \item[\texttt{Macro}] Requires a macro, which may need a single
% argument.
-% \item[\texttt{Meta}] These are options which actually apply
+% \item[\texttt{Meta}] These are options which actually apply
% a number of other options. As such, they do not take any
% value at all.
% \item[\texttt{Switch}] These are on--off switches, and recognise
-% \opt{true} and \opt{false}. Giving just the key name also
+% \opt{true} and \opt{false}. Giving just the key name also
% turns the key on.
%\end{description}
% The tables of option names use these descriptions to indicate how the
@@ -1342,8 +1354,8 @@ This work consists of the file siunitx.dtx
% The \pkg{siunitx} package controls the font used to print output
% independently of the surrounding material. The standard method is to
% ignore the surroundings entirely, and to use the current body fonts.
-% However, the package can detect and follow surrounding bold, italic
-% and font family changes. The font detection options are summarised in
+% However, the package can detect and follow surrounding bold, italic
+% and font family changes. The font detection options are summarised in
% \cref{tab:opt:font:det}.
%\begin{table}
% \centering
@@ -1351,7 +1363,7 @@ This work consists of the file siunitx.dtx
% \label{tab:opt:font:det}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule
@@ -1361,9 +1373,9 @@ This work consists of the file siunitx.dtx
% detect-inline-family & Choice & text \\
% detect-inline-weight & Choice & text \\
% detect-mode & Switch & false \\
-% detect-none & Meta & \meta{none} \\
+% detect-none & Meta & \meta{none} \\
% detect-shape & Switch & false \\
-% detect-weight & Switch & false \\
+% detect-weight & Switch & false \\
% \bottomrule
% \end{tabular}
%\end{table}
@@ -1372,15 +1384,17 @@ This work consists of the file siunitx.dtx
%\DescribeOption{detect-family}
%\DescribeOption{detect-shape}
%\DescribeOption{detect-mode}
+%\changes{v2.0o}{2010/07/21}{Extend \opt{detect-italic} option
+% to other shapes, renaming as \opt{detect-shape} as a result}
% The options \opt{detect-weight} and \opt{detect-shape} set detection
-% of the prevailing font weight and font shape states, respectively. The
-% font shape state is only checked if the surrounding material is not in
+% of the prevailing font weight and font shape states, respectively. The
+% font shape state is only checked if the surrounding material is not in
% math mode (as math text is always italic). The \opt{detect-shape}
% option is an extension of the older \opt{detect-italic} option, which
-% is retained for backward compatibility. Detecting the current
-% family (roman, sans serif or monospaced) is controlled by the
-% \opt{detect-family} setting, while the current mode (text or math)
-% is detected using the \opt{detect-mode} switch.
+% is retained for backward compatibility. Detecting the current
+% family (roman, sans serif or monospaced) is controlled by the
+% \opt{detect-family} setting, while the current mode (text or math)
+% is detected using the \opt{detect-mode} switch.
%\DescribeOption{detect-all}
%\DescribeOption{detect-none}
% For convenience, all of the preceding options can be turned on or
@@ -1389,43 +1403,48 @@ This work consists of the file siunitx.dtx
% of \opt{detect-weight}, \opt{detect-family}, \opt{detect-shape}
% and \opt{detect-mode} to \texttt{true}, while \opt{detect-none}
% sets all of them to \texttt{false}.
-%
+%
%\DescribeOption{detect-inline-family}
%\DescribeOption{detect-inline-weight}
+%\changes{v2.1k}{2011/02/09}{Remove \opt{combined} choice for option
+% \opt{detect-inline-weight}}
+%\changes{v2.1k}{2011/02/09}{New option \opt{detect-inline-family}}
+%\changes{v2.1l}{2011/02/10}{Error in font family detection introduced
+% in v2.1k corrected}
% When \pkg{siunitx} macros are used in in-line math, the detection
% of font weight and font family can be tuned using the
% \opt{detect-inline-family} and \opt{detect-inline-weight} options.
% Both of these take the choices \opt{text} and \opt{math}.
%\begin{LaTeXdemo}
% \sisetup{
-% detect-family = true,
+% detect-family = true,
% detect-inline-family = math
% }%
% $\num{1234}$ \\
-% { \sffamily $\num{1234}$ } \\
+% { \sffamily $\num{1234}$ } \\
% $ \mathsf { \num{1234}} $ \\
% \sisetup{detect-inline-family = text}
-% { \sffamily $\num{1234}$ } \\
+% { \sffamily $\num{1234}$ } \\
% $ \mathsf { \num{1234} } $ \\
% \sisetup{
-% detect-weight = true,
+% detect-weight = true,
% detect-inline-weight = math
% }%
% $\num{5678}$ \\
-% { \boldmath $\num{5678}$ } \\
+% { \boldmath $\num{5678}$ } \\
% { \bfseries $\num{5678}$ } \\
% \sisetup{detect-inline-weight = text}
% { \boldmath $\num{5678}$ } \\
% { \bfseries $\num{5678}$ }
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
%
%\DescribeOption{detect-display-math}
% The font detection system can treat displayed mathematical content
% in two ways. This is controlled by the \opt{detect-display-math}
-% option. When set \opt{true}, display mathematics is treated
-% independently from the body of the document. Thus the local
-% \emph{math} font is checked for matching. In contrast, when set
-% \opt{false}, display material is treated with the current running
+% option. When set \opt{true}, display mathematics is treated
+% independently from the body of the document. Thus the local
+% \emph{math} font is checked for matching. In contrast, when set
+% \opt{false}, display material is treated with the current running
% text font.\footnote{Here, \enquote{display} math means either typeset
% in \TeX's display math mode or using the AMS display-like
% environments. Simply using \cs{displaystyle} will not make otherwise
@@ -1446,29 +1465,29 @@ This work consists of the file siunitx.dtx
%\subsection{Output font families}
%
% The relationship between font family detected and font family used
-% for output is not fixed. The font detected by the package in the
+% for output is not fixed. The font detected by the package in the
% surrounding material does not have to match that used for output.
-%
+%
%\begin{table}
% \centering
% \caption{^^A
-% Font options (also available as \opt{number-\ldots} and
+% Font options (also available as \opt{number-\ldots} and
% \opt{unit-\ldots} versions).
% }
% \label{tab:opt:font:set}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule
% color & Literal & \meta{none} \\
% math-rm & Macro & \cs{mathrm} \\
-% math-sf & Macro & \cs{mathsf} \\
+% math-sf & Macro & \cs{mathsf} \\
% math-tt & Macro & \cs{mathtt} \\
% mode & Choice & math \\
% text-rm & Macro & \cs{rmfamily} \\
-% text-sf & Macro & \cs{sffamily} \\
+% text-sf & Macro & \cs{sffamily} \\
% text-tt & Macro & \cs{ttfamily} \\
% \bottomrule
% \end{tabular}
@@ -1477,13 +1496,13 @@ This work consists of the file siunitx.dtx
%\DescribeOption{mode}
% The \opt{mode} option determines whether \pkg{siunitx} uses
% math or text mode when printing output. The choices are \opt{math} and
-% \opt{text}. When using math mode, text is printed using a math font
-% whereas in text mode a text font is used. The extent to which this is
-% visually obvious depends on the fonts in use in the document. This
-% manual uses old style (lower-case) figures in text mode to highlight
-% the differences. This option has no effect if the \opt{detect-mode}
+% \opt{text}. When using math mode, text is printed using a math font
+% whereas in text mode a text font is used. The extent to which this is
+% visually obvious depends on the fonts in use in the document. This
+% manual uses old style (lower-case) figures in text mode to highlight
+% the differences. This option has no effect if the \opt{detect-mode}
% switch is \opt{true}.
-%
+%
%\DescribeOption{math-rm}
%\DescribeOption{math-sf}
%\DescribeOption{math-tt}
@@ -1493,10 +1512,10 @@ This work consists of the file siunitx.dtx
% If font family detection is inactive, \pkg{siunitx} uses the font
% family stored in either \opt{math-rm} or \opt{text-rm} for
% output. The choice of \opt{math} or \opt{text} depends on the
-% \opt{mode} setting. If font family detection is active,
-% \pkg{siunitx} may be using a sans serif or monospaced font for
-% output. In math mode, these are stored in \opt{math-sf} and
-% \opt{math-tt}, and for text mode in \opt{text-sf} and \opt{text-tt}.
+% \opt{mode} setting. If font family detection is active,
+% \pkg{siunitx} may be using a sans serif or monospaced font for
+% output. In math mode, these are stored in \opt{math-sf} and
+% \opt{math-tt}, and for text mode in \opt{text-sf} and \opt{text-tt}.
% Notice that the detected and output font families can differ.
%\begin{LaTeXdemo}
% \sisetup{detect-family}%
@@ -1504,13 +1523,13 @@ This work consists of the file siunitx.dtx
% { \sffamily \num{1234} } \\
% \SI{99}{\metre} \\
% \sisetup{math-rm = \mathtt}%
-% \SI{99}{\metre}
+% \SI{99}{\metre}
%\end{LaTeXdemo}
-%
-%\DescribeOption{color}
-% The colour of printed output can be set using the \opt{color}
-% option. When no colour is given, printing follows the surrounding
-% text. In contrast, when a specific colour is given, it is used
+%
+%\DescribeOption{color}
+% The colour of printed output can be set using the \opt{color}
+% option. When no colour is given, printing follows the surrounding
+% text. In contrast, when a specific colour is given, it is used
% irrespective of the surroundings. As there are a number of different
% colour models available, it is left to to user to load \pkg{color} or
% a more powerful colour package.
@@ -1523,46 +1542,47 @@ This work consists of the file siunitx.dtx
% Still red here!
%\end{LaTeXdemo}
%
-% Every one of the font options can be given independently for units
-% and number, with the prefixes \opt{unit-} and \opt{number-},
+% Every one of the font options can be given independently for units
+% and number, with the prefixes \opt{unit-} and \opt{number-},
% respectively. This allows fine control of output.
%\begin{LaTeXdemo}
% \SI{4}{\angstrom} \\
% \SI[number-color = green]{4}{\angstrom} \\
% \SI[unit-color = green]{4}{\angstrom}
%\end{LaTeXdemo}
-%
+%
%\subsection{Parsing numbers}
-%
-% The package uses a sophisticated parsing system to understand
+%
+% The package uses a sophisticated parsing system to understand
% numbers. This allows \pkg{siunitx} to carry out a range of
% formatting, as described later. All of the input options take lists of
% literal tokens, and are summarised in \cref{tab:opt:num:in}.
-%
+%
%\begin{table}
% \centering
% \caption{Options for number parsing.}
% \label{tab:opt:num:in}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule ^^A (
-% input-close-uncertainty & Literal & ) \\
-% input-comparators & Literal &
+% input-close-uncertainty & Literal & ) \\
+% input-comparators & Literal &
% <=>\cs{approx}\cs{ge}\cs{geq} \\
% & & \cs{gg}\cs{le}\cs{leq}\cs{ll} \cs{sim} \\
-% input-complex-roots & Literal & ij \\
+% input-complex-roots & Literal & ij \\
% input-decimal-markers & Literal & ., \\
% input-digits & Literal & 0123456789 \\
% input-exponent-markers & Literal & dDeE \\
% input-ignore & Literal & \meta{none} \\
-% input-open-uncertainty & Literal & ( \\ ^^A )
-% input-protect-tokens & Literal &
+% input-open-uncertainty & Literal & ( \\ ^^A )
+% input-protect-tokens & Literal &
% \cs{approx}\cs{ge}\cs{geq}\cs{gg}\cs{le} \\
% & & \cs{leq}\cs{ll}\cs{mp}\cs{pi}\cs{pm}\cs{sim} \\
% input-signs & Literal & +-\cs{pm}\cs{mp} \\
+% input-uncertainty-signs & Literal & \cs{pm} \\
% input-symbols & Literal & \cs{pi} \\
% parse-numbers & Switch & true \\
% \bottomrule
@@ -1572,26 +1592,28 @@ This work consists of the file siunitx.dtx
%\DescribeOption{input-digits}
%\DescribeOption{input-decimal-markers}
%\DescribeOption{input-signs}
-%\DescribeOption{input-exponent-markers}
+%\DescribeOption{input-exponent-markers}
% The basic parts of a number are the digits, any sign and a separator
% between the integer and decimal parts. These are stored in the input
-% options \opt{input-digits}, \opt{input-decimal-markers} and
-% \opt{input-signs}, respectively. More than one input decimal marker
-% can be used: it will be converted by the package to the appropriate
-% output marker. Numbers which include an exponent part also require
-% a marker for the exponent: this again is taken from the range of
+% options \opt{input-digits}, \opt{input-decimal-markers} and
+% \opt{input-signs}, respectively. More than one input decimal marker
+% can be used: it will be converted by the package to the appropriate
+% output marker. Numbers which include an exponent part also require
+% a marker for the exponent: this again is taken from the range of
% tokens in the \opt{input-exponent-markers} option.
-%
+%
%\DescribeOption{input-symbols}
%\DescribeOption{input-ignore}
-% As well as \enquote{normal} digits, the package will interpret
-% symbolic \enquote{numbers} (such as \cs{pi}) correctly if they are
+% As well as \enquote{normal} digits, the package will interpret
+% symbolic \enquote{numbers} (such as \cs{pi}) correctly if they are
% included in the \opt{input-symbols} list. Symbols are always
-% printed in math mode. Tokens given in the \opt{input-ignore} list
-% are totally passed over by \pkg{siunitx}: they will be removed from
+% printed in math mode. Tokens given in the \opt{input-ignore} list
+% are totally passed over by \pkg{siunitx}: they will be removed from
% the input with no further processing.
-%
+%
%\DescribeOption{input-comparators}
+%\changes{v2.1}{2010/10/26}{New \opt{input-comparators} option
+% for numbers greater than, less than and so on}
% In addition to signs, \pkg{siunitx} can recognise comparators, such
% as \texttt{<}. The package will automatically carry out conversions
% for "<<", ">>", "<=" and ">=" to \cs{ll}, \cs{gg}, \cs{le} and
@@ -1600,37 +1622,52 @@ This work consists of the file siunitx.dtx
% \num{< 10} \\
% \SI{>> 5}{\metre} \\
% \num{\le 0.12}
-%\end{LaTeXdemo}
-%
+%\end{LaTeXdemo}
+%
%\DescribeOption{input-open-uncertainty}
-%\DescribeOption{input-close-uncertainty}
-% In some fields, it is common to give the uncertainty in a number
-% in brackets after the main part of the number, for example
-% \enquote{\num{1.234(5)}}. The opening and closing symbols used for
-% this type of input are set as \opt{input-open-uncertainty} and
+%\DescribeOption{input-close-uncertainty}
+% In some fields, it is common to give the uncertainty in a number
+% in brackets after the main part of the number, for example
+% \enquote{\num{1.234(5)}}. The opening and closing symbols used for
+% this type of input are set as \opt{input-open-uncertainty} and
% \opt{input-close-uncertainty}.
+%\DescribeOption{input-uncertainty-signs}
+%\changes{v2.2}{2011/04/03}{New \opt{input-uncertainty-signs}
+% option}
+% Alternatively, the uncertainty may be given as a separate part
+% following a sign. Which signs are valid for this operation is
+% determined by the \opt{input-uncertainty-signs} option. As with
+% other signs, the combination \texttt{+-} will automatically be
+% converted to \cs{pm} internally.
+%\begin{LaTeXdemo}
+% \num{9.99(9)} \\
+% \num{9.99 +- 0.09} \\
+% \num{9.99 \pm 0.09} \\
+% \num{123 +- 4.5} \\
+% \num{12.3 +- 6}
+%\end{LaTeXdemo}
%
%\DescribeOption{input-complex-roots}
-% When using complex numbers in input, the complex root
+% When using complex numbers in input, the complex root
% (\( \mathrm{i} = \sqrt{-1}\)) is indicated by one of the tokens stored
-% in \opt{input-complex-roots}. The parser understands complex root
+% in \opt{input-complex-roots}. The parser understands complex root
% symbols given either before or after the associated number (but will
% detect any invalid arrangement):
%\begin{LaTeXdemo}
% \num{9.99 + 88.8i} \\
% \num{9.99 + i88.8}
-%\end{LaTeXdemo}
-%
+%\end{LaTeXdemo}
+%
%\DescribeOption{input-protect-tokens}
-% Some symbols can be problematic under expansion in \LaTeXe. To allow
+% Some symbols can be problematic under expansion in \LaTeXe. To allow
% these to be used in input without issue, the package can protect these
-% tokens while expanding input. Symbols to be protected in this way
+% tokens while expanding input. Symbols to be protected in this way
% should be listed in \opt{input-protect-tokens}.
-%
+%
%\DescribeOption{parse-numbers}
% The \opt{parse-numbers} option turns the entire parsing system on
% and off. The option is made available for two reasons. First, if
-% all of the numbers in a document are to be reproduced \enquote{as
+% all of the numbers in a document are to be reproduced \enquote{as
% given}, turning off the parser will represent a significant saving in
% processing required. Second, it allows the use of arbitrary \TeX\
% code in numbers. If the parser is turned off, the input will be
@@ -1643,9 +1680,9 @@ This work consists of the file siunitx.dtx
%
%\subsection{Post-processing numbers}
%
-% Before typesetting numbers, various post-processing steps can be
-% carried out. These involve adding or removing information from the
-% number in a systematic way; the options are summarised in
+% Before typesetting numbers, various post-processing steps can be
+% carried out. These involve adding or removing information from the
+% number in a systematic way; the options are summarised in
% \cref{tab:opt:num:post}.
%
%\begin{table}
@@ -1654,22 +1691,23 @@ This work consists of the file siunitx.dtx
% \label{tab:opt:num:post}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule
-% add-decimal-zero & Switch & true \\
-% add-integer-zero & Switch & true \\
-% explicit-sign & Literal & \m{none} \\
-% retain-explicit-plus & Switch & false \\
-% retain-unity-mantissa & Switch & true \\
-% retain-zero-exponent & Switch & false \\
-% round-integer-to-decimal & Switch & false \\
-% round-minimum & Literal & 0 \\
-% round-mode & Choice & off \\
-% round-precision & Integer & 2 \\
-% scientific-notation & Switch & false \\
-% scientific-notation-exponent & Integer & 0 \\
+% add-decimal-zero & Switch & true \\
+% add-integer-zero & Switch & true \\
+% explicit-sign & Literal & \m{none} \\
+% fixed-exponent & Integer & 0 \\
+% minimum-integer-digits & Integer & 0 \\
+% retain-explicit-plus & Switch & false \\
+% retain-unity-mantissa & Switch & true \\
+% retain-zero-exponent & Switch & false \\
+% round-integer-to-decimal & Switch & false \\
+% round-minimum & Literal & 0 \\
+% round-mode & Choice & off \\
+% round-precision & Integer & 2 \\
+% scientific-notation & Switch & false \\
% \bottomrule
% \end{tabular}
%\end{table}
@@ -1705,6 +1743,8 @@ This work consists of the file siunitx.dtx
% \num{0.12345(9)}
%\end{LaTeXdemo}
%\DescribeOption{round-integer-to-decimal}
+%\changes{v2.1}{2010/10/25}{New \opt{round-integer-to-decimal} option
+% to convert integers to decimals on rounding}
% The standard settings for \pkg{siunitx} do not add a decimal part
% if none was given in the input. The \opt{round-integer-to-decimal}
% option can be used to allow this conversion as part of the rounding
@@ -1717,6 +1757,8 @@ This work consists of the file siunitx.dtx
% \num[round-mode = places]{1}
%\end{LaTeXdemo}
%\DescribeOption{round-minimum}
+%\changes{v2.1}{2010/10/27}{New \opt{round-minimum} option
+% to set a floor for rounding numbers downward}
% There are cases in which rounding will result in the number reaching
% zero. It may be desirable to show such results as below a threshold
% value. This can be achieved by setting \opt{round-minimum} to the
@@ -1735,8 +1777,8 @@ This work consists of the file siunitx.dtx
%\DescribeOption{add-decimal-zero}
%\DescribeOption{add-integer-zero}
% It is possible to give real (floating point) numbers as input omitting
-% the decimal or the integer parts of the number (for example \num{.123}
-% or \num{123.}). The options \opt{add-decimal-zero} and
+% the decimal or the integer parts of the number (for example \num{.123}
+% or \num{123.}). The options \opt{add-decimal-zero} and
% \opt{add-integer-zero} allow the package to \enquote{fill in} the
% missing zero.
%\begin{LaTeXdemo}
@@ -1749,7 +1791,20 @@ This work consists of the file siunitx.dtx
% }%
% \num{123.} \\
% \num{456} \\
-% \num{.789}
+% \num{.789}
+%\end{LaTeXdemo}
+%\DescribeOption{minimum-integer-digits}
+%\changes{v2.2}{2011/04/04}{New \opt{minimum-integer-digits} option}
+% Related is the \opt{minimum-integer-digits} option. This applies
+% only to the integer part of the mantissa, and ensures that it will
+% contain at least the specified number of digits. This is achieved
+% by padding with zeros if needed.
+%\begin{LaTeXdemo}
+% \num{123} \\
+% \num[minimum-integer-digits = 1]{123} \\
+% \num[minimum-integer-digits = 2]{123} \\
+% \num[minimum-integer-digits = 3]{123} \\
+% \num[minimum-integer-digits = 4]{123}
%\end{LaTeXdemo}
%
%\DescribeOption{explicit-sign}
@@ -1764,42 +1819,51 @@ This work consists of the file siunitx.dtx
% \num{+345} \\
% \num[retain-explicit-plus]{+345} \\
% \num[explicit-sign = -]{345} \\
-% \num[explicit-sign = -]{+345}
+% \num[explicit-sign = -]{+345}
%\end{LaTeXdemo}
%
%\DescribeOption{retain-unity-mantissa}
%\DescribeOption{retain-zero-exponent}
-% The retention of a zero exponent is controlled by the
+% The retention of a zero exponent is controlled by the
% \opt{retain-zero-exponent} option. The retention of a mantissa of one
% is likewise controlled by the \opt{retain-unity-mantissa} option.
%\begin{LaTeXdemo}
% \num{1e4} \\
% \num[retain-unity-mantissa = false]{1e4} \\
% \num{444e0} \\
-% \num[retain-zero-exponent = true]{444e0}
+% \num[retain-zero-exponent = true]{444e0}
%\end{LaTeXdemo}
%
%\DescribeOption{scientific-notation}
+%\changes{v2.1}{2010/10/13}{New \opt{scientific-notation} option
+% for to use exponent form for numbers in all cases}
+%\changes{v2.2}{2011/04/04}{Extend \opt{scientific-notation} option
+% to include \opt{engineering} mode}
%\DescribeOption{fixed-exponent}
% Numbers can be converted to scientific notation by the package. This
% is controlled by the \opt{scientific-notation} option, which takes
-% choices \opt{false}, \opt{true} and \opt{fixed}. In the later case,
-% the exponent value used will be set by the \opt{fixed-exponent}
-% option.
+% choices \opt{false}, \opt{true}, \opt{fixed} and
+% \opt{engineering}. The \opt{fixed} setting will use the exponent value
+% by the \opt{fixed-exponent} option. When \opt{engineering} is set,
+% the exponent is always a power of three.
%\begin{LaTeXdemo}
% \num{0.001} \\
-% \num{0.00100} \\
+% \num{0.0100} \\
% \num{1200} \\
% \sisetup{scientific-notation = true}%
% \num{0.001} \\
-% \num{0.00100} \\
+% \num{0.0100} \\
+% \num{1200} \\
+% \sisetup{scientific-notation = engineering}%
+% \num{0.001} \\
+% \num{0.0100} \\
% \num{1200} \\
% \sisetup{
% fixed-exponent = 2,
% scientific-notation = fixed,
% }%
% \num{0.001} \\
-% \num{0.00100} \\
+% \num{0.0100} \\
% \num{1200}
%\end{LaTeXdemo}
%
@@ -1810,19 +1874,20 @@ This work consists of the file siunitx.dtx
% grouping and so on. All of these options are concerned with the
% appearance of output, rather than the data it conveys. The options are
% summarised in \cref{tab:opt:num:out}.
-%
+%
%\begin{table}
% \centering
% \caption{Output options for numbers.}
% \label{tab:opt:num:out}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
-% \midrule
+% \midrule
+% bracket-negative-numbers & Switch & false \\
% bracket-numbers & Switch & true \\ ^^A (
-% close-bracket & Literal & ) \\
+% close-bracket & Literal & ) \\
% complex-root-position & Choice & after-number \\
% copy-complex-root & Choice & false \\
% copy-decimal-marker & Choice & false \\
@@ -1834,11 +1899,12 @@ This work consists of the file siunitx.dtx
% group-integer-digits & Switch & true \\
% group-separator & Math & \cs{,} \\
% negative-color & Literal & \meta{none} \\
-% open-bracket & Literal & (
+% open-bracket & Literal & (
% \\ ^^A ) (
-% output-close-uncertainty & Literal & ) \\
+% output-close-uncertainty & Literal & ) \\
% output-complex-root & Math & \verb=\mathrm{i}= \\
% output-decimal-marker & Math & . \\
+% output-exponent-marker & Literal & \meta{none} \\
% output-open-uncertainty & Literal & ( \\ ^^A )
% separate-uncertainty & Switch & false \\
% tight-spacing & Switch & false \\
@@ -1857,7 +1923,7 @@ This work consists of the file siunitx.dtx
% turns this behaviour on and off, with grouping for numbers of exactly
% four digits controlled by the \opt{group-four-digits} choice. Note
% that the later only applies if \opt{group-digits} is turned on.
-% The separator used between groups of digits is stored by the
+% The separator used between groups of digits is stored by the
% \opt{group-separator} option. This takes literal input and is
% used in math mode: for a text-mode full space use "\text{~}".
%\begin{LaTeXdemo}
@@ -1867,27 +1933,29 @@ This work consists of the file siunitx.dtx
% \num[group-four-digits = true]{1234} \\
% \num{12345} \\
% \num[group-separator = {,}]{12345} \\
-% \num[group-separator = \text{~}]{12345}
-%\end{LaTeXdemo}
+% \num[group-separator = \text{~}]{12345}
+%\end{LaTeXdemo}
% Grouping can be activated separately for the integer and decimal
-% parts of a number using the \opt{group-integer-digits} and
+% parts of a number using the \opt{group-integer-digits} and
% \opt{group-decimal-digits} options.
%\begin{LaTeXdemo}
% \sisetup{group-digits = false}%
% \num{12345.67890} \\
% \num[group-decimal-digits]{12345.67890} \\
-% \num[group-integer-digits]{12345.67890}
+% \num[group-integer-digits]{12345.67890}
%\end{LaTeXdemo}
%
%\DescribeOption{output-complex-root}
%\DescribeOption{output-decimal-marker}
%\DescribeOption{copy-complex-root}
+%\changes{v2.1}{2010/10/02}{New \opt{copy-complex-root} option for
+% moving input complex root to output}
%\DescribeOption{copy-decimal-marker}
-% The decimal marker used in output is set using the
-% \opt{output-decimal-marker} option. This can differ from the input
-% marker, as can the root of $\sqrt{-1}$, which is stored in the
-% \opt{output-complex-root} option. The later is always in math mode,
-% but the standard setting uses \cs{mathrm} to give an upright
+% The decimal marker used in output is set using the
+% \opt{output-decimal-marker} option. This can differ from the input
+% marker, as can the root of $\sqrt{-1}$, which is stored in the
+% \opt{output-complex-root} option. The later is always in math mode,
+% but the standard setting uses \cs{mathrm} to give an upright
% \enquote{i}: this can easily be altered. The complex root or decimal
% marker from the input can be used in the output by setting the
% \opt{copy-complex-root} and \opt{copy-decimal-marker} options,
@@ -1911,10 +1979,10 @@ This work consists of the file siunitx.dtx
% \num[complex-root-position = before-number]{67-0.9i} \\
% \num[complex-root-position = after-number]{67-0.9i}
%\end{LaTeXdemo}
-%
+%
%\DescribeOption{exponent-base}
%\DescribeOption{exponent-product}
-% When exponents are present in the input, the
+% When exponents are present in the input, the
% \opt{exponent-base} and \opt{exponent-product} options set the obvious
% parts of the output. Notice that the base is in the current mode, but
% the product sign is always in math mode.
@@ -1923,18 +1991,28 @@ This work consists of the file siunitx.dtx
% \num[exponent-product = \cdot]{1e2} \\
% \num[exponent-base = 2]{1e2}
%\end{LaTeXdemo}
+%\DescribeOption{output-exponent-marker}
+%\changes{v2.2}{2011/04/03}{New \opt{output-exponent-marker} option}
+% Alternatively, if the \opt{output-exponent-marker} option is
+% set then the value stored will be used in place of the normal
+% product and base combination. This will normally be set up to
+% ensure math or text mode.
+%\begin{LaTeXdemo}
+% \num[output-exponent-marker = \text{e}]{1e2} \\
+% \num[output-exponent-marker = \ensuremath{\mathrm{E}}]{1e2}
+%\end{LaTeXdemo}
%
%\DescribeOption{separate-uncertainty}
%\DescribeOption{uncertainty-separator}
%\DescribeOption{output-open-uncertainty}
%\DescribeOption{output-close-uncertainty}
-% When input is given including an uncertainty in a number, it can be
-% printed either with the uncertainty in brackets or as a separate
-% number. This behaviour is controlled by the
-% \opt{separate-uncertainty} choice. If the uncertainty is given in
-% brackets, a space may be added between the main number and the
+% When input is given including an uncertainty in a number, it can be
+% printed either with the uncertainty in brackets or as a separate
+% number. This behaviour is controlled by the
+% \opt{separate-uncertainty} choice. If the uncertainty is given in
+% brackets, a space may be added between the main number and the
% uncertainty: this is stored using the \opt{uncertainty-separator}
-% option. The opening and closing brackets used are stored in
+% option. The opening and closing brackets used are stored in
% \opt{output-open-uncertainty} and
% \opt{output-close-uncertainty}, respectively.
%\begin{LaTeXdemo}
@@ -1950,7 +2028,7 @@ This work consists of the file siunitx.dtx
% Notice that \pkg{siunitx} correctly interprets uncertainties which
% cross the decimal marker position whether these are separated out
% or not.
-%\begin{LaTeXdemo}
+%\begin{LaTeXdemo}
% \num{8.2(13)} \\
% \num[separate-uncertainty]{8.2(13)}
%\end{LaTeXdemo}
@@ -1960,7 +2038,7 @@ This work consists of the file siunitx.dtx
%\DescribeOption{close-bracket}
% There are certain combinations of numerical input which can be
% ambiguous. This can be corrected by adding brackets in the appropriate
-% place, and is controlled by the \opt{bracket-numbers} switch. The
+% place, and is controlled by the \opt{bracket-numbers} switch. The
% opening and closing brackets used are stored in \opt{open-bracket} and
% \opt{close-bracket}, respectively. Note that \opt{bracket-numbers}
% only applies to numbers without units: for numbers with units
@@ -1984,17 +2062,31 @@ This work consists of the file siunitx.dtx
% \num[negative-color = red]{-15673}
%\end{LaTeXdemo}
%
+%\DescribeOption{bracket-negative-numbers}
+%\changes{v2.2}{2011/04/02}{New \opt{bracket-negative-numbers} option}
+% A common means to display negative numbers in financial situations
+% is to place them in brackets. This can be carried out automatically
+% using the \opt{bracket-negative-numbers} option.
+%\begin{LaTeXdemo}
+% \num{-15673} \\
+% \num[bracket-negative-numbers]{-15673} \\
+% \SI{-10}{\metre} \\
+% \SI[bracket-negative-numbers]{-10}{\metre}
+%\end{LaTeXdemo}
+%
%\DescribeOption{tight-spacing}
+%\changes{v2.0y}{2010/10/09}{Error with \opt{tight-spacing} option
+% and exponents corrected}
% Under some circumstances is may be desirable to \enquote{squeeze}
% the output spacing. This is turned on using the \opt{tight-spacing}
% switch, which compresses spacing where possible.
%\begin{LaTeXdemo}
% \num{1 \pm 2i e3} \\
-% \num[tight-spacing = true]{1 \pm 2i e3}
+% \num[tight-spacing = true]{1 \pm 2i e3}
%\end{LaTeXdemo}
%
% Lists and ranges of numbers have a small number of specialised
-% options, which apply on to these more unusual input forms
+% options, which apply on to these more unusual input forms
% (\cref{tab:opt:num:list}).
%
%\begin{table}
@@ -2003,10 +2095,10 @@ This work consists of the file siunitx.dtx
% \label{tab:opt:num:list}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
-% \midrule
+% \midrule
% list-final-separator & Literal & \verb*= and = \\
% list-separator & Literal & \verb*=, = \\
% range-phrase & Literal & \verb*= to = \\
@@ -2033,9 +2125,9 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
%\DescribeOption{range-phrase}
-% Ranges of numbers can be given as input. These will have an
+% Ranges of numbers can be given as input. These will have an
% appropriate word or symbol inserted between the two entries: this
-% is stored using the \opt{range-phrase} option. The phrase should
+% is stored using the \opt{range-phrase} option. The phrase should
% include any necessary spaces: no extra space is added.
%\begin{LaTeXdemo}
% \numrange{5}{100} \\
@@ -2044,18 +2136,18 @@ This work consists of the file siunitx.dtx
%
%\subsection{Multi-part numbers}
%
-% \pkg{siunitx} recognises the idea of products and quotients in
+% \pkg{siunitx} recognises the idea of products and quotients in
% numbers, both with and without units. These multi-part numbers have
% a number of options affecting how they are processed. The options are
% summarised in \cref{tab:opt:num:multi}.
-%
+%
%\begin{table}
% \centering
% \caption{Multi-part number options.}
% \label{tab:opt:num:multi}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule ^^A (
@@ -2091,7 +2183,7 @@ This work consists of the file siunitx.dtx
%
%\DescribeOption{quotient-mode}
% For quotients, there is the possibility to print output either using
-% a slash, or using the \cs{frac} macro. This is controlled by the
+% a slash, or using the \cs{frac} macro. This is controlled by the
% \opt{quotient} choice option, which takes values \opt{symbol} and
% \opt{fraction}.
%\begin{LaTeXdemo}
@@ -2100,28 +2192,28 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
%\DescribeOption{fraction-function}
-% The function used when \opt{quotient-mode = fraction} is set is
+% The function used when \opt{quotient-mode = fraction} is set is
% determined by the \opt{fraction-function} option. This should
% be set to a function which takes two arguments, and presumably
% creates some type of fraction. Most alternatives to the standard
% \cs{frac} function will involve loading additional packages: the
-% demonstrations here need \pkg{amsmath} and
+% demonstrations here need \pkg{amsmath} and
% \pkg{xfrac}.\footnote{If \pkg{xfrac} is not available when typesetting
% this document, the demonstration of \cs{sfrac} will have the wrong
% appearance.}
%\begin{LaTeXdemo}
% \sisetup{quotient-mode = fraction}
% \num{1 / 1}
-% \num[fraction-function = \dfrac]{1 / 2}
-% \num[fraction-function = \sfrac]{1 / 3}
-% \num[fraction-function = \tfrac]{1 / 4}
+% \num[fraction-function = \dfrac]{1 / 2}
+% \num[fraction-function = \sfrac]{1 / 3}
+% \num[fraction-function = \tfrac]{1 / 4}
%\end{LaTeXdemo}
%
%\subsection{Angles}
%
-% Angle processing provided by the \cs{ang} function has a set of options
-% which apply in addition to the general ones set up for number processing
-% (\cref{tab:opt:ang}).
+% Angle processing provided by the \cs{ang} function has a set of
+% options which apply in addition to the general ones set up for number
+% processing (\cref{tab:opt:ang}).
%
%\begin{table}
% \centering
@@ -2129,28 +2221,28 @@ This work consists of the file siunitx.dtx
% \label{tab:opt:ang}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule
% add-arc-degree-zero & Switch & false \\
-% add-arc-minute-zero & Switch & false \\
-% add-arc-second-zero & Switch & false \\
+% add-arc-minute-zero & Switch & false \\
+% add-arc-second-zero & Switch & false \\
% angle-symbol-over-decimal & Switch & false \\
% arc-separator & Math & false \\
-% number-angle-separator & Math & \meta{empty} \\
+% number-angle-product & Math & \meta{empty} \\
% \bottomrule
% \end{tabular}
%\end{table}
%
-%\DescribeOption{number-angle-separator}
+%\DescribeOption{number-angle-product}
% The separator between the number and angle symbol (degrees, minutes
-% or seconds) can be set using the \opt{number-angle-separator}
-% option, independent of the related \opt{number-unit-separator}
+% or seconds) can be set using the \opt{number-angle-product}
+% option, independent of the related \opt{number-unit-product}
% option used by the \cs{SI} function.
%\begin{LaTeXdemo}
% \ang{2.67} \\
-% \ang[number-angle-separator = \,]{2.67}
+% \ang[number-angle-product = \,]{2.67}
%\end{LaTeXdemo}
%
%\DescribeOption{arc-separator}
@@ -2165,7 +2257,7 @@ This work consists of the file siunitx.dtx
%\DescribeOption{add-arc-minute-zero}
%\DescribeOption{add-arc-second-zero}
% Zero-filling for the degree, minute or second parts of an arc is
-% controlled using the \opt{add-arc-degree-zero},
+% controlled using the \opt{add-arc-degree-zero},
% \opt{add-arc-minute-zero} and \opt{add-arc-second-zero} options.
% All are off as standard.
%\begin{LaTeXdemo}
@@ -2189,7 +2281,7 @@ This work consists of the file siunitx.dtx
%\DescribeOption{angle-symbol-over-decimal}
% In some subject areas, most notably astronomy, the angle symbols
% are given over the decimal marker, rather than at the end of the
-% number. This behaviour is available using the
+% number. This behaviour is available using the
% \opt{angle-symbol-over-decimal} option.
%\begin{LaTeXdemo}
% \ang{45.697} \\
@@ -2201,21 +2293,21 @@ This work consists of the file siunitx.dtx
%\subsection{Creating units}
%\label{sec:units:creating}
%
-% The various macro units are created at the start of the document.
-% \pkg{siunitx} can define these such that they are only available for
+% The various macro units are created at the start of the document.
+% \pkg{siunitx} can define these such that they are only available for
% use within the \cs{si} and \cs{SI} functions, or can make the unit
% macros available throughout the document body. There are a number of
-% settings which control this creation process
+% settings which control this creation process
% (\cref{tab:opt:units:def}). As a result, these options all apply
% in the preamble only.
-%
+%
%\begin{table}
% \centering
% \caption{Unit creation options.}
% \label{tab:opt:units:def}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule ^^A (
@@ -2229,20 +2321,26 @@ This work consists of the file siunitx.dtx
%\end{table}
%
%\DescribeOption{free-standing-units}
+%\changes{v2.1d}{2010/11/14}{Apply unit options when
+% \opt{free-standing-units} is active}
+%\changes{v2.1e}{2010/11/22}{Further corrections when applying unit
+% options when \opt{free-standing-units} is active}
%\DescribeOption{overwrite-functions}
-% The \opt{free-standing-units} option controls whether the unit macros
+% The \opt{free-standing-units} option controls whether the unit macros
% exist outside of the \cs{si} and \cs{SI} arguments. When this option
% is \opt{true}, \pkg{siunitx} creates the macros for general use.
% The standard method to achieve this does not overwrite any existing
-% macros: this behaviour can be altered using the
+% macros: this behaviour can be altered using the
% \opt{overwrite-functions} switch.
-%
+%
%\DescribeOption{space-before-unit}
%\DescribeOption{unit-optional-argument}
+%\changes{v2.1f}{2010/11/24}{Typo in definition for
+% \opt{unit-optional-argument} implementation corrected}
%\DescribeOption{use-xspace}
% When \enquote{free standing} unit macros are created, their behaviour
% can be adjusted by a number of options. These are mainly intended for
-% emulating the input syntax of older packages. The option
+% emulating the input syntax of older packages. The option
% \opt{unit-optional-argument} gives the same behaviour for the
% inputs
%\begin{LaTeXdemo}[code only]
@@ -2253,7 +2351,7 @@ This work consists of the file siunitx.dtx
% \metre[10].
%\end{LaTeXdemo}
% The \opt{space-before-unit} and \opt{use-xspace} options control
-% the behaviour at the \enquote{ends} of the unit macros. Activating
+% the behaviour at the \enquote{ends} of the unit macros. Activating
% \opt{space-before-unit} inserts the number--unit space before the
% unit is printed. This is suitable for the input syntax
%\begin{LaTeXdemo}[code only]
@@ -2273,14 +2371,15 @@ This work consists of the file siunitx.dtx
% to make life easier for the user. The files are loaded using the
% \opt{load-configurations} option, which accepts a comma-separated of
% file names.
-%
-% The first configuration file provides a number of convenient
-% abbreviations for the SI units (\cref{tab:unit:abbr}). The
+%
+% The first configuration file provides a number of convenient
+% abbreviations for the SI units (\cref{tab:unit:abbr}). The
% standard \pkg{siunitx} settings only create these abbreviations within
-% the scope of the \cs{si} and \cs{SI} functions, meaning that no
-% clashes should occur (for example with the standard \cs{pm} symbol).
-%
-%\begin{center}
+% the scope of the \cs{si} and \cs{SI} functions, meaning that no
+% clashes should occur (for example with the standard \cs{pm} symbol).
+%
+%\begin{center}
+% \changes{v2.0n}{2010/07/15}{More abbreviated units}
% \tablecaption{Abbreviated units \endgraf
% (\opt{load-configurations=abbreviations}).}
% \label{tab:unit:abbr}
@@ -2309,13 +2408,13 @@ This work consists of the file siunitx.dtx
% \DescribeNamedUnit{picogram}{pg} \\
% \DescribeNamedUnit{nanogram}{ng} \\
% \DescribeNamedUnit{microgram}{ug} \\
-% \DescribeNamedUnit{milligram}{mg} \\
-% \DescribeNamedUnit{gram}{g} \\
+% \DescribeNamedUnit{milligram}{mg} \\
+% \DescribeNamedUnit{gram}{g} \\
% \DescribeNamedUnit{kilogram}{kg} \\
% \DescribeNamedUnit{atomic mass unit}{amu} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{picometre}{pm} \\
% \DescribeNamedUnit{nanometre}{nm} \\
% \DescribeNamedUnit{micrometre}{um} \\
@@ -2324,9 +2423,9 @@ This work consists of the file siunitx.dtx
% \DescribeNamedUnit{decimetre}{dm} \\
% \DescribeNamedUnit{metre}{m} \\
% \DescribeNamedUnit{kilometre}{km} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{attosecond}{as} \\
% \DescribeNamedUnit{femtosecond}{fs} \\
% \DescribeNamedUnit{picosecond}{ps} \\
@@ -2334,9 +2433,9 @@ This work consists of the file siunitx.dtx
% \DescribeNamedUnit{microsecond}{us} \\
% \DescribeNamedUnit{millisecond}{ms} \\
% \DescribeNamedUnit{second}{s} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{femtomole}{fmol} \\
% \DescribeNamedUnit{picomole}{pmol} \\
% \DescribeNamedUnit{nanomole}{nmol} \\
@@ -2344,62 +2443,65 @@ This work consists of the file siunitx.dtx
% \DescribeNamedUnit{millimole}{mmol} \\
% \DescribeNamedUnit{mole}{mol} \\
% \DescribeNamedUnit{kilomole}{kmol} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{picoampere}{pA} \\
% \DescribeNamedUnit{nanoampere}{nA} \\
% \DescribeNamedUnit{microampere}{uA} \\
% \DescribeNamedUnit{milliampere}{mA} \\
% \DescribeNamedUnit{ampere}{A} \\
% \DescribeNamedUnit{kiloampere}{kA} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{microlitre}{ul} \\
% \DescribeNamedUnit{millilitre}{ml} \\
% \DescribeNamedUnit{litre}{l} \\
% \DescribeNamedUnit{microliter}{uL} \\
% \DescribeNamedUnit{milliliter}{mL} \\
% \DescribeNamedUnit{liter}{L} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{millihertz}{mHz} \\
% \DescribeNamedUnit{hertz}{Hz} \\
% \DescribeNamedUnit{kilohertz}{kHz} \\
% \DescribeNamedUnit{megahertz}{MHz} \\
% \DescribeNamedUnit{gigahertz}{GHz} \\
% \DescribeNamedUnit{terahertz}{THz} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{newton}{N} \\
% \DescribeNamedUnit{millinewton}{mN} \\
% \DescribeNamedUnit{kilonewton}{kN} \\
% \DescribeNamedUnit{meganewton}{MN} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{pascal}{Pa} \\
% \DescribeNamedUnit{kilopascal}{kPa} \\
% \DescribeNamedUnit{megapacal}{MPa} \\
% \DescribeNamedUnit{gigapascal}{GPa} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{milliohm}{mohm} \\
% \DescribeNamedUnit{kilohm}{kohm} \\
% \DescribeNamedUnit{megohm}{Mohm} \\
-%
+%
% \midrule
-%
+%
+% \DescribeNamedUnit{picovolt}{pV} \\
+% \DescribeNamedUnit{nanovolt}{nV} \\
+% \DescribeNamedUnit{microvolt}{uV} \\
% \DescribeNamedUnit{millivolt}{mV} \\
% \DescribeNamedUnit{volt}{V} \\
% \DescribeNamedUnit{kilovolt}{kV} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{watt}{W} \\
% \DescribeNamedUnit{milliwatt}{mW} \\
% \DescribeNamedUnit{kilowatt}{kW} \\
@@ -2414,13 +2516,13 @@ This work consists of the file siunitx.dtx
% \DescribeNamedUnit{gigaelectronvolt}{GeV} \\
% \DescribeNamedUnit{teraelectronvolt}{TeV} \\
% \DescribeNamedUnit{kilowatt hour}{kWh} \\
-%
+%
% \midrule
-%
+%
% \DescribeNamedUnit{kelvin}{K} \\
-%
+%
% \end{xtabular}
-%\end{center}
+%\end{center}
%
%\DescribeMacro{\bit}
%\DescribeMacro{\byte}
@@ -2460,7 +2562,7 @@ This work consists of the file siunitx.dtx
% and define macros as defined by version 1 of \pkg{siunitx}: this
% can be accessed with the option \opt{load-configurations = version-1}.
% This is intended to allow easy transition to version 2: users
-% should update their source to use the new interfaces and functions.
+% should update their source to use the new interfaces and functions.
%
% Users upgrading from version 1 of \pkg{siunitx} will notice that
% the various \enquote{specialist} units available in version 1 are
@@ -2468,27 +2570,27 @@ This work consists of the file siunitx.dtx
% in the loaded configuration file \opt{version-1}, but this is intended
% purely to ease transition to version 2.} These are not included in
% version 2 as the criteria for inclusion of such units are far from
-% clear, and it is difficult to justify providing clearly non-SI
-% units in the package. For reference, appropriate definitions for
+% clear, and it is difficult to justify providing clearly non-SI
+% units in the package. For reference, appropriate definitions for
% the units which where provided in version 1 are as follows.
%\begin{LaTeXdemo}[code only]
% % Astronomy
% \DeclareSIUnit\parse{pc}
% \DeclareSIUnit\lightyear{ly}
-%
+%
% % Chemical engineering
% \DeclareSIUnit\gmol{g\text{-}mol}
% \DeclareSIUnit\kgmol{kg\text{-}mol}
% \DeclareSIUnit\lbmol{lb\text{-}mol}
-%
+%
% % Chemistry
% \DeclareSIUnit\molar{\mole\per\cubic\deci\metre}
% \DeclareSIUnit\Molar{\textsc{m}}
% \DeclareSIUnit\torr{torr}
-%
+%
% % Geophysics
% \DeclareSIUnit\gon{gon}
-%
+%
% % High energy physics
% \DeclareSIUnit\micron{\micro\metre}
% \DeclareSIUnit\mrad{\milli\rad}
@@ -2506,7 +2608,7 @@ This work consists of the file siunitx.dtx
% \DeclareSIUnit\ab{\atto\barn}
% \DeclareSIUnit\zb{\zepto\barn}
% \DeclareSIUnit\yb{\yocto\barn}
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
% Users can use a local configuration file to make additional units
% available on a local basis, as described in \cref{sec:config:local}.
%
@@ -2515,26 +2617,26 @@ This work consists of the file siunitx.dtx
% Part of the power of \pkg{siunitx} is the ability to alter the output
% format for units without changing the input. The behaviour of units
% is therefore controlled by a number of options which alter either the
-% processing of units or the output directly
+% processing of units or the output directly
% (\cref{tab:opt:units:out}).
-%
+%
%\begin{table}
% \centering
% \caption{Unit output options.}
% \label{tab:opt:units:out}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule ^^A (
% bracket-unit-denominator & Switch & true \\
% forbid-literal-units & Switch & false \\
-% inter-unit-separator & Math & \cs{,} \\
+% inter-unit-product & Math & \cs{,} \\
% parse-units & Switch & true \\
% per-mode & Choice & reciprocal \\
% per-symbol & Math & / \\
-% power-font & Choice & number \\
+% power-font & Choice & number \\
% prefixes-as-symbols & Switch & true \\
% qualifier-mode & Choice & subscript \\
% sticky-per & Switch & false \\
@@ -2545,34 +2647,39 @@ This work consists of the file siunitx.dtx
%\DescribeOption{forbid-literal-units}
% Some users may prefer to completely disable the use of literal input
% in units, for example to enforce consistency. This can be
-% accomplished by setting the \opt{forbid-literal-units} switch. With
+% accomplished by setting the \opt{forbid-literal-units} switch. With
% this option enabled, only macro-based units can be used in a document.
-%
-%\DescribeOption{inter-unit-separator}
-% The separator between each unit is stored using the
-% \opt{inter-unit-separator} option. The standard setting is a thin
+%
+%\DescribeOption{inter-unit-product}
+% The separator between each unit is stored using the
+% \opt{inter-unit-product} option. The standard setting is a thin
% space: another common choice is a centred dot. To get the correct
% spacing it is necessary to use "{}\cdot{}" in the later case.
%\begin{LaTeXdemo}
% \si{\farad\squared\lumen\candela} \\
-% \si[inter-unit-separator={}\cdot{}]{\farad\squared\lumen\candela}
-%\end{LaTeXdemo}
-%
+% \si[inter-unit-product={}\cdot{}]{\farad\squared\lumen\candela}
+%\end{LaTeXdemo}
+%
%\DescribeOption{per-mode}
+%\changes{v2.1i}{2011/01/27}{Improved logic for \opt{per-mode} setting
+% \opt{symbol-or-fraction}}
+%\changes{v2.2}{2011/04/05}{Include leading \( 1 \) when \opt{per-mode}
+% is set to \opt{symbol} and there are no numerator units in \cs{si}
+% arguments}
%\DescribeOption{per-symbol}
%\DescribeOption{bracket-unit-denominator}
% The handling of \cs{per} is altered using the \opt{per-mode} choice
-% option. The standard setting is \opt{reciprocal}, meaning that
+% option. The standard setting is \opt{reciprocal}, meaning that
% \cs{per} generates reciprocal powers for units. Setting the option
% to \opt{fraction} uses the \cs{frac} function to typeset the positive
-% and negative powers of a unit separately.
+% and negative powers of a unit separately.
%\begin{LaTeXdemo}
% \si{\joule\per\mole\per\kelvin} \\
% \si{\metre\per\second\squared} \\
% \si[per-mode=fraction]{\joule\per\mole\per\kelvin} \\
-% \si[per-mode=fraction]{\metre\per\second\squared}
+% \si[per-mode=fraction]{\metre\per\second\squared}
%\end{LaTeXdemo}
-% The closely-related \opt{reciprocal-positive-first} setting acts in
+% The closely-related \opt{reciprocal-positive-first} setting acts in
% the same way but places all of the positive powers before any negative
% ones.
%\begin{LaTeXdemo}
@@ -2581,9 +2688,9 @@ This work consists of the file siunitx.dtx
% {\ampere\per\mole\second}
%\end{LaTeXdemo}
% It is possible to use a symbol (usually \texttt{/}) to separate the
-% two parts of a unit by setting \opt{per-mode} to \opt{symbol}; the
+% two parts of a unit by setting \opt{per-mode} to \opt{symbol}; the
% symbol used is stored using the setting \opt{per-symbol}. This method
-% for displaying units can be ambiguous, and so brackets are added
+% for displaying units can be ambiguous, and so brackets are added
% unless \opt{bracket-unit-denominator} is set to \opt{false}.
% Notice that \opt{bracket-unit-denominator} only applies when
% \opt{per-mode} is set to \opt{symbol} or \opt{symbol-or-fraction}.
@@ -2596,8 +2703,8 @@ This work consists of the file siunitx.dtx
% \si[per-symbol = \text{~div~}]{\joule\per\mole\per\kelvin} \\
% \si[bracket-unit-denominator = false]{\joule\per\mole\per\kelvin}
%\end{LaTeXdemo}
-% The often-requested (but mathematically invalid)
-% \opt{repeated-symbol} option is also available to repeat the symbol
+% The often-requested (but mathematically invalid)
+% \opt{repeated-symbol} option is also available to repeat the symbol
% for each \cs{per}.
%\begin{LaTeXdemo}
% \si[per-mode=repeated-symbol]{\joule\per\mole\per\kelvin}
@@ -2609,25 +2716,25 @@ This work consists of the file siunitx.dtx
% \cs{displaystyle} math.
%\begin{LaTeXdemo}
% \sisetup{per-mode = symbol-or-fraction}%
-% \( \si{\joule\per\mole\per\kelvin} \)
+% \( \si{\joule\per\mole\per\kelvin} \)
% \[ \si{\joule\per\mole\per\kelvin} \]
% \si{\joule\per\mole\per\kelvin} \\
-% \(
-% \displaystyle
+% \(
+% \displaystyle
% \si{\joule\per\mole\per\kelvin}
% \)
-% \[
-% \textstyle
+% \[
+% \textstyle
% \si{\joule\per\mole\per\kelvin}
% \]
%\end{LaTeXdemo}
-%
+%
%\DescribeOption{sticky-per}
% 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
-% \enquote{joules per mole per kelvin}.} By setting the
-% \opt{sticky-per} flag, this behaviour is changed so that \cs{per}
+% \enquote{joules per mole per kelvin}.} By setting the
+% \opt{sticky-per} flag, this behaviour is changed so that \cs{per}
% applies to all subsequent units.
%\begin{LaTeXdemo}
% \si{\pascal\per\gray\henry} \\
@@ -2635,9 +2742,11 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
%\DescribeOption{power-font}
+%\changes{v2.1}{2010/10/12}{New \opt{power-font} option for controlling
+% whether superscript powers are treated as numbers or units}
% The font used for the powers in units can be typeset using the
% current number or unit font. This may be of use when the font used
-% for numbers and units are very different, for example when the
+% for numbers and units are very different, for example when the
% \pkg{euler} package is loaded.
%\begin{LaTeXdemo}
% \sisetup{unit-mode = text}%
@@ -2646,6 +2755,8 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
%\DescribeOption{qualifier-mode}
+%\changes{v2.1c}{2010/11/13}{New \opt{text} choice for
+% \opt{qualifier-mode} option}
% Unit qualifiers can be printed in three different formats, set by the
% \opt{qualifier-mode} option. The standard setting is \opt{subscript},
% while the options \opt{brackets}, \opt{space} and \opt{text} are also
@@ -2660,11 +2771,11 @@ This work consists of the file siunitx.dtx
% \si[qualifier-mode = space]
% {\kilogram\polymer\squared\per\mole\catalyst\per\hour} \\
% \si[qualifier-mode = text]
-% {\deci\bel\isotropic}
+% {\deci\bel\isotropic}
%\end{LaTeXdemo}
%
%\DescribeOption{prefixes-as-symbols}
-% The unit prefixes (\cs{kilo}, \emph{etc}.) are normally given as
+% The unit prefixes (\cs{kilo}, \emph{etc}.) are normally given as
% letters. However, the package can convert these into numerical powers.
% This is controlled by the \opt{prefixes-as-symbols} switch option.
% This correctly deals with the kilogram, which is a base unit even
@@ -2672,7 +2783,7 @@ This work consists of the file siunitx.dtx
%\begin{LaTeXdemo}
% \si{\milli\litre\per\mole\deci\ampere} \\
% \SI{10}{\kilo\gram\squared\deci\second} \\
-% \si[prefixes-as-symbols=false]{\milli\litre\per\mole\deci\ampere} \\
+% \si[prefixes-as-symbols=false]{\milli\litre\per\mole\deci\ampere}\\
% \SI[prefixes-as-symbols=false]{10}{\kilo\gram\squared\deci\second}
%\end{LaTeXdemo}
%
@@ -2691,21 +2802,21 @@ This work consists of the file siunitx.dtx
%
% Some options apply to the combination of units and numbers, rather
% than to units or numbers alone (\cref{tab:opt:units:numbers}).
-%
+%
%\begin{table}
% \centering
% \caption{Options for numbers with units.}
% \label{tab:opt:units:numbers}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule ^^A (
% allow-number-unit-breaks & Switch & false \\
% list-units & Choice & repeat \\
% multi-part-units & Choice & brackets \\
-% number-unit-separator & Math & \cs{,} \\
+% number-unit-product & Math & \cs{,} \\
% product-units & Choice & repeat \\
% range-units & Choice & repeat \\
% \bottomrule
@@ -2715,27 +2826,27 @@ This work consists of the file siunitx.dtx
%\DescribeOption{allow-number-unit-breaks}
% Usually, the combination of a number and unit is regarded as a single
% mathematical entity which should not be split across lines. However,
-% there are cases (very long units, narrow columns, \emph{etc}.) where
-% breaks may be needed. This can be turned on using the
+% there are cases (very long units, narrow columns, \emph{etc}.) where
+% breaks may be needed. This can be turned on using the
% \opt{allow-number-unit-breaks} option.
%\begin{LaTeXdemo}
% \begin{minipage}{2.55 cm}
% % Gives an underfull hbox
% Some filler text \SI{10}{\metre} \\
% \sisetup{allow-number-unit-breaks}
-% Some filler text \SI{10}{\metre}
-% \end{minipage}
+% Some filler text \SI{10}{\metre}
+% \end{minipage}
%\end{LaTeXdemo}
%
-%\DescribeOption{number-unit-separator}
-% The separator between the number and unit is set using the
-% \opt{number-unit-separator} option. This is always printed in math
+%\DescribeOption{number-unit-product}
+% The product symbol between the number and unit is set using the
+% \opt{number-unit-product} option. This is always printed in math
% mode, and so anything which must be printed as text should be placed
% inside a \cs{text} macro.
%\begin{LaTeXdemo}
% \SI{2.67}{\farad} \\
-% \SI[number-unit-separator=\text{~}]{2.67}{\farad} \\
-% \SI[number-unit-separator=]{2.67}{\farad}
+% \SI[number-unit-product = \text{~}]{2.67}{\farad} \\
+% \SI[number-unit-product = ]{2.67}{\farad}
%\end{LaTeXdemo}
%
%\DescribeOption{multi-part-units}
@@ -2751,7 +2862,7 @@ This work consists of the file siunitx.dtx
% \SI{12.3(4)}{\kilo\gram} \\
% \SI[multi-part-units = brackets]{12.3(4)}{\kilo\gram} \\
% \SI[multi-part-units = repeat]{12.3(4)}{\kilo\gram} \\
-% \SI[multi-part-units = single]{12.3(4)}{\kilo\gram}
+% \SI[multi-part-units = single]{12.3(4)}{\kilo\gram}
%\end{LaTeXdemo}
% It is important to notice that numbers with units are not affected by
% the setting of \opt{bracket-numbers}, which applies to \enquote{pure}
@@ -2759,15 +2870,15 @@ This work consists of the file siunitx.dtx
%\begin{LaTeXdemo}
% \sisetup{separate-uncertainty,bracket-numbers = false}%
% \num{1.234(5)e-4} \\
-% \SI{1.234(5)e-4}{\metre}
+% \SI{1.234(5)e-4}{\metre}
%\end{LaTeXdemo}
% The reason is that the requirements to bracket values with units are
-% fundamentally different from those for numbers alone. Some combinations
-% which are mathematically valid in the absence of a unit become invalid
-% when a unit is present.
+% fundamentally different from those for numbers alone. Some
+% combinations which are mathematically valid in the absence of a unit
+% become invalid when a unit is present.
%
%\DescribeOption{product-units}
-% When a product of quantities is given, the resulting units can be
+% When a product of quantities is given, the resulting units can be
% displayed in a number of ways, set using the \opt{product-units}
% option. The standard setting is \opt{repeat}, which prints one
% unit symbol for each numbers. Alternatives are \opt{brackets},
@@ -2776,32 +2887,32 @@ This work consists of the file siunitx.dtx
% number within the product list: it only sets those around the
% entire list.
%\begin{LaTeXdemo}
-% \SI{2 x 3 x 4}{\metre} \\
+% \SI{2 x 3 x 4}{\metre} \\
% \SI[product-units = brackets]{2 x 3 x 4}{\metre} \\
% \SI[product-units = brackets-power]{2 x 3 x 4}{\metre} \\
% \SI[product-units = power]{2 x 3 x 4}{\metre} \\
% \SI[product-units = repeat]{2 x 3 x 4}{\metre} \\
-% \SI[product-units = single]{2 x 3 x 4}{\metre}
+% \SI[product-units = single]{2 x 3 x 4}{\metre}
%\end{LaTeXdemo}
%
%\DescribeOption{list-units}
%\DescribeOption{range-units}
-% The \opt{list-units} and \opt{range-units} options determines how
-% the \cs{SIlist} and\cs{SIrange} function displays units, respectively.
-% The standard setting for both is \opt{repeat}, where each number will
-% be printed with a unit. Alternatives are \opt{brackets} and
-% \opt{single}. Any brackets needed on individual numbers within a
-% product are controlled by the \opt{brackets-numbers} option
-% (\emph{i.e}.~they are treated as pure numbers).
+% The \opt{list-units} and \opt{range-units} options determines how
+% the \cs{SIlist} and\cs{SIrange} function displays units,
+% respectively. The standard setting for both is \opt{repeat}, where
+% each number will be printed with a unit. Alternatives are
+% \opt{brackets} and \opt{single}. Any brackets needed on individual
+% numbers within a product are controlled by the \opt{brackets-numbers}
+% option (\emph{i.e}.~they are treated as pure numbers).
% These options do not affect the application of brackets for each
% number within the list or range: they only sets those around the
% entire group.
%\begin{LaTeXdemo}
-% \SIlist{2;4;6;8}{\tesla} \\
+% \SIlist{2;4;6;8}{\tesla} \\
% \SIlist[list-units = brackets]{2;4;6;8}{\tesla} \\
% \SIlist[list-units = repeat]{2;4;6;8}{\tesla} \\
% \SIlist[list-units = single]{2;4;6;8}{\tesla} \\
-% \SIrange{2}{4}{\degreeCelsius} \\
+% \SIrange{2}{4}{\degreeCelsius} \\
% \SIrange[range-units = brackets]{2}{4}{\degreeCelsius} \\
% \SIrange[range-units = repeat]{2}{4}{\degreeCelsius} \\
% \SIrange[range-units = single]{2}{4}{\degreeCelsius}
@@ -2811,31 +2922,33 @@ This work consists of the file siunitx.dtx
%
% Processing of material in tables obeys the same settings as described
% for the functions already described. However, there are some settings
-% which apply only to the layout of tabular material
+% which apply only to the layout of tabular material
% (\cref{tab:opt:tables}).
-%
+%
%\begin{table}
% \centering
% \caption{Options for tabular material.}
% \label{tab:opt:tables}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule ^^A (
+% table-align-comparator & Switch & true \\
% table-align-exponent & Switch & true \\
% table-align-text-post & Switch & true \\
% table-align-uncertainty & Switch & true \\
% table-alignment & Choice & \m{none} \\
% table-auto-round & Switch & false \\
+% table-column-width & Length & 0 pt \\
% table-comparator & Switch & false \\
% table-figures-decimal & Integer & 2 \\
% table-figures-exponent & Integer & 0 \\
% table-figures-integer & Integer & 3 \\
% table-figures-uncertainty & Integer & 0 \\
% table-format & Special & \m{none} \\
-% table-number-alignment & Choice &
+% table-number-alignment & Choice &
% center-decimal-marker \\
% table-parse-only & Switch & false \\
% table-omit-exponent & Switch & true \\
@@ -2864,7 +2977,7 @@ This work consists of the file siunitx.dtx
% {
% S
% S[table-parse-only]
-% }
+% }
% \toprule
% {Decimal-centred} &
% {Simple centring} \\
@@ -2889,9 +3002,9 @@ This work consists of the file siunitx.dtx
% digits before and after the decimal). On the other hand, the
% \opt{center}, \opt{left} and \opt{right} options require space to be
% reserved for the numbers, and then use this fixed space to align with
-% the edges of the column. The different alignment choices are
-% illustrated in \cref{tab:S:align}, which uses somewhat
-% exaggerated column headings to show the relative position of the
+% the edges of the column. The different alignment choices are
+% illustrated in \cref{tab:S:align}, which uses somewhat
+% exaggerated column headings to show the relative position of the
% cell contents.
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -2919,9 +3032,9 @@ This work consists of the file siunitx.dtx
% \end{tabular}
% \end{table}
%\end{LaTeXdemo}
-% Many of the other table options do not apply when
-% \opt{table-number-alignment = center-decimal-marker} is set, as this
-% mode always centres the marker at the expense of any other
+% Many of the other table options do not apply when
+% \opt{table-number-alignment = center-decimal-marker} is set, as this
+% mode always centres the marker at the expense of any other
% choices.
%
%\DescribeOption{table-figures-decimal}
@@ -2936,7 +3049,7 @@ This work consists of the file siunitx.dtx
% space is reserved and some output will either be out of position
% or not printed at all (although a warning will result). Reserving
% space for a given part of number will automatically include space
-% for any associated items (for example the \enquote{\( \times \)}
+% for any associated items (for example the \enquote{\( \times \)}
% symbol for exponents).
%\DescribeOption{table-sign-exponent}
%\DescribeOption{table-sign-mantissa}
@@ -2981,8 +3094,10 @@ This work consists of the file siunitx.dtx
% \end{table}
%\end{LaTeXdemo}
%\DescribeOption{table-comparator}
+%\changes{v2.1}{2010/10/26}{New \opt{table-comparator} option
+% for reserving space for comparators in tables}
% Space can also be reserved in a table for a comparator (greater than,
-% less than, and so forth). This is activated using the
+% less than, and so forth). This is activated using the
% \opt{table-comparator} switch (\cref{tab:S:comparators}).
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -3013,35 +3128,35 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
% The table-printing code will omit any part of a number which has no
% space reserved, placing a warning in the \LaTeX\ log. This means that
-% uncertainties and exponents will not be printed if no space is reserved
-% for them.
+% uncertainties and exponents will not be printed if no space is
+% reserved for them.
%
%\DescribeOption{table-format}
-% As a short cut for the preceding options, \pkg{siunitx} also
+% As a short cut for the preceding options, \pkg{siunitx} also
% provides the \opt{table-format} option. This can be used to give the
-% same information about the space to reserve for a number in a
+% same information about the space to reserve for a number in a
% \enquote{compressed} manner. The input to \opt{table-format} should
% consist of a number showing how many figures to reserve in each part
% of the input. Thus
%\begin{LaTeXdemo}[code only]
% \sisetup{
% table-format = 3.2
-% }
-%\end{LaTeXdemo}
-% is equivalent to
+% }
+%\end{LaTeXdemo}
+% is equivalent to
%\begin{LaTeXdemo}[code only]
% \sisetup{
% table-figures-integer = 3,
% table-figures-decimal = 2
-% }
-%\end{LaTeXdemo}
-% The \opt{table-format} option will also correctly interpret the
+% }
+%\end{LaTeXdemo}
+% The \opt{table-format} option will also correctly interpret the
% presence of a sign, so that
%\begin{LaTeXdemo}[code only]
% \sisetup{
% table-format = +3.2e+4
-% }
-%\end{LaTeXdemo}
+% }
+%\end{LaTeXdemo}
% will have the same effect as
%\begin{LaTeXdemo}[code only]
% \sisetup{
@@ -3050,9 +3165,9 @@ This work consists of the file siunitx.dtx
% table-figures-exponent = 4,
% table-sign-mantissa,
% table-sign-exponent
-% }
-%\end{LaTeXdemo}
-% It is important to note that any parts of a number \emph{not}
+% }
+%\end{LaTeXdemo}
+% It is important to note that any parts of a number \emph{not}
% specified in the table format argument are set to be absent (the
% number of figures is set to zero). Setting the \opt{table-format}
% option also resets \opt{table-number-alignment} to \opt{center}
@@ -3090,7 +3205,7 @@ This work consists of the file siunitx.dtx
% Space for material before and after the \texttt{S} column can
% be reserved by giving model text for the options
% \opt{table-space-text-pre} and \opt{\ldots -post}.
-% This is then used to provide the necessary gap while maintaining
+% This is then used to provide the necessary gap while maintaining
% alignment (\cref{tab:S:ends}).
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -3102,7 +3217,7 @@ This work consists of the file siunitx.dtx
% table-figures-integer = 2,
% table-figures-decimal = 4,
% table-space-text-pre = now~,
-% table-space-text-post =
+% table-space-text-post =
% \textsuperscript{\emph{a}}
% }
% \begin{tabular}{S}
@@ -3118,15 +3233,23 @@ This work consists of the file siunitx.dtx
% \end{table}
%\end{LaTeXdemo}
%
+%\DescribeOption{table-align-comparator}
+%\changes{v2.2}{2010/04/04}{New \opt{table-align-comparator}
+% option for more control of table formatting}
%\DescribeOption{table-align-exponent}
%\DescribeOption{table-align-uncertainty}
-% When printing exponents in tables, there is a choice of aligning
+%\changes{v2.1}{2010/10/12}{New \opt{table-align-exponent} and
+% \opt{table-align-uncertainty} options for additional choices of
+% table formatting}
+% When printing exponents in tables, there is a choice of aligning
% the exponent parts or having these close up to the mantissa. This
-% is controlled by the \opt{table-align-exponent} option
+% is controlled by the \opt{table-align-exponent} option
% (\cref{tab:align:exp}). Similarly, uncertainty parts which are printed
% separately from the mantissa can be aligned or closed up. This is
-% set by the \opt{table-align-uncertainty} option
-% (\cref{tab:align:uncert}).
+% set by the \opt{table-align-uncertainty} option
+% (\cref{tab:align:uncert}). Finally, the same approach is available
+% for the comparator with the \opt{table-align-comparator} option
+% (\cref{tab:align:comp}).
%\begin{LaTeXdemo}[code and float]
% \begin{table}
% \centering
@@ -3150,7 +3273,7 @@ This work consists of the file siunitx.dtx
% \label{tab:align:uncert}
% \sisetup{
% separate-uncertainty,
-% table-format = 1.3(1),
+% table-format = 1.3(1),
% }
% \begin{tabular}{SS[table-align-uncertainty = false]}
% \toprule
@@ -3162,13 +3285,31 @@ This work consists of the file siunitx.dtx
% \end{tabular}
% \end{table}
%\end{LaTeXdemo}
+%\begin{LaTeXdemo}[code and float]
+% \begin{table}
+% \centering
+% \caption{The \opt{table-align-comparator} option}
+% \label{tab:align:comp}
+% \sisetup{table-format = >2.2}
+% \begin{tabular}{SS[table-align-comparator = false]}
+% \toprule
+% {Header} & {Header} \\
+% \midrule
+% > 1.2 & > 1.2 \\
+% < 12.34 & < 12.34 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXdemo}
%
%\DescribeOption{table-omit-exponent}
+%\changes{v2.1}{2010/10/13}{New \opt{table-omit-exponent} option
+% for simplifying tables}
% In cases where data cover a range of values, printing using a fixed
% exponent in a table may make presentation clearer. In these cases,
% omitting the exponent value from the table is useful. The package
% offers the \opt{table-omit-exponent} option to do this
-% (\cref{tab:exp:omit}); this automatically sets
+% (\cref{tab:exp:omit}); this automatically sets
% \opt{scientific-notation = fixed} for the table column.
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -3196,8 +3337,8 @@ This work consists of the file siunitx.dtx
%
%\DescribeOption{table-align-text-post}
% Note markers are often given in tables after the numerical content. It
-% may be desirable for these to close up to the numbers. Whether this
-% takes place is controlled by the \opt{table-align-text-post}
+% may be desirable for these to close up to the numbers. Whether this
+% takes place is controlled by the \opt{table-align-text-post}
% option (\cref{tab:S:notes}).
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -3230,9 +3371,9 @@ This work consists of the file siunitx.dtx
%
%\DescribeOption{table-auto-round}
% The contents of table cells can automatically be rounded or
-% zero-filled to the number of decimal digits given for the
+% zero-filled to the number of decimal digits given for the
% \opt{table-figures-decimal} option. This mode is activated using
-% the \opt{table-auto-round} switch, as illustrated in
+% the \opt{table-auto-round} switch, as illustrated in
% \cref{tab:S:auto}.
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -3264,7 +3405,7 @@ This work consists of the file siunitx.dtx
% When the \opt{parse-numbers} option is set to \opt{false}, then
% the alignment code for tables takes a different approach. The
% output is always set in math mode, and alignment takes place
-% at the first decimal marker. This is achieved by making it
+% at the first decimal marker. This is achieved by making it
% active in math mode. When reserving space for content only
% the integer and decimal values for the mantissa are considered
% (\cref{tab:S:nonparsed}).
@@ -3303,7 +3444,7 @@ This work consists of the file siunitx.dtx
%\DescribeOption{table-text-alignment}
% Cell contents which are not part of a number can be protected
% using braces, as illustrated. Cells which contain no numerical data
-% at all are aligned using the setting specified by the
+% at all are aligned using the setting specified by the
% \opt{table-text-alignment} option, which recognises the values
% \opt{center}, \opt{left} and \opt{right} (\cref{tab:S:text}).
%\begin{LaTeXdemo}[code and float]
@@ -3334,12 +3475,12 @@ This work consists of the file siunitx.dtx
% \end{tabular}
% \end{table}
%\end{LaTeXdemo}
-%
+%
%\DescribeOption{table-unit-alignment}
% The contents of \texttt{s} columns can be centred or aligned to the
% left or right using the \opt{table-unit-alignment} option. As for the
% other alignment options, this recognises the choices \opt{center},
-% \opt{left} and \opt{right}.
+% \opt{left} and \opt{right}.
%\begin{LaTeXdemo}[code and float]
% \begin{table}
% \centering
@@ -3350,9 +3491,9 @@ This work consists of the file siunitx.dtx
% s[table-unit-alignment = right]
% s
% s[table-unit-alignment = left]
-% }
+% }
% \toprule
-% {Left-aligned} &
+% {Left-aligned} &
% {Centred text} &
% {Right-aligned} \\
% \midrule
@@ -3364,12 +3505,75 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
%\DescribeOption{table-alignment}
-% The three table alignment options (\opt{table-number-alignment},
-% \opt{table-text-alignment} and \opt{table-unit-alignment}) can be set
-% to the same value using the \opt{table-alignment} option. This will
-% set all three alignment options to the same value (one of \opt{center},
-% \opt{right} or \opt{left}).
+% The three table alignment options (\opt{table-number-alignment},
+% \opt{table-text-alignment} and \opt{table-unit-alignment}) can be set
+% to the same value using the \opt{table-alignment} option. This will
+% set all three alignment options to the same value (one of
+% \opt{center}, \opt{right} or \opt{left}).
+%
+%\DescribeOption{table-column-width}
+%\changes{v2.2}{2011/04/02}{New \opt{table-column-width} option}
+% Usually, the width of the \texttt{S} and \texttt{s} columns is allowed
+% to vary depending on the content. However, there are cases where a
+% strictly fixed width is desirable. For these cases, the
+% \opt{table-column-width} option is available. The standard
+% setting, "0 pt", indicates that no fixing takes place. If a value
+% is set for this option then the tabular material is typeset to
+% the specified width (\cref{tab:width:fixed}).
+%\begin{LaTeXdemo}[code and float]
+% \begin{table}
+% \centering
+% \caption{Fixed-width columns.}
+% \label{tab:width:fixed}
+% \begin{tabular}
+% {
+% s
+% s[table-column-width = 2 cm]
+% S
+% S[table-column-width = 2 cm]
+% }
+% \toprule
+% {Flexible} &
+% {Fixed} &
+% {Flexible} &
+% {Fixed} \\
+% \midrule
+% \metre\per\second & \metre\per\second & 1.23 & 1.23 \\
+% \kilogram\candela & \kilogram\candela & 45.6 & 45.6 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXdemo}
%
+% The \opt{table-column-width} option can also be used to achieve
+% special effects. One example is centring a column of numbers under
+% a wide heading, with the numbers themselves right-aligned
+% (\cref{tab:width:special}).
+%\begin{LaTeXdemo}[code and float]
+% \begin{table}
+% \centering
+% \caption{Right-aligning under a heading.}
+% \label{tab:width:special}
+% \settowidth\mylength{Long header}
+% \sisetup{
+% table-format = 4 ,
+% table-number-alignment = center ,
+% table-column-width = \mylength ,
+% input-decimal-markers = ,
+% input-symbols = . ,
+% }
+% \begin{tabular}{S}
+% \toprule
+% {Long header} \\
+% \midrule
+% 12.33 \\
+% 2 \\
+% 1234 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%\end{LaTeXdemo}
+%
%\subsection{Symbols}
%
% Most units use letters as the symbol for the unit, and these are all
@@ -3378,53 +3582,53 @@ This work consists of the file siunitx.dtx
% \pkg{siunitx} provides appropriate symbols for commonly-used units,
% but the definitions may need adjustment depending on the body font
% used in a document.
-%
+%
%\DescribeOption{redefine-symbols}
% The package provides one general option for the handling of symbols.
-% If the packages \pkg{textcomp} or \pkg{upgreek} are loaded, symbols
+% If the packages \pkg{textcomp} or \pkg{upgreek} are loaded, symbols
% can be taken from these for units, rather than using the
-% \pkg{siunitx} default values. The switch \opt{redefine-symbols}
+% \pkg{siunitx} default values. The switch \opt{redefine-symbols}
% can be used to turn this behaviour on or off: the standard setting
% is \opt{true}.
-%
+%
% The individual symbols are set up independently for math and text
-% output, and are summarised in \cref{tab:opt:symbols}. Many of
+% output, and are summarised in \cref{tab:opt:symbols}. Many of
% the definitions are variations using \cs{text} or \cs{ensuremath} to
% produce the correct output, as the symbols available in the document
-% may vary considerably. In the case of the micro symbol
-% (\SIUnitSymbolMicro), \pkg{sunitx} provides a suitable low-level
+% may vary considerably. In the case of the micro symbol
+% (\SIUnitSymbolMicro), \pkg{sunitx} provides a suitable low-level
% definition for the symbol. Depending on the fonts available, this
-% may need to be replaced by an alternative by the user. The
+% may need to be replaced by an alternative by the user. The
% ohm symbol (\SIUnitSymbolOhm) is usually set to \cs{Omega}, but
% will check that this has not been redefined as a slanted letter. If
% \cs{Omega} has been redefined, an alternative definition is used.
-%
+%
%\begin{table}
% \centering
% \caption{Symbol options.}
% \label{tab:opt:symbols}
% \begin{tabular}{>{\ttfamily}ll>{\ttfamily}l}
% \toprule
-% \multicolumn{1}{l}{Option name} &
+% \multicolumn{1}{l}{Option name} &
% Type &
% \multicolumn{1}{l}{Default} \\
% \midrule ^^A (
-% math-angstrom & Literal & \verb=\text{\AA}= \\
+% math-angstrom & Literal & \verb=\text{\AA}= \\
% math-arcminute & Literal & \verb={}^{\prime}= \\
% math-arcsecond & Literal & \verb={}^{\prime\prime}= \\
% math-celsius & Literal & \verb={}^{\circ}= \\
-% & & \verb=\kern -\scriptspace \mathrm{C}= \\
+% & & \verb=\kern -\scriptspace \mathrm{C}= \\
% math-degree & Literal & \verb={}^{\circ}= \\
% math-micro & Literal & \meta{see text} \\
% math-ohm & Literal & \cs{Omega} \\
% redefine-symbols & Switch & true \\
-% text-angstrom & Literal & \cs{AA} \\
+% text-angstrom & Literal & \cs{AA} \\
% text-arcminute & Literal & \verb=\ensuremath{{}^{\prime}}= \\
-% text-arcsecond & Literal &
-% \verb=\ensuremath{{}^{\prime\prime}}= \\
+% text-arcsecond & Literal &
+% \verb=\ensuremath{{}^{\prime\prime}}= \\
% text-celsius & Literal & \verb=\ensuremath{{}^{\circ}= \\
-% & & \verb=\kern -\scriptspace \text{C}}= \\
-% text-degree & Literal & \verb=\ensuremath{{}^{\circ}}= \\
+% & & \verb=\kern -\scriptspace \text{C}}= \\
+% text-degree & Literal & \verb=\ensuremath{{}^{\circ}}= \\
% text-micro & Literal & \meta{see text} \\
% text-ohm & Literal & \verb=\ensuremath{\Omega}= \\
% \bottomrule
@@ -3442,18 +3646,19 @@ This work consists of the file siunitx.dtx
% independent functions with user names. These are then used in the
% definitions of the appropriate units. For example, the micro
% symbol can be accessed using the macro \cs{SIUnitSymbolMicro}.
-% Notice that these names capitalise the unit name (to make reading
-% the macro name easier!).\footnote{The function
+% Notice that these names capitalise the unit name (to make reading
+% the macro name easier!).\footnote{The function
% \cs{SIUnitSymbolAngstrom} uses the name without accents.}
-%
+%
%\subsection{Other options}
%
%\DescribeOption{locale}
+%\changes{v2.0m}{2010/07/09}{Re-introduce \opt{locale} option}
% \pkg{siunitx} allows the user to switch between the typographic
-% conventions of different (geographical) areas by using locales.
-% Currently, the package is supplied with configurations for locales
+% conventions of different (geographical) areas by using locales.
+% Currently, the package is supplied with configurations for locales
% \opt{UK}, \opt{US}, \opt{DE} (Germany), \opt{FR} (French) and \opt{ZA}
-% (South Africa). The \opt{locale} option is used to switch to a
+% (South Africa). The \opt{locale} option is used to switch to a
% particular locale.
%\begin{LaTeXdemo}
% \SI{1.234}{\metre}\\
@@ -3464,18 +3669,18 @@ This work consists of the file siunitx.dtx
% 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
-% preamble-only 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
+% preamble-only 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 using the upright serif font.
-%
+%
%\subsection{Local configurations}
%\label{sec:config:local}
-%
+%
% The \pkg{siunitx} package will check for a local configuration file
% \file{siunitx.cfg} during package loading. This occurs before
-% applying any setting given in the optional argument to
-% \cs{usepackage}. A typical configuration file may include
+% applying any setting given in the optional argument to
+% \cs{usepackage}. A typical configuration file may include
% settings (using \cs{sisetup}) and locally-defined units, for
% example
%\begin{LaTeXdemo}[code only]
@@ -3489,25 +3694,25 @@ This work consists of the file siunitx.dtx
% As units are always declared, overwriting any existing definition,
% units may safely be created in the configuration file even when also
% included in individual \LaTeX\ document headers.
-%
+%
%\section{Localisation}
-%
-% The \pkg{translator} package provides a structured framework for
+%
+% The \pkg{translator} package provides a structured framework for
% localisation of words and phrases, and is part of the larger
% \pkg{beamer} bundle. The \pkg{translator} package provides the
-% \cs{translate} macro, which will provide appropriate translations
-% based on the current \pkg{babel} or \pkg{polyglossia} language
+% \cs{translate} macro, which will provide appropriate translations
+% based on the current \pkg{babel} or \pkg{polyglossia} language
% setting.
-%
-% If \pkg{translator} is available, \pkg{siunitx} will load it and alter
-% the standard settings for the \opt{list-final-separator} and
+%
+% If \pkg{translator} is available, \pkg{siunitx} will load it and alter
+% the standard settings for the \opt{list-final-separator} and
% \opt{range-phrase} options to read:
%\begin{LaTeXdemo}[code only]
% \sisetup{
% list-final-separator = { \translate{and} },
% range-phrase = { \translate{to (numerical range)} },
% }
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
% If the current language is known to the \pkg{translator} package
% then the result will be localised text. The preamble for this manual
% loads English, French and German as options, and also loads the
@@ -3522,31 +3727,31 @@ This work consists of the file siunitx.dtx
% \selectlanguage{german}%
% \SIlist{1;2;3}{\metre} \\
% \SIrange{1}{10}{\degreeCelsius} \\
-%\end{LaTeXdemo}
-%
-%\section{Hints for using \pkg{siunitx}}
-%
+%\end{LaTeXdemo}
+%
+%\section{Hints for using \pkg{siunitx}}
+%
%\subsection{Ensuring text or math output}
%
% The macros \cs{ensuremath} and \cs{text} should be used to ensure that
-% a particular item is always printed in the desired mode. Some
+% a particular item is always printed in the desired mode. Some
% mathematical output does not work well in \cs{mathrm} (the standard
% font used by \pkg{siunitx} for printing). The easiest way to solve
% this is to use the construction "\text{\ensuremath{...}}", which will
% print the material in the standard mathematics font without affecting
% the rest of the output. In some cases, simply forcing \cs{mathnormal}
% will suffice, but this is less reliable with non-Latin characters.
-%
+%
%\subsection{Expanding content in tables}
%\label{sec:expanding}
%
% When processing tables, \pkg{siunitx} will expand anything stored
% inside a macro, unless it is long or protected. \LaTeXe\ robust
-% commands are also detected and are not expanded
+% commands are also detected and are not expanded
% (\cref{tab:xmpl:macro}). Values which would otherwise be expanded
% can be protected by wrapping them in a set of braces. As \TeX\ itself
% will expand the first token in a table cell before \pkg{siunitx}
-% can act on it, using the \eTeX\ protected mechanism is the
+% can act on it, using the \eTeX\ protected mechanism is the
% recommended course of action to prevent expansion of macros in
% table cells. (As is shown in the table, \TeX's expansion of
% \LaTeXe\ robust commands can lead to unexpected results.)
@@ -3578,13 +3783,13 @@ This work consists of the file siunitx.dtx
% It is possible to use calculated values in tables. For this to
% work, the calculation must take place before attempting to parse
% the number. An added complication is that \TeX\ itself will
-% expand the first macro in a table cell until it finds
+% expand the first macro in a table cell until it finds
% something unexpandable. The \eTeX\ protected mechanism can be
% used to prevent this; using the \pkg{etoolbox} package provides
% a convenient way to apply this protection to existing functions.
% The general approach is illustrated in \cref{tab:xmpl:calc}.
% The macro \cs{DTLmul} is made robust inside the table using
-% the \cs{robustify} command from \pkg{etoolbox}, before
+% the \cs{robustify} command from \pkg{etoolbox}, before
% constructing the table using an extra column to contain the
% calculation.
%\begin{LaTeXdemo}[code and float]
@@ -3645,20 +3850,20 @@ This work consists of the file siunitx.dtx
% \DTLdisplaydb{moredata}
% \end{table}
%\end{LaTeXdemo}
-%
-%\subsection{Using units such as \si{\micro\metre\per\second} in
+%
+%\subsection{Using units such as \si{\micro\metre\per\second} in
% headings}
%
-% The \pkg{siunitx} code is designed to work correctly with functions
+% The \pkg{siunitx} code is designed to work correctly with functions
% in headings. They will print correctly in headings and in the table
% of contents. As illustrated here, the standard behaviour is to ignore
% font changes. When the \pkg{hyperref} package is loaded, the
-% functions automatically \enquote{degrade gracefully} to produce
+% functions automatically \enquote{degrade gracefully} to produce
% useful information in PDF bookmarks. If you want more control over
-% the bookmark text, use the \cs{texorpdfstring} function from
+% the bookmark text, use the \cs{texorpdfstring} function from
% \pkg{hyperref}, for example:
%\begin{LaTeXdemo}[code only]
-% \section{Some text
+% \section{Some text
% \texorpdfstring
% {\si{\joule\per\mole\per\kelvin}}
% {J mol-1 K-1}%
@@ -3672,10 +3877,10 @@ This work consists of the file siunitx.dtx
% glyphs for these which are correct in the sense that they are upright
% (not italic) symbols, and match the \LaTeX\ standard Computer Modern
% font. However, this does not make them the best choice if other
-% fonts are in use, which is particularly common when \XeTeX\ is
-% being used.
-%
-% \XeTeX\ users will probably need to choose appropriate symbols
+% fonts are in use, which is particularly common when \XeTeX\ is
+% being used.
+%
+% \XeTeX\ users will probably need to choose appropriate symbols
% themselves. The correct choice depends on the fonts in use, but many
% system fonts include Greek letters and other symbols (which is not
% the case with most \TeX-specific fonts). An appropriate setting
@@ -3687,7 +3892,7 @@ This work consists of the file siunitx.dtx
%\begin{flushleft}
% \ttfamily
% \textbackslash \textcolor{blue}{sisetup}\{\\
-% \ \ math-micro = \textbackslash
+% \ \ math-micro = \textbackslash
% \textcolor{blue}{text}\{\SIUnitSymbolMicro\}, \\
% \ \ text-micro \ = \SIUnitSymbolMicro \\
% \}
@@ -3696,7 +3901,7 @@ This work consists of the file siunitx.dtx
%\subsection{Scaled document fonts with \texorpdfstring{\XeTeX}{XeTeX}}
%
% The \pkg{fontspec} package makes it possible to scale the document
-% body font. This can lead to unexpected problems with printing
+% body font. This can lead to unexpected problems with printing
% for \pkg{siunitx}, as some symbols will not scale while numbers
% and text will. The problem is best avoided by forcing \pkg{siunitx}
% to use the default math font for all output:
@@ -3708,20 +3913,20 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
% This will cause all \pkg{siunitx} output \emph{not} to scale at all,
% consistent with other mathematical content.
-%
+%
% \subsection{Interaction with \pkg{tex4ht}}
%
-% \pkg{siunitx} will detect when \pkg{tex4ht} is in use, and makes
+% \pkg{siunitx} will detect when \pkg{tex4ht} is in use, and makes
% some changes to the way output is printed. Text mode printing is
% automatically selected, and certain items (such as spaces) are
-% printed in text mode rather than as math. This is designed to
+% printed in text mode rather than as math. This is designed to
% reduce the likelihood of spurious formulae appearing in, for
% example, output converted to OpenOffice format.
%
%\subsection{Maximising performance}
%
% Both the number and unit parsers require significant effort in
-% terms of \TeX\ programming. For input that does not require
+% terms of \TeX\ programming. For input that does not require
% such processing, the maximum performance for \pkg{siunitx} can
% therefore be obtained by turning off both systems:
%\begin{LaTeXdemo}
@@ -3730,19 +3935,21 @@ This work consists of the file siunitx.dtx
% \SI[
% parse-numbers = false,
% parse-units = false
-% ]{7.3}{\Hz}
+% ]{7.3}{\Hz}
%\end{LaTeXdemo}
%
%\subsection{Transferring settings to \pkg{pgf}}
%
%\DescribeMacro{\SendSettingsToPgf}
+%\changes{v2.0a}{2010/05/28}{Make \cs{SendSettingsToPgf} available
+% in document body}
% The numerical engine in the \pkg{pgf} package has settings similar
% to those in \pkg{siunitx}. To enable working with both packages
% easily, the macro \cs{SendSettingsToPgf} is available. It will
% set some commonly-used numerical formatting options in \pkg{pgf}
-% to the current values used by \pkg{siunitx} to make using the
+% to the current values used by \pkg{siunitx} to make using the
% two packages together more convenient for end users. This
-% function can be used at any point after loading both the
+% function can be used at any point after loading both the
% \pkg{pgf} and \pkg{siunitx} packages.
%\begin{LaTeXdemo}[code only]
% \documentclass{article}
@@ -3750,29 +3957,29 @@ This work consists of the file siunitx.dtx
% \sisetup{...}
% \SendSettingsToPgf
% ...
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
%
%\subsection{Using \pkg{siunitx} with the \pkg{cellspace} package}
%
-% Both \pkg{siunitx} and \pkg{cellspace} use the letter \texttt{S} for a
-% new column type. This obviously leads to a problem. If both are
+% Both \pkg{siunitx} and \pkg{cellspace} use the letter \texttt{S} for a
+% new column type. This obviously leads to a problem. If both are
% loaded, \pkg{siunitx} will retain the \texttt{S} column, and moves the
-% functionality of \pkg{cellspace} to the letter \texttt{C}. This
+% functionality of \pkg{cellspace} to the letter \texttt{C}. This
% allows the normal use of \pkg{cellspace} with standard column types:
-% it does \emph{not} work with the \pkg{siunitx} \texttt{S} or
+% it does \emph{not} work with the \pkg{siunitx} \texttt{S} or
% \texttt{s} columns.
-%
+%
%\subsection{Special considerations for the \cs{kWh} unit}
%
-% The \file{abbreviations} configuration file provides the unit
-% \cs{kWh}, which is set up with no spacing between the
-% \enquote{\si{\kilo\watt}} and the \enquote{\si{\hour}} unit to give
-% \enquote{\si{\kWh}}. However, this only applies when the unit is given
-% on its own: combinations will follow the normal rules
+% The \file{abbreviations} configuration file provides the unit
+% \cs{kWh}, which is set up with no spacing between the
+% \enquote{\si{\kilo\watt}} and the \enquote{\si{\hour}} unit to
+% give \enquote{\si{\kWh}}. However, this only applies when the unit
+% is given on its own: combinations will follow the normal rules
%\begin{LaTeXdemo}
% \si{\kWh} \\
-% \si{\kWh\per\metre}
-%\end{LaTeXdemo}
+% \si{\kWh\per\metre}
+%\end{LaTeXdemo}
% This is because the unit \cs{kWh} is defined so that it can still be
% varied by altering \cs{kilo}, \cs{watt} and \cs{hour}, and so that
% the prefix can still be turned into a number. However, some users
@@ -3782,13 +3989,13 @@ This work consists of the file siunitx.dtx
%\begin{LaTeXdemo}[code only]
% \DeclareSIUnit\kWh{kWh}
% \DeclareSIUnit\KWH{kWh}
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
% or of course by using literal unit input.
%\begin{LaTeXdemo}
% \si{\KWH\per\metre}\\
% \si{kWh.m^{-1}}
%\end{LaTeXdemo}
-%
+%
% Another point to notice is that the \cs{per} macro applies to
% the next unit, and not an entire unit combination. Thus in
%\begin{LaTeXdemo}
@@ -3803,12 +4010,14 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
%\subsection{Adding items after the last column of a tabular}
+%\changes{v2.0d}{2010/06/10}{Document special case situations for last
+% cell in table row}
%
% When using the \pkg{array} package \enquote{\texttt{<}} construct
-% to insert material after an \texttt{S} or \texttt{s} column, the
+% to insert material after an \texttt{S} or \texttt{s} column, the
% spacing will be wrong. This is due to the way that \LaTeX\ constructs
% tables at a low level. The incorrect spacing can be avoided by using
-% the \TeX\ \cs{cr} primitive to end the table rows instead
+% the \TeX\ \cs{cr} primitive to end the table rows instead
% (\cref{tab:cr}).
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -3845,13 +4054,13 @@ This work consists of the file siunitx.dtx
% Usually, numbers in a table should be given with the units in the
% column heading. However, there are cases where a series of data are
% best presented in a table but have different units. There are two
-% ways to do this (\cref{tab:xmpl:mixed}). The first is to place the
-% units in the first column of the table, which makes sense if there
-% are several related items in the table. The second method is to
+% ways to do this (\cref{tab:xmpl:mixed}). The first is to place the
+% units in the first column of the table, which makes sense if there
+% are several related items in the table. The second method is to
% generate two columns, one for numbers and a second for units, and then
-% to format these to give the visual effect of a single column. The
-% later effect is most appropriate when only one set of numbers are
-% presented in a table.
+% to format these to give the visual effect of a single column. The
+% later effect is most appropriate when only one set of numbers are
+% presented in a table.
%\begin{LaTeXdemo}[code and float]
% \begin{table}
% \caption{Tables where numbers have different units}
@@ -3881,17 +4090,19 @@ This work consists of the file siunitx.dtx
% 0.835 & \candela \\
% 4.23 & \joule\per\mole \\
% \bottomrule
-% \end{tabular}
+% \end{tabular}
% \hfil
% \end{table}
%\end{LaTeXdemo}
%
%\subsection{Tables with heading rows}
+%\changes{v2.0s}{2010/08/12}{Document how to do mixed bold and normal
+% numbers in tables}
%
% A common format for tables is to make the heading row visually
% distinct using a background colour and bold text. If numbers appear
% in such a heading row within an \texttt{S} column then getting the
-% appearance right can be challenging. The best approach is to
+% appearance right can be challenging. The best approach is to
% make the \cs{bfseries} macro \enquote{robust} (as demonstrated in
% \cref{sec:expanding}), then to use this macro to make the heading
% cells bold. This approach is illustrated in \cref{tab:xmpl:headers},
@@ -3909,7 +4120,7 @@ This work consists of the file siunitx.dtx
% 23.45 \\
% 123.4 \\
% 3.456 \\
-% \end{tabular}
+% \end{tabular}
% \end{table}
%\end{LaTeXdemo}
%
@@ -3925,30 +4136,45 @@ This work consists of the file siunitx.dtx
% \addto\extrasgerman{\sisetup{locale = DE}}
%\end{LaTeXdemo}
%
-%\section{Information for those upgrading from version 1}
+%\section{Information for those upgrading}
+%
+%\subsection{Upgrading from version 1}
+%\changes{v2.0a}{2010/05/28}{Fix various errors in \file{version-1}
+% configuration file}
+%\changes{v2.0a}{2010/05/28}{Detect use of version 1 options and
+% automatically load appropriate configuration file}
+%\changes{v2.0a}{2010/05/28}{Include high energy physics units in
+% discussion of old configurations and in \file{version-1}
+% configuration file}
+%\changes{v2.0b}{2010/06/01}{Further improvements to \file{version-1}
+% configuration file}
+%\changes{v2.0r}{2010/08/02}{Error in definition for old
+% \opt{decimalsymbol} option corrected}
+%\changes{v2.1d}{2010/11/14}{Error with definition of version 1 option
+% \opt{xspace} corrected}
%
% The key--value control system of \pkg{siunitx} has been completely
% rewritten for version 2, and at the same time some of the macros
-% provided by the package have been renamed and reworked. The package
+% provided by the package have been renamed and reworked. The package
% can be loaded with a configuration file to provide most of the
% same options and defaults as in version 1:
%\begin{LaTeXdemo}[code only]
% \usepackage[load-configurations = version-1]{siunitx}
-%\end{LaTeXdemo}
+%\end{LaTeXdemo}
% Many of the options from version 1 map to similar ones in version 2
% (\cref{tab:opt:map}). The correspondence often includes a syntax
% change: consult details of the new options for the correct syntax for
% the new options. In some cases, the new approach is different to the
% older one, and in these cases the most appropriate option new has been
% listed in the table.
-%\begin{center}
+%\begin{center}
% \tablecaption{Mapping of version 1 options to version 2.}
% \label{tab:opt:map}
% \tablefirsthead{^^A
% \toprule
% \multicolumn{1}{l}{Version 1} &
% \multicolumn{1}{l}{See in version 2} \\
-% \midrule
+% \midrule
% }
% \tablehead{^^A
% \multicolumn{2}{l}{\emph{Continued from previous page}} \\
@@ -3960,9 +4186,9 @@ This work consists of the file siunitx.dtx
% \tabletail{^^A
% \bottomrule
% \multicolumn{2}{r}{\emph{Continued on next page}} \\
-% }
+% }
% \tablelasttail{\bottomrule}
-%
+%
% \begin{xtabular}{>{\ttfamily}l>{\ttfamily}l}
% addsign & explicit-sign \\
% allowlitunits & free-standing-units \\
@@ -3998,7 +4224,7 @@ This work consists of the file siunitx.dtx
% mathOmega & math-ohm \\
% mathcelsius & math-celsius \\
% mathdegree & math-degree \\
-% mathminute & math-arcminute \\
+% mathminute & math-arcminute \\
% mathmu & math-micro \\
% mathringA & math-angstrom \\
% mathrm & math-rm \\
@@ -4007,7 +4233,7 @@ This work consists of the file siunitx.dtx
% mathsdegree & math-degree \\
% mathsecond & math-arcsecond \\
% mathsf & math-sf \\
-% mathsminute & math-arcminute \\
+% mathsminute & math-arcminute \\
% mathsmu & math-micro \\
% mathsringA & math-angstrom \\
% mathsrm & math-rm \\
@@ -4090,8 +4316,8 @@ This work consists of the file siunitx.dtx
% unitmathstt & unit-math-tt \\
% unitmathtt & unit-math-tt \\
% unitmode & unit-mode \\
-% unitsep & inter-unit-separator \\
-% unitspace & inter-unit-separator \\
+% unitsep & inter-unit-product \\
+% unitspace & inter-unit-product \\
% valuecolor & value-color \\
% valuecolour & value-color \\
% valuemathrm & value-math-rm \\
@@ -4101,25 +4327,58 @@ This work consists of the file siunitx.dtx
% valuemathstt & value-math-tt \\
% valuemathtt & value-math-tt \\
% valuemode & value-mode \\
-% valuesep & number-unit-separator \\
+% valuesep & number-unit-product \\
% xspace & use-xspace \\
% \end{xtabular}
%\end{center}
-% A small number of the options from version 1 are used unchanged in
+% A small number of the options from version 1 are used unchanged in
% version 2, for example the \opt{mode} setting. These are listed above
% but require no action on the part of the user. There are also a
% few options which are no longer used at all, and are therefore ignored
-% by the current code.
-%
-% Loading configuration files has been completely changed, and this
+% by the current code.
+%
+% Loading configuration files has been completely changed, and this
% means that the options \opt{alsoload}, \opt{load} and \opt{noload} are
-% ignored by version 2. In the same way the options \opt{debug} and
-% \opt{log} are not used by the current release of \pkg{siunitx}, as
+% ignored by version 2. In the same way the options \opt{debug} and
+% \opt{log} are not used by the current release of \pkg{siunitx}, as
% this information is usually only needed by the package author.
% Emulation of older packages is no longer offered (it was intended
% to help with the transition form earlier packages), and so the
% \opt{emulate} option no longer applies.
%
+%\subsection{Upgrading from version 2.0 or 2.1}
+%
+% User feedback on \pkg{siunitx} means that over time some renaming
+% takes place. The following functions and options have been depreciated
+% in version 2.2. They are therefore available in version 2.2, but
+% should be replaced in new or updated documents with the successor
+% names.
+%
+%\DescribeOption{angle-unit-separator}
+%\DescribeOption{inter-unit-separator}
+%\DescribeOption{number-unit-separator}
+%\changes{v2.2}{2011/03/20}{Renamed \opt{angle-unit-separator} option
+% to \opt{angle-unit-product}}
+%\changes{v2.2}{2011/03/20}{Renamed \opt{inter-unit-separator} option
+% to \opt{inter-unit-product}}
+%\changes{v2.2}{2011/03/20}{Renamed \opt{number-unit-separator} option
+% to \opt{number-unit-product}}
+% These options have been replaced by the options
+%\begin{itemize}
+% \item \opt{angle-unit-product}
+% \item \opt{inter-unit-product}
+% \item \opt{number-unit-product}
+%\end{itemize}
+% as these items are formally products, and the new option names
+% emphasise this.
+%
+%\DescribeMacro{\DeclareSIUnitWithOptions}
+%\changes{v2.2}{2011/04/01}{Depreciate \cs{DeclareSIUnitWithOptions}}
+% The \cs{DeclareSIUnit} function has been extended to take a
+% first optional argument, which removes the need for
+% \cs{DeclareSIUnitWithOptions}. This function is therefore depreciated
+% but retained for compatibility.
+%
%\section{Correct application of (SI) units}
%
% Consistent and logical units are a necessity for scientific work,
@@ -4144,7 +4403,7 @@ This work consists of the file siunitx.dtx
% full details are available from the \emph{Bureau International des
% Poids et Mesures} \cite{BIPM}.
%
-% \pkg{siunitx} takes account of the information given here, so far as
+% \pkg{siunitx} takes account of the information given here, so far as
% is possible. Thus the package defaults follow the recommendations
% made for typesetting numbers and units. Spacing and so forth is
% handled in such a way as to make implementing the rules
@@ -4152,7 +4411,7 @@ This work consists of the file siunitx.dtx
%
%\subsection{Units}
%
-% There are seven base SI units, listed in \cref{tab:unit:base}.
+% There are seven base SI units, listed in \cref{tab:unit:base}.
% 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
@@ -4166,8 +4425,8 @@ This work consists of the file siunitx.dtx
% All other units within the SI system are regarded as \enquote{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 \cref{tab:unit:derived,tab:unit:accepted}) have a
-% special name and symbol. Most of these units are simple combinations
+% units (listed in \cref{tab:unit:derived,tab:unit:accepted}) have a
+% special name and symbol. 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 (\cref{tab:unit:physical}).
@@ -4175,16 +4434,16 @@ This work consists of the file siunitx.dtx
% A series of SI prefixes for decimal multiples and sub-multiples 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 \cref{tab:unit:prefix}. No space should be used
-% between a prefix and the unit, and only a single prefix should be
+% are listed in \cref{tab:unit: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\degreeCelsius}.
+% \SI{1}{\milli\degreeCelsius}.
%
% 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
+% 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 \enquote{gram} and the prefix symbols are used with
-% the unit symbol \si{\gram}. For example
+% the unit symbol \si{\gram}. For example
% \( \SI[prefixes-as-symbols = false]{1}{\milli\gram} =
% \SI{1}{\milli\gram} \).
%
@@ -4195,14 +4454,14 @@ This work consists of the file siunitx.dtx
% 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 (\cref{tab:unit:binary}) are the most obvious
-% example. These are \emph{not} part of the SI specifications, but the
+% prefixes and units (\cref{tab:unit:binary}) are the most obvious
+% example. These are \emph{not} part of the SI specifications, but the
% prefix names are derived from those in \cref{tab:unit:prefix}.
%
-% Other units are normally to be avoided where possible. SI units
+% Other units 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.
+% definition and self-consistency this brings. However, there will
+% probably always be a place for specialist or non-standard units.
% This is particularly true of units derived from basic physical
% constants.
%
@@ -4218,10 +4477,11 @@ This work consists of the file siunitx.dtx
% As explained earlier, a number--unit 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{\arcminute} and \si{\arcsecond}), it is usual to
-% have a space between the unit and the number. This should therefore
-% be a thin non-breaking space between the two.
+% be separated: a quantity is a product of the number and the unit.
+% With the exception of the symbols for plane angles (\si{\degree},
+% \si{\arcminute} and \si{\arcsecond}), the \textsc{bipm}
+% specifies either a space or half-height (centred) dot should be
+% used \cite{BIPM}.
%\begin{LaTeXdemo}
% A space for \SI{10}{\percent}\\
% and also for \SI{100}{\degreeCelsius}\\
@@ -4231,7 +4491,7 @@ This work consists of the file siunitx.dtx
% 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. The \pkg{siunitx}
+% all used mathematically to convey other meanings. The \pkg{siunitx}
% package defaults again follow this convention: any local settings are
% ignored, and uses the current upright serif math font. However,
% there are occasions where this may not be the most desirable
@@ -4246,27 +4506,29 @@ This work consists of the file siunitx.dtx
%
% 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.
+% or a (thin) space.
%\begin{LaTeXdemo}
% \( \si{\metre\second} = \text{metre second} \) \\
% \( \si{\milli\second} = \text{millisecond} \) \\
-% \sisetup{inter-unit-separator = { } \cdot { } }
+% \sisetup{inter-unit-product = { } \cdot { } }
% \( \si{\metre\second} = \text{metre second} \) \\
% \( \si{\milli\second} = \text{millisecond} \)
%\end{LaTeXdemo}
-% There are some circumstances under which it is permissible to omit
+% There are some circumstances under which it is common practice to omit
% any spaces. The classic example is \si{\kWh}, where
-% \enquote{\si[inter-unit-separator = \,]{\kWh}} does not add any
-% useful information. If using such a unit repeatedly, users of
-% \pkg{siunitx} are advised to create a custom unit to ensure
-% consistency.
+% \enquote{\si[inter-unit-product = \,]{\kWh}} does not add any
+% useful information. If using such a unit repeatedly, users of
+% \pkg{siunitx} are advised to create a custom unit to ensure
+% consistency. It is important to note that while this is common
+% practice, it is \emph{not} allowed by the \textsc{bipm}
+% \cite{BIPM}.
%
% 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
+% are used. This is ensured when using named unit macros in
% \pkg{siunitx}, which will \enquote{trap} repeated division and format
% it correctly. In complicated cases, negative exponents are to be
% preferred over other formats.
@@ -4277,22 +4539,22 @@ This work consists of the file siunitx.dtx
%\end{LaTeXdemo}
%
% Products and errors should show what unit applies to each number
-% given. Thus \SI[product-units = brackets]{2x3}{\metre} is an
-% ordered set of lengths of a geometric area, whereas
-% \SI[product-units = single]{2x3}{\metre} is a length (and equal
-% to \SI{6}{\metre}). Thus, \(\times\) is not a product but is a
+% given. Thus \SI[product-units = brackets]{2x3}{\metre} is an
+% ordered set of lengths of a geometric area, whereas
+% \SI[product-units = single]{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[product-units = power]{2 x 3}{\metre}. Although this does
+% a \(6\) matrix! In some areas, areas and volumes are given with
+% separated units but a unit raised to the appropriate power:
+% \SI[product-units = power]{2 x 3}{\metre}. Although this does
% display the correct overall units, it is potentially-confusing and is
% not encouraged.
%
% Care must be taken when writing ranges of numbers. For purely
% numerical values, it is common to use a en-dash to show a range, for
-% example \enquote{see pages 1--5}. On the other hand, physical
-% quantities could be misinterpret as negative values if written in this
-% way. As the unit--number combination is a single mathematical entity,
+% example \enquote{see pages 1--5}. On the other hand, physical
+% quantities could be misinterpret as negative values if written in this
+% way. As the unit--number combination is a single mathematical entity,
% writing the values with an en-dash followed by a single unit is also
% incorrect. As a result, using the word \enquote{to} is strongly
% recommended.
@@ -4307,10 +4569,10 @@ This work consists of the file siunitx.dtx
% 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\), \emph{i.e.}~length per time
-% squared in this case.} Much better is to show division of all
-% quantities by the unit, which leaves the entries as unitless ratios.
-% This is illustrated in \cref{tab:xmpl:unitless} and
+% \([a]\) is the dimensions of \(a\), \emph{i.e.}~length per time
+% squared in this case.} Much better is to show division of all
+% quantities by the unit, which leaves the entries as unitless ratios.
+% This is illustrated in \cref{tab:xmpl:unitless} and
% \cref{fig:xmpl:unitless}.
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -4365,7 +4627,7 @@ This work consists of the file siunitx.dtx
% 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 \cref{tab:good}. The use of \cs{multicolumn} is
-% needed here due to the \enquote{\texttt{<}}; without \cs{multicolumn},
+% needed here due to the \enquote{\texttt{<}}; without \cs{multicolumn},
% the titles are followed by \enquote{\si{\kilo\gram}}!
%\begin{LaTeXdemo}[code and float]
% \begin{table}
@@ -4385,7 +4647,7 @@ This work consists of the file siunitx.dtx
% table-figures-integer = 2,
% table-figures-decimal = 2
% ]
-% }
+% }
% \toprule
% Entry & \multicolumn{1}{c}{Mass} &
% {Mass/\SI{e3}{\kilogram}} \\
@@ -4401,7 +4663,7 @@ This work consists of the file siunitx.dtx
%
%\section{Making suggestions and reporting bugs}
%
-% Feedback on \pkg{siunitx} is always welcome, either to make
+% Feedback on \pkg{siunitx} is always welcome, either to make
% suggestions or to report problems. When sending feedback, it is
% always useful if a small example file is included, showing the
% bug being reported or illustrating the desired output. It is
@@ -4415,28 +4677,28 @@ This work consists of the file siunitx.dtx
% % Other packages loaded as required
% \begin{document}
% Reference output: $ 1.23\,\mathrm{m} $
-%
+%
% siunitx output: \SI{1.23}{\metre}
% \end{document}
%\end{LaTeXdemo}
% As illustrated, it is usually best to use the \texttt{article}
-% class and to only load packages which are needed to show the issue.
+% class and to only load packages which are needed to show the issue.
% It is also useful to include a copy of the log file generate by
% \TeX\ when reporting a bug (as the versions of packages can be
% important to solving the issue).
-%
-% Feedback can be sent in a range of ways. The development code
-% is hosted by
+%
+% Feedback can be sent in a range of ways. The development code
+% is hosted by
% \href{http://bitbucket.org/josephwright/siunitx}{BitBucket},
% and the site includes an issue tracker. Adding feedback directly
-% to the database means that other users can see it, and also
-% ensures that it does not get forgotten. E-mailing directly is
+% to the database means that other users can see it, and also
+% ensures that it does not get forgotten. E-mailing directly is
% will also definitely get attention:
% \href{mailto:joseph.wright@morningstar2.co.uk}
% {\texttt{joseph.wright@morningstar2.co.uk}}. I also keep an eye
-% on various groups, for example
+% on various groups, for example
% \href{http://groups.google.com/group/comp.text.tex/topics}
-% {\texttt{comp.text.tex}} and
+% {\texttt{comp.text.tex}} and
% \href{http://www.latex-community.org/forum/}{The \LaTeX\ Community}.
% Sometimes I miss posts to these places, so it's useful if you also
% e-mail me pointing to the appropriate thread.
@@ -4446,8 +4708,8 @@ This work consists of the file siunitx.dtx
% Many users have provided feedback, bug reports and ideas for new
% features for \pkg{siunitx}: thanks to all of them. Particular thanks
% to Stefan Pinnow, who has taken the lead role as beta tester for
-% \pkg{siunitx}, finding incorrect output, bad documentation and the
-% odd spelling mistake in the documentation. Thanks also to
+% \pkg{siunitx}, finding incorrect output, bad documentation and the
+% odd spelling mistake in the documentation. Thanks also to
% Danie Els and Marcel Heldoorn for the \pkg{SIstyle} and \pkg{SIunits}
% packages, respectively, which provided the starting point for the
% development of \pkg{siunitx}.
@@ -4464,21 +4726,21 @@ This work consists of the file siunitx.dtx
%
%\subsection{Preliminaries}
%
-% The usual preliminaries.
+% The usual preliminaries.
% \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2011/04/04} {2.1p}
+\ProvidesExplPackage {siunitx} {2011/04/13} {2.2}
{A comprehensive (SI) units package}
% \end{macrocode}
-%
+%
% Various problems pop up if the support files are too old. First,
% a check on \pkg{expl3}. There is also a check on \pkg{xparse}, but
% that comes a bit later. If the version of \pkg{expl3} is \emph{really}
-% old then the message system may not be in place at all: there is a
+% old then the message system may not be in place at all: there is a
% back up for that case.
% \begin{macrocode}
\cs_if_exist:NTF \msg_set:nnnn
{
- \msg_set:nnnn { siunitx } { support-outdated }
+ \msg_set:nnnn { siunitx } { support-outdated }
{ Support~package~#1~too~old. }
{
Please~install~an~up~to~date~version~of~#1. \\
@@ -4491,35 +4753,35 @@ This work consists of the file siunitx.dtx
Please~install~an~up~to~date~version~of~expl3. \\
Loading~siunitx~will~abort!
}
- \tex_endinput:D
+ \tex_endinput:D
}
-\@ifpackagelater { expl3 } { 2010/11/13 }
+\@ifpackagelater { expl3 } { 2010/11/13 }
{ }
{
\msg_error:nnx { siunitx } { support-outdated } { expl3 }
\tex_endinput:D
}
% \end{macrocode}
-%
+%
%\begin{macro}{\siunitx_load_check:}
% There are also a number of packages that are incompatible with
-% \pkg{siunitx}. These are all checked for next. Some of the
-% incompatible packages will not raise an error if loaded after
-% \pkg{siunitx}. So a test is made at the beginning of the
+% \pkg{siunitx}. These are all checked for next. Some of the
+% incompatible packages will not raise an error if loaded after
+% \pkg{siunitx}. So a test is made at the beginning of the
% document as well. The message for this may be needed immediately, so
% it is created here not with the other messages.
% \begin{macrocode}
-\msg_set:nnnn { siunitx } { incompatible-package }
+\msg_set:nnnn { siunitx } { incompatible-package }
{ Package~'#1'~incompatible. }
{ The~#1~package~and~siunitx~are~incompatible. }
\cs_new_protected_nopar:Npn \siunitx_load_check:n #1 {
\group_begin:
- \@ifpackageloaded {#1}
- { \msg_error:nnx { siunitx } { incompatible-package } {#1} }
+ \@ifpackageloaded {#1}
+ { \msg_error:nnx { siunitx } { incompatible-package } {#1} }
{ }
\group_end:
}
-\clist_map_function:nN
+\clist_map_function:nN
{ SIunits , sistyle , siunits , SIstyle , unitsdef , fancyunits }
\siunitx_load_check:n
\AtBeginDocument {
@@ -4533,7 +4795,7 @@ This work consists of the file siunitx.dtx
% errors.
% \begin{macrocode}
\RequirePackage{ xparse }
-\@ifpackagelater { xparse } { 2010/10/13 }
+\@ifpackagelater { xparse } { 2010/10/13 }
{ }
{
\msg_error:nnx { siunitx } { support-outdated } { xparse }
@@ -4545,16 +4807,23 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\RequirePackage{ amstext , array , l3keys2e }
% \end{macrocode}
-%
+%
%\begin{macro}{\siunitx_tmp:w}
-%\begin{macro}{\l_siunitx_tmp_bool}
-%\begin{macro}{\l_siunitx_tmp_box}
-%\begin{macro}{\l_siunitx_tmp_int}
-%\begin{macro}{\l_siunitx_tmpa_tl}
-%\begin{macro}{\l_siunitx_tmpb_tl}
-% Scratch items.
+% A scratch function.
% \begin{macrocode}
\cs_new:Npn \siunitx_tmp:w { }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{
+% \l_siunitx_tmp_bool ,
+% \l_siunitx_tmp_box ,
+% \l_siunitx_tmp_int ,
+% \l_siunitx_tmpa_tl ,
+% \l_siunitx_tmpb_tl ,
+%}
+% Scratch variables.
+% \begin{macrocode}
\bool_new:N \l_siunitx_tmp_bool
\box_new:N \l_siunitx_tmp_box
\int_new:N \l_siunitx_tmp_int
@@ -4562,19 +4831,15 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_tmpb_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
+%\begin{macro}{
+% \siunitx_error:nxx ,
+% \siunitx_error:nx ,
+% \siunitx_error:n ,
+%}
%\begin{macro}{\l_siunitx_error_bool}
-%\begin{macro}{\siunitx_error:nxx}
-%\begin{macro}{\siunitx_error:nx}
-%\begin{macro}{\siunitx_error:n}
% General-purpose functions for throwing errors.
% \begin{macrocode}
-\bool_new:N \l_siunitx_error_bool
\cs_new_protected:Npn \siunitx_error:nxx #1#2#3 {
\bool_set_true:N \l_siunitx_error_bool
\msg_error:nnxx { siunitx } {#1} {#2} {#3}
@@ -4585,27 +4850,28 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_error:n #1 {
\siunitx_error:nxx {#1} { } { }
}
+\bool_new:N \l_siunitx_error_bool
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% Some of the \texttt{TS1} encoding is needed to provide symbols in
+%
+% Some of the \texttt{TS1} encoding is needed to provide symbols in
% text mode. If the user has not loaded the encoding themselves, it is
% done here.
% \begin{macrocode}
-\AtBeginDocument {
- \cs_if_free:cT { T@TS1 }
+\AtBeginDocument {
+ \cs_if_free:cT { T@TS1 }
{
- \DeclareFontEncoding { TS1 } { } { }
- \DeclareFontSubstitution { TS1 } { cmr } { m } { n }
+ \DeclareFontEncoding { TS1 } { } { }
+ \DeclareFontSubstitution { TS1 } { cmr } { m } { n }
}
}
% \end{macrocode}
%
-%\begin{macro}{\c_siunitx_minus_tl}
-%\begin{macro}{\c_siunitx_minus_int}
+%\begin{macro}{
+% \c_siunitx_minus_tl ,
+% \c_siunitx_minus_int ,
+%}
% To allow the correct symbol to appear in text mode: this is the same
% as \cs{textminus} from \pkg{textcomp}. If \pkg{fontspec} is loaded
% then the real character can be used.
@@ -4614,18 +4880,20 @@ This work consists of the file siunitx.dtx
\DeclareTextSymbol \c_siunitx_minus_tl { TS1 } { 61 }
\AtBeginDocument {
\@ifpackageloaded { fontspec }
- {
+ {
\int_const:Nn \c_siunitx_minus_int { 8722 }
- \tl_set:Nn \c_siunitx_minus_tl { \char \c_siunitx_minus_int }
+ \tl_set:Nn \c_siunitx_minus_tl
+ { \tex_char:D \c_siunitx_minus_int }
}
{ }
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%
-%\begin{macro}{\c_siunitx_mu_tl}
+%\begin{macro}{
+% \c_siunitx_mu_tl ,
+% \c_siunitx_mu_int ,
+%}
% The lack of an upright mu has to be sorted out. The same consideration
% for \pkg{fontspec} as above.
% \begin{macrocode}
@@ -4633,29 +4901,36 @@ This work consists of the file siunitx.dtx
\DeclareTextSymbolDefault \c_siunitx_mu_tl { TS1 }
\AtBeginDocument {
\@ifpackageloaded { fontspec }
- { \tl_set:Nx \c_siunitx_mu_tl { \char 181 } }
+ {
+ \int_const:Nn \c_siunitx_mu_int { 181 }
+ \tl_set:Nn \c_siunitx_mu_tl { \tex_char:D \c_siunitx_mu_int }
+ }
{ }
}
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\c_siunitx_omega_tl}
% Some package redefine \cs{Omega} to be slanted and move the original
% symbol to \cs{upOmega}. This is handled here.
% \begin{macrocode}
\tl_new:N \c_siunitx_omega_tl
\tl_set:Nn \c_siunitx_omega_tl { \Omega }
\AtBeginDocument {
- \cs_if_exist:NT \upOmega
+ \cs_if_exist:NT \upOmega
{ \tl_set:Nn \c_siunitx_omega_tl { \upOmega } }
}
% \end{macrocode}
+%\end{macro}
%
-%\begin{macro}{\siunitx_tl_put_left_math:Nn}
-%\begin{macro}{\siunitx_tl_put_left_math:NV}
-%\begin{macro}{\siunitx_tl_put_left_math:cV}
-%\begin{macro}{\siunitx_tl_put_right_math:Nn}
-%\begin{macro}{\siunitx_tl_put_right_math:NV}
-%\begin{macro}{\siunitx_tl_put_right_math:cV}
+%\begin{macro}{
+% \siunitx_tl_put_left_math:Nn ,
+% \siunitx_tl_put_left_math:NV ,
+% \siunitx_tl_put_left_math:cV ,
+% \siunitx_tl_put_right_math:Nn ,
+% \siunitx_tl_put_right_math:NV ,
+% \siunitx_tl_put_right_math:cV ,
+%}
% To add stuff in math mode.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_tl_put_left_math:Nn #1#2 {
@@ -4670,11 +4945,6 @@ This work consists of the file siunitx.dtx
\cs_generate_variant:Nn \siunitx_tl_put_right_math:Nn { cV }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\c_siunitx_old_options_seq}
% To pick up old options, all of the names need to be known.
@@ -4826,68 +5096,67 @@ This work consists of the file siunitx.dtx
\siunitx_tmp:w { valuesep }
\siunitx_tmp:w { xpace }
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%
%\begin{macro}{\l_siunitx_key_tl}
% Unknown options should raise an \pkg{siunitx}-specific error message.
% \begin{macrocode}
\tl_new:N \l_siunitx_key_tl
\keys_define:nn { siunitx } {
- unknown .code:n =
- {
+ unknown .code:n =
+ {
\seq_if_in:NVTF \c_siunitx_old_options_seq \l_keys_key_tl
{
- \msg_warning:nnx { siunitx } { version-1-option }
- { \exp_not:V \l_keys_key_tl }
+ \msg_warning:nnx { siunitx } { version-1-option }
+ { \exp_not:V \l_keys_key_tl }
\tl_set:Nx \l_siunitx_key_tl
- {
- \keys_set:nn { siunitx }
- {
- \exp_not:V \l_keys_key_tl
+ {
+ \keys_set:nn { siunitx }
+ {
+ \exp_not:V \l_keys_key_tl
\tl_if_blank:nF {#1} { = \exp_not:n {#1} }
}
}
\keys_set:nn { siunitx } { load-configurations = version-1 }
- \tl_use:N \l_siunitx_key_tl
+ \tl_use:N \l_siunitx_key_tl
}
{
- \msg_error:nnx { siunitx } { unknown-option }
- { \exp_not:V \l_keys_key_tl }
- }
+ \msg_error:nnx { siunitx } { unknown-option }
+ { \exp_not:V \l_keys_key_tl }
+ }
}
}
\AtBeginDocument {
\keys_define:nn { siunitx } {
- unknown .code:n =
- {
+ unknown .code:n =
+ {
\seq_if_in:NVTF \c_siunitx_old_options_seq \l_keys_key_tl
{
- \msg_error:nnx { siunitx } { version-1-option }
- { \exp_not:V \l_keys_key_tl }
+ \msg_error:nnx { siunitx } { version-1-option }
+ { \exp_not:V \l_keys_key_tl }
}
{
- \msg_error:nnx { siunitx } { unknown-option }
- { \exp_not:V \l_keys_key_tl }
- }
+ \msg_error:nnx { siunitx } { unknown-option }
+ { \exp_not:V \l_keys_key_tl }
+ }
}
}
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_option_deactivate_clist}
%\begin{macro}{\siunitx_option_deactivate:n}
%\begin{macro}[aux]{\siunitx_option_deactivate_aux:n}
+%\begin{macro}{\l_siunitx_option_deactivate_clist}
% Some options need to be deactivated at the start of the document.
% \begin{macrocode}
-\clist_new:N \l_siunitx_option_deactivate_clist
\cs_new_protected_nopar:Npn \siunitx_option_deactivate:n #1 {
\clist_put_right:Nn \l_siunitx_option_deactivate_clist {#1}
}
\cs_new_protected_nopar:Npn \siunitx_option_deactivate_aux:n #1 {
- \keys_define:nn { siunitx }
+ \keys_define:nn { siunitx }
{
- #1 .code:n =
+ #1 .code:n =
{ \msg_warning:nnx { siunitx } { option-preamble-only } {#1} }
}
}
@@ -4895,55 +5164,58 @@ This work consists of the file siunitx.dtx
\clist_map_function:NN \l_siunitx_option_deactivate_clist
\siunitx_option_deactivate_aux:n
}
+\clist_new:N \l_siunitx_option_deactivate_clist
% \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%
-%\begin{macro}{\prop_del:cn}
-%\begin{macro}{\prop_put:cnV}
-%\begin{macro}{\tl_replace_all_in:NnV}
+%\begin{macro}{
+% \prop_del:cn ,
+% \prop_put:cnV ,
+% \tl_if_in:NVTF ,
+% \tl_replace_all_in:NnV ,
+%}
% Variants needed which are not in \pkg{expl3}.
% \begin{macrocode}
\cs_generate_variant:Nn \prop_del:Nn { c }
\cs_generate_variant:Nn \prop_put:Nnn { cnV }
+\cs_generate_variant:Nn \tl_if_in:NnTF { NV }
\cs_generate_variant:Nn \tl_replace_all_in:Nnn { NnV }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_cs_if_tl_p:N}
-%\begin{macro}[TF]{\siunitx_cs_if_tl:N}
+%\begin{macro}[pTF]{
+% \siunitx_cs_if_tl:N ,
+% \siunitx_cs_if_macro:N ,
+%}
%\begin{macro}[aux]{\siunitx_cs_if_tl_aux:w}
-%\begin{macro}{\siunitx_cs_if_macro_p:N}
-%\begin{macro}[TF]{\siunitx_cs_if_macro:N}
% This is basically a re-hash of stuff from \pkg{expl3}, but to test for
% short macros only. The second test (with the \cs{cs_to_str:N} part)
% is checking for \LaTeXe\ robust commands.
% \begin{macrocode}
\group_begin:
-\tl_map_inline:nn { \M \A \C \R \O }
+\tl_map_inline:nn { \M \A \C \R \O }
{ \char_make_other:n { `#1 } }
\tl_map_inline:nn { \F \N \T }
- { \char_set_lccode:nn { `#1 } { `#1 } }
+ { \char_set_lccode:nn { `#1 } { `#1 } }
\tl_to_lowercase:n {
\group_end:
- \prg_new_conditional:Npnn \siunitx_cs_if_tl:N #1 { T , F, TF , p }
+ \prg_new_conditional:Npnn \siunitx_cs_if_tl:N #1 { T , F, TF , p }
{
\exp_last_unbraced:No \siunitx_cs_if_tl_aux:w
{ \token_to_meaning:N #1 MACRO \q_stop }
- {
+ {
\cs_if_exist:cTF { \cs_to_str:N #1 ~ }
{ \prg_return_false: }
{ \prg_return_true: }
- }
+ }
{ \prg_return_false: }
}
- \cs_new_nopar:Npn \siunitx_cs_if_tl_aux:w #1 MACRO #2 \q_stop
+ \cs_new_nopar:Npn \siunitx_cs_if_tl_aux:w #1 MACRO #2 \q_stop
{ \tl_if_empty:nTF {#1} }
- \prg_new_conditional:Npnn \siunitx_cs_if_macro:N #1
- { T , F , TF , p }
+ \prg_new_conditional:Npnn \siunitx_cs_if_macro:N #1
+ { T , F , TF , p }
{
\exp_last_unbraced:No \siunitx_cs_if_tl_aux:w
{ \token_to_meaning:N #1 MACRO \q_stop }
@@ -4954,9 +5226,6 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_ensuremath:n}
% A copy is made of \cs{ensuremath}: if \pkg{tex4ht} is in use, it
@@ -4966,8 +5235,8 @@ This work consists of the file siunitx.dtx
\cs_new_eq:NN \siunitx_ensuremath:n \ensuremath
\AtBeginDocument {
\@ifpackageloaded { tex4ht }
- {
- \cs_set_eq:NN \siunitx_ensuremath:n \use:n
+ {
+ \cs_set_eq:NN \siunitx_ensuremath:n \use:n
\keys_set:nn { siunitx } { mode = text }
}
{ }
@@ -4980,7 +5249,7 @@ This work consists of the file siunitx.dtx
% display environment.
% \begin{macrocode}
\bool_new:N \l_siunitx_display_math_bool
-\toks_put_right:Nn \tex_everydisplay:D
+\toks_put_right:Nn \tex_everydisplay:D
{ \bool_set_true:N \l_siunitx_display_math_bool }
% \end{macrocode}
%\end{macro}
@@ -4992,30 +5261,32 @@ This work consists of the file siunitx.dtx
% then be used inside the \cs{text} macro from the \pkg{amstext}
% package. By carrying out the changes outside math mode, bold can
% reliably be applied to math output.
-%
-%\begin{macro}{\c_siunitx_mathsf_int}
-%\begin{macro}{\c_siunitx_mathtt_int}
+%
%\begin{macro}{\siunitx_set_math_fam:n}
+%\begin{macro}{
+% \c_siunitx_mathsf_int ,
+% \c_siunitx_mathtt_int ,
+%}
% The detection routine needs some basic data about the sans serif and
-% monospaced fonts in use. This is collected up at the start of the
-% document. The families used can change between here and the start of
+% monospaced fonts in use. This is collected up at the start of the
+% document. The families used can change between here and the start of
% the document. This is run as a hook onto \cs{document}, rather than
% using \cs{AtBeginDocument} as it has to come after anything that
-% \pkg{fontspec} does (nasty errors arise otherwise).
+% \pkg{fontspec} does (nasty errors arise otherwise).
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_set_math_fam:n #1 {
\int_new:c { c_siunitx_math #1 _int }
\group_begin:
- \hbox_set:Nn \l_siunitx_tmp_box
+ \hbox_set:Nn \l_siunitx_tmp_box
{
- \ensuremath
+ \ensuremath
{
- \use:c { math #1 }
+ \use:c { math #1 }
{
- \int_gset:cn { c_siunitx_math #1 _int } { \fam }
+ \int_gset:cn { c_siunitx_math #1 _int } { \fam }
}
}
- }
+ }
\group_end:
}
\tl_put_right:Nn \document {
@@ -5025,14 +5296,15 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_font_set_text_fam:n}
-%\begin{macro}{\c_siunitx_textsf_tl}
-%\begin{macro}{\c_siunitx_texttt_tl}
-% The text families are done in a somewhat different manner: there are
-% no issues with \cs{AtBeginDocument}, luckily. The need to define
-% new macros here arises as \cs{sfdefault} and \cs{ttdefault} are
+%\begin{macro}{
+% \c_siunitx_textsf_tl ,
+% \c_siunitx_texttt_tl ,
+%}
+% The text families are done in a somewhat different manner: there are
+% no issues with \cs{AtBeginDocument}, luckily. The need to define
+% new macros here arises as \cs{sfdefault} and \cs{ttdefault} are
% \cs{long}, whereas \cs{f@family} is not.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_set_text_fam:n #1 {
@@ -5046,7 +5318,6 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\l_siunitx_detect_inline_weight_tl}
% Used by the keys, but needs to be created here.
@@ -5055,64 +5326,66 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_detect_display_math_bool}
-%\begin{macro}{\l_siunitx_detect_family_bool}
-%\begin{macro}{\l_siunitx_detect_inline_family_tl}
-%\begin{macro}{\l_siunitx_detect_inline_weight_tl}
-%\begin{macro}{\l_siunitx_detect_shape_bool}
-%\begin{macro}{\l_siunitx_detect_mode_bool}
-%\begin{macro}{\l_siunitx_detect_weight_bool}
+%\begin{macro}{
+% \l_siunitx_detect_display_math_bool ,
+% \l_siunitx_detect_family_bool ,
+% \l_siunitx_detect_inline_family_tl ,
+% \l_siunitx_detect_inline_weight_tl ,
+% \l_siunitx_detect_shape_bool ,
+% \l_siunitx_detect_mode_bool ,
+% \l_siunitx_detect_weight_bool ,
+%}
% Font detection is all about creating switches, with just a little
% gloss for \texttt{detect-all} and \texttt{detect-none}.
% \begin{macrocode}
\keys_define:nn { siunitx } {
detect-all .choice:,
detect-all .default:n = true,
- detect-all / false .meta:n =
+ detect-all / false .meta:n =
{
- detect-family = false,
- detect-mode = false,
- detect-shape = false,
- detect-weight = false
+ detect-family = false ,
+ detect-mode = false ,
+ detect-shape = false ,
+ detect-weight = false ,
},
- detect-all / true .meta:n =
+ detect-all / true .meta:n =
{
- detect-family = true,
- detect-mode = true,
- detect-shape = true,
- detect-weight = true
+ detect-family = true ,
+ detect-mode = true ,
+ detect-shape = true ,
+ detect-weight = true ,
},
- detect-display-math .bool_set:N =
+ detect-display-math .bool_set:N =
\l_siunitx_detect_display_math_bool,
detect-family .bool_set:N = \l_siunitx_detect_family_bool,
detect-inline-family .choice:,
detect-inline-family .value_required:,
- detect-inline-family /
- math .code:n =
+ detect-inline-family /
+ math .code:n =
{ \tl_set:Nn \l_siunitx_detect_inline_family_tl { math } },
- detect-inline-family /
- text .code:n =
+ detect-inline-family /
+ text .code:n =
{ \tl_set:Nn \l_siunitx_detect_inline_family_tl { text } },
detect-inline-weight .choice:,
detect-inline-weight .value_required:,
- detect-inline-weight /
- math .code:n =
+ detect-inline-weight /
+ math .code:n =
{ \tl_set:Nn \l_siunitx_detect_inline_weight_tl { math } },
- detect-inline-weight /
- text .code:n =
+ detect-inline-weight /
+ text .code:n =
{ \tl_set:Nn \l_siunitx_detect_inline_weight_tl { text } },
detect-italic .bool_set:N = \l_siunitx_detect_shape_bool,
detect-mode .bool_set:N = \l_siunitx_detect_mode_bool,
detect-none .choice:,
detect-none .default:n = true,
- detect-none / false .meta:n =
+ detect-none / false .meta:n =
{
detect-family = true,
detect-mode = true,
detect-shape = true,
detect-weight = true
},
- detect-none / true .meta:n =
+ detect-none / true .meta:n =
{
detect-family = false,
detect-mode = false,
@@ -5128,15 +5401,11 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_font_set_bool}
-%\begin{macro}{\l_siunitx_font_math_mode_bool}
+%\begin{macro}{
+% \l_siunitx_font_set_bool ,
+% \l_siunitx_font_math_mode_bool ,
+%}
% The internals of the package need a number of switches to track what
% is happening.
% \begin{macrocode}
@@ -5144,7 +5413,6 @@ This work consists of the file siunitx.dtx
\bool_new:N \l_siunitx_font_math_mode_bool
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\l_siunitx_font_family_tl}
% Also some token storage.
@@ -5153,15 +5421,16 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_font_shape:}
-%\begin{macro}{\siunitx_font_weight:}
+%\begin{macro}{
+% \siunitx_font_shape: ,
+% \siunitx_font_weight: ,
+%}
% These could be token lists or functions!
% \begin{macrocode}
\cs_new_nopar:Npn \siunitx_font_shape: { }
\cs_new_nopar:Npn \siunitx_font_weight: { }
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_detect_font:}
% The main font-setting macro is a control point for the other
@@ -5169,16 +5438,16 @@ This work consists of the file siunitx.dtx
% test is to ensure this is not happening.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_detect_font: {
- \bool_if:NF \l_siunitx_font_set_bool
+ \bool_if:NF \l_siunitx_font_set_bool
{
\siunitx_detect_font_init:
- \bool_if:NT \l_siunitx_detect_weight_bool
+ \bool_if:NT \l_siunitx_detect_weight_bool
{ \siunitx_detect_font_weight: }
- \bool_if:NT \l_siunitx_detect_family_bool
+ \bool_if:NT \l_siunitx_detect_family_bool
{ \siunitx_detect_font_family: }
- \bool_if:NT \l_siunitx_detect_shape_bool
+ \bool_if:NT \l_siunitx_detect_shape_bool
{ \siunitx_detect_font_shape: }
- \bool_if:NT \l_siunitx_detect_mode_bool
+ \bool_if:NT \l_siunitx_detect_mode_bool
{ \siunitx_detect_font_mode: }
}
}
@@ -5190,9 +5459,9 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_detect_font_init: {
\bool_set_true:N \l_siunitx_font_set_bool
- \cs_set:Npn \siunitx_font_weight:
+ \cs_set:Npn \siunitx_font_weight:
{
- \unboldmath
+ \unboldmath
\mdseries
}
\cs_set:Npn \siunitx_font_shape: { \upshape }
@@ -5203,23 +5472,23 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_detect_font_weight:}
-% The font weight detection code depends on whether the current text is
-% math or text, and also the type of math (if appropriate). For
+% The font weight detection code depends on whether the current text is
+% math or text, and also the type of math (if appropriate). For
% inline math, there is a choice of what test to apply.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_detect_font_weight: {
- \mode_if_math:TF
+ \mode_if_math:TF
{
\bool_if:NTF \l_siunitx_display_math_bool
{
- \bool_if:NTF \l_siunitx_detect_display_math_bool
+ \bool_if:NTF \l_siunitx_detect_display_math_bool
{ \siunitx_detect_font_weight_math: }
{ \siunitx_detect_font_weight_text: }
}
{
- \use:c
+ \use:c
{
- siunitx_detect_font_weight_
+ siunitx_detect_font_weight_
\l_siunitx_detect_inline_weight_tl
:
}
@@ -5229,28 +5498,30 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\siunitx_detect_font_weight_math:}
-%\begin{macro}{\siunitx_detect_font_weight_text:}
-% The tests for font weight depend on whether the module is testing
+%\begin{macro}{
+% \siunitx_detect_font_weight_math: ,
+% \siunitx_detect_font_weight_text: ,
+%}
+% The tests for font weight depend on whether the module is testing
% text or math content.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_detect_font_weight_math: {
\str_if_eq:VnT \math@version { bold }
{
- \cs_set:Npn \siunitx_font_weight:
+ \cs_set:Npn \siunitx_font_weight:
{
\boldmath
\bfseries
}
}
- \str_if_eq:VnT \math@version { light }
+ \str_if_eq:VnT \math@version { light }
{ \cs_set:Npn \siunitx_font_weight: { \lseries } }
}
\cs_new_protected_nopar:Npn \siunitx_detect_font_weight_text: {
\tl_set:Nx \l_siunitx_tmpa_tl { \tl_head:V \f@series }
\str_if_eq:VnT \l_siunitx_tmpa_tl { b }
{
- \cs_set:Npn \siunitx_font_weight:
+ \cs_set:Npn \siunitx_font_weight:
{
\boldmath
\bfseries
@@ -5261,25 +5532,24 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_detect_font_family:}
% Family detection usually picks up the surrounding text. However, for
% display math there are two options, and so a second test may be made.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_detect_font_family: {
- \mode_if_math:TF
+ \mode_if_math:TF
{
\bool_if:NTF \l_siunitx_display_math_bool
{
- \bool_if:NTF \l_siunitx_detect_display_math_bool
+ \bool_if:NTF \l_siunitx_detect_display_math_bool
{ \siunitx_detect_font_family_math: }
{ \siunitx_detect_font_family_text: }
}
{
- \use:c
+ \use:c
{
- siunitx_detect_font_family_
+ siunitx_detect_font_family_
\l_siunitx_detect_inline_family_tl
:
}
@@ -5289,30 +5559,31 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\siunitx_detect_font_family_math:}
-%\begin{macro}{\siunitx_detect_font_family_text:}
+%\begin{macro}{
+% \siunitx_detect_font_family_math: ,
+% \siunitx_detect_font_family_text: ,
+%}
% The two detections routines check if the current font is sans serif or
% monospaced. The method used depends on whether the current math or
-% text font is of interest. The math detection routine re-applies the
+% text font is of interest. The math detection routine re-applies the
% default (\texttt{rm}), as the text function is always called and may
% have changed things.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_detect_font_family_math: {
\tl_set:Nn \l_siunitx_font_family_tl { rm }
- \int_compare:nNnT { \fam } = { \c_siunitx_mathsf_int }
+ \int_compare:nNnT { \fam } = { \c_siunitx_mathsf_int }
{ \tl_set:Nn \l_siunitx_font_family_tl { sf } }
- \int_compare:nNnT { \fam } = { \c_siunitx_mathtt_int }
+ \int_compare:nNnT { \fam } = { \c_siunitx_mathtt_int }
{ \tl_set:Nn \l_siunitx_font_family_tl { tt } }
}
\cs_new_protected_nopar:Npn \siunitx_detect_font_family_text: {
- \tl_if_eq:NNT \f@family \c_siunitx_textsf_tl
+ \tl_if_eq:NNT \f@family \c_siunitx_textsf_tl
{ \tl_set:Nn \l_siunitx_font_family_tl { sf } }
- \tl_if_eq:NNT \f@family \c_siunitx_texttt_tl
+ \tl_if_eq:NNT \f@family \c_siunitx_texttt_tl
{ \tl_set:Nn \l_siunitx_font_family_tl { tt } }
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_detect_font_shape:}
% The shape test uses \cs{f@shape} as a handy indicator.
@@ -5331,8 +5602,8 @@ This work consists of the file siunitx.dtx
% standard.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_detect_font_mode: {
- \mode_if_math:F
- {
+ \mode_if_math:F
+ {
\bool_set_false:N \l_siunitx_font_math_mode_bool
\bool_set_false:N \l_siunitx_number_math_mode_bool
\bool_set_false:N \l_siunitx_unit_math_mode_bool
@@ -5344,30 +5615,31 @@ This work consists of the file siunitx.dtx
%\subsection{Font macros}
%
% With the detection routines in place, the module can apply the result
-% to control the font used for output. This requires a series of font
+% to control the font used for output. This requires a series of font
% names to be available. The appropriate storage areas will be selected
% by name, based on output type (\texttt{unit} or \texttt{value}) and
% the family selected by the detector.
-%
-%\begin{macro}{\l_siunitx_number_math_mode_bool}
-%\begin{macro}{\l_siunitx_unit_math_mode_bool}
+%
+%\begin{macro}{
+% \l_siunitx_number_math_mode_bool ,
+% \l_siunitx_unit_math_mode_bool ,
+%}
% Most of the variables are created by the keys system: these are not.
% \begin{macrocode}
\bool_new:N \l_siunitx_number_math_mode_bool
\bool_new:N \l_siunitx_unit_math_mode_bool
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_number_color_tl}
-%\begin{macro}{\siunitx_number_mathrm:n}
-%\begin{macro}{\siunitx_number_mathsf:n}
-%\begin{macro}{\siunitx_number_mathtt:n}
-%\begin{macro}{\siunitx_number_textrm:}
-%\begin{macro}{\siunitx_number_textsf:}
-%\begin{macro}{\siunitx_number_texttt:}
-% The settings are actually created separately for numbers and units:
-% numbers first.
+%\begin{macro}{
+% \siunitx_number_mathrm:n ,
+% \siunitx_number_mathsf:n ,
+% \siunitx_number_mathtt:n ,
+% \siunitx_number_textrm: ,
+% \siunitx_number_textsf: ,
+% \siunitx_number_texttt: ,
+%}
+% Functions for number-mode fonts.
% \begin{macrocode}
\cs_new:Npn \siunitx_number_mathrm:n #1 { }
\cs_new:Npn \siunitx_number_mathsf:n #1 { }
@@ -5375,43 +5647,45 @@ This work consists of the file siunitx.dtx
\cs_new_nopar:Npn \siunitx_number_textrm: { }
\cs_new_nopar:Npn \siunitx_number_textsf: { }
\cs_new_nopar:Npn \siunitx_number_texttt: { }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\l_siunitx_number_color_tl}
+% The settings are actually created separately for numbers and units:
+% numbers first.
+% \begin{macrocode}
\keys_define:nn { siunitx } {
number-color .tl_set:N = \l_siunitx_number_color_tl,
number-math-rm .code:n =
{ \cs_set_nopar:Npn \siunitx_number_mathrm:n ##1 { #1 {##1} } },
number-math-sf .code:n =
{ \cs_set_nopar:Npn \siunitx_number_mathsf:n ##1 { #1 {##1} } },
- number-math-tt .code:n =
+ number-math-tt .code:n =
{ \cs_set_nopar:Npn \siunitx_number_mathtt:n ##1 { #1 {##1} } },
number-mode .choice:,
- number-mode / math .code:n =
+ number-mode / math .code:n =
{ \bool_set_true:N \l_siunitx_number_math_mode_bool },
number-mode / text .code:n =
{ \bool_set_false:N \l_siunitx_number_math_mode_bool },
- number-text-rm .code:n =
+ number-text-rm .code:n =
{ \cs_set_nopar:Npn \siunitx_number_textrm: {#1} },
- number-text-sf .code:n =
+ number-text-sf .code:n =
{ \cs_set_nopar:Npn \siunitx_number_textsf: {#1} },
- number-text-tt .code:n =
+ number-text-tt .code:n =
{ \cs_set_nopar:Npn \siunitx_number_texttt: {#1} }
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_siunitx_unit_color_tl}
-%\begin{macro}{\siunitx_unit_mathrm:n}
-%\begin{macro}{\siunitx_unit_mathsf:n}
-%\begin{macro}{\siunitx_unit_mathtt:n}
-%\begin{macro}{\siunitx_unit_textrm:}
-%\begin{macro}{\siunitx_unit_textsf:}
-%\begin{macro}{\siunitx_unit_texttt:}
-% Units look exactly the same.
+%
+%\begin{macro}{
+% \siunitx_unit_mathrm:n ,
+% \siunitx_unit_mathsf:n ,
+% \siunitx_unit_mathtt:n ,
+% \siunitx_unit_textrm: ,
+% \siunitx_unit_textsf: ,
+% \siunitx_unit_texttt: ,
+%}
+% The same storage for unit-mode fonts.
% \begin{macrocode}
\cs_new_nopar:Npn \siunitx_unit_mathrm: { }
\cs_new_nopar:Npn \siunitx_unit_mathsf: { }
@@ -5419,20 +5693,26 @@ This work consists of the file siunitx.dtx
\cs_new_nopar:Npn \siunitx_unit_textrm: { }
\cs_new_nopar:Npn \siunitx_unit_textsf: { }
\cs_new_nopar:Npn \siunitx_unit_texttt: { }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\l_siunitx_unit_color_tl}
+% Units look exactly the same.
+% \begin{macrocode}
\keys_define:nn { siunitx } {
unit-color .tl_set:N = \l_siunitx_unit_color_tl,
unit-math-rm .code:n =
{ \cs_set_nopar:Npn \siunitx_unit_mathrm:n ##1 { #1 {##1} } },
- unit-math-sf .code:n =
+ unit-math-sf .code:n =
{ \cs_set_nopar:Npn \siunitx_unit_mathsf:n ##1 { #1 {##1} } },
- unit-math-tt .code:n =
+ unit-math-tt .code:n =
{ \cs_set_nopar:Npn \siunitx_unit_mathtt:n ##1 { #1 {##1} } },
unit-mode .choice:,
- unit-mode / math .code:n =
+ unit-mode / math .code:n =
{ \bool_set_true:N \l_siunitx_unit_math_mode_bool },
- unit-mode / text .code:n =
+ unit-mode / text .code:n =
{ \bool_set_false:N \l_siunitx_unit_math_mode_bool },
- unit-text-rm .code:n =
+ unit-text-rm .code:n =
{ \cs_set_nopar:Npn \siunitx_unit_textrm: {#1} },
unit-text-sf .code:n =
{ \cs_set_nopar:Npn \siunitx_unit_textsf: {#1} },
@@ -5441,59 +5721,53 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
% The general settings are all meta-keys. A few initial values are set
% here as they are needed for everything to work.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- color .meta:n =
+ color .meta:n =
{
number-color = #1,
unit-color = #1
},
- math-rm .meta:n =
+ math-rm .meta:n =
{
number-math-rm = #1,
unit-math-rm = #1
},
- math-sf .meta:n =
+ math-sf .meta:n =
{
number-math-sf = #1,
unit-math-sf = #1
},
- math-tt .meta:n =
+ math-tt .meta:n =
{
number-math-tt = #1,
unit-math-tt = #1
},
mode .choice:,
- mode / math .meta:n =
+ mode / math .meta:n =
{
number-mode = math,
unit-mode = math
},
- mode / text .meta:n =
+ mode / text .meta:n =
{
number-mode = text,
unit-mode = text
},
- text-rm .meta:n =
+ text-rm .meta:n =
{
number-text-rm = #1,
unit-text-rm = #1
},
- text-sf .meta:n =
+ text-sf .meta:n =
{
number-text-sf = #1,
unit-text-sf = #1
},
- text-tt .meta:n =
+ text-tt .meta:n =
{
number-text-tt = #1,
unit-text-tt = #1
@@ -5509,15 +5783,15 @@ This work consists of the file siunitx.dtx
text-tt = \ttfamily,
}
% \end{macrocode}
-%
-% Some packages and classes (for example \pkg{beamer}) set the default
-% family to be something other than serif family. A one-off detection
+%
+% Some packages and classes (for example \pkg{beamer}) set the default
+% family to be something other than serif family. A one-off detection
% will make life easier
% all round.
% \begin{macrocode}
\AtBeginDocument {
\tl_set:Nx \l_siunitx_tmpa_tl { \familydefault }
- \tl_if_eq:NNT \l_siunitx_tmpa_tl \c_siunitx_textsf_tl
+ \tl_if_eq:NNT \l_siunitx_tmpa_tl \c_siunitx_textsf_tl
{
\@ifpackageloaded { arev }
{ }
@@ -5528,9 +5802,9 @@ This work consists of the file siunitx.dtx
}
\keys_set:nn { siunitx } { text-rm = \sffamily }
}
- \tl_if_eq:NNT \l_siunitx_tmpa_tl \c_siunitx_texttt_tl
+ \tl_if_eq:NNT \l_siunitx_tmpa_tl \c_siunitx_texttt_tl
{
- \keys_set:nn { siunitx }
+ \keys_set:nn { siunitx }
{
math-rm = \mathtt,
text-rm = \ttfamily
@@ -5538,7 +5812,7 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-%
+%
%\subsection{Output control}
%
% The \pkg{siunitx} output routine uses all of the font information
@@ -5546,25 +5820,28 @@ This work consists of the file siunitx.dtx
% The low-level stuff is done here, with the calling routines expected
% to have taken some steps first (this is to allow line breaks in the
% appropriate places).
-%
+%
%\begin{macro}{\l_siunitx_print_arg_tl}
% The text to print.
% \begin{macrocode}
\tl_new:N \l_siunitx_print_arg_tl
% \end{macrocode}
%\end{macro}
-%
+%
%\begin{macro}{\l_siunitx_print_type_tl}
-% The type of output (\texttt{number} or \texttt{unit}) is always
+% The type of output (\texttt{number} or \texttt{unit}) is always
% needed.
% \begin{macrocode}
\tl_new:N \l_siunitx_print_type_tl
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_print:nn}
-%\begin{macro}{\siunitx_print:nV}
-% The main printing function does everything inside a group, as
+%\begin{macro}{
+% \siunitx_print:nn ,
+% \siunitx_print:nV ,
+%}
+%\begin{macro}[aux]{\siunitx_print_aux:}
+% The main printing function does everything inside a group, as
% there are category code and definition changes to make. First, set
% the fonts. Then move on to printing mode, before moving to actual
% printing.
@@ -5574,9 +5851,9 @@ This work consists of the file siunitx.dtx
\tl_set:Nn \l_siunitx_print_type_tl {#1}
\tl_set:Nn \l_siunitx_print_arg_tl {#2}
\siunitx_detect_font:
- \bool_if:NF \l_siunitx_detect_mode_bool
+ \bool_if:NF \l_siunitx_detect_mode_bool
{
- \bool_if:cTF { l_siunitx_ #1 _math_mode_bool }
+ \bool_if:cTF { l_siunitx_ #1 _math_mode_bool }
{ \bool_set_true:N \l_siunitx_font_math_mode_bool }
{ \bool_set_false:N \l_siunitx_font_math_mode_bool }
}
@@ -5585,58 +5862,65 @@ This work consists of the file siunitx.dtx
}
\cs_generate_variant:Nn \siunitx_print:nn { nV }
% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_print_aux:}
% The various font changes are set up, then the correct printing
-% function is called. Everything is inside \cs{text} as this allows
+% function is called. Everything is inside \cs{text} as this allows
% proper setting of the various mode settings.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_print_aux: {
- \text
+ \text
{
\siunitx_print_color:
\siunitx_font_shape:
\siunitx_font_weight:
- \use:c
- {
- siunitx_ \l_siunitx_print_type_tl _
+ \use:c
+ {
+ siunitx_ \l_siunitx_print_type_tl _
text \l_siunitx_font_family_tl :
}
- \bool_if:NTF \l_siunitx_font_math_mode_bool
+ \bool_if:NTF \l_siunitx_font_math_mode_bool
{ \siunitx_print_math: }
{ \siunitx_print_text: }
}
}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%
-%\begin{macro}{\siunitx_print_color:}
+%\begin{macro}{
+% \siunitx_print_color: ,
+% \siunitx_textcolor:n ,
+%}
% The colour system checks if \pkg{color} is loaded, and only does
% anything if it is. This will change when \LaTeX3 proper is available:
% there will be colour out of the box!
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_print_color: {
- \tl_if_empty:cF { l_siunitx_ \l_siunitx_print_type_tl _color_tl }
+ \tl_if_empty:cF { l_siunitx_ \l_siunitx_print_type_tl _color_tl }
{
- \color
+ \color
{
\tl_use:c { l_siunitx_ \l_siunitx_print_type_tl _color_tl }
}
}
}
\AtBeginDocument {
- \@ifpackageloaded { color } { }
- { \cs_set_eq:NN \siunitx_print_color: \scan_stop: }
+ \@ifpackageloaded { color }
+ { \cs_new_eq:NN \siunitx_textcolor:n \textcolor }
+ {
+ \cs_set_eq:NN \siunitx_print_color: \scan_stop:
+ \cs_new_eq:NN \siunitx_textcolor:n \use:n
+ }
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_print_math:}
-%\begin{macro}{\siunitx_print_text:}
+%\begin{macro}{
+% \siunitx_print_math: ,
+% \siunitx_print_text: ,
+%}
% Printing the text means replacing any awkward characters, which is
% dependent on the output mode. The rest of the package uses "_" and
-% "^" to represent sub- and superscripts, respectively. In this way,
+% "^" to represent sub- and superscripts, respectively. In this way,
% mode decisions can be delayed as long as possible. The
% \pkg{underscore} package may make "_" active, or more likely
% it will be a superscript character. Both are tested for here.
@@ -5648,39 +5932,44 @@ This work consists of the file siunitx.dtx
\char_make_active:N \!
\tl_to_lowercase:n {
\group_end:
- \cs_set_protected_nopar:Npn \siunitx_print_math:
+ \cs_set_protected_nopar:Npn \siunitx_print_math:
{
- \ensuremath
+ \cs_set_eq:NN \PrintSubscript @
+ \cs_set_eq:NN \PrintSuperscript ^
+ \ensuremath
{
- \use:c
+ \use:c
{
- siunitx_ \l_siunitx_print_type_tl _
+ siunitx_ \l_siunitx_print_type_tl _
math \l_siunitx_font_family_tl :n
- }
+ }
{ \l_siunitx_print_arg_tl }
}
}
- \cs_set_protected_nopar:Npn \siunitx_print_text:
+ \cs_set_protected_nopar:Npn \siunitx_print_text:
{
- \tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { @ }
+ \cs_set_eq:NN \PrintSubscript \siunitx_print_text_sub:n
+ \cs_set_eq:NN \PrintSuperscript \siunitx_print_text_super:n
+ \tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { @ }
{ \siunitx_print_text_sub:n }
- \tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { ! }
+ \tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { ! }
{ \siunitx_print_text_sub:n }
- \tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { ^ }
+ \tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { ^ }
{ \siunitx_print_text_super:n }
\l_siunitx_print_arg_tl
}
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_print_text_sub:n}
+%\begin{macro}{
+% \siunitx_print_text_sub:n ,
+% \siunitx_print_text_super:n ,
+%}
%\begin{macro}[aux]{\siunitx_print_text_sub_super:n}
-%\begin{macro}{\siunitx_print_text_super:n}
% The appropriate macros for sub- and superscript in text mode ensure
% the appearance is the same as math mode. As "_" is a letter, there
-% is the need to do a category-code juggle. The search and replace
+% is the need to do a category-code juggle. The search and replace
% code for superscripts deals with the case where a literal number has
% been given with text mode printing.
% \begin{macrocode}
@@ -5689,13 +5978,13 @@ This work consists of the file siunitx.dtx
\char_make_math_subscript:N \@
\tl_to_lowercase:n {
\group_end:
- \cs_set_protected:Npn \siunitx_print_text_sub:n #1
- {
+ \cs_set_protected:Npn \siunitx_print_text_sub:n #1
+ {
\cs_set:Npn \siunitx_print_text_sub_super:n ##1
{
- \ensuremath
- {
- @ { \text {#1} }
+ \ensuremath
+ {
+ @ { \text {#1} }
^ { \text {##1} }
}
}
@@ -5707,7 +5996,7 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_print_text_sub_super:n { }
\cs_new_protected:Npn \siunitx_print_text_super:n #1 {
\tl_set:Nn \l_siunitx_tmpa_tl {#1}
- \tl_replace_all_in:Nnn \l_siunitx_tmpa_tl { - }
+ \tl_replace_all_in:Nnn \l_siunitx_tmpa_tl { - }
{ \c_siunitx_minus_tl }
\tl_set:Nx \l_siunitx_tmpa_tl
{
@@ -5721,14 +6010,23 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
+%
+%\begin{macro}{
+% \PrintSubscript ,
+% \PrintSuperscript ,
+%}
+% In the unit-construction code, there are places where it cannot
+% be guarenteed that the search-and-replace approach will work.
+% Instead, two user-space functions are needed. These are only
+% defined within the above code: the names are not needed elsewhere.
%\end{macro}
%
%\subsection{Pre-processing numbers}
%
-% Before the main parsing routine can be called, there is a need to
+% Before the main parsing routine can be called, there is a need to
% pre-process the input. The possibility that the data in can contain
% more than one number needs to be handled.
-%
+%
%\begin{macro}{\l_siunitx_input_product_tl}
%\begin{macro}{\l_siunitx_input_quotient_tl}
% There are a couple of settings which are created here as they are used
@@ -5746,9 +6044,11 @@ This work consists of the file siunitx.dtx
%\end{macro}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_number_arg_tl}
-%\begin{macro}{\l_siunitx_number_next_tl}
-% Storage for the pre-parsed material. The \texttt{arg} variable
+%\begin{macro}{
+% \l_siunitx_number_arg_tl ,
+% \l_siunitx_number_next_tl ,
+%}
+% Storage for the pre-parsed material. The \texttt{arg} variable
% contains the current argument, the \texttt{next} variable contains
% anything held-over for the next round.
% \begin{macrocode}
@@ -5756,7 +6056,6 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_number_next_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\l_siunitx_number_multi_tl}
% For products and quotients, a way of feeding information back.
@@ -5765,18 +6064,21 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_number_denominator_tl}
-%\begin{macro}{\l_siunitx_number_numerator_tl}
+%\begin{macro}{
+% \l_siunitx_number_denominator_tl ,
+% \l_siunitx_number_numerator_tl ,
+%}
% When searching for quotients, some more storage is needed.
% \begin{macrocode}
\tl_new:N \l_siunitx_number_denominator_tl
\tl_new:N \l_siunitx_number_numerator_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_number_preprocess:n}
-%\begin{macro}{\siunitx_number_preprocess:V}
+%\begin{macro}{
+% \siunitx_number_preprocess:n ,
+% \siunitx_number_preprocess:V ,
+%}
% The pre-processor starts with the obvious: the most likely outcome is
% that all of the argument is passed through unchanged.
% \begin{macrocode}
@@ -5784,13 +6086,12 @@ This work consists of the file siunitx.dtx
\siunitx_number_preprocess_init:
\tl_set:Nn \l_siunitx_number_arg_tl {#1}
\siunitx_number_preprocess_product:
- \tl_if_empty:NT \l_siunitx_number_multi_tl
+ \tl_if_empty:NT \l_siunitx_number_multi_tl
{ \siunitx_number_preprocess_quotient: }
}
\cs_generate_variant:Nn \siunitx_number_preprocess:n { V }
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_preprocess_init:}
% A little initialisation as normal.
@@ -5804,7 +6105,7 @@ This work consists of the file siunitx.dtx
%
%\begin{macro}{\siunitx_number_preprocess_product:}
%\begin{macro}[aux]{\siunitx_number_preprocess_product_aux:N}
-% Rather than search through the entire argument, we use the
+% Rather than search through the entire argument, we use the
% delimited-argument trick.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_preprocess_product: {
@@ -5812,19 +6113,19 @@ This work consists of the file siunitx.dtx
\siunitx_number_preprocess_product_aux:N
}
\cs_new_protected:Npn \siunitx_number_preprocess_product_aux:N #1 {
- \tl_if_in:NnT \l_siunitx_number_arg_tl {#1}
+ \tl_if_in:NnT \l_siunitx_number_arg_tl {#1}
{
- \cs_set:Npn \siunitx_tmp:w ##1 #1 ##2 \q_stop
+ \cs_set:Npn \siunitx_tmp:w ##1 #1 ##2 \q_stop
{
\tl_set:Nn \l_siunitx_number_arg_tl {##1}
\tl_set:Nn \l_siunitx_number_next_tl {##2}
- \tl_set:Nn \l_siunitx_number_multi_tl { product }
+ \tl_set:Nn \l_siunitx_number_multi_tl { product }
}
- \exp_last_unbraced:NV \siunitx_tmp:w \l_siunitx_number_arg_tl
+ \exp_last_unbraced:NV \siunitx_tmp:w \l_siunitx_number_arg_tl
\q_stop
\tl_if_empty:NT \l_siunitx_number_arg_tl
{ \siunitx_error:n { starting-product-token } }
- \tl_if_empty:NT \l_siunitx_number_next_tl
+ \tl_if_empty:NT \l_siunitx_number_next_tl
{ \siunitx_error:n { ending-product-token } }
\tl_map_break:
}
@@ -5843,17 +6144,17 @@ This work consists of the file siunitx.dtx
\siunitx_number_preprocess_quotient_aux:N
}
\cs_new_protected:Npn \siunitx_number_preprocess_quotient_aux:N #1 {
- \tl_if_in:NnT \l_siunitx_number_arg_tl {#1}
+ \tl_if_in:NnT \l_siunitx_number_arg_tl {#1}
{
- \cs_set:Npn \siunitx_tmp:w ##1 #1 ##2 \q_stop
+ \cs_set:Npn \siunitx_tmp:w ##1 #1 ##2 \q_stop
{
\tl_set:Nn \l_siunitx_number_numerator_tl {##1}
- \tl_set:Nn \l_siunitx_number_denominator_tl {##2}
- \tl_set:Nn \l_siunitx_number_multi_tl { quotient }
+ \tl_set:Nn \l_siunitx_number_denominator_tl {##2}
+ \tl_set:Nn \l_siunitx_number_multi_tl { quotient }
}
- \exp_last_unbraced:NV \siunitx_tmp:w \l_siunitx_number_arg_tl
+ \exp_last_unbraced:NV \siunitx_tmp:w \l_siunitx_number_arg_tl
\q_stop
- \tl_if_empty:NT \l_siunitx_number_numerator_tl
+ \tl_if_empty:NT \l_siunitx_number_numerator_tl
{ \siunitx_error:n { starting-quotient-token } }
\tl_if_empty:NT \l_siunitx_number_denominator_tl
{ \siunitx_error:n { ending-quotient-token } }
@@ -5873,7 +6174,7 @@ This work consists of the file siunitx.dtx
% that simple numbers (such as \num{-1.23}) are parsed particularly
% quickly. For most documents, this gain more than offsets any slight
% losses with more complicated numbers.
-%
+%
%\begin{macro}{\c_siunitx_number_part_complex_tl}
% A couple of the comparisons needed for checking complex numbers
% are done using stored text. To make them a little quicker, a
@@ -5884,14 +6185,16 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_number_in_complex_bool}
-%\begin{macro}{\l_siunitx_number_in_complex_root_bool}
-%\begin{macro}{\l_siunitx_number_in_decimal_bool}
-%\begin{macro}{\l_siunitx_number_in_exponent_bool}
-%\begin{macro}{\l_siunitx_number_in_first_bool}
-%\begin{macro}{\l_siunitx_number_in_sign_bool}
-%\begin{macro}{\l_siunitx_number_in_uncert_bool}
-%\begin{macro}{\l_siunitx_number_in_value_bool}
+%\begin{macro}{
+% \l_siunitx_number_in_complex_bool ,
+% \l_siunitx_number_in_complex_root_bool ,
+% \l_siunitx_number_in_decimal_bool ,
+% \l_siunitx_number_in_exponent_bool ,
+% \l_siunitx_number_in_first_bool ,
+% \l_siunitx_number_in_sign_bool ,
+% \l_siunitx_number_in_uncert_bool ,
+% \l_siunitx_number_in_value_bool ,
+%}
% \begin{macrocode}
\bool_new:N \l_siunitx_number_in_complex_bool
\bool_new:N \l_siunitx_number_in_complex_root_bool
@@ -5903,16 +6206,9 @@ This work consists of the file siunitx.dtx
\bool_new:N \l_siunitx_number_in_value_bool
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\l_siunitx_number_in_prop}
-% The parsed number is stored in a property list as its constituent
+% The parsed number is stored in a property list as its constituent
% parts.
% \begin{macrocode}
\prop_new:N \l_siunitx_number_in_prop
@@ -5926,12 +6222,14 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_number_part_tl}
-%\begin{macro}{\l_siunitx_number_part_decimal_tl}
-%\begin{macro}{\l_siunitx_number_part_decimal_marker_tl}
-%\begin{macro}{\l_siunitx_number_part_integer_tl}
-%\begin{macro}{\l_siunitx_number_part_sign_tl}
-%\begin{macro}{\l_siunitx_number_part_uncert_tl}
+%\begin{macro}{
+% \l_siunitx_number_part_tl ,
+% \l_siunitx_number_part_decimal_tl ,
+% \l_siunitx_number_part_decimal_marker_tl ,
+% \l_siunitx_number_part_integer_tl ,
+% \l_siunitx_number_part_sign_tl ,
+% \l_siunitx_number_part_uncert_tl ,
+%}
% The names of various parts of a number are set up as stored values.
% This lets some code be used for different parts of a number, while
% pre-storing everything brings a performance (and clarity) benefit.
@@ -5944,39 +6242,67 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_number_part_uncert_tl
% \end{macrocode}
%\end{macro}
+%
+%\begin{macro}{
+% \l_siunitx_number_mantissa_length_int
+% \l_siunitx_number_uncert_tl
+% \l_siunitx_number_uncert_length_int
+%}
+% Conversion of uncertainty forms requires some storage, mainly for
+% performance reasons.
+% \begin{macrocode}
+\int_new:N \l_siunitx_number_mantissa_length_int
+\tl_new:N \l_siunitx_number_uncert_tl
+\int_new:N \l_siunitx_number_uncert_length_int
+% \end{macrocode}
%\end{macro}
+%
+%\begin{macro}{\l_siunitx_input_uncert_sign_tl}
+% This one is stored by some low-level code, so is declared explicitly.
+% \begin{macrocode}
+\tl_new:N \l_siunitx_input_uncert_sign_tl
+% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_siunitx_input_uncert_close_tl}
-%\begin{macro}{\l_siunitx_input_complex_tl}
-%\begin{macro}{\l_siunitx_input_comparator_tl}
-%\begin{macro}{\l_siunitx_input_decimal_tl}
-%\begin{macro}{\l_siunitx_input_digit_tl}
-%\begin{macro}{\l_siunitx_input_exponent_tl}
-%\begin{macro}{\l_siunitx_input_ignore_tl}
-%\begin{macro}{\l_siunitx_input_uncert_open_tl}
-%\begin{macro}{\l_siunitx_input_protect_tl}
-%\begin{macro}{\l_siunitx_input_sign_tl}
-%\begin{macro}{\l_siunitx_input_symbol_tl}
+%
+%\begin{macro}{
+% \l_siunitx_input_uncert_close_tl ,
+% \l_siunitx_input_complex_tl ,
+% \l_siunitx_input_comparator_tl ,
+% \l_siunitx_input_decimal_tl ,
+% \l_siunitx_input_digit_tl ,
+% \l_siunitx_input_exponent_tl ,
+% \l_siunitx_input_ignore_tl ,
+% \l_siunitx_input_uncert_open_tl ,
+% \l_siunitx_input_protect_tl ,
+% \l_siunitx_input_sign_tl ,
+% \l_siunitx_input_symbol_tl ,
+% \l_siunitx_input_uncert_sign_tl ,
+%}
% The various tokens to check against when parsing are all set up here.
% These are valid inside a single number: the pre-processor has already
% set up the appropriate things for products and quotients.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- input-close-uncertainty .tl_set:N = \l_siunitx_input_uncert_close_tl,
- input-complex-roots .tl_set:N = \l_siunitx_input_complex_tl,
- input-comparators .tl_set:N = \l_siunitx_input_comparator_tl,
- input-decimal-markers .tl_set:N = \l_siunitx_input_decimal_tl,
- input-digits .tl_set:N = \l_siunitx_input_digit_tl,
- input-exponent-markers .tl_set:N = \l_siunitx_input_exponent_tl,
- input-ignore .tl_set:N = \l_siunitx_input_ignore_tl,
- input-open-uncertainty .tl_set:N = \l_siunitx_input_uncert_open_tl,
- input-protect-tokens .tl_set:N = \l_siunitx_input_protect_tl,
- input-signs .tl_set:N = \l_siunitx_input_sign_tl,
- input-symbols .tl_set:N = \l_siunitx_input_symbol_tl,
+ input-close-uncertainty .tl_set:N = \l_siunitx_input_uncert_close_tl ,
+ input-complex-roots .tl_set:N = \l_siunitx_input_complex_tl ,
+ input-comparators .tl_set:N = \l_siunitx_input_comparator_tl ,
+ input-decimal-markers .tl_set:N = \l_siunitx_input_decimal_tl ,
+ input-digits .tl_set:N = \l_siunitx_input_digit_tl ,
+ input-exponent-markers .tl_set:N = \l_siunitx_input_exponent_tl ,
+ input-ignore .tl_set:N = \l_siunitx_input_ignore_tl ,
+ input-open-uncertainty .tl_set:N = \l_siunitx_input_uncert_open_tl ,
+ input-protect-tokens .tl_set:N = \l_siunitx_input_protect_tl ,
+ input-signs .tl_set:N = \l_siunitx_input_sign_tl ,
+ input-symbols .tl_set:N = \l_siunitx_input_symbol_tl ,
+ input-uncertainty-signs .code:n =
+ {
+ \tl_set:Nn \l_siunitx_input_uncert_sign_tl {#1}
+ \tl_map_inline:nn {#1}
+ {
+ \tl_if_in:NnF \l_siunitx_input_sign_tl {##1}
+ { \tl_put_right:Nn \l_siunitx_input_sign_tl {##1} }
+ }
+ } ,
}
\keys_set:nn { siunitx } { % (
input-close-uncertainty = ),
@@ -5989,36 +6315,29 @@ This work consists of the file siunitx.dtx
input-protect-tokens = \approx\ge\geq\gg\le\leg\ll\mp\pi\pm\sim,
input-signs = +-\mp\pm,
input-symbols = \pi,
+ input-uncertainty-signs = \pm,
}
% \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}{\siunitx_number_in_parse:n}
-%\begin{macro}{\siunitx_number_in_parse:V}
+%\begin{macro}{
+% \siunitx_number_in_parse:n ,
+% \siunitx_number_in_parse:V ,
+%}
%\begin{macro}[aux]{\siunitx_number_in_parse_aux:n}
% The parsing routine starts by replacing any formatting in the input
% using \cs{tl_set_rescan:Nnx}. Next, there is a quick routine to
-% ensure that all signs are single tokens. The main loop then takes
+% ensure that all signs are single tokens. The main loop then takes
% place, which will parse the input into the property list and also
% set up the flags. There are then some checks and possible corrections.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_parse:n #1 {
- \tl_if_empty:nF {#1}
- {
+ \tl_if_empty:nF {#1}
+ {
\siunitx_number_in_init:
\cs_set_eq:NN \siunitx_number_in_parse_more:N
\siunitx_number_in_parse_mantissa_aux:N
- \siunitx_number_in_parse_aux:n {#1}
+ \siunitx_number_in_parse_aux:n {#1}
}
}
\cs_generate_variant:Nn \siunitx_number_in_parse:n { V }
@@ -6034,46 +6353,47 @@ This work consists of the file siunitx.dtx
{#1}
\siunitx_number_in_sign_replace:N \l_siunitx_number_arg_tl
\siunitx_number_in_parse_relation:N \l_siunitx_number_arg_tl
- \tl_map_function:NN \l_siunitx_number_arg_tl
+ \tl_map_function:NN \l_siunitx_number_arg_tl
\siunitx_number_in_parse_loop:N
\tl_if_empty:NF \l_siunitx_number_parsed_tl
{
\bool_if:NTF \l_siunitx_number_in_uncert_bool
{ \siunitx_error:nx { invalid-number } {#1} }
{
- \prop_put:NVn \l_siunitx_number_in_prop
+ \prop_put:NVn \l_siunitx_number_in_prop
\l_siunitx_number_part_tl { true }
- \bool_if:NTF \l_siunitx_number_in_decimal_bool
+ \bool_if:NTF \l_siunitx_number_in_decimal_bool
{
- \prop_put:NVV \l_siunitx_number_in_prop
- \l_siunitx_number_part_decimal_tl
+ \prop_put:NVV \l_siunitx_number_in_prop
+ \l_siunitx_number_part_decimal_tl
\l_siunitx_number_parsed_tl
}
{
- \prop_put:NVV \l_siunitx_number_in_prop
- \l_siunitx_number_part_integer_tl
+ \prop_put:NVV \l_siunitx_number_in_prop
+ \l_siunitx_number_part_integer_tl
\l_siunitx_number_parsed_tl
}
- }
+ }
}
\siunitx_number_in_check:n {#1}
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_number_in_init:}
-%\begin{macro}{\siunitx_number_in_init_part:n}
+%\begin{macro}{
+% \siunitx_number_in_init: ,
+% \siunitx_number_in_init_part:n ,
+%}
% The set up code is divided into to parts. First, code only needed
-% once to start the entire parser. Then a second group, which is
+% once to start the entire parser. Then a second group, which is
% carried out at the start of each part of a number, and so is called
% from a few places.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_in_init: {
- \cs_set_eq:NN \siunitx_number_in_parse_loop:N
- \siunitx_number_in_parse_mantissa:N
- \cs_set_eq:NN \siunitx_number_in_check:n
+ \cs_set_eq:NN \siunitx_number_in_parse_loop:N
+ \siunitx_number_in_parse_mantissa:N
+ \cs_set_eq:NN \siunitx_number_in_check:n
\siunitx_number_in_check_short:n
\tl_clear:N \l_siunitx_number_parsed_tl
\prop_clear:N \l_siunitx_number_in_prop
@@ -6084,14 +6404,14 @@ This work consists of the file siunitx.dtx
\bool_set_false:N \l_siunitx_number_in_uncert_bool
\siunitx_number_in_init_part:n { mantissa }
}
-\cs_new_protected_nopar:Npn \siunitx_number_in_init_part:n #1 {
+\cs_new_protected_nopar:Npn \siunitx_number_in_init_part:n #1 {
\bool_set_false:N \l_siunitx_number_in_decimal_bool
\bool_set_true:N \l_siunitx_number_in_first_bool
\bool_set_false:N \l_siunitx_number_in_sign_bool
\bool_set_false:N \l_siunitx_number_in_value_bool
\tl_set:Nn \l_siunitx_number_part_tl {#1}
\tl_set:Nn \l_siunitx_number_part_decimal_tl { #1 -decimal }
- \tl_set:Nn \l_siunitx_number_part_decimal_marker_tl
+ \tl_set:Nn \l_siunitx_number_part_decimal_marker_tl
{ #1 -decimal-marker }
\tl_set:Nn \l_siunitx_number_part_integer_tl { #1 -integer }
\tl_set:Nn \l_siunitx_number_part_sign_tl { #1 -sign }
@@ -6099,11 +6419,10 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_in_protect:}
%\begin{macro}[aux]{\siunitx_number_in_protect_aux:N}
-% Under some circumstances (for example when loading \pkg{breqn})
+% Under some circumstances (for example when loading \pkg{breqn})
% some tokens do not behave safely under \texttt{x} expansion (at the
% moment). To get round this, they are redefined here.
% \begin{macrocode}
@@ -6132,32 +6451,34 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_number_in_parse_error:nx}
-%\begin{macro}{\siunitx_number_in_parse_error:nV}
+%\begin{macro}{
+% \siunitx_number_in_parse_error:nn ,
+% \siunitx_number_in_parse_error:nV ,
+%}
% There are lots of rather similar errors in the parser, all of which
-% require a \cs{tl_map_break:}. To keep life simple, this is set up
-% here.
+% require a \cs{tl_map_break:}. To keep life simple, this is set up
+% here.
% \begin{macrocode}
-\cs_new_protected:Npn \siunitx_number_in_parse_error:nx #1#2 {
+\cs_new_protected:Npn \siunitx_number_in_parse_error:nn #1#2 {
\siunitx_error:nx {#1} { \exp_not:n {#2} }
\tl_map_break:
}
-\cs_generate_variant:Nn \siunitx_number_in_parse_error:nx { nV }
+\cs_generate_variant:Nn \siunitx_number_in_parse_error:nn { nV }
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_number_in_parse_loop:N}
-%\begin{macro}{\siunitx_number_in_parse_more:N}
+%\begin{macro}{
+% \siunitx_number_in_parse_loop:N ,
+% \siunitx_number_in_parse_more:N ,
+%}
% The main loop is set up as a place holder, as the definition is
-% varied to keep things fast. There is also a place holder for the
+% varied to keep things fast. There is also a place holder for the
% extended routing for normal mantissas.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_parse_loop:N #1 { }
\cs_new_protected:Npn \siunitx_number_in_parse_more:N #1 { }
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_in_parse_relation:N}
%\begin{macro}[aux]{\siunitx_number_in_parse_relation:w}
@@ -6169,7 +6490,7 @@ This work consists of the file siunitx.dtx
\exp_last_unbraced:NV \siunitx_number_in_parse_relation:w
#1 \q_stop #1
}
-\cs_new_protected:Npn \siunitx_number_in_parse_relation:w
+\cs_new_protected:Npn \siunitx_number_in_parse_relation:w
#1#2 \q_stop #3 {
\tl_if_in:NnT \l_siunitx_input_comparator_tl {#1}
{
@@ -6182,36 +6503,36 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_in_parse_restricted:N}
-% When parsing numbers for the \cs{ang} function, no extended input
+% When parsing numbers for the \cs{ang} function, no extended input
% is permitted at all.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_parse_restricted:N #1 {
\tl_if_in:NnTF \l_siunitx_input_exponent_tl {#1}
- {
- \siunitx_number_in_parse_error:nx
- { restricted-number } {#1}
+ {
+ \siunitx_number_in_parse_error:nn
+ { restricted-number } {#1}
}
- {
+ {
\tl_if_in:NnTF \l_siunitx_input_uncert_open_tl {#1}
- {
- \siunitx_number_in_parse_error:nV
- { restricted-number } \l_siunitx_number_arg_tl
+ {
+ \siunitx_number_in_parse_error:nV
+ { restricted-number } \l_siunitx_number_arg_tl
}
{
\tl_if_in:NnTF \l_siunitx_input_uncert_close_tl {#1}
- {
- \siunitx_number_in_parse_error:nV
+ {
+ \siunitx_number_in_parse_error:nV
{ restricted-number } \l_siunitx_number_arg_tl
}
{
\tl_if_in:NnTF \l_siunitx_input_complex_tl {#1}
{
- \siunitx_number_in_parse_error:nV
+ \siunitx_number_in_parse_error:nV
{ restricted-number } \l_siunitx_number_arg_tl
}
{
- \siunitx_number_in_parse_error:nx
- { restricted-number } {#1}
+ \siunitx_number_in_parse_error:nn
+ { restricted-number } {#1}
}
}
}
@@ -6227,16 +6548,16 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_parse_complex:N #1 {
\tl_if_in:NnTF \l_siunitx_input_exponent_tl {#1}
- {
+ {
\cs_set_eq:NN \siunitx_number_in_parse_loop:N
\siunitx_number_in_parse_mantissa:N
- \siunitx_number_in_exponent:N #1
+ \siunitx_number_in_exponent:N #1
}
- {
+ {
\tl_if_in:NnF \l_siunitx_input_ignore_tl {#1}
{
- \siunitx_number_in_parse_error:nV
- { misplaced-complex-root-token }
+ \siunitx_number_in_parse_error:nV
+ { misplaced-complex-root-token }
\l_siunitx_number_arg_tl
}
}
@@ -6251,32 +6572,32 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_parse_exponent:N #1 {
\tl_if_in:NnTF \l_siunitx_input_exponent_tl {#1}
- {
- \siunitx_number_in_parse_error:nx
- { duplicate-exponent-token } { \token_to_str:N #1 }
+ {
+ \siunitx_number_in_parse_error:nn
+ { duplicate-exponent-token } { \token_to_str:N #1 }
}
- {
+ {
\tl_if_in:NnTF \l_siunitx_input_uncert_open_tl {#1}
- {
- \siunitx_number_in_parse_error:nV
- { invalid-token-in-exponent } \l_siunitx_number_arg_tl
+ {
+ \siunitx_number_in_parse_error:nV
+ { invalid-token-in-exponent } \l_siunitx_number_arg_tl
}
{
\tl_if_in:NnTF \l_siunitx_input_uncert_close_tl {#1}
- {
- \siunitx_number_in_parse_error:nV
+ {
+ \siunitx_number_in_parse_error:nV
{ invalid-token-in-exponent } \l_siunitx_number_arg_tl
}
{
\tl_if_in:NnTF \l_siunitx_input_complex_tl {#1}
{
- \siunitx_number_in_parse_error:nV
- { invalid-token-in-exponent }
+ \siunitx_number_in_parse_error:nV
+ { invalid-token-in-exponent }
\l_siunitx_number_arg_tl
}
{
- \siunitx_number_in_parse_error:nx
- { invalid-token-in-number } {#1}
+ \siunitx_number_in_parse_error:nn
+ { invalid-token-in-number } {#1}
}
}
}
@@ -6286,7 +6607,7 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_in_parse_mantissa:N}
-%\begin{macro}{\siunitx_number_in_parse_mantissa_aux:N}
+%\begin{macro}[aux]{\siunitx_number_in_parse_mantissa_aux:N}
% For the mantissa, most things are valid. The procedure is split
% into two parts, with the simple symbols handled here and the more
% complex ones in a second part(which needs to be varied). Essentially
@@ -6304,15 +6625,15 @@ This work consists of the file siunitx.dtx
{ \siunitx_number_in_sign:N #1 }
{
\tl_if_in:NnTF \l_siunitx_input_symbol_tl {#1}
- {
- \prop_put:Nnn \l_siunitx_number_in_prop { symbolic }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { symbolic }
{ true }
\siunitx_number_in_digit:n { \ensuremath {#1} }
}
- {
+ {
\tl_if_in:NnF \l_siunitx_input_ignore_tl {#1}
{ \siunitx_number_in_parse_more:N #1 }
- }
+ }
}
}
}
@@ -6320,22 +6641,22 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_number_in_parse_mantissa_aux:N #1 {
\tl_if_in:NnTF \l_siunitx_input_exponent_tl {#1}
{ \siunitx_number_in_exponent:N #1 }
- {
+ {
\tl_if_in:NnTF \l_siunitx_input_uncert_open_tl {#1}
{ \siunitx_number_in_uncert_open:N #1 }
{
\tl_if_in:NnTF \l_siunitx_input_uncert_close_tl {#1}
- {
- \siunitx_number_in_parse_error:nx
- { misplaced-uncertainty-token } {#1}
+ {
+ \siunitx_number_in_parse_error:nn
+ { misplaced-uncertainty-token } {#1}
}
{
\tl_if_in:NnTF \l_siunitx_input_complex_tl {#1}
{ \siunitx_number_in_complex:N #1 }
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ invalid-token-in-number } {#1}
- }
+ }
}
}
}
@@ -6353,38 +6674,38 @@ This work consists of the file siunitx.dtx
{ \siunitx_number_in_digit:n {#1} }
{
\tl_if_in:NnTF \l_siunitx_input_decimal_tl {#1}
- {
- \siunitx_number_in_parse_error:nV
- { invalid-token-in-uncertainty }
+ {
+ \siunitx_number_in_parse_error:nV
+ { invalid-token-in-uncertainty }
\l_siunitx_number_arg_tl
- }
+ }
{
\tl_if_in:NnTF \l_siunitx_input_sign_tl {#1}
{
- \siunitx_number_in_parse_error:nV
- { invalid-token-in-uncertainty }
+ \siunitx_number_in_parse_error:nV
+ { invalid-token-in-uncertainty }
\l_siunitx_number_arg_tl
}
{
\tl_if_in:NnTF \l_siunitx_input_symbol_tl {#1}
- {
+ {
\prop_put:Nnn \l_siunitx_number_in_prop { symbolic }
{ true }
\siunitx_number_in_digit:n {#1}
}
- {
+ {
\tl_if_in:NnF \l_siunitx_input_ignore_tl {#1}
- {
- \tl_if_in:NnTF \l_siunitx_input_uncert_close_tl
+ {
+ \tl_if_in:NnTF \l_siunitx_input_uncert_close_tl
{#1}
{ \siunitx_number_in_uncert_close:N #1 }
{
- \siunitx_number_in_parse_error:nV
- { invalid-token-in-uncertainty }
+ \siunitx_number_in_parse_error:nV
+ { invalid-token-in-uncertainty }
\l_siunitx_number_arg_tl
}
}
- }
+ }
}
}
}
@@ -6398,32 +6719,32 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_parse_uncert_after:N #1 {
\tl_if_in:NnTF \l_siunitx_input_exponent_tl {#1}
- {
+ {
\cs_set_eq:NN \siunitx_number_in_parse_loop:N
\siunitx_number_in_parse_mantissa:N
- \siunitx_number_in_exponent:N #1
+ \siunitx_number_in_exponent:N #1
}
{
\tl_if_in:NnTF \l_siunitx_input_sign_tl {#1}
- {
+ {
\cs_set_eq:NN \siunitx_number_in_parse_loop:N
\siunitx_number_in_parse_mantissa:N
\siunitx_number_in_sign:N #1
}
{
\tl_if_in:NnF \l_siunitx_input_ignore_tl {#1}
- {
+ {
\tl_if_in:NnTF \l_siunitx_input_complex_tl {#1}
{
\cs_set_eq:NN \siunitx_number_in_parse_loop:N
\siunitx_number_in_parse_mantissa:N
\siunitx_number_in_complex:N #1
}
- {
+ {
\siunitx_number_in_parse_error:nV { invalid-number }
- \l_siunitx_number_arg_tl
+ \l_siunitx_number_arg_tl
}
- }
+ }
}
}
}
@@ -6436,62 +6757,62 @@ This work consists of the file siunitx.dtx
% More tests are needed for complex numbers than other systems, so
% the additional ones are turned on, followed by some flag setting.
% The complex root is stored, then there is a check to see if the
-% root is at the end of the number: if it is, prevent any more tokens
+% root is at the end of the number: if it is, prevent any more tokens
% being added.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_complex:N #1 {
\bool_set_false:N \l_siunitx_number_in_first_bool
\bool_if:NTF \l_siunitx_number_in_complex_root_bool
- {
- \siunitx_number_in_parse_error:nx
- { duplicate-complex-root-token } { \token_to_str:N #1 }
+ {
+ \siunitx_number_in_parse_error:nn
+ { duplicate-complex-root-token } { \token_to_str:N #1 }
}
{
- \cs_set_eq:NN \siunitx_number_in_check:n
- \siunitx_number_in_check_full:n
+ \cs_set_eq:NN \siunitx_number_in_check:n
+ \siunitx_number_in_check_full:n
\bool_set_true:N \l_siunitx_number_in_complex_root_bool
\prop_put:Nnn \l_siunitx_number_in_prop { complex-root } {#1}
\tl_if_empty:NF \l_siunitx_number_parsed_tl
- {
- \cs_set_eq:NN \siunitx_number_in_parse_loop:N
- \siunitx_number_in_parse_complex:N
- }
+ {
+ \cs_set_eq:NN \siunitx_number_in_parse_loop:N
+ \siunitx_number_in_parse_complex:N
+ }
\bool_if:NT \l_siunitx_number_in_decimal_bool
- {
+ {
\bool_if:NF \l_siunitx_number_in_complex_bool
{
- \prop_if_in:NnT \l_siunitx_number_in_prop
+ \prop_if_in:NnT \l_siunitx_number_in_prop
{ mantissa-uncertainty }
{
- \siunitx_number_in_complex_aux:nn
+ \siunitx_number_in_complex_aux:nn
{ mantissa-decimal } { complex-decimal }
- \siunitx_number_in_complex_aux:nn
+ \siunitx_number_in_complex_aux:nn
{ mantissa-uncertainty } { complex-uncertainty }
}
\siunitx_number_in_complex_aux:nn { mantissa-integer }
{ complex-integer }
- \siunitx_number_in_complex_aux:nn
+ \siunitx_number_in_complex_aux:nn
{ mantissa-decimal-marker } { complex-decimal-marker }
\prop_del:Nn \l_siunitx_number_in_prop { mantissa }
\prop_put:Nnn \l_siunitx_number_in_prop { complex }
{ true }
}
- }
+ }
\prop_if_in:NnF \l_siunitx_number_in_prop { mantissa }
{
\prop_if_in:NnT \l_siunitx_number_in_prop { mantissa-sign }
- {
+ {
\siunitx_number_in_complex_aux:nn { mantissa-sign }
{ complex-sign }
}
- }
- \bool_set_true:N \l_siunitx_number_in_complex_bool
- \bool_set_false:N \l_siunitx_number_in_first_bool
- \siunitx_number_in_init_part:n { complex }
- \prop_if_in:NnT \l_siunitx_number_in_prop
+ }
+ \bool_set_true:N \l_siunitx_number_in_complex_bool
+ \bool_set_false:N \l_siunitx_number_in_first_bool
+ \siunitx_number_in_init_part:n { complex }
+ \prop_if_in:NnT \l_siunitx_number_in_prop
{ complex-decimal-marker }
{ \bool_set_true:N \l_siunitx_number_in_decimal_bool }
- \prop_if_in:NnT \l_siunitx_number_in_prop
+ \prop_if_in:NnT \l_siunitx_number_in_prop
{ complex-sign }
{ \bool_set_true:N \l_siunitx_number_in_sign_bool }
}
@@ -6500,7 +6821,7 @@ This work consists of the file siunitx.dtx
\prop_get:NnN \l_siunitx_number_in_prop {#1} \l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \prop_del:Nn \l_siunitx_number_in_prop {#1}
+ \prop_del:Nn \l_siunitx_number_in_prop {#1}
\prop_put:NnV \l_siunitx_number_in_prop {#2} \l_siunitx_tmpa_tl
}
}
@@ -6516,23 +6837,23 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_decimal:N #1 {
\bool_set_false:N \l_siunitx_number_in_first_bool
- \bool_if:NTF \l_siunitx_number_in_decimal_bool
- {
- \siunitx_number_in_parse_error:nx { duplicate-decimal-token }
- { \token_to_str:N #1 }
+ \bool_if:NTF \l_siunitx_number_in_decimal_bool
+ {
+ \siunitx_number_in_parse_error:nn { duplicate-decimal-token }
+ {#1}
}
{
\bool_set_true:N \l_siunitx_number_in_decimal_bool
\tl_if_empty:NF \l_siunitx_number_parsed_tl
{
- \prop_put:NVn \l_siunitx_number_in_prop
+ \prop_put:NVn \l_siunitx_number_in_prop
\l_siunitx_number_part_tl { true }
- \prop_put:NVV \l_siunitx_number_in_prop
- \l_siunitx_number_part_integer_tl
+ \prop_put:NVV \l_siunitx_number_in_prop
+ \l_siunitx_number_part_integer_tl
\l_siunitx_number_parsed_tl
- \tl_clear:N \l_siunitx_number_parsed_tl
+ \tl_clear:N \l_siunitx_number_parsed_tl
}
- \prop_put:NVn \l_siunitx_number_in_prop
+ \prop_put:NVn \l_siunitx_number_in_prop
\l_siunitx_number_part_decimal_marker_tl {#1}
}
}
@@ -6553,45 +6874,45 @@ This work consists of the file siunitx.dtx
\bool_if:NTF \l_siunitx_number_in_decimal_bool
{
\tl_put_right:Nn \l_siunitx_number_parsed_tl {#1}
- \str_if_eq:nnF {#1} { 0 }
+ \str_if_eq:nnF {#1} { 0 }
{ \bool_set_true:N \l_siunitx_number_in_value_bool }
}
{
- \str_if_eq:nnTF {#1} { 0 }
- {
- \prop_put:NVn \l_siunitx_number_in_prop
+ \str_if_eq:nnTF {#1} { 0 }
+ {
+ \prop_put:NVn \l_siunitx_number_in_prop
\l_siunitx_number_part_tl { true }
- \prop_put:NVn \l_siunitx_number_in_prop
+ \prop_put:NVn \l_siunitx_number_in_prop
\l_siunitx_number_part_integer_tl { 0 }
}
{ \bool_set_true:N \l_siunitx_number_in_value_bool }
- \bool_if:NT \l_siunitx_number_in_value_bool
+ \bool_if:NT \l_siunitx_number_in_value_bool
{ \tl_put_right:Nn \l_siunitx_number_parsed_tl {#1} }
- }
+ }
}
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\siunitx_number_in_exponent:N}
-% A duplicate token test starts off the code, which if passed
-% leads to some simple storage manipulation. As exponents are
+% A duplicate token test starts off the code, which if passed
+% leads to some simple storage manipulation. As exponents are
% more simple than the mantissa, the extra processing is swapped for
% some that only raises errors.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_exponent:N #1 {
\bool_if:NTF \l_siunitx_number_in_exponent_bool
- {
- \siunitx_number_in_parse_error:nx { duplicate-exponent-token }
+ {
+ \siunitx_number_in_parse_error:nn { duplicate-exponent-token }
{ \token_to_str:N #1 }
}
{
\cs_set_eq:NN \siunitx_number_in_parse_more:N
\siunitx_number_in_parse_exponent:N
- \tl_if_empty:NF \l_siunitx_number_parsed_tl
+ \tl_if_empty:NF \l_siunitx_number_parsed_tl
{ \siunitx_number_in_store: }
\bool_set_true:N \l_siunitx_number_in_exponent_bool
- \siunitx_number_in_init_part:n { exponent }
+ \siunitx_number_in_init_part:n { exponent }
}
}
% \end{macrocode}
@@ -6608,29 +6929,29 @@ This work consists of the file siunitx.dtx
{
\bool_set_false:N \l_siunitx_number_in_first_bool
\bool_set_true:N \l_siunitx_number_in_sign_bool
- \prop_put:NVn \l_siunitx_number_in_prop
+ \prop_put:NVn \l_siunitx_number_in_prop
\l_siunitx_number_part_sign_tl {#1}
}
- {
+ {
\bool_if:NTF \l_siunitx_number_in_exponent_bool
- {
- \siunitx_number_in_parse_error:nx { misplaced-sign-token }
+ {
+ \siunitx_number_in_parse_error:nn { misplaced-sign-token }
{#1}
}
{
\bool_if:NTF \l_siunitx_number_in_complex_bool
- {
- \siunitx_number_in_parse_error:nx
- { misplaced-sign-token } {#1}
+ {
+ \siunitx_number_in_parse_error:nn
+ { misplaced-sign-token } {#1}
}
- {
- \tl_if_empty:NF \l_siunitx_number_parsed_tl
+ {
+ \tl_if_empty:NF \l_siunitx_number_parsed_tl
{ \siunitx_number_in_store: }
- \cs_set_eq:NN \siunitx_number_in_check:n
- \siunitx_number_in_check_full:n
+ \cs_set_eq:NN \siunitx_number_in_check:n
+ \siunitx_number_in_check_full:n
\siunitx_number_in_init_part:n { complex }
- \prop_put:Nnn \l_siunitx_number_in_prop
- { complex-sign } {#1}
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { complex-sign } {#1}
\bool_set_true:N \l_siunitx_number_in_complex_bool
}
}
@@ -6639,8 +6960,10 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_number_in_uncert_open:N}
-%\begin{macro}{\siunitx_number_in_uncert_close:N}
+%\begin{macro}{
+% \siunitx_number_in_uncert_open:N ,
+% \siunitx_number_in_uncert_close:N ,
+%}
% Opening and closing uncertainty tokens are handled separately. For
% opening tokens, a check is made that there is something else to the
% number before collecting material up. For the closing token, the
@@ -6649,65 +6972,66 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_in_uncert_open:N #1 {
\bool_set_false:N \l_siunitx_number_in_first_bool
- \cs_set_eq:NN \siunitx_number_in_parse_loop:N
+ \cs_set_eq:NN \siunitx_number_in_parse_loop:N
\siunitx_number_in_parse_uncert:N
\bool_set_true:N \l_siunitx_number_in_uncert_bool
\tl_if_empty:NTF \l_siunitx_number_parsed_tl
{
- \prop_if_in:NVF \l_siunitx_number_in_prop
+ \prop_if_in:NVF \l_siunitx_number_in_prop
\l_siunitx_number_part_integer_tl
- {
- \siunitx_number_in_parse_error:nV { invalid-number }
- \l_siunitx_number_arg_tl
+ {
+ \siunitx_number_in_parse_error:nV { invalid-number }
+ \l_siunitx_number_arg_tl
}
}
{ \siunitx_number_in_store: }
}
-\cs_new_protected:Npn \siunitx_number_in_uncert_close:N #1 {
+\cs_new_protected:Npn \siunitx_number_in_uncert_close:N #1 {
\bool_set_false:N \l_siunitx_number_in_uncert_bool
\tl_if_empty:NTF \l_siunitx_number_parsed_tl
- {
- \siunitx_number_in_parse_error:nV { empty-uncertainty }
+ {
+ \siunitx_number_in_parse_error:nV { empty-uncertainty }
\l_siunitx_number_arg_tl
}
{
- \prop_put:NVV \l_siunitx_number_in_prop
+ \prop_put:NVV \l_siunitx_number_in_prop
\l_siunitx_number_part_uncert_tl \l_siunitx_number_parsed_tl
- \prop_put:Nnn \l_siunitx_number_in_prop
+ \prop_put:Nnn \l_siunitx_number_in_prop
{ uncertainty } { true }
\tl_clear:N \l_siunitx_number_parsed_tl
- \cs_set_eq:NN \siunitx_number_in_parse_loop:N
- \siunitx_number_in_parse_uncert_after:N
- }
+ \cs_set_eq:NN \siunitx_number_in_parse_loop:N
+ \siunitx_number_in_parse_uncert_after:N
+ }
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_in_store:}
% A short auxiliary function needed in various places for storing
% either the integer or decimal part of a number, as appropriate.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_in_store: {
- \prop_put:NVn \l_siunitx_number_in_prop \l_siunitx_number_part_tl
+ \prop_put:NVn \l_siunitx_number_in_prop \l_siunitx_number_part_tl
{ true }
\bool_if:NTF \l_siunitx_number_in_decimal_bool
{
- \prop_put:NVV \l_siunitx_number_in_prop
+ \prop_put:NVV \l_siunitx_number_in_prop
\l_siunitx_number_part_decimal_tl \l_siunitx_number_parsed_tl
}
{
- \prop_put:NVV \l_siunitx_number_in_prop
+ \prop_put:NVV \l_siunitx_number_in_prop
\l_siunitx_number_part_integer_tl \l_siunitx_number_parsed_tl
- }
- \tl_clear:N \l_siunitx_number_parsed_tl
+ }
+ \tl_clear:N \l_siunitx_number_parsed_tl
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_number_in_check:n}
-%\begin{macro}{\siunitx_number_in_check_short:n}
-%\begin{macro}{\siunitx_number_in_check_full:n}
+%\begin{macro}{
+% \siunitx_number_in_check:n ,
+% \siunitx_number_in_check_short:n ,
+% \siunitx_number_in_check_full:n ,
+%}
% The checks needed for a number depend on whether there is a complex
% part. In all cases, there must be some digits, as well as a sign or
% decimal marker. There is also a check for a zero-valued input, which
@@ -6715,19 +7039,19 @@ This work consists of the file siunitx.dtx
% case there was no real part.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_in_check:n #1 { }
-\cs_new_protected_nopar:Npn \siunitx_number_in_check_short:n #1 {
- \prop_if_in:NVF \l_siunitx_number_in_prop
+\cs_new_protected_nopar:Npn \siunitx_number_in_check_short:n #1 {
+ \prop_if_in:NVF \l_siunitx_number_in_prop
\l_siunitx_number_part_integer_tl
{
- \prop_if_in:NVF \l_siunitx_number_in_prop
+ \prop_if_in:NVF \l_siunitx_number_in_prop
\l_siunitx_number_part_decimal_tl
{ \siunitx_error:nx { invalid-number } {#1} }
}
- \bool_if:NF \l_siunitx_number_in_value_bool
- {
- \tl_if_eq:NNF \l_siunitx_number_part_tl
+ \bool_if:NF \l_siunitx_number_in_value_bool
+ {
+ \tl_if_eq:NNF \l_siunitx_number_part_tl
\c_siunitx_number_part_complex_tl
- {
+ {
\prop_get:NVN \l_siunitx_number_in_prop
\l_siunitx_number_part_sign_tl \l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
@@ -6736,55 +7060,221 @@ This work consists of the file siunitx.dtx
{ \l_siunitx_number_part_sign_tl -deleted }
\prop_put:NVV \l_siunitx_number_in_prop
\l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
- }
- \prop_del:NV \l_siunitx_number_in_prop
- \l_siunitx_number_part_sign_tl
+ }
+ \prop_del:NV \l_siunitx_number_in_prop
+ \l_siunitx_number_part_sign_tl
}
}
}
\cs_new_protected_nopar:Npn \siunitx_number_in_check_full:n #1 {
- \tl_if_eq:NNF \l_siunitx_number_part_tl
- \c_siunitx_number_part_complex_tl
+ \tl_if_eq:NNF \l_siunitx_number_part_tl
+ \c_siunitx_number_part_complex_tl
{ \siunitx_number_in_check_short:n {#1} }
\bool_if:NF \l_siunitx_number_in_complex_root_bool
- {
- \prop_get:NnN \l_siunitx_number_in_prop { complex-sign }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-sign }
\l_siunitx_tmpa_tl
- \siunitx_error:nx { misplaced-sign-token }
- { \exp_not:V \l_siunitx_tmpa_tl }
+ \tl_if_in:NVTF \l_siunitx_input_uncert_sign_tl \l_siunitx_tmpa_tl
+ {
+ \prop_if_in:NnTF \l_siunitx_number_in_prop { uncertainty }
+ {
+ \siunitx_error:nx { misplaced-sign-token }
+ { \exp_not:n {#1} }
+ }
+ { \siunitx_number_in_complex_to_uncert:n {#1} }
+ }
+ {
+ \siunitx_error:nx { misplaced-sign-token }
+ { \exp_not:n {#1} }
+ }
}
- \prop_get:NnN \l_siunitx_number_in_prop { mantissa-sign }
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-sign }
\l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
{
\prop_if_in:NnF \l_siunitx_number_in_prop { mantissa }
{
\prop_del:Nn \l_siunitx_number_in_prop { mantissa-sign }
- \prop_put:NnV \l_siunitx_number_in_prop { complex-sign }
+ \prop_put:NnV \l_siunitx_number_in_prop { complex-sign }
\l_siunitx_tmpa_tl
}
}
}
% \end{macrocode}
%\end{macro}
+%
+%
+%\begin{macro}{\siunitx_number_in_complex_to_uncert:n}
+%\begin{macro}[aux]{
+% \siunitx_number_in_complex_to_uncert_int: ,
+% \siunitx_number_in_complex_to_uncert_dec: ,
+%}
+% Internally, uncertainties are stored in \enquote{compact} form.
+% The code here takes a putative complex part and converts it to
+% a compact uncertainty, with checks for the cases where things look
+% wrong. The method needed depends on whether there is an integer
+% part.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert:n #1 {
+ \prop_del:Nn \l_siunitx_number_in_prop { complex }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-decimal-marker }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-sign }
+ \prop_put:Nnn \l_siunitx_number_in_prop { uncertainty } { true }
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-integer }
+ \l_siunitx_number_uncert_tl
+ \quark_if_no_value:NTF \l_siunitx_number_uncert_tl
+ { \siunitx_number_in_complex_to_uncert_dec:n {#1} }
+ {
+ \tl_if_single:NTF \l_siunitx_number_uncert_tl
+ {
+ \int_compare:nNnTF
+ { \l_siunitx_number_uncert_tl } = { \c_zero }
+ { \siunitx_number_in_complex_to_uncert_dec:n {#1} }
+ { \siunitx_number_in_complex_to_uncert_int: }
+ }
+ { \siunitx_number_in_complex_to_uncert_int: }
+ }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-integer }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-decimal }
+}
+% \end{macrocode}
+% When the input has an integer part to the uncertainty, the
+% conversion is easy as all of the decimal part can be copied
+% across.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_int: {
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-decimal }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NT \l_siunitx_tmpa_tl
+ { \tl_clear:N \l_siunitx_tmpa_tl }
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \quark_if_no_value:NT \l_siunitx_tmpb_tl
+ { \tl_clear:N \l_siunitx_tmpb_tl }
+ \siunitx_number_in_complex_to_uncert_pad:
+}
+% \end{macrocode}
+% For a number in which all of the uncertainty is in the decimal part,
+% only the significant digits are needed. This means that a loop is
+% needed to drop non-significant ones.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_dec:n
+ #1
+ {
+ \tl_clear:N \l_siunitx_number_uncert_tl
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-decimal }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NTF \l_siunitx_tmpa_tl
+ {
+ \siunitx_error:nx { misplaced-sign-token }
+ { \exp_not:n {#1} }
+ }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \quark_if_no_value:NT \l_siunitx_tmpb_tl
+ { \tl_clear:N \l_siunitx_tmpb_tl }
+ \tl_map_function:NN
+ \l_siunitx_tmpa_tl
+ \siunitx_number_in_complex_to_uncert_dec_loop:N
+ \siunitx_number_in_complex_to_uncert_pad:
+ }
+ }
+\cs_new_protected_nopar:Npn
+ \siunitx_number_in_complex_to_uncert_dec_loop:N #1
+ {
+ \str_if_eq:nnTF {#1} { 0 }
+ {
+ \tl_set:Nf \l_siunitx_tmpa_tl
+ { \tl_tail:V \l_siunitx_tmpa_tl }
+ \tl_if_empty:NF \l_siunitx_tmpb_tl
+ {
+ \tl_set:Nf \l_siunitx_tmpb_tl
+ { \tl_tail:V \l_siunitx_tmpb_tl }
+ }
+ }
+ { \tl_map_break: }
+ }
+% \end{macrocode}
+% In all cases, there is a need to pad out either the uncertainty or
+% the decimal part so the places agree. To allow the two branches to
+% share code, some of the order here is slightly odd. The code
+% also re-obtains the decimal part from the mantissa, as the stored
+% value may have been trimmed to drop non-significant zeros.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_pad:
+ {
+ \int_set:Nn \l_siunitx_number_uncert_length_int
+ { \tl_elt_count:N \l_siunitx_tmpa_tl }
+ \int_set:Nn \l_siunitx_number_mantissa_length_int
+ { \tl_elt_count:N \l_siunitx_tmpb_tl }
+ \int_compare:nNnTF
+ { \l_siunitx_number_mantissa_length_int }
+ > { \l_siunitx_number_uncert_length_int }
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ {
+ \exp_not:V \l_siunitx_tmpa_tl
+ \prg_replicate:nn
+ {
+ \l_siunitx_number_mantissa_length_int
+ - \l_siunitx_number_uncert_length_int
+ }
+ { 0 }
+ }
+ }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \quark_if_no_value:NT \l_siunitx_tmpb_tl
+ { \tl_clear:N \l_siunitx_tmpb_tl }
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ {
+ \exp_not:V \l_siunitx_tmpb_tl
+ \prg_replicate:nn
+ {
+ \l_siunitx_number_uncert_length_int
+ - \l_siunitx_number_mantissa_length_int
+ }
+ { 0 }
+ }
+ \tl_if_empty:NF \l_siunitx_tmpb_tl
+ {
+ \prop_put:NnV \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \prop_if_in:NnF \l_siunitx_number_in_prop
+ { mantissa-decimal-marker }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker } { . }
+ }
+ }
+ }
+ \tl_put_right:NV \l_siunitx_number_uncert_tl \l_siunitx_tmpa_tl
+ \prop_put:NnV \l_siunitx_number_in_prop { mantissa-uncertainty }
+ \l_siunitx_number_uncert_tl
+ }
+% \end{macrocode}
%\end{macro}
%\end{macro}
%
%\subsection{Post-processing numbers}
%
% After finding the basic number in the code above, there may be some
-% manipulation to do. This covers things such as tidying up excess
+% manipulation to do. This covers things such as tidying up excess
% information and rounding numbers. Nothing is added here that is
-% for \enquote{formatting}: this is left for the output part of the
+% for \enquote{formatting}: this is left for the output part of the
% system.
-%
-%\begin{macro}{\l_siunitx_round_int}
-%\begin{macro}{\l_siunitx_round_tl}
-%\begin{macro}{\l_siunitx_round_bool}
-%\begin{macro}{\l_siunitx_round_decimal_in_tl}
-%\begin{macro}{\l_siunitx_round_decimal_out_tl}
-%\begin{macro}{\l_siunitx_round_integer_in_tl}
-%\begin{macro}{\l_siunitx_round_integer_out_tl}
+%
+%\begin{macro}{
+% \l_siunitx_round_int ,
+% \l_siunitx_round_tl ,
+% \l_siunitx_round_bool ,
+% \l_siunitx_round_decimal_in_tl ,
+% \l_siunitx_round_decimal_out_tl ,
+% \l_siunitx_round_integer_in_tl ,
+% \l_siunitx_round_integer_out_tl ,
+%}
% The rounding system needs a number of variables.
% \begin{macrocode}
\int_new:N \l_siunitx_round_int
@@ -6796,17 +7286,13 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_round_integer_out_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_process_decimal_int}
-%\begin{macro}{\l_siunitx_process_uncertainty_int}
-%\begin{macro}{\l_siunitx_uncertainty_decimal_tl}
-%\begin{macro}{\l_siunitx_uncertainty_integer_tl}
+%\begin{macro}{
+% \l_siunitx_process_decimal_int ,
+% \l_siunitx_process_uncertainty_int ,
+% \l_siunitx_uncertainty_decimal_tl ,
+% \l_siunitx_uncertainty_integer_tl ,
+%}
% The code to expand uncertainties needs to know numbers of digits, and
% to store various data.
% \begin{macrocode}
@@ -6816,30 +7302,33 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_uncertainty_integer_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_process_fixed_bool}
-%\begin{macro}{\l_siunitx_process_scientific_bool}
+%\begin{macro}{
+% \l_siunitx_process_fixed_bool ,
+% \l_siunitx_process_engineering_bool ,
+% \l_siunitx_process_scientific_bool ,
+%}
% Settings for the scientific notation system.
% \begin{macrocode}
\bool_new:N \l_siunitx_process_fixed_bool
+\bool_new:N \l_siunitx_process_engineering_bool
\bool_new:N \l_siunitx_process_scientific_bool
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_siunitx_process_decimal_zero_bool}
-%\begin{macro}{\l_siunitx_process_integer_zero_bool}
-%\begin{macro}{\l_siunitx_process_sign_tl}
-%\begin{macro}{\l_siunitx_process_fixed_int}
-%\begin{macro}{\l_siunitx_process_plus_tl}
-%\begin{macro}{\l_siunitx_process_unity_mantissa_tl}
-%\begin{macro}{\l_siunitx_process_zero_exponent_bool}
-%\begin{macro}{\l_siunitx_process_int_to_dec_bool}
-%\begin{macro}{\l_siunitx_process_round_min_tl}
-%\begin{macro}{\l_siunitx_process_precision_int}
+%
+%\begin{macro}{
+% \l_siunitx_process_decimal_zero_bool ,
+% \l_siunitx_process_integer_zero_bool ,
+% \l_siunitx_process_sign_tl ,
+% \l_siunitx_process_fixed_int ,
+% \l_siunitx_process_integer_min_int ,
+% \l_siunitx_process_plus_tl ,
+% \l_siunitx_process_unity_mantissa_tl ,
+% \l_siunitx_process_zero_exponent_bool ,
+% \l_siunitx_process_int_to_dec_bool ,
+% \l_siunitx_process_round_min_tl ,
+% \l_siunitx_process_precision_int ,
+%}
% First, the options are set up.
% \begin{macrocode}
\keys_define:nn { siunitx } {
@@ -6847,58 +7336,61 @@ This work consists of the file siunitx.dtx
add-integer-zero .bool_set:N = \l_siunitx_process_integer_zero_bool,
explicit-sign .tl_set:N = \l_siunitx_process_sign_tl,
fixed-exponent .int_set:N = \l_siunitx_process_fixed_int,
+ minimum-integer-digits .int_set:N =
+ \l_siunitx_process_integer_min_int,
retain-explicit-plus .bool_set:N = \l_siunitx_process_plus_tl,
- retain-unity-mantissa .bool_set:N =
+ retain-unity-mantissa .bool_set:N =
\l_siunitx_process_unity_mantissa_bool,
retain-zero-exponent .bool_set:N =
\l_siunitx_process_zero_exponent_bool,
- round-integer-to-decimal .bool_set:N =
+ round-integer-to-decimal .bool_set:N =
\l_siunitx_process_int_to_dec_bool,
round-minimum .tl_set:N = \l_siunitx_process_round_min_tl,
round-mode .choice: ,
- round-mode / figures .code:n =
+ round-mode / figures .code:n =
{ \tl_set:Nn \l_siunitx_round_tl { figures } },
round-mode / off .code:n = { \tl_clear:N \l_siunitx_round_tl },
- round-mode / places .code:n =
+ round-mode / places .code:n =
{ \tl_set:Nn \l_siunitx_round_tl { places } },
round-precision .int_set:N = \l_siunitx_process_precision_int,
scientific-notation .choice: ,
scientific-notation
- / false .code:n =
+ / false .code:n =
{
\bool_set_false:N \l_siunitx_process_fixed_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
\bool_set_false:N \l_siunitx_process_scientific_bool
},
scientific-notation
- / fixed .code:n =
+ / engineering .code:n =
+ {
+ \bool_set_false:N \l_siunitx_process_fixed_bool
+ \bool_set_true:N \l_siunitx_process_engineering_bool
+ \bool_set_true:N \l_siunitx_process_scientific_bool
+ },
+ scientific-notation
+ / fixed .code:n =
{
\bool_set_true:N \l_siunitx_process_fixed_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
\bool_set_false:N \l_siunitx_process_scientific_bool
},
scientific-notation
- / true .code:n =
+ / true .code:n =
{
\bool_set_false:N \l_siunitx_process_fixed_bool
- \bool_set_true:N \l_siunitx_process_scientific_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
+ \bool_set_true:N \l_siunitx_process_scientific_bool
},
}
\keys_set:nn { siunitx } {
add-decimal-zero = true,
add-integer-zero = true,
- retain-unity-mantissa = true,
+ retain-unity-mantissa = true,
round-precision = 2,
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_process:}
% Post-processing is a series of small tasks.
@@ -6907,7 +7399,7 @@ This work consists of the file siunitx.dtx
\siunitx_number_process_sign:
\siunitx_number_process_zero_fill:
\siunitx_number_process_mantissa:
- \prop_if_in:NnF \l_siunitx_number_in_prop { symbolic }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { symbolic }
{
\siunitx_number_process_exponent:
\bool_if:NTF \l_siunitx_process_fixed_bool
@@ -6915,11 +7407,12 @@ This work consists of the file siunitx.dtx
{
\bool_if:NT \l_siunitx_process_scientific_bool
{ \siunitx_number_process_scientific: }
- }
+ }
\siunitx_number_process_uncertainty:
\prop_if_in:NnF \l_siunitx_number_in_prop { uncertainty }
{ \siunitx_number_process_round: }
}
+ \siunitx_number_process_integer_digits:
}
% \end{macrocode}
%\end{macro}
@@ -6927,23 +7420,23 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\siunitx_number_process_exponent:}
%\begin{macro}[aux]{\siunitx_number_process_exponent_aux:n}
% To check for a totally zero exponent, the possibility that one or more
-% of the exponent storage areas is zero needs to be considered.
+% of the exponent storage areas is zero needs to be considered.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_exponent: {
- \bool_if:NF \l_siunitx_process_zero_exponent_bool
+ \bool_if:NF \l_siunitx_process_zero_exponent_bool
{
- \prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
{
\bool_set_false:N \l_siunitx_tmp_bool
\siunitx_number_process_exponent_aux:n { integer }
\bool_if:NF \l_siunitx_tmp_bool
{ \siunitx_number_process_exponent_aux:n { decimal } }
- \bool_if:NF \l_siunitx_tmp_bool
+ \bool_if:NF \l_siunitx_tmp_bool
{
\prop_del:Nn \l_siunitx_number_in_prop { exponent }
- \prop_del:Nn \l_siunitx_number_in_prop
+ \prop_del:Nn \l_siunitx_number_in_prop
{ exponent-integer }
- \prop_del:Nn \l_siunitx_number_in_prop
+ \prop_del:Nn \l_siunitx_number_in_prop
{ exponent-decimal }
}
}
@@ -6952,9 +7445,9 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_number_process_exponent_aux:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { exponent- #1 }
\l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \int_compare:nNnF { \l_siunitx_tmpa_tl } = { 0 }
+ \int_compare:nNnF { \l_siunitx_tmpa_tl } = { 0 }
{ \bool_set_true:N \l_siunitx_tmp_bool }
}
}
@@ -6963,16 +7456,18 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_process_figures:n}
-%\begin{macro}[aux]{\siunitx_number_process_figures_aux:n}
-%\begin{macro}[aux]{\siunitx_number_process_figures_init:n}
+%\begin{macro}[aux]{
+% \siunitx_number_process_figures_aux:n ,
+% \siunitx_number_process_figures_init:n ,
+%}
% The approach here is to find how many digits there are in each part
-% of the number, working out which are significant. The next stage is
+% of the number, working out which are significant. The next stage is
% reconstruction of the number.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_figures:n #1 {
\int_compare:nNnTF { \l_siunitx_process_precision_int } > { 0 }
{
- \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
+ \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
{ \siunitx_number_process_figures_aux:n {#1} }
}
{
@@ -6989,13 +7484,13 @@ This work consists of the file siunitx.dtx
\siunitx_number_process_figures_init:n {#1}
\siunitx_number_process_figures_count:n { integer }
\siunitx_number_process_figures_count:n { decimal }
- \bool_if:NTF \l_siunitx_round_bool
+ \bool_if:NTF \l_siunitx_round_bool
{
\bool_set_false:N \l_siunitx_round_bool
- \int_compare:nNnTF
- { \l_siunitx_round_int } >
+ \int_compare:nNnTF
+ { \l_siunitx_round_int } >
{ \l_siunitx_process_precision_int }
- {
+ {
\siunitx_number_process_figures_round:
\siunitx_number_process_round_tidy:n {#1}
}
@@ -7009,51 +7504,50 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_number_process_figures_init:n #1 {
\int_zero:N \l_siunitx_round_int
\bool_set_false:N \l_siunitx_round_bool
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
\l_siunitx_round_decimal_in_tl
\quark_if_no_value:NT \l_siunitx_round_decimal_in_tl
- { \tl_clear:N \l_siunitx_round_decimal_in_tl }
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -integer }
+ { \tl_clear:N \l_siunitx_round_decimal_in_tl }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -integer }
\l_siunitx_round_integer_in_tl
\quark_if_no_value:NT \l_siunitx_round_integer_in_tl
- { \tl_clear:N \l_siunitx_round_integer_in_tl }
+ { \tl_clear:N \l_siunitx_round_integer_in_tl }
\tl_clear:N \l_siunitx_round_decimal_out_tl
\tl_clear:N \l_siunitx_round_integer_out_tl
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%\begin{macro}{\siunitx_number_process_figures_count:n}
%\begin{macro}[aux]{\siunitx_number_process_figures_count_aux:n}
-% The counting code has to check that characters are actually
+% The counting code has to check that characters are actually
% significant.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_figures_count:n #1 {
- \tl_if_empty:cF { l_siunitx_round_ #1 _in_tl }
+ \tl_if_empty:cF { l_siunitx_round_ #1 _in_tl }
{
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
{ \siunitx_number_process_figures_count_aux:n {#1} }
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_figures_count_aux:n #1 {
- \int_set:Nn \l_siunitx_tmp_int
+ \int_set:Nn \l_siunitx_tmp_int
{ \tl_head:v { l_siunitx_round_ #1 _in_tl } }
- \tl_set:cx { l_siunitx_round_ #1 _in_tl }
+ \tl_set:cx { l_siunitx_round_ #1 _in_tl }
{ \tl_tail:v { l_siunitx_round_ #1 _in_tl } }
\tl_put_left:cV { l_siunitx_round_ #1 _out_tl } \l_siunitx_tmp_int
- \bool_if:NF \l_siunitx_round_bool
+ \bool_if:NF \l_siunitx_round_bool
{
\int_compare:nNnF { \l_siunitx_tmp_int } = { 0 }
{ \bool_set_true:N \l_siunitx_round_bool }
}
- \bool_if:NT \l_siunitx_round_bool
+ \bool_if:NT \l_siunitx_round_bool
{ \int_incr:N \l_siunitx_round_int }
- \tl_if_empty:cTF { l_siunitx_round_ #1 _in_tl }
+ \tl_if_empty:cTF { l_siunitx_round_ #1 _in_tl }
{
- \tl_set_eq:cc { l_siunitx_round_ #1 _in_tl }
+ \tl_set_eq:cc { l_siunitx_round_ #1 _in_tl }
{ l_siunitx_round_ #1 _out_tl }
\tl_clear:c { l_siunitx_round_ #1 _out_tl }
}
@@ -7069,28 +7563,28 @@ This work consists of the file siunitx.dtx
% digit is carried at the end.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_figures_round: {
- \int_set:Nn \l_siunitx_round_int
+ \int_set:Nn \l_siunitx_round_int
{ \l_siunitx_round_int - \l_siunitx_process_precision_int }
- \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
+ \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
{ \siunitx_number_process_figures_round_loop: }
- \tl_if_empty:NF \l_siunitx_round_integer_in_tl
+ \tl_if_empty:NF \l_siunitx_round_integer_in_tl
{ \siunitx_number_process_figures_integer: }
- \bool_if:NT \l_siunitx_round_bool
+ \bool_if:NT \l_siunitx_round_bool
{
\tl_put_left:Nn \l_siunitx_round_integer_out_tl { 1 }
- \tl_if_empty:NF \l_siunitx_round_decimal_out_tl
+ \tl_if_empty:NF \l_siunitx_round_decimal_out_tl
{
\tl_reverse:N \l_siunitx_round_decimal_out_tl
- \tl_set:Nx \l_siunitx_round_decimal_out_tl
+ \tl_set:Nx \l_siunitx_round_decimal_out_tl
{ \tl_tail:n \l_siunitx_round_decimal_out_tl }
\tl_reverse:N \l_siunitx_round_decimal_out_tl
}
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_figures_round_loop: {
\siunitx_number_process_round_decimal:
- \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
+ \tl_if_empty:NF \l_siunitx_round_decimal_in_tl
{ \siunitx_number_process_figures_round_loop: }
}
% \end{macrocode}
@@ -7101,11 +7595,11 @@ This work consists of the file siunitx.dtx
% to be included.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_figures_integer: {
- \int_compare:nNnT { \l_siunitx_round_int } > { 0 }
+ \int_compare:nNnT { \l_siunitx_round_int } > { 0 }
{ \tl_put_left:Nn \l_siunitx_round_integer_out_tl { 0 } }
- \int_compare:nNnF { \l_siunitx_round_int } > { 1 }
+ \int_compare:nNnF { \l_siunitx_round_int } > { 1 }
{
- \int_set:Nn \l_siunitx_tmp_int
+ \int_set:Nn \l_siunitx_tmp_int
{ \tl_head:V \l_siunitx_round_integer_in_tl }
\bool_if:NT \l_siunitx_round_bool
{ \int_incr:N \l_siunitx_tmp_int }
@@ -7116,25 +7610,25 @@ This work consists of the file siunitx.dtx
{ \bool_set_true:N \l_siunitx_round_bool }
}
{
- \int_compare:nNnT { \l_siunitx_tmp_int } > { 10 }
+ \int_compare:nNnT { \l_siunitx_tmp_int } > { 10 }
{
\bool_set_true:N \l_siunitx_round_bool
\int_zero:N \l_siunitx_tmp_int
}
- \tl_put_left:NV \l_siunitx_round_integer_out_tl
+ \tl_put_left:NV \l_siunitx_round_integer_out_tl
\l_siunitx_tmp_int
}
- }
+ }
\int_decr:N \l_siunitx_round_int
- \tl_set:Nx \l_siunitx_round_integer_in_tl
+ \tl_set:Nx \l_siunitx_round_integer_in_tl
{ \tl_tail:V \l_siunitx_round_integer_in_tl }
- \tl_if_empty:NF \l_siunitx_round_integer_in_tl
+ \tl_if_empty:NF \l_siunitx_round_integer_in_tl
{ \siunitx_number_process_figures_integer: }
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\siunitx_number_process_figures_pad:n}
-% If the number is too short, then the reversal is undone and the
+% If the number is too short, then the reversal is undone and the
% padding routine is called.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_figures_pad:n #1 {
@@ -7142,7 +7636,7 @@ This work consists of the file siunitx.dtx
\l_siunitx_round_integer_in_tl
\prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
\l_siunitx_round_decimal_in_tl
- \int_set:Nn \l_siunitx_round_int
+ \int_set:Nn \l_siunitx_round_int
{ \l_siunitx_process_precision_int - \l_siunitx_round_int }
\siunitx_number_process_pad:n {#1}
}
@@ -7150,17 +7644,19 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_process_fixed:}
-%\begin{macro}[aux]{\siunitx_number_process_fixed_aux_i:nnn}
-%\begin{macro}[aux]{\siunitx_number_process_fixed_aux_ii:nnn}
-%\begin{macro}[aux]{\siunitx_number_process_fixed_large:nnn}
-%\begin{macro}[aux]{\siunitx_number_process_fixed_large_aux:w}
-%\begin{macro}[aux]{\siunitx_number_process_fixed_small:nnn}
-%\begin{macro}[aux]{\siunitx_number_process_fixed_small_aux:w}
+%\begin{macro}[aux]{
+% \siunitx_number_process_fixed_aux_i:nnn ,
+% \siunitx_number_process_fixed_aux_ii:nnn ,
+% \siunitx_number_process_fixed_large:nnn ,
+% \siunitx_number_process_fixed_large_aux:w ,
+% \siunitx_number_process_fixed_small:nnn ,
+% \siunitx_number_process_fixed_small_aux:w ,
+%}
% When working to a fixed exponent value, the idea is to use the stack
% to do the work. First, there is some set up to do.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_fixed: {
- \prop_if_in:NnF \l_siunitx_number_in_prop { complex }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { complex }
{
\prop_get:NnN \l_siunitx_number_in_prop { mantissa-integer }
\l_siunitx_tmpa_tl
@@ -7187,17 +7683,17 @@ This work consists of the file siunitx.dtx
\tl_set:Nn \l_siunitx_tmpb_tl \l_siunitx_tmpb_tl
\tl_set:Nx \l_siunitx_tmpa_tl
{ \l_siunitx_tmpa_tl { \l_siunitx_tmpb_tl } }
- \exp_last_unbraced:NV \siunitx_number_process_fixed_aux_i:nnn
+ \exp_last_unbraced:NV \siunitx_number_process_fixed_aux_i:nnn
\l_siunitx_tmpa_tl
}
-}
+}
% \end{macrocode}
-% The main loop checks to see which way to adjust the exponent then
+% The main loop checks to see which way to adjust the exponent then
% does the work.
-% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn
\siunitx_number_process_fixed_aux_i:nnn #1#2#3 {
- \prop_put:Nnn \l_siunitx_number_in_prop { exponent }
+ \prop_put:Nnn \l_siunitx_number_in_prop { exponent }
{ true }
\int_compare:nNnTF { \l_siunitx_process_fixed_int } > { \c_zero }
{
@@ -7213,7 +7709,7 @@ This work consists of the file siunitx.dtx
\int_compare:nNnF { #1 + 0 #2 } = { 0 }
{ \siunitx_number_process_fixed_aux_ii:nnn {#1} {#2} {#3} }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_fixed_aux_ii:nnn #1#2#3 {
\int_compare:nNnTF {#3} > { \l_siunitx_process_fixed_int }
{ \siunitx_number_process_fixed_large:nnn {#1} {#2} {#3} }
@@ -7225,39 +7721,39 @@ This work consists of the file siunitx.dtx
{ mantissa-integer } {#1}
\tl_if_empty:nTF {#2}
{
- \prop_del:Nn \l_siunitx_number_in_prop
+ \prop_del:Nn \l_siunitx_number_in_prop
{ mantissa-decimal }
- \prop_del:Nn \l_siunitx_number_in_prop
+ \prop_del:Nn \l_siunitx_number_in_prop
{ mantissa-decimal-marker }
}
{
\prop_put:Nnn \l_siunitx_number_in_prop
{ mantissa-decimal } {#2}
- \prop_if_in:NnF \l_siunitx_number_in_prop
+ \prop_if_in:NnF \l_siunitx_number_in_prop
{ mantissa-decimal-marker }
{
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-decimal-marker } { . }
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker } { . }
}
- }
+ }
}
- }
+ }
}
% \end{macrocode}
-% Simple stack-based manipulation of the input for number which are
+% Simple stack-based manipulation of the input for number which are
% either too big or too small. There are a couple of checks needed to
% deal with cases where there is no decimal part and where there are
% leading zeros to dispose of. There is also a check to avoid adding
% an additional zero to the decimal part of the number.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_fixed_large:nnn #1#2#3 {
- \cs_set_protected_nopar:Npn
+ \cs_set_protected_nopar:Npn
\siunitx_number_process_fixed_large_aux:w ##1##2 \q_stop
{
\tl_if_empty:nTF {##2}
{
- \int_compare:nNnTF
+ \int_compare:nNnTF
{ #3 - 1 } = { \l_siunitx_process_fixed_int }
{
\siunitx_number_process_fixed_aux_ii:nnn { #1 ##1 }
@@ -7267,11 +7763,11 @@ This work consists of the file siunitx.dtx
\siunitx_number_process_fixed_aux_ii:nnn { #1 ##1 }
{ 0 } { #3 - 1 }
}
- }
+ }
{
\int_compare:nNnTF {#1} = { 0 }
{
- \siunitx_number_process_fixed_aux_ii:nnn {##1} {##2}
+ \siunitx_number_process_fixed_aux_ii:nnn {##1} {##2}
{ #3 - 1 }
}
{
@@ -7280,31 +7776,31 @@ This work consists of the file siunitx.dtx
}
}
}
- \tl_if_empty:nTF {#2}
+ \tl_if_empty:nTF {#2}
{ \siunitx_number_process_fixed_aux_ii:nnn { #1 0 } { } { #3 - 1 } }
{ \siunitx_number_process_fixed_large_aux:w #2 \q_stop }
}
-\cs_new_protected_nopar:Npn \siunitx_number_process_fixed_large_aux:w
+\cs_new_protected_nopar:Npn \siunitx_number_process_fixed_large_aux:w
{ }
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_fixed_small:nnn #1#2#3 {
- \cs_set_protected_nopar:Npn
+ \cs_set_protected_nopar:Npn
\siunitx_number_process_fixed_small_aux:w ##1##2 \q_stop ##3
{
\tl_if_empty:nTF {##2}
{
\tl_if_empty:nTF {##3}
{
- \siunitx_number_process_fixed_aux_ii:nnn { 0 }
+ \siunitx_number_process_fixed_aux_ii:nnn { 0 }
{ ##1 #2 } { #3 + 1 }
}
{
\siunitx_number_process_fixed_aux_ii:nnn {##3}
{ ##1 #2 } { #3 + 1 }
}
- }
+ }
{
- \siunitx_number_process_fixed_small_aux:w ##2 \q_stop
+ \siunitx_number_process_fixed_small_aux:w ##2 \q_stop
{ ##3 ##1 }
}
}
@@ -7315,43 +7811,71 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
+%
+%\begin{macro}{\siunitx_number_process_integer_digits:}
+% Producing extra digits for the integer part is a simple process
+% once the target is known.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \siunitx_number_process_integer_digits: {
+ \int_compare:nNnT
+ { \l_siunitx_process_integer_min_int } > { \c_zero }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-integer }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ {
+ \int_set:Nn \l_siunitx_tmp_int
+ {
+ \l_siunitx_process_integer_min_int
+ - \tl_elt_count:N \l_siunitx_tmpa_tl
+ }
+ \int_compare:nNnT { \l_siunitx_tmp_int } > { \c_zero }
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ {
+ \prg_replicate:nn { \l_siunitx_tmp_int } { 0 }
+ \exp_not:V \l_siunitx_tmpa_tl
+ }
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { mantissa-integer } \l_siunitx_tmpa_tl
+ }
+ }
+ }
+}
+% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\c_siunitx_unity_tl}
%\begin{macro}{\siunitx_number_process_mantissa:}
+%\begin{macro}{\c_siunitx_unity_tl}
% A check for the mantissa consisting only of the token \texttt{1}, when
% an exponent is also available.
% \begin{macrocode}
-\tl_new:N \c_siunitx_unity_tl
-\tl_set:Nn \c_siunitx_unity_tl { 1 }
\cs_new_protected_nopar:Npn \siunitx_number_process_mantissa: {
- \bool_if:NF \l_siunitx_process_unity_mantissa_bool
+ \bool_if:NF \l_siunitx_process_unity_mantissa_bool
{
- \prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
{
\prop_get:NnN \l_siunitx_number_in_prop { mantissa-integer }
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \tl_if_eq:NNT \c_siunitx_unity_tl \l_siunitx_tmpa_tl
- {
- \prop_if_in:NnF \l_siunitx_number_in_prop
+ \tl_if_eq:NNT \c_siunitx_unity_tl \l_siunitx_tmpa_tl
+ {
+ \prop_if_in:NnF \l_siunitx_number_in_prop
{ mantissa-decimal-marker }
{
- \prop_del:Nn \l_siunitx_number_in_prop
+ \prop_del:Nn \l_siunitx_number_in_prop
{ mantissa }
- \prop_del:Nn \l_siunitx_number_in_prop
+ \prop_del:Nn \l_siunitx_number_in_prop
{ mantissa-integer }
- }
+ }
}
}
}
}
}
+\tl_new:N \c_siunitx_unity_tl
+\tl_set:Nn \c_siunitx_unity_tl { 1 }
% \end{macrocode}
%\end{macro}
%\end{macro}
@@ -7361,16 +7885,16 @@ This work consists of the file siunitx.dtx
% happen if the input was zero or if the number is too short.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_pad:n #1 {
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \int_while_do:nNnn { \l_siunitx_round_int } > { 0 }
+ \int_while_do:nNnn { \l_siunitx_round_int } > { 0 }
{
\tl_put_right:Nn \l_siunitx_tmpa_tl { 0 }
\int_decr:N \l_siunitx_round_int
}
- \prop_put:NnV \l_siunitx_number_in_prop { #1 -decimal }
+ \prop_put:NnV \l_siunitx_number_in_prop { #1 -decimal }
\l_siunitx_tmpa_tl
}
}
@@ -7378,53 +7902,59 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_process_places:n}
-%\begin{macro}[aux]{\siunitx_number_process_places_aux_i:n}
+%\begin{macro}[aux]{
+% \siunitx_number_process_places_init:n ,
+% \siunitx_number_process_places_aux_i:n ,
+% \siunitx_number_process_places_aux_ii:n ,
+% \siunitx_number_process_places_loop:n ,
+% \siunitx_number_process_places_integer:n ,
+%}
% For rounding to a fixed number of places, a check is made to see if
% the decimal part is exactly zero. If it is, just create the
% appropriate number of zeros in the padding routine. Otherwise, do the
% real work.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_places:n #1 {
- \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
+ \prop_if_in:NnT \l_siunitx_number_in_prop {#1}
{
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -uncertainty }
{ \siunitx_number_process_places_aux_i:n {#1} }
}
-}
+}
\cs_new_protected_nopar:Npn \siunitx_number_process_places_aux_i:n #1 {
- \int_compare:nNnTF { \l_siunitx_process_precision_int } = { 0 }
- {
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
- \l_siunitx_tmpa_tl
+ \int_compare:nNnTF { \l_siunitx_process_precision_int } = { 0 }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
+ \l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \int_compare:nNnTF
+ \int_compare:nNnTF
{ \tl_head:V \l_siunitx_tmpa_tl } > { 4 }
{
\prop_get:NnN \l_siunitx_number_in_prop { #1 -integer }
\l_siunitx_tmpa_tl
- \quark_if_no_value:NTF \l_siunitx_tmpa_tl
+ \quark_if_no_value:NTF \l_siunitx_tmpa_tl
{
- \prop_put:Nnn \l_siunitx_number_in_prop
+ \prop_put:Nnn \l_siunitx_number_in_prop
{ #1 -integer } { 1 }
}
{
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ \int_eval:n { \l_siunitx_tmpa_tl + 1 } }
- \prop_put:NnV \l_siunitx_number_in_prop
- { #1 -integer } \l_siunitx_tmpa_tl
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { #1 -integer } \l_siunitx_tmpa_tl
}
}
{
\prop_if_in:NnF \l_siunitx_number_in_prop { #1 -integer }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
{ #1 -integer } { 0 }
}
}
- }
+ }
\prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal }
- \bool_if:NF \l_siunitx_process_int_to_dec_bool
+ \bool_if:NF \l_siunitx_process_int_to_dec_bool
{
\prop_del:Nn \l_siunitx_number_in_prop { #1 -decimal-marker }
}
@@ -7434,18 +7964,18 @@ This work consists of the file siunitx.dtx
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \tl_if_empty:NT \l_siunitx_tmpa_tl
+ \tl_if_empty:NT \l_siunitx_tmpa_tl
{ \tl_set:Nn \l_siunitx_tmpa_tl { 0 } }
- \int_compare:nNnTF { \l_siunitx_tmpa_tl } = { 0 }
+ \int_compare:nNnTF { \l_siunitx_tmpa_tl } = { 0 }
{
\prop_put:Nnn \l_siunitx_number_in_prop { #1 -decimal }
{ }
- \int_set:Nn \l_siunitx_round_int
+ \int_set:Nn \l_siunitx_round_int
{ \l_siunitx_process_precision_int }
\siunitx_number_process_pad:n {#1}
}
{
- \int_set:Nn \l_siunitx_round_int
+ \int_set:Nn \l_siunitx_round_int
{ \tl_elt_count:N \l_siunitx_tmpa_tl }
\siunitx_number_process_places_aux_ii:n {#1}
}
@@ -7453,18 +7983,15 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_number_process_places_aux_ii:n}
% For rounding to a fixed number of places, the package finds the
% difference in length between what is present and what is required.
% If the number is too short, there is some simple padding to do.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_places_aux_ii:n #1 {
- \int_sub:Nn \l_siunitx_round_int
+ \int_sub:Nn \l_siunitx_round_int
{ \l_siunitx_process_precision_int }
- \int_compare:nNnTF { \l_siunitx_round_int } < { 0 }
+ \int_compare:nNnTF { \l_siunitx_round_int } < { 0 }
{
\int_set:Nn \l_siunitx_round_int { - \l_siunitx_round_int }
\siunitx_number_process_pad:n {#1}
@@ -7476,13 +8003,11 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\siunitx_number_process_places_init:n}
% To keep the code a little clearer.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_places_init:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -integer }
- \l_siunitx_round_integer_in_tl
+ \l_siunitx_round_integer_in_tl
\quark_if_no_value:NT \l_siunitx_round_integer_in_tl
{ \tl_clear:N \l_siunitx_round_integer_in_tl }
\prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
@@ -7494,21 +8019,19 @@ This work consists of the file siunitx.dtx
\bool_set_false:N \l_siunitx_round_bool
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_number_process_places_loop:n}
% If there is a decimal, do the decimal processing then come back here.
% If there is an integer, do the same. Only if both are empty does the
% loop stop.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_places_loop:n #1 {
- \tl_if_empty:NTF \l_siunitx_round_decimal_in_tl
+ \tl_if_empty:NTF \l_siunitx_round_decimal_in_tl
{
- \tl_if_empty:NF \l_siunitx_round_integer_in_tl
+ \tl_if_empty:NF \l_siunitx_round_integer_in_tl
{
\siunitx_number_process_places_integer:n {#1}
\siunitx_number_process_places_loop:n {#1}
}
- \bool_if:NT \l_siunitx_round_bool
+ \bool_if:NT \l_siunitx_round_bool
{
\tl_put_left:Nn \l_siunitx_round_integer_out_tl { 1 }
\bool_set_false:N \l_siunitx_round_bool
@@ -7520,59 +8043,58 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_number_process_places_integer:n}
% Rounding for integers is just a case of carrying digits.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_places_integer:n #1 {
- \int_set:Nn \l_siunitx_tmp_int
+ \int_set:Nn \l_siunitx_tmp_int
{ \tl_head:V \l_siunitx_round_integer_in_tl }
- \tl_set:Nx \l_siunitx_round_integer_in_tl
+ \tl_set:Nx \l_siunitx_round_integer_in_tl
{ \tl_tail:V \l_siunitx_round_integer_in_tl }
\bool_if:NT \l_siunitx_round_bool
{ \int_incr:N \l_siunitx_tmp_int }
\bool_set_false:N \l_siunitx_round_bool
- \int_compare:nNnT { \l_siunitx_tmp_int } = { 10 }
+ \int_compare:nNnT { \l_siunitx_tmp_int } = { 10 }
{
\int_zero:N \l_siunitx_tmp_int
- \bool_set_true:N \l_siunitx_round_bool
+ \bool_set_true:N \l_siunitx_round_bool
}
\tl_put_left:NV \l_siunitx_round_integer_out_tl \l_siunitx_tmp_int
}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%
%\begin{macro}{\siunitx_number_process_round:}
-% The lead-off for rounding is the same for decimal places and
+% The lead-off for rounding is the same for decimal places and
% significant figures.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_round: {
- \tl_if_empty:NF \l_siunitx_round_tl
+ \tl_if_empty:NF \l_siunitx_round_tl
{
\bool_if:NT \l_siunitx_process_int_to_dec_bool
{
- \prop_if_in:NnF \l_siunitx_number_in_prop
+ \prop_if_in:NnF \l_siunitx_number_in_prop
{ mantissa-decimal }
{
\prop_put:Nnn \l_siunitx_number_in_prop
{ mantissa-decimal } { 0 }
}
- \prop_if_in:NnF \l_siunitx_number_in_prop
+ \prop_if_in:NnF \l_siunitx_number_in_prop
{ mantissa-decimal-marker }
{
\prop_put:Nnn \l_siunitx_number_in_prop
{ mantissa-decimal-marker } { . }
}
}
- \cs_set_nopar:Npx \siunitx_tmp:w
+ \cs_set_nopar:Npx \siunitx_tmp:w
{
- \exp_not:N \clist_map_function:nN
+ \exp_not:N \clist_map_function:nN
{ mantissa , complex }
- \exp_not:c
+ \exp_not:c
{ siunitx_number_process_ \l_siunitx_round_tl :n }
}
- \siunitx_tmp:w
+ \siunitx_tmp:w
}
}
% \end{macrocode}
@@ -7580,35 +8102,35 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\siunitx_number_process_round_decimal:}
%\begin{macro}[aux]{\siunitx_number_process_round_decimal_aux:}
% The rounding routine for decimals is the same for figures and places,
-% so there is a generalised function here. Unfortunately, it is also
+% so there is a generalised function here. Unfortunately, it is also
% complicated!
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_round_decimal: {
- \int_compare:nNnF { \l_siunitx_round_int } > { 1 }
+ \int_compare:nNnF { \l_siunitx_round_int } > { 1 }
{ \siunitx_number_process_round_decimal_aux: }
- \tl_set:Nx \l_siunitx_round_decimal_in_tl
+ \tl_set:Nx \l_siunitx_round_decimal_in_tl
{ \tl_tail:V \l_siunitx_round_decimal_in_tl }
\int_decr:N \l_siunitx_round_int
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_round_decimal_aux: {
- \int_set:Nn \l_siunitx_tmp_int
+ \int_set:Nn \l_siunitx_tmp_int
{ \tl_head:V \l_siunitx_round_decimal_in_tl }
- \bool_if:NT \l_siunitx_round_bool
+ \bool_if:NT \l_siunitx_round_bool
{ \int_incr:N \l_siunitx_tmp_int }
\bool_set_false:N \l_siunitx_round_bool
- \int_compare:nNnTF { \l_siunitx_round_int } = { 1 }
+ \int_compare:nNnTF { \l_siunitx_round_int } = { 1 }
{
- \int_compare:nNnT { \l_siunitx_tmp_int } > { 4 }
+ \int_compare:nNnT { \l_siunitx_tmp_int } > { 4 }
{ \bool_set_true:N \l_siunitx_round_bool }
}
{
- \int_compare:nNnT { \l_siunitx_tmp_int } = { 10 }
+ \int_compare:nNnT { \l_siunitx_tmp_int } = { 10 }
{
\bool_set_true:N \l_siunitx_round_bool
\int_zero:N \l_siunitx_tmp_int
}
- \tl_put_left:NV \l_siunitx_round_decimal_out_tl
+ \tl_put_left:NV \l_siunitx_round_decimal_out_tl
\l_siunitx_tmp_int
}
}
@@ -7625,7 +8147,7 @@ This work consists of the file siunitx.dtx
{
0 \l_siunitx_round_integer_out_tl +
0 \l_siunitx_round_decimal_out_tl
- }
+ }
= { 0 }
{
\fp_compare:nNnTF { \l_siunitx_process_round_min_tl } = { 0 }
@@ -7650,7 +8172,7 @@ This work consists of the file siunitx.dtx
{
\prop_put:NnV \l_siunitx_number_in_prop { #1 -decimal }
\l_siunitx_round_decimal_out_tl
- }
+ }
}
}
\cs_new_protected_nopar:Npn
@@ -7666,16 +8188,26 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_process_scientific:}
-%\begin{macro}[aux]{\siunitx_number_process_scientific_aux_i:nnn}
-%\begin{macro}[aux]{\siunitx_number_process_scientific_aux_ii:nnn}
-%\begin{macro}[aux]{\siunitx_number_process_scientific_large:nnn}
-%\begin{macro}[aux]{\siunitx_number_process_scientific_small:wn}
+%\begin{macro}[aux]{
+% \siunitx_number_process_scientific_aux_i:nnn ,
+% \siunitx_number_process_scientific_aux_ii:nnn ,
+% \siunitx_number_process_scientific_large:nnn ,
+% \siunitx_number_process_scientific_small:wn ,
+% \siunitx_number_process_scientific_store:nnn ,
+% \siunitx_number_process_scientific_engineering:nnn ,
+% \siunitx_number_process_scientific_engineering_0:nnn ,
+% \siunitx_number_process_scientific_engineering_1:nnn ,
+% \siunitx_number_process_scientific_engineering_1:nw ,
+% \siunitx_number_process_scientific_engineering_2:nnn ,
+% \siunitx_number_process_scientific_engineering_2_i:nw ,
+% \siunitx_number_process_scientific_engineering_2_ii:nw ,
+%}
% Converting a number to scientific form is done such that the number
% of places involved is unchanged. The first step is to skip any
% complex-number containing input and to recover the stored data.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_scientific: {
- \prop_if_in:NnF \l_siunitx_number_in_prop { complex }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { complex }
{
\prop_get:NnN \l_siunitx_number_in_prop { mantissa-integer }
\l_siunitx_tmpa_tl
@@ -7691,76 +8223,59 @@ This work consists of the file siunitx.dtx
\l_siunitx_tmpb_tl
\quark_if_no_value:NT \l_siunitx_tmpb_tl
{ \tl_set:Nn \l_siunitx_tmpb_tl { 0 } }
+ \group_begin:
+ \prop_get:NnN \l_siunitx_number_in_prop { exponent-sign }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ { \tl_put_left:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl }
+ \exp_args:NNNV \group_end:
+ \tl_set:Nn \l_siunitx_tmpb_tl \l_siunitx_tmpb_tl
\tl_set:Nx \l_siunitx_tmpa_tl
{ \l_siunitx_tmpa_tl { \l_siunitx_tmpb_tl } }
\exp_last_unbraced:NV \siunitx_number_process_scientific_aux_i:nnn
\l_siunitx_tmpa_tl
}
-}
-\cs_new_protected_nopar:Npn
+}
+\cs_new_protected_nopar:Npn
\siunitx_number_process_scientific_aux_i:nnn #1#2#3 {
\int_compare:nNnF { #1 + 0 #2 } = { 0 }
{ \siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} {#3} }
}
% \end{macrocode}
% The code here works on a loop, standardising the mantissa into the
-% range \( 1 \le x < 10 \).
+% range \( 1 \le x < 10 \).
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_scientific_aux_ii:nnn #1#2#3 {
\int_compare:nNnTF {#1} > { 9 }
{ \siunitx_number_process_scientific_large:nnn {#1} {#2} {#3} }
{
\int_compare:nNnTF {#1} > { 0 }
{
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-integer } {#1}
-
- \tl_if_empty:nTF {#2}
- {
- \prop_del:Nn \l_siunitx_number_in_prop
- { mantissa-decimal }
- \prop_del:Nn \l_siunitx_number_in_prop
- { mantissa-decimal-marker }
- }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-decimal } {#2}
- \prop_if_in:NnF \l_siunitx_number_in_prop
- { mantissa-decimal-marker }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-decimal-marker } { . }
- }
- }
- \int_compare:nNnF {#3} = { 0 }
- {
- \int_set:Nn \l_siunitx_tmp_int {#3}
- \prop_put:Nnn \l_siunitx_number_in_prop { exponent }
- { true }
- \prop_put:NnV \l_siunitx_number_in_prop
- { exponent-integer } \l_siunitx_tmp_int
- }
- }
+ \bool_if:NTF \l_siunitx_process_engineering_bool
+ { \siunitx_number_process_scientific_engineering:nnn }
+ { \siunitx_number_process_scientific_store:nnn }
+ {#1} {#2} {#3}
+ }
{
\siunitx_number_process_scientific_small:wn
#2 \q_stop {#3}
}
- }
+ }
}
% \end{macrocode}
% The fastest way to find the smallest digit of the integer part is
% using some mathematics. This does limit the range of the input, but
% in real cases this should not be an issue.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_scientific_large:nnn #1#2#3 {
\int_set:Nn \l_siunitx_tmp_int { \int_div_truncate:nn {#1} { 10 } }
\tl_set:Nx \l_siunitx_tmpa_tl { \int_use:N \l_siunitx_tmp_int }
\int_set:Nn \l_siunitx_tmp_int { #1 - 10 * \l_siunitx_tmp_int }
\tl_set:Nx \l_siunitx_tmpa_tl
- {
- { \l_siunitx_tmpa_tl } { \int_use:N \l_siunitx_tmp_int #2 }
+ {
+ { \l_siunitx_tmpa_tl } { \int_use:N \l_siunitx_tmp_int #2 }
{ #3 + 1 }
}
\exp_last_unbraced:NV \siunitx_number_process_scientific_aux_ii:nnn
@@ -7769,95 +8284,224 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
% For small numbers, the important digit is easy to find.
% \begin{macrocode}
+\cs_new_protected_nopar:Npn
+ \siunitx_number_process_scientific_small:wn #1#2 \q_stop #3
+ { \siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} { #3 - 1 } }
+% \end{macrocode}
+% A tidy-up and store routine.
+% \begin{macrocode}
\cs_new_protected_nopar:Npn
- \siunitx_number_process_scientific_small:wn #1#2 \q_stop #3 {
- \siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} { #3 - 1 }
-}
+ \siunitx_number_process_scientific_store:nnn #1#2#3
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { mantissa-integer } {#1}
+ \tl_if_empty:nTF {#2}
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { mantissa-decimal }
+ \prop_del:Nn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker }
+ }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal } {#2}
+ \prop_if_in:NnF \l_siunitx_number_in_prop
+ { mantissa-decimal-marker }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker } { . }
+ }
+ }
+ \int_compare:nNnTF {#3} = { 0 }
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent }
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-sign }
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-integer }
+ }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { exponent } { true }
+ \int_compare:nNnTF {#3} > { 0 }
+ {
+ \int_set:Nn \l_siunitx_tmp_int {#3}
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { exponent-integer } \l_siunitx_tmp_int
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-sign }
+ }
+ {
+ \int_set:Nn \l_siunitx_tmp_int { 0 - (#3) }
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { exponent-integer } \l_siunitx_tmp_int
+ \prop_put:Nnn \l_siunitx_number_in_prop { exponent-sign }
+ { - }
+ }
+ }
+ }
+% \end{macrocode}
+% For engineering style, the exponent has to be a power of three.
+% The fastest way to do this is by expansion, as the number of tokens
+% is known.
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn
+ \siunitx_number_process_scientific_engineering:nnn #1#2#3
+ {
+ \use:c
+ {
+ siunitx_number_process_scientific_engineering_
+ \int_compare:nNnTF {#3} < { 0 }
+ {
+ \prg_case_int:nnn { \int_mod:nn { 0 - (#3) } { 3 } }
+ {
+ { 1 } { 2 }
+ { 2 } { 1 }
+ }
+ { 0 }
+ }
+ { \int_mod:nn {#3} { 3 } }
+ :nnn
+ }
+ {#1} {#2} {#3}
+ }
+\cs_new_eq:cN
+ { siunitx_number_process_scientific_engineering_0:nnn }
+ \siunitx_number_process_scientific_store:nnn
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_1:nnn } #1#2#3
+ {
+ \tl_if_empty:nTF {#2}
+ {
+ \siunitx_number_process_scientific_store:nnn { #1 0 } { }
+ { #3 - 1 }
+ }
+ {
+ \use:c
+ { siunitx_number_process_scientific_engineering_1:nw }
+ {#1} #2 \q_stop {#3}
+ }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_1:nw }
+ #1#2#3 \q_stop #4
+ {
+ \siunitx_number_process_scientific_store:nnn
+ {#1#2} {#3} { #4 - 1 }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_2:nnn } #1#2#3
+ {
+ \tl_if_empty:nTF {#2}
+ {
+ \siunitx_number_process_scientific_store:nnn { #1 00 } { }
+ { #3 - 2 }
+ }
+ {
+ \use:c
+ { siunitx_number_process_scientific_engineering_2_i:nw }
+ {#1} #2 \q_stop {#3}
+ }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_2_i:nw }
+ #1#2#3 \q_stop #4
+ {
+ \tl_if_empty:nTF {#3}
+ {
+ \siunitx_number_process_scientific_store:nnn { #1#2 0 } { }
+ { #4 - 2 }
+ }
+ {
+ \use:c
+ { siunitx_number_process_scientific_engineering_2_ii:nw }
+ {#1#2} #3 \q_stop {#4}
+ }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_2_ii:nw }
+ #1#2#3 \q_stop #4
+ {
+ \siunitx_number_process_scientific_store:nnn { #1#2 } {#3}
+ { #4 - 2 }
+ }
% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%\end{macro}
%\end{macro}
%
%\begin{macro}{\siunitx_number_process_sign:}
+%\begin{macro}[aux]{
+% \siunitx_number_process_sign_add:n ,
+% \siunitx_number_process_sign_plus:n ,
+%}
+%\begin{macro}{\c_siunitx_plus_tl}
% Sorting out signs consists of two parts: retaining a plus if necessary
% and adding an explicit sign.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_sign: {
- \bool_if:NF \l_siunitx_process_plus_tl
+ \bool_if:NF \l_siunitx_process_plus_tl
{
\prop_if_in:NnTF \l_siunitx_number_in_prop { mantissa-sign }
{ \siunitx_number_process_sign_plus:n { mantissa } }
{
\prop_if_in:NnT \l_siunitx_number_in_prop { complex-sign }
- {
+ {
\prop_if_in:NnF \l_siunitx_number_in_prop { mantissa }
{ \siunitx_number_process_sign_plus:n { complex } }
- }
+ }
}
\prop_if_in:NnT \l_siunitx_number_in_prop { exponent-sign }
{ \siunitx_number_process_sign_plus:n { exponent } }
}
- \tl_if_empty:NF \l_siunitx_process_sign_tl
+ \tl_if_empty:NF \l_siunitx_process_sign_tl
{
\prop_if_in:NnTF \l_siunitx_number_in_prop { mantissa }
{ \siunitx_number_process_sign_add:n { mantissa } }
{
\prop_if_in:NnT \l_siunitx_number_in_prop { complex }
- { \siunitx_number_process_sign_add:n { complex } }
+ { \siunitx_number_process_sign_add:n { complex } }
}
\prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
{ \siunitx_number_process_sign_add:n { exponent } }
}
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_number_process_sign_add:n}
% Adding a sign to an existing number needs a couple of to make sure
% there is a number to add to, and to see if there is a sign already.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_sign_add:n #1 {
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -sign }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -sign }
{
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -had-sign }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 -had-sign }
{
\prop_get:NnN \l_siunitx_number_in_prop {#1}
\l_siunitx_tmpa_tl
- \tl_if_empty:NTF \l_siunitx_tmpa_tl
+ \tl_if_empty:NTF \l_siunitx_tmpa_tl
{
- \prop_put:NnV \l_siunitx_number_in_prop { sign }
- \l_siunitx_process_sign_tl
+ \prop_put:NnV \l_siunitx_number_in_prop { sign }
+ \l_siunitx_process_sign_tl
}
{
- \prop_put:NnV \l_siunitx_number_in_prop { #1 -sign }
+ \prop_put:NnV \l_siunitx_number_in_prop { #1 -sign }
\l_siunitx_process_sign_tl
}
- }
+ }
}
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\c_siunitx_plus_tl}
-%\begin{macro}[aux]{\siunitx_number_process_sign_plus:n}
% Holding onto a plus works very much in the same way as adding a sign:
% some quick tests and an assignment. Using a pre-defined token list is
% a speed-related choice: very slightly faster comparison.
% \begin{macrocode}
-\tl_new:N \c_siunitx_plus_tl
-\tl_set:Nn \c_siunitx_plus_tl { + }
\cs_new_protected_nopar:Npn \siunitx_number_process_sign_plus:n #1 {
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -sign }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -sign }
\l_siunitx_tmpa_tl
- \tl_if_eq:NNT \c_siunitx_plus_tl \l_siunitx_tmpa_tl
- {
- \prop_del:Nn \l_siunitx_number_in_prop { #1 -sign }
+ \tl_if_eq:NNT \c_siunitx_plus_tl \l_siunitx_tmpa_tl
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { #1 -sign }
\prop_put:Nnn \l_siunitx_number_in_prop { #1 -had-sign } { true }
}
}
+\tl_new:N \c_siunitx_plus_tl
+\tl_set:Nn \c_siunitx_plus_tl { + }
% \end{macrocode}
%\end{macro}
%\end{macro}
+%\end{macro}
%
%\begin{macro}{\siunitx_number_process_uncertainty:}
%\begin{macro}[aux]{\siunitx_number_process_uncertainty_aux:n}
@@ -7866,13 +8510,13 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_uncertainty: {
\clist_map_function:nN { mantissa , complex }
- \siunitx_number_process_uncertainty_aux:n
+ \siunitx_number_process_uncertainty_aux:n
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_uncertainty_aux:n #1 {
- \prop_if_in:NnT \l_siunitx_number_in_prop { #1 -uncertainty }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { #1 -uncertainty }
{
- \prop_if_in:NnTF \l_siunitx_number_in_prop { #1 -decimal-marker }
+ \prop_if_in:NnTF \l_siunitx_number_in_prop { #1 -decimal-marker }
{ \siunitx_number_process_uncertainty_decimal:n {#1} }
{ \siunitx_number_process_uncertainty_integer:n {#1} }
}
@@ -7886,35 +8530,35 @@ This work consists of the file siunitx.dtx
% correctly pad with zeros and also to allow for the possibility that
% the error crosses the decimal--integer boundary.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_uncertainty_decimal:n #1 {
\siunitx_number_process_uncertainty_count:nn {#1} { decimal }
\siunitx_number_process_uncertainty_count:nn {#1} { uncertainty }
\tl_clear:N \l_siunitx_uncertainty_decimal_tl
\tl_clear:N \l_siunitx_uncertainty_integer_tl
- \int_compare:nNnTF
+ \int_compare:nNnTF
{ \l_siunitx_process_uncertainty_int } >
- { \l_siunitx_process_decimal_int }
+ { \l_siunitx_process_decimal_int }
{ \siunitx_number_process_uncertainty_separate: }
{ \siunitx_number_process_uncertainty_pad: }
- \tl_if_empty:NF \l_siunitx_uncertainty_integer_tl
+ \tl_if_empty:NF \l_siunitx_uncertainty_integer_tl
{
- \prop_put:NnV \l_siunitx_number_in_prop
- { #1 -uncertainty-integer }
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { #1 -uncertainty-integer }
\l_siunitx_uncertainty_integer_tl
- }
- \prop_put:NnV \l_siunitx_number_in_prop { #1 -uncertainty-decimal }
+ }
+ \prop_put:NnV \l_siunitx_number_in_prop { #1 -uncertainty-decimal }
\l_siunitx_uncertainty_decimal_tl
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal-marker }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal-marker }
\l_siunitx_tmpa_tl
- \prop_put:NnV \l_siunitx_number_in_prop
+ \prop_put:NnV \l_siunitx_number_in_prop
{ #1 -uncertainty-decimal-marker } \l_siunitx_tmpa_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_uncertainty_count:nn #1#2 {
- \prop_get:NnN \l_siunitx_number_in_prop { #1 - #2 }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 - #2 }
\l_siunitx_tmpa_tl
- \int_set:cn { l_siunitx_process_ #2 _int }
+ \int_set:cn { l_siunitx_process_ #2 _int }
{ \tl_elt_count:N \l_siunitx_tmpa_tl }
}
% \end{macrocode}
@@ -7928,28 +8572,28 @@ This work consists of the file siunitx.dtx
{ \l_siunitx_process_uncertainty_int } <
{ \l_siunitx_process_decimal_int }
{
- \tl_put_right:Nn \l_siunitx_uncertainty_decimal_tl {0}
+ \tl_put_right:Nn \l_siunitx_uncertainty_decimal_tl {0}
\int_incr:N \l_siunitx_process_uncertainty_int
}
- \tl_put_right:NV \l_siunitx_uncertainty_decimal_tl
+ \tl_put_right:NV \l_siunitx_uncertainty_decimal_tl
\l_siunitx_tmpa_tl
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\siunitx_number_process_uncertainty_separate:}
-%\begin{macro}{\siunitx_number_process_uncertainty_separate_aux:N}
+%\begin{macro}[aux]{\siunitx_number_process_uncertainty_separate_aux:N}
% Find the integer--decimal boundary and work appropriately.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_uncertainty_separate: {
- \tl_map_function:NN \l_siunitx_tmpa_tl
+ \tl_map_function:NN \l_siunitx_tmpa_tl
\siunitx_number_process_uncertainty_separate_aux:N
}
-\cs_new_protected:Npn
+\cs_new_protected:Npn
\siunitx_number_process_uncertainty_separate_aux:N #1 {
- \int_compare:nNnTF
+ \int_compare:nNnTF
{ \l_siunitx_process_uncertainty_int } >
- { \l_siunitx_process_decimal_int }
+ { \l_siunitx_process_decimal_int }
{ \tl_put_right:Nn \l_siunitx_uncertainty_integer_tl {#1} }
{ \tl_put_right:Nn \l_siunitx_uncertainty_decimal_tl {#1} }
\int_decr:N \l_siunitx_process_uncertainty_int
@@ -7961,7 +8605,7 @@ This work consists of the file siunitx.dtx
% Relatively easy: the uncertainty is in the integer part of the number,
% and so there is no need to generate zeros.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_uncertainty_integer:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -uncertainty }
\l_siunitx_tmpa_tl
@@ -7972,9 +8616,11 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_process_zero_fill:}
-%\begin{macro}[aux]{\siunitx_number_process_zero_fill_aux:n}
-%\begin{macro}[aux]{\siunitx_number_process_zero_fill_aux:nn}
-% Checks for adding zeros to each component are carried out. The nesting
+%\begin{macro}[aux]{
+% \siunitx_number_process_zero_fill_aux:n ,
+% \siunitx_number_process_zero_fill_aux:nn ,
+%}
+% Checks for adding zeros to each component are carried out. The nesting
% here makes checking the appropriate flag a little more efficient.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_process_zero_fill: {
@@ -7982,44 +8628,45 @@ This work consists of the file siunitx.dtx
\siunitx_number_process_zero_fill_aux:n { decimal }
}
\cs_new_nopar:Npn \siunitx_number_process_zero_fill_aux:n #1 {
- \bool_if:cT { l_siunitx_process_ #1 _zero_bool }
+ \bool_if:cT { l_siunitx_process_ #1 _zero_bool }
{
\siunitx_number_process_zero_fill_aux:nn { mantissa } {#1}
\siunitx_number_process_zero_fill_aux:nn { complex } {#1}
\siunitx_number_process_zero_fill_aux:nn { exponent } {#1}
}
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_process_zero_fill_aux:nn #1#2 {
- \prop_if_in:NnT \l_siunitx_number_in_prop { #1 -decimal-marker }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { #1 -decimal-marker }
{
- \prop_if_in:NnF \l_siunitx_number_in_prop { #1 - #2 }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { #1 - #2 }
{ \prop_put:Nnn \l_siunitx_number_in_prop { #1 - #2 } { 0 } }
}
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\subsection{Formatting numbers for output}
%
% Getting numbers ready for printing requires the reconstruction of the
% number from the various parts processed earlier. Spaces and brackets
-% are added back into the main numbers, as the various parts are also
+% are added back into the main numbers, as the various parts are also
% correctly formatted. The difference between the \texttt{in} and
-% \texttt{out} store is that the later can include formatting such as
+% \texttt{out} store is that the later can include formatting such as
% hard spaces.
-%
+%
%\begin{macro}{\l_siunitx_number_out_prop}
% Like the \texttt{in} version!
% \begin{macrocode}
\prop_new:N \l_siunitx_number_out_prop
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%
-%\begin{macro}{\l_siunitx_group_sep_tl}
-%\begin{macro}{\l_siunitx_output_decimal_tl}
+%\begin{macro}{
+% \l_siunitx_group_sep_tl ,
+% \l_siunitx_output_decimal_tl ,
+%}
% A couple of variables are declared here, as they need a little more
% work than just storage.
% \begin{macrocode}
@@ -8027,7 +8674,6 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_output_decimal_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\l_siunitx_complex_after_bool}
% A setting for where complex numbers go.
@@ -8036,28 +8682,34 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_brackets_bool}
-%\begin{macro}{\l_siunitx_bracket_close_tl}
-%\begin{macro}{\l_siunitx_output_complex_copy_bool}
-%\begin{macro}{\l_siunitx_output_decimal_copy_bool}
-%\begin{macro}{\l_siunitx_exponent_base_tl}
-%\begin{macro}{\l_siunitx_exponent_product_tl}
-%\begin{macro}{\l_siunitx_group_decimal_bool}
-%\begin{macro}{\l_siunitx_group_four_bool}
-%\begin{macro}{\l_siunitx_group_integer_bool}
-%\begin{macro}{\l_siunitx_negative_color_tl}
-%\begin{macro}{\l_siunitx_bracket_open_tl}
-%\begin{macro}{\l_siunitx_output_uncert_close_tl}
-%\begin{macro}{\l_siunitx_output_complex_tl}
-%\begin{macro}{\l_siunitx_output_uncert_open_tl}
-%\begin{macro}{\l_siunitx_uncert_sep_bool}
-%\begin{macro}{\l_siunitx_tight_bool}
-%\begin{macro}{\l_siunitx_uncert_sep_tl}
+%\begin{macro}{
+% \l_siunitx_negative_bracket_bool ,
+% \l_siunitx_brackets_bool ,
+% \l_siunitx_bracket_close_tl ,
+% \l_siunitx_output_complex_copy_bool ,
+% \l_siunitx_output_decimal_copy_bool ,
+% \l_siunitx_exponent_base_tl ,
+% \l_siunitx_exponent_product_tl ,
+% \l_siunitx_group_decimal_bool ,
+% \l_siunitx_group_four_bool ,
+% \l_siunitx_group_integer_bool ,
+% \l_siunitx_negative_color_tl ,
+% \l_siunitx_bracket_open_tl ,
+% \l_siunitx_output_uncert_close_tl ,
+% \l_siunitx_output_complex_tl ,
+% \l_siunitx_output_exponent_tl ,
+% \l_siunitx_output_uncert_open_tl ,
+% \l_siunitx_uncert_sep_bool ,
+% \l_siunitx_tight_bool ,
+% \l_siunitx_uncert_sep_tl ,
+%}
% Lots of settings, some used only for numbers, some more widely.
% \begin{macrocode}
\keys_define:nn { siunitx } {
+ bracket-negative-numbers .bool_set:N =
+ \l_siunitx_negative_bracket_bool ,
bracket-numbers .bool_set:N = \l_siunitx_brackets_bool,
- close-bracket .tl_set:N = \l_siunitx_bracket_close_tl,
+ close-bracket .tl_set:N = \l_siunitx_bracket_close_tl,
complex-root-position .choice:,
complex-root-position
/ after-number .code:n =
@@ -8065,43 +8717,44 @@ This work consists of the file siunitx.dtx
complex-root-position
/ before-number .code:n =
{ \bool_set_false:N \l_siunitx_complex_after_bool } ,
- copy-complex-root .bool_set:N =
+ copy-complex-root .bool_set:N =
\l_siunitx_output_complex_copy_bool,
- copy-decimal-marker .bool_set:N =
+ copy-decimal-marker .bool_set:N =
\l_siunitx_output_decimal_copy_bool,
exponent-base .tl_set:N = \l_siunitx_exponent_base_tl,
- exponent-product .tl_set:N =
+ exponent-product .tl_set:N =
\l_siunitx_exponent_product_tl,
- group-decimal-digits .bool_set:N =
+ group-decimal-digits .bool_set:N =
\l_siunitx_group_decimal_bool,
- group-digits .meta:n =
+ group-digits .meta:n =
{
group-decimal-digits = #1,
group-integer-digits = #1
},
group-four-digits .bool_set:N = \l_siunitx_group_four_bool,
- group-integer-digits .bool_set:N =
+ group-integer-digits .bool_set:N =
\l_siunitx_group_integer_bool,
- group-separator .code:n =
+ group-separator .code:n =
{
\tl_set:Nn \l_siunitx_group_sep_tl { {#1} }
},
negative-color .tl_set:N = \l_siunitx_negative_color_tl,
- open-bracket .tl_set:N = \l_siunitx_bracket_open_tl,
- output-close-uncertainty .tl_set:N =
+ open-bracket .tl_set:N = \l_siunitx_bracket_open_tl,
+ output-close-uncertainty .tl_set:N =
\l_siunitx_output_uncert_close_tl,
output-complex-root .tl_set:N = \l_siunitx_output_complex_tl ,
- output-decimal-marker .code:n =
+ output-decimal-marker .code:n =
{
\tl_set:Nn \l_siunitx_output_decimal_tl { {#1} }
},
- output-open-uncertainty .tl_set:N =
- \l_siunitx_output_uncert_open_tl,
+ output-exponent-marker .tl_set:N = \l_siunitx_output_exponent_tl,
+ output-open-uncertainty .tl_set:N =
+ \l_siunitx_output_uncert_open_tl,
separate-uncertainty .bool_set:N = \l_siunitx_uncert_sep_bool,
tight-spacing .bool_set:N = \l_siunitx_tight_bool,
uncertainty-separator .tl_set:N = \l_siunitx_uncert_sep_tl,
}
-\keys_set:nn { siunitx } {
+\keys_set:nn { siunitx } {
bracket-numbers = true, % (
close-bracket = ),
complex-root-position = after-number,
@@ -8118,30 +8771,14 @@ This work consists of the file siunitx.dtx
output-open-uncertainty = (, % )
}
% \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}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_format:}
% The master control function for formatting output: the usual set up.
-% The number is put back together in stages.
+% The number is put back together in stages.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format: {
- \prop_if_empty:NF \l_siunitx_number_in_prop
+ \prop_if_empty:NF \l_siunitx_number_in_prop
{
\prop_clear:N \l_siunitx_number_out_prop
\siunitx_number_format_reassemble:
@@ -8157,15 +8794,15 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_format_brackets:n}
-%\begin{macro}{\siunitx_number_format_brackets_aux:n}
+%\begin{macro}[aux]{\siunitx_number_format_brackets_aux:n}
% There are various points at which brackets might be added to
% avoid ambiguity. The function here adds the appropriate tokens
% around whatever is in the supplied named store.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_brackets:n #1 {
- \bool_if:NT \l_siunitx_brackets_bool
+ \bool_if:NT \l_siunitx_brackets_bool
{
- \prop_if_in:NnT \l_siunitx_number_out_prop { #1 -bracket }
+ \prop_if_in:NnT \l_siunitx_number_out_prop { #1 -bracket }
{
\siunitx_number_format_brackets_aux:n {#1}
\prop_del:Nn \l_siunitx_number_out_prop { #1 -bracket }
@@ -8173,20 +8810,20 @@ This work consists of the file siunitx.dtx
}
}
\cs_new_protected_nopar:Npn \siunitx_number_format_brackets_aux:n #1 {
- \prop_get:NnN \l_siunitx_number_out_prop { #1 -result }
+ \prop_get:NnN \l_siunitx_number_out_prop { #1 -result }
\l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
{
\prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
}
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
\l_siunitx_bracket_open_tl
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
\l_siunitx_bracket_close_tl
- \str_if_eq:nnTF {#1} { result }
+ \str_if_eq:nnTF {#1} { result }
{ \prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl }
{
- \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
\l_siunitx_tmpa_tl
}
}
@@ -8195,12 +8832,12 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_format_color:}
-%\begin{macro}{\siunitx_number_format_color_aux:n}
+%\begin{macro}[aux]{\siunitx_number_format_color_aux:n}
% If the mantissa is negative, then any colour for output might change.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_color: {
- \tl_if_empty:NF \l_siunitx_negative_color_tl
- {
+ \tl_if_empty:NF \l_siunitx_negative_color_tl
+ {
\siunitx_number_format_color_aux:n { mantissa-sign }
\siunitx_number_format_color_aux:n { sign }
}
@@ -8211,7 +8848,7 @@ This work consists of the file siunitx.dtx
{
\str_if_eq:VnT \l_siunitx_tmpa_tl { - }
{
- \prop_put:NnV \l_siunitx_number_out_prop { color }
+ \prop_put:NnV \l_siunitx_number_out_prop { color }
\l_siunitx_negative_color_tl
}
}
@@ -8221,31 +8858,33 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_number_format_complex:}
-%\begin{macro}[aux]{\siunitx_number_format_complex_aux:n}
-%\begin{macro}[aux]{\siunitx_number_format_complex_aux:}
-% The real and complex parts of each number are reassembled, with
+%\begin{macro}[aux]{
+% \siunitx_number_format_complex_aux:n ,
+% \siunitx_number_format_complex_aux: ,
+%}
+% The real and complex parts of each number are reassembled, with
% brackets if needed.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_complex: {
- \prop_if_in:NnT \l_siunitx_number_in_prop { complex-root }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { complex-root }
{
\prop_if_in:NnTF \l_siunitx_number_out_prop { complex }
{
\siunitx_number_format_brackets:n { complex }
\siunitx_number_format_complex_aux:n { complex }
\siunitx_number_format_complex_aux:n { complex-result }
- \prop_if_in:NnT \l_siunitx_number_out_prop
+ \prop_if_in:NnT \l_siunitx_number_out_prop
{ complex-uncertainty }
- {
- \siunitx_number_format_complex_aux:n
- { complex-uncertainty }
- }
+ {
+ \siunitx_number_format_complex_aux:n
+ { complex-uncertainty }
+ }
}
{
\tl_set:Nx \l_siunitx_tmpa_tl
- {
- \exp_not:N \siunitx_ensuremath:n
- { \exp_not:V \l_siunitx_output_complex_tl }
+ {
+ \exp_not:N \siunitx_ensuremath:n
+ { \exp_not:V \l_siunitx_output_complex_tl }
}
\prop_put:NnV \l_siunitx_number_out_prop { complex }
\l_siunitx_tmpa_tl
@@ -8258,11 +8897,11 @@ This work consists of the file siunitx.dtx
\prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
\bool_if:NTF \l_siunitx_complex_after_bool
{
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
\l_siunitx_tmpa_tl
}
{
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
\l_siunitx_tmpa_tl
}
\prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
@@ -8270,31 +8909,32 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_number_format_complex_aux: {
\tl_set:Nn \l_siunitx_tmpa_tl
{
- \use:c
+ \use:c
{
- siunitx_ \l_siunitx_print_type_tl _
+ siunitx_ \l_siunitx_print_type_tl _
math \l_siunitx_font_family_tl :n
}
}
\bool_if:NTF \l_siunitx_output_complex_copy_bool
- {
- \prop_get:NnN \l_siunitx_number_in_prop { complex-root }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-root }
\l_siunitx_tmpb_tl
- \tl_put_right:Nx \l_siunitx_tmpa_tl
+ \tl_put_right:Nx \l_siunitx_tmpa_tl
{ { \exp_not:V \l_siunitx_tmpb_tl } }
}
{
- \tl_put_right:Nx \l_siunitx_tmpa_tl
+ \tl_put_right:Nx \l_siunitx_tmpa_tl
{ { \exp_not:V \l_siunitx_output_complex_tl } }
}
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_number_format_copy:n}
-%\begin{macro}{\siunitx_number_format_copy:nn}
+%\begin{macro}{
+% \siunitx_number_format_copy:n ,
+% \siunitx_number_format_copy:nn ,
+%}
% Just copy across.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_copy:n #1 {
@@ -8307,40 +8947,39 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_format_final:}
% For numbers which do not contain an exponent, the mantissa result is
% simply copied to the final output position. On the other hand, for
% exponents there are further checks, which are handed off to dedicated
% functions. There is also a check for complex numbers with no real
-% part, which needs to be \enquote{copied} to the standard result
+% part, which needs to be \enquote{copied} to the standard result
% slot.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_final: {
\prop_if_in:NnT \l_siunitx_number_out_prop { complex }
{
\prop_if_in:NnF \l_siunitx_number_out_prop { mantissa-result }
- {
- \siunitx_number_format_copy:nn { complex }
- { mantissa-result }
+ {
+ \siunitx_number_format_copy:nn { complex }
+ { mantissa-result }
}
}
\prop_if_in:NnTF \l_siunitx_number_out_prop { exponent }
{
\siunitx_number_format_final_exponent:
- \prop_if_in:NnTF \l_siunitx_number_out_prop { mantissa-result }
+ \prop_if_in:NnTF \l_siunitx_number_out_prop { mantissa-result }
{ \siunitx_number_format_final_combined: }
{ \siunitx_number_format_final_exponent_only: }
}
{ \siunitx_number_format_copy:nn { mantissa-result } { result } }
- \prop_if_in:NnT \l_siunitx_number_out_prop { mantissa-bracket }
+ \prop_if_in:NnT \l_siunitx_number_out_prop { mantissa-bracket }
{
- \prop_put:Nnn \l_siunitx_number_out_prop { result-bracket }
+ \prop_put:Nnn \l_siunitx_number_out_prop { result-bracket }
{ true }
- \prop_del:Nn \l_siunitx_number_out_prop { mantissa-bracket }
+ \prop_del:Nn \l_siunitx_number_out_prop { mantissa-bracket }
}
- \prop_if_in:NnT \l_siunitx_number_out_prop { comparator }
+ \prop_if_in:NnT \l_siunitx_number_out_prop { comparator }
{
\siunitx_number_format_brackets:n { result }
\prop_get:NnN \l_siunitx_number_out_prop { comparator }
@@ -8349,7 +8988,7 @@ This work consists of the file siunitx.dtx
\l_siunitx_tmpb_tl
\tl_put_right:No \l_siunitx_tmpa_tl { \l_siunitx_tmpb_tl }
\prop_put:NnV \l_siunitx_number_out_prop { result }
- \l_siunitx_tmpa_tl
+ \l_siunitx_tmpa_tl
}
}
% \end{macrocode}
@@ -8363,63 +9002,72 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_final_combined: {
\siunitx_number_format_brackets:n { mantissa }
- \prop_get:NnN \l_siunitx_number_out_prop { mantissa-result }
+ \prop_get:NnN \l_siunitx_number_out_prop { mantissa-result }
\l_siunitx_tmpa_tl
- \bool_if:NTF \l_siunitx_tight_bool
- {
- \tl_set:Nx \l_siunitx_tmpb_tl
- { { \exp_not:V \l_siunitx_exponent_product_tl } }
- }
- {
- \tl_set:Nx \l_siunitx_tmpb_tl
- { { } \exp_not:V \l_siunitx_exponent_product_tl { } }
+ \tl_if_empty:NT \l_siunitx_output_exponent_tl
+ {
+ \bool_if:NTF \l_siunitx_tight_bool
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { { \exp_not:V \l_siunitx_exponent_product_tl } }
+ }
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { { } \exp_not:V \l_siunitx_exponent_product_tl { } }
+ }
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
+ \l_siunitx_tmpb_tl
}
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_tmpb_tl
- \prop_get:NnN \l_siunitx_number_out_prop { exponent-result }
+ \prop_get:NnN \l_siunitx_number_out_prop { exponent-result }
\l_siunitx_tmpb_tl
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop { result }
+ \prop_put:NnV \l_siunitx_number_out_prop { result }
\l_siunitx_tmpa_tl
- \prop_put:Nnn \l_siunitx_number_out_prop
+ \prop_put:Nnn \l_siunitx_number_out_prop
{ result-bracket-exponent } { true }
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\siunitx_number_format_final_exponent:}
% When there is an exponent, the base always needs to be added to the
-% front of the number itself. The number must be superscripted, of
+% front of the number itself. The number must be superscripted, of
% course.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_final_exponent: {
- \prop_get:NnN \l_siunitx_number_out_prop { exponent }
+ \prop_get:NnN \l_siunitx_number_out_prop { exponent }
\l_siunitx_tmpa_tl
- \tl_set:Nx \l_siunitx_tmpa_tl
- { ^ { \exp_not:V \l_siunitx_tmpa_tl } }
- \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_exponent_base_tl
- \prop_put:NnV \l_siunitx_number_out_prop { exponent-result }
+ \tl_if_empty:NTF \l_siunitx_output_exponent_tl
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { ^ { \exp_not:V \l_siunitx_tmpa_tl } }
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_exponent_base_tl
+ }
+ {
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_output_exponent_tl
+ }
+ \prop_put:NnV \l_siunitx_number_out_prop { exponent-result }
\l_siunitx_tmpa_tl
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\siunitx_number_format_final_exponent_only:}
-% When there is only an exponent, a check must be made for a
+% When there is only an exponent, a check must be made for a
% sign in the mantissa part. If there is one, it is copied across.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_format_final_exponent_only: {
\prop_get:NnN \l_siunitx_number_in_prop { mantissa-sign }
\l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
- {
- \bool_if:NT \l_siunitx_tight_bool
- {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ {
+ \bool_if:NT \l_siunitx_tight_bool
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ { \exp_not:V \l_siunitx_tmpa_tl } }
}
\prop_get:NnN \l_siunitx_number_out_prop { exponent-result }
\l_siunitx_tmpb_tl
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
\l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_out_prop { exponent-result }
\l_siunitx_tmpb_tl
@@ -8437,61 +9085,63 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_number_format_group:n #1 {
\siunitx_number_format_group_aux:nn {#1} { integer }
\siunitx_number_format_group_aux:nn {#1} { decimal }
- \prop_if_in:NnTF \l_siunitx_number_out_prop { #1 -integer }
+ \prop_if_in:NnTF \l_siunitx_number_out_prop { #1 -integer }
{ \siunitx_number_format_copy:nn { #1 -integer } {#1} }
{ \tl_clear:N \l_siunitx_tmpa_tl }
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal-marker }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal-marker }
\l_siunitx_tmpb_tl
- \quark_if_no_value:NF \l_siunitx_tmpb_tl
+ \quark_if_no_value:NF \l_siunitx_tmpb_tl
{
\bool_if:NTF \l_siunitx_output_decimal_copy_bool
{ \tl_set:Nx \l_siunitx_tmpb_tl { { \l_siunitx_tmpb_tl } } }
{
- \tl_set_eq:NN \l_siunitx_tmpb_tl
+ \tl_set_eq:NN \l_siunitx_tmpb_tl
\l_siunitx_output_decimal_tl
}
- \tl_set:Nx \l_siunitx_tmpb_tl
- {
- \exp_not:N \siunitx_ensuremath:n
- { \exp_not:V \l_siunitx_tmpb_tl }
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ {
+ \exp_not:N \siunitx_ensuremath:n
+ { \exp_not:V \l_siunitx_tmpb_tl }
}
- \tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
+ \tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
\prop_put:NnV \l_siunitx_number_out_prop { #1 -decimal-marker }
\l_siunitx_tmpb_tl
- \prop_get:NnN \l_siunitx_number_out_prop { #1 -decimal }
+ \prop_get:NnN \l_siunitx_number_out_prop { #1 -decimal }
\l_siunitx_tmpb_tl
- \quark_if_no_value:NT \l_siunitx_tmpb_tl
+ \quark_if_no_value:NT \l_siunitx_tmpb_tl
{ \tl_clear:N \l_siunitx_tmpb_tl }
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
\prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
}
}
\cs_new_protected_nopar:Npn \siunitx_number_format_group_aux:nn #1#2 {
- \prop_if_in:NnT \l_siunitx_number_in_prop { #1 - #2 }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { #1 - #2 }
{
- \prop_if_in:NnTF \l_siunitx_number_in_prop { symbolic }
+ \prop_if_in:NnTF \l_siunitx_number_in_prop { symbolic }
{ \siunitx_number_format_copy:n { #1 - #2 } }
{
- \bool_if:cTF { l_siunitx_group_ #2 _bool }
+ \bool_if:cTF { l_siunitx_group_ #2 _bool }
{ \siunitx_number_format_group_four:nn {#1} {#2} }
{ \siunitx_number_format_copy:n { #1 - #2 } }
- }
+ }
}
}
% \end{macrocode}
%\end{macro}
%\end{macro}
%\begin{macro}{\siunitx_number_format_group_four:nn}
-%\begin{macro}[aux]{\siunitx_number_format_group_four_aux:NNNNNNw}
-%\begin{macro}[aux]{\siunitx_number_format_group_four_aux:nn}
-% The idea here is that grouping is only needed for items with at
-% least four tokens in them, and perhaps five if the grouping of
+%\begin{macro}[aux]{
+% \siunitx_number_format_group_four_aux:NNNNNNw ,
+% \siunitx_number_format_group_four_aux:nn ,
+%}
+% The idea here is that grouping is only needed for items with at
+% least four tokens in them, and perhaps five if the grouping of
% four-digit numbers is turned off.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_group_four:nn #1#2 {
- \prop_get:NnN \l_siunitx_number_in_prop { #1 - #2 }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 - #2 }
\l_siunitx_tmpa_tl
- \bool_if:NTF \l_siunitx_group_four_bool
+ \bool_if:NTF \l_siunitx_group_four_bool
{ \siunitx_number_format_group_four_aux:nn {#1} {#2} }
{
\exp_last_unbraced:NV
@@ -8499,24 +9149,23 @@ This work consists of the file siunitx.dtx
\l_siunitx_tmpa_tl \q_no_value \q_no_value \q_no_value
\q_no_value \q_no_value \q_stop
{ \siunitx_number_format_copy:n {#1 - #2} }
- { \siunitx_number_format_group_four_aux:nn {#1} {#2} }
+ { \siunitx_number_format_group_four_aux:nn {#1} {#2} }
}
}
-\cs_new_protected:Npn \siunitx_number_format_group_four_aux:NNNNNNw
+\cs_new_protected:Npn \siunitx_number_format_group_four_aux:NNNNNNw
#1#2#3#4#5#6 \q_stop {
\quark_if_no_value:NTF #5
}
-\cs_new_protected_nopar:Npn \siunitx_number_format_group_four_aux:nn
+\cs_new_protected_nopar:Npn \siunitx_number_format_group_four_aux:nn
#1#2 {
\tl_clear:N \l_siunitx_tmpb_tl
\use:c { siunitx_number_format_group_ #2 : }
- \prop_put:NnV \l_siunitx_number_out_prop { #1 - #2 }
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 - #2 }
\l_siunitx_tmpb_tl
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%\begin{macro}{\siunitx_number_format_group_decimal:}
%\begin{macro}[aux]{\siunitx_number_format_group_decimal_aux:}
% Using the \enquote{keep everything on the stack} approach, relatively
@@ -8524,25 +9173,25 @@ This work consists of the file siunitx.dtx
% from \pkg{numprint}.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_group_decimal: {
- \tl_if_empty:NF \l_siunitx_tmpa_tl
- {
+ \tl_if_empty:NF \l_siunitx_tmpa_tl
+ {
\exp_last_unbraced:NV
- \siunitx_number_format_group_decimal_aux:NNNN
+ \siunitx_number_format_group_decimal_aux:NNNN
\l_siunitx_tmpa_tl { } { } { }
}
}
-\cs_new_protected:Npn \siunitx_number_format_group_decimal_aux:NNNN
+\cs_new_protected:Npn \siunitx_number_format_group_decimal_aux:NNNN
#1#2#3#4 {
- \tl_if_empty:nTF {#2}
+ \tl_if_empty:nTF {#2}
{ \tl_put_right:Nn \l_siunitx_tmpb_tl {#1} }
{
- \tl_if_empty:nTF {#3}
+ \tl_if_empty:nTF {#3}
{ \tl_put_right:Nn \l_siunitx_tmpb_tl { #1 #2 } }
{
\tl_put_right:Nn \l_siunitx_tmpb_tl { #1 #2 #3 }
- \tl_if_empty:nF {#4}
+ \tl_if_empty:nF {#4}
{
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
\l_siunitx_group_sep_tl
\siunitx_number_format_group_decimal_aux:NNNN #4
}
@@ -8553,54 +9202,56 @@ This work consists of the file siunitx.dtx
%\end{macro}
%\end{macro}
%\begin{macro}{\siunitx_number_format_group_integer:}
-%\begin{macro}[aux]{\siunitx_number_format_group_integer_setup:n}
-%\begin{macro}[aux]{\siunitx_number_format_group_integer_setup:V}
-%\begin{macro}[aux]{\siunitx_number_format_group_integer_setup_aux:NNNN}
-%\begin{macro}[aux]{\siunitx_number_format_group_integer_aux:NNNN}
-% By keeping everything on the stack, recursion can occur quite
+%\begin{macro}[aux]{
+% \siunitx_number_format_group_integer_setup:n ,
+% \siunitx_number_format_group_integer_setup:V ,
+% \siunitx_number_format_group_integer_setup_aux:NNNN ,
+% \siunitx_number_format_group_integer_aux:NNNN ,
+%}
+% By keeping everything on the stack, recursion can occur quite
% efficiently here.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_group_integer: {
- \tl_if_empty:NF \l_siunitx_tmpa_tl
- {
+ \tl_if_empty:NF \l_siunitx_tmpa_tl
+ {
\siunitx_number_format_group_integer_setup:V \l_siunitx_tmpa_tl
}
}
\cs_new_protected:Npn \siunitx_number_format_group_integer_setup:n #1 {
- \siunitx_number_format_group_integer_setup_aux:NNNN
+ \siunitx_number_format_group_integer_setup_aux:NNNN
{ } #1 { } { } { }
}
-\cs_generate_variant:Nn \siunitx_number_format_group_integer_setup:n
+\cs_generate_variant:Nn \siunitx_number_format_group_integer_setup:n
{ V }
-\cs_new_protected:Npn
+\cs_new_protected:Npn
\siunitx_number_format_group_integer_setup_aux:NNNN #1#2#3#4 {
- \tl_if_empty:nTF {#2}
+ \tl_if_empty:nTF {#2}
{ \siunitx_number_format_group_integer_aux:NNNN #1 \q_nil }
{
- \tl_if_empty:nTF {#3}
+ \tl_if_empty:nTF {#3}
{
- \siunitx_number_format_group_integer_aux:NNNN { } { } #1#2
+ \siunitx_number_format_group_integer_aux:NNNN { } { } #1#2
\q_nil
}
{
- \tl_if_empty:nTF {#4}
+ \tl_if_empty:nTF {#4}
{
\siunitx_number_format_group_integer_aux:NNNN { } #1#2#3
\q_nil
}
{
- \siunitx_number_format_group_integer_setup_aux:NNNN
+ \siunitx_number_format_group_integer_setup_aux:NNNN
{#1#2#3#4}
}
}
- }
+ }
}
-\cs_new_protected:Npn
+\cs_new_protected:Npn
\siunitx_number_format_group_integer_aux:NNNN #1#2#3#4 {
\tl_put_right:Nn \l_siunitx_tmpb_tl {#1#2#3}
- \quark_if_nil:nF {#4}
+ \quark_if_nil:nF {#4}
{
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpb_tl
\l_siunitx_group_sep_tl
\siunitx_number_format_group_integer_aux:NNNN #4
}
@@ -8608,39 +9259,38 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_format_join_complex:}
% For adding the complex part to the main part of a number.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_join_complex: {
\siunitx_number_format_sign_complex:
- \prop_if_in:NnT \l_siunitx_number_out_prop { mantissa }
+ \prop_if_in:NnT \l_siunitx_number_out_prop { mantissa }
{
\siunitx_number_format_brackets:n { mantissa }
- \prop_get:NnN \l_siunitx_number_out_prop { mantissa-result }
- \l_siunitx_tmpa_tl
+ \prop_get:NnN \l_siunitx_number_out_prop { mantissa-result }
+ \l_siunitx_tmpa_tl
\prop_get:NnN \l_siunitx_number_out_prop { complex-result }
\l_siunitx_tmpb_tl
\quark_if_no_value:NT \l_siunitx_tmpb_tl
{
\prop_get:NnN \l_siunitx_number_out_prop { complex }
\l_siunitx_tmpb_tl
- }
+ }
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop { mantissa-result }
+ \prop_put:NnV \l_siunitx_number_out_prop { mantissa-result }
\l_siunitx_tmpa_tl
- \prop_put:Nnn \l_siunitx_number_out_prop { mantissa-bracket }
+ \prop_put:Nnn \l_siunitx_number_out_prop { mantissa-bracket }
{ true }
}
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_number_format_join_uncert:}
-%\begin{macro}{\siunitx_number_format_join_uncert:n}
+%\begin{macro}{
+% \siunitx_number_format_join_uncert: ,
+% \siunitx_number_format_join_uncert:n ,
+%}
%\begin{macro}[aux]{\siunitx_number_format_join_uncert_pm:}
% For adding separated uncertainties to the main part of a number.
% \begin{macrocode}
@@ -8649,60 +9299,59 @@ This work consists of the file siunitx.dtx
\siunitx_number_format_join_uncert:n { complex }
}
\cs_new_protected_nopar:Npn \siunitx_number_format_join_uncert:n #1 {
- \prop_get:NnN \l_siunitx_number_out_prop {#1}
+ \prop_get:NnN \l_siunitx_number_out_prop {#1}
\l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
{
\prop_get:NnN \l_siunitx_number_out_prop { #1 -uncertainty }
\l_siunitx_tmpb_tl
- \quark_if_no_value:NTF \l_siunitx_tmpb_tl
- { \siunitx_number_format_copy:nn {#1} { #1 -result } }
+ \quark_if_no_value:NTF \l_siunitx_tmpb_tl
+ { \siunitx_number_format_copy:nn {#1} { #1 -result } }
{
\bool_if:NT \l_siunitx_uncert_sep_bool
{ \siunitx_number_format_join_uncert_pm: }
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
\l_siunitx_tmpa_tl
- \prop_put:Nnn \l_siunitx_number_out_prop { #1 -bracket }
+ \prop_put:Nnn \l_siunitx_number_out_prop { #1 -bracket }
{ true }
}
}
}
\cs_new_protected_nopar:Npn \siunitx_number_format_join_uncert_pm: {
- \bool_if:NTF \l_siunitx_tight_bool
- {
- \tl_put_left:Nn \l_siunitx_tmpb_tl
- { \siunitx_ensuremath:n { { \pm } } }
+ \bool_if:NTF \l_siunitx_tight_bool
+ {
+ \tl_put_left:Nn \l_siunitx_tmpb_tl
+ { \siunitx_ensuremath:n { { \pm } } }
}
- {
- \tl_put_left:Nn \l_siunitx_tmpb_tl
+ {
+ \tl_put_left:Nn \l_siunitx_tmpb_tl
{ \siunitx_ensuremath:n { { } \pm { } } }
}
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_format_reassemble:}
-% The integer, decimal and any non-separated uncertainty parts are
+% The integer, decimal and any non-separated uncertainty parts are
% put back together. This gives a \enquote{minimal} unit which cannot
-% need any brackets or repeated units (if applicable). If the
-% uncertainty is separate, it is stored at this stage pending later
+% need any brackets or repeated units (if applicable). If the
+% uncertainty is separate, it is stored at this stage pending later
% re-attachment.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_reassemble: {
- \prop_if_in:NnT \l_siunitx_number_in_prop { mantissa }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { mantissa }
{
\siunitx_number_format_group:n { mantissa }
\siunitx_number_format_uncertainty:n { mantissa }
}
- \prop_if_in:NnT \l_siunitx_number_in_prop { complex }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { complex }
{
\siunitx_number_format_group:n { complex }
\siunitx_number_format_uncertainty:n { complex }
}
- \prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
+ \prop_if_in:NnT \l_siunitx_number_in_prop { exponent }
{ \siunitx_number_format_group:n { exponent } }
}
% \end{macrocode}
@@ -8718,72 +9367,100 @@ This work consists of the file siunitx.dtx
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
\tl_set:Nx \l_siunitx_tmpa_tl
- {
+ {
\exp_not:N \ensuremath
{ \exp_not:V \l_siunitx_tmpa_tl }
}
\prop_put:NnV \l_siunitx_number_out_prop { comparator }
\l_siunitx_tmpa_tl
- }
+ }
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_number_format_sign:n}
-%\begin{macro}{\siunitx_number_format_sign_complex:}
-%\begin{macro}[aux]{\siunitx_number_format_sign_complex:n}
+%\begin{macro}{
+% \siunitx_number_format_sign:n ,
+% \siunitx_number_format_sign_complex: ,
+%}
+%\begin{macro}[aux]{
+% \siunitx_number_format_sign_aux:n ,
+% \siunitx_number_format_sign_negative_brackets:n ,
+% \siunitx_number_format_sign_complex:n ,
+%}
% Some simple sign manipulation: for tight signs, a little shuffling.
% In the complex number case, there is a need for a correction to get
% the right formatting in text mode. For speed reasons, this is done in
% a separate function.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_sign:n #1 {
- \prop_if_in:NnT \l_siunitx_number_out_prop {#1}
+ \prop_if_in:NnT \l_siunitx_number_out_prop {#1}
{
- \prop_get:NnN \l_siunitx_number_in_prop { #1 -sign }
+ \prop_get:NnN \l_siunitx_number_in_prop { #1 -sign }
\l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \bool_if:NT \l_siunitx_tight_bool
+ \bool_if:NTF \l_siunitx_negative_bracket_bool
{
- \tl_set:Nx \l_siunitx_tmpa_tl
- { { \exp_not:V \l_siunitx_tmpa_tl } }
+ \str_if_eq:VnTF \l_siunitx_tmpa_tl { - }
+ { \siunitx_number_format_sign_negative_brackets:n {#1} }
+ { \siunitx_number_format_sign_aux:n {#1} }
}
- \tl_clear:N \l_siunitx_tmpb_tl
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
- \l_siunitx_tmpa_tl
- \prop_put:NnV \l_siunitx_number_out_prop { #1 -sign }
- \l_siunitx_tmpb_tl
- \prop_get:NnN \l_siunitx_number_out_prop {#1}
- \l_siunitx_tmpa_tl
- \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop {#1}
- \l_siunitx_tmpa_tl
- \prop_get:NnN \l_siunitx_number_out_prop { #1 -result }
- \l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
- {
- \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
- \l_siunitx_tmpa_tl
- }
- }
+ { \siunitx_number_format_sign_aux:n {#1} }
+ }
+ }
+}
+\cs_new_protected_nopar:Npn \siunitx_number_format_sign_aux:n #1 {
+ \bool_if:NT \l_siunitx_tight_bool
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { { \exp_not:V \l_siunitx_tmpa_tl } }
+ }
+ \tl_clear:N \l_siunitx_tmpb_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 -sign }
+ \l_siunitx_tmpb_tl
+ \prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
+ \prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
+ \prop_get:NnN \l_siunitx_number_out_prop { #1 -result }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ {
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
+ \l_siunitx_tmpa_tl
}
}
+\cs_new_protected_nopar:Npn
+ \siunitx_number_format_sign_negative_brackets:n #1
+ {
+ \siunitx_number_format_brackets_aux:n {#1}
+ \prop_get:NnN \l_siunitx_number_out_prop { #1 }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ {
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
+ \l_siunitx_bracket_open_tl
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
+ \l_siunitx_bracket_close_tl
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 }
+ \l_siunitx_tmpa_tl
+ }
+ }
\cs_new_protected_nopar:Npn \siunitx_number_format_sign_complex: {
\siunitx_number_format_sign_complex:n { complex }
\siunitx_number_format_sign_complex:n { complex-result }
}
\cs_new_protected_nopar:Npn \siunitx_number_format_sign_complex:n #1 {
- \prop_if_in:NnT \l_siunitx_number_out_prop {#1}
+ \prop_if_in:NnT \l_siunitx_number_out_prop {#1}
{
- \prop_get:NnN \l_siunitx_number_in_prop { complex-sign }
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-sign }
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \bool_if:NTF \l_siunitx_tight_bool
+ \bool_if:NTF \l_siunitx_tight_bool
{
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ { \exp_not:V \l_siunitx_tmpa_tl } }
}
{
@@ -8794,45 +9471,46 @@ This work consists of the file siunitx.dtx
}
}
\tl_clear:N \l_siunitx_tmpb_tl
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
+ \l_siunitx_tmpa_tl
+ \prop_put:NnV \l_siunitx_number_out_prop { complex-sign }
+ \l_siunitx_tmpb_tl
+ \prop_get:NnN \l_siunitx_number_out_prop {#1}
+ \l_siunitx_tmpa_tl
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
+ \prop_put:NnV \l_siunitx_number_out_prop {#1}
\l_siunitx_tmpa_tl
- \prop_put:NnV \l_siunitx_number_out_prop { complex-sign }
- \l_siunitx_tmpb_tl
- \prop_get:NnN \l_siunitx_number_out_prop {#1}
- \l_siunitx_tmpa_tl
- \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop {#1}
- \l_siunitx_tmpa_tl
}
}
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_format_uncertainty:n}
-%\begin{macro}{\siunitx_number_format_uncertainty_joined:n}
-%\begin{macro}{\siunitx_number_format_uncertainty_sep:n}
-% Uncertainty output varies depending on whether there is a need to
-% separate the error form the number in the output.
+%\begin{macro}[aux]{
+% \siunitx_number_format_uncertainty_joined:n ,
+% \siunitx_number_format_uncertainty_sep:n ,
+%}
+% Uncertainty output varies depending on whether there is a need to
+% separate the error form the number in the output.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_format_uncertainty:n #1 {
- \prop_if_in:NnTF \l_siunitx_number_in_prop { #1 -uncertainty }
+ \prop_if_in:NnTF \l_siunitx_number_in_prop { #1 -uncertainty }
{
- \bool_if:NTF \l_siunitx_uncert_sep_bool
+ \bool_if:NTF \l_siunitx_uncert_sep_bool
{ \siunitx_number_format_uncertainty_sep:n {#1} }
{ \siunitx_number_format_uncertainty_joined:n {#1} }
\siunitx_number_format_join_uncert:
}
{ \siunitx_number_format_copy:nn {#1} { #1 -result } }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_format_uncertainty_joined:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -uncertainty }
\l_siunitx_tmpa_tl
\prop_del:Nn \l_siunitx_number_in_prop { #1 -uncertainty }
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
\l_siunitx_output_uncert_open_tl
\siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
\l_siunitx_uncert_sep_tl
@@ -8842,14 +9520,14 @@ This work consists of the file siunitx.dtx
\tl_put_right:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
\prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpb_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_number_format_uncertainty_sep:n #1 {
- \prop_if_in:NnT \l_siunitx_number_out_prop { #1 -integer }
+ \prop_if_in:NnT \l_siunitx_number_out_prop { #1 -integer }
{
- \prop_if_in:NnF \l_siunitx_number_out_prop
+ \prop_if_in:NnF \l_siunitx_number_out_prop
{ #1 -uncertainty-integer }
{
- \prop_put:Nnn \l_siunitx_number_out_prop
+ \prop_put:Nnn \l_siunitx_number_out_prop
{ #1 -uncertainty-integer } { 0 }
}
}
@@ -8860,24 +9538,24 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\subsection{Numerical output}
%
% The outer level of number processing for actually printing things.
-%
-%\begin{macro}{\l_siunitx_number_out_tl}
-%\begin{macro}{\l_siunitx_number_out_saved_tl}
+%
+%\begin{macro}{
+% \l_siunitx_number_out_tl ,
+% \l_siunitx_number_out_saved_tl ,
+%}
% The final result, plus a version for loops.
% \begin{macrocode}
\tl_new:N \l_siunitx_number_out_tl
\tl_new:N \l_siunitx_number_out_saved_tl
% \end{macrocode}
-%\end{macro}
-%\end{macro}
+%\end{macro}
%
%\begin{macro}{\l_siunitx_number_fraction_tl}
-% Fractions need to be build separately, so that there is no problem
+% Fractions need to be build separately, so that there is no problem
% with stack order.
% \begin{macrocode}
\tl_new:N \l_siunitx_number_fraction_tl
@@ -8904,21 +9582,23 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_fraction:nn { }
% \end{macrocode}
%\end{macro}
-%
-%\begin{macro}{\l_siunitx_output_quotient_tl}
-%\begin{macro}{\l_siunix_number_parse_bool}
+%
+%\begin{macro}{
+% \l_siunitx_output_quotient_tl ,
+% \l_siunix_number_parse_bool ,
+%}
% Some options related to numbers at the output stage.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- fraction-function .code:n =
+ fraction-function .code:n =
{ \cs_set_eq:NN \siunitx_fraction:nn #1 },
output-product .tl_set:N = \l_siunitx_output_product_tl,
output-quotient .tl_set:N = \l_siunitx_output_quotient_tl,
parse-numbers .bool_set:N = \l_siunitx_number_parse_bool,
quotient-mode .choice:,
- quotient-mode / fraction .code:n =
- { \tl_set:Nn \l_siunitx_quotient_mode_tl { fraction } },
- quotient-mode / symbol .code:n =
+ quotient-mode / fraction .code:n =
+ { \tl_set:Nn \l_siunitx_quotient_mode_tl { fraction } },
+ quotient-mode / symbol .code:n =
{ \tl_set:Nn \l_siunitx_quotient_mode_tl { symbol } },
}
\keys_set:nn { siunitx } {
@@ -8928,32 +9608,32 @@ This work consists of the file siunitx.dtx
parse-numbers = true,
quotient-mode = symbol
}
-% \end{macrocode}
-%\end{macro}
+% \end{macrocode}
%\end{macro}
-%
-%\begin{macro}{\siunitx_number_output:n}
-%\begin{macro}{\siunitx_number_output:V}
+%
+%\begin{macro}{
+% \siunitx_number_output:n ,
+% \siunitx_number_output:V ,
+%}
% The number output system simply sets up for the combined number and
% unit system.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_output:n #1 {
\tl_clear:N \l_siunitx_unit_tl
- \tl_clear:N \l_siunitx_preunit_tl
+ \tl_clear:N \l_siunitx_preunit_tl
\siunitx_combined_output:n {#1}
}
\cs_generate_variant:Nn \siunitx_number_output:n { V }
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_output_bracket:}
% Compound numbers may need brackets adding.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_bracket: {
- \bool_if:NF \l_siunitx_error_bool
+ \bool_if:NF \l_siunitx_error_bool
{
- \bool_if:NT \l_siunitx_number_compound_bool
+ \bool_if:NT \l_siunitx_number_compound_bool
{ \siunitx_number_format_brackets:n { result } }
}
}
@@ -8966,29 +9646,31 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_color: {
\prop_if_in:NnT \l_siunitx_number_out_prop { color }
- {
- \prop_get:NnN \l_siunitx_number_out_prop { color }
+ {
+ \prop_get:NnN \l_siunitx_number_out_prop { color }
\l_siunitx_number_color_tl
- }
+ }
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_number_output_parse:n}
-%\begin{macro}{\siunitx_number_output_parse:V}
+%\begin{macro}{
+% \siunitx_number_output_parse:n ,
+% \siunitx_number_output_parse:V ,
+%}
%\begin{macro}[aux]{\siunitx_number_output_parse_aux:}
% The parsing system just has to check if there are multiple parts to
% worry about.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_number_output_parse:n #1 {
\siunitx_number_preprocess:n {#1}
- \bool_if:NF \l_siunitx_error_bool
- {
- \tl_if_empty:NTF \l_siunitx_number_multi_tl
+ \bool_if:NF \l_siunitx_error_bool
+ {
+ \tl_if_empty:NTF \l_siunitx_number_multi_tl
{ \siunitx_number_output_parse_aux: }
- {
- \use:c
- { siunitx_number_output_ \l_siunitx_number_multi_tl : }
+ {
+ \use:c
+ { siunitx_number_output_ \l_siunitx_number_multi_tl : }
}
}
}
@@ -8997,20 +9679,20 @@ This work consists of the file siunitx.dtx
% There are a few additional tests for printing partwise, as this is
% only needed if there are brackets to add and these are not due to
% an exponent. The test for an exponent is needed as this must force
-% the units to come at the end of the number, and there then have to
+% the units to come at the end of the number, and there then have to
% be brackets in the output if there are any separate parts.
-% \begin{macrocode}
+% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_parse_aux: {
- \siunitx_number_in_parse:V \l_siunitx_number_arg_tl
- \bool_if:NF \l_siunitx_error_bool
+ \siunitx_number_in_parse:V \l_siunitx_number_arg_tl
+ \bool_if:NF \l_siunitx_error_bool
{
\siunitx_number_process:
\siunitx_number_format:
\siunitx_number_output_color:
\bool_if:NTF \l_siunitx_brackets_bool
{ \siunitx_number_output_single: }
- {
- \prop_if_in:NnTF \l_siunitx_number_out_prop
+ {
+ \prop_if_in:NnTF \l_siunitx_number_out_prop
{ result-bracket }
{ \siunitx_number_output_parts: }
{ \siunitx_number_output_single: }
@@ -9020,13 +9702,14 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_output_parts:}
-%\begin{macro}[aux]{\siunitx_number_output_parts_aux:}
-%\begin{macro}[aux]{\siunitx_number_output_parts_aux:n}
-%\begin{macro}[aux]{\siunitx_number_output_parts_print:n}
-% Printing numbers by parts is necessary when there are units to
+%\begin{macro}[aux]{
+% \siunitx_number_output_parts_aux: ,
+% \siunitx_number_output_parts_aux:n ,
+% \siunitx_number_output_parts_print:n ,
+%}
+% Printing numbers by parts is necessary when there are units to
% repeat. That means doing things that have already been done by the
% number formatter again.
% \begin{macrocode}
@@ -9034,32 +9717,32 @@ This work consists of the file siunitx.dtx
\bool_if:nTF
{
\tl_if_empty_p:N \l_siunitx_pre_unit_tl &&
- \tl_if_empty_p:N \l_siunitx_unit_tl
+ \tl_if_empty_p:N \l_siunitx_unit_tl
}
{ \siunitx_number_output_single: }
{ \siunitx_number_output_parts_aux: }
}
\cs_new_protected_nopar:Npn \siunitx_number_output_parts_aux: {
\bool_if:NTF \l_siunitx_multi_repeat_bool
- {
+ {
\prop_if_in:NnT \l_siunitx_number_out_prop { mantissa-result }
{
\siunitx_number_output_parts_aux:n { mantissa }
\siunitx_number_output_parts_aux:n { complex }
}
\prop_get:NnN \l_siunitx_number_out_prop { exponent-result }
- \l_siunitx_tmpa_tl
+ \l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
\prop_if_in:NnT \l_siunitx_number_out_prop { mantissa-result }
{
- \bool_if:NTF \l_siunitx_tight_bool
- {
- \tl_set:Nx \l_siunitx_tmpb_tl
+ \bool_if:NTF \l_siunitx_tight_bool
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
{ { \exp_not:V \l_siunitx_exponent_product_tl } }
}
- {
- \tl_set:Nx \l_siunitx_tmpb_tl
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
{
{ } \exp_not:V \l_siunitx_exponent_product_tl { }
}
@@ -9075,20 +9758,20 @@ This work consists of the file siunitx.dtx
{ \siunitx_number_output_single: }
}
\cs_new_protected_nopar:Npn \siunitx_number_output_parts_aux:n #1 {
- \prop_if_in:NnT \l_siunitx_number_out_prop {#1}
+ \prop_if_in:NnT \l_siunitx_number_out_prop {#1}
{ \siunitx_number_output_parts_print:n {#1} }
- \prop_if_in:NnT \l_siunitx_number_out_prop { #1 -uncertainty }
- {
- \bool_if:NTF \l_siunitx_tight_bool
- {
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { { \pm } } }
+ \prop_if_in:NnT \l_siunitx_number_out_prop { #1 -uncertainty }
+ {
+ \bool_if:NTF \l_siunitx_tight_bool
+ {
+ \siunitx_print:nn { number }
+ { \siunitx_ensuremath:n { { \pm } } }
}
- {
- \siunitx_print:nn { number }
- { \siunitx_ensuremath:n { { } \pm { } } }
+ {
+ \siunitx_print:nn { number }
+ { \siunitx_ensuremath:n { { } \pm { } } }
}
- \siunitx_number_output_parts_print:n { #1 -uncertainty }
+ \siunitx_number_output_parts_print:n { #1 -uncertainty }
}
}
\cs_new_protected_nopar:Npn \siunitx_number_output_parts_print:n #1 {
@@ -9100,8 +9783,6 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_output_product:}
% For products, there may need to be the addition of brackets if there
@@ -9111,26 +9792,26 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_product: {
\bool_if:NTF \l_siunitx_product_brackets_bool
- {
+ {
\bool_if:nTF
{
\tl_if_empty_p:N \l_siunitx_pre_unit_tl &&
- \tl_if_empty_p:N \l_siunitx_unit_tl
+ \tl_if_empty_p:N \l_siunitx_unit_tl
}
{ \siunitx_number_output_product_aux: }
{ \siunitx_number_output_product_brackets: }
}
- {
+ {
\bool_if:NTF \l_siunitx_product_repeat_bool
{ \siunitx_number_output_product_aux: }
- {
+ {
\siunitx_unit_output_pre_print:
\tl_set_eq:NN \l_siunitx_unit_saved_tl \l_siunitx_unit_tl
\tl_clear:N \l_siunitx_pre_unit_tl
\tl_clear:N \l_siunitx_unit_tl
- \group_begin:
+ \group_begin:
\siunitx_number_output_product_aux:
- \group_end:
+ \group_end:
\tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_saved_tl
\siunitx_unit_output_print:
}
@@ -9144,7 +9825,7 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_product_brackets: {
\siunitx_unit_output_pre_print:
- \siunitx_print:nn { number }
+ \siunitx_print:nn { number }
{ \siunitx_ensuremath:n { \l_siunitx_bracket_open_tl } }
\nobreak
\tl_set_eq:NN \l_siunitx_unit_saved_tl \l_siunitx_unit_tl
@@ -9153,7 +9834,7 @@ This work consists of the file siunitx.dtx
\siunitx_number_output_product_aux:
\nobreak
\tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_saved_tl
- \siunitx_print:nn { number }
+ \siunitx_print:nn { number }
{ \siunitx_ensuremath:n { \l_siunitx_bracket_close_tl } }
\siunitx_unit_output_print:
}
@@ -9171,23 +9852,23 @@ This work consists of the file siunitx.dtx
{ \siunitx_number_output_parse_aux: }
{ \siunitx_number_output_quotient: }
\tl_if_empty:NF \l_siunitx_number_next_tl
- {
+ {
\bool_if:NTF \l_siunitx_tight_bool
{
- \siunitx_print:nn { number }
- {
- \siunitx_ensuremath:n
- { \l_siunitx_output_product_tl }
+ \siunitx_print:nn { number }
+ {
+ \siunitx_ensuremath:n
+ { \l_siunitx_output_product_tl }
}
- }
+ }
{
- \siunitx_print:nn { number }
- {
- \siunitx_ensuremath:n
+ \siunitx_print:nn { number }
+ {
+ \siunitx_ensuremath:n
{ { } \l_siunitx_output_product_tl { } }
}
- }
- \siunitx_number_output_parse:V \l_siunitx_number_next_tl
+ }
+ \siunitx_number_output_parse:V \l_siunitx_number_next_tl
}
}
}
@@ -9198,7 +9879,7 @@ This work consists of the file siunitx.dtx
% For quotients, there are two options.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_quotient: {
- \use:c
+ \use:c
{ siunitx_number_output_quotient_ \l_siunitx_quotient_mode_tl : }
}
% \end{macrocode}
@@ -9210,15 +9891,15 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_fraction: {
\bool_set_false:N \l_siunitx_number_compound_bool
\siunitx_number_output_quotient_aux_i:
- \tl_set:Nx \l_siunitx_number_out_tl
+ \tl_set:Nx \l_siunitx_number_out_tl
{ { \exp_not:V \l_siunitx_number_numerator_tl } }
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ { \exp_not:V \l_siunitx_number_denominator_tl } }
\tl_put_right:NV \l_siunitx_number_out_tl \l_siunitx_tmpa_tl
- \tl_put_left:Nn \l_siunitx_number_out_tl { \siunitx_fraction:nn }
- \tl_set:Nx \l_siunitx_number_out_tl
+ \tl_put_left:Nn \l_siunitx_number_out_tl { \siunitx_fraction:nn }
+ \tl_set:Nx \l_siunitx_number_out_tl
{
- \exp_not:N \ensuremath
+ \exp_not:N \ensuremath
{ \exp_not:V \l_siunitx_number_out_tl }
}
\siunitx_number_output_single_aux:
@@ -9226,24 +9907,26 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\begin{macro}{\siunitx_number_output_quotient_symbol:}
-% If a symbol is used for the division, the build process is less
+% If a symbol is used for the division, the build process is less
% complex.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_symbol: {
\bool_set_true:N \l_siunitx_number_compound_bool
\siunitx_number_output_quotient_aux_i:
- \tl_set_eq:NN \l_siunitx_number_out_tl
+ \tl_set_eq:NN \l_siunitx_number_out_tl
\l_siunitx_number_numerator_tl
\siunitx_tl_put_right_math:NV \l_siunitx_number_out_tl
\l_siunitx_output_quotient_tl
- \tl_put_right:NV \l_siunitx_number_out_tl
- \l_siunitx_number_denominator_tl
+ \tl_put_right:NV \l_siunitx_number_out_tl
+ \l_siunitx_number_denominator_tl
\siunitx_number_output_single_aux:
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}[aux]{\siunitx_number_output_quotient_aux_i:}
-%\begin{macro}[aux]{\siunitx_number_output_quotient_aux_ii:}
+%\begin{macro}[aux]{
+% \siunitx_number_output_quotient_aux_i: ,
+% \siunitx_number_output_quotient_aux_ii: ,
+%}
% The two parts of the number are parsed and formatted.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_aux_i: {
@@ -9251,70 +9934,69 @@ This work consists of the file siunitx.dtx
\siunitx_number_output_quotient_aux_ii:
\siunitx_number_output_color:
\prop_if_in:NnT \l_siunitx_number_out_prop { complex }
- {
+ {
\prop_if_in:NnT \l_siunitx_number_out_prop { mantissa }
{
- \prop_put:Nnn \l_siunitx_number_out_prop
- { result-bracket } { true }
- \siunitx_number_format_brackets:n { result }
- }
+ \prop_put:Nnn \l_siunitx_number_out_prop
+ { result-bracket } { true }
+ \siunitx_number_format_brackets:n { result }
+ }
}
\prop_get:NnN \l_siunitx_number_out_prop { result }
- \l_siunitx_number_numerator_tl
+ \l_siunitx_number_numerator_tl
\siunitx_number_in_parse:V \l_siunitx_number_denominator_tl
\siunitx_number_output_quotient_aux_ii:
\prop_if_in:NnT \l_siunitx_number_out_prop
{ result-bracket-exponent }
- {
- \prop_put:Nnn \l_siunitx_number_out_prop { result-bracket }
+ {
+ \prop_put:Nnn \l_siunitx_number_out_prop { result-bracket }
{ true }
}
\siunitx_number_output_bracket:
\prop_get:NnN \l_siunitx_number_out_prop { result }
- \l_siunitx_number_denominator_tl
+ \l_siunitx_number_denominator_tl
}
-\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_aux_ii: {
+\cs_new_protected_nopar:Npn \siunitx_number_output_quotient_aux_ii: {
\siunitx_number_process:
\siunitx_number_format:
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_number_output_single:}
%\begin{macro}[aux]{\siunitx_number_output_single_aux:}
% Printing a number with no multiple parts is easy. There is a check for
-% any units, which if present may force the number to have brackets
+% any units, which if present may force the number to have brackets
% added. there is then simply a short run to print the units and number.
-% The test for bracketing numbers does not happen if there is an
+% The test for bracketing numbers does not happen if there is an
% exponent: if there is, any other parts will already be bracketed and
-% mathematically there is no need for brackets at this point.
+% mathematically there is no need for brackets at this point.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_number_output_single: {
\bool_if:nF
{
\tl_if_empty_p:N \l_siunitx_pre_unit_tl &&
- \tl_if_empty_p:N \l_siunitx_unit_tl
+ \tl_if_empty_p:N \l_siunitx_unit_tl
}
{
\prop_if_in:NnF \l_siunitx_number_out_prop { exponent }
{ \siunitx_number_format_brackets:n { result } }
}
\siunitx_number_output_bracket:
- \prop_get:NnN \l_siunitx_number_out_prop { result }
+ \prop_get:NnN \l_siunitx_number_out_prop { result }
\l_siunitx_number_out_tl
\siunitx_number_output_single_aux:
}
\cs_new_protected_nopar:Npn \siunitx_number_output_single_aux: {
\siunitx_unit_output_pre_print:
\quark_if_no_value:NTF \l_siunitx_number_out_tl
- { \tl_clear:N \l_siunitx_number_unit_separator_tl }
+ { \tl_clear:N \l_siunitx_number_unit_product_tl }
{ \siunitx_print:nV { number } \l_siunitx_number_out_tl }
\siunitx_unit_output_print:
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
+%\end{macro}
%
%\subsection{Angles}
%
@@ -9322,9 +10004,11 @@ This work consists of the file siunitx.dtx
% is always a unit, which is known in advance. Second, there are two
% possible input syntaxes, "\ang{1.23}" and "\ang{1;2;3}". Both need
% to be handled correctly.
-%
-%\begin{macro}{\l_siunitx_angle_degree_space_bool}
-%\begin{macro}{\l_siunitx_angle_minute_space_bool}
+%
+%\begin{macro}{
+% \l_siunitx_angle_degree_space_bool ,
+% \l_siunitx_angle_minute_space_bool ,
+%}
% The need for spaces between parts of an arc needs to be accommodated:
% this is achieved by flagging up the need for such spaces using two
% switches.
@@ -9333,13 +10017,14 @@ This work consists of the file siunitx.dtx
\bool_new:N \l_siunitx_angle_minute_space_bool
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_angle_marker_box}
-%\begin{macro}{\l_siunitx_angle_unit_box}
-%\begin{macro}{\l_siunitx_angle_marker_dim}
-%\begin{macro}{\l_siunitx_angle_unit_dim}
-% When creating astronomy-style angles, the decimal marker and angle
+%\begin{macro}{
+% \l_siunitx_angle_marker_box ,
+% \l_siunitx_angle_unit_box ,
+% \l_siunitx_angle_marker_dim ,
+% \l_siunitx_angle_unit_dim ,
+%}
+% When creating astronomy-style angles, the decimal marker and angle
% symbol have to be boxed up and measured.
% \begin{macrocode}
\box_new:N \l_siunitx_angle_marker_box
@@ -9348,13 +10033,12 @@ This work consists of the file siunitx.dtx
\dim_new:N \l_siunitx_angle_unit_dim
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_angle_degree_prop}
-%\begin{macro}{\l_siunitx_angle_minute_prop}
-%\begin{macro}{\l_siunitx_angle_second_prop}
+%\begin{macro}{
+% \l_siunitx_angle_degree_prop ,
+% \l_siunitx_angle_minute_prop ,
+% \l_siunitx_angle_second_prop ,
+%}
% As there are potentially three numbers to parse, three properly lists
% are made available to hold the results. This allows the code to be
% generalised, with only the name of the storage area varying.
@@ -9364,38 +10048,35 @@ This work consists of the file siunitx.dtx
\prop_new:N \l_siunitx_angle_second_prop
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\l_siunitx_angle_degree_zero_bool}
-%\begin{macro}{\l_siunitx_angle_minute_zero_bool}
-%\begin{macro}{\l_siunitx_angle_second_zero_bool}
-%\begin{macro}{\l_siunitx_angle_arc_separator_tl}
-%\begin{macro}{\l_siunitx_angle_astronomy_bool}
-%\begin{macro}{\l_siunitx_angle_unit_separator_tl}
+%
+%\begin{macro}{
+% \l_siunitx_angle_degree_zero_bool ,
+% \l_siunitx_angle_minute_zero_bool ,
+% \l_siunitx_angle_second_zero_bool ,
+% \l_siunitx_angle_arc_separator_tl ,
+% \l_siunitx_angle_astronomy_bool ,
+% \l_siunitx_angle_unit_product_tl ,
+%}
% The angle-specific options are created here.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- add-arc-degree-zero .bool_set:N =
- \l_siunitx_angle_degree_zero_bool ,
- add-arc-minute-zero .bool_set:N =
- \l_siunitx_angle_minute_zero_bool ,
- add-arc-second-zero .bool_set:N =
+ add-arc-degree-zero .bool_set:N =
+ \l_siunitx_angle_degree_zero_bool ,
+ add-arc-minute-zero .bool_set:N =
+ \l_siunitx_angle_minute_zero_bool ,
+ add-arc-second-zero .bool_set:N =
\l_siunitx_angle_second_zero_bool ,
- angle-symbol-over-decimal .bool_set:N =
+ angle-symbol-over-decimal .bool_set:N =
\l_siunitx_angle_astronomy_bool ,
- arc-separator .tl_set:N =
+ arc-separator .tl_set:N =
\l_siunitx_angle_arc_separator_tl ,
- number-angle-separator .tl_set:N =
- \l_siunitx_angle_unit_separator_tl ,
+ number-angle-product .tl_set:N =
+ \l_siunitx_angle_unit_product_tl ,
+ number-angle-separator .tl_set:N =
+ \l_siunitx_angle_unit_product_tl ,
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_angle_output:nnn}
%\begin{macro}[aux]{\siunitx_angle_output_aux:nnn}
@@ -9407,7 +10088,7 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_angle_output:nnn #1#2#3 {
\siunitx_angle_init:
\IfNoValueTF {#2}
- {
+ {
\bool_set_false:N \l_siunitx_angle_minute_zero_bool
\bool_set_false:N \l_siunitx_angle_second_zero_bool
\siunitx_angle_output_aux:nnn {#1} { } { }
@@ -9428,8 +10109,8 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-%\end{macro}
-%\end{macro}
+%\end{macro}
+%\end{macro}
%
%\begin{macro}{\siunitx_angle_init:}
% The usual separation of initial storage resets.
@@ -9440,19 +10121,21 @@ This work consists of the file siunitx.dtx
\prop_clear:N \l_siunitx_angle_degree_prop
\prop_clear:N \l_siunitx_angle_minute_prop
\prop_clear:N \l_siunitx_angle_second_prop
- \tl_clear:N \l_siunitx_preunit_tl
- \tl_set_eq:NN \l_siunitx_number_unit_separator_tl
- \l_siunitx_angle_unit_separator_tl
- \cs_set_eq:NN \siunitx_number_in_parse_more:N
- \siunitx_number_in_parse_restricted:N
+ \tl_clear:N \l_siunitx_preunit_tl
+ \tl_set_eq:NN \l_siunitx_number_unit_product_tl
+ \l_siunitx_angle_unit_product_tl
+ \cs_set_eq:NN \siunitx_number_in_parse_more:N
+ \siunitx_number_in_parse_restricted:N
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\siunitx_angle_direct:nnn}
-%\begin{macro}[aux]{\siunitx_angle_direct_aux_i:nnn}
-%\begin{macro}[aux]{\siunitx_angle_direct_aux_ii:nnn}
-%\begin{macro}[aux]{\siunitx_angle_direct_aux_iii:nnn}
+%\begin{macro}[aux]{
+% \siunitx_angle_direct_aux_i:nnn ,
+% \siunitx_angle_direct_aux_ii:nnn ,
+% \siunitx_angle_direct_aux_iii:nnn ,
+%}
% When printing an arc directly, there is still the need to fill in
% any zero values required and to check the spacing is correct. That
% is done using a chain approach, which is easy to implement and
@@ -9466,7 +10149,6 @@ This work consists of the file siunitx.dtx
{ \siunitx_angle_direct_aux_i:nnn { } }
}
{ \siunitx_angle_direct_aux_i:nnn {#1} }
-
}
\cs_new_protected:Npn \siunitx_angle_direct_aux_i:nnn #1#2 {
\tl_if_empty:nTF {#2}
@@ -9476,7 +10158,6 @@ This work consists of the file siunitx.dtx
{ \siunitx_angle_direct_aux_ii:nnn {#1} { } }
}
{ \siunitx_angle_direct_aux_ii:nnn {#1} {#2} }
-
}
\cs_new_protected:Npn \siunitx_angle_direct_aux_ii:nnn #1#2#3 {
\tl_if_empty:nTF {#3}
@@ -9485,7 +10166,7 @@ This work consists of the file siunitx.dtx
{ \siunitx_angle_direct_aux_iii:nnn {#1} {#2} { 0 } }
{ \siunitx_angle_direct_aux_iii:nnn {#1} {#2} { } }
}
- { \siunitx_angle_direct_aux_iii:nnn {#1} {#2} {#3} }
+ { \siunitx_angle_direct_aux_iii:nnn {#1} {#2} {#3} }
}
\cs_new_protected:Npn \siunitx_angle_direct_aux_iii:nnn #1#2#3 {
\tl_if_empty:nF {#1}
@@ -9503,16 +10184,18 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_angle_parse:nnn}
-%\begin{macro}[aux]{\siunitx_angle_parse_aux:nnn}
-%\begin{macro}{\siunitx_angle_check_sign:}
-%\begin{macro}[aux]{\siunitx_angle_check_sign:n}
-%\begin{macro}{\siunitx_angle_zero_fill:}
-%\begin{macro}{\siunitx_angle_sign_shuffle:nn}
-%\begin{macro}[aux]{\siunitx_angle_sign_shuffle_aux:nnn}
+%\begin{macro}{
+% \siunitx_angle_parse:nnn ,
+% \siunitx_angle_check_sign: ,
+% \siunitx_angle_zero_fill: ,
+% \siunitx_angle_sign_shuffle:nn ,
+%}
+%\begin{macro}[aux]{
+% \siunitx_angle_parse_aux:nnn ,
+% \siunitx_angle_check_sign:n ,
+% \siunitx_angle_sign_shuffle_aux:nnn ,
+%}
% Parsing an arc requires a number of stages. First, there is the
% basic conversion of the input numbers into three property lists,
% which will contain the data required. There is then a zero-filling
@@ -9529,34 +10212,34 @@ This work consists of the file siunitx.dtx
\prop_if_empty:NF \l_siunitx_angle_degree_prop
{
\prop_if_empty:NF \l_siunitx_angle_minute_prop
- { \bool_set_true:N \l_siunitx_angle_degree_space_bool }
+ { \bool_set_true:N \l_siunitx_angle_degree_space_bool }
\prop_if_empty:NF \l_siunitx_angle_second_prop
- { \bool_set_true:N \l_siunitx_angle_degree_space_bool }
+ { \bool_set_true:N \l_siunitx_angle_degree_space_bool }
}
\prop_if_empty:NF \l_siunitx_angle_minute_prop
{
\prop_if_empty:NF \l_siunitx_angle_second_prop
- { \bool_set_true:N \l_siunitx_angle_minute_space_bool }
+ { \bool_set_true:N \l_siunitx_angle_minute_space_bool }
}
- \siunitx_angle_print:
+ \siunitx_angle_print:
}
\cs_new_protected:Npn \siunitx_angle_parse_aux:nn #1#2 {
\prop_clear:N \l_siunitx_number_in_prop
- \tl_if_empty:nF {#1}
- {
+ \tl_if_empty:nF {#1}
+ {
\siunitx_number_in_init:
- \siunitx_number_in_parse_aux:n {#1}
+ \siunitx_number_in_parse_aux:n {#1}
}
\prop_get:NnN \l_siunitx_number_in_prop { mantissa-sign-deleted }
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
- {
+ {
\prop_put:NnV \l_siunitx_number_in_prop { mantissa-sign }
\l_siunitx_tmpa_tl
}
\siunitx_number_process:
- \prop_set_eq:cN { l_siunitx_angle_ #2 _prop }
- \l_siunitx_number_in_prop
+ \prop_set_eq:cN { l_siunitx_angle_ #2 _prop }
+ \l_siunitx_number_in_prop
}
% \end{macrocode}
% Only the highest-order part of an arc can have a sign. This is checked
@@ -9570,7 +10253,7 @@ This work consists of the file siunitx.dtx
}
{
\siunitx_angle_check_sign_aux:n { minute }
- \siunitx_angle_check_sign_aux:n { second }
+ \siunitx_angle_check_sign_aux:n { second }
}
}
\cs_new_protected_nopar:Npn \siunitx_angle_check_sign_aux:n #1 {
@@ -9584,7 +10267,7 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-% Filling in the zero values is rather awkward as there are signs
+% Filling in the zero values is rather awkward as there are signs
% to worry about. There is therefore a shuffle to move them into the
% correct places.
% \begin{macrocode}
@@ -9610,7 +10293,7 @@ This work consists of the file siunitx.dtx
{ true }
\prop_put:Nnn \l_siunitx_angle_minute_prop { mantissa-integer }
{ 0 }
- \siunitx_angle_sign_shuffle:nn { second } { minute }
+ \siunitx_angle_sign_shuffle:nn { second } { minute }
}
\bool_if:nT
{
@@ -9623,7 +10306,7 @@ This work consists of the file siunitx.dtx
\prop_put:Nnn \l_siunitx_angle_degree_prop { mantissa-integer }
{ 0 }
\siunitx_angle_sign_shuffle:nn { second } { degree }
- \siunitx_angle_sign_shuffle:nn { minute } { degree }
+ \siunitx_angle_sign_shuffle:nn { minute } { degree }
}
}
\cs_new_protected_nopar:Npn \siunitx_angle_sign_shuffle:nn #1#2 {
@@ -9632,9 +10315,9 @@ This work consists of the file siunitx.dtx
}
\cs_new_protected_nopar:Npn \siunitx_angle_sign_shuffle_aux:nnn
#1#2#3 {
- \prop_get:cnN { l_siunitx_angle_ #1 _prop } { mantissa-sign #3 }
+ \prop_get:cnN { l_siunitx_angle_ #1 _prop } { mantissa-sign #3 }
\l_siunitx_tmpa_tl
- \prop_del:cn { l_siunitx_angle_ #1 _prop } { mantissa-sign #3 }
+ \prop_del:cn { l_siunitx_angle_ #1 _prop } { mantissa-sign #3 }
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
\prop_put:cnV { l_siunitx_angle_ #2 _prop } { mantissa-sign #3 }
@@ -9644,11 +10327,6 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_angle_print:}
%\begin{macro}[aux]{\siunitx_angle_print:nn}
@@ -9659,24 +10337,24 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_angle_print: {
\siunitx_angle_print_aux:nn { degree } { \SIUnitSymbolDegree }
\bool_if:NT \l_siunitx_angle_degree_space_bool
- {
+ {
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
}
\siunitx_angle_print_aux:nn { minute } { \SIUnitSymbolArcminute }
\bool_if:NT \l_siunitx_angle_minute_space_bool
- {
+ {
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
}
\siunitx_angle_print_aux:nn { second } { \SIUnitSymbolArcsecond }
}
\cs_new_protected_nopar:Npn \siunitx_angle_print_aux:nn #1#2 {
\prop_if_empty:cF { l_siunitx_angle_ #1 _prop }
{
- \prop_set_eq:Nc \l_siunitx_number_in_prop
+ \prop_set_eq:Nc \l_siunitx_number_in_prop
{ l_siunitx_angle_ #1 _prop }
- \tl_set:Nn \l_siunitx_unit_tl {#2}
+ \tl_set:Nn \l_siunitx_unit_tl {#2}
\tl_clear:N \l_siunitx_number_out_tl
\siunitx_number_format:
\siunitx_number_output_color:
@@ -9690,22 +10368,24 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_angle_print_astronomy:}
-%\begin{macro}[aux]{\siunitx_angle_print_astronomy_aux:}
-%\begin{macro}[aux]{\siunitx_angle_print_astronomy_aux:n}
-%\begin{macro}[aux]{\siunitx_angle_print_astronomy_marker:}
-%\begin{macro}[aux]{\siunitx_angle_print_astronomy_unit:}
+%\begin{macro}[aux]{
+% \siunitx_angle_print_astronomy_aux: ,
+% \siunitx_angle_print_astronomy_aux:n ,
+% \siunitx_angle_print_astronomy_marker: ,
+% \siunitx_angle_print_astronomy_unit: ,
+%}
% The first check for astronomy-style angles is that there is a decimal
% marker in the current input: if not, the standard method can be used.
% The method for the astronomy-style angle is not straight-forward, so
% needs a little explanation. The integer and decimal parts of the
-% number are printed at each end of the function. In the middle is a
+% number are printed at each end of the function. In the middle is a
% method to centre the unit symbol on the decimal marker. This is done
% by typesetting the two symbols and measuring their respective widths.
-% The two are then put into zero-width boxes, which allows them to be
+% The two are then put into zero-width boxes, which allows them to be
% aligned horizontally centred with no vertical change. The larger
% dimension is then used to reconstruct the appropriate width for the
% final output. There is also a need to allow for the \cs{scriptspace}
-% added in after superscripts, which otherwise messes up the
+% added in after superscripts, which otherwise messes up the
% calculation.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy: {
@@ -9718,32 +10398,32 @@ This work consists of the file siunitx.dtx
\prop_get:NnN \l_siunitx_number_out_prop { mantissa-integer }
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
- { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
+ { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
\hbox_set:Nn \l_siunitx_angle_marker_box
{
- \siunitx_print:nn { number }
+ \siunitx_print:nn { number }
{ \siunitx_ensuremath:n { { \l_siunitx_output_decimal_tl } } }
}
\hbox_set:Nn \l_siunitx_angle_unit_box
{
\siunitx_print:nV { unit } \l_siunitx_unit_tl
\skip_horizontal:n { -\scriptspace }
- }
+ }
\siunitx_angle_print_astronomy_aux:n { marker }
\siunitx_angle_print_astronomy_aux:n { unit }
- \hbox_set:Nn \l_siunitx_angle_marker_box
+ \hbox_set:Nn \l_siunitx_angle_marker_box
{
\box_use:N \l_siunitx_angle_marker_box
\box_use:N \l_siunitx_angle_unit_box
}
- \dim_compare:nNnTF
+ \dim_compare:nNnTF
{ \l_siunitx_angle_marker_dim } > { \l_siunitx_angle_unit_dim }
{ \siunitx_angle_print_astronomy_marker: }
{ \siunitx_angle_print_astronomy_unit: }
\prop_get:NnN \l_siunitx_number_out_prop { mantissa-decimal }
\l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
- { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
}
\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy_aux:n #1 {
\dim_set:cn { l_siunitx_angle_ #1 _dim }
@@ -9752,11 +10432,11 @@ This work consists of the file siunitx.dtx
{
\tex_hss:D
\hbox_unpack:c { l_siunitx_angle_ #1_box }
- \tex_hss:D
+ \tex_hss:D
}
}
\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy_marker: {
- \hbox_set_to_wd:Nnn \l_siunitx_angle_marker_box
+ \hbox_set_to_wd:Nnn \l_siunitx_angle_marker_box
{ \l_siunitx_angle_marker_dim }
{
\tex_hss:D
@@ -9766,8 +10446,8 @@ This work consists of the file siunitx.dtx
\box_use:N \l_siunitx_angle_marker_box
}
\cs_new_protected_nopar:Npn \siunitx_angle_print_astronomy_unit: {
- \hbox_set_to_wd:Nnn \l_siunitx_angle_marker_box
- { \l_siunitx_angle_unit_dim }
+ \hbox_set_to_wd:Nnn \l_siunitx_angle_marker_box
+ { \l_siunitx_angle_unit_dim }
{
\tex_hss:D
\hbox_unpack:N \l_siunitx_angle_marker_box
@@ -9779,9 +10459,6 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_angle_print_direct:nnn}
%\begin{macro}[aux]{\siunitx_angle_print_direct_aux:nn}
@@ -9791,15 +10468,15 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_angle_print_direct:nnn #1#2#3 {
\siunitx_angle_print_direct_aux:nn {#1} { \SIUnitSymbolDegree }
\bool_if:NT \l_siunitx_angle_degree_space_bool
- {
+ {
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
}
\siunitx_angle_print_direct_aux:nn {#2} { \SIUnitSymbolArcminute }
\bool_if:NT \l_siunitx_angle_minute_space_bool
- {
+ {
\nobreak
- \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
+ \siunitx_ensuremath:n { \l_siunitx_angle_arc_separator_tl }
}
\siunitx_angle_print_direct_aux:nn {#3} { \SIUnitSymbolArcsecond }
}
@@ -9814,43 +10491,45 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%
+%
%\subsection{Creating unit macros}
%
% Unit macros and related support are created here. To avoid cluttering
% up the user name-space with a lot of short macro names, the standard
% method only makes these available inside the unit-processing functions
% (\cs{SI}, \cs{si} and the \texttt{S} column).
-%
+%
%\begin{macro}{\l_siunitx_declare_list_tl}
% A list of all unit and related functions.
% \begin{macrocode}
\tl_new:N \l_siunitx_declare_list_tl
-\tl_set:Nn \l_siunitx_declare_list_tl { \of \per \raiseto \tothe }
+\tl_set:Nn \l_siunitx_declare_list_tl
+ { \of \highlight \per \raiseto \tothe }
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%
-%\begin{macro}{\siunitx_declare_power_after:Nn}
-%\begin{macro}{\siunitx_declare_power_before:Nn}
+%\begin{macro}{
+% \siunitx_declare_power_after:Nn ,
+% \siunitx_declare_power_before:Nn ,
+%}
% Creating powers is all about storing values.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_declare_power_after:Nn #1#2 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w }
{ \textsuperscript {#2} }
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
{ \siunitx_unit_parse_power_after:n {#2} }
}
\cs_new_protected:Npn \siunitx_declare_power_before:Nn #1#2 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } ##1
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } ##1
{ ##1 \textsuperscript {#2} }
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
{ \siunitx_unit_parse_power_before:n {#2} }
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_declare_prefix:Nnnn}
% Prefixes need to store both the symbol and the power they represent.
@@ -9858,9 +10537,9 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_declare_prefix:Nnnn #1#2#3#4 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
\cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } {#2}
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
{
- \bool_if:NTF \l_siunitx_prefix_symbols_bool
+ \bool_if:NTF \l_siunitx_prefix_symbols_bool
{ \siunitx_unit_parse_prefix:n {#2} }
{ \siunitx_unit_parse_prefix:nn {#3} {#4} }
}
@@ -9873,48 +10552,62 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_declare_qualifier:Nn #1#2 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w }
{ \text { ~ } ( #2 ) }
\cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
{ \siunitx_unit_parse_qualifier:n {#2} }
}
% \end{macrocode}
%\end{macro}
-%
+%
+%\begin{macro}{\siunitx_declare_special:Nn}
+% Special effects functions are declared to store their arguments
+% or to directly apply them.
+% \begin{macrocode}
+\cs_new_protected:Npn \siunitx_declare_special:Nn #1#2 {
+ \tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } ##1
+ { #2 {##1} }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
+ { \siunitx_unit_parse_special:n {#2} }
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\siunitx_declare_unit:Nnn}
%\begin{macro}[aux]{\siunitx_unit_first_token:n}
% Creating units requires various things to be stored. This is done
-% with several storage bins to keep the code clear. For the
+% with several storage bins to keep the code clear. For the
% \texttt{macro} definition, the test occurs at use so that there is no
% problem with the creation order for units.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_declare_unit:Nnn #1#2#3 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
\cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } {#2}
- \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
{
\siunitx_unit_if_literal:nTF {#2}
{ \siunitx_unit_parse_unit:Nn #1 {#2} }
{#2}
}
\tl_if_empty:nTF {#3}
- {
+ {
\cs_if_free:cF { l_siunitx_ \token_to_str:N #1 _options_tl }
- {
+ {
\cs_gundefine:c { l_siunitx_ \token_to_str:N #1 _options_tl }
}
}
{
- \cs_if_free:cT { l_siunitx_ \token_to_str:N #1 _options_tl }
+ \cs_if_free:cT { l_siunitx_ \token_to_str:N #1 _options_tl }
{ \tl_new:c { l_siunitx_ \token_to_str:N #1 _options_tl } }
- \tl_set:cn { l_siunitx_ \token_to_str:N #1 _options_tl } {#3}
+ \tl_set:cn { l_siunitx_ \token_to_str:N #1 _options_tl } {#3}
}
}
\cs_new_protected:Npn \siunitx_unit_first_token:n #1 {
\exp_last_unbraced:No \token_to_str:N { \tl_head:w #1 \q_stop }
}
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%\end{macro}
%
%\begin{macro}{\per}
@@ -9928,28 +10621,29 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\raiseto}
-%\begin{macro}{\tothe}
+%\begin{macro}{
+% \raiseto ,
+% \tothe ,
+%}
% Generic versions of the pre-set powers.
% \begin{macrocode}
\cs_new:cpn { siunitx_ \token_to_str:N \raiseto _literal:w } #1#2 {
#2
\textsuperscript {#1}
}
-\cs_new_protected:cpn { siunitx_ \token_to_str:N \raiseto _function:w }
+\cs_new_protected:cpn { siunitx_ \token_to_str:N \raiseto _function:w }
#1 {
\siunitx_unit_parse_power_before:n {#1}
}
\cs_new:cpn { siunitx_ \token_to_str:N \tothe _literal:w } #1 {
\textsuperscript {#1}
}
-\cs_new_protected:cpn { siunitx_ \token_to_str:N \tothe _function:w }
+\cs_new_protected:cpn { siunitx_ \token_to_str:N \tothe _function:w }
#1 {
\siunitx_unit_parse_power_after:n {#1}
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\of}
% A flexible qualifier as well.
@@ -9963,46 +10657,74 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\cancel}
+%\begin{macro}[aux]{\siunitx_cancel:n}
+% The \cs{cancel} macro is odd as it is only defined if the appropriate
+% package is loaded.
+% \begin{macrocode}
+\AtBeginDocument {
+ \cs_if_exist:NT \cancel
+ {
+ \cs_set_eq:NN \siunitx_cancel:n \cancel
+ \tl_put_right:Nn \l_siunitx_declare_list_tl { \cancel }
+ \cs_new_protected:cpn
+ { siunitx_ \token_to_str:N \cancel _function:w }
+ { \siunitx_unit_parse_special:n { \siunitx_cancel:n } }
+ }
+}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+%\begin{macro}{\highlight}
+% Another special function: selective colour.
+% \begin{macrocode}
+\cs_new_protected:cpn
+ { siunitx_ \token_to_str:N \highlight _literal:w } #1
+ { \siunitx_textcolor:n {#1} }
+\cs_new_protected:cpn
+ { siunitx_ \token_to_str:N \highlight _function:w } #1
+ { \siunitx_unit_parse_special:n { \siunitx_textcolor:n {#1} } }
+% \end{macrocode}
+%\end{macro}
+%
%\subsection{Creating body unit macros}
%
% The user might have asked for the unit macros to be available in the
-% document body. If so, then these are created at the start of the
-% document body.
-%
-%\begin{macro}{\l_siunitx_create_free_bool}
-%\begin{macro}{\l_siunitx_create_overwrite_bool}
-%\begin{macro}{\l_siunitx_create_prespace_bool}
-%\begin{macro}{\l_siunitx_create_optional_bool}
-%\begin{macro}{\l_siunitx_create_xspace_bool}
+% document body. If so, then these are created at the start of the
+% document body.
+%
+%\begin{macro}{
+% \l_siunitx_create_free_bool ,
+% \l_siunitx_create_overwrite_bool ,
+% \l_siunitx_create_prespace_bool ,
+% \l_siunitx_create_optional_bool ,
+% \l_siunitx_create_xspace_bool ,
+%}
% There are a few options which control this behaviour: these are all
% preamble-only.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- free-standing-units .bool_set:N = \l_siunitx_create_free_bool,
- overwrite-functions .bool_set:N =
- \l_siunitx_create_overwrite_bool,
- space-before-unit .bool_set:N = \l_siunitx_create_prespace_bool,
- unit-optional-argument .bool_set:N = \l_siunitx_create_optional_bool,
- use-xspace .bool_set:N = \l_siunitx_create_xspace_bool
+ free-standing-units .bool_set:N = \l_siunitx_create_free_bool ,
+ overwrite-functions .bool_set:N = \l_siunitx_create_overwrite_bool,
+ space-before-unit .bool_set:N = \l_siunitx_create_prespace_bool ,
+ unit-optional-argument .bool_set:N = \l_siunitx_create_optional_bool ,
+ use-xspace .bool_set:N = \l_siunitx_create_xspace_bool ,
}
\siunitx_option_deactivate:n {
- free-standing-units,
- overwrite-functions,
- space-before-unit,
- unit-optional-argument,
- use-xspace
+ free-standing-units ,
+ overwrite-functions ,
+ space-before-unit ,
+ unit-optional-argument ,
+ use-xspace ,
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
% The master control macro which occurs at the start of the document.
% \begin{macrocode}
\AtBeginDocument {
- \bool_if:NTF \l_siunitx_create_free_bool
+ \bool_if:NTF \l_siunitx_create_free_bool
{ \siunitx_unit_create_functions: }
{ \siunitx_unit_create_empty_functions: }
}
@@ -10014,10 +10736,10 @@ This work consists of the file siunitx.dtx
% \pkg{hyperref}.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_create_empty_functions: {
- \tl_map_function:NN \l_siunitx_declare_list_tl
+ \tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_create_empty_functions_aux:N
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_unit_create_empty_functions_aux:N #1 {
\cs_if_free:NT #1 { \cs_set_protected_nopar:Npn #1 { \ERROR } }
}
@@ -10029,55 +10751,57 @@ This work consists of the file siunitx.dtx
% Creation of macros essentially involves picking up a couple of loops.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_create_functions: {
- \bool_if:NT \l_siunitx_create_overwrite_bool
+ \bool_if:NT \l_siunitx_create_overwrite_bool
{ \tl_map_function:NN \l_siunitx_declare_list_tl \cs_gundefine:N }
- \bool_if:NTF \l_siunitx_create_optional_bool
+ \bool_if:NTF \l_siunitx_create_optional_bool
{
- \tl_map_function:NN \l_siunitx_declare_list_tl
+ \tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_create_with_arg:N
}
{
- \tl_map_function:NN \l_siunitx_declare_list_tl
+ \tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_create:N
}
- \bool_if:NT \l_siunitx_create_xspace_bool
+ \bool_if:NT \l_siunitx_create_xspace_bool
{ \RequirePackage { xspace } }
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_unit_create:N}
-%\begin{macro}{\siunitx_unit_create_with_arg:N}
+%\begin{macro}{
+% \siunitx_unit_create:N ,
+% \siunitx_unit_create_with_arg:N ,
+%}
% The creation functions expand everything as far as possible so that
% there is less to do in the document.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_create:N #1 {
- \cs_if_free:NT #1
+ \cs_if_free:NT #1
{
- \cs_set:Npx \siunitx_tmp:w
+ \cs_set:Npx \siunitx_tmp:w
{
- \ProvideDocumentCommand \exp_not:N #1 { }
+ \ProvideDocumentCommand \exp_not:N #1 { }
{
\group_begin:
\exp_not:N \cs_if_free:NF
- \exp_not:c
+ \exp_not:c
{ l_siunitx_ \token_to_str:N #1 _options_tl }
{
- \keys_set:nV { siunitx }
- \exp_not:c
+ \keys_set:nV { siunitx }
+ \exp_not:c
{ l_siunitx_ \token_to_str:N #1 _options_tl }
- }
- \bool_if:NT \l_siunitx_create_prespace_bool
+ }
+ \bool_if:NT \l_siunitx_create_prespace_bool
{
- \exp_not:n
- {
- \siunitx_ensuremath:n
- { \l_siunitx_number_unit_separator_tl }
+ \exp_not:n
+ {
+ \siunitx_ensuremath:n
+ { \l_siunitx_number_unit_product_tl }
}
}
\exp_not:n { \siunitx_unit_output:nn {#1} { } }
- \group_end:
- \bool_if:NT \l_siunitx_create_xspace_bool
+ \group_end:
+ \bool_if:NT \l_siunitx_create_xspace_bool
{ \exp_not:N \xspace }
}
}
@@ -10085,34 +10809,34 @@ This work consists of the file siunitx.dtx
}
}
\cs_new_protected:Npn \siunitx_unit_create_with_arg:N #1 {
- \cs_if_free:NT #1
+ \cs_if_free:NT #1
{
- \cs_set:Npx \siunitx_tmp:w
+ \cs_set:Npx \siunitx_tmp:w
{
- \ProvideDocumentCommand \exp_not:N #1 { o }
+ \ProvideDocumentCommand \exp_not:N #1 { o }
{
\group_begin:
\exp_not:N \cs_if_free:NF
- \exp_not:c
+ \exp_not:c
{ l_siunitx_ \token_to_str:N #1 _options_tl }
{
- \keys_set:nV { siunitx }
- \exp_not:c
+ \keys_set:nV { siunitx }
+ \exp_not:c
{
l_siunitx_ \token_to_str:N #1 _options_tl
}
}
- \exp_not:N \IfNoValueTF {####1}
- {
- \bool_if:NT \l_siunitx_create_prespace_bool
+ \exp_not:N \IfNoValueTF {####1}
+ {
+ \bool_if:NT \l_siunitx_create_prespace_bool
{
- \exp_not:n
- {
- \siunitx_ensuremath:n
- { \l_siunitx_number_unit_separator_tl }
+ \exp_not:n
+ {
+ \siunitx_ensuremath:n
+ { \l_siunitx_number_unit_product_tl }
}
- }
- \exp_not:n { \siunitx_unit_output:nn {#1} { } }
+ }
+ \exp_not:n { \siunitx_unit_output:nn {#1} { } }
}
{ \SI {####1} { \exp_not:N #1 } }
\group_end:
@@ -10125,14 +10849,13 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_protect_symbols:N}
% There are a few unit names which may be defined by other parts of
% \LaTeX. They need to be unexpandable, as in an \texttt{S} column
% \TeX\ will look for \cs{omit} \emph{before} starting the internal
-% version of \cs{si} and doing a redefinition. The same is true
-% for the \cs{color} function, which may well be the first thing in
+% version of \cs{si} and doing a redefinition. The same is true
+% for the \cs{color} function, which may well be the first thing in
% a table cell. The same is true for \cs{array@row@rst}, from REV\TeX,
% which otherwise gives an error.
% \begin{macrocode}
@@ -10141,15 +10864,15 @@ This work consists of the file siunitx.dtx
{ \cs_set_protected:Npn \color #1 { } }
\cs_set_nopar:Npn \siunitx_tmp:w #1 { }
\cs_if_eq:NNT \color \siunitx_tmp:w
- { \cs_set_protected:Npn \color #1 { } }
- \tl_map_function:nN { \bar \color \ng \pm \array@row@rst }
+ { \cs_set_protected:Npn \color #1 { } }
+ \tl_map_function:nN { \bar \color \ng \pm \array@row@rst }
\siunitx_protect_symbols:N
}
\tl_put_right:Nn \document { \siunitx_protect_symbols:N \fg }
\cs_new_protected_nopar:Npn \siunitx_protect_symbols:N #1 {
- \cs_if_exist:NT #1
+ \cs_if_exist:NT #1
{
- \siunitx_cs_if_macro:NT #1
+ \siunitx_cs_if_macro:NT #1
{ \cs_set_protected_nopar:Npx #1 { \exp_not:V #1 } }
}
}
@@ -10159,15 +10882,17 @@ This work consists of the file siunitx.dtx
%\subsection{Initial unit processing}
%
% The unit processor has to convert the input (which may be all macros
-% or may contain literal input) into formatted text for output. The
+% or may contain literal input) into formatted text for output. The
% input part of the process is used to sort out parsed or literal units.
%
-%\begin{macro}{\l_siunitx_unit_forbid_literal_bool}
-%\begin{macro}{\l_siunitx_unit_parse_bool}
+%\begin{macro}{
+% \l_siunitx_unit_forbid_literal_bool ,
+% \l_siunitx_unit_parse_bool ,
+%}
% One option is related to how units are pre-processed.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- forbid-literal-units .bool_set:N =
+ forbid-literal-units .bool_set:N =
\l_siunitx_unit_forbid_literal_bool,
parse-units .bool_set:N = \l_siunitx_unit_parse_bool
}
@@ -10176,25 +10901,26 @@ This work consists of the file siunitx.dtx
parse-units = true
}
% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\siunitx_unit_in:nn}
-%\begin{macro}{\siunitx_unit_in:Vn}
-%\begin{macro}{\siunitx_pm:}
-% The master function does a very simple checks then hands off.
+%\end{macro}
+%
+%\begin{macro}{
+% \siunitx_unit_in:nn ,
+% \siunitx_unit_in:Vn ,
+% \siunitx_pm: ,
+%}
+% The master function does a very simple checks then hands off.
% The definition of \cs{pm} needs to be saved here so that it can
% safely be used as an abbreviation for picometre and also in numbers
% for \( \pm \).
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_in:nn #1#2 {
- \bool_if:NTF \l_siunitx_unit_parse_bool
+ \bool_if:NTF \l_siunitx_unit_parse_bool
{
- \tl_if_empty:nF {#1}
+ \tl_if_empty:nF {#1}
{
- \siunitx_unit_if_literal:nTF {#1}
+ \siunitx_unit_if_literal:nTF {#1}
{
- \bool_if:NTF \l_siunitx_unit_forbid_literal_bool
+ \bool_if:NTF \l_siunitx_unit_forbid_literal_bool
{
\msg_error:nnx { siunitx } { literal-unit }
{ \exp_not:n {#1} }
@@ -10202,10 +10928,10 @@ This work consists of the file siunitx.dtx
{ \siunitx_unit_format_literal:n {#1} }
}
{
- \cs_set_eq:NN \siunitx_pm: \pm
+ \cs_set_eq:NN \siunitx_pm: \pm
\siunitx_unit_parse:nn {#1} {#2}
\siunitx_unit_format:
- \cs_set_eq:NN \pm \siunitx_pm:
+ \cs_set_eq:NN \pm \siunitx_pm:
}
}
}
@@ -10215,13 +10941,11 @@ This work consists of the file siunitx.dtx
\cs_new_nopar:Npn \siunitx_pm: { }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_unit_if_literal:nTF}
%\begin{macro}[aux]{\siunitx_unit_if_literal_aux:N}
-% A test is needed to see if the input only contains unit macros. This
-% is done by altering setting all of the unit macros to expand to
+% A test is needed to see if the input only contains unit macros. This
+% is done by altering setting all of the unit macros to expand to
% nothing at all. Thus there will only be anything left if there is
% a literal in the unit.
% \begin{macrocode}
@@ -10229,7 +10953,8 @@ This work consists of the file siunitx.dtx
\group_begin:
\tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_if_literal_aux:N
- \cs_set_eq:NN \of \use_none:n
+ \cs_set_eq:NN \of \use_none:n
+ \cs_set_eq:NN \highlight \use_none:n
\cs_set_eq:NN \raiseto \use_none:n
\cs_set_eq:NN \tothe \use_none:n
\protected@edef \l_siunitx_tmpa_tl {#1}
@@ -10247,12 +10972,14 @@ This work consists of the file siunitx.dtx
%\subsection{Parsing macro units}
%
% For macro-based units, the macros are converted into literal text,
-% which is then passed on for printing. The code reads through the
+% which is then passed on for printing. The code reads through the
% input to collect up the units, before re-combining everything into
% a single block at the end of the process.
%
-%\begin{macro}{\l_siunitx_unit_int}
-%\begin{macro}{\l_siunitx_unit_prop}
+%\begin{macro}{
+% \l_siunitx_unit_int ,
+% \l_siunitx_unit_prop ,
+%}
% Parsed units are stored in a property list, to keep things compact.
% An integer is also needed to count up units.
% \begin{macrocode}
@@ -10260,7 +10987,6 @@ This work consists of the file siunitx.dtx
\prop_new:N \l_siunitx_unit_prop
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\l_siunitx_per_bool}
% To allow \cs{per} to be \enquote{sticky}.
@@ -10268,9 +10994,11 @@ This work consists of the file siunitx.dtx
\bool_new:N \l_siunitx_per_bool
% \end{macrocode}
%\end{macro}
-%
-%\begin{macro}{\l_siunitx_prefix_symbols_bool}
-%\begin{macro}{\l_siunitx_sticky_per_bool}
+%
+%\begin{macro}{
+% \l_siunitx_prefix_symbols_bool ,
+% \l_siunitx_sticky_per_bool ,
+%}
% Some options are directly related to how units are handled at this
% stage, so need be created before the reconstruction part of the code.
% \begin{macrocode}
@@ -10281,9 +11009,8 @@ This work consists of the file siunitx.dtx
\keys_set:nn { siunitx } {
prefixes-as-symbols = true
}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
+% \end{macrocode}
+%\end{macro}
%
%\begin{macro}{\siunitx_unit_parse:nn}
% The unit to be parsed is received here along with any options given.
@@ -10308,7 +11035,7 @@ This work consists of the file siunitx.dtx
\prop_clear:N \l_siunitx_unit_prop
\int_zero:N \l_siunitx_unit_int
\bool_set_false:N \l_siunitx_per_bool
- \tl_map_function:NN \l_siunitx_declare_list_tl
+ \tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_parse_init_aux:N
}
\cs_new_protected:Npn \siunitx_unit_parse_init_aux:N #1 {
@@ -10320,70 +11047,72 @@ This work consists of the file siunitx.dtx
%
%\begin{macro}{\siunitx_unit_parse_options:n}
% Any unit-specific options are loaded, followed by re-applying any
-% options given for this particular macro. The second call to
+% options given for this particular macro. The second call to
% \cs{keys_set:nn} is needed to allow the local overriding of settings.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_parse_options:nn #1#2 {
\tl_if_single:nT {#1}
{
- \cs_if_free:cF
+ \cs_if_free:cF
{ l_siunitx_ \siunitx_unit_first_token:n {#1} _options_tl }
{
- \keys_set:nv { siunitx }
+ \keys_set:nv { siunitx }
{ l_siunitx_ \siunitx_unit_first_token:n {#1} _options_tl }
\keys_set:nn { siunitx } {#2}
}
- }
+ }
}
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\siunitx_unit_parse_power_before:n}
-%\begin{macro}{\siunitx_unit_parse_power_after:n}
+%\begin{macro}{
+% \siunitx_unit_parse_power_before:n ,
+% \siunitx_unit_parse_power_after:n ,
+%}
% Storing powers depends on whether they are given before or after
% the unit.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_parse_power_before:n #1 {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ power- \int_eval:n { \l_siunitx_unit_int + 1 } }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
}
\cs_new_protected:Npn \siunitx_unit_parse_power_after:n #1 {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ power- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\siunitx_unit_parse_prefix:n}
-%\begin{macro}{\siunitx_unit_parse_prefix:nn}
-% Saving prefixes always increments the counter. For non-symbolic
+%\begin{macro}{
+% \siunitx_unit_parse_prefix:n ,
+% \siunitx_unit_parse_prefix:nn ,
+%}
+% Saving prefixes always increments the counter. For non-symbolic
% mode, the base needs to be saved along with the power.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_parse_prefix:n #1 {
\int_incr:N \l_siunitx_unit_int
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ prefix- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
}
\cs_new_protected:Npn \siunitx_unit_parse_prefix:nn #1#2 {
\siunitx_unit_parse_prefix:n {#2}
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ prefix-base- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_unit_parse_per:}
% The \cs{per} function always applies to the next unit seen, so
% the counter has to be advanced by one.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_parse_per: {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ per- \int_eval:n { \l_siunitx_unit_int + 1 } }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl { true }
\bool_if:NT \l_siunitx_sticky_per_bool
@@ -10399,51 +11128,64 @@ This work consists of the file siunitx.dtx
% Qualifiers never alter the number of units.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_parse_qualifier:n #1 {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ symbol- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_if_in:NVF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{ \msg_error:nn { siunitx } { qualifier-before-unit } }
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ qualifier- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
}
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\siunitx_unit_parse_special:n}
+% Special effects are possible by adding code to the unit property
+% list here: this is pretty much arbitrary, so there is no real
+% processing done.
+% \begin{macrocode}
+\cs_new_protected:Npn \siunitx_unit_parse_special:n #1 {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { special- \int_eval:n { \l_siunitx_unit_int + 1 } }
+ \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\siunitx_unit_parse_unit:Nn}
%\begin{macro}[aux]{\siunitx_unit_parse_unit_per:}
-% For units, there is a check in case a prefix is present (which will
+% For units, there is a check in case a prefix is present (which will
% have incremented the counter). With the counter correct, simply add
% the literal to the property list. There is also a check to see if
% there is a \enquote{sticky} \cs{per} to think about.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_parse_unit:Nn #1#2 {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ prefix- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVTF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_if_in:NVTF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ symbol- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{ \int_incr:N \l_siunitx_unit_int }
}
{ \int_incr:N \l_siunitx_unit_int }
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ unit- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ symbol- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#2}
- \siunitx_unit_parse_unit_per:
+ \siunitx_unit_parse_unit_per:
}
\cs_new_protected_nopar:Npn \siunitx_unit_parse_unit_per: {
- \bool_if:NT \l_siunitx_sticky_per_bool
+ \bool_if:NT \l_siunitx_sticky_per_bool
{
- \bool_if:NT \l_siunitx_per_bool
+ \bool_if:NT \l_siunitx_per_bool
{
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ per- \int_use:N \l_siunitx_unit_int }
- \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{ true }
}
}
@@ -10454,12 +11196,14 @@ This work consists of the file siunitx.dtx
%
%\subsection{Unit formatting}
%
-%\begin{macro}{\l_siunitx_preunit_tl}
-%\begin{macro}{\l_siunitx_unit_tl}
-%\begin{macro}{\l_siunitx_unit_current_tl}
-%\begin{macro}{\l_siunitx_unit_denominator_tl}
-%\begin{macro}{\l_siunitx_unit_numerator_tl}
-%\begin{macro}{\l_siunitx_unit_saved_tl}
+%\begin{macro}{
+% \l_siunitx_preunit_tl ,
+% \l_siunitx_unit_tl ,
+% \l_siunitx_unit_current_tl ,
+% \l_siunitx_unit_denominator_tl ,
+% \l_siunitx_unit_numerator_tl ,
+% \l_siunitx_unit_saved_tl ,
+%}
% Storage space for creating unit output.
% \begin{macrocode}
\tl_new:N \l_siunitx_preunit_tl
@@ -10470,25 +11214,23 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_unit_saved_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_unit_denominator_int}
-%\begin{macro}{\l_siunitx_unit_numerator_int}
+%\begin{macro}{
+% \l_siunitx_unit_denominator_int ,
+% \l_siunitx_unit_numerator_int ,
+%}
% For tracking in case brackets are needed.
% \begin{macrocode}
\int_new:N \l_siunitx_unit_denominator_int
\int_new:N \l_siunitx_unit_numerator_int
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_unit_prefix_int}
-%\begin{macro}{\l_siunitx_unit_prefix_base_int}
-%\begin{macro}{\l_siunitx_unit_prefix_current_tl}
+%\begin{macro}{
+% \l_siunitx_unit_prefix_int ,
+% \l_siunitx_unit_prefix_base_int ,
+% \l_siunitx_unit_prefix_current_tl ,
+%}
% Used to calculate the overall prefix value.
% \begin{macrocode}
\int_new:N \l_siunitx_unit_prefix_int
@@ -10496,11 +11238,9 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_unit_prefix_current_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\l_siunitx_unit_prefix_gram_int}
-% Formatting units is complicated by the fact that the kilogram is a
+% Formatting units is complicated by the fact that the kilogram is a
% base unit, making conversions a little more awkward.
% \begin{macrocode}
\int_new:N \l_siunitx_unit_prefix_gram_int
@@ -10515,12 +11255,14 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_per_auto_bool}
-%\begin{macro}{\l_siunitx_per_fraction_bool}
-%\begin{macro}{\l_siunitx_per_mode_tl}
-%\begin{macro}{\l_siunitx_power_number_bool}
-%\begin{macro}{\l_siunitx_qualifier_mode_tl}
-%\begin{macro}{\l_siunitx_per_two_parts_bool}
+%\begin{macro}{
+% \l_siunitx_per_auto_bool ,
+% \l_siunitx_per_fraction_bool ,
+% \l_siunitx_per_mode_tl ,
+% \l_siunitx_power_number_bool ,
+% \l_siunitx_qualifier_mode_tl ,
+% \l_siunitx_per_two_parts_bool ,
+%}
% For saving settings.
% \begin{macrocode}
\bool_new:N \l_siunitx_per_auto_bool
@@ -10531,23 +11273,21 @@ This work consists of the file siunitx.dtx
\tl_new:N \l_siunitx_qualifier_mode_tl
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\l_siunitx_unit_denominator_bracket_bool}
-%\begin{macro}{\l_siunitx_unit_separator_tl}
-%\begin{macro}{\l_siunitx_per_symbol_tl}
+%\begin{macro}{
+% \l_siunitx_unit_denominator_bracket_bool ,
+% \l_siunitx_unit_product_tl ,
+% \l_siunitx_per_symbol_tl ,
+%}
% At this stage, output formatting options are created.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- bracket-unit-denominator .bool_set:N
+ bracket-unit-denominator .bool_set:N
= \l_siunitx_unit_denominator_bracket_bool,
- inter-unit-separator .tl_set:N = \l_siunitx_unit_separator_tl ,
+ inter-unit-product .tl_set:N = \l_siunitx_unit_product_tl ,
+ inter-unit-separator .tl_set:N = \l_siunitx_unit_product_tl ,
per-mode .choice:,
- per-mode / fraction .code:n =
+ per-mode / fraction .code:n =
{
\bool_set_false:N \l_siunitx_per_auto_bool
\bool_set_true:N \l_siunitx_per_fraction_bool
@@ -10555,37 +11295,37 @@ This work consists of the file siunitx.dtx
\tl_set:Nn \l_siunitx_per_mode_tl { fraction }
},
per-mode / power .meta:n = { per-mode = reciprocal } ,
- per-mode / power-positive-first .meta:n =
+ per-mode / power-positive-first .meta:n =
{ per-mode = reciprocal-positive-first } ,
- per-mode / reciprocal .code:n =
+ per-mode / reciprocal .code:n =
{
\bool_set_false:N \l_siunitx_per_auto_bool
\bool_set_false:N \l_siunitx_per_fraction_bool
\bool_set_false:N \l_siunitx_per_two_parts_bool
- \tl_clear:N \l_siunitx_per_mode_tl
+ \tl_clear:N \l_siunitx_per_mode_tl
},
- per-mode / reciprocal-positive-first .code:n =
+ per-mode / reciprocal-positive-first .code:n =
{
\bool_set_false:N \l_siunitx_per_auto_bool
\bool_set_false:N \l_siunitx_per_fraction_bool
\bool_set_true:N \l_siunitx_per_two_parts_bool
- \tl_clear:N \l_siunitx_per_mode_tl
+ \tl_clear:N \l_siunitx_per_mode_tl
},
- per-mode / repeated-symbol .code:n =
+ per-mode / repeated-symbol .code:n =
{
\bool_set_false:N \l_siunitx_per_auto_bool
\bool_set_false:N \l_siunitx_per_fraction_bool
\bool_set_false:N \l_siunitx_per_two_parts_bool
\tl_set:Nn \l_siunitx_per_mode_tl { repeat }
},
- per-mode / symbol .code:n =
+ per-mode / symbol .code:n =
{
\bool_set_false:N \l_siunitx_per_auto_bool
\bool_set_true:N \l_siunitx_per_fraction_bool
\bool_set_true:N \l_siunitx_per_two_parts_bool
\tl_set:Nn \l_siunitx_per_mode_tl { symbol }
},
- per-mode / symbol-or-fraction .code:n =
+ per-mode / symbol-or-fraction .code:n =
{
\bool_set_true:N \l_siunitx_per_auto_bool
\bool_set_true:N \l_siunitx_per_fraction_bool
@@ -10594,23 +11334,23 @@ This work consists of the file siunitx.dtx
},
per-symbol .tl_set:N = \l_siunitx_per_symbol_tl,
power-font .choice:,
- power-font / number .code:n =
+ power-font / number .code:n =
{ \bool_set_true:N \l_siunitx_power_number_bool },
- power-font / unit .code:n =
+ power-font / unit .code:n =
{ \bool_set_false:N \l_siunitx_power_number_bool },
qualifier-mode .choice:,
- qualifier-mode / brackets .code:n =
+ qualifier-mode / brackets .code:n =
{ \tl_set:Nn \l_siunitx_qualifier_mode_tl { brackets } },
- qualifier-mode / space .code:n =
+ qualifier-mode / space .code:n =
{ \tl_set:Nn \l_siunitx_qualifier_mode_tl { space } },
- qualifier-mode / subscript .code:n =
+ qualifier-mode / subscript .code:n =
{ \tl_set:Nn \l_siunitx_qualifier_mode_tl { subscript } },
- qualifier-mode / text .code:n =
+ qualifier-mode / text .code:n =
{ \tl_set:Nn \l_siunitx_qualifier_mode_tl { text } },
}
\keys_set:nn { siunitx } {
bracket-unit-denominator = true,
- inter-unit-separator = \,,
+ inter-unit-product = \,,
per-mode = reciprocal,
per-symbol = /,
power-font = number,
@@ -10618,26 +11358,16 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_unit_format:}
% Most of the work is done by the loop, with a little tidying up for
% fraction-like output. Before starting the loop, there is a check for
% the case of a single reciprocal unit when per is set up to create a
-% symbol. In that special case, the space between a number and a unit
+% symbol. In that special case, the space between a number and a unit
% has to be removed.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format: {
\siunitx_unit_format_init:
- \int_compare:nNnT { \l_siunitx_unit_int } = { 1 }
- {
- \str_if_eq:VnT \l_siunitx_per_mode_tl { symbol }
- {
- \prop_if_in:NnT \l_siunitx_unit_prop { per-1 }
- { \bool_set_true:N \l_siunitx_omit_unit_space_bool }
- }
- }
\int_while_do:nNnn { \l_siunitx_unit_int } > { 0 }
{
\siunitx_unit_format_prefix:
@@ -10646,29 +11376,29 @@ This work consists of the file siunitx.dtx
\siunitx_unit_format_power:
\siunitx_unit_format_add:
\int_decr:N \l_siunitx_unit_int
- }
- \bool_if:NT \l_siunitx_per_two_parts_bool
+ }
+ \bool_if:NT \l_siunitx_per_two_parts_bool
{
\bool_if:NTF \l_siunitx_per_fraction_bool
{ \siunitx_unit_format_fraction: }
{ \siunitx_unit_format_sorted: }
}
-}
+}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_add:}
%\begin{macro}[aux]{\siunitx_unit_format_add_aux:n}
% Adding the current unit to the output means checking where it goes.
-% The odd code when adding a space is to pick up repeated per symbols,
+% The odd code when adding a space is to pick up repeated per symbols,
% which need to suppress the space.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_add: {
- \bool_if:NTF \l_siunitx_per_two_parts_bool
+ \bool_if:NTF \l_siunitx_per_two_parts_bool
{
- \tl_set:Nx \l_siunitx_tmpb_tl
+ \tl_set:Nx \l_siunitx_tmpb_tl
{ per- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVTF \l_siunitx_unit_prop \l_siunitx_tmpb_tl
+ \prop_if_in:NVTF \l_siunitx_unit_prop \l_siunitx_tmpb_tl
{
\siunitx_unit_format_add_aux:n { _denominator }
\int_incr:N \l_siunitx_unit_denominator_int
@@ -10680,79 +11410,101 @@ This work consists of the file siunitx.dtx
}
{ \siunitx_unit_format_add_aux:n { } }
\tl_clear:N \l_siunitx_unit_current_tl
-}
+}
\cs_new_protected_nopar:Npn \siunitx_unit_format_add_aux:n #1 {
- \tl_if_empty:cF { l_siunitx_unit #1 _tl }
+ \tl_if_empty:cF { l_siunitx_unit #1 _tl }
{
\str_if_eq:VnTF \l_siunitx_per_mode_tl { repeat }
{
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ per- \int_eval:n { \l_siunitx_unit_int + 1 } }
- \prop_if_in:NVF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_if_in:NVF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
\siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_unit_separator_tl
+ \l_siunitx_unit_product_tl
}
}
- {
+ {
\siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_unit_separator_tl
+ \l_siunitx_unit_product_tl
}
}
- \tl_put_left:cV { l_siunitx_unit #1 _tl } \l_siunitx_unit_current_tl
-}
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { special- \int_use:N \l_siunitx_unit_int }
+ \prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NTF \l_siunitx_tmpa_tl
+ {
+ \tl_put_left:cV { l_siunitx_unit #1 _tl }
+ \l_siunitx_unit_current_tl
+ }
+ {
+ \tl_put_left:cx { l_siunitx_unit #1 _tl }
+ {
+ \exp_not:V \l_siunitx_tmpa_tl
+ { \exp_not:V \l_siunitx_unit_current_tl }
+ }
+ }
+}
% \end{macrocode}
%\end{macro}
%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_fraction:}
-%\begin{macro}[aux]{\siunitx_unit_format_fraction:}
-%\begin{macro}[aux]{\siunitx_unit_format_auto:}
-%\begin{macro}[aux]{\siunitx_unit_format_symbol:}
-%\begin{macro}[aux]{\siunitx_unit_format_symbol_aux:}
-%\begin{macro}[aux]{\siunitx_unit_format_symbol_aux_alt:}
+%\begin{macro}[aux]{
+% \siunitx_unit_format_fraction: ,
+% \siunitx_unit_format_auto: ,
+% \siunitx_unit_format_symbol: ,
+% \siunitx_unit_format_symbol_aux: ,
+% \siunitx_unit_format_symbol_aux_alt: ,
+%}
% When making (\emph{psuedo}-)fractions there is a check to place a
% \( 1 \) in the numerator is it's blank. For symbol mode, this is
% only done if there is no number. Then some construction work.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_fraction: {
- \int_compare:nNnTF { \l_siunitx_unit_denominator_int } > { 0 }
+ \int_compare:nNnT { \l_siunitx_unit_numerator_int } = { 0 }
+ {
+ \str_if_eq:VnT \l_siunitx_per_mode_tl { symbol }
+ { \bool_set_true:N \l_siunitx_omit_unit_space_bool }
+ }
+ \int_compare:nNnTF { \l_siunitx_unit_denominator_int } > { 0 }
{
\bool_if:NTF \l_siunitx_per_auto_bool
{ \siunitx_unit_format_fraction_auto: }
{
- \use:c
+ \use:c
{ siunitx_unit_format_fraction_ \l_siunitx_per_mode_tl : }
}
}
{ \tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl }
-}
+}
\cs_new_protected_nopar:Npn \siunitx_unit_format_fraction_fraction: {
- \tl_if_empty:NT \l_siunitx_unit_numerator_tl
+ \tl_if_empty:NT \l_siunitx_unit_numerator_tl
{ \tl_set:Nn \l_siunitx_unit_numerator_tl { 1 } }
- \tl_set:Nx \l_siunitx_unit_numerator_tl
+ \tl_set:Nx \l_siunitx_unit_numerator_tl
{ { \exp_not:V \l_siunitx_unit_numerator_tl } }
- \tl_put_left:Nn \l_siunitx_unit_numerator_tl
- { \siunitx_print:nn { unit } }
- \tl_set:Nx \l_siunitx_unit_numerator_tl
+ \tl_put_left:Nn \l_siunitx_unit_numerator_tl
+ { \siunitx_print:nn { unit } }
+ \tl_set:Nx \l_siunitx_unit_numerator_tl
{ { \exp_not:V \l_siunitx_unit_numerator_tl } }
- \tl_set:Nx \l_siunitx_unit_denominator_tl
+ \tl_set:Nx \l_siunitx_unit_denominator_tl
{ { \exp_not:V \l_siunitx_unit_denominator_tl } }
- \tl_put_left:Nn \l_siunitx_unit_denominator_tl
- { \siunitx_print:nn { unit } }
- \tl_set:Nx \l_siunitx_unit_denominator_tl
+ \tl_put_left:Nn \l_siunitx_unit_denominator_tl
+ { \siunitx_print:nn { unit } }
+ \tl_set:Nx \l_siunitx_unit_denominator_tl
{ { \exp_not:V \l_siunitx_unit_denominator_tl } }
\tl_set:Nn \l_siunitx_unit_tl { \siunitx_fraction:nn }
\tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl
\tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_unit_denominator_tl
- \tl_set:Nx \l_siunitx_unit_tl
+ \tl_set:Nx \l_siunitx_unit_tl
{ \exp_not:N \ensuremath { \exp_not:V \l_siunitx_unit_tl } }
-}
+}
% \end{macrocode}
% For the \opt{symbol} setting, there is a need to deal with the
% possible \opt{symbol-or-fraction} choice. That is achieved by
% setting up both the \opt{fraction} and \opt{symbol} output.
-% In the automatic mode, both cases are combined inside a
+% In the automatic mode, both cases are combined inside a
% \cs{tex_mathchoice:D}, with appropriate protection, before sending
% everything through for printing.
% \begin{macrocode}
@@ -10769,7 +11521,7 @@ This work consists of the file siunitx.dtx
\tl_set:Nn \l_siunitx_tmpb_tl \l_siunitx_unit_tl
\tl_set:Nx \l_siunitx_tmpb_tl
{
- \siunitx_print:nn { unit }
+ \siunitx_print:nn { unit }
{ \exp_not:V \l_siunitx_tmpb_tl }
}
\tl_set:Nx \l_siunitx_unit_tl
@@ -10793,7 +11545,7 @@ This work consists of the file siunitx.dtx
\siunitx_unit_format_fraction_symbol_aux:
\int_compare:nNnT { \l_siunitx_unit_denominator_int } > { 1 }
{
- \bool_if:NT \l_siunitx_unit_denominator_bracket_bool
+ \bool_if:NT \l_siunitx_unit_denominator_bracket_bool
{
\siunitx_tl_put_left_math:NV \l_siunitx_unit_denominator_tl
\l_siunitx_bracket_open_tl
@@ -10806,20 +11558,16 @@ This work consists of the file siunitx.dtx
\l_siunitx_per_symbol_tl
\tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_unit_denominator_tl
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_unit_format_fraction_symbol_aux: { }
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_unit_format_fraction_symbol_aux_alt: {
- \tl_if_empty:NT \l_siunitx_unit_numerator_tl
+ \tl_if_empty:NT \l_siunitx_unit_numerator_tl
{ \tl_set:Nn \l_siunitx_unit_numerator_tl { 1 } }
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_init:}
% The normal initialisation stuff.
@@ -10837,16 +11585,16 @@ This work consists of the file siunitx.dtx
\int_zero:N \l_siunitx_unit_numerator_int
\tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_print_literal_aux:N
-}
+}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_literal:n}
-%\begin{macro}{\siunitx_unit_format_literal_aux:N}
+%\begin{macro}[aux]{\siunitx_unit_format_literal_aux:N}
% If the unit given contains anything which is not a unit macro, then
-% any unit macros that are there simply dump literal meanings. There is
-% then a little work to do sorting out "~" and \texttt{.} characters at
-% the outer level.
+% any unit macros that are there simply dump literal meanings. There is
+% then a little work to do sorting out "~" and \texttt{.} characters at
+% the outer level.
% \begin{macrocode}
\char_make_active:N \~
\cs_new_protected:Npn \siunitx_unit_format_literal:n #1 {
@@ -10854,20 +11602,20 @@ This work consists of the file siunitx.dtx
\tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_print_literal_aux:N
\tl_set:Nn \l_siunitx_unit_tl {#1}
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{
\exp_not:N \siunitx_ensuremath:n
- { \exp_not:V \l_siunitx_unit_separator_tl }
+ { \exp_not:V \l_siunitx_unit_product_tl }
}
- \tl_replace_all_in:NnV \l_siunitx_unit_tl { . }
+ \tl_replace_all_in:NnV \l_siunitx_unit_tl { . }
\l_siunitx_tmpa_tl
- \tl_replace_all_in:NnV \l_siunitx_unit_tl { ~ }
+ \tl_replace_all_in:NnV \l_siunitx_unit_tl { ~ }
\l_siunitx_tmpa_tl
- \siunitx_unit_format_literal_extras:
+ \siunitx_unit_format_literal_extras:
}
\cs_new_protected:Npn \siunitx_unit_print_literal_aux:N #1 {
\cs_set_eq:Nc #1 { siunitx_ \token_to_str:N #1 _literal:w }
-}
+}
\char_make_space:N \~
% \end{macrocode}
%\end{macro}
@@ -10875,68 +11623,76 @@ This work consists of the file siunitx.dtx
%
%\begin{macro}{\siunitx_unit_format_literal_extras:}
%\begin{macro}[aux]{\siunitx_unit_format_literal_extras_aux:nN}
-% The code here deals with characters outside the normal range that
+% The code here deals with characters outside the normal range that
% can appear in units in UTF-8 and related encodings. The idea is to
% do a search and replace, thus avoiding any active characters.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \siunitx_unit_format_literal_extras: {
+\cs_new_protected_nopar:Npn \siunitx_unit_format_literal_extras: {
\siunitx_unit_format_literal_extras_aux:nN { 176 }
\SIUnitSymbolDegree
\siunitx_unit_format_literal_extras_aux:nN { 181 }
\SIUnitSymbolMicro
\siunitx_unit_format_literal_extras_aux:nN { 197 }
- \SIUnitSymbolAngstrom
+ \SIUnitSymbolAngstrom
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_unit_format_literal_extras_aux:nN #1#2 {
\char_set_lccode:nn { `\@ } {#1}
\tl_to_lowercase:n
- {
- \tl_replace_all_in:NnV \l_siunitx_unit_tl { @ }
+ {
+ \tl_replace_all_in:NnV \l_siunitx_unit_tl { @ }
\l_siunitx_unit_tl
}
}
\xetex_if_engine:F {
- \luatex_if_engine:F
+ \luatex_if_engine:F
{
- \AtBeginDocument
+ \AtBeginDocument
{
\cs_if_exist:NTF \inputencodingname
{
\tl_set:Nn \l_siunitx_tmpa_tl { latin1 , latin5 , latin9 }
- \clist_if_in:NVF \l_siunitx_tmpa_tl \inputencodingname
- {
- \cs_set_eq:NN \siunitx_unit_format_literal_extras:
+ \clist_if_in:NVF \l_siunitx_tmpa_tl \inputencodingname
+ {
+ \cs_set_eq:NN \siunitx_unit_format_literal_extras:
\scan_stop:
}
}
- {
+ {
\cs_set_eq:NN \siunitx_unit_format_literal_extras:
- \scan_stop:
+ \scan_stop:
}
- }
- }
+ }
+ }
}
% \end{macrocode}
%\end{macro}
%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_power:}
+%\begin{macro}[aux]{
+% \siunitx_unit_format_power_aux: ,
+% \siunitx_unit_format_power_aux:n ,
+% \siunitx_unit_format_power_aux:nn ,
+% \siunitx_unit_format_power_brackets: ,
+% \siunitx_unit_format_power_per: ,
+% \siunitx_unit_format_power_repeat: ,
+%}
% To format powers, there are a few issues: are brackets needed, is
% the power reciprocal and is fraction-formatting in operation. Repeated
-% per symbols make life a little more complex, as they have to be
-% handled here as well.
+% per symbols make life a little more complex, as they have to be
+% handled here as well.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_power: {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ power- \int_use:N \l_siunitx_unit_int }
- \prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
\l_siunitx_tmpa_tl
- \quark_if_no_value:NTF \l_siunitx_tmpa_tl
+ \quark_if_no_value:NTF \l_siunitx_tmpa_tl
{
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ per- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
\tl_set:Nn \l_siunitx_tmpa_tl { 1 }
\siunitx_unit_format_power_aux:
@@ -10945,10 +11701,6 @@ This work consists of the file siunitx.dtx
{ \siunitx_unit_format_power_aux: }
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_unit_format_power_aux:}
-%\begin{macro}[aux]{\siunitx_unit_format_power_aux:n}
-%\begin{macro}[aux]{\siunitx_unit_format_power_aux:nn}
% The auxiliary function needs to make sure that the printing routine
% prints the power as a number, not as text: the two modes may be
% different. A search and replace function is needed for superscripts
@@ -10961,13 +11713,13 @@ This work consists of the file siunitx.dtx
\str_if_eq:VnF \l_siunitx_tmpa_tl { 1 }
{
\siunitx_unit_format_power_brackets:
- \tl_put_right:Nx \l_siunitx_unit_current_tl
- {
- ^
- {
- \siunitx_unit_format_power_aux:n
- { \exp_not:V \l_siunitx_tmpa_tl }
- }
+ \tl_put_right:Nx \l_siunitx_unit_current_tl
+ {
+ \exp_not:N \PrintSuperscript
+ {
+ \siunitx_unit_format_power_aux:n
+ { \exp_not:V \l_siunitx_tmpa_tl }
+ }
}
}
}
@@ -10981,184 +11733,179 @@ This work consists of the file siunitx.dtx
{ \siunitx_print:nn {#1} {#2} }
{
\tl_set:Nn \l_siunitx_tmpa_tl {#2}
- \tl_replace_all_in:Nnn \l_siunitx_tmpa_tl { - }
+ \tl_replace_all_in:Nnn \l_siunitx_tmpa_tl { - }
{ \text { \c_siunitx_minus_tl } }
\siunitx_print:nV {#1} \l_siunitx_tmpa_tl
}
}
% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_unit_format_power_brackets:}
% A check is made for a qualifier with a space, which needs brackets
% if there is also a power.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_power_brackets: {
- \tl_set:Nx \l_siunitx_tmpb_tl
- { bracket- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { bracket- \int_use:N \l_siunitx_unit_int }
+ \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
{
- \siunitx_tl_put_left_math:NV \l_siunitx_unit_current_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_unit_current_tl
\l_siunitx_bracket_open_tl
\siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
\l_siunitx_bracket_close_tl
}
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}[aux]{\siunitx_unit_format_power_per:}
-%\begin{macro}[aux]{\siunitx_unit_format_power_repeat:}
% For dealing with \cs{per} and repeated \cs{per} symbols. The sign
-% change does not use any numbers, as this makes life easier with
+% change does not use any numbers, as this makes life easier with
% non-integer values.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_power_per: {
- \tl_set:Nx \l_siunitx_tmpb_tl
- { per- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { per- \int_use:N \l_siunitx_unit_int }
+ \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
{
- \bool_if:NF \l_siunitx_per_fraction_bool
+ \bool_if:NF \l_siunitx_per_fraction_bool
{
- \tl_if_in:NnTF \l_siunitx_tmpa_tl { - }
+ \tl_if_in:NnTF \l_siunitx_tmpa_tl { - }
{
- \cs_set:Npn \siunitx_tmp:w ##1 - ##2 \q_stop
+ \cs_set:Npn \siunitx_tmp:w ##1 - ##2 \q_stop
{ \tl_set:Nn \l_siunitx_tmpa_tl {##2} }
- \exp_last_unbraced:NV \siunitx_tmp:w
+ \exp_last_unbraced:NV \siunitx_tmp:w
\l_siunitx_tmpa_tl \q_stop
}
{ \tl_put_left:Nn \l_siunitx_tmpa_tl { - } }
}
- }
+ }
}
\cs_new_protected_nopar:Npn \siunitx_unit_format_power_repeat: {
- \tl_set:Nx \l_siunitx_tmpb_tl
- { per- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { per- \int_use:N \l_siunitx_unit_int }
+ \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpb_tl
{
- \siunitx_tl_put_left_math:NV \l_siunitx_unit_current_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_unit_current_tl
\l_siunitx_per_symbol_tl
- }
+ }
}
% \end{macrocode}
%\end{macro}
%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_prefix:}
-%\begin{macro}[aux]{\siunitx_unit_format_prefix_number:}
-%\begin{macro}[aux]{\siunitx_unit_format_prefix_number_calc:}
-%\begin{macro}[aux]{\siunitx_unit_format_prefix_symbol:}
+%\begin{macro}[aux]{
+% \siunitx_unit_format_prefix_number: ,
+% \siunitx_unit_format_prefix_number_calc: ,
+% \siunitx_unit_format_prefix_symbol: ,
+%}
% If there is a prefix, it is added to the output. When using numerical
% output, some conversion is needed instead.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix: {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ prefix- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_if_in:NVT \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
\prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
\l_siunitx_unit_prefix_current_tl
- \bool_if:NTF \l_siunitx_prefix_symbols_bool
+ \bool_if:NTF \l_siunitx_prefix_symbols_bool
{ \siunitx_unit_format_prefix_symbol: }
{ \siunitx_unit_format_prefix_number: }
}
-}
+}
\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix_number: {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ prefix-base- \int_use:N \l_siunitx_unit_int }
\prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
\l_siunitx_tmpa_tl
- \int_compare:nNnT { \l_siunitx_unit_prefix_base_int } = { 0 }
+ \int_compare:nNnT { \l_siunitx_unit_prefix_base_int } = { 0 }
{
- \int_set:Nn \l_siunitx_unit_prefix_base_int
+ \int_set:Nn \l_siunitx_unit_prefix_base_int
{ \l_siunitx_tmpa_tl }
}
- \int_compare:nNnTF
+ \int_compare:nNnTF
{ \l_siunitx_unit_prefix_base_int } = { \l_siunitx_tmpa_tl }
{ \siunitx_unit_format_prefix_number_calc: }
{ \msg_error:nn { siunitx } { prefix-base-mismatch } }
}
% \end{macrocode}
-% The calculation for converting a unit prefix into a number is
+% The calculation for converting a unit prefix into a number is
% simple unless there are grammes involved. In that case, the base unit
% is the kilogram and so there is some code to convert the number
-% back correctly.
+% back correctly.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix_number_calc: {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ power- \int_use:N \l_siunitx_unit_int }
\prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
\l_siunitx_tmpa_tl
- \quark_if_no_value:NT \l_siunitx_tmpa_tl
+ \quark_if_no_value:NT \l_siunitx_tmpa_tl
{ \tl_set:Nn \l_siunitx_tmpa_tl { 1 } }
- \tl_set:Nx \l_siunitx_tmpb_tl
+ \tl_set:Nx \l_siunitx_tmpb_tl
{ unit- \int_use:N \l_siunitx_unit_int }
\prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpb_tl
\l_siunitx_tmpb_tl
\str_if_eq:VnT \l_siunitx_tmpb_tl { \gram }
- {
+ {
\tl_set:Nx \l_siunitx_unit_prefix_current_tl
- { \int_eval:n { \l_siunitx_unit_prefix_current_tl - 3 } }
- \tl_set:Nx \l_siunitx_tmpb_tl
+ { \int_eval:n { \l_siunitx_unit_prefix_current_tl - 3 } }
+ \tl_set:Nx \l_siunitx_tmpb_tl
{ symbol- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpb_tl { kg }
}
- \tl_set:Nx \l_siunitx_unit_prefix_current_tl
+ \tl_set:Nx \l_siunitx_unit_prefix_current_tl
{
- \int_eval:n
+ \int_eval:n
{ \l_siunitx_unit_prefix_current_tl * \l_siunitx_tmpa_tl }
}
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ per- \int_use:N \l_siunitx_unit_int }
- \prop_if_in:NVTF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \prop_if_in:NVTF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
- \int_set:Nn \l_siunitx_unit_prefix_int
+ \int_set:Nn \l_siunitx_unit_prefix_int
{
- \l_siunitx_unit_prefix_int
+ \l_siunitx_unit_prefix_int
- \l_siunitx_unit_prefix_current_tl
- }
+ }
}
{
- \int_set:Nn \l_siunitx_unit_prefix_int
+ \int_set:Nn \l_siunitx_unit_prefix_int
{
- \l_siunitx_unit_prefix_int
+ \l_siunitx_unit_prefix_int
+ \l_siunitx_unit_prefix_current_tl
}
}
}
\cs_new_protected_nopar:Npn \siunitx_unit_format_prefix_symbol: {
- \tl_set_eq:NN \l_siunitx_unit_current_tl
+ \tl_set_eq:NN \l_siunitx_unit_current_tl
\l_siunitx_unit_prefix_current_tl
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_qualifier:}
-%\begin{macro}{\siunitx_unit_format_qualifier_brackets:}
-%\begin{macro}{\siunitx_unit_format_qualifier_space:}
-%\begin{macro}{\siunitx_unit_format_qualifier_subscript:}
-%\begin{macro}{\siunitx_unit_format_qualifier_text:}
+%\begin{macro}[aux]{
+% \siunitx_unit_format_qualifier_brackets: ,
+% \siunitx_unit_format_qualifier_space: ,
+% \siunitx_unit_format_qualifier_subscript: ,
+% \siunitx_unit_format_qualifier_text: ,
+%}
% Four methods for showing qualifiers, each with its own sub-function.
% For the \texttt{space} methods, a warning is set in the property list
% as if there is a power then some brackets will be needed.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier: {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ qualifier- \int_use:N \l_siunitx_unit_int }
\prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \use:c
- {
- siunitx_unit_format_qualifier_
+ \use:c
+ {
+ siunitx_unit_format_qualifier_
\l_siunitx_qualifier_mode_tl :
}
}
-}
+}
\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_brackets: {
\siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
\l_siunitx_bracket_open_tl
@@ -11170,21 +11917,14 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_space: {
\tl_put_right:Nn \l_siunitx_unit_current_tl { \text { ~ } }
\tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ bracket- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl { true }
}
\char_make_space:N \~
-\group_begin:
- \char_set_lccode:nn { `\@ } { `\_ }
- \char_make_math_subscript:N \@
-\tl_to_lowercase:n {
- \group_end:
- \cs_set_protected_nopar:Npn \siunitx_unit_format_qualifier_subscript:
- {
- \tl_put_right:Nx \l_siunitx_unit_current_tl
- { @ { \exp_not:V \l_siunitx_tmpa_tl } }
- }
+\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_subscript: {
+ \tl_put_right:Nx \l_siunitx_unit_current_tl
+ { \exp_not:N \PrintSubscript { \exp_not:V \l_siunitx_tmpa_tl } }
}
\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_text: {
\tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl
@@ -11192,9 +11932,6 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_sorted:}
% For when the powers are sorted with the positive ones first. The only
@@ -11203,12 +11940,12 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_sorted: {
\tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl
- \tl_if_empty:NF \l_siunitx_unit_tl
+ \tl_if_empty:NTF \l_siunitx_unit_tl
{
\tl_if_empty:NF \l_siunitx_unit_denominator_tl
- {
+ {
\siunitx_tl_put_right_math:NV \l_siunitx_unit_tl
- \l_siunitx_unit_separator_tl
+ \l_siunitx_unit_product_tl
}
}
\tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_unit_denominator_tl
@@ -11217,43 +11954,44 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_unit_format_symbol:}
-%\begin{macro}[aux]{\siunitx_unit_format_symbol_aux:}
-%\begin{macro}[aux]{\siunitx_unit_format_symbol_aux_alt:}
+%\begin{macro}[aux]{
+% \siunitx_unit_format_symbol_aux: ,
+% \siunitx_unit_format_symbol_aux_alt: ,
+%}
% If there is no symbol, something is wrong! The only exception is
% when the code is inside the \cs{si} function (or similar) and there
% is only a prefix with nothing else present at all.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_format_symbol: {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ symbol- \int_use:N \l_siunitx_unit_int }
- \prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
- \l_siunitx_tmpa_tl
- \quark_if_no_value:NTF \l_siunitx_tmpa_tl
+ \prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NTF \l_siunitx_tmpa_tl
{ \siunitx_unit_format_symbol_aux: }
{
\tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl
}
-}
+}
\cs_new_protected_nopar:Npn \siunitx_unit_format_symbol_aux: {
\msg_error:nn { siunitx } { prefix-only }
}
\cs_new_protected_nopar:Npn \siunitx_unit_format_symbol_aux_alt: {
\int_compare:nNnTF { \l_siunitx_unit_int } = { 1 }
- {
+ {
\prop_del:Nn \l_siunitx_unit_prop { prefix-1 }
\prop_del:Nn \l_siunitx_unit_prop { prefix-base-1 }
\prop_if_empty:NF \l_siunitx_unit_prop
- { \msg_error:nn { siunitx } { prefix-only } }
+ { \msg_error:nn { siunitx } { prefix-only } }
}
{ \msg_error:nn { siunitx } { prefix-only } }
}
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%
%\subsection{Unit output}
-%
+%
% A collection of the internal parts of various user functions.
%
%\begin{macro}{\l_siunitx_multi_brackets_bool}
@@ -11265,7 +12003,7 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%
+%
%\begin{macro}{\l_siunitx_product_brackets_bool}
%\begin{macro}{\l_siunitx_product_power_bool}
%\begin{macro}{\l_siunitx_number_unit_repeat_bool}
@@ -11276,15 +12014,15 @@ This work consists of the file siunitx.dtx
\bool_new:N \l_siunitx_number_unit_repeat_bool
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%
+%\end{macro}
+%\end{macro}
+%
%\begin{macro}{\l_siunitx_number_unit_breaks_bool}
-%\begin{macro}{\l_siunitx_number_unit_separator_tl}
+%\begin{macro}{\l_siunitx_number_unit_product_tl}
% Options for printing units or units with numbers.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- allow-number-unit-breaks .bool_set:N =
+ allow-number-unit-breaks .bool_set:N =
\l_siunitx_number_unit_breaks_bool,
multi-part-units .choice:,
multi-part-units
@@ -11305,8 +12043,10 @@ This work consists of the file siunitx.dtx
\bool_set_false:N \l_siunitx_multi_brackets_bool
\bool_set_false:N \l_siunitx_multi_repeat_bool
},
- number-unit-separator .tl_set:N =
- \l_siunitx_number_unit_separator_tl,
+ number-unit-product .tl_set:N =
+ \l_siunitx_number_unit_product_tl,
+ number-unit-separator .tl_set:N =
+ \l_siunitx_number_unit_product_tl,
product-units .choice:,
product-units
/ brackets .code:n =
@@ -11328,7 +12068,7 @@ This work consists of the file siunitx.dtx
\bool_set_false:N \l_siunitx_product_brackets_bool
\bool_set_true:N \l_siunitx_product_power_bool
\bool_set_false:N \l_siunitx_product_repeat_bool
- },
+ },
product-units
/ repeat .code:n =
{
@@ -11345,31 +12085,39 @@ This work consists of the file siunitx.dtx
},
}
\keys_set:nn { siunitx } {
- multi-part-units = brackets,
- number-unit-separator = \,,
- product-units = repeat,
+ multi-part-units = brackets,
+ number-unit-product = \,,
+ product-units = repeat,
}
% \end{macrocode}
-%\end{macro}
%\end{macro}
-%
+%\end{macro}
+%
%\begin{macro}{\siunitx_unit_output:nn}
%\begin{macro}{\siunitx_unit_output:Vn}
% For typesetting a unit directly: used by \cs{si} and the \texttt{s}
% column. The second argument is any options to set locally.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_unit_output:nn #1#2 {
- \cs_set_eq:NN \siunitx_unit_format_symbol_aux:
+ \cs_set_eq:NN \siunitx_unit_format_symbol_aux:
\siunitx_unit_format_symbol_aux_alt:
- \cs_set_eq:NN \siunitx_unit_format_fraction_symbol_aux_ii:
+ \cs_set_eq:NN \siunitx_unit_format_fraction_symbol_aux_ii:
\siunitx_unit_format_fraction_symbol_aux_alt:
\siunitx_unit_in:nn {#1} {#2}
- \int_compare:nNnF { \l_siunitx_unit_prefix_int } = { 0 }
- {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \int_compare:nNnTF { \l_siunitx_unit_prefix_int } = { 0 }
+ {
+ \str_if_eq:VnT \l_siunitx_per_mode_tl { symbol }
+ {
+ \int_compare:nNnT { \l_siunitx_unit_numerator_int } = { 0 }
+ { \siunitx_print:nn { unit } { 1 } }
+ }
+ }
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
{
\int_use:N \l_siunitx_unit_prefix_base_int
- ^ { \int_use:N \l_siunitx_unit_prefix_int }
+ \exp_not:N \PrintSuperscript
+ { \int_use:N \l_siunitx_unit_prefix_int }
}
\siunitx_print:nV { number } \l_siunitx_tmpa_tl
\siunitx_unit_output_number_sep:
@@ -11378,8 +12126,8 @@ This work consists of the file siunitx.dtx
}
\cs_generate_variant:Nn \siunitx_unit_output:nn { V }
% \end{macrocode}
-%\end{macro}
-%\end{macro}
+%\end{macro}
+%\end{macro}
%
%\begin{macro}{\siunitx_unit_output_number_sep:}
%\begin{macro}{\siunitx_unit_output_number_sep_aux:}
@@ -11389,7 +12137,7 @@ This work consists of the file siunitx.dtx
% depends on the current math style.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_output_number_sep: {
- \bool_if:NTF \l_siunitx_number_unit_breaks_bool
+ \bool_if:NTF \l_siunitx_number_unit_breaks_bool
{ \penalty \binoppenalty } { \nobreak }
\bool_if:NTF \l_siunitx_per_auto_bool
{
@@ -11398,7 +12146,7 @@ This work consists of the file siunitx.dtx
\ensuremath
{
\tex_mathchoice:D
- { \l_siunitx_number_unit_separator_tl }
+ { \l_siunitx_number_unit_product_tl }
{ \siunitx_unit_output_number_sep_aux: }
{ \siunitx_unit_output_number_sep_aux: }
{ \siunitx_unit_output_number_sep_aux: }
@@ -11410,7 +12158,7 @@ This work consists of the file siunitx.dtx
}
\cs_new_protected_nopar:Npn \siunitx_unit_output_number_sep_aux: {
\bool_if:NF \l_siunitx_omit_unit_space_bool
- { \siunitx_ensuremath:n { \l_siunitx_number_unit_separator_tl } }
+ { \siunitx_ensuremath:n { \l_siunitx_number_unit_product_tl } }
}
% \end{macrocode}
%\end{macro}
@@ -11418,30 +12166,30 @@ This work consists of the file siunitx.dtx
%
%\begin{macro}{\siunitx_unit_output_pre_print:}
%\begin{macro}{\siunitx_unit_output_print:}
-% The printing functions for units do some simple tests then
+% The printing functions for units do some simple tests then
% actually print there output.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_unit_output_pre_print: {
\tl_if_empty:NF \l_siunitx_pre_unit_tl
- {
+ {
\nobreak
- \siunitx_print:nV { unit } \l_siunitx_pre_unit_tl
+ \siunitx_print:nV { unit } \l_siunitx_pre_unit_tl
}
}
\cs_new_protected_nopar:Npn \siunitx_unit_output_print: {
- \int_compare:nNnF { \l_siunitx_unit_prefix_int } = { 0 }
- {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \int_compare:nNnF { \l_siunitx_unit_prefix_int } = { 0 }
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
{
- \bool_if:NTF \l_siunitx_tight_bool
+ \bool_if:NTF \l_siunitx_tight_bool
{
\exp_not:N \ensuremath
{ { \exp_not:V \l_siunitx_exponent_product_tl } }
- }
- {
+ }
+ {
\exp_not:N \ensuremath
{ { } \exp_not:V \l_siunitx_exponent_product_tl { } }
- }
+ }
\int_use:N \l_siunitx_unit_prefix_base_int
^ { \int_use:N \l_siunitx_unit_prefix_int }
}
@@ -11450,7 +12198,7 @@ This work consists of the file siunitx.dtx
\tl_if_empty:NF \l_siunitx_unit_tl
{
\siunitx_unit_output_number_sep:
- \siunitx_print:nV { unit } \l_siunitx_unit_tl
+ \siunitx_print:nV { unit } \l_siunitx_unit_tl
}
}
% \end{macrocode}
@@ -11461,7 +12209,16 @@ This work consists of the file siunitx.dtx
%
% Numbers with units have to be formatted in a more complex way than
% simply sticking the two together.
-%
+%
+%\begin{macro}{\l_siunitx_preunit_tl}
+% A pre-unit is optional, so can be handled using the setting system.
+% \begin{macrocode}
+\keys_define:nn { siunitx } {
+ preunit .tl_set:N = \l_siunitx_preunit_tl ,
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\l_siunitx_pre_unit_tl}
% When there is a pre-unit, it gets stored here.
% \begin{macrocode}
@@ -11477,19 +12234,19 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_combined:nnnn}
-% Printing numbers and units means first processing the units, then
-% handing off this information to the combined number and unit
+% Printing numbers and units means first processing the units, then
+% handing off this information to the combined number and unit
% processor.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_combined:nnnn #1#2#3#4 {
- \IfNoValueTF {#3}
+ \IfNoValueTF {#3}
{ \tl_clear:N \l_siunitx_pre_unit_tl }
{
- \siunitx_unit_in:nn {#3} {#1}
+ \siunitx_unit_in:nn {#3} {#1}
\cs_set_eq:NN \l_siunitx_pre_unit_tl \l_siunitx_unit_tl
}
- \cs_set_eq:NN \l_siunitx_brackets_bool
- \l_siunitx_multi_brackets_bool
+ \cs_set_eq:NN \l_siunitx_brackets_bool
+ \l_siunitx_multi_brackets_bool
\siunitx_combined_unit:nnn {#2} {#4} {#1}
\siunitx_combined_output:n {#2}
}
@@ -11520,18 +12277,18 @@ This work consists of the file siunitx.dtx
% In most cases, sorting out the main unit is easy: simply set up for
% printing using \cs{siunitx_unit_in:nn}. However, if there are multiple
% parts to the number, and they are to be combined into the unit, then
-% there is more work to do. In either case, the result is the
+% there is more work to do. In either case, the result is the
% correctly-prepared unit stored in \cs{l_siunitx_unit_tl}.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_combined_unit:nnn #1#2#3 {
\bool_if:NTF \l_siunitx_product_power_bool
{
\siunitx_combined_product_count:n {#1}
- \int_compare:nNnTF { \l_siunitx_number_product_int } > { 0 }
+ \int_compare:nNnTF { \l_siunitx_number_product_int } > { 0 }
{
\int_incr:N \l_siunitx_number_product_int
\tl_set:Nn \l_siunitx_tmpa_tl {#2}
- \tl_set:Nx \l_siunitx_tmpb_tl
+ \tl_set:Nx \l_siunitx_tmpb_tl
{ \tothe { \exp_not:V \l_siunitx_number_product_int } }
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
\siunitx_unit_in:Vn \l_siunitx_tmpa_tl {#3}
@@ -11551,11 +12308,11 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_combined_product_count:n #1 {
\int_zero:N \l_siunitx_number_product_int
\tl_set:Nn \l_siunitx_tmpa_tl {#1}
- \tl_map_function:NN \l_siunitx_input_product_tl
+ \tl_map_function:NN \l_siunitx_input_product_tl
\siunitx_combined_product_count_aux:N
}
\cs_new_protected:Npn \siunitx_combined_product_count_aux:N #1 {
- \tl_if_in:NnT \l_siunitx_tmpa_tl {#1}
+ \tl_if_in:NnT \l_siunitx_tmpa_tl {#1}
{
\int_incr:N \l_siunitx_number_product_int
\tl_remove_in:Nn \l_siunitx_tmpa_tl {#1}
@@ -11602,13 +12359,13 @@ This work consists of the file siunitx.dtx
\bool_set_true:N \l_siunitx_list_brackets_bool
\bool_set_false:N \l_siunitx_list_repeat_bool
},
- list-units
+ list-units
/ repeat .code:n =
{
\bool_set_false:N \l_siunitx_list_brackets_bool
\bool_set_true:N \l_siunitx_list_repeat_bool
},
- list-units
+ list-units
/ single .code:n =
{
\bool_set_false:N \l_siunitx_list_brackets_bool
@@ -11638,22 +12395,22 @@ This work consists of the file siunitx.dtx
\tl_clear:N \l_siunitx_preunit_tl
\siunitx_list_numbers_aux_i:n {#1}
}
-\cs_new_protected:Npn \siunitx_list_numbers_aux_i:n #1 {
+\cs_new_protected:Npn \siunitx_list_numbers_aux_i:n #1 {
\tl_clear:N \l_siunitx_list_tl
\tl_clear:N \l_siunitx_list_current_tl
- \tl_map_function:nN {#1} \siunitx_list_numbers_aux_ii:n
+ \tl_map_function:nN {#1} \siunitx_list_numbers_aux_ii:n
\tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_separator_final_tl
\tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_current_tl
- \tl_use:N \l_siunitx_list_tl
+ \tl_use:N \l_siunitx_list_tl
}
\cs_new_protected:Npn \siunitx_list_numbers_aux_ii:n #1 {
\tl_if_empty:NTF \l_siunitx_list_tl
{ \tl_set_eq:NN \l_siunitx_list_tl \l_siunitx_list_current_tl }
- {
+ {
\tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_separator_tl
\tl_put_right:NV \l_siunitx_list_tl \l_siunitx_list_current_tl
}
- \tl_set:Nn \l_siunitx_list_current_tl
+ \tl_set:Nn \l_siunitx_list_current_tl
{ \siunitx_combined_output:n {#1} }
}
% \end{macrocode}
@@ -11662,7 +12419,7 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_list_units:nnn}
-% For a list of items with units, the method is to first parse the
+% For a list of items with units, the method is to first parse the
% unit when repeating (to save time), then to use the number loop above
% for the actual work. On the other hand, when the unit is only printed
% once life is easier as the normal unit printer can operate.
@@ -11676,15 +12433,15 @@ This work consists of the file siunitx.dtx
{
\bool_if:NT \l_siunitx_list_brackets_bool
{
- \siunitx_print:nn { number }
+ \siunitx_print:nn { number }
{ \siunitx_ensuremath:n { \l_siunitx_bracket_open_tl } }
}
\siunitx_list_numbers:n {#1}
\bool_if:NT \l_siunitx_list_brackets_bool
{
- \siunitx_print:nn { number }
+ \siunitx_print:nn { number }
{ \siunitx_ensuremath:n { \l_siunitx_bracket_close_tl } }
- }
+ }
\siunitx_unit_output_number_sep:
\siunitx_unit_output:nn {#2} {#3}
}
@@ -11710,19 +12467,19 @@ This work consists of the file siunitx.dtx
\keys_define:nn { siunitx } {
range-phrase .tl_set:N = \l_siunitx_range_phrase_tl,
range-units .choice:,
- range-units
+ range-units
/ brackets .code:n =
{
\bool_set_true:N \l_siunitx_range_brackets_bool
\bool_set_false:N \l_siunitx_range_repeat_bool
},
- range-units
+ range-units
/ repeat .code:n =
{
\bool_set_false:N \l_siunitx_range_brackets_bool
\bool_set_true:N \l_siunitx_range_repeat_bool
},
- range-units
+ range-units
/ single .code:n =
{
\bool_set_false:N \l_siunitx_range_brackets_bool
@@ -11738,7 +12495,7 @@ This work consists of the file siunitx.dtx
%
%\begin{macro}{\siunitx_range_numbers:nn}
%\begin{macro}{\siunitx_range_numbers_aux:n}
-% A range of numbers. This is more restrictive than the \cs{num}
+% A range of numbers. This is more restrictive than the \cs{num}
% function: nothing compound.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_range_numbers:nn #1#2 {
@@ -11747,16 +12504,16 @@ This work consists of the file siunitx.dtx
\siunitx_range_numbers_aux:n {#2}
}
\cs_new_protected:Npn \siunitx_range_numbers_aux:n #1 {
- \bool_if:NTF \l_siunitx_number_parse_bool
+ \bool_if:NTF \l_siunitx_number_parse_bool
{
\tl_clear:N \l_siunitx_number_out_tl
\tl_clear:N \l_siunitx_number_out_saved_tl
\bool_set_false:N \l_siunitx_number_compound_bool
\siunitx_number_output_parse:n {#1}
- \bool_if:NT \l_siunitx_number_compound_bool
+ \bool_if:NT \l_siunitx_number_compound_bool
{ \msg_error:nnx { siunitx } { multi-part-range } {#1} }
}
- {
+ {
\siunitx_unit_output_pre_print:
\siunitx_print:nn { number } {#1}
\siunitx_unit_output_print:
@@ -11780,15 +12537,15 @@ This work consists of the file siunitx.dtx
{
\bool_if:NT \l_siunitx_range_brackets_bool
{
- \siunitx_print:nn { number }
+ \siunitx_print:nn { number }
{ \siunitx_ensuremath:n { \l_siunitx_bracket_open_tl } }
}
\siunitx_range_numbers:nn {#3} {#4}
\bool_if:NT \l_siunitx_range_brackets_bool
{
- \siunitx_print:nn { number }
+ \siunitx_print:nn { number }
{ \siunitx_ensuremath:n { \l_siunitx_bracket_close_tl } }
- }
+ }
\siunitx_unit_output_number_sep:
\siunitx_unit_output:nn {#1} {#2}
}
@@ -11797,20 +12554,20 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\subsection{Setting up tables}
-%
+%
% There is a slight problem with the \pkg{cellspace} package: it also
% uses \texttt{S} for a column type Here, \texttt{S} seems to make
-% more sense for \pkg{siunitx}, with \texttt{C} used for
+% more sense for \pkg{siunitx}, with \texttt{C} used for
% \pkg{cellspace}. To enable this to work well, the column
% rewriting code happens \cs{AtBeginDocument}. The \texttt{S} column
% is deleted from \cs{NC@list} so that no warning appears.
% \begin{macrocode}
\AtBeginDocument {
- \@ifpackageloaded { cellspace }
+ \@ifpackageloaded { cellspace }
{
- \newcolumntype { C } [1]
+ \newcolumntype { C } [1]
{ > { \bcolumn #1 \@nil } #1 < { \ecolumn } }
- \cs_set:Npn \siunitx_tmp:w #1 \NC@do S #2 \q_stop
+ \cs_set:Npn \siunitx_tmp:w #1 \NC@do S #2 \q_stop
{ \toks_set:Nn \NC@list { #1 #2 } }
\exp_last_unbraced:NV \siunitx_tmp:w \NC@list \q_stop
\cs_gundefine:N \NC@find@S
@@ -11822,9 +12579,9 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\siunitx_table_rewrite_create:N}
% The \texttt{s} and \texttt{S} column types are both created using
% the \pkg{array} package, but with the internal macros redefined
-% to work with optional argument. First, there is a need to do a
-% quick shuffle with the \cs{NC@list} macro. The \pkg{siunitx}
-% columns have to be listed first, as otherwise the optional
+% to work with optional argument. First, there is a need to do a
+% quick shuffle with the \cs{NC@list} macro. The \pkg{siunitx}
+% columns have to be listed first, as otherwise the optional
% arguments do not work correctly. So they are added \enquote{by hand}
% to the appropriate macro.
% \begin{macrocode}
@@ -11833,13 +12590,13 @@ This work consists of the file siunitx.dtx
\tl_put_right:NV \l_siunitx_tmpa_tl \NC@list
\newcolumntype {#1} { }
\toks_set:NV \NC@list \l_siunitx_tmpa_tl
- \exp_args:NNc \renewcommand * { NC@rewrite@ #1 } [1] [ ]
+ \exp_args:NNc \renewcommand * { NC@rewrite@ #1 } [1] [ ]
{
- \toks_put_right:Nn \@temptokena
+ \toks_put_right:Nn \@temptokena
{
- > { \siunitx_table_collect_begin:Nn #1 {##1} }
+ > { \siunitx_table_collect_begin:Nn #1 {##1} }
c
- < { \siunitx_table_print: }
+ < { \siunitx_table_print: }
}
\NC@find
}
@@ -11852,9 +12609,9 @@ This work consists of the file siunitx.dtx
%\subsection{Collecting tokens in tables}
%
% The table system is in two parts, collecting tokens and typesetting
-% the result. The collection routine tries to ensure that the
+% the result. The collection routine tries to ensure that the
% typesetting part only receives real cell contents.
-%
+%
%\begin{macro}{\l_siunitx_table_collect_tl}
%\begin{macro}{\l_siunitx_table_collect_pre_tl}
%\begin{macro}{\l_siunitx_table_collect_post_tl}
@@ -11879,7 +12636,7 @@ This work consists of the file siunitx.dtx
%
%\begin{macro}{\l_siunitx_table_math_bool}
% A flag used inside the table cell to track math mode: there is
-% a need to do things by hand as otherwise the grouping goes
+% a need to do things by hand as otherwise the grouping goes
% wrong.
% \begin{macrocode}
\bool_new:N \l_siunitx_table_math_bool
@@ -11895,26 +12652,26 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%
+%
%\begin{macro}{\siunitx_table_collect_begin:Nn}
%\begin{macro}[aux]{\siunitx_table_collect_begin_s:}
%\begin{macro}[aux]{\siunitx_table_collect_begin_S:}
% The collector starts by setting up local options, then clears and
-% initialises the storage and testing system.
+% initialises the storage and testing system.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_table_collect_begin:Nn #1#2 {
\keys_set:nn { siunitx } {#2}
\use:c { siunitx_table_collect_begin_ #1 : }
}
\cs_new_protected_nopar:Npn \siunitx_table_collect_begin_s: {
- \cs_set_eq:NN \siunitx_table_collect_token:N
+ \cs_set_eq:NN \siunitx_table_collect_token:N
\siunitx_table_collect_token_s:N
\cs_set_eq:NN \siunitx_table_print: \siunitx_table_print_s:
\siunitx_table_collect_init_s:
\siunitx_table_collect_get:
}
\cs_new_protected_nopar:Npn \siunitx_table_collect_begin_S: {
- \cs_set_eq:NN \siunitx_table_collect_token:N
+ \cs_set_eq:NN \siunitx_table_collect_token:N
\siunitx_table_collect_token_S:N
\cs_set_eq:NN \siunitx_table_print: \siunitx_table_print_S:
\siunitx_table_collect_init_S:
@@ -11925,7 +12682,7 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
+%\end{macro}
%
%\begin{macro}{\siunitx_table_collect_braced:n}
% The collection of braced items depends on the column type. So we
@@ -11937,20 +12694,20 @@ This work consists of the file siunitx.dtx
%
%\begin{macro}{\siunitx_table_collect_expand:N}
%\begin{macro}[aux]{\siunitx_table_collect_expand_math:N}
-% The idea here is to expand content if possible. There are a few
+% The idea here is to expand content if possible. There are a few
% things to note. Only macros which are not long or protected are
% expanded. There is the possibility that the macro may need the
% contents of the pre-numeral part to be executed, for example see
-% \cref{tab:xmpl:calc} in the user part of the documentation.
+% \cref{tab:xmpl:calc} in the user part of the documentation.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_table_collect_expand:N #1 {
\cs_if_eq:NNTF #1 \color
{
\bool_if:NTF \l_siunitx_table_collect_pre_bool
- {
+ {
\tl_clear:N \l_siunitx_number_color_tl
\tl_clear:N \l_siunitx_unit_color_tl
- \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1}
+ \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1}
}
{
\bool_set_true:N \l_siunitx_table_collect_post_bool
@@ -11958,17 +12715,17 @@ This work consists of the file siunitx.dtx
}
}
{
- \siunitx_cs_if_tl:NTF #1
+ \siunitx_cs_if_tl:NTF #1
{
\tl_use:N \l_siunitx_table_collect_pre_tl
\tl_clear:N \l_siunitx_table_collect_pre_tl
- \cs_set_nopar:Npx \siunitx_table_collect_next:
+ \cs_set_nopar:Npx \siunitx_table_collect_next:
{ \exp_not:N \siunitx_table_collect_get: \exp_not:V #1 }
}
{
\bool_if:NTF \l_siunitx_table_collect_pre_bool
- {
- \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1}
+ {
+ \tl_put_right:Nn \l_siunitx_table_collect_pre_tl {#1}
\siunitx_table_collect_expand_math:N #1
}
{
@@ -11981,7 +12738,7 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
% There is a need to keep a track of math mode, so that there are no
% disasters when the tokens are boxed up later. The ideal is to know
-% the math state of the collected tokens so that appropriate
+% the math state of the collected tokens so that appropriate
% steps can be taken to insert math shift tokens later.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_table_collect_expand_math:N #1 {
@@ -12007,16 +12764,16 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\siunitx_table_collect_get:}
%\begin{macro}{\siunitx_table_collect_get_aux:}
% The token collection system first has to check that the next argument
-% does not start with an opening-brace character. If it does, the
+% does not start with an opening-brace character. If it does, the
% testing is skipped and the braced token is stored. Otherwise, a check
% is made against various ignored tokens. At present, things seem to be
-% broken with \pkg{expl3}'s \cs{peek_catcode_ignore_spaces:NTF}, so
+% broken with \pkg{expl3}'s \cs{peek_catcode_ignore_spaces:NTF}, so
% everything is done by hand.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_collect_get: {
- \cs_set_eq:NN \siunitx_table_collect_next:
+ \cs_set_eq:NN \siunitx_table_collect_next:
\siunitx_table_collect_get:
- \cs_set_nopar:Npn \peek_execute_branches:
+ \cs_set_nopar:Npn \peek_execute_branches:
{
\tex_ifcat:D \exp_not:N \l_peek_token \c_group_begin_token
\exp_after:wN \siunitx_table_collect_braced:n
@@ -12041,17 +12798,17 @@ This work consists of the file siunitx.dtx
\bool_set_false:N \l_siunitx_table_math_bool
}
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%\begin{macro}{\siunitx_table_collect_init_s:}
%\begin{macro}{\siunitx_table_collect_init_S:}
-% Some type-specific definitions. In the \texttt{S} case, the
-% initialisation function for numbers is used to set
+% Some type-specific definitions. In the \texttt{S} case, the
+% initialisation function for numbers is used to set
% \cs{l_siunitx_number_valid_tl} correctly.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_collect_init_s: {
\siunitx_table_collect_init:
\bool_set_false:N \l_siunitx_table_collect_pre_bool
- \cs_set:Npn \siunitx_table_collect_braced:n ##1
+ \cs_set:Npn \siunitx_table_collect_braced:n ##1
{
\tl_put_right:Nn \l_siunitx_table_collect_tl { {##1} }
\siunitx_table_collect_next:
@@ -12059,7 +12816,7 @@ This work consists of the file siunitx.dtx
}
\cs_new_protected_nopar:Npn \siunitx_table_collect_init_S: {
\siunitx_number_in_init:
- \tl_set:Nx \l_siunitx_number_valid_tl
+ \tl_set:Nx \l_siunitx_number_valid_tl
{
\exp_not:V \l_siunitx_input_complex_tl
\exp_not:V \l_siunitx_input_decimal_tl
@@ -12070,10 +12827,10 @@ This work consists of the file siunitx.dtx
\exp_not:V \l_siunitx_input_uncert_close_tl
\exp_not:V \l_siunitx_input_uncert_open_tl
\exp_not:V \l_siunitx_input_sign_tl
- \exp_not:V \l_siunitx_input_symbol_tl
+ \exp_not:V \l_siunitx_input_symbol_tl
}
\bool_set_true:N \l_siunitx_table_collect_pre_bool
- \cs_set:Npn \siunitx_table_collect_braced:n ##1
+ \cs_set:Npn \siunitx_table_collect_braced:n ##1
{
\bool_if:NTF \l_siunitx_table_collect_pre_bool
{ \tl_put_right:Nn \l_siunitx_table_collect_pre_tl { {##1} } }
@@ -12085,7 +12842,7 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%\end{macro}
%
%\begin{macro}{\siunitx_table_collect_next:}
@@ -12096,9 +12853,9 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_table_collect_newline:}
-% The end macro needs to come before the new line is called. The
+% The end macro needs to come before the new line is called. The
% print function is redefined so that it only actually does stuff once.
-% As each cell is a group anyway, there is no need to save the
+% As each cell is a group anyway, there is no need to save the
% definition of \cs{siunitx_table_print:}, as it will re-appear on its
% own.
% \begin{macrocode}
@@ -12114,11 +12871,11 @@ This work consists of the file siunitx.dtx
%\begin{macro}[aux]{\siunitx_table_collect_not_braced_aux_i:N}
%\begin{macro}[aux]{\siunitx_table_collect_not_braced_aux_ii:N}
% A few macros are simply passed through to be executed; this is mainly
-% so that the table actually works. The newline function needs its own
+% so that the table actually works. The newline function needs its own
% function, which is picked up by hand.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_table_collect_not_braced:N #1 {
- \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D
+ \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D
{
\token_if_eq_meaning:NNF #1 \tex_unskip:D
{ \siunitx_table_collect_not_braced_aux_i:N #1 }
@@ -12126,20 +12883,20 @@ This work consists of the file siunitx.dtx
\siunitx_table_collect_next:
}
\cs_new_protected:Npn \siunitx_table_collect_not_braced_aux_i:N #1 {
- \cs_set:Npn \siunitx_table_collect_not_braced_aux_ii:N ##1
+ \cs_set:Npn \siunitx_table_collect_not_braced_aux_ii:N ##1
{
- \token_if_eq_meaning:NNT #1 ##1
+ \token_if_eq_meaning:NNT #1 ##1
{ \cs_set_eq:NN \siunitx_table_collect_next: ##1 }
}
- \tl_map_function:nN
- { \cs:w \end \endtabular \scan_stop: \siunitx_table_print: }
+ \tl_map_function:nN
+ { \cs:w \end \scan_stop: \siunitx_table_print: }
\siunitx_table_collect_not_braced_aux_ii:N
- \token_if_eq_meaning:NNT \siunitx_table_collect_next:
- \siunitx_table_collect_get:
+ \token_if_eq_meaning:NNT \siunitx_table_collect_next:
+ \siunitx_table_collect_get:
{
- \token_if_eq_meaning:NNTF #1 \tabularnewline
+ \token_if_eq_meaning:NNTF #1 \tabularnewline
{
- \cs_set_eq:NN \siunitx_table_collect_next:
+ \cs_set_eq:NN \siunitx_table_collect_next:
\siunitx_table_collect_newline:
}
{ \siunitx_table_collect_token:N #1 }
@@ -12157,7 +12914,7 @@ This work consists of the file siunitx.dtx
% area, so life is simple.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_table_collect_token:N #1 { }
-\cs_new_protected:Npn \siunitx_table_collect_token_s:N #1 {
+\cs_new_protected:Npn \siunitx_table_collect_token_s:N #1 {
\tl_put_right:Nn \l_siunitx_table_collect_tl {#1}
}
% \end{macrocode}
@@ -12170,10 +12927,10 @@ This work consists of the file siunitx.dtx
% it is passed on to the expansion handler.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_table_collect_token_S:N #1 {
- \bool_if:NTF \l_siunitx_table_collect_post_bool
+ \bool_if:NTF \l_siunitx_table_collect_post_bool
{ \tl_put_right:Nn \l_siunitx_table_collect_post_tl {#1} }
{
- \tl_if_in:NnTF \l_siunitx_number_valid_tl {#1}
+ \tl_if_in:NnTF \l_siunitx_number_valid_tl {#1}
{
\bool_set_false:N \l_siunitx_table_collect_pre_bool
\tl_put_right:Nn \l_siunitx_table_collect_tl {#1}
@@ -12186,6 +12943,26 @@ This work consists of the file siunitx.dtx
%
%\subsection{Table printing: general code}
%
+% Getting the general alignment correct in tables is made more
+% complex than one would like by the \pkg{colortbl} package. In the
+% original \LaTeXe{} definition, cell material is centred by a
+% construction of the (primitive) form
+%\begin{verbatim}
+% \hfil
+% #
+% \hfil
+%\end{verbatim}
+% which only uses \texttt{fil} stretch. That is altered by
+% \pkg{colortbl} to broadly
+%\begin{verbatim}
+% \hskip 0 pt plus 0.5 fill
+% \kern 0 pt
+% #
+% \hskip 0 pt plus 0.5 fill
+%\end{verbatim}
+% which means there is \texttt{fill} stretch to worry about and
+% the kern as well.
+%
%\begin{macro}{\c_siunitx_one_fill_skip}
% A fixed skip of one \texttt{fill}.
% \begin{macrocode}
@@ -12194,35 +12971,31 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\c_siunitx_table_correction_skip}
%\begin{macro}{\siunitx_table_colortbl_correction:}
% If the package \pkg{colortbl} is loaded, there is a need to allow
% that it changes how centring is carried out.
% \begin{macrocode}
-\skip_new:N \c_siunitx_table_correction_skip
\AtBeginDocument {
\@ifpackageloaded { colortbl }
- {
- \skip_set:Nn \c_siunitx_table_correction_skip
- { \c_zero_skip plus -0.5 fill }
+ {
+ \cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction:
+ {
+ \skip_horizontal:n { \c_zero_skip plus -0.5 fill }
+ \tex_kern:D \c_zero_skip
+ }
}
- {
- \skip_set:Nn \c_siunitx_table_correction_skip
- { \c_zero_skip }
+ {
+ \cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction:
+ { }
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction: {
- \skip_horizontal:n { \c_siunitx_table_correction_skip }
- \tex_kern:D \c_zero_skip
-}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\siunitx_table_align_left:n}
%\begin{macro}{\siunitx_table_align_right:n}
-% These are simple shortcuts to keep life clearer in the rest of the
-% code. The idea is that the kern acts as a \enquote{stop} for the
+% These are simple shortcuts to keep life clearer in the rest of the
+% code. The idea is that the kern acts as a \enquote{stop} for the
% horizontal skip. The correction for \pkg{colortbl} is separate as the
% spacing needs to be explicitly deleted.
% \begin{macrocode}
@@ -12240,63 +13013,108 @@ This work consists of the file siunitx.dtx
%\end{macro}
%\end{macro}
%
+%\begin{macro}{\siunitx_table_column_begin:}
+%\begin{macro}{\siunitx_table_column_end:}
+% \begin{macrocode}
+\cs_new_eq:NN \siunitx_table_column_begin:n \siunitx_table_align_left:n
+\cs_new_eq:NN \siunitx_table_column_end:n \siunitx_table_align_right:n
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+% Setting up for a fixed column width is done so that the check is
+% made at the key-setting stage. In that way, there will be some
+% speed gained if the key is set before the table, as the comparison
+% is not made for every cell.
+% \begin{macrocode}
+\keys_define:nn { siunitx } {
+ table-column-width .code:n =
+ {
+ \dim_compare:nNnTF {#1} = { \c_zero_dim }
+ {
+ \cs_new_eq:NN \siunitx_table_column_begin:n
+ \siunitx_table_align_left:n
+ \cs_new_eq:NN \siunitx_table_column_end:n
+ \siunitx_table_align_right:n
+ }
+ {
+ \cs_set_protected_nopar:Npn \siunitx_table_column_begin:n ##1
+ {
+ \siunitx_table_colortbl_correction:
+ \tex_hbox:D to \dim_eval:n {#1}
+ \c_group_begin_token
+ \skip_horizontal:n {##1}
+ \tex_kern:D \c_zero_skip
+ }
+ \cs_set_protected_nopar:Npn \siunitx_table_column_end:n ##1
+ {
+ \skip_horizontal:n { \c_siunitx_one_fill_skip - ##1 }
+ \tex_kern:D \c_zero_skip
+ \hbox_set_inline_end:
+ \siunitx_table_colortbl_correction:
+ }
+ }
+ }
+}
+% \end{macrocode}
+%
%\subsection{Printing units in \texttt{s} columns}
%
% The easiest type of printing is the \texttt{s} column. Here, there is
% no real problem with alignment. All that has to happen is to print the
% collected input as the argument to the internal part of an \cs{si}
% function.
-%
+%
%\begin{macro}{\l_siunitx_table_unit_align_skip}
% The spacing used is stored as a skip, which needs to be set up first.
% \begin{macrocode}
\skip_new:N \l_siunitx_table_unit_align_skip
% \end{macrocode}
-%\end{macro}
-%
+%\end{macro}
+%
% \begin{macrocode}
\keys_define:nn { siunitx } {
table-unit-alignment .choice:,
table-unit-alignment / center .code:n =
- {
- \skip_set:Nn \l_siunitx_table_unit_align_skip
- { \c_zero_skip plus 0.5 fill }
+ {
+ \skip_set:Nn \l_siunitx_table_unit_align_skip
+ { \c_zero_skip plus 0.5 fill }
},
table-unit-alignment / left .code:n =
- {
- \skip_set:Nn \l_siunitx_table_unit_align_skip
- { \c_zero_skip }
+ {
+ \skip_set:Nn \l_siunitx_table_unit_align_skip
+ { \c_zero_skip }
},
table-unit-alignment / right .code:n =
- {
- \skip_set:Nn \l_siunitx_table_unit_align_skip
- { \c_zero_skip plus 1 fill }
+ {
+ \skip_set:Nn \l_siunitx_table_unit_align_skip
+ { \c_zero_skip plus 1 fill }
},
}
\keys_set:nn { siunitx } {
table-unit-alignment = center
}
% \end{macrocode}
-%
+%
%\begin{macro}{\siunitx_table_print_s:}
% Actually printing an \texttt{s} column is not very complex. There is
% some spacing to do at each side, with the main part of the job being
% to print the material using the internal version of \cs{si}.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \siunitx_table_print_s: {
- \siunitx_table_align_left:n { \l_siunitx_table_unit_align_skip }
- \siunitx_unit_output:Vn \l_siunitx_table_collect_tl { }
- \siunitx_table_align_right:n { \l_siunitx_table_unit_align_skip }
+\cs_new_protected_nopar:Npn \siunitx_table_print_s: {
+ \siunitx_table_column_begin:n { \l_siunitx_table_unit_align_skip }
+ \siunitx_unit_output:Vn \l_siunitx_table_collect_tl { }
+ \siunitx_table_column_end:n { \l_siunitx_table_unit_align_skip }
}
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%
%\subsection{Formatting and printing in tables}
%
% With the content grabbed, the next stage is to turn it into formatted
% output then print it. Most of the formatting is done elsewhere, so
% most of the work here is in printing.
-%
+%
%\begin{macro}{\l_siunitx_table_center_decimal_bool}
% A switch for the basic \enquote{decimal marker in the middle}
% mode.
@@ -12388,7 +13206,7 @@ This work consists of the file siunitx.dtx
\dim_new:N \l_siunitx_table_space_dim
% \end{macrocode}
%\end{macro}
-%
+%
%\begin{macro}{\l_siunitx_table_text_align_skip}
%\begin{macro}{\l_siunitx_table_number_align_skip}
% Skips for aligning text and numbers.
@@ -12399,99 +13217,105 @@ This work consists of the file siunitx.dtx
%\end{macro}
%\end{macro}
%
-%\begin{macro}{\l_siunitx_table_align_exp_bool}
-%\begin{macro}{\l_siunitx_table_align_post_bool}
-%\begin{macro}{\l_siunitx_table_align_uncert_bool}
-%\begin{macro}{\l_siunitx_table_omit_exp_bool}
-%\begin{macro}{\l_siunitx_table_auto_bool}
-%\begin{macro}{\l_siunitx_table_comparator_bool}
-%\begin{macro}{\l_siunitx_table_decimal_int}
-%\begin{macro}{\l_siunitx_table_exponent_int}
-%\begin{macro}{\l_siunitx_table_integer_int}
-%\begin{macro}{\l_siunitx_table_uncert_int}
-%\begin{macro}{\l_siunitx_table_parse_only_bool}
-%\begin{macro}{\l_siunitx_table_pre_tl}
-%\begin{macro}{\l_siunitx_table_post_tl}
-%\begin{macro}{\l_siunitx_table_sign_exponent_bool}
-%\begin{macro}{\l_siunitx_table_sign_manitssa_bool}
+%\begin{macro}{
+% \l_siunitx_table_align_comparator_bool ,
+% \l_siunitx_table_align_exp_bool ,
+% \l_siunitx_table_align_post_bool ,
+% \l_siunitx_table_align_uncert_bool ,
+% \l_siunitx_table_omit_exp_bool ,
+% \l_siunitx_table_auto_bool ,
+% \l_siunitx_table_comparator_bool ,
+% \l_siunitx_table_decimal_int ,
+% \l_siunitx_table_exponent_int ,
+% \l_siunitx_table_integer_int ,
+% \l_siunitx_table_uncert_int ,
+% \l_siunitx_table_parse_only_bool ,
+% \l_siunitx_table_pre_tl ,
+% \l_siunitx_table_post_tl ,
+% \l_siunitx_table_sign_exponent_bool ,
+% \l_siunitx_table_sign_manitssa_bool ,
+%}
% As usual, set up the options.
% \begin{macrocode}
\keys_define:nn { siunitx } {
+ table-align-comparator .bool_set:N
+ = \l_siunitx_table_align_comparator_bool,
table-align-exponent .bool_set:N
= \l_siunitx_table_align_exp_bool,
- table-align-text-post .bool_set:N
+ table-align-text-post .bool_set:N
= \l_siunitx_table_align_post_bool,
table-align-uncertainty .bool_set:N
= \l_siunitx_table_align_uncert_bool,
table-number-alignment .choice:,
- table-number-alignment /
- center .code:n =
+ table-number-alignment /
+ center .code:n =
{
- \skip_set:Nn \l_siunitx_table_number_align_skip
- { \c_zero_skip plus 0.5 fill }
+ \skip_set:Nn \l_siunitx_table_number_align_skip
+ { \c_zero_skip plus 0.5 fill }
\bool_set_false:N \l_siunitx_table_center_decimal_bool
},
- table-number-alignment /
- center-decimal-marker .code:n =
+ table-number-alignment /
+ center-decimal-marker .code:n =
{
- \skip_set:Nn \l_siunitx_table_number_align_skip
- { \c_zero_skip plus 0.5 fill }
+ \skip_set:Nn \l_siunitx_table_number_align_skip
+ { \c_zero_skip plus 0.5 fill }
\bool_set_true:N \l_siunitx_table_center_decimal_bool
},
- table-number-alignment /
- left .code:n =
+ table-number-alignment /
+ left .code:n =
{
- \skip_set:Nn \l_siunitx_table_number_align_skip
- { \c_zero_skip }
+ \skip_set:Nn \l_siunitx_table_number_align_skip
+ { \c_zero_skip }
\bool_set_false:N \l_siunitx_table_center_decimal_bool
},
- table-number-alignment /
- right .code:n =
+ table-number-alignment /
+ right .code:n =
{
- \skip_set:Nn \l_siunitx_table_number_align_skip
- { \c_zero_skip plus 1 fill }
+ \skip_set:Nn \l_siunitx_table_number_align_skip
+ { \c_zero_skip plus 1 fill }
\bool_set_false:N \l_siunitx_table_center_decimal_bool
},
table-omit-exponent .bool_set:N = \l_siunitx_table_omit_exp_bool ,
table-text-alignment .choice:,
- table-text-alignment /
+ table-text-alignment /
center .code:n =
- {
- \skip_set:Nn \l_siunitx_table_text_align_skip
- { \c_zero_skip plus 0.5 fill }
+ {
+ \skip_set:Nn \l_siunitx_table_text_align_skip
+ { \c_zero_skip plus 0.5 fill }
},
- table-text-alignment /
+ table-text-alignment /
left .code:n =
- {
- \skip_set:Nn \l_siunitx_table_text_align_skip
- { \c_zero_skip }
+ {
+ \skip_set:Nn \l_siunitx_table_text_align_skip
+ { \c_zero_skip }
},
- table-text-alignment /
+ table-text-alignment /
right .code:n =
- {
- \skip_set:Nn \l_siunitx_table_text_align_skip
- { \c_zero_skip plus 1 fill }
+ {
+ \skip_set:Nn \l_siunitx_table_text_align_skip
+ { \c_zero_skip plus 1 fill }
},
table-auto-round .bool_set:N = \l_siunitx_table_auto_bool,
table-comparator .bool_set:N =
- \l_siunitx_table_comparator_bool,
+ \l_siunitx_table_comparator_bool,
table-figures-decimal .int_set:N = \l_siunitx_table_decimal_int,
- table-figures-exponent .int_set:N =
+ table-figures-exponent .int_set:N =
\l_siunitx_table_exponent_int,
table-figures-integer .int_set:N = \l_siunitx_table_integer_int,
table-figures-uncertainty .int_set:N = \l_siunitx_table_uncert_int ,
- table-parse-only .bool_set:N =
+ table-parse-only .bool_set:N =
\l_siunitx_table_parse_only_bool,
table-space-text-pre .tl_set:N =
- \l_siunitx_table_pre_tl,
+ \l_siunitx_table_pre_tl,
table-space-text-post .tl_set:N =
- \l_siunitx_table_post_tl,
- table-sign-exponent .bool_set:N =
+ \l_siunitx_table_post_tl,
+ table-sign-exponent .bool_set:N =
\l_siunitx_table_sign_exponent_bool,
- table-sign-mantissa .bool_set:N =
+ table-sign-mantissa .bool_set:N =
\l_siunitx_table_sign_mantissa_bool
}
\keys_set:nn { siunitx } {
+ table-align-comparator = true,
table-align-exponent = true,
table-align-text-post = true,
table-align-uncertainty = true,
@@ -12500,27 +13324,13 @@ This work consists of the file siunitx.dtx
table-figures-decimal = 2,
table-figures-integer = 3
}
-% \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{macrocode}
%\end{macro}
-%\end{macro}
%
% A meta-choice for all table alignment is also provided.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- table-alignment .meta:n =
+ table-alignment .meta:n =
{
table-number-alignment = #1,
table-text-alignment = #1,
@@ -12528,8 +13338,8 @@ This work consists of the file siunitx.dtx
}
}
% \end{macrocode}
-%
-%\begin{macro}{\siunitx_table_format_convert:nn}
+%
+%\begin{macro}{\siunitx_table_format_convert:nn}
% Another special option. This converts a number format in compacted
% form into the various internal settings needed. The function is used
% for the conversion to keep code down.
@@ -12538,20 +13348,20 @@ This work consists of the file siunitx.dtx
\prop_get:NnN \l_siunitx_number_in_prop {#1} \l_siunitx_tmpa_tl
\quark_if_no_value:NTF \l_siunitx_tmpa_tl
{ \int_set:cn { l_siunitx_table_ #2 _int } { 0 } }
- {
+ {
\prop_get:NnN \l_siunitx_number_in_prop {#1} \l_siunitx_tmpa_tl
\int_set:cn { l_siunitx_table_ #2 _int } { \l_siunitx_tmpa_tl }
}
}
\keys_define:nn { siunitx } {
- table-format .code:n =
+ table-format .code:n =
{
\siunitx_number_in_parse:n {#1}
\siunitx_table_format_convert:nn { mantissa-integer } { integer }
\siunitx_table_format_convert:nn { mantissa-decimal } { decimal }
\siunitx_table_format_convert:nn { mantissa-uncertainty }
{ uncert }
- \siunitx_table_format_convert:nn { exponent-integer }
+ \siunitx_table_format_convert:nn { exponent-integer }
{ exponent }
\prop_if_in:NnTF \l_siunitx_number_in_prop { comparator }
{ \bool_set_true:N \l_siunitx_table_comparator_bool }
@@ -12559,14 +13369,14 @@ This work consists of the file siunitx.dtx
\prop_if_in:NnTF \l_siunitx_number_in_prop { mantissa-sign }
{ \bool_set_true:N \l_siunitx_table_sign_mantissa_bool }
{ \bool_set_false:N \l_siunitx_table_sign_mantissa_bool }
- \prop_if_in:NnTF \l_siunitx_number_in_prop { exponent-sign }
+ \prop_if_in:NnTF \l_siunitx_number_in_prop { exponent-sign }
{ \bool_set_true:N \l_siunitx_table_sign_exponent_bool }
{ \bool_set_false:N \l_siunitx_table_sign_exponent_bool }
- \keys_set:nn { siunitx } { table-number-alignment = center }
+ \keys_set:nn { siunitx } { table-number-alignment = center }
},
}
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%
%\begin{macro}{\siunitx_table_print_S:}
% The main printing function does a simple test: was there anything
@@ -12576,36 +13386,36 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S: {
\bool_if:NTF \l_siunitx_table_collect_pre_bool
- {
- \siunitx_table_align_left:n { \l_siunitx_table_text_align_skip }
- \tl_use:N \l_siunitx_table_collect_pre_tl
- \siunitx_table_align_right:n
+ {
+ \siunitx_table_column_begin:n
+ { \l_siunitx_table_text_align_skip }
+ \tl_use:N \l_siunitx_table_collect_pre_tl
+ \siunitx_table_column_end:n
{ \l_siunitx_table_text_align_skip }
}
- {
- \siunitx_table_align_left:n
+ {
+ \siunitx_table_column_begin:n
{ \l_siunitx_table_number_align_skip }
- \siunitx_table_print_S_aux:
- \siunitx_table_align_right:n
+ \siunitx_table_print_S_aux:
+ \siunitx_table_column_end:n
{ \l_siunitx_table_number_align_skip }
}
}
% \end{macrocode}
%\end{macro}
-
%\begin{macro}[aux]{\siunitx_table_print_S_aux:}
% The auxiliary function now splits the path. If the number is only
% being parsed, then it is printed with no more fuss. Otherwise, there
% is a second choice based on the alignment approach.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_aux: {
- \bool_if:NTF \l_siunitx_table_parse_only_bool
- {
+ \bool_if:NTF \l_siunitx_table_parse_only_bool
+ {
\tl_use:N \l_siunitx_table_collect_pre_tl
- \siunitx_number_output:V \l_siunitx_table_collect_tl
+ \siunitx_number_output:V \l_siunitx_table_collect_tl
\tl_use:N \l_siunitx_table_collect_post_tl
}
- {
+ {
\bool_if:NTF \l_siunitx_table_center_decimal_bool
{ \siunitx_table_print_S_centered: }
{ \siunitx_table_print_S_reserved: }
@@ -12619,8 +13429,8 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_parse: {
\bool_set_false:N \l_siunitx_error_bool
- \siunitx_number_in_parse:V \l_siunitx_table_collect_tl
- \bool_if:NF \l_siunitx_error_bool
+ \siunitx_number_in_parse:V \l_siunitx_table_collect_tl
+ \bool_if:NF \l_siunitx_error_bool
{
\bool_if:NT \l_siunitx_table_omit_exp_bool
{ \bool_set_true:N \l_siunitx_process_fixed_bool }
@@ -12643,13 +13453,13 @@ This work consists of the file siunitx.dtx
% the decimal marker itself. There is then a measurement to see
% which part of the number is bigger: before or after the decimal
% marker. Based on that, a path is chosen. The two then come back
-% together to print any material after the number: the filling
+% together to print any material after the number: the filling
% space needed will be equal to the correction required to place notes,
% \emph{etc}.~flush with the number.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered: {
\siunitx_table_print_S_centered_ends:
- \dim_compare:nNnTF
+ \dim_compare:nNnTF
{ \box_wd:N \l_siunitx_table_pre_box } = { \c_zero_skip }
{ \tl_use:N \l_siunitx_table_collect_pre_tl }
{ \box_use:N \l_siunitx_table_pre_box }
@@ -12659,12 +13469,12 @@ This work consists of the file siunitx.dtx
\l_siunitx_number_out_prop
\siunitx_table_print_S_measure:Nnn \l_siunitx_number_out_prop
{ marker } { mantissa }
- \siunitx_table_print_S_measure:Nnn \l_siunitx_number_out_prop
+ \siunitx_table_print_S_measure:Nnn \l_siunitx_number_out_prop
{ result } { }
\box_set_eq:NN \l_siunitx_table_result_box \l_siunitx_tmp_box
\dim_set:Nn \l_siunitx_table_fill_dim
{ \l_siunitx_table_result_dim - \l_siunitx_table_integer_dim }
- \prop_if_in:NnT \l_siunitx_number_out_prop
+ \prop_if_in:NnT \l_siunitx_number_out_prop
{ mantissa-decimal-marker }
{
\dim_set:Nn \l_siunitx_table_fill_dim
@@ -12674,16 +13484,16 @@ This work consists of the file siunitx.dtx
{ \l_siunitx_table_integer_dim } > { \l_siunitx_table_fill_dim }
{ \siunitx_table_print_S_centered_integer: }
{ \siunitx_table_print_S_centered_decimal: }
- \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token }
+ \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token }
\bool_if:NTF \l_siunitx_table_align_post_bool
{ \box_use:N \l_siunitx_table_post_box }
- {
+ {
\dim_set:Nn \l_siunitx_table_fill_dim
{ - \dim_use:N \l_siunitx_table_fill_dim }
\skip_horizontal:N \l_siunitx_table_fill_dim
\box_use:N \l_siunitx_table_post_box
\box_use:N \l_siunitx_table_fill_box
- }
+ }
}
% \end{macrocode}
%\end{macro}
@@ -12694,43 +13504,43 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_ends: {
\hbox_set:Nn \l_siunitx_table_pre_box
- {
- {
+ {
+ {
\tl_use:N \l_siunitx_table_collect_pre_tl
- \bool_if:NT \l_siunitx_table_math_bool
- {
+ \bool_if:NT \l_siunitx_table_math_bool
+ {
\scan_stop:
- \c_math_shift_token
+ \c_math_shift_token
}
- }
+ }
}
\hbox_set:Nn \l_siunitx_table_post_box
- {
- \bool_if:NT \l_siunitx_table_math_bool
- {
+ {
+ \bool_if:NT \l_siunitx_table_math_bool
+ {
\c_math_shift_token
\scan_stop:
}
- \tl_use:N \l_siunitx_table_collect_post_tl
+ \tl_use:N \l_siunitx_table_collect_post_tl
}
- \dim_compare:nNnTF
- { \box_wd:N \l_siunitx_table_pre_box } >
+ \dim_compare:nNnTF
+ { \box_wd:N \l_siunitx_table_pre_box } >
{ \box_wd:N \l_siunitx_table_post_box }
{
\hbox_set_to_wd:Nnn \l_siunitx_table_post_box
{ \box_wd:N \l_siunitx_table_pre_box }
- {
+ {
\hbox_unpack:N \l_siunitx_table_post_box
- \tex_hfil:D
+ \tex_hfil:D
}
}
{
\hbox_set_to_wd:Nnn \l_siunitx_table_pre_box
{ \box_wd:N \l_siunitx_table_post_box }
- {
- \tex_hfil:D
+ {
+ \tex_hfil:D
\hbox_unpack:N \l_siunitx_table_pre_box
- }
+ }
}
}
% \end{macrocode}
@@ -12743,7 +13553,7 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_integer: {
\dim_set:Nn \l_siunitx_table_fill_dim
{ \l_siunitx_table_integer_dim - \l_siunitx_table_fill_dim }
- \hbox_set_to_wd:Nnn \l_siunitx_table_fill_box
+ \hbox_set_to_wd:Nnn \l_siunitx_table_fill_box
{ \l_siunitx_table_fill_dim } { \tex_hfil:D }
\box_use:N \l_siunitx_table_result_box
\box_use:N \l_siunitx_table_fill_box
@@ -12751,7 +13561,7 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_table_print_S_centered_decimal: {
\dim_set:Nn \l_siunitx_table_fill_dim
{ \l_siunitx_table_fill_dim - \l_siunitx_table_integer_dim }
- \hbox_set_to_wd:Nnn \l_siunitx_table_fill_box
+ \hbox_set_to_wd:Nnn \l_siunitx_table_fill_box
{ \l_siunitx_table_fill_dim } { \tex_hfil:D }
\box_use:N \l_siunitx_table_fill_box
\box_use:N \l_siunitx_table_result_box
@@ -12770,27 +13580,30 @@ This work consists of the file siunitx.dtx
\dim_zero:N \l_siunitx_table_gap_dim
\dim_zero:N \l_siunitx_table_space_dim
\siunitx_table_print_S_reserved_ends:
- \dim_compare:nNnTF
+ \dim_compare:nNnTF
{ \box_wd:N \l_siunitx_table_pre_box } = { \c_zero_skip }
{ \tl_use:N \l_siunitx_table_collect_pre_tl }
{
- \box_use:N \l_siunitx_table_pre_box
+ \box_use:N \l_siunitx_table_pre_box
\bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token }
}
\siunitx_table_print_S_model_create:
\bool_if:NT \l_siunitx_table_auto_bool
{
- \int_set:Nn \l_siunitx_process_precision_int
+ \int_set:Nn \l_siunitx_process_precision_int
{ \l_siunitx_table_decimal_int }
- \tl_set:Nn \l_siunitx_round_tl { places }
+ \tl_set:Nn \l_siunitx_round_tl { places }
}
\siunitx_table_print_S_parse:
\bool_if:NTF \l_siunitx_table_comparator_bool
- { \siunitx_table_print_S_reserved_comparator: }
+ {
+ \bool_if:NT \l_siunitx_table_align_comparator_bool
+ { \siunitx_table_print_S_reserved_comparator: }
+ }
{
\prop_if_in:NnT \l_siunitx_number_out_prop { comparator }
- {
- \msg_error:nnx { siunitx } { table-partial-number }
+ {
+ \msg_error:nnx { siunitx } { table-partial-number }
{ a~comparator }
}
}
@@ -12798,31 +13611,31 @@ This work consists of the file siunitx.dtx
{ \l_siunitx_table_integer_int + \l_siunitx_table_decimal_int } >
{ 0 }
{ \siunitx_table_print_S_reserved_mantissa: }
- {
+ {
\prop_if_in:NnT \l_siunitx_number_out_prop { mantissa-result }
- {
- \msg_error:nnx { siunitx } { table-partial-number }
+ {
+ \msg_error:nnx { siunitx } { table-partial-number }
{ a~mantissa }
}
}
\prop_if_in:NnT \l_siunitx_number_out_prop { complex-result }
- {
- \msg_error:nnx { siunitx } { table-partial-number }
+ {
+ \msg_error:nnx { siunitx } { table-partial-number }
{ a~complex }
}
\int_compare:nNnTF { \l_siunitx_table_exponent_int } > { 0 }
{ \siunitx_table_print_S_reserved_exponent: }
- {
+ {
\prop_if_in:NnT \l_siunitx_number_out_prop { exponent-result }
- {
- \msg_error:nnx { siunitx } { table-partial-number }
+ {
+ \msg_error:nnx { siunitx } { table-partial-number }
{ an~exponent }
}
}
- \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token }
+ \bool_if:NT \l_siunitx_table_math_bool { \c_math_shift_token }
\bool_if:NTF \l_siunitx_table_align_post_bool
{ \box_use:N \l_siunitx_table_post_box }
- {
+ {
\hbox_set_to_wd:Nnn \l_siunitx_table_fill_box
{ \dim_use:N \l_siunitx_table_gap_dim }
{ \tex_hfil:D }
@@ -12831,8 +13644,8 @@ This work consists of the file siunitx.dtx
\skip_horizontal:N \l_siunitx_table_gap_dim
\box_use:N \l_siunitx_table_post_box
\box_use:N \l_siunitx_table_fill_box
- }
-}
+ }
+}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\siunitx_table_print_S_reserved_ends:}
@@ -12840,31 +13653,31 @@ This work consists of the file siunitx.dtx
% created spaces.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_ends: {
- \hbox_set:Nn \l_siunitx_tmp_box
- {
+ \hbox_set:Nn \l_siunitx_tmp_box
+ {
\l_siunitx_table_pre_tl
- \bool_if:NT \l_siunitx_table_math_bool
- {
+ \bool_if:NT \l_siunitx_table_math_bool
+ {
\scan_stop:
\c_math_shift_token
}
}
\hbox_set_to_wd:Nnn \l_siunitx_table_pre_box
{ \box_wd:N \l_siunitx_tmp_box }
- {
+ {
\tex_hfil:D
- { \tl_use:N \l_siunitx_table_collect_pre_tl }
+ { \tl_use:N \l_siunitx_table_collect_pre_tl }
}
- \hbox_set:Nn \l_siunitx_tmp_box { \l_siunitx_table_post_tl }
+ \hbox_set:Nn \l_siunitx_tmp_box { \l_siunitx_table_post_tl }
\hbox_set_to_wd:Nnn \l_siunitx_table_post_box
{ \box_wd:N \l_siunitx_tmp_box }
- {
- \bool_if:NT \l_siunitx_table_math_bool
- {
+ {
+ \bool_if:NT \l_siunitx_table_math_bool
+ {
\c_math_shift_token
\scan_stop:
}
- \tl_use:N \l_siunitx_table_collect_post_tl
+ \tl_use:N \l_siunitx_table_collect_post_tl
\tex_hfil:D
}
}
@@ -12882,50 +13695,50 @@ This work consists of the file siunitx.dtx
{ \prop_put:Nnn \l_siunitx_number_in_prop { comparator } { \ll } }
\siunitx_table_print_S_model_aux:nn { integer } { mantissa-integer }
\siunitx_table_print_S_model_aux:nn { decimal } { mantissa-decimal }
- \siunitx_table_print_S_model_aux:nn { uncert }
+ \siunitx_table_print_S_model_aux:nn { uncert }
{ mantissa-uncertainty }
\siunitx_table_print_S_model_aux:nn { exponent } { exponent-integer }
- \int_compare:nNnF
+ \int_compare:nNnF
{ \l_siunitx_table_integer_int + \l_siunitx_table_decimal_int } =
{ 0 }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop { mantissa }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { mantissa }
{ true }
}
\int_compare:nNnT { \l_siunitx_table_decimal_int } > { 0 }
- {
- \prop_put:NnV \l_siunitx_number_in_prop
+ {
+ \prop_put:NnV \l_siunitx_number_in_prop
{ mantissa-decimal-marker }
- \l_siunitx_output_decimal_tl
+ \l_siunitx_output_decimal_tl
}
\bool_if:NT \l_siunitx_table_sign_mantissa_bool
{ \prop_put:Nnn \l_siunitx_number_in_prop { mantissa-sign } { - } }
\int_compare:nNnT { \l_siunitx_table_exponent_int } > { 0 }
- {
+ {
\bool_if:NT \l_siunitx_table_sign_exponent_bool
{
- \prop_put:Nnn \l_siunitx_number_in_prop { exponent-sign }
- { - }
- }
- }
+ \prop_put:Nnn \l_siunitx_number_in_prop { exponent-sign }
+ { - }
+ }
+ }
\siunitx_number_process_sign:
\siunitx_number_process_zero_fill:
\siunitx_number_process_mantissa:
- \prop_if_in:NnF \l_siunitx_number_in_prop { symbolic }
+ \prop_if_in:NnF \l_siunitx_number_in_prop { symbolic }
{ \siunitx_number_process_uncertainty: }
- \siunitx_number_format:
- \prop_set_eq:NN \l_siunitx_table_model_prop
+ \siunitx_number_format:
+ \prop_set_eq:NN \l_siunitx_table_model_prop
\l_siunitx_number_out_prop
}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_model_aux:nn #1#2 {
- \tl_set:Nx \l_siunitx_tmpa_tl
- {
- \prg_replicate:nn { \int_use:c { l_siunitx_table_ #1 _int } }
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ {
+ \prg_replicate:nn { \int_use:c { l_siunitx_table_ #1 _int } }
{ 8 }
}
\tl_if_empty:NF \l_siunitx_tmpa_tl
- {
- \prop_put:NnV \l_siunitx_number_in_prop {#2} \l_siunitx_tmpa_tl
+ {
+ \prop_put:NnV \l_siunitx_number_in_prop {#2} \l_siunitx_tmpa_tl
\prop_put:Nnn \l_siunitx_number_in_prop {#1} { true }
}
}
@@ -12937,18 +13750,18 @@ This work consists of the file siunitx.dtx
% the output so there is not so much to worry about.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_comparator:
- {
- \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
+ {
+ \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
{ comparator } { }
- \siunitx_table_print_S_get_comparator:Nn
+ \siunitx_table_print_S_get_comparator:Nn
\l_siunitx_number_out_prop { }
- \hbox_set_to_wd:Nnn \l_siunitx_table_result_box
+ \hbox_set_to_wd:Nnn \l_siunitx_table_result_box
{ \l_siunitx_table_comparator_dim }
{
\siunitx_print:nV { number } \l_siunitx_tmpa_tl
\tex_hfil:D
}
- \box_use:N \l_siunitx_table_result_box
+ \box_use:N \l_siunitx_table_result_box
}
% \end{macrocode}
%\end{macro}
@@ -12965,32 +13778,41 @@ This work consists of the file siunitx.dtx
\siunitx_table_print_S_reserved_mantissa_aux:n { mantissa }
\siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
{ mantissa } { }
- \siunitx_table_print_S_get_mantissa:Nn
+ \siunitx_table_print_S_get_mantissa:Nn
\l_siunitx_number_out_prop { }
- \dim_set:Nn \l_siunitx_table_space_dim
+ \dim_set:Nn \l_siunitx_table_space_dim
{ \l_siunitx_table_mantissa_dim }
\hbox_set:Nn \l_siunitx_table_result_box
{
\box_use:N \l_siunitx_table_fill_box
\siunitx_print:nV { number } \l_siunitx_tmpa_tl
}
- \dim_sub:Nn \l_siunitx_table_space_dim
+ \dim_sub:Nn \l_siunitx_table_space_dim
{ \box_wd:N \l_siunitx_table_result_box }
\hbox_set_to_wd:Nnn \l_siunitx_table_result_box
{ \l_siunitx_table_mantissa_dim }
- {
+ {
\box_use:N \l_siunitx_table_result_box
\tex_hfil:D
}
\box_use:N \l_siunitx_table_result_box
\siunitx_table_print_S_reserved_uncert:n { mantissa }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_mantissa_aux:n #1 {
- \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
- { integer } {#1}
- \siunitx_table_print_S_get_integer:Nn
- \l_siunitx_number_out_prop {#1}
+ \bool_if:NTF \l_siunitx_table_align_comparator_bool
+ {
+ \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
+ { integer } {#1}
+ \siunitx_table_print_S_get_integer:Nn
+ \l_siunitx_number_out_prop {#1}
+ }
+ {
+ \siunitx_table_print_S_measure_comparator_integer:N
+ \l_siunitx_table_model_prop
+ \siunitx_table_print_S_measure_comparator_integer_get:N
+ \l_siunitx_number_out_prop
+ }
\box_clear:N \l_siunitx_tmp_box
\tl_if_empty:NF \l_siunitx_tmpa_tl
{
@@ -12999,11 +13821,11 @@ This work consists of the file siunitx.dtx
}
\hbox_set_to_wd:Nnn \l_siunitx_table_fill_box
{ \l_siunitx_table_integer_dim - \box_wd:N \l_siunitx_tmp_box }
- { \tex_hfil:D }
- \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
+ { \tex_hfil:D }
+ \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
{ decimal } {#1}
\box_clear:N \l_siunitx_tmp_box
- \siunitx_table_print_S_get_decimal:Nn
+ \siunitx_table_print_S_get_decimal:Nn
\l_siunitx_number_out_prop {#1}
\tl_if_empty:NF \l_siunitx_tmpa_tl
{
@@ -13011,9 +13833,9 @@ This work consists of the file siunitx.dtx
{ \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
}
\dim_set:Nn \l_siunitx_table_gap_dim
- {
- \dim_use:N \l_siunitx_table_decimal_dim -
- \box_wd:N \l_siunitx_tmp_box
+ {
+ \dim_use:N \l_siunitx_table_decimal_dim -
+ \box_wd:N \l_siunitx_tmp_box
}
}
% \end{macrocode}
@@ -13027,32 +13849,32 @@ This work consists of the file siunitx.dtx
% symbol) or the mantissa (the number measuring). So some of the
% code is shared.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_uncert:n #1 {
\bool_if:NT \l_siunitx_uncert_sep_bool
{
\int_compare:nNnTF { \l_siunitx_table_uncert_int } > { 0 }
{ \siunitx_table_print_S_reserved_uncert_aux:n {#1} }
- {
- \prop_if_in:NnT \l_siunitx_number_out_prop
+ {
+ \prop_if_in:NnT \l_siunitx_number_out_prop
{ #1 -uncertainty }
- {
- \msg_error:nn { siunitx } { table-partial-number }
+ {
+ \msg_error:nn { siunitx } { table-partial-number }
{ an~uncertainty }
}
}
- }
+ }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_uncert_aux:n #1 {
- \siunitx_table_print_S_reserved_uncert_pm:n {#1}
+ \siunitx_table_print_S_reserved_uncert_pm:n {#1}
\siunitx_table_print_S_reserved_mantissa_aux:n { #1 -uncertainty }
\siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
{ uncert } {#1}
\siunitx_table_print_S_get_uncert:Nn \l_siunitx_number_out_prop {#1}
\hbox_set_to_wd:Nnn \l_siunitx_table_result_box
{ \l_siunitx_table_uncert_dim }
- {
+ {
\box_use:N \l_siunitx_table_fill_box
\siunitx_print:nV { number } \l_siunitx_tmpa_tl
\tex_hfil:D
@@ -13062,9 +13884,9 @@ This work consists of the file siunitx.dtx
{
\tex_hskip:D \l_siunitx_table_space_dim
\dim_zero:N \l_siunitx_table_space_dim
- }
+ }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_uncert_pm:n #1 {
\tl_clear:N \l_siunitx_tmpb_tl
\siunitx_number_format_join_uncert_pm:
@@ -13077,9 +13899,8 @@ This work consists of the file siunitx.dtx
\hbox_set_to_wd:Nnn \l_siunitx_table_result_box
{ \box_wd:N \l_siunitx_table_result_box } { \tex_hfil:D }
}
-
\bool_if:NF \l_siunitx_table_align_uncert_bool
- { \tex_hskip:D -\l_siunitx_table_space_dim }
+ { \tex_hskip:D -\l_siunitx_table_space_dim }
\box_use:N \l_siunitx_table_result_box
}
% \end{macrocode}
@@ -13097,64 +13918,68 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_exponent: {
\dim_zero:N \l_siunitx_table_gap_dim
- \siunitx_table_print_S_reserved_exponent_product:
- \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
+ \tl_if_empty:NTF \l_siunitx_output_exponent_tl
+ { \siunitx_table_print_S_reserved_exponent_product: }
+ {
+ \bool_if:NF \l_siunitx_table_align_exp_bool
+ { \tex_hskip:D -\l_siunitx_table_space_dim }
+ }
+ \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
{ exponent } { }
- \siunitx_table_print_S_get_exponent:Nn
+ \siunitx_table_print_S_get_exponent:Nn
\l_siunitx_number_out_prop { }
- \hbox_set_to_wd:Nnn \l_siunitx_table_result_box
+ \hbox_set_to_wd:Nnn \l_siunitx_table_result_box
{ \l_siunitx_table_exponent_dim }
{
\siunitx_print:nV { number } \l_siunitx_tmpa_tl
\tex_hfil:D
}
- \box_use:N \l_siunitx_table_result_box
+ \box_use:N \l_siunitx_table_result_box
\bool_if:NF \l_siunitx_table_align_exp_bool
- { \tex_hskip:D \l_siunitx_table_space_dim }
+ { \tex_hskip:D \l_siunitx_table_space_dim }
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_exponent_product: {
\tl_clear:N \l_siunitx_tmpa_tl
\box_clear:N \l_siunitx_table_result_box
\prop_if_in:NnTF \l_siunitx_table_model_prop { mantissa-result }
{ \siunitx_table_print_S_reserved_exponent_product_aux_i: }
- {
+ {
\prop_if_in:NnT \l_siunitx_table_model_prop { complex-result }
{ \siunitx_table_print_S_reserved_exponent_product_aux_i: }
}
\bool_if:NF \l_siunitx_table_align_exp_bool
- { \tex_hskip:D -\l_siunitx_table_space_dim }
+ { \tex_hskip:D -\l_siunitx_table_space_dim }
\box_use:N \l_siunitx_table_result_box
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_exponent_product_aux_i: {
\tl_set_eq:NN \l_siunitx_tmpa_tl \l_siunitx_exponent_product_tl
- \bool_if:NT \l_siunitx_tight_bool
- {
- \tl_set:Nx \l_siunitx_tmpa_tl
+ \bool_if:NT \l_siunitx_tight_bool
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ { \exp_not:V \l_siunitx_tmpa_tl } }
}
\tl_set:Nx \l_siunitx_tmpa_tl
- {
- \exp_not:N \siunitx_ensuremath:n
+ {
+ \exp_not:N \siunitx_ensuremath:n
{ { } \exp_not:V \l_siunitx_tmpa_tl { } }
}
\hbox_set:Nn \l_siunitx_table_result_box
{ \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
\prop_if_in:NnTF \l_siunitx_number_out_prop { exponent-result }
{
- \prop_if_in:NnF \l_siunitx_number_out_prop { mantissa-result }
+ \prop_if_in:NnF \l_siunitx_number_out_prop { mantissa-result }
{
- \prop_if_in:NnF \l_siunitx_number_out_prop { complex-result }
- {
+ \prop_if_in:NnF \l_siunitx_number_out_prop { complex-result }
+ {
\siunitx_table_print_S_reserved_exponent_product_aux_ii:
}
}
}
{ \siunitx_table_print_S_reserved_exponent_product_aux_ii: }
-
}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_exponent_product_aux_ii: {
\hbox_set_to_wd:Nnn \l_siunitx_table_result_box
{ \box_wd:N \l_siunitx_table_result_box } { \tex_hfil:D }
@@ -13166,7 +13991,7 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_table_print_S_measure:Nnn}
-% The measuring code recovers whatever is needed into
+% The measuring code recovers whatever is needed into
% \cs{l_siunitx_tmpa_tl} (as this is internal code, that is okay).
% The content is then boxed up and measured: if there is nothing to do,
% a bit of time can be saved by not boxing up at all.
@@ -13178,7 +14003,7 @@ This work consists of the file siunitx.dtx
{
\hbox_set:Nn \l_siunitx_tmp_box
{ \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
- \dim_set:cn { l_siunitx_table_ #2 _dim }
+ \dim_set:cn { l_siunitx_table_ #2 _dim }
{ \box_wd:N \l_siunitx_tmp_box }
}
}
@@ -13187,7 +14012,7 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\siunitx_table_print_S_get_comparator:Nn}
% Getting the comparator part is quite easy.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_get_comparator:Nn #1#2 {
\prop_get:NnN #1 { comparator } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
@@ -13198,7 +14023,7 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\siunitx_table_print_S_get_decimal:Nn}
% Grabbing the decimal part is a simple operation.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_get_decimal:Nn #1#2 {
\prop_get:NnN #1 { #2 -decimal } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
@@ -13209,7 +14034,7 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\siunitx_table_print_S_get_exponent:Nn}
% Getting the exponent part is quite easy.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_get_exponent:Nn #1#2 {
\prop_get:NnN #1 { exponent-result } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
@@ -13223,7 +14048,7 @@ This work consists of the file siunitx.dtx
% slightly odd approach here. There is also the comparator to
% worry about.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_get_integer:Nn #1#2 {
\prop_get:NnN #1 { #2 -sign } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
@@ -13237,32 +14062,38 @@ This work consists of the file siunitx.dtx
%\end{macro}
%\begin{macro}{\siunitx_table_print_S_get_mantissa:Nn}
% The mantissa without any uncertainty is needed by the reserved
-% space routine.
+% space routine.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn
+\cs_new_protected_nopar:Npn
\siunitx_table_print_S_get_mantissa:Nn #1#2 {
\prop_get:NnN #1 { mantissa } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
{ \tl_clear:N \l_siunitx_tmpa_tl }
+ \bool_if:NF \l_siunitx_table_align_comparator_bool
+ {
+ \prop_get:NnN #1 { comparator } \l_siunitx_tmpb_tl
+ \quark_if_no_value:NF \l_siunitx_tmpb_tl
+ { \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl }
+ }
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\siunitx_table_print_S_get_marker:Nn}
-% The decimal marker is always going to be boxed up using the
+%\begin{macro}{\siunitx_table_print_S_get_marker:Nn}
+% The decimal marker is always going to be boxed up using the
% standard version, not any possible copied value. So the code can be
% kept quite clear.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_get_marker:Nn #1#2 {
\tl_set:Nx \l_siunitx_tmpa_tl
- {
- \exp_not:N \siunitx_ensuremath:n
+ {
+ \exp_not:N \siunitx_ensuremath:n
{ \exp_not:V \l_siunitx_output_decimal_tl }
}
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\siunitx_table_print_S_get_result:Nn}
-% Getting the result values is easy.
+%\begin{macro}{\siunitx_table_print_S_get_result:Nn}
+% Getting the result values is easy.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_get_result:Nn #1#2 {
\prop_get:NnN #1 { result } \l_siunitx_tmpa_tl
@@ -13271,7 +14102,7 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\siunitx_table_print_S_get_uncert:Nn}
+%\begin{macro}{\siunitx_table_print_S_get_uncert:Nn}
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_get_uncert:Nn #1#2 {
\prop_get:NnN #1 { #2 -uncertainty } \l_siunitx_tmpa_tl
@@ -13282,12 +14113,26 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\siunitx_table_print_S_measure_comparator_integer:N}
+%\begin{macro}{\siunitx_table_print_S_measure_comparator_integer_get:N}
% A special-case macro when the comparator is also needed in
% measuring up the integer part of the mantissa.
% \begin{macrocode}
\cs_new_protected_nopar:Npn
\siunitx_table_print_S_measure_comparator_integer:N #1
{
+ \siunitx_table_print_S_measure_comparator_integer_get:N #1
+ \tl_if_empty:NTF \l_siunitx_tmpa_tl
+ { \dim_set:Nn \l_siunitx_table_integer_dim { \c_zero_skip } }
+ {
+ \hbox_set:Nn \l_siunitx_tmp_box
+ { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
+ \dim_set:Nn \l_siunitx_table_integer_dim
+ { \box_wd:N \l_siunitx_tmp_box }
+ }
+ }
+\cs_new_protected_nopar:Npn
+ \siunitx_table_print_S_measure_comparator_integer_get:N #1
+ {
\prop_get:NnN #1 { comparator } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
{ \tl_clear:N \l_siunitx_tmpa_tl }
@@ -13298,17 +14143,10 @@ This work consists of the file siunitx.dtx
\quark_if_no_value:NT \l_siunitx_tmpb_tl
{ \tl_clear:N \l_siunitx_tmpb_tl }
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \tl_if_empty:NTF \l_siunitx_tmpa_tl
- { \dim_set:Nn \l_siunitx_table_integer_dim { \c_zero_skip } }
- {
- \hbox_set:Nn \l_siunitx_tmp_box
- { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
- \dim_set:Nn \l_siunitx_table_integer_dim
- { \box_wd:N \l_siunitx_tmp_box }
- }
}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%
%\subsection{Direct printing in \texttt{S} columns}
%
@@ -13316,19 +14154,19 @@ This work consists of the file siunitx.dtx
% tabular material is not suitable. Instead, the strategy used by
% \pkg{dcolumn} can be applied, which requires the decimal marker to
% be made active in math mode.
-%
+%
%\begin{macro}{\siunitx_table_direct:}
-% The main part of the system simply makes a choice about the
+% The main part of the system simply makes a choice about the
% methods to use.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_table_direct: {
- \m@th
+ \m@th
\bool_if:NTF \l_siunitx_table_center_decimal_bool
{ \siunitx_table_direct_centered: }
{ \siunitx_table_direct_reserved: }
}
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%
%\begin{macro}{\siunitx_table_direct_centered:}
%\begin{macro}[aux]{\siunitx_table_direct_centered_aux:N}
@@ -13340,15 +14178,15 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\char_make_active:N \@
\cs_new_protected_nopar:Npn \siunitx_table_direct_centered: {
- \cs_set_eq:NN \siunitx_table_print:
+ \cs_set_eq:NN \siunitx_table_print:
\siunitx_table_direct_centered_end:
- \hbox_set:Nn \l_siunitx_tmp_box
+ \hbox_set:Nn \l_siunitx_tmp_box
{ \siunitx_ensuremath:n { \l_siunitx_output_decimal_tl } }
- \hbox_set_to_wd:Nnn \l_siunitx_table_post_box
+ \hbox_set_to_wd:Nnn \l_siunitx_table_post_box
{ \box_wd:N \l_siunitx_tmp_box }
- { \tex_hfil:D }
- \hbox_set:Nn \l_siunitx_table_pre_box
- \c_group_begin_token
+ { \tex_hfil:D }
+ \hbox_set:Nn \l_siunitx_table_pre_box
+ \c_group_begin_token
\c_math_shift_token
\tl_map_function:NN \l_siunitx_input_decimal_tl
\siunitx_table_direct_centered_aux:N
@@ -13370,10 +14208,10 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_table_direct_centered_end: {
\c_math_shift_token
\c_group_end_token
- \dim_compare:nNnTF
- { \box_wd:N \l_siunitx_table_pre_box } >
+ \dim_compare:nNnTF
+ { \box_wd:N \l_siunitx_table_pre_box } >
{ \box_wd:N \l_siunitx_table_post_box }
- {
+ {
\hbox_set_to_wd:Nnn \l_siunitx_table_post_box
{ \box_wd:N \l_siunitx_table_pre_box }
{
@@ -13381,7 +14219,7 @@ This work consists of the file siunitx.dtx
\tex_hfil:D
}
}
- {
+ {
\hbox_set_to_wd:Nnn \l_siunitx_table_pre_box
{ \box_wd:N \l_siunitx_table_post_box }
{
@@ -13407,40 +14245,40 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\char_make_active:N \@
\cs_new_protected_nopar:Npn \siunitx_table_direct_reserved: {
- \cs_set_eq:NN \siunitx_table_print:
+ \cs_set_eq:NN \siunitx_table_print:
\siunitx_table_direct_reserved_end:
- \tl_set:Nx \l_siunitx_tmpa_tl
- { \prg_replicate:nn { \l_siunitx_table_integer_int } { 8 } }
- \hbox_set:Nn \l_siunitx_tmp_box
- {
- \siunitx_ensuremath:n
- {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { \prg_replicate:nn { \l_siunitx_table_integer_int } { 8 } }
+ \hbox_set:Nn \l_siunitx_tmp_box
+ {
+ \siunitx_ensuremath:n
+ {
\bool_if:NT \l_siunitx_table_sign_mantissa_bool { - }
- \l_siunitx_tmpa_tl
- }
+ \l_siunitx_tmpa_tl
+ }
}
\dim_set:Nn \l_siunitx_table_integer_dim
- { \box_wd:N \l_siunitx_tmp_box }
- \tl_set:Nx \l_siunitx_tmpa_tl
+ { \box_wd:N \l_siunitx_tmp_box }
+ \tl_set:Nx \l_siunitx_tmpa_tl
{ \prg_replicate:nn { \l_siunitx_table_decimal_int } { 8 } }
- \hbox_set:Nn \l_siunitx_tmp_box
- {
- \siunitx_ensuremath:n
- {
+ \hbox_set:Nn \l_siunitx_tmp_box
+ {
+ \siunitx_ensuremath:n
+ {
\l_siunitx_output_decimal_tl
\l_siunitx_tmpa_tl
- }
+ }
}
- \hbox_set_to_wd:Nnn \l_siunitx_table_post_box
+ \hbox_set_to_wd:Nnn \l_siunitx_table_post_box
{ \box_wd:N \l_siunitx_tmp_box }
- { \tex_hfil:D }
- \hbox_set_to_wd:Nnn \l_siunitx_table_pre_box
+ { \tex_hfil:D }
+ \hbox_set_to_wd:Nnn \l_siunitx_table_pre_box
{ \l_siunitx_table_integer_dim }
- \c_group_begin_token
+ \c_group_begin_token
\c_math_shift_token
\tl_map_function:NN \l_siunitx_input_decimal_tl
- \siunitx_table_direct_reserved_aux:N
- \tex_hfill:D
+ \siunitx_table_direct_reserved_aux:N
+ \tex_hfill:D
}
\cs_new_protected_nopar:Npn \siunitx_table_direct_reserved_aux:N #1 {
\char_set_lccode:nn { `\@ } { `#1 }
@@ -13460,7 +14298,7 @@ This work consists of the file siunitx.dtx
\cs_new_protected_nopar:Npn \siunitx_table_direct_reserved_end: {
\c_math_shift_token
\tex_hfil:D
- \c_group_end_token
+ \c_group_end_token
\siunitx_table_align_left:n { \l_siunitx_table_number_align_skip }
\box_use:N \l_siunitx_table_pre_box
\box_use:N \l_siunitx_table_post_box
@@ -13473,10 +14311,10 @@ This work consists of the file siunitx.dtx
%
%\subsection{Symbols}
%
-% Not all units use letters alone for their symbol. This raises two
+% Not all units use letters alone for their symbol. This raises two
% problems. First, the symbols need to work in math and in text mode.
% Second, the user needs to be able to adjust each symbol.
-%
+%
%\begin{macro}{\l_siunitx_redefine_symbols_bool}
% Only one setting applies here!
% \begin{macrocode}
@@ -13487,39 +14325,39 @@ This work consists of the file siunitx.dtx
redefine-symbols = true
}
% \end{macrocode}
-%\end{macro}
+%\end{macro}
%
% The redefinition of symbols has to do a number of checks to ensure
% that there are no clashes.
% \begin{macrocode}
\AtBeginDocument {
- \bool_if:NT \l_siunitx_redefine_symbols_bool
+ \bool_if:NT \l_siunitx_redefine_symbols_bool
{
- \@ifpackageloaded { textcomp }
+ \@ifpackageloaded { textcomp }
{
- \keys_set:nn { siunitx }
+ \keys_set:nn { siunitx }
{
math-degree = \text { \textdegree },
text-degree = \textdegree,
}
- \@ifpackageloaded { mathptmx } { }
+ \@ifpackageloaded { mathptmx } { }
{
\keys_set:nn { siunitx } { text-micro = \textmu }
\@ifpackageloaded { fourier } { }
- { \keys_set:nn { siunitx } { text-ohm = \textohm } }
+ { \keys_set:nn { siunitx } { text-ohm = \textohm } }
}
\str_if_eq:VnT \encodingdefault { OT1 }
- {
- \keys_set:nn { siunitx }
+ {
+ \keys_set:nn { siunitx }
{
math-angstrom = \text { \capitalring { A } },
text-angstrom = \capitalring { A }
}
}
} { }
- \@ifpackageloaded { upgreek }
+ \@ifpackageloaded { upgreek }
{
- \keys_set:nn { siunitx }
+ \keys_set:nn { siunitx }
{ math-ohm = \Upomega }
} { }
}
@@ -13535,8 +14373,8 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\l_siunitx_ohm_math_tl}
% The symbol storage macros are created separately for math and text
% mode, although this is all pretty similar. The default definitions use
-% what is generally available, except for those for micro, where
-% Computer Modern does not have the appropriate symbol at all. For the
+% what is generally available, except for those for micro, where
+% Computer Modern does not have the appropriate symbol at all. For the
% math mode omega option, the "\text{\ensuremath{...}}" construction
% deals with the case where \cs{mathnormal} has the wrong symbol.
% \begin{macrocode}
@@ -13588,7 +14426,7 @@ This work consists of the file siunitx.dtx
text-angstrom = \AA,
text-arcminute = \ensuremath { { } ^ { \prime } },
text-arcsecond = \ensuremath { { } ^ { \prime \prime } },
- text-celsius =
+ text-celsius =
\ensuremath { { } ^ { \circ } \kern - \scriptspace \text { C } },
text-degree = \ensuremath { { } ^ { \circ } },
text-micro = \c_siunitx_mu_tl ,
@@ -13607,9 +14445,9 @@ This work consists of the file siunitx.dtx
% For creating the outer symbol macro.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_symbol_new:n #1 {
- \cs_set_protected_nopar:cpn { SIUnitSymbol #1 }
+ \cs_set_protected_nopar:cpn { SIUnitSymbol #1 }
{
- \mode_if_math:TF
+ \mode_if_math:TF
{ \tl_to_lowercase:n { \use:c { l_siunitx_ #1 _math_tl } } }
{ \tl_to_lowercase:n { \use:c { l_siunitx_ #1 _text_tl } } }
}
@@ -13630,7 +14468,7 @@ This work consists of the file siunitx.dtx
\siunitx_symbol_new:n { Arcminute }
\siunitx_symbol_new:n { Arcsecond }
\siunitx_symbol_new:n { Celsius }
-\siunitx_symbol_new:n { Degree }
+\siunitx_symbol_new:n { Degree }
\siunitx_symbol_new:n { Micro }
\siunitx_symbol_new:n { Ohm }
% \end{macrocode}
@@ -13647,7 +14485,7 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\l_siunitx_pgf_link_clist}
%\begin{macro}{\siunitx_pgf_link:}
% Here, the settings used by \pkg{siunitx} are translated into those for
-% \pkg{pgf}. Things could be done more efficiently, but the logic would
+% \pkg{pgf}. Things could be done more efficiently, but the logic would
% be more difficult to follow.
% \begin{macrocode}
\clist_new:N \l_siunitx_pgf_link_clist
@@ -13656,66 +14494,66 @@ This work consists of the file siunitx.dtx
\str_if_eq:VnT \l_siunitx_round_tl { figure }
{
\clist_put_right:Nn \l_siunitx_pgf_link_clist { fixed }
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
{ fixed~zerofill = true }
}
\clist_put_right:Nx \l_siunitx_pgf_link_clist
{ precision = \int_use:N \l_siunitx_process_precision_int }
\clist_put_right:Nx \l_siunitx_pgf_link_clist
- {
- set~decimal~separator =
+ {
+ set~decimal~separator =
{ { \exp_not:V \l_siunitx_output_decimal_tl } }
- }
+ }
\clist_put_right:Nx \l_siunitx_pgf_link_clist
- {
- set~thousands~separator =
- { \exp_not:V \l_siunitx_group_sep_tl }
- }
+ {
+ set~thousands~separator =
+ { \exp_not:V \l_siunitx_group_sep_tl }
+ }
\bool_if:NTF \l_siunitx_group_four_bool
- {
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ {
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
{ min~exponent~for~1000~sep = 3 }
}
- {
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ {
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
{ min~exponent~for~1000~sep = 4 }
}
\bool_if:nF
- {
+ {
\l_siunitx_group_decimal_bool ||
- \l_siunitx_group_integer_bool
- }
+ \l_siunitx_group_integer_bool
+ }
{
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
- { min~exponent~for~1000~sep = 999 }
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ { min~exponent~for~1000~sep = 999 }
}
\bool_if:NTF \l_siunitx_process_integer_zero_bool
- {
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ {
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
{ skip~0. = false }
}
{
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
{ skip~0. = true }
- }
+ }
\str_if_eq:VnTF \l_siunitx_process_sign_tl { + }
- {
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ {
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
{ showpos = true }
}
{
- \clist_put_right:Nn \l_siunitx_pgf_link_clist
+ \clist_put_right:Nn \l_siunitx_pgf_link_clist
{ showpos = false }
- }
- \group_begin:
+ }
+ \group_begin:
\cs_set_nopar:Npx \siunitx_tmp:w
{
\group_end:
- \exp_not:N \pgfqkeys
+ \exp_not:N \pgfqkeys
{ /pgf/number~format }
{ \exp_not:V \l_siunitx_pgf_link_clist }
- }
- \siunitx_tmp:w
+ }
+ \siunitx_tmp:w
}
% \end{macrocode}
%\end{macro}
@@ -13726,29 +14564,29 @@ This work consists of the file siunitx.dtx
% Lots of messages, all of them together in one block to make life
% easier.
% \begin{macrocode}
-\msg_set:nnnn { siunitx } { bad-arc-sign }
+\msg_set:nnnn { siunitx } { bad-arc-sign }
{ Incorrect~use~of~sign~in~degree-minute-second~angle. }
{ Only~the~highest~value~part~of~an~angle~can~have~a~sign. }
-\msg_set:nnnn { siunitx } { duplicate-complex-root-token }
+\msg_set:nnnn { siunitx } { duplicate-complex-root-token }
{ Duplicate~complex~root~token~'#1'~in~input. }
{ Only~one~complex~root~token~can~appear~in~a~single~number. }
-\msg_set:nnnn { siunitx } { duplicate-decimal-token }
+\msg_set:nnnn { siunitx } { duplicate-decimal-token }
{ Duplicate~decimal~marker~token~'#1'~in~input. }
- { Only one decimal marker token can appear in a single number. }
-\msg_set:nnnn { siunitx } { duplicate-exponent-token }
+ { Only~one~decimal~marker~token~can~appear~in~a~single~number. }
+\msg_set:nnnn { siunitx } { duplicate-exponent-token }
{ Duplicate~exponent~marker~token~'#1'~in~input. }
{ Only~one~exponent~marker~token~can~appear~in~a~single~number. }
-\msg_set:nnnn { siunitx } { duplicate-quotient-token }
- { Duplicate~quotient~token. }
+\msg_set:nnnn { siunitx } { duplicate-quotient-token }
+ { Duplicate~quotient~token. }
{ Only~one~quotient~token~can~appear~in~a~single~number. }
-\msg_set:nnnn { siunitx } { duplicate-sticky-per }
- { Duplicate~\token_to_str:N \per. }
+\msg_set:nnnn { siunitx } { duplicate-sticky-per }
+ { Duplicate~\token_to_str:N \per. }
{
- When~the~'sticky-per'~option~is~active,~only~one
+ When~the~'sticky-per'~option~is~active,~only~one
\token_to_str:N \per \\
may~appear~in~a~unit.
}
-\msg_set:nnnn { siunitx } { empty-arc }
+\msg_set:nnnn { siunitx } { empty-arc }
{ Empty~degree-minute-second~angle. }
{ The~angle~given~does~not~contain~any~numbers. }
\msg_set:nnnn { siunitx } { empty-uncertainty }
@@ -13757,16 +14595,16 @@ This work consists of the file siunitx.dtx
\msg_set:nnnn { siunitx } { ending-product-token }
{ Misplaced~product~token. }
{ A~number~cannot~end~with~a~product~token. }
-\msg_set:nnnn { siunitx } { ending-quotient-token }
+\msg_set:nnnn { siunitx } { ending-quotient-token }
{ Misplaced~quotient~token. }
{ A~number~cannot~end~with~a~quotient~token. }
-\msg_set:nnnn { siunitx } { invalid-arc-format }
+\msg_set:nnnn { siunitx } { invalid-arc-format }
{ Invalid~degree-minute-second angle~'#1'. }
{
Angles~given~in~degree-minute-second~format~should~contain~two~';'\\
symbols~to~divide~up~the~parts~of~the~input.\\
}
-\msg_set:nnnn { siunitx } { invalid-number }
+\msg_set:nnnn { siunitx } { invalid-number }
{ Invalid~numerical~input~'#1'. }
{
The~input given~as~a~number~does~not~make~logical~sense.\\
@@ -13798,16 +14636,16 @@ This work consists of the file siunitx.dtx
You~gave~the~literal~input~'#1'\\
but~literal~unit~output~is~disabled.
}
-\msg_set:nnnn { siunitx } { misplaced-sign-token }
+\msg_set:nnnn { siunitx } { misplaced-sign-token }
{ Misplaced~sign~token~'#1'. }
{ Sign~tokens~can~only~come~at~the~beginning~of~a~number. }
-\msg_set:nnnn { siunitx } { misplaced-complex-root-token }
- { Misplaced~complex~token~in~numerical~input~'#1'. }
+\msg_set:nnnn { siunitx } { misplaced-complex-root-token }
+ { Misplaced~complex~token~in~numerical~input~'#1'. }
{
The~root~token~must~come~either~before~or~after~the~real~digits\\
of~the~complex~part.
}
-\msg_set:nnnn { siunitx } { misplaced-uncertainty-token }
+\msg_set:nnnn { siunitx } { misplaced-uncertainty-token }
{ Misplaced~uncertainty~token~'#1'. }
{
The~uncertainty~in~a~number~must~be~given~between~a~set~of~
@@ -13816,7 +14654,7 @@ This work consists of the file siunitx.dtx
'input-open-uncertainty'~and~'input-close-uncertainty'\\
options.
}
-\msg_set:nnnn { siunitx } { multi-part-range }
+\msg_set:nnnn { siunitx } { multi-part-range }
{ Numerical~range~with~multiple~parts. }
{
The~input~'#1'~is~a~number~which~has~more~than~one~part.\\
@@ -13832,54 +14670,54 @@ This work consists of the file siunitx.dtx
You~have~asked~for~prefixes~to~be~converted~into~a~power,\\
but~the~bases~do~not~match.
}
-\msg_set:nnn { siunitx } { prefix-only }
+\msg_set:nnn { siunitx } { prefix-only }
{ Prefix~with~no~unit. }
-\msg_set:nnnn { siunitx } { qualifier-before-unit }
+\msg_set:nnnn { siunitx } { qualifier-before-unit }
{ Qualifier~before~unit. }
{ Unit~qualifiers~have~to~follow~after~units,~not~before~them. }
-\msg_set:nnnn { siunitx } { restricted-number }
+\msg_set:nnnn { siunitx } { restricted-number }
{ Token~'#1'~forbidden~in~restricted~numerical~input. }
- {
+ {
The~current~input~must~be~a~real~number~and~cannot~contain: \\
\c_space_tl -~an~exponent; \\
\c_space_tl -~an~uncertainty; \\
\c_space_tl -~a~complex~part.
}
-\msg_set:nnnn { siunitx } { starting-product-token }
+\msg_set:nnnn { siunitx } { starting-product-token }
{ Misplaced~product~token. }
{ A~number~cannot~begin~with~a~product~token. }
-\msg_set:nnnn { siunitx } { starting-quotient-token }
+\msg_set:nnnn { siunitx } { starting-quotient-token }
{ Misplaced~quotient~token. }
{ A~number~cannot~begin~with~a~quotient~token. }
\msg_set:nnnn { siunitx } { table-partial-number }
{ No~space~reserved~for~#1~\msg_line_context:. }
- {
+ {
The~number~in~the~current~table~cell~contains~#1~part, \\
but~you~did~not~reserve~any~space~to~print~it: \\
it~will~be~missing~in~the~output.
}
-\msg_set:nnnn { siunitx } { unknown-configuration-file }
+\msg_set:nnnn { siunitx } { unknown-configuration-file }
{ Unknown~configuration~'#1'. }
{ The~configuration~file~'siunitx-#1.cfg'~was~not~found. }
-\msg_set:nnnn { siunitx } { unknown-option }
+\msg_set:nnnn { siunitx } { unknown-option }
{ Unknown~option~'#1'. }
- {
+ {
The~option~file~'#1'~is~not~known~by~siunitx: \\
perhaps~it~is~spelled~incorrectly.
}
-\msg_set:nnnn { siunitx } { version-1-option }
+\msg_set:nnnn { siunitx } { version-1-option }
{ Version~1~option~'#1'~detected. }
- {
+ {
Use: \\
- \c_space_tl \c_space_tl
+ \c_space_tl \c_space_tl
\token_to_str:N \usepackage[load-configurations = version-1]
\token_to_str:N { siunitx \token_to_str:N } \\
in~the~preamble~to~load~the~appropriate~code.
}
% \end{macrocode}
-%
+%
%\subsection{Design-level macros}
-%
+%
%\begin{macro}{\DeclareBinaryPrefix}
%\begin{macro}{\DeclareSIPostPower}
%\begin{macro}{\DeclareSIPrefix}
@@ -13890,36 +14728,36 @@ This work consists of the file siunitx.dtx
% The macros for creating units and so on are in design name space.
% Basically, a set of shuffles for arguments.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \DeclareBinaryPrefix #1#2#3 {
+\NewDocumentCommand \DeclareBinaryPrefix { m m m } {
\siunitx_declare_prefix:Nnnn #1 {#2} { 2 } {#3}
}
-\cs_new_protected_nopar:Npn \DeclareSIPostPower #1#2 {
+\NewDocumentCommand \DeclareSIPostPower { m m } {
\siunitx_declare_power_after:Nn #1 {#2}
}
-\cs_new_protected_nopar:Npn \DeclareSIPrefix #1#2#3 {
+\NewDocumentCommand \DeclareSIPrefix { m m m } {
\siunitx_declare_prefix:Nnnn #1 {#2} { 10 } {#3}
}
-\cs_new_protected_nopar:Npn \DeclareSIPrePower #1#2 {
+\NewDocumentCommand \DeclareSIPrePower { m m } {
\siunitx_declare_power_before:Nn #1 {#2}
}
-\cs_new_protected_nopar:Npn \DeclareSIQualifier #1#2 {
+\NewDocumentCommand \DeclareSIQualifier { m m } {
\siunitx_declare_qualifier:Nn #1 {#2}
}
-\cs_new_protected_nopar:Npn \DeclareSIUnit #1#2 {
- \siunitx_declare_unit:Nnn #1 {#2} { }
+\NewDocumentCommand \DeclareSIUnit { O { } m m } {
+ \siunitx_declare_unit:Nnn #2 {#3} {#1}
}
-\cs_new_protected_nopar:Npn \DeclareSIUnitWithOptions #1#2#3 {
+\NewDocumentCommand \DeclareSIUnitWithOptions { m m m } {
\siunitx_declare_unit:Nnn #1 {#2} {#3}
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
-%
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
% None of this should be done after the preamble.
% \begin{macrocode}
\@onlypreamble \DeclareBinaryPrefix
@@ -13930,7 +14768,7 @@ This work consists of the file siunitx.dtx
\@onlypreamble \DeclareSIUnit
\@onlypreamble \DeclareSIUnitWithOptions
% \end{macrocode}
-%
+%
%\begin{macro}{\SendSettingsToPgf}
% A settings transfer function.
% \begin{macrocode}
@@ -13941,28 +14779,28 @@ This work consists of the file siunitx.dtx
%\subsection{Document macros}
%
% The user document macros are all collected together here for ease.
-%
+%
%\begin{macro}{\ang}
% The \cs{ang} function does very little beyond setting the local
% keys and passing on the input.
% \begin{macrocode}
\NewDocumentCommand \ang { o > { \SplitArgument { 2 } { ; } } m } {
\group_begin:
- \IfNoValueF {#1}
+ \IfNoValueF {#1}
{ \keys_set:nn { siunitx } {#1} }
\siunitx_angle_output:nnn #2
\group_end:
}
% \end{macrocode}
%\end{macro}
-%
+%
%\begin{macro}{\num}
-% The \cs{num} macro is quite simple: read the number, check it is
-% correct then print it.
+% The \cs{num} macro is quite simple: read the number, check it is
+% correct then print it.
% \begin{macrocode}
\NewDocumentCommand \num { o m } {
\group_begin:
- \IfNoValueF {#1}
+ \IfNoValueF {#1}
{ \keys_set:nn { siunitx } {#1} }
\siunitx_number_output:n {#2}
\group_end:
@@ -13984,7 +14822,7 @@ This work consists of the file siunitx.dtx
%\end{macro}
%
%\begin{macro}{\numrange}
-% A very simple approach is taken here: this is not intended for
+% A very simple approach is taken here: this is not intended for
% anything complicated.
% \begin{macrocode}
\NewDocumentCommand \numrange { o m m } {
@@ -13997,29 +14835,13 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\si}
-% The \cs{si} macro needs to pass options through to the internal
-% function as well as setting them here. This is used so that options
-% set for a unit can be overridden on a one-off basis.
-% \begin{macrocode}
-\NewDocumentCommand \si { o m } {
- \group_begin:
- \IfNoValueTF {#1}
- { \siunitx_unit_output:nn {#2} { } }
- {
- \keys_set:nn { siunitx } {#1}
- \siunitx_unit_output:nn {#2} {#1}
- }
- \group_end:
-}
-% \end{macrocode}
-%\end{macro}
-%
-%\begin{macro}{\SIlist}
-%\begin{macro}{\SIrange}
+%\begin{macro}{
+% \SIlist ,
+% \SIrange ,
+%}
% Lists and range of values are handled in a very similar way.
% Everything is kept relatively simple, and so there is not too much
-% complexity. In theory the two could be combined together, but
+% complexity. In theory the two could be combined together, but
% the differences between the two make this less desirable.
% \begin{macrocode}
\NewDocumentCommand \SIlist { o > { \SplitList { ; } } m m } {
@@ -14028,7 +14850,7 @@ This work consists of the file siunitx.dtx
{ \siunitx_list_units:nnn {#2} {#3} { } }
{
\keys_set:nn { siunitx } {#1}
- \siunitx_list_units:nnn {#2} {#3} {#1}
+ \siunitx_list_units:nnn {#2} {#3} {#1}
}
\group_end:
}
@@ -14044,7 +14866,6 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
%\begin{macro}{\SI}
% The main \cs{SI} function follows the same pattern as the previous
@@ -14062,9 +14883,9 @@ This work consists of the file siunitx.dtx
}
% \end{macrocode}
%\end{macro}
-%
+%
%\begin{macro}{\sisetup}
-% The set up macro simply moves to the correct path and executes
+% The set up macro simply moves to the correct path and executes
% whatever has been passed.
% \begin{macrocode}
\NewDocumentCommand \sisetup { m } {
@@ -14073,14 +14894,46 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\tablenum}
+% A variation on the \cs{num} macro that will retain alignment within
+% \cs{multicolumn} and \cs{multirow} situations.
+% \begin{macrocode}
+\NewDocumentCommand \tablenum { o m } {
+ \IfNoValueF {#1}
+ { \keys_set:nn { siunitx } {#1} }
+ \tl_set:Nn \l_siunitx_table_collect_tl {#2}
+ \bool_set_false:N \l_siunitx_table_collect_pre_bool
+ \siunitx_table_print_S:
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\si}
+% The \cs{si} macro needs to pass options through to the internal
+% function as well as setting them here. This is used so that options
+% set for a unit can be overridden on a one-off basis.
+% \begin{macrocode}
+\NewDocumentCommand \si { o m } {
+ \group_begin:
+ \IfNoValueTF {#1}
+ { \siunitx_unit_output:nn {#2} { } }
+ {
+ \keys_set:nn { siunitx } {#1}
+ \siunitx_unit_output:nn {#2} {#1}
+ }
+ \group_end:
+}
+% \end{macrocode}
+%\end{macro}
+%
%\subsection{Precautions for section headings}
%
% There are two issues to be handled for section headings, \emph{etc}.
-% First, within the \cs{addcontentline} macro the various unit functions
+% First, within the \cs{addcontentline} macro the various unit functions
% need to be \cs{protected}. Secondly, there is a need to worry about
% \pkg{hyperref}, and ensure that everything works cleanly and with
% no unnecessary warnings.
-%
+%
%\begin{macro}{\siunitx_contents_add:N}
% An updated version of \cs{addtocontents} which will ensure that
% everything works properly. Using \cs{token_to_str:N} means that
@@ -14092,11 +14945,11 @@ This work consists of the file siunitx.dtx
{
\protected@write \@auxout
{
- \cs_set_eq:NN \label \use_none:n
- \cs_set_eq:NN \index \use_none:n
+ \cs_set_eq:NN \label \use_none:n
+ \cs_set_eq:NN \index \use_none:n
\cs_set_eq:NN \glossary\use_none:n
- \tl_map_function:NN \l_siunitx_declare_list_tl
- \siunitx_contents_add:N
+ \tl_map_function:NN \l_siunitx_declare_list_tl
+ \siunitx_contents_add:N
}
{ \token_to_str:N \@writefile {#1} {#2} }
}
@@ -14105,26 +14958,27 @@ This work consists of the file siunitx.dtx
\cs_set_nopar:Npn #1 { \token_to_str:N #1 }
}
% \end{macrocode}
-%\end{macro}
-%
+%\end{macro}
+%
%\begin{macro}{\siunitx_contents_bookmarks:}
% The idea here is two-fold. First, all of the unit macros are set
% up to simply print their literal interpretation: this is hopefully
% good enough for most bookmark situations. Secondly, the document
% commands are made expandable. This allows a bit of re-arrangement
% of the input, removes any set up options (which are being ignored)
-% and stops \pkg{hyperref} issuing a warning.
+% and stops \pkg{hyperref} issuing a warning.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \siunitx_contents_bookmarks: {
\tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_print_literal_aux:N
- \msg_redirect_name:nnn { LaTeX / xparse } { redefine-command }
+ \msg_redirect_name:nnn { LaTeX / xparse } { redefine-command }
{ none }
\cs_set_eq:NN \num \siunitx_bookmark_num:w
\cs_set_eq:NN \numrange \siunitx_bookmark_numrange:w
\cs_set_eq:NN \si \siunitx_bookmark_si:w
\cs_set_eq:NN \SI \siunitx_bookmark_SI:w
\cs_set_eq:NN \SIrange \siunitx_bookmark_SIrange:w
+ \cs_set_eq:NN \si \siunitx_bookmark_si:w
\cs_set_nopar:Npn \SIUnitSymbolAngstrom { \AA }
\cs_set_nopar:Npn \SIUnitSymbolArcminute { ' }
\cs_set_nopar:Npn \SIUnitSymbolArcsecond { '' }
@@ -14134,35 +14988,61 @@ This work consists of the file siunitx.dtx
\cs_set_nopar:Npn \SIUnitSymbolOhm { [ohm] }
}
% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\siunitx_bookmark_num:w}
-%\begin{macro}{\siunitx_bookmark_numrange:w}
-%\begin{macro}{\siunitx_bookmark_si:w}
-%\begin{macro}{\siunitx_bookmark_SI:w}
-%\begin{macro}{\siunitx_bookmark_SIrange:w}
+%\end{macro}
+%
+%\begin{macro}{
+% \siunitx_bookmark_num:w ,
+% \siunitx_bookmark_numrange:w ,
+% \siunitx_bookmark_SIlist:w ,
+% \siunitx_bookmark_SIrange:w ,
+% \siunitx_bookmark_SI:w ,
+% \siunitx_bookmark_si:w ,
+%}
% To keep things fast, expandable versions of the document commands
% are created only once. These are then used if necessary to remove
% and re-order arguments in an expandable fashion.
% \begin{macrocode}
\DeclareExpandableDocumentCommand \siunitx_bookmark_num:w { o m } {#2}
-\DeclareExpandableDocumentCommand \siunitx_bookmark_numrange:w { o m m }
+\DeclareExpandableDocumentCommand \siunitx_bookmark_numrange:w { o m m }
{ #2 \l_siunitx_range_phrase_tl #3 }
-\DeclareExpandableDocumentCommand \siunitx_bookmark_si:w { o m } {#2}
-\DeclareExpandableDocumentCommand \siunitx_bookmark_SI:w { o m o m }
+\DeclareExpandableDocumentCommand \siunitx_bookmark_SI:w { o m o m }
{ \IfNoValueF {#3} {#3} #2 ~ #4 }
+\DeclareExpandableDocumentCommand \siunitx_bookmark_SIlist:w
+ { o m m } { \siunitx_bookmark_SIlist_map:nn {#1} {#2} }
\DeclareExpandableDocumentCommand \siunitx_bookmark_SIrange:w
{ o m m m } { #2 ~ #4 \l_siunitx_range_phrase_tl #3 ~ #4 }
+\DeclareExpandableDocumentCommand \siunitx_bookmark_si:w { o m } {#2}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
+%
+%\begin{macro}{\siunitx_bookmark_SIlist_map:nn}
+%\begin{macro}[aux]{\siunitx_bookmark_SIlist_map_aux:nw}
+% An expandable mapping to replace the list separator in the
+% input by appropriate output version.
+% \begin{macrocode}
+\cs_new:Npn \siunitx_bookmark_SIlist_map:nn #1#2 {
+ \siunitx_bookmark_SIlist_map_aux:nw {#2} #1 ; \q_recursion_tail ;
+ \q_recursion_tail ; \q_recursion_stop
+}
+\cs_new:Npn \siunitx_bookmark_SIlist_map_aux:nw #1#2 ; #3 ; #4 {
+ #2 ~ #1
+ \quark_if_recursion_tail_stop:n {#3}
+ \quark_if_recursion_tail_stop_do:nn {#4}
+ {
+ \l_siunitx_list_separator_final_tl
+ #3 ~ #1
+ }
+ \l_siunitx_list_separator_tl
+ \siunitx_bookmark_SIlist_map_aux:nw {#1} #3 ; #4
+}
+% \end{macrocode}
%\end{macro}
%\end{macro}
%
% A short check to get things working.
% \begin{macrocode}
\AtBeginDocument {
- \@ifpackageloaded { hyperref }
+ \@ifpackageloaded { hyperref }
{ \pdfstringdefDisableCommands { \siunitx_contents_bookmarks: } }
{ }
}
@@ -14217,7 +15097,7 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\centi}
%\begin{macro}{\deci}
% The various SI multiple prefixes are defined here: first the small
-% ones.
+% ones.
% \begin{macrocode}
\DeclareSIPrefix \yocto { y } { -24 }
\DeclareSIPrefix \zepto { z } { -21 }
@@ -14366,15 +15246,13 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\tonne}
% Non-SI, but accepted for general use.
% \begin{macrocode}
-\DeclareSIUnitWithOptions \arcmin { \arcminute }
- { number-unit-separator = }
-\DeclareSIUnitWithOptions \arcminute { \SIUnitSymbolArcminute }
- { number-unit-separator = }
-\DeclareSIUnitWithOptions \arcsecond { \SIUnitSymbolArcsecond }
- { number-unit-separator = }
+\DeclareSIUnit [ number-unit-product = ] \arcmin { \arcminute }
+\DeclareSIUnit [ number-unit-product = ]
+ \arcminute { \SIUnitSymbolArcminute }
+\DeclareSIUnit [ number-unit-product = ]
+ \arcsecond { \SIUnitSymbolArcsecond }
\DeclareSIUnit \day { d }
-\DeclareSIUnitWithOptions \degree { \SIUnitSymbolDegree }
- { number-unit-separator = }
+\DeclareSIUnit[ number-unit-product = ] \degree { \SIUnitSymbolDegree }
\DeclareSIUnit \hectare { ha }
\DeclareSIUnit \hour { h }
\DeclareSIUnit \litre { l }
@@ -14399,7 +15277,7 @@ This work consists of the file siunitx.dtx
%\begin{macro}{\atomicmassunit}
%\begin{macro}{\electronvolt}
%\begin{macro}{\dalton}
-% A few units based on physical measurements exist.
+% A few units based on physical measurements exist.
% \begin{macrocode}
\DeclareSIUnit \astronomicalunit { ua }
\DeclareSIUnit \atomicmassunit { u }
@@ -14421,8 +15299,8 @@ This work consists of the file siunitx.dtx
\tl_to_lowercase:n {
\group_end:
\DeclareSIUnit \clight { \text { \ensuremath { c @ { 0 } } } }
- \DeclareSIUnit \electronmass
- { \text { \ensuremath { m @ { \text { e } } } } }
+ \DeclareSIUnit \electronmass
+ { \text { \ensuremath { m @ { \text { e } } } } }
}
\DeclareSIUnit \planckbar { \text { \ensuremath { \hbar } } }
% \end{macrocode}
@@ -14442,7 +15320,7 @@ This work consists of the file siunitx.dtx
\tl_to_lowercase:n {
\group_end:
\DeclareSIUnit \bohr { \text { \ensuremath { a @ { 0 } } } }
- \DeclareSIUnit \hartree
+ \DeclareSIUnit \hartree
{ \text { \ensuremath { E @ { \textup { h } } } } }
}
% \end{macrocode}
@@ -14478,9 +15356,9 @@ This work consists of the file siunitx.dtx
%\end{macro}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
%
%\begin{macro}{\square}
%\begin{macro}{\squared}
@@ -14505,9 +15383,9 @@ This work consists of the file siunitx.dtx
% When sticking to the rules closely, a few options are not available.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- strict .code:n =
+ strict .code:n =
{
- \keys_set:nn { siunitx }
+ \keys_set:nn { siunitx }
{
bracket-numbers = true,
detect-mode = false,
@@ -14518,8 +15396,8 @@ This work consists of the file siunitx.dtx
parse-units = true,
product-units = repeat,
}
- \siunitx_strict_option:n
- {
+ \siunitx_strict_option:n
+ {
bracket-numbers ,
detect-italic ,
detect-mode ,
@@ -14533,26 +15411,26 @@ This work consists of the file siunitx.dtx
\keys_define:nn { siunitx }
{
per-mode / repeated-symbol .code:n =
- {
- \msg_warning:nnx { siunitx } { option-not-available }
+ {
+ \msg_warning:nnx { siunitx } { option-not-available }
{ per-mode~=~repeated-symbol }
}
- }
+ }
}
}
\siunitx_option_deactivate:n { strict }
\cs_new_protected_nopar:Npn \siunitx_strict_option:n #1 {
- \clist_map_function:nN {#1} \siunitx_strict_option_aux:n
+ \clist_map_function:nN {#1} \siunitx_strict_option_aux:n
}
\cs_new_protected_nopar:Npn \siunitx_strict_option_aux:n #1 {
\keys_define:nn { siunitx }
- { #1 .code:n =
+ { #1 .code:n =
{ \msg_warning:nnx { siunitx } { option-not-available } {#1} }
- }
+ }
}
% \end{macrocode}
-%\end{macro}
-%\end{macro}
+%\end{macro}
+%\end{macro}
%
%\subsection{Locales}
%
@@ -14562,61 +15440,61 @@ This work consists of the file siunitx.dtx
\keys_define:nn { siunitx } {
locale .choice:,
locale /
- DE .meta:n =
+ DE .meta:n =
{
exponent-product = \cdot ,
- inter-unit-separator = { \, } ,
+ inter-unit-product = { \, } ,
output-decimal-marker = { , } ,
},
locale /
- FR .meta:n =
+ FR .meta:n =
{
exponent-product = \times ,
- inter-unit-separator = { \, } ,
+ inter-unit-product = { \, } ,
output-decimal-marker = { , } ,
},
locale /
- UK .meta:n =
+ UK .meta:n =
{
exponent-product = \times ,
- inter-unit-separator = \, ,
+ inter-unit-product = \, ,
output-decimal-marker = . ,
},
locale /
- US .meta:n = { locale = UK },
+ US .meta:n = { locale = UK },
locale /
- USA .meta:n = { locale = UK },
- locale /
- ZA .meta:n =
+ USA .meta:n = { locale = UK },
+ locale /
+ ZA .meta:n =
{
exponent-product = \times ,
- inter-unit-separator = \cdot ,
+ inter-unit-product = \cdot ,
output-decimal-marker = { , } ,
},
}
-% \end{macrocode}
+% \end{macrocode}
%
%\subsection{Localisation}
%
% Localisation makes use of the \pkg{translator} package. This only
% happens if it is available, and is transparent to the user.
% \begin{macrocode}
-\file_if_exist:nT { translator.sty }
+\file_if_exist:nT { translator.sty }
{
\RequirePackage { translator }
\usedictionary { translator-basic-dictionary }
- \providetranslation [ to = English ]
+ \providetranslation [ to = English ]
{ to~(numerical~range) } { to }
- \providetranslation [ to = French ]
+ \providetranslation [ to = French ]
{ to~(numerical~range) } { \`a }
- \providetranslation [ to = German ]
+ \providetranslation [ to = German ]
{ to~(numerical~range) } { bis }
- \sisetup
+ \sisetup
{
list-final-separator = { ~ \translate { and } ~ },
- range-phrase =
+ range-phrase =
{ ~ \translate { to~(numerical~range) } ~ },
- }
+ }
}
% \end{macrocode}
%
@@ -14629,7 +15507,7 @@ This work consists of the file siunitx.dtx
{ \siunitx_load_configuration:n {#1} }
}
% \end{macrocode}
-%
+%
%\begin{macro}{\siunitx_load_configuration:n}
%\begin{macro}[aux]{\siunitx_load_configuration_aux:n}
%\begin{macro}{\c_siunitx_configuration_ext_tl}
@@ -14642,19 +15520,19 @@ This work consists of the file siunitx.dtx
\cs_new_protected:Npn \siunitx_load_configuration:n #1 {
\tl_set_rescan:Nnn \l_siunitx_tmpa_tl
{ \char_make_ignore:N \ } {#1}
- \clist_map_function:NN \l_siunitx_tmpa_tl
+ \clist_map_function:NN \l_siunitx_tmpa_tl
\siunitx_load_configuration_aux:n
}
\cs_new_protected:Npn \siunitx_load_configuration_aux:n #1 {
\tl_if_empty:nF {#1}
{
- \file_if_exist:nTF
+ \file_if_exist:nTF
{ siunitx- #1 . \c_siunitx_configuration_ext_tl }
- {
- \@onefilewithoptions { siunitx- #1 } [ ] [ ]
- \c_siunitx_configuration_ext_tl
+ {
+ \@onefilewithoptions { siunitx- #1 } [ ] [ ]
+ \c_siunitx_configuration_ext_tl
}
- {
+ {
\msg_error:nnx { siunitx } { unknown-configuration-file } {#1}
}
}
@@ -14662,16 +15540,16 @@ This work consists of the file siunitx.dtx
\tl_new:N \c_siunitx_configuration_ext_tl
\tl_set:Nn \c_siunitx_configuration_ext_tl { cfg }
% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%
-% Load any local configuration file.
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+% Load any local configuration file.
% \begin{macrocode}
\file_if_exist:nT { siunitx . \c_siunitx_configuration_ext_tl }
- {
+ {
\@onefilewithoptions { siunitx } [ ] [ ]
- \c_siunitx_configuration_ext_tl
+ \c_siunitx_configuration_ext_tl
}
% \end{macrocode}
%
@@ -14679,7 +15557,7 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
\ProcessKeysOptions { siunitx }
% \end{macrocode}
-%
+%
% \begin{macrocode}
%</package>
% \end{macrocode}
@@ -14691,36 +15569,36 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplFile {siunitx-version-1.cfg} {2011/04/04} {2.1p}
+\ProvidesExplFile {siunitx-version-1.cfg} {2011/04/13} {2.2}
{siunitx: Version 1 settings}
% \end{macrocode}
-%
-% The abbreviations are loaded by default by version one.
+%
+% The abbreviations are loaded by default by version one.
% \begin{macrocode}
-\keys_set:nn { siunitx }
+\keys_set:nn { siunitx }
{ load-configurations = { abbreviations , binary } }
% \end{macrocode}
%
% The re-arrangements made to the code in version two, and in particular
% the new option names, mean that support for version one needs to be
-% included explicitly.
-%
-% \begin{macrocode}
+% included explicitly.
+%
+% \begin{macrocode}
\keys_define:nn { siunitx } {
addsign .choice: ,
addsign /
all .meta:n = { explicit-sign = + },
addsign /
exp .meta:n = { explicit-sign = + },
- addsign /
+ addsign /
false .meta:n = { explicit-sign = },
addsign /
mant .meta:n = { explicit-sign = + },
- addsign /
+ addsign /
none .meta:n = { explicit-sign = },
addsign /
true .meta:n = { explicit-sign = + },
- addsign .default:n = { true },
+ addsign .default:n = { true },
allowlitunits .meta:n = { free-standing-units = #1 },
allowlitunits .default:n = { true },
allowoptarg .meta:n = { unit-optional-argument = #1 },
@@ -14730,42 +15608,42 @@ This work consists of the file siunitx.dtx
alsoload .code:n = ,
angformat .code:n = ,
anglesep .choice: ,
- anglesep /
- cdot .meta:n =
+ anglesep /
+ cdot .meta:n =
{ arc-separator = { } \cdot { } },
- anglesep /
+ anglesep /
comma .meta:n = { arc-separator = { {,} } },
- anglesep /
+ anglesep /
fullstop .meta:n = { arc-separator = { { . } } },
- anglesep /
+ anglesep /
med .meta:n = { arc-separator = \: },
- anglesep /
+ anglesep /
medium .meta:n = { arc-separator = \: },
- anglesep /
+ anglesep /
none .meta:n = { arc-separator = },
- anglesep /
+ anglesep /
period .meta:n = { arc-separator = { { . } } },
- anglesep /
+ anglesep /
space .meta:n = { arc-separator = \text { ~ } },
- anglesep /
+ anglesep /
stop .meta:n = { arc-separator = { { . } } },
- anglesep /
+ anglesep /
thick .meta:n = { arc-separator = \; },
- anglesep /
+ anglesep /
thin .meta:n = { arc-separator = \, },
- anglesep /
- tightcdot .meta:n =
+ anglesep /
+ tightcdot .meta:n =
{ arc-separator = \bgroup \cdot \egroup },
- anglesep /
+ anglesep /
tighttimes .meta:n =
{ arc-separator = \bgroup \times \egroup },
- anglesep /
+ anglesep /
times .meta:n = { arc-separator = \times },
- anglesep /
+ anglesep /
unknown .meta:n = { arc-separator = #1 },
- astroang .meta:n =
+ astroang .meta:n =
{ angle-symbol-over-decimal = #1 },
- astroang .default:n = { true },
+ astroang .default:n = { true },
closeerr .meta:n = { close-bracket = #1 },
closefrac .meta:n = { close-bracket = #1 },
closerange .meta:n = { close-bracket = #1 },
@@ -14780,18 +15658,18 @@ This work consists of the file siunitx.dtx
colourvalues .meta:n = ,
decimalsymbol .choice: ,
decimalsymbol /
- cdot .meta:n =
- { output-decimal-marker = { } \cdot { } },
+ cdot .meta:n =
+ { output-decimal-marker = { } \cdot { } },
decimalsymbol /
- comma .meta:n = { output-decimal-marker = { { , } } },
+ comma .meta:n = { output-decimal-marker = { { , } } },
decimalsymbol /
- fullstop .meta:n = { output-decimal-marker = { { . } } },
+ fullstop .meta:n = { output-decimal-marker = { { . } } },
decimalsymbol /
period .meta:n = { output-decimal-marker = { { . } } },
decimalsymbol /
stop .meta:n = { output-decimal-marker = { { . } } },
decimalsymbol /
- tightcdot .code:n =
+ tightcdot .code:n =
{ output-decimal-marker = \bgroup \cdot \egroup },
decimalsymbol /
unknown .meta:n = { output-decimal-marker = #1 },
@@ -14799,59 +15677,59 @@ This work consists of the file siunitx.dtx
detectdisplay .meta:n = { detect-display-math = #1 },
detectdisplay .default:n = { true },
digitsep .choice: ,
- digitsep /
- cdot .meta:n =
+ digitsep /
+ cdot .meta:n =
{ group-separator = { } \cdot { } },
- digitsep /
+ digitsep /
comma .meta:n = { group-separator = { , } },
- digitsep /
+ digitsep /
fullstop .meta:n = { group-separator = . },
- digitsep /
+ digitsep /
med .meta:n = { group-separator = \: },
- digitsep /
+ digitsep /
medium .meta:n = { group-separator = \: },
- digitsep /
+ digitsep /
none .meta:n = { group-separator = },
- digitsep /
+ digitsep /
period .meta:n = { group-separator = . },
- digitsep /
+ digitsep /
space .meta:n = { group-separator = \text { ~ } },
- digitsep /
+ digitsep /
stop .meta:n = { group-separator = . },
- digitsep /
+ digitsep /
thick .meta:n = { group-separator = \; },
- digitsep /
+ digitsep /
thin .meta:n = { group-separator = \, },
- digitsep /
- tightcdot .meta:n =
+ digitsep /
+ tightcdot .meta:n =
{ group-separator = \bgroup \cdot \egroup },
- digitsep /
+ digitsep /
tighttimes .meta:n =
{ group-separator = \bgroup \times \egroup },
- digitsep /
+ digitsep /
times .meta:n = { group-separator = \times },
- digitsep /
+ digitsep /
unknown .meta:n = { group-separator = #1 },
- dp .meta:n =
- {
+ dp .meta:n =
+ {
round-mode = places,
round-precision = #1,
},
emulate .code:n = ,
errspace .choice: ,
- errspace /
+ errspace /
med .meta:n = { uncertainty-separator = \: },
- errspace /
+ errspace /
medium .meta:n = { uncertainty-separator = \: },
- errspace /
+ errspace /
none .meta:n = { uncertainty-separator = },
- errspace /
+ errspace /
space .meta:n = { uncertainty-separator = \text { ~ } },
- errspace /
+ errspace /
thick .meta:n = { uncertainty-separator = \; },
- errspace /
+ errspace /
thin .meta:n = { uncertainty-separator = \, },
- errspace /
+ errspace /
unknown .meta:n = { uncertainty-separator = #1 },
eVcorra .code:n = ,
eVcorrb .code:n = ,
@@ -14859,33 +15737,33 @@ This work consists of the file siunitx.dtx
expbase /
ten .meta:n = { exponent-base = 10 },
expbase /
- two .meta:n = { exponent-base = 2 },
+ two .meta:n = { exponent-base = 2 },
expbase /
- unknown .meta:n = { exponent-base = #1 },
- expproduct .choice: ,
- expproduct /
- cdot .meta:n =
+ unknown .meta:n = { exponent-base = #1 },
+ expproduct .choice: ,
+ expproduct /
+ cdot .meta:n =
{ exponent-product = { } \cdot { } },
- expproduct /
- tightcdot .meta:n =
+ expproduct /
+ tightcdot .meta:n =
{ exponent-product = \bgroup \cdot \egroup },
- expproduct /
+ expproduct /
tighttimes .meta:n =
{ exponent-product = \bgroup \times \egroup },
- expproduct /
+ expproduct /
times .meta:n = { exponent-product = \times },
expproduct /
- unknown .meta:n = { exponent-product = #1 },
+ unknown .meta:n = { exponent-product = #1 },
fixdp .choice:,
- fixdp /
+ fixdp /
false .meta:n = { round-mode = none },
- fixdp /
+ fixdp /
true .meta:n = { round-mode = places },
fixdp .default:n = { true },
fixsf .choice: ,
- fixsf /
+ fixsf /
false .meta:n = { round-mode = none },
- fixsf /
+ fixsf /
true .meta:n = { round-mode = figures },
fixsf .default:n = { true },
fraction .choice: ,
@@ -14896,8 +15774,8 @@ This work consists of the file siunitx.dtx
fraction /
sfrac .meta:n = { fraction-function = \sfrac },
fraction /
- ugly .meta:n =
- {
+ ugly .meta:n =
+ {
fraction-function = \frac ,
per-mode = symbol-or-fraction
},
@@ -14911,25 +15789,25 @@ This work consists of the file siunitx.dtx
mathminute .meta:n = { math-arcminute = #1 },
mathmu .meta:n = { math-micro = #1 },
mathringA .meta:n = { math-angstrom = #1 },
- mathrm .meta:x =
+ mathrm .meta:x =
{ math-rm = \exp_not:c {#1} },
mathsOmega .meta:n = { math-ohm = #1 },
mathscelsius .meta:n = { math-celsius = #1 },
mathsdegree .meta:n = { math-degree = #1 },
mathsecond .meta:n = { math-arcsecond = #1 },
- mathsf .meta:x =
+ mathsf .meta:x =
{ math-sf = \exp_not:c {#1} },
mathsminute .meta:n = { math-arcminute = #1 },
mathsmu .meta:n = { math-micro = #1 },
mathsringA .meta:n = { math-angstrom = #1 },
- mathsrm .meta:x =
+ mathsrm .meta:x =
{ math-rm = \exp_not:c {#1} },
mathssecond .meta:n = { math-arcsecond = #1 },
- mathssf .meta:x =
+ mathssf .meta:x =
{ math-sf = \exp_not:c {#1} },
- mathstt .meta:x =
+ mathstt .meta:x =
{ math-tt = \exp_not:c {#1} },
- mathtt .meta:x =
+ mathtt .meta:x =
{ math-tt = \exp_not:c {#1} },
negcolor .meta:n = { negative-color = #1 },
negcolour .meta:n = { negative-color = #1 },
@@ -15054,7 +15932,7 @@ This work consists of the file siunitx.dtx
frac .meta:n = { per-mode = fraction },
per /
fraction .meta:n = { per-mode = fraction },
- per /
+ per /
reciprocal .meta:n = { per-mode = reciprocal },
per /
slash .meta:n = { per-mode = symbol },
@@ -15068,22 +15946,22 @@ This work consists of the file siunitx.dtx
redefsymbols .default:n = { true },
repeatunits .choice: ,
repeatunits /
- false .meta:n =
- {
+ false .meta:n =
+ {
multi-part-units = single,
- product-units = single,
+ product-units = single,
},
repeatunits /
- power .meta:n =
- {
+ power .meta:n =
+ {
multi-part-units = repeat,
- product-units = power,
+ product-units = power,
},
repeatunits /
true .meta:n =
- {
+ {
multi-part-units = repeat,
- product-units = repeat,
+ product-units = repeat,
},
repeatunits .default:n = { true },
retainplus .meta:n = { retain-explicit-plus = #1 },
@@ -15092,63 +15970,63 @@ This work consists of the file siunitx.dtx
seperr .default:n = { true },
sepfour .meta:n = { group-four-digits = true },
sepfour .default:n = { true },
- sf .meta:n =
- {
+ sf .meta:n =
+ {
round-mode = figures,
round-precision = #1,
},
sign .meta:n = { explicit-sign = #1 },
slash .choice: ,
- slash /
+ slash /
slash .meta:n = { per-symbol = / },
- slash /
+ slash /
unknown .meta:n = { per-symbol = #1 },
stickyper .meta:n = { sticky-per = #1 },
stickyper .default:n = { true },
strictarc .code:n = ,
- tabalign .code:n =
+ tabalign .code:n =
{
\str_if_eq:nnTF {#1} { centre }
{ \keys_set:nn { siunitx } { table-alignment = center } }
- { \keys_set:nn { siunitx } { table-alignment = #1 } }
+ { \keys_set:nn { siunitx } { table-alignment = #1 } }
},
tabalignexp .code:n = { table-align-exponent = #1 },
tabautofit .meta:n = { table-auto-round = #1 },
tabautofit .default:n = { true },
tabexpalign .code:n = { table-align-exponent = #1 },
tabformat .meta:n = { table-format = #1 },
- tabnumalign .code:n =
+ tabnumalign .code:n =
{
\str_if_eq:nnTF {#1} { centre }
{ \keys_set:nn { siunitx } { table-number-alignment = center } }
- {
+ {
\str_if_eq:nnTF {#1} { centredecimal }
{
- \keys_set:nn { siunitx }
- { table-number-alignment = center-decimal-marker }
+ \keys_set:nn { siunitx }
+ { table-number-alignment = center-decimal-marker }
}
{
\str_if_eq:nnTF {#1} { centerdecimal }
{
- \keys_set:nn { siunitx }
- { table-number-alignment = center-decimal-marker }
- }
+ \keys_set:nn { siunitx }
+ { table-number-alignment = center-decimal-marker }
+ }
{
- \keys_set:nn { siunitx }
- { table-number-alignment = #1 }
- }
+ \keys_set:nn { siunitx }
+ { table-number-alignment = #1 }
+ }
}
}
},
tabparseonly .meta:n = { table-parse-only = #1 },
tabparseonly .default:n = { true },
- tabtextalign .code:n =
+ tabtextalign .code:n =
{
\str_if_eq:nnTF {#1} { centre }
{ \keys_set:nn { siunitx } { table-text-alignment = center } }
{ \keys_set:nn { siunitx } { table-text-alignment = #1 } }
},
- tabunitalign .code:n =
+ tabunitalign .code:n =
{
\str_if_eq:nnTF {#1} { centre }
{ \keys_set:nn { siunitx } { table-unit-alignment = center } }
@@ -15159,250 +16037,248 @@ This work consists of the file siunitx.dtx
textdegree .meta:n = { text-degree = #1 },
textminute .meta:n = { text-arcminute = #1 },
textmode .choice: ,
- textmode /
+ textmode /
true .meta:n = { mode = text },
- textmode /
+ textmode /
false .meta:n = { mode = math },
textmode .default:n = { true },
textmu .meta:n = { text-micro = #1 },
textringA .meta:n = { text-angstrom = #1 },
- textrm .meta:x =
+ textrm .meta:x =
{ text-rm = \exp_not:c {#1} },
textsecond .meta:n = { text-arcsecond = #1 },
- textsf .meta:x =
+ textsf .meta:x =
{ text-sf = \exp_not:c {#1} },
- texttt .meta:x =
+ texttt .meta:x =
{ text-tt = \exp_not:c {#1} },
tightpm .meta:n = { tight-spacing = #1 },
tightpm .default:n = { true },
tophrase .meta:n = { range-phrase = #1 },
trapambigerr .choice: ,
- trapambigerr
+ trapambigerr
/ false .meta:n = { multi-part-units = single },
- trapambigerr
+ trapambigerr
/ true .meta:n = { multi-part-units = brackets },
trapambigerr .default:n = { true },
trapambigfrac .meta:n = { bracket-numbers = #1 },
trapambigfrac .default:n = { true },
trapambigrange .choice: ,
- trapambigrange
+ trapambigrange
/ false .meta:n = { range-units = single },
- trapambigrange
+ trapambigrange
/ true .meta:n = { range-units = brackets },
trapambigrange .default:n = { true },
unitcolor .meta:n = { unit-color = #1 },
unitcolour .meta:n = { unit-color = #1 },
- unitmathrm .meta:x =
+ unitmathrm .meta:x =
{ unit-math-rm = \exp_not:c {#1} },
- unitmathsf .meta:x =
+ unitmathsf .meta:x =
{ unit-math-sf = \exp_not:c {#1} },
- unitmathsrm .meta:x =
+ unitmathsrm .meta:x =
{ unit-math-rm = \exp_not:c {#1} },
- unitmathssf .meta:x =
+ unitmathssf .meta:x =
{ unit-math-sf = \exp_not:c {#1} },
- unitmathstt .meta:x =
+ unitmathstt .meta:x =
{ unit-math-tt = \exp_not:c {#1} },
- unitmathtt .meta:x =
+ unitmathtt .meta:x =
{ unit-math-tt = \exp_not:c {#1} },
unitmode .meta:n = { unit-mode = #1 },
unitsep .choice: ,
- unitsep /
- cdot .meta:n =
- { inter-unit-separator = { } \cdot { } },
- unitsep /
- comma .meta:n = { inter-unit-separator = { {,} } },
- unitsep /
- fullstop .meta:n = { inter-unit-separator = { { . } } },
- unitsep /
- med .meta:n = { inter-unit-separator = \: },
- unitsep /
- medium .meta:n = { inter-unit-separator = \: },
- unitsep /
- none .meta:n = { inter-unit-separator = },
- unitsep /
- period .meta:n = { inter-unit-separator = { { . } } },
- unitsep /
- space .meta:n = { inter-unit-separator = \text { ~ } },
- unitsep /
- stop .meta:n = { inter-unit-separator = { { . } } },
- unitsep /
- thick .meta:n = { inter-unit-separator = \; },
- unitsep /
- thin .meta:n = { inter-unit-separator = \, },
- unitsep /
+ unitsep /
+ cdot .meta:n =
+ { inter-unit-product = { } \cdot { } },
+ unitsep /
+ comma .meta:n = { inter-unit-product = { {,} } },
+ unitsep /
+ fullstop .meta:n = { inter-unit-product = { { . } } },
+ unitsep /
+ med .meta:n = { inter-unit-product = \: },
+ unitsep /
+ medium .meta:n = { inter-unit-product = \: },
+ unitsep /
+ none .meta:n = { inter-unit-product = },
+ unitsep /
+ period .meta:n = { inter-unit-product = { { . } } },
+ unitsep /
+ space .meta:n = { inter-unit-product = \text { ~ } },
+ unitsep /
+ stop .meta:n = { inter-unit-product = { { . } } },
+ unitsep /
+ thick .meta:n = { inter-unit-product = \; },
+ unitsep /
+ thin .meta:n = { inter-unit-product = \, },
+ unitsep /
tightcdot .meta:n =
- { inter-unit-separator = \bgroup \cdot \egroup },
- unitsep /
+ { inter-unit-product = \bgroup \cdot \egroup },
+ unitsep /
tighttimes .meta:n =
- { inter-unit-separator = \bgroup \times \egroup },
- unitsep /
- times .meta:n = { inter-unit-separator = \times },
- unitsep /
- unknown .meta:n = { inter-unit-separator = #1 },
+ { inter-unit-product = \bgroup \times \egroup },
+ unitsep /
+ times .meta:n = { inter-unit-product = \times },
+ unitsep /
+ unknown .meta:n = { inter-unit-product = #1 },
unitspace .choice: ,
- unitspace /
- med .meta:n = { inter-unit-separator = \: },
- unitspace /
- medium .meta:n = { inter-unit-separator = \: },
- unitspace /
- none .meta:n = { inter-unit-separator = },
- unitspace /
- space .meta:n = { inter-unit-separator = \text { ~ } },
- unitspace /
- thick .meta:n = { inter-unit-separator = \; },
- unitspace /
- thin .meta:n = { inter-unit-separator = \, },
- unitspace /
- unknown .meta:n = { inter-unit-separator = #1 },
+ unitspace /
+ med .meta:n = { inter-unit-product = \: },
+ unitspace /
+ medium .meta:n = { inter-unit-product = \: },
+ unitspace /
+ none .meta:n = { inter-unit-product = },
+ unitspace /
+ space .meta:n = { inter-unit-product = \text { ~ } },
+ unitspace /
+ thick .meta:n = { inter-unit-product = \; },
+ unitspace /
+ thin .meta:n = { inter-unit-product = \, },
+ unitspace /
+ unknown .meta:n = { inter-unit-product = #1 },
valuecolor .meta:n = { number-color = #1 },
valuecolour .meta:n = { number-color = #1 },
- valuemathrm .meta:x =
+ valuemathrm .meta:x =
{ number-math-rm = \exp_not:c {#1} },
- valuemathsf .meta:x =
+ valuemathsf .meta:x =
{ number-math-sf = \exp_not:c {#1} },
- valuemathsrm .meta:x =
+ valuemathsrm .meta:x =
{ number-math-rm = \exp_not:c {#1} },
- valuemathssf .meta:x =
+ valuemathssf .meta:x =
{ number-math-sf = \exp_not:c {#1} },
- valuemathstt .meta:x =
+ valuemathstt .meta:x =
{ number-math-tt = \exp_not:c {#1} },
- valuemathtt .meta:x =
+ valuemathtt .meta:x =
{ number-math-tt = \exp_not:c {#1} },
valuemode .meta:n = { number-mode = #1 },
valuesep .choice: ,
- valuesep /
- cdot .meta:n =
- { number-unit-separator = { } \cdot { } },
- valuesep /
- comma .meta:n = { number-unit-separator = { {,} } },
- valuesep /
- fullstop .meta:n = { number-unit-separator = { { . } } },
- valuesep /
- med .meta:n = { number-unit-separator = \: },
- valuesep /
- medium .meta:n = { number-unit-separator = \: },
- valuesep /
- none .meta:n = { number-unit-separator = },
- valuesep /
- period .meta:n = { number-unit-separator = { { . } } },
- valuesep /
- space .meta:n = { number-unit-separator = \text { ~ } },
- valuesep /
- stop .meta:n = { number-unit-separator = { { . } } },
- valuesep /
- thick .meta:n = { number-unit-separator = \; },
- valuesep /
- thin .meta:n = { number-unit-separator = \, },
- valuesep /
- tightcdot .meta:n =
- { number-unit-separator = \bgroup \cdot \egroup },
- valuesep /
+ valuesep /
+ cdot .meta:n =
+ { number-unit-product = { } \cdot { } },
+ valuesep /
+ comma .meta:n = { number-unit-product = { {,} } },
+ valuesep /
+ fullstop .meta:n = { number-unit-product = { { . } } },
+ valuesep /
+ med .meta:n = { number-unit-product = \: },
+ valuesep /
+ medium .meta:n = { number-unit-product = \: },
+ valuesep /
+ none .meta:n = { number-unit-product = },
+ valuesep /
+ period .meta:n = { number-unit-product = { { . } } },
+ valuesep /
+ space .meta:n = { number-unit-product = \text { ~ } },
+ valuesep /
+ stop .meta:n = { number-unit-product = { { . } } },
+ valuesep /
+ thick .meta:n = { number-unit-product = \; },
+ valuesep /
+ thin .meta:n = { number-unit-product = \, },
+ valuesep /
+ tightcdot .meta:n =
+ { number-unit-product = \bgroup \cdot \egroup },
+ valuesep /
tighttimes .meta:n =
- { number-unit-separator = \bgroup \times \egroup },
- valuesep /
- times .meta:n = { number-unit-separator = \times },
- valuesep /
- unknown .meta:n = { number-unit-separator = #1 },
+ { number-unit-product = \bgroup \times \egroup },
+ valuesep /
+ times .meta:n = { number-unit-product = \times },
+ valuesep /
+ unknown .meta:n = { number-unit-product = #1 },
xspace .meta:n = { use-xspace = #1 },
xspace .default:n = { true },
-}
+}
% \end{macrocode}
-%
-% The error can be simplified here: if the option is not known, then
+%
+% The error can be simplified here: if the option is not known, then
% it really is an error.
% \begin{macrocode}
\keys_define:nn { siunitx } {
- unknown .code:n =
- {
- \msg_error:nnx { siunitx } { unknown-option }
- { \exp_not:V \l_keys_key_tl }
+ unknown .code:n =
+ {
+ \msg_error:nnx { siunitx } { unknown-option }
+ { \exp_not:V \l_keys_key_tl }
}
}
% \end{macrocode}
-%
+%
% A couple of settings which are slightly different by default in
-% version 1.
+% version 1.
% \begin{macrocode}
\keys_set:nn { siunitx } {
free-standing-units = true ,
mode = math ,
}
% \end{macrocode}
-%
-%\begin{macro}{\newunit}
-%\begin{macro}{\renewunit}
-%\begin{macro}{\provideunit}
+%
+%\begin{macro}{
+% \newunit ,
+% \renewunit ,
+% \provideunit ,
+%}
% The functions for creating units from version one are easy to create.
% \begin{macrocode}
-\NewDocumentCommand \newunit { o m m } {
- \IfNoValueTF {#1}
- { \siunitx_declare_unit:Nnn #2 {#3} { } }
- { \siunitx_declare_unit:Nnn #2 {#3} {#1} }
-}
-\cs_new_eq:NN \renewunit \newunit
-\cs_new_eq:NN \provideunit \newunit
+\cs_new_eq:NN \newunit \DeclareSIUnit
+\cs_new_eq:NN \renewunit \DeclareSIUnit
+\cs_new_eq:NN \provideunit \DeclareSIUnit
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\newpower}
-%\begin{macro}{\renewpower}
-%\begin{macro}{\providepower}
-% Slightly more complex: an optional argument to check. A simple
+%\begin{macro}{
+% \newpower ,
+% \renewpower ,
+% \providepower ,
+%}
+% Slightly more complex: an optional argument to check. A simple
% assumption is made that it will be \texttt{post}: anything else
% would not make sense anyway.
% \begin{macrocode}
\NewDocumentCommand \newpower { o m m } {
- \IfNoValueTF {#1}
+ \IfNoValueTF {#1}
{ \DeclareSIPrePower #2 {#3} }
{ \DeclareSIPostPower #2 {#3} }
}
\NewDocumentCommand \renewpower { o m m } {
- \IfNoValueTF {#1}
+ \IfNoValueTF {#1}
{ \DeclareSIPrePower #2 {#3} }
{ \DeclareSIPostPower #2 {#3} }
}
\NewDocumentCommand \providepower { o m m } {
- \IfNoValueTF {#1}
+ \IfNoValueTF {#1}
{ \DeclareSIPrePower #2 {#3} }
{ \DeclareSIPostPower #2 {#3} }
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\newprefix}
-%\begin{macro}{\renewprefix}
-%\begin{macro}{\provideprefix}
-% Slightly more complex: an optional argument to check. A simple
+%\begin{macro}{
+% \newprefix ,
+% \renewprefix ,
+% \provideprefix ,
+%}
+% Slightly more complex: an optional argument to check. A simple
% assumption is made that it will be \texttt{post}: anything else
% would not make sense anyway.
% \begin{macrocode}
\NewDocumentCommand \newprefix { o m m m } {
- \IfNoValueTF {#1}
+ \IfNoValueTF {#1}
{ \DeclareSIPrefix #2 {#3} {#4} }
{ \DeclareBinaryPrefix #2 {#3} {#4} }
}
\NewDocumentCommand \renewprefix { o m m m } {
- \IfNoValueTF {#1}
+ \IfNoValueTF {#1}
{ \DeclareSIPrefix #2 {#3} {#4} }
{ \DeclareBinaryPrefix #2 {#3} {#4} }
}
\NewDocumentCommand \provideprefix { o m m m } {
- \IfNoValueTF {#1}
+ \IfNoValueTF {#1}
{ \DeclareSIPrefix #2 {#3} {#4} }
{ \DeclareBinaryPrefix #2 {#3} {#4} }
}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\newqualifier}
-%\begin{macro}{\renewqualifier}
-%\begin{macro}{\providequalifier}
+%\begin{macro}{
+% \newqualifier ,
+% \renewqualifier ,
+% \providequalifier ,
+%}
% The functions for creating qualifiers are easy to create again.
% \begin{macrocode}
\NewDocumentCommand \newqualifier { m m } {
@@ -15412,11 +16288,11 @@ This work consists of the file siunitx.dtx
\cs_new_eq:NN \providequalifier \newqualifier
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\Square}
-%\begin{macro}{\ssquare}
+%\begin{macro}{
+% \Square ,
+% \ssquare ,
+%}
% In version 1, \cs{square} is not used with these two alternatives
% preferred.
% \begin{macrocode}
@@ -15424,14 +16300,15 @@ This work consists of the file siunitx.dtx
\DeclareSIPrePower \ssquare { 2 }
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\BAR}
-%\begin{macro}{\bbar}
-%\begin{macro}{\Day}
-%\begin{macro}{\dday}
-%\begin{macro}{\Gray}
-%\begin{macro}{\ggray}
+%\begin{macro}{
+% \BAR ,
+% \bbar ,
+% \Day ,
+% \dday ,
+% \Gray ,
+% \ggray ,
+%}
% Units which are given awkward names in version one.
% \begin{macrocode}
\DeclareSIUnit \BAR { \bar }
@@ -15442,13 +16319,12 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \ggray { \gray }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\atomicmass}
+%\begin{macro}{
+% \atomicmass ,
+% \arcmin ,
+% \arcsec ,
+%}
% Slightly different: given more complete names in version two.
% \begin{macrocode}
\DeclareSIUnit \atomicmass { \atomicmassunit }
@@ -15457,13 +16333,15 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\are}
-%\begin{macro}{\curie}
-%\begin{macro}{\gal}
-%\begin{macro}{\millibar}
-%\begin{macro}{\rad}
-%\begin{macro}{\rem}
-%\begin{macro}{\roentgen}
+%\begin{macro}{
+% \are ,
+% \curie ,
+% \gal ,
+% \millibar ,
+% \rad ,
+% \rem ,
+% \roentgen ,
+%}
% Units which were defined in version one but are no longer listed
% by the \textsc{bipm} as acceptable.
% \begin{macrocode}
@@ -15476,26 +16354,22 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \roentgen { R }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\micA}
-%\begin{macro}{\micmol}
-%\begin{macro}{\micl}
-%\begin{macro}{\micL}
-%\begin{macro}{\nanog}
-%\begin{macro}{\micg}
-%\begin{macro}{\picm}
-%\begin{macro}{\micm}
-%\begin{macro}{\Sec}
-%\begin{macro}{\mics}
-%\begin{macro}{\cmc}
-%\begin{macro}{\dmc}
-%\begin{macro}{\cms}
+%\begin{macro}{
+% \micA ,
+% \micmol ,
+% \micl ,
+% \micL ,
+% \nanog ,
+% \micg ,
+% \picm ,
+% \micm ,
+% \Sec ,
+% \mics ,
+% \cmc ,
+% \dmc ,
+% \cms ,
+%}
% A few abbreviations which have been renamed.
% \begin{macrocode}
\DeclareSIUnit \micA { \micro \ampere }
@@ -15513,26 +16387,16 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \cms { \centi \metre \squared }
% \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}
%
-%\begin{macro}{\centimetrecubed}
-%\begin{macro}{\centimetresquared}
-%\begin{macro}{\cubiccentimetre}
-%\begin{macro}{\cubicdecimetre}
-%\begin{macro}{\squarecentimetre}
-%\begin{macro}{\squaremetre}
-%\begin{macro}{\squarekilometre}
+%\begin{macro}{
+% \centimetrecubed ,
+% \centimetresquared ,
+% \cubiccentimetre ,
+% \cubicdecimetre ,
+% \squarecentimetre ,
+% \squaremetre ,
+% \squarekilometre ,
+%}
% Units from version one that did not seem like a good idea to retain.
% \begin{macrocode}
\DeclareSIUnit \centimetrecubed { \centi \metre \cubed }
@@ -15544,26 +16408,23 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \squarekilometre { \kilo \metre \squared }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\parsec}
-%\begin{macro}{\lightyear}
+%\begin{macro}{
+% \parsec ,
+% \lightyear ,
+%}
% A few units for astronomy that version 1 provided.
% \begin{macrocode}
\DeclareSIUnit \parsec { pc }
\DeclareSIUnit \lightyear { ly }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%
-%\begin{macro}{\gmol}
-%\begin{macro}{\kgmol}
-%\begin{macro}{\lbmol}
+%
+%\begin{macro}{
+% \gmol ,
+% \kgmol ,
+% \lbmol ,
+%}
% Slightly odd chemical engineering units, again provided in version 1.
% \begin{macrocode}
\DeclareSIUnit \gmol { g \text { - } mol }
@@ -15571,14 +16432,14 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \lbmol { lb \text { - } mol }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
-%\begin{macro}{\molar}
-%\begin{macro}{\Molar}
-%\begin{macro}{\torr}
-% A few common units for chemistry from version 1. \cs{molar} is
-% simply a handy abbreviation: \cs{Molar} is common but rather
+%\begin{macro}{
+% \molar ,
+% \Molar ,
+% \torr ,
+%}
+% A few common units for chemistry from version 1. \cs{molar} is
+% simply a handy abbreviation: \cs{Molar} is common but rather
% questionable.
% \begin{macrocode}
\DeclareSIUnit \molar { \mole \per \cubic \deci \metre }
@@ -15586,9 +16447,7 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \torr { Torr }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%
+%
%\begin{macro}{\gon}
% A single unit for geophysics that version 1 included.
% \begin{macrocode}
@@ -15603,22 +16462,23 @@ This work consists of the file siunitx.dtx
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\micron}
-%\begin{macro}{\mrad}
-%\begin{macro}{\gauss}
-%\begin{macro}{\eVperc}
-%\begin{macro}{\nanobarn}
-%\begin{macro}{\picobarn}
-%\begin{macro}{\femptobarn}
-%\begin{macro}{\attobarn}
-%\begin{macro}{\zeptobarn}
-%\begin{macro}{\yoctobarn}
-%\begin{macro}{\nb}
-%\begin{macro}{\pb}
-%\begin{macro}{\fb}
-%\begin{macro}{\ab}
-%\begin{macro}{\zb}
-%\begin{macro}{\yb}
+%\begin{macro}{
+% \micron ,
+% \mrad ,
+% \gauss ,
+% \eVperc ,
+% \nanobarn ,
+% \picobarn ,
+% \femptobarn ,
+% \attobarn ,
+% \zeptobarn ,
+% \yoctobarn ,
+% \nb ,
+% \pb ,
+% \fb ,
+% \ab ,
+% \zb ,
+%}
% High-energy physics units from version one.
% \begin{macrocode}
\DeclareSIUnit \micron { \micro \metre }
@@ -15639,25 +16499,10 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \yb { \yocto \barn }
% \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}
-%\end{macro}
-%\end{macro}
-%
+%
%\begin{macro}{\requiresiconfigs}
-%\begin{macro}{\siunitx_requireconfig:n}
-% Version one provides this, and it might pop up so should not
+%\begin{macro}[aux]{\siunitx_requireconfig:n}
+% Version one provides this, and it might pop up so should not
% cause errors.
% \begin{macrocode}
\NewDocumentCommand \requiresiconfigs { m } {
@@ -15681,9 +16526,9 @@ This work consists of the file siunitx.dtx
% \begin{macrocode}
%<*abbreviations>
% \end{macrocode}
-%
+%
% \begin{macrocode}
-\ProvidesExplFile {siunitx-abbreviations.cfg} {2010/08/12} {2.0s}
+\ProvidesExplFile {siunitx-abbreviations.cfg} {2010/08/12} {2.0s}
{siunitx: Abbreviated units}
% \end{macrocode}
%
@@ -15692,12 +16537,14 @@ This work consists of the file siunitx.dtx
% into related groups, mainly to avoid an overly long list in one
% place.
%
-%\begin{macro}{\A}
-%\begin{macro}{\pA}
-%\begin{macro}{\nA}
-%\begin{macro}{\uA}
-%\begin{macro}{\mA}
-%\begin{macro}{\kA}
+%\begin{macro}{
+% \A ,
+% \pA ,
+% \nA ,
+% \uA ,
+% \mA ,
+% \kA ,
+%}
% Currents.
% \begin{macrocode}
\DeclareSIUnit \A { \ampere }
@@ -15708,17 +16555,14 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \kA { \kilo \ampere }
% \end{macrocode}
%\end{macro}
-%\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}
+%\begin{macro}{
+% \Hz ,
+% \mHz ,
+% \kHz ,
+% \MHz ,
+% \GHz ,
+% \THz ,
+%}
% Then frequencies.
% \begin{macrocode}
\DeclareSIUnit \Hz { \hertz }
@@ -15729,18 +16573,15 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \THz { \tera \hertz }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\mol}
-%\begin{macro}{\fmol}
-%\begin{macro}{\pmol}
-%\begin{macro}{\nmol}
-%\begin{macro}{\umol}
-%\begin{macro}{\mmol}
-%\begin{macro}{\kmol}
+%\begin{macro}{
+% \mol ,
+% \fmol ,
+% \pmol ,
+% \nmol ,
+% \umol ,
+% \mmol ,
+% \kmol ,
+%}
% Amounts of substance (moles).
% \begin{macrocode}
\DeclareSIUnit \mol { \mole }
@@ -15752,30 +16593,32 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \kmol { \kilo \mole }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\V}
-%\begin{macro}{\mV}
-%\begin{macro}{\kV}
+%\begin{macro}{
+% \V ,
+% \pV ,
+% \nV ,
+% \uV ,
+% \mV ,
+% \kV ,
+%}
% Potentials.
% \begin{macrocode}
\DeclareSIUnit \V { \volt }
+\DeclareSIUnit \pV { \pico \volt }
+\DeclareSIUnit \nV { \nano \volt }
+\DeclareSIUnit \uV { \micro \volt }
\DeclareSIUnit \mV { \milli \volt }
\DeclareSIUnit \kV { \kilo \volt }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\l}
-%\begin{macro}{\ml}
-%\begin{macro}{\ul}
-%\begin{macro}{\L}
-%\begin{macro}{\mL}
-%\begin{macro}{\uL}
+%\begin{macro}{
+% \l ,
+% \ml ,
+% \ul ,
+% \L ,
+% \mL ,
+% \uL ,
+%}
% Volumes.
% \begin{macrocode}
\DeclareSIUnit \l { \litre }
@@ -15786,19 +16629,16 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \uL { \micro \liter }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\fg}
-%\begin{macro}{\pg}
-%\begin{macro}{\ng}
-%\begin{macro}{\ug}
-%\begin{macro}{\mg}
-%\begin{macro}{\g}
-%\begin{macro}{\kg}
-%\begin{macro}{\amu}
+%\begin{macro}{
+% \fg ,
+% \pg ,
+% \ng ,
+% \ug ,
+% \mg ,
+% \g ,
+% \kg ,
+% \amu ,
+%}
% Masses.
% \begin{macrocode}
\DeclareSIUnit \fg { \femto \gram }
@@ -15811,27 +16651,22 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \amu { \atomicmassunit }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\W}
-%\begin{macro}{\mW}
-%\begin{macro}{\kW}
-%\begin{macro}{\MW}
-%\begin{macro}{\GW}
-%\begin{macro}{\kJ}
-%\begin{macro}{\J}
-%\begin{macro}{\eV}
-%\begin{macro}{\meV}
-%\begin{macro}{\keV}
-%\begin{macro}{\MeV}
-%\begin{macro}{\GeV}
-%\begin{macro}{\TeV}
-%\begin{macro}{\kWh}
+%\begin{macro}{
+% \W ,
+% \mW ,
+% \kW ,
+% \MW ,
+% \GW ,
+% \kJ ,
+% \J ,
+% \eV ,
+% \meV ,
+% \keV ,
+% \MeV ,
+% \GeV ,
+% \TeV ,
+% \kWh ,
+%}
% Energies.
% \begin{macrocode}
\DeclareSIUnit \W { \watt }
@@ -15847,31 +16682,19 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \MeV { \mega \electronvolt }
\DeclareSIUnit \GeV { \giga \electronvolt }
\DeclareSIUnit \TeV { \tera \electronvolt }
-\DeclareSIUnitWithOptions \kWh { \kilo \watt \hour }
- { inter-unit-separator = }
-% \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}
-%\begin{macro}{\m}
-%\begin{macro}{\pm}
-%\begin{macro}{\nm}
-%\begin{macro}{\um}
-%\begin{macro}{\mm}
-%\begin{macro}{\cm}
-%\begin{macro}{\dm}
-%\begin{macro}{\km}
+\DeclareSIUnit [ inter-unit-product = ] \kWh { \kilo \watt \hour }
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{
+% \m ,
+% \pm ,
+% \nm ,
+% \um ,
+% \mm ,
+% \cm ,
+% \dm ,
+% \km ,
+%}
% Lengths.
% \begin{macrocode}
\DeclareSIUnit \m { \metre }
@@ -15884,38 +16707,32 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \km { \kilo \metre }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\K}
% Temperatures.
% \begin{macrocode}
\DeclareSIUnit \K { \kelvin }
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\N}
-%\begin{macro}{\mN}
-%\begin{macro}{\kN}
-%\begin{macro}{\MN}
+%\begin{macro}{
+% \N ,
+% \mN ,
+% \kN ,
+% \MN ,
+%}
% Forces.
% \begin{macrocode}
-\DeclareSIUnit \N { \newton }
+\DeclareSIUnit \N { \newton }
\DeclareSIUnit \mN { \milli \newton }
\DeclareSIUnit \kN { \kilo \newton }
\DeclareSIUnit \MN { \mega \newton }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\Pa}
-%\begin{macro}{\kPa}
-%\begin{macro}{\MPa}
-%\begin{macro}{\GPa}
+%\begin{macro}{
+% \Pa ,
+% \kPa ,
+% \MPa ,
+% \GPa ,
+%}
% Pressures.
% \begin{macrocode}
\DeclareSIUnit \Pa { \pascal }
@@ -15924,28 +16741,27 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \GPa { \giga \pascal }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\mohm}
-%\begin{macro}{\kohm}
-%\begin{macro}{\Mohm}
+%\begin{macro}{
+% \mohm ,
+% \kohm ,
+% \Mohm ,
+%}
% Resistances.
% \begin{macrocode}
-\DeclareSIUnit \mohm { \milli \ohm }
-\DeclareSIUnit \kohm { \kilo \ohm }
-\DeclareSIUnit \Mohm { \mega \ohm }
+\DeclareSIUnit \mohm { \milli \ohm }
+\DeclareSIUnit \kohm { \kilo \ohm }
+\DeclareSIUnit \Mohm { \mega \ohm }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\s}
-%\begin{macro}{\as}
-%\begin{macro}{\fs}
-%\begin{macro}{\ps}
-%\begin{macro}{\ns}
-%\begin{macro}{\us}
-%\begin{macro}{\ms}
+%\begin{macro}{
+% \s ,
+% \as ,
+% \fs ,
+% \ps ,
+% \ns ,
+% \us ,
+% \ms ,
+%}
% Finally, times.
% \begin{macrocode}
\DeclareSIUnit \s { \second }
@@ -15957,112 +16773,102 @@ This work consists of the file siunitx.dtx
\DeclareSIUnit \ms { \milli \second }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
% \begin{macrocode}
%</abbreviations>
-% \end{macrocode}
-%
+% \end{macrocode}
+%
%\subsection{Binary units}
%
% \begin{macrocode}
%<*binary>
-% \end{macrocode}
-%
+% \end{macrocode}
+%
% \begin{macrocode}
-\ProvidesExplFile {siunitx-binary.cfg} {2011/04/04} {2.1p}
+\ProvidesExplFile {siunitx-binary.cfg} {2011/04/13} {2.2}
{siunitx: Binary units}
% \end{macrocode}
-%
-%\begin{macro}{\kibi}
-%\begin{macro}{\mebi}
-%\begin{macro}{\gibi}
-%\begin{macro}{\tebi}
-%\begin{macro}{\pebi}
-%\begin{macro}{\exbi}
-%\begin{macro}{\zebi}
-%\begin{macro}{\yobi}
+%
+%\begin{macro}{
+% \kibi ,
+% \mebi ,
+% \gibi ,
+% \tebi ,
+% \pebi ,
+% \exbi ,
+% \zebi ,
+% \yobi ,
+%}
% The binary units as specified by the IEC.
% \begin{macrocode}
-\DeclareBinaryPrefix \kibi { Ki } { 10 }
-\DeclareBinaryPrefix \mebi { Mi } { 20 }
-\DeclareBinaryPrefix \gibi { Gi } { 30 }
-\DeclareBinaryPrefix \tebi { Ti } { 40 }
-\DeclareBinaryPrefix \pebi { Pi } { 50 }
-\DeclareBinaryPrefix \exbi { Ei } { 60 }
-\DeclareBinaryPrefix \zebi { Zi } { 70 }
-\DeclareBinaryPrefix \yobi { Yi } { 80 }
+\DeclareBinaryPrefix \kibi { Ki } { 10 }
+\DeclareBinaryPrefix \mebi { Mi } { 20 }
+\DeclareBinaryPrefix \gibi { Gi } { 30 }
+\DeclareBinaryPrefix \tebi { Ti } { 40 }
+\DeclareBinaryPrefix \pebi { Pi } { 50 }
+\DeclareBinaryPrefix \exbi { Ei } { 60 }
+\DeclareBinaryPrefix \zebi { Zi } { 70 }
+\DeclareBinaryPrefix \yobi { Yi } { 80 }
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\bit}
-%\begin{macro}{\byte}
+%\begin{macro}{
+% \bit ,
+% \byte ,
+%}
% Now the units.
% \begin{macrocode}
\DeclareSIUnit \bit { bit }
\DeclareSIUnit \byte { B }
% \end{macrocode}
%\end{macro}
-%\end{macro}
%
% \begin{macrocode}
%</binary>
-% \end{macrocode}
+% \end{macrocode}
%
%\end{implementation}
-%
+%
%\begin{thebibliography}{1}
-%
+%
% \bibitem{BIPM}
% \emph{The International System of Units (SI)},
% \url{http://www.bipm.org/en/si/}.
-%
+%
% \bibitem{NIST}
% \emph{International System of Units from NIST},
% \url{http://physics.nist.gov/cuu/Units/index.html}.
-%
+%
% \bibitem{SI:2.1}
% \emph{SI base units},
% \url{http://www.bipm.org/en/si/si_brochure/chapter2/2-1/}.
-%
+%
% \bibitem{SI:2.2.2}
-% \emph{Units with special names and symbols; units that
+% \emph{Units with special names and symbols; units that
% incorporate special names and symbols},
% \url{http://www.bipm.org/en/si/si_brochure/chapter2/2-2/2-2-2.html}.
-%
+%
% \bibitem{SI:3.1}
% \emph{SI Prefixes},
% \url{http://www.bipm.org/en/si/si_brochure/chapter3/prefixes.html}.
-%
+%
% \bibitem{SI:4.1.T6}
-% \emph{Non-SI units accepted for use with the International
+% \emph{Non-SI units accepted for use with the International
% System of Units},
% \url{http://www.bipm.org/en/si/si_brochure/chapter4/table6.html}.
-%
+%
% \bibitem{SI:4.1.T7}
-% \emph{Non-SI units whose values in SI units must be obtained
+% \emph{Non-SI units whose values in SI units must be obtained
% experimentally},
% \url{http://www.bipm.org/en/si/si_brochure/chapter4/table7.html}.
-%
+%
% \bibitem{SI:4.1.T8}
% \emph{Other non-SI units},
% \url{http://www.bipm.org/en/si/si_brochure/chapter4/table8.html}.
-%
+%
% \bibitem{SI:5.3.3}
% \emph{Formatting the value of a quantity},
% \url{http://www.bipm.org/en/si/si_brochure/chapter5/5-3-2.html#5-3-3}.
-%
+%
%\end{thebibliography}
%
%\PrintChanges
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.ins b/Master/texmf-dist/source/latex/siunitx/siunitx.ins
index d0e0d4c6776..6ece6097a03 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx.ins
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.ins
@@ -27,7 +27,6 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-
Copyright (C) 2008-2011 by
Joseph Wright <joseph.wright@morningstar2.co.uk>
@@ -35,9 +34,7 @@ It may be distributed and/or modified under the conditions of
the LaTeX Project Public License (LPPL), either version 1.3c of
this license or (at your option) any later version. The latest
version of this license is in the file:
-
http://www.latex-project.org/lppl.txt
-
This work is "maintained" (as per LPPL maintenance status) by
Joseph Wright.
@@ -59,7 +56,6 @@ This work consists of the file siunitx.dtx
\file{siunitx-version-1.cfg}{\from{\jobname.dtx}{config,version-1}}
}
\endbatchfile
-%%
%% Copyright (C) 2008-2011 by
%% Joseph Wright <joseph.wright@morningstar2.co.uk>
%%
@@ -67,9 +63,7 @@ This work consists of the file siunitx.dtx
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
-%%
%% http://www.latex-project.org/lppl.txt
-%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Joseph Wright.
%%
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg
index 12c6de9e954..8a41d284d25 100644
--- a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg
+++ b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviations.cfg
@@ -35,6 +35,9 @@
\DeclareSIUnit \mmol { \milli \mole }
\DeclareSIUnit \kmol { \kilo \mole }
\DeclareSIUnit \V { \volt }
+\DeclareSIUnit \pV { \pico \volt }
+\DeclareSIUnit \nV { \nano \volt }
+\DeclareSIUnit \uV { \micro \volt }
\DeclareSIUnit \mV { \milli \volt }
\DeclareSIUnit \kV { \kilo \volt }
\DeclareSIUnit \l { \litre }
@@ -64,8 +67,7 @@
\DeclareSIUnit \MeV { \mega \electronvolt }
\DeclareSIUnit \GeV { \giga \electronvolt }
\DeclareSIUnit \TeV { \tera \electronvolt }
-\DeclareSIUnitWithOptions \kWh { \kilo \watt \hour }
- { inter-unit-separator = }
+\DeclareSIUnit [ inter-unit-product = ] \kWh { \kilo \watt \hour }
\DeclareSIUnit \m { \metre }
\DeclareSIUnit \pm { \pico \metre }
\DeclareSIUnit \nm { \nano \metre }
@@ -93,7 +95,6 @@
\DeclareSIUnit \ns { \nano \second }
\DeclareSIUnit \us { \micro \second }
\DeclareSIUnit \ms { \milli \second }
-%%
%% Copyright (C) 2008-2011 by
%% Joseph Wright <joseph.wright@morningstar2.co.uk>
%%
@@ -101,9 +102,7 @@
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
-%%
%% http://www.latex-project.org/lppl.txt
-%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Joseph Wright.
%%
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
index 21745c20815..1454b87328f 100644
--- a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
+++ b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
@@ -13,7 +13,7 @@
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
%%
-\ProvidesExplFile {siunitx-binary.cfg} {2011/04/04} {2.1p}
+\ProvidesExplFile {siunitx-binary.cfg} {2011/04/13} {2.2}
{siunitx: Binary units}
\DeclareBinaryPrefix \kibi { Ki } { 10 }
\DeclareBinaryPrefix \mebi { Mi } { 20 }
@@ -25,7 +25,6 @@
\DeclareBinaryPrefix \yobi { Yi } { 80 }
\DeclareSIUnit \bit { bit }
\DeclareSIUnit \byte { B }
-%%
%% Copyright (C) 2008-2011 by
%% Joseph Wright <joseph.wright@morningstar2.co.uk>
%%
@@ -33,9 +32,7 @@
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
-%%
%% http://www.latex-project.org/lppl.txt
-%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Joseph Wright.
%%
diff --git a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg
index 01b5b852b83..2fea1ee48d2 100644
--- a/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg
+++ b/Master/texmf-dist/tex/latex/siunitx/config/siunitx-version-1.cfg
@@ -13,7 +13,7 @@
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
%%
-\ProvidesExplFile {siunitx-version-1.cfg} {2011/04/04} {2.1p}
+\ProvidesExplFile {siunitx-version-1.cfg} {2011/04/13} {2.2}
{siunitx: Version 1 settings}
\keys_set:nn { siunitx }
{ load-configurations = { abbreviations , binary } }
@@ -519,52 +519,52 @@
unitsep .choice: ,
unitsep /
cdot .meta:n =
- { inter-unit-separator = { } \cdot { } },
+ { inter-unit-product = { } \cdot { } },
unitsep /
- comma .meta:n = { inter-unit-separator = { {,} } },
+ comma .meta:n = { inter-unit-product = { {,} } },
unitsep /
- fullstop .meta:n = { inter-unit-separator = { { . } } },
+ fullstop .meta:n = { inter-unit-product = { { . } } },
unitsep /
- med .meta:n = { inter-unit-separator = \: },
+ med .meta:n = { inter-unit-product = \: },
unitsep /
- medium .meta:n = { inter-unit-separator = \: },
+ medium .meta:n = { inter-unit-product = \: },
unitsep /
- none .meta:n = { inter-unit-separator = },
+ none .meta:n = { inter-unit-product = },
unitsep /
- period .meta:n = { inter-unit-separator = { { . } } },
+ period .meta:n = { inter-unit-product = { { . } } },
unitsep /
- space .meta:n = { inter-unit-separator = \text { ~ } },
+ space .meta:n = { inter-unit-product = \text { ~ } },
unitsep /
- stop .meta:n = { inter-unit-separator = { { . } } },
+ stop .meta:n = { inter-unit-product = { { . } } },
unitsep /
- thick .meta:n = { inter-unit-separator = \; },
+ thick .meta:n = { inter-unit-product = \; },
unitsep /
- thin .meta:n = { inter-unit-separator = \, },
+ thin .meta:n = { inter-unit-product = \, },
unitsep /
tightcdot .meta:n =
- { inter-unit-separator = \bgroup \cdot \egroup },
+ { inter-unit-product = \bgroup \cdot \egroup },
unitsep /
tighttimes .meta:n =
- { inter-unit-separator = \bgroup \times \egroup },
+ { inter-unit-product = \bgroup \times \egroup },
unitsep /
- times .meta:n = { inter-unit-separator = \times },
+ times .meta:n = { inter-unit-product = \times },
unitsep /
- unknown .meta:n = { inter-unit-separator = #1 },
+ unknown .meta:n = { inter-unit-product = #1 },
unitspace .choice: ,
unitspace /
- med .meta:n = { inter-unit-separator = \: },
+ med .meta:n = { inter-unit-product = \: },
unitspace /
- medium .meta:n = { inter-unit-separator = \: },
+ medium .meta:n = { inter-unit-product = \: },
unitspace /
- none .meta:n = { inter-unit-separator = },
+ none .meta:n = { inter-unit-product = },
unitspace /
- space .meta:n = { inter-unit-separator = \text { ~ } },
+ space .meta:n = { inter-unit-product = \text { ~ } },
unitspace /
- thick .meta:n = { inter-unit-separator = \; },
+ thick .meta:n = { inter-unit-product = \; },
unitspace /
- thin .meta:n = { inter-unit-separator = \, },
+ thin .meta:n = { inter-unit-product = \, },
unitspace /
- unknown .meta:n = { inter-unit-separator = #1 },
+ unknown .meta:n = { inter-unit-product = #1 },
valuecolor .meta:n = { number-color = #1 },
valuecolour .meta:n = { number-color = #1 },
valuemathrm .meta:x =
@@ -583,37 +583,37 @@
valuesep .choice: ,
valuesep /
cdot .meta:n =
- { number-unit-separator = { } \cdot { } },
+ { number-unit-product = { } \cdot { } },
valuesep /
- comma .meta:n = { number-unit-separator = { {,} } },
+ comma .meta:n = { number-unit-product = { {,} } },
valuesep /
- fullstop .meta:n = { number-unit-separator = { { . } } },
+ fullstop .meta:n = { number-unit-product = { { . } } },
valuesep /
- med .meta:n = { number-unit-separator = \: },
+ med .meta:n = { number-unit-product = \: },
valuesep /
- medium .meta:n = { number-unit-separator = \: },
+ medium .meta:n = { number-unit-product = \: },
valuesep /
- none .meta:n = { number-unit-separator = },
+ none .meta:n = { number-unit-product = },
valuesep /
- period .meta:n = { number-unit-separator = { { . } } },
+ period .meta:n = { number-unit-product = { { . } } },
valuesep /
- space .meta:n = { number-unit-separator = \text { ~ } },
+ space .meta:n = { number-unit-product = \text { ~ } },
valuesep /
- stop .meta:n = { number-unit-separator = { { . } } },
+ stop .meta:n = { number-unit-product = { { . } } },
valuesep /
- thick .meta:n = { number-unit-separator = \; },
+ thick .meta:n = { number-unit-product = \; },
valuesep /
- thin .meta:n = { number-unit-separator = \, },
+ thin .meta:n = { number-unit-product = \, },
valuesep /
tightcdot .meta:n =
- { number-unit-separator = \bgroup \cdot \egroup },
+ { number-unit-product = \bgroup \cdot \egroup },
valuesep /
tighttimes .meta:n =
- { number-unit-separator = \bgroup \times \egroup },
+ { number-unit-product = \bgroup \times \egroup },
valuesep /
- times .meta:n = { number-unit-separator = \times },
+ times .meta:n = { number-unit-product = \times },
valuesep /
- unknown .meta:n = { number-unit-separator = #1 },
+ unknown .meta:n = { number-unit-product = #1 },
xspace .meta:n = { use-xspace = #1 },
xspace .default:n = { true },
}
@@ -628,13 +628,9 @@
free-standing-units = true ,
mode = math ,
}
-\NewDocumentCommand \newunit { o m m } {
- \IfNoValueTF {#1}
- { \siunitx_declare_unit:Nnn #2 {#3} { } }
- { \siunitx_declare_unit:Nnn #2 {#3} {#1} }
-}
-\cs_new_eq:NN \renewunit \newunit
-\cs_new_eq:NN \provideunit \newunit
+\cs_new_eq:NN \newunit \DeclareSIUnit
+\cs_new_eq:NN \renewunit \DeclareSIUnit
+\cs_new_eq:NN \provideunit \DeclareSIUnit
\NewDocumentCommand \newpower { o m m } {
\IfNoValueTF {#1}
{ \DeclareSIPrePower #2 {#3} }
@@ -742,7 +738,6 @@
\str_if_eq:nnT {#1} { synchem }
{ \keys_set:nn { siunitx } { load-configurations = chemistry } }
}
-%%
%% Copyright (C) 2008-2011 by
%% Joseph Wright <joseph.wright@morningstar2.co.uk>
%%
@@ -750,9 +745,7 @@
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
-%%
%% http://www.latex-project.org/lppl.txt
-%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Joseph Wright.
%%
diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
index bbc700ec004..7bfb956c781 100644
--- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
+++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
@@ -14,7 +14,7 @@
%% ---------------------------------------------------------------
%%
\RequirePackage{expl3}
-\ProvidesExplPackage {siunitx} {2011/04/04} {2.1p}
+\ProvidesExplPackage {siunitx} {2011/04/13} {2.2}
{A comprehensive (SI) units package}
\cs_if_exist:NTF \msg_set:nnnn
{
@@ -70,7 +70,6 @@
\int_new:N \l_siunitx_tmp_int
\tl_new:N \l_siunitx_tmpa_tl
\tl_new:N \l_siunitx_tmpb_tl
-\bool_new:N \l_siunitx_error_bool
\cs_new_protected:Npn \siunitx_error:nxx #1#2#3 {
\bool_set_true:N \l_siunitx_error_bool
\msg_error:nnxx { siunitx } {#1} {#2} {#3}
@@ -81,6 +80,7 @@
\cs_new_protected:Npn \siunitx_error:n #1 {
\siunitx_error:nxx {#1} { } { }
}
+\bool_new:N \l_siunitx_error_bool
\AtBeginDocument {
\cs_if_free:cT { T@TS1 }
{
@@ -94,7 +94,8 @@
\@ifpackageloaded { fontspec }
{
\int_const:Nn \c_siunitx_minus_int { 8722 }
- \tl_set:Nn \c_siunitx_minus_tl { \char \c_siunitx_minus_int }
+ \tl_set:Nn \c_siunitx_minus_tl
+ { \tex_char:D \c_siunitx_minus_int }
}
{ }
}
@@ -102,7 +103,10 @@
\DeclareTextSymbolDefault \c_siunitx_mu_tl { TS1 }
\AtBeginDocument {
\@ifpackageloaded { fontspec }
- { \tl_set:Nx \c_siunitx_mu_tl { \char 181 } }
+ {
+ \int_const:Nn \c_siunitx_mu_int { 181 }
+ \tl_set:Nn \c_siunitx_mu_tl { \tex_char:D \c_siunitx_mu_int }
+ }
{ }
}
\tl_new:N \c_siunitx_omega_tl
@@ -308,7 +312,6 @@
}
}
}
-\clist_new:N \l_siunitx_option_deactivate_clist
\cs_new_protected_nopar:Npn \siunitx_option_deactivate:n #1 {
\clist_put_right:Nn \l_siunitx_option_deactivate_clist {#1}
}
@@ -323,8 +326,10 @@
\clist_map_function:NN \l_siunitx_option_deactivate_clist
\siunitx_option_deactivate_aux:n
}
+\clist_new:N \l_siunitx_option_deactivate_clist
\cs_generate_variant:Nn \prop_del:Nn { c }
\cs_generate_variant:Nn \prop_put:Nnn { cnV }
+\cs_generate_variant:Nn \tl_if_in:NnTF { NV }
\cs_generate_variant:Nn \tl_replace_all_in:Nnn { NnV }
\group_begin:
\tl_map_inline:nn { \M \A \C \R \O }
@@ -400,17 +405,17 @@
detect-all .default:n = true,
detect-all / false .meta:n =
{
- detect-family = false,
- detect-mode = false,
- detect-shape = false,
- detect-weight = false
+ detect-family = false ,
+ detect-mode = false ,
+ detect-shape = false ,
+ detect-weight = false ,
},
detect-all / true .meta:n =
{
- detect-family = true,
- detect-mode = true,
- detect-shape = true,
- detect-weight = true
+ detect-family = true ,
+ detect-mode = true ,
+ detect-shape = true ,
+ detect-weight = true ,
},
detect-display-math .bool_set:N =
\l_siunitx_detect_display_math_bool,
@@ -754,8 +759,12 @@
}
}
\AtBeginDocument {
- \@ifpackageloaded { color } { }
- { \cs_set_eq:NN \siunitx_print_color: \scan_stop: }
+ \@ifpackageloaded { color }
+ { \cs_new_eq:NN \siunitx_textcolor:n \textcolor }
+ {
+ \cs_set_eq:NN \siunitx_print_color: \scan_stop:
+ \cs_new_eq:NN \siunitx_textcolor:n \use:n
+ }
}
\group_begin:
\char_set_lccode:nn { `\@ } { `\_ }
@@ -766,6 +775,8 @@
\group_end:
\cs_set_protected_nopar:Npn \siunitx_print_math:
{
+ \cs_set_eq:NN \PrintSubscript @
+ \cs_set_eq:NN \PrintSuperscript ^
\ensuremath
{
\use:c
@@ -778,6 +789,8 @@
}
\cs_set_protected_nopar:Npn \siunitx_print_text:
{
+ \cs_set_eq:NN \PrintSubscript \siunitx_print_text_sub:n
+ \cs_set_eq:NN \PrintSuperscript \siunitx_print_text_super:n
\tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { @ }
{ \siunitx_print_text_sub:n }
\tl_replace_all_in:Nnn \l_siunitx_print_arg_tl { ! }
@@ -910,18 +923,31 @@
\tl_new:N \l_siunitx_number_part_integer_tl
\tl_new:N \l_siunitx_number_part_sign_tl
\tl_new:N \l_siunitx_number_part_uncert_tl
+\int_new:N \l_siunitx_number_mantissa_length_int
+\tl_new:N \l_siunitx_number_uncert_tl
+\int_new:N \l_siunitx_number_uncert_length_int
+\tl_new:N \l_siunitx_input_uncert_sign_tl
\keys_define:nn { siunitx } {
- input-close-uncertainty .tl_set:N = \l_siunitx_input_uncert_close_tl,
- input-complex-roots .tl_set:N = \l_siunitx_input_complex_tl,
- input-comparators .tl_set:N = \l_siunitx_input_comparator_tl,
- input-decimal-markers .tl_set:N = \l_siunitx_input_decimal_tl,
- input-digits .tl_set:N = \l_siunitx_input_digit_tl,
- input-exponent-markers .tl_set:N = \l_siunitx_input_exponent_tl,
- input-ignore .tl_set:N = \l_siunitx_input_ignore_tl,
- input-open-uncertainty .tl_set:N = \l_siunitx_input_uncert_open_tl,
- input-protect-tokens .tl_set:N = \l_siunitx_input_protect_tl,
- input-signs .tl_set:N = \l_siunitx_input_sign_tl,
- input-symbols .tl_set:N = \l_siunitx_input_symbol_tl,
+ input-close-uncertainty .tl_set:N = \l_siunitx_input_uncert_close_tl ,
+ input-complex-roots .tl_set:N = \l_siunitx_input_complex_tl ,
+ input-comparators .tl_set:N = \l_siunitx_input_comparator_tl ,
+ input-decimal-markers .tl_set:N = \l_siunitx_input_decimal_tl ,
+ input-digits .tl_set:N = \l_siunitx_input_digit_tl ,
+ input-exponent-markers .tl_set:N = \l_siunitx_input_exponent_tl ,
+ input-ignore .tl_set:N = \l_siunitx_input_ignore_tl ,
+ input-open-uncertainty .tl_set:N = \l_siunitx_input_uncert_open_tl ,
+ input-protect-tokens .tl_set:N = \l_siunitx_input_protect_tl ,
+ input-signs .tl_set:N = \l_siunitx_input_sign_tl ,
+ input-symbols .tl_set:N = \l_siunitx_input_symbol_tl ,
+ input-uncertainty-signs .code:n =
+ {
+ \tl_set:Nn \l_siunitx_input_uncert_sign_tl {#1}
+ \tl_map_inline:nn {#1}
+ {
+ \tl_if_in:NnF \l_siunitx_input_sign_tl {##1}
+ { \tl_put_right:Nn \l_siunitx_input_sign_tl {##1} }
+ }
+ } ,
}
\keys_set:nn { siunitx } { % (
input-close-uncertainty = ),
@@ -934,6 +960,7 @@
input-protect-tokens = \approx\ge\geq\gg\le\leg\ll\mp\pi\pm\sim,
input-signs = +-\mp\pm,
input-symbols = \pi,
+ input-uncertainty-signs = \pm,
}
\cs_new_protected:Npn \siunitx_number_in_parse:n #1 {
\tl_if_empty:nF {#1}
@@ -1023,11 +1050,11 @@
\tl_replace_all_in:Nnn #1 { >> } { \gg }
\tl_replace_all_in:Nnn #1 { >= } { \ge }
}
-\cs_new_protected:Npn \siunitx_number_in_parse_error:nx #1#2 {
+\cs_new_protected:Npn \siunitx_number_in_parse_error:nn #1#2 {
\siunitx_error:nx {#1} { \exp_not:n {#2} }
\tl_map_break:
}
-\cs_generate_variant:Nn \siunitx_number_in_parse_error:nx { nV }
+\cs_generate_variant:Nn \siunitx_number_in_parse_error:nn { nV }
\cs_new_protected:Npn \siunitx_number_in_parse_loop:N #1 { }
\cs_new_protected:Npn \siunitx_number_in_parse_more:N #1 { }
\cs_new_protected:Npn \siunitx_number_in_parse_relation:N #1 {
@@ -1045,7 +1072,7 @@
\cs_new_protected:Npn \siunitx_number_in_parse_restricted:N #1 {
\tl_if_in:NnTF \l_siunitx_input_exponent_tl {#1}
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ restricted-number } {#1}
}
{
@@ -1067,7 +1094,7 @@
{ restricted-number } \l_siunitx_number_arg_tl
}
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ restricted-number } {#1}
}
}
@@ -1093,7 +1120,7 @@
\cs_new_protected:Npn \siunitx_number_in_parse_exponent:N #1 {
\tl_if_in:NnTF \l_siunitx_input_exponent_tl {#1}
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ duplicate-exponent-token } { \token_to_str:N #1 }
}
{
@@ -1116,7 +1143,7 @@
\l_siunitx_number_arg_tl
}
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ invalid-token-in-number } {#1}
}
}
@@ -1156,14 +1183,14 @@
{
\tl_if_in:NnTF \l_siunitx_input_uncert_close_tl {#1}
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ misplaced-uncertainty-token } {#1}
}
{
\tl_if_in:NnTF \l_siunitx_input_complex_tl {#1}
{ \siunitx_number_in_complex:N #1 }
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ invalid-token-in-number } {#1}
}
}
@@ -1246,7 +1273,7 @@
\bool_set_false:N \l_siunitx_number_in_first_bool
\bool_if:NTF \l_siunitx_number_in_complex_root_bool
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ duplicate-complex-root-token } { \token_to_str:N #1 }
}
{
@@ -1311,8 +1338,8 @@
\bool_set_false:N \l_siunitx_number_in_first_bool
\bool_if:NTF \l_siunitx_number_in_decimal_bool
{
- \siunitx_number_in_parse_error:nx { duplicate-decimal-token }
- { \token_to_str:N #1 }
+ \siunitx_number_in_parse_error:nn { duplicate-decimal-token }
+ {#1}
}
{
\bool_set_true:N \l_siunitx_number_in_decimal_bool
@@ -1357,7 +1384,7 @@
\cs_new_protected:Npn \siunitx_number_in_exponent:N #1 {
\bool_if:NTF \l_siunitx_number_in_exponent_bool
{
- \siunitx_number_in_parse_error:nx { duplicate-exponent-token }
+ \siunitx_number_in_parse_error:nn { duplicate-exponent-token }
{ \token_to_str:N #1 }
}
{
@@ -1380,13 +1407,13 @@
{
\bool_if:NTF \l_siunitx_number_in_exponent_bool
{
- \siunitx_number_in_parse_error:nx { misplaced-sign-token }
+ \siunitx_number_in_parse_error:nn { misplaced-sign-token }
{#1}
}
{
\bool_if:NTF \l_siunitx_number_in_complex_bool
{
- \siunitx_number_in_parse_error:nx
+ \siunitx_number_in_parse_error:nn
{ misplaced-sign-token } {#1}
}
{
@@ -1485,8 +1512,19 @@
{
\prop_get:NnN \l_siunitx_number_in_prop { complex-sign }
\l_siunitx_tmpa_tl
- \siunitx_error:nx { misplaced-sign-token }
- { \exp_not:V \l_siunitx_tmpa_tl }
+ \tl_if_in:NVTF \l_siunitx_input_uncert_sign_tl \l_siunitx_tmpa_tl
+ {
+ \prop_if_in:NnTF \l_siunitx_number_in_prop { uncertainty }
+ {
+ \siunitx_error:nx { misplaced-sign-token }
+ { \exp_not:n {#1} }
+ }
+ { \siunitx_number_in_complex_to_uncert:n {#1} }
+ }
+ {
+ \siunitx_error:nx { misplaced-sign-token }
+ { \exp_not:n {#1} }
+ }
}
\prop_get:NnN \l_siunitx_number_in_prop { mantissa-sign }
\l_siunitx_tmpa_tl
@@ -1500,6 +1538,128 @@
}
}
}
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert:n #1 {
+ \prop_del:Nn \l_siunitx_number_in_prop { complex }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-decimal-marker }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-sign }
+ \prop_put:Nnn \l_siunitx_number_in_prop { uncertainty } { true }
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-integer }
+ \l_siunitx_number_uncert_tl
+ \quark_if_no_value:NTF \l_siunitx_number_uncert_tl
+ { \siunitx_number_in_complex_to_uncert_dec:n {#1} }
+ {
+ \tl_if_single:NTF \l_siunitx_number_uncert_tl
+ {
+ \int_compare:nNnTF
+ { \l_siunitx_number_uncert_tl } = { \c_zero }
+ { \siunitx_number_in_complex_to_uncert_dec:n {#1} }
+ { \siunitx_number_in_complex_to_uncert_int: }
+ }
+ { \siunitx_number_in_complex_to_uncert_int: }
+ }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-integer }
+ \prop_del:Nn \l_siunitx_number_in_prop { complex-decimal }
+}
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_int: {
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-decimal }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NT \l_siunitx_tmpa_tl
+ { \tl_clear:N \l_siunitx_tmpa_tl }
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \quark_if_no_value:NT \l_siunitx_tmpb_tl
+ { \tl_clear:N \l_siunitx_tmpb_tl }
+ \siunitx_number_in_complex_to_uncert_pad:
+}
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_dec:n
+ #1
+ {
+ \tl_clear:N \l_siunitx_number_uncert_tl
+ \prop_get:NnN \l_siunitx_number_in_prop { complex-decimal }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NTF \l_siunitx_tmpa_tl
+ {
+ \siunitx_error:nx { misplaced-sign-token }
+ { \exp_not:n {#1} }
+ }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \quark_if_no_value:NT \l_siunitx_tmpb_tl
+ { \tl_clear:N \l_siunitx_tmpb_tl }
+ \tl_map_function:NN
+ \l_siunitx_tmpa_tl
+ \siunitx_number_in_complex_to_uncert_dec_loop:N
+ \siunitx_number_in_complex_to_uncert_pad:
+ }
+ }
+\cs_new_protected_nopar:Npn
+ \siunitx_number_in_complex_to_uncert_dec_loop:N #1
+ {
+ \str_if_eq:nnTF {#1} { 0 }
+ {
+ \tl_set:Nf \l_siunitx_tmpa_tl
+ { \tl_tail:V \l_siunitx_tmpa_tl }
+ \tl_if_empty:NF \l_siunitx_tmpb_tl
+ {
+ \tl_set:Nf \l_siunitx_tmpb_tl
+ { \tl_tail:V \l_siunitx_tmpb_tl }
+ }
+ }
+ { \tl_map_break: }
+ }
+\cs_new_protected_nopar:Npn \siunitx_number_in_complex_to_uncert_pad:
+ {
+ \int_set:Nn \l_siunitx_number_uncert_length_int
+ { \tl_elt_count:N \l_siunitx_tmpa_tl }
+ \int_set:Nn \l_siunitx_number_mantissa_length_int
+ { \tl_elt_count:N \l_siunitx_tmpb_tl }
+ \int_compare:nNnTF
+ { \l_siunitx_number_mantissa_length_int }
+ > { \l_siunitx_number_uncert_length_int }
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ {
+ \exp_not:V \l_siunitx_tmpa_tl
+ \prg_replicate:nn
+ {
+ \l_siunitx_number_mantissa_length_int
+ - \l_siunitx_number_uncert_length_int
+ }
+ { 0 }
+ }
+ }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \quark_if_no_value:NT \l_siunitx_tmpb_tl
+ { \tl_clear:N \l_siunitx_tmpb_tl }
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ {
+ \exp_not:V \l_siunitx_tmpb_tl
+ \prg_replicate:nn
+ {
+ \l_siunitx_number_uncert_length_int
+ - \l_siunitx_number_mantissa_length_int
+ }
+ { 0 }
+ }
+ \tl_if_empty:NF \l_siunitx_tmpb_tl
+ {
+ \prop_put:NnV \l_siunitx_number_in_prop { mantissa-decimal }
+ \l_siunitx_tmpb_tl
+ \prop_if_in:NnF \l_siunitx_number_in_prop
+ { mantissa-decimal-marker }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker } { . }
+ }
+ }
+ }
+ \tl_put_right:NV \l_siunitx_number_uncert_tl \l_siunitx_tmpa_tl
+ \prop_put:NnV \l_siunitx_number_in_prop { mantissa-uncertainty }
+ \l_siunitx_number_uncert_tl
+ }
\int_new:N \l_siunitx_round_int
\tl_new:N \l_siunitx_round_tl
\bool_new:N \l_siunitx_round_bool
@@ -1512,12 +1672,15 @@
\tl_new:N \l_siunitx_uncertainty_decimal_tl
\tl_new:N \l_siunitx_uncertainty_integer_tl
\bool_new:N \l_siunitx_process_fixed_bool
+\bool_new:N \l_siunitx_process_engineering_bool
\bool_new:N \l_siunitx_process_scientific_bool
\keys_define:nn { siunitx } {
add-decimal-zero .bool_set:N = \l_siunitx_process_decimal_zero_bool,
add-integer-zero .bool_set:N = \l_siunitx_process_integer_zero_bool,
explicit-sign .tl_set:N = \l_siunitx_process_sign_tl,
fixed-exponent .int_set:N = \l_siunitx_process_fixed_int,
+ minimum-integer-digits .int_set:N =
+ \l_siunitx_process_integer_min_int,
retain-explicit-plus .bool_set:N = \l_siunitx_process_plus_tl,
retain-unity-mantissa .bool_set:N =
\l_siunitx_process_unity_mantissa_bool,
@@ -1538,19 +1701,29 @@
/ false .code:n =
{
\bool_set_false:N \l_siunitx_process_fixed_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
\bool_set_false:N \l_siunitx_process_scientific_bool
},
scientific-notation
+ / engineering .code:n =
+ {
+ \bool_set_false:N \l_siunitx_process_fixed_bool
+ \bool_set_true:N \l_siunitx_process_engineering_bool
+ \bool_set_true:N \l_siunitx_process_scientific_bool
+ },
+ scientific-notation
/ fixed .code:n =
{
\bool_set_true:N \l_siunitx_process_fixed_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
\bool_set_false:N \l_siunitx_process_scientific_bool
},
scientific-notation
/ true .code:n =
{
\bool_set_false:N \l_siunitx_process_fixed_bool
- \bool_set_true:N \l_siunitx_process_scientific_bool
+ \bool_set_false:N \l_siunitx_process_engineering_bool
+ \bool_set_true:N \l_siunitx_process_scientific_bool
},
}
\keys_set:nn { siunitx } {
@@ -1576,6 +1749,7 @@
\prop_if_in:NnF \l_siunitx_number_in_prop { uncertainty }
{ \siunitx_number_process_round: }
}
+ \siunitx_number_process_integer_digits:
}
\cs_new_protected_nopar:Npn \siunitx_number_process_exponent: {
\bool_if:NF \l_siunitx_process_zero_exponent_bool
@@ -1894,8 +2068,32 @@
}
\cs_new_protected_nopar:Npn \siunitx_number_process_fixed_small_aux:w
{ }
-\tl_new:N \c_siunitx_unity_tl
-\tl_set:Nn \c_siunitx_unity_tl { 1 }
+\cs_new_protected_nopar:Npn \siunitx_number_process_integer_digits: {
+ \int_compare:nNnT
+ { \l_siunitx_process_integer_min_int } > { \c_zero }
+ {
+ \prop_get:NnN \l_siunitx_number_in_prop { mantissa-integer }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ {
+ \int_set:Nn \l_siunitx_tmp_int
+ {
+ \l_siunitx_process_integer_min_int
+ - \tl_elt_count:N \l_siunitx_tmpa_tl
+ }
+ \int_compare:nNnT { \l_siunitx_tmp_int } > { \c_zero }
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ {
+ \prg_replicate:nn { \l_siunitx_tmp_int } { 0 }
+ \exp_not:V \l_siunitx_tmpa_tl
+ }
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { mantissa-integer } \l_siunitx_tmpa_tl
+ }
+ }
+ }
+}
\cs_new_protected_nopar:Npn \siunitx_number_process_mantissa: {
\bool_if:NF \l_siunitx_process_unity_mantissa_bool
{
@@ -1920,6 +2118,8 @@
}
}
}
+\tl_new:N \c_siunitx_unity_tl
+\tl_set:Nn \c_siunitx_unity_tl { 1 }
\cs_new_protected_nopar:Npn \siunitx_number_process_pad:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -decimal }
\l_siunitx_tmpa_tl
@@ -2180,6 +2380,13 @@
\l_siunitx_tmpb_tl
\quark_if_no_value:NT \l_siunitx_tmpb_tl
{ \tl_set:Nn \l_siunitx_tmpb_tl { 0 } }
+ \group_begin:
+ \prop_get:NnN \l_siunitx_number_in_prop { exponent-sign }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ { \tl_put_left:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl }
+ \exp_args:NNNV \group_end:
+ \tl_set:Nn \l_siunitx_tmpb_tl \l_siunitx_tmpb_tl
\tl_set:Nx \l_siunitx_tmpa_tl
{ \l_siunitx_tmpa_tl { \l_siunitx_tmpb_tl } }
\exp_last_unbraced:NV \siunitx_number_process_scientific_aux_i:nnn
@@ -2198,34 +2405,10 @@
{
\int_compare:nNnTF {#1} > { 0 }
{
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-integer } {#1}
-
- \tl_if_empty:nTF {#2}
- {
- \prop_del:Nn \l_siunitx_number_in_prop
- { mantissa-decimal }
- \prop_del:Nn \l_siunitx_number_in_prop
- { mantissa-decimal-marker }
- }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-decimal } {#2}
- \prop_if_in:NnF \l_siunitx_number_in_prop
- { mantissa-decimal-marker }
- {
- \prop_put:Nnn \l_siunitx_number_in_prop
- { mantissa-decimal-marker } { . }
- }
- }
- \int_compare:nNnF {#3} = { 0 }
- {
- \int_set:Nn \l_siunitx_tmp_int {#3}
- \prop_put:Nnn \l_siunitx_number_in_prop { exponent }
- { true }
- \prop_put:NnV \l_siunitx_number_in_prop
- { exponent-integer } \l_siunitx_tmp_int
- }
+ \bool_if:NTF \l_siunitx_process_engineering_bool
+ { \siunitx_number_process_scientific_engineering:nnn }
+ { \siunitx_number_process_scientific_store:nnn }
+ {#1} {#2} {#3}
}
{
\siunitx_number_process_scientific_small:wn
@@ -2247,9 +2430,132 @@
\l_siunitx_tmpa_tl
}
\cs_new_protected_nopar:Npn
- \siunitx_number_process_scientific_small:wn #1#2 \q_stop #3 {
- \siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} { #3 - 1 }
-}
+ \siunitx_number_process_scientific_small:wn #1#2 \q_stop #3
+ { \siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} { #3 - 1 } }
+\cs_new_protected_nopar:Npn
+ \siunitx_number_process_scientific_store:nnn #1#2#3
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { mantissa-integer } {#1}
+ \tl_if_empty:nTF {#2}
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { mantissa-decimal }
+ \prop_del:Nn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker }
+ }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal } {#2}
+ \prop_if_in:NnF \l_siunitx_number_in_prop
+ { mantissa-decimal-marker }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop
+ { mantissa-decimal-marker } { . }
+ }
+ }
+ \int_compare:nNnTF {#3} = { 0 }
+ {
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent }
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-sign }
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-integer }
+ }
+ {
+ \prop_put:Nnn \l_siunitx_number_in_prop { exponent } { true }
+ \int_compare:nNnTF {#3} > { 0 }
+ {
+ \int_set:Nn \l_siunitx_tmp_int {#3}
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { exponent-integer } \l_siunitx_tmp_int
+ \prop_del:Nn \l_siunitx_number_in_prop { exponent-sign }
+ }
+ {
+ \int_set:Nn \l_siunitx_tmp_int { 0 - (#3) }
+ \prop_put:NnV \l_siunitx_number_in_prop
+ { exponent-integer } \l_siunitx_tmp_int
+ \prop_put:Nnn \l_siunitx_number_in_prop { exponent-sign }
+ { - }
+ }
+ }
+ }
+\cs_new_protected_nopar:Npn
+ \siunitx_number_process_scientific_engineering:nnn #1#2#3
+ {
+ \use:c
+ {
+ siunitx_number_process_scientific_engineering_
+ \int_compare:nNnTF {#3} < { 0 }
+ {
+ \prg_case_int:nnn { \int_mod:nn { 0 - (#3) } { 3 } }
+ {
+ { 1 } { 2 }
+ { 2 } { 1 }
+ }
+ { 0 }
+ }
+ { \int_mod:nn {#3} { 3 } }
+ :nnn
+ }
+ {#1} {#2} {#3}
+ }
+\cs_new_eq:cN
+ { siunitx_number_process_scientific_engineering_0:nnn }
+ \siunitx_number_process_scientific_store:nnn
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_1:nnn } #1#2#3
+ {
+ \tl_if_empty:nTF {#2}
+ {
+ \siunitx_number_process_scientific_store:nnn { #1 0 } { }
+ { #3 - 1 }
+ }
+ {
+ \use:c
+ { siunitx_number_process_scientific_engineering_1:nw }
+ {#1} #2 \q_stop {#3}
+ }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_1:nw }
+ #1#2#3 \q_stop #4
+ {
+ \siunitx_number_process_scientific_store:nnn
+ {#1#2} {#3} { #4 - 1 }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_2:nnn } #1#2#3
+ {
+ \tl_if_empty:nTF {#2}
+ {
+ \siunitx_number_process_scientific_store:nnn { #1 00 } { }
+ { #3 - 2 }
+ }
+ {
+ \use:c
+ { siunitx_number_process_scientific_engineering_2_i:nw }
+ {#1} #2 \q_stop {#3}
+ }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_2_i:nw }
+ #1#2#3 \q_stop #4
+ {
+ \tl_if_empty:nTF {#3}
+ {
+ \siunitx_number_process_scientific_store:nnn { #1#2 0 } { }
+ { #4 - 2 }
+ }
+ {
+ \use:c
+ { siunitx_number_process_scientific_engineering_2_ii:nw }
+ {#1#2} #3 \q_stop {#4}
+ }
+ }
+\cs_new_protected_nopar:cpn
+ { siunitx_number_process_scientific_engineering_2_ii:nw }
+ #1#2#3 \q_stop #4
+ {
+ \siunitx_number_process_scientific_store:nnn { #1#2 } {#3}
+ { #4 - 2 }
+ }
\cs_new_protected_nopar:Npn \siunitx_number_process_sign: {
\bool_if:NF \l_siunitx_process_plus_tl
{
@@ -2296,8 +2602,6 @@
}
}
}
-\tl_new:N \c_siunitx_plus_tl
-\tl_set:Nn \c_siunitx_plus_tl { + }
\cs_new_protected_nopar:Npn \siunitx_number_process_sign_plus:n #1 {
\prop_get:NnN \l_siunitx_number_in_prop { #1 -sign }
\l_siunitx_tmpa_tl
@@ -2307,6 +2611,8 @@
\prop_put:Nnn \l_siunitx_number_in_prop { #1 -had-sign } { true }
}
}
+\tl_new:N \c_siunitx_plus_tl
+\tl_set:Nn \c_siunitx_plus_tl { + }
\cs_new_protected_nopar:Npn \siunitx_number_process_uncertainty: {
\clist_map_function:nN { mantissa , complex }
\siunitx_number_process_uncertainty_aux:n
@@ -2408,6 +2714,8 @@
\tl_new:N \l_siunitx_output_decimal_tl
\bool_new:N \l_siunitx_complex_after_bool
\keys_define:nn { siunitx } {
+ bracket-negative-numbers .bool_set:N =
+ \l_siunitx_negative_bracket_bool ,
bracket-numbers .bool_set:N = \l_siunitx_brackets_bool,
close-bracket .tl_set:N = \l_siunitx_bracket_close_tl,
complex-root-position .choice:,
@@ -2447,6 +2755,7 @@
{
\tl_set:Nn \l_siunitx_output_decimal_tl { {#1} }
},
+ output-exponent-marker .tl_set:N = \l_siunitx_output_exponent_tl,
output-open-uncertainty .tl_set:N =
\l_siunitx_output_uncert_open_tl,
separate-uncertainty .bool_set:N = \l_siunitx_uncert_sep_bool,
@@ -2637,17 +2946,20 @@
\siunitx_number_format_brackets:n { mantissa }
\prop_get:NnN \l_siunitx_number_out_prop { mantissa-result }
\l_siunitx_tmpa_tl
- \bool_if:NTF \l_siunitx_tight_bool
+ \tl_if_empty:NT \l_siunitx_output_exponent_tl
{
- \tl_set:Nx \l_siunitx_tmpb_tl
- { { \exp_not:V \l_siunitx_exponent_product_tl } }
- }
- {
- \tl_set:Nx \l_siunitx_tmpb_tl
- { { } \exp_not:V \l_siunitx_exponent_product_tl { } }
+ \bool_if:NTF \l_siunitx_tight_bool
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { { \exp_not:V \l_siunitx_exponent_product_tl } }
+ }
+ {
+ \tl_set:Nx \l_siunitx_tmpb_tl
+ { { } \exp_not:V \l_siunitx_exponent_product_tl { } }
+ }
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
+ \l_siunitx_tmpb_tl
}
- \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
- \l_siunitx_tmpb_tl
\prop_get:NnN \l_siunitx_number_out_prop { exponent-result }
\l_siunitx_tmpb_tl
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
@@ -2659,9 +2971,15 @@
\cs_new_protected_nopar:Npn \siunitx_number_format_final_exponent: {
\prop_get:NnN \l_siunitx_number_out_prop { exponent }
\l_siunitx_tmpa_tl
- \tl_set:Nx \l_siunitx_tmpa_tl
- { ^ { \exp_not:V \l_siunitx_tmpa_tl } }
- \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_exponent_base_tl
+ \tl_if_empty:NTF \l_siunitx_output_exponent_tl
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { ^ { \exp_not:V \l_siunitx_tmpa_tl } }
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_exponent_base_tl
+ }
+ {
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_output_exponent_tl
+ }
\prop_put:NnV \l_siunitx_number_out_prop { exponent-result }
\l_siunitx_tmpa_tl
}
@@ -2916,32 +3234,54 @@
\l_siunitx_tmpa_tl
\quark_if_no_value:NF \l_siunitx_tmpa_tl
{
- \bool_if:NT \l_siunitx_tight_bool
- {
- \tl_set:Nx \l_siunitx_tmpa_tl
- { { \exp_not:V \l_siunitx_tmpa_tl } }
- }
- \tl_clear:N \l_siunitx_tmpb_tl
- \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl
- \l_siunitx_tmpa_tl
- \prop_put:NnV \l_siunitx_number_out_prop { #1 -sign }
- \l_siunitx_tmpb_tl
- \prop_get:NnN \l_siunitx_number_out_prop {#1}
- \l_siunitx_tmpa_tl
- \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop {#1}
- \l_siunitx_tmpa_tl
- \prop_get:NnN \l_siunitx_number_out_prop { #1 -result }
- \l_siunitx_tmpa_tl
- \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ \bool_if:NTF \l_siunitx_negative_bracket_bool
{
- \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
- \l_siunitx_tmpa_tl
+ \str_if_eq:VnTF \l_siunitx_tmpa_tl { - }
+ { \siunitx_number_format_sign_negative_brackets:n {#1} }
+ { \siunitx_number_format_sign_aux:n {#1} }
}
- }
+ { \siunitx_number_format_sign_aux:n {#1} }
+ }
}
}
+\cs_new_protected_nopar:Npn \siunitx_number_format_sign_aux:n #1 {
+ \bool_if:NT \l_siunitx_tight_bool
+ {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { { \exp_not:V \l_siunitx_tmpa_tl } }
+ }
+ \tl_clear:N \l_siunitx_tmpb_tl
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpb_tl \l_siunitx_tmpa_tl
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 -sign }
+ \l_siunitx_tmpb_tl
+ \prop_get:NnN \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
+ \prop_put:NnV \l_siunitx_number_out_prop {#1} \l_siunitx_tmpa_tl
+ \prop_get:NnN \l_siunitx_number_out_prop { #1 -result }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ {
+ \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 -result }
+ \l_siunitx_tmpa_tl
+ }
+}
+\cs_new_protected_nopar:Npn
+ \siunitx_number_format_sign_negative_brackets:n #1
+ {
+ \siunitx_number_format_brackets_aux:n {#1}
+ \prop_get:NnN \l_siunitx_number_out_prop { #1 }
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NF \l_siunitx_tmpa_tl
+ {
+ \siunitx_tl_put_left_math:NV \l_siunitx_tmpa_tl
+ \l_siunitx_bracket_open_tl
+ \siunitx_tl_put_right_math:NV \l_siunitx_tmpa_tl
+ \l_siunitx_bracket_close_tl
+ \prop_put:NnV \l_siunitx_number_out_prop { #1 }
+ \l_siunitx_tmpa_tl
+ }
+ }
\cs_new_protected_nopar:Npn \siunitx_number_format_sign_complex: {
\siunitx_number_format_sign_complex:n { complex }
\siunitx_number_format_sign_complex:n { complex-result }
@@ -3311,7 +3651,7 @@
\cs_new_protected_nopar:Npn \siunitx_number_output_single_aux: {
\siunitx_unit_output_pre_print:
\quark_if_no_value:NTF \l_siunitx_number_out_tl
- { \tl_clear:N \l_siunitx_number_unit_separator_tl }
+ { \tl_clear:N \l_siunitx_number_unit_product_tl }
{ \siunitx_print:nV { number } \l_siunitx_number_out_tl }
\siunitx_unit_output_print:
}
@@ -3335,8 +3675,10 @@
\l_siunitx_angle_astronomy_bool ,
arc-separator .tl_set:N =
\l_siunitx_angle_arc_separator_tl ,
+ number-angle-product .tl_set:N =
+ \l_siunitx_angle_unit_product_tl ,
number-angle-separator .tl_set:N =
- \l_siunitx_angle_unit_separator_tl ,
+ \l_siunitx_angle_unit_product_tl ,
}
\cs_new_protected:Npn \siunitx_angle_output:nnn #1#2#3 {
\siunitx_angle_init:
@@ -3368,8 +3710,8 @@
\prop_clear:N \l_siunitx_angle_minute_prop
\prop_clear:N \l_siunitx_angle_second_prop
\tl_clear:N \l_siunitx_preunit_tl
- \tl_set_eq:NN \l_siunitx_number_unit_separator_tl
- \l_siunitx_angle_unit_separator_tl
+ \tl_set_eq:NN \l_siunitx_number_unit_product_tl
+ \l_siunitx_angle_unit_product_tl
\cs_set_eq:NN \siunitx_number_in_parse_more:N
\siunitx_number_in_parse_restricted:N
}
@@ -3381,7 +3723,6 @@
{ \siunitx_angle_direct_aux_i:nnn { } }
}
{ \siunitx_angle_direct_aux_i:nnn {#1} }
-
}
\cs_new_protected:Npn \siunitx_angle_direct_aux_i:nnn #1#2 {
\tl_if_empty:nTF {#2}
@@ -3391,7 +3732,6 @@
{ \siunitx_angle_direct_aux_ii:nnn {#1} { } }
}
{ \siunitx_angle_direct_aux_ii:nnn {#1} {#2} }
-
}
\cs_new_protected:Npn \siunitx_angle_direct_aux_ii:nnn #1#2#3 {
\tl_if_empty:nTF {#3}
@@ -3648,7 +3988,8 @@
}
}
\tl_new:N \l_siunitx_declare_list_tl
-\tl_set:Nn \l_siunitx_declare_list_tl { \of \per \raiseto \tothe }
+\tl_set:Nn \l_siunitx_declare_list_tl
+ { \of \highlight \per \raiseto \tothe }
\cs_new_protected:Npn \siunitx_declare_power_after:Nn #1#2 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
\cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w }
@@ -3680,6 +4021,13 @@
\cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
{ \siunitx_unit_parse_qualifier:n {#2} }
}
+\cs_new_protected:Npn \siunitx_declare_special:Nn #1#2 {
+ \tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } ##1
+ { #2 {##1} }
+ \cs_set:cpn { siunitx_ \token_to_str:N #1 _function:w }
+ { \siunitx_unit_parse_special:n {#2} }
+}
\cs_new_protected:Npn \siunitx_declare_unit:Nnn #1#2#3 {
\tl_put_right:Nn \l_siunitx_declare_list_tl {#1}
\cs_set:cpn { siunitx_ \token_to_str:N #1 _literal:w } {#2}
@@ -3731,20 +4079,35 @@
\cs_new_protected:cpn { siunitx_ \token_to_str:N \of _function:w } #1 {
\siunitx_unit_parse_qualifier:n {#1}
}
+\AtBeginDocument {
+ \cs_if_exist:NT \cancel
+ {
+ \cs_set_eq:NN \siunitx_cancel:n \cancel
+ \tl_put_right:Nn \l_siunitx_declare_list_tl { \cancel }
+ \cs_new_protected:cpn
+ { siunitx_ \token_to_str:N \cancel _function:w }
+ { \siunitx_unit_parse_special:n { \siunitx_cancel:n } }
+ }
+}
+\cs_new_protected:cpn
+ { siunitx_ \token_to_str:N \highlight _literal:w } #1
+ { \siunitx_textcolor:n {#1} }
+\cs_new_protected:cpn
+ { siunitx_ \token_to_str:N \highlight _function:w } #1
+ { \siunitx_unit_parse_special:n { \siunitx_textcolor:n {#1} } }
\keys_define:nn { siunitx } {
- free-standing-units .bool_set:N = \l_siunitx_create_free_bool,
- overwrite-functions .bool_set:N =
- \l_siunitx_create_overwrite_bool,
- space-before-unit .bool_set:N = \l_siunitx_create_prespace_bool,
- unit-optional-argument .bool_set:N = \l_siunitx_create_optional_bool,
- use-xspace .bool_set:N = \l_siunitx_create_xspace_bool
+ free-standing-units .bool_set:N = \l_siunitx_create_free_bool ,
+ overwrite-functions .bool_set:N = \l_siunitx_create_overwrite_bool,
+ space-before-unit .bool_set:N = \l_siunitx_create_prespace_bool ,
+ unit-optional-argument .bool_set:N = \l_siunitx_create_optional_bool ,
+ use-xspace .bool_set:N = \l_siunitx_create_xspace_bool ,
}
\siunitx_option_deactivate:n {
- free-standing-units,
- overwrite-functions,
- space-before-unit,
- unit-optional-argument,
- use-xspace
+ free-standing-units ,
+ overwrite-functions ,
+ space-before-unit ,
+ unit-optional-argument ,
+ use-xspace ,
}
\AtBeginDocument {
\bool_if:NTF \l_siunitx_create_free_bool
@@ -3795,7 +4158,7 @@
\exp_not:n
{
\siunitx_ensuremath:n
- { \l_siunitx_number_unit_separator_tl }
+ { \l_siunitx_number_unit_product_tl }
}
}
\exp_not:n { \siunitx_unit_output:nn {#1} { } }
@@ -3832,7 +4195,7 @@
\exp_not:n
{
\siunitx_ensuremath:n
- { \l_siunitx_number_unit_separator_tl }
+ { \l_siunitx_number_unit_product_tl }
}
}
\exp_not:n { \siunitx_unit_output:nn {#1} { } }
@@ -3903,6 +4266,7 @@
\tl_map_function:NN \l_siunitx_declare_list_tl
\siunitx_unit_if_literal_aux:N
\cs_set_eq:NN \of \use_none:n
+ \cs_set_eq:NN \highlight \use_none:n
\cs_set_eq:NN \raiseto \use_none:n
\cs_set_eq:NN \tothe \use_none:n
\protected@edef \l_siunitx_tmpa_tl {#1}
@@ -3991,6 +4355,11 @@
{ qualifier- \int_use:N \l_siunitx_unit_int }
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
}
+\cs_new_protected:Npn \siunitx_unit_parse_special:n #1 {
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { special- \int_eval:n { \l_siunitx_unit_int + 1 } }
+ \prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl {#1}
+}
\cs_new_protected:Npn \siunitx_unit_parse_unit:Nn #1#2 {
\tl_set:Nx \l_siunitx_tmpa_tl
{ prefix- \int_use:N \l_siunitx_unit_int }
@@ -4044,7 +4413,8 @@
\keys_define:nn { siunitx } {
bracket-unit-denominator .bool_set:N
= \l_siunitx_unit_denominator_bracket_bool,
- inter-unit-separator .tl_set:N = \l_siunitx_unit_separator_tl ,
+ inter-unit-product .tl_set:N = \l_siunitx_unit_product_tl ,
+ inter-unit-separator .tl_set:N = \l_siunitx_unit_product_tl ,
per-mode .choice:,
per-mode / fraction .code:n =
{
@@ -4109,7 +4479,7 @@
}
\keys_set:nn { siunitx } {
bracket-unit-denominator = true,
- inter-unit-separator = \,,
+ inter-unit-product = \,,
per-mode = reciprocal,
per-symbol = /,
power-font = number,
@@ -4117,14 +4487,6 @@
}
\cs_new_protected_nopar:Npn \siunitx_unit_format: {
\siunitx_unit_format_init:
- \int_compare:nNnT { \l_siunitx_unit_int } = { 1 }
- {
- \str_if_eq:VnT \l_siunitx_per_mode_tl { symbol }
- {
- \prop_if_in:NnT \l_siunitx_unit_prop { per-1 }
- { \bool_set_true:N \l_siunitx_omit_unit_space_bool }
- }
- }
\int_while_do:nNnn { \l_siunitx_unit_int } > { 0 }
{
\siunitx_unit_format_prefix:
@@ -4169,17 +4531,37 @@
\prop_if_in:NVF \l_siunitx_unit_prop \l_siunitx_tmpa_tl
{
\siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_unit_separator_tl
+ \l_siunitx_unit_product_tl
}
}
{
\siunitx_tl_put_right_math:NV \l_siunitx_unit_current_tl
- \l_siunitx_unit_separator_tl
+ \l_siunitx_unit_product_tl
}
}
- \tl_put_left:cV { l_siunitx_unit #1 _tl } \l_siunitx_unit_current_tl
+ \tl_set:Nx \l_siunitx_tmpa_tl
+ { special- \int_use:N \l_siunitx_unit_int }
+ \prop_get:NVN \l_siunitx_unit_prop \l_siunitx_tmpa_tl
+ \l_siunitx_tmpa_tl
+ \quark_if_no_value:NTF \l_siunitx_tmpa_tl
+ {
+ \tl_put_left:cV { l_siunitx_unit #1 _tl }
+ \l_siunitx_unit_current_tl
+ }
+ {
+ \tl_put_left:cx { l_siunitx_unit #1 _tl }
+ {
+ \exp_not:V \l_siunitx_tmpa_tl
+ { \exp_not:V \l_siunitx_unit_current_tl }
+ }
+ }
}
\cs_new_protected_nopar:Npn \siunitx_unit_format_fraction: {
+ \int_compare:nNnT { \l_siunitx_unit_numerator_int } = { 0 }
+ {
+ \str_if_eq:VnT \l_siunitx_per_mode_tl { symbol }
+ { \bool_set_true:N \l_siunitx_omit_unit_space_bool }
+ }
\int_compare:nNnTF { \l_siunitx_unit_denominator_int } > { 0 }
{
\bool_if:NTF \l_siunitx_per_auto_bool
@@ -4288,7 +4670,7 @@
\tl_set:Nx \l_siunitx_tmpa_tl
{
\exp_not:N \siunitx_ensuremath:n
- { \exp_not:V \l_siunitx_unit_separator_tl }
+ { \exp_not:V \l_siunitx_unit_product_tl }
}
\tl_replace_all_in:NnV \l_siunitx_unit_tl { . }
\l_siunitx_tmpa_tl
@@ -4364,7 +4746,7 @@
\siunitx_unit_format_power_brackets:
\tl_put_right:Nx \l_siunitx_unit_current_tl
{
- ^
+ \exp_not:N \PrintSuperscript
{
\siunitx_unit_format_power_aux:n
{ \exp_not:V \l_siunitx_tmpa_tl }
@@ -4528,28 +4910,21 @@
\prop_put:NVn \l_siunitx_unit_prop \l_siunitx_tmpa_tl { true }
}
\char_make_space:N \~
-\group_begin:
- \char_set_lccode:nn { `\@ } { `\_ }
- \char_make_math_subscript:N \@
-\tl_to_lowercase:n {
- \group_end:
- \cs_set_protected_nopar:Npn \siunitx_unit_format_qualifier_subscript:
- {
- \tl_put_right:Nx \l_siunitx_unit_current_tl
- { @ { \exp_not:V \l_siunitx_tmpa_tl } }
- }
+\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_subscript: {
+ \tl_put_right:Nx \l_siunitx_unit_current_tl
+ { \exp_not:N \PrintSubscript { \exp_not:V \l_siunitx_tmpa_tl } }
}
\cs_new_protected_nopar:Npn \siunitx_unit_format_qualifier_text: {
\tl_put_right:NV \l_siunitx_unit_current_tl \l_siunitx_tmpa_tl
}
\cs_new_protected_nopar:Npn \siunitx_unit_format_sorted: {
\tl_set_eq:NN \l_siunitx_unit_tl \l_siunitx_unit_numerator_tl
- \tl_if_empty:NF \l_siunitx_unit_tl
+ \tl_if_empty:NTF \l_siunitx_unit_tl
{
\tl_if_empty:NF \l_siunitx_unit_denominator_tl
{
\siunitx_tl_put_right_math:NV \l_siunitx_unit_tl
- \l_siunitx_unit_separator_tl
+ \l_siunitx_unit_product_tl
}
}
\tl_put_right:NV \l_siunitx_unit_tl \l_siunitx_unit_denominator_tl
@@ -4605,8 +4980,10 @@
\bool_set_false:N \l_siunitx_multi_brackets_bool
\bool_set_false:N \l_siunitx_multi_repeat_bool
},
+ number-unit-product .tl_set:N =
+ \l_siunitx_number_unit_product_tl,
number-unit-separator .tl_set:N =
- \l_siunitx_number_unit_separator_tl,
+ \l_siunitx_number_unit_product_tl,
product-units .choice:,
product-units
/ brackets .code:n =
@@ -4645,9 +5022,9 @@
},
}
\keys_set:nn { siunitx } {
- multi-part-units = brackets,
- number-unit-separator = \,,
- product-units = repeat,
+ multi-part-units = brackets,
+ number-unit-product = \,,
+ product-units = repeat,
}
\cs_new_protected:Npn \siunitx_unit_output:nn #1#2 {
\cs_set_eq:NN \siunitx_unit_format_symbol_aux:
@@ -4655,12 +5032,20 @@
\cs_set_eq:NN \siunitx_unit_format_fraction_symbol_aux_ii:
\siunitx_unit_format_fraction_symbol_aux_alt:
\siunitx_unit_in:nn {#1} {#2}
- \int_compare:nNnF { \l_siunitx_unit_prefix_int } = { 0 }
+ \int_compare:nNnTF { \l_siunitx_unit_prefix_int } = { 0 }
+ {
+ \str_if_eq:VnT \l_siunitx_per_mode_tl { symbol }
+ {
+ \int_compare:nNnT { \l_siunitx_unit_numerator_int } = { 0 }
+ { \siunitx_print:nn { unit } { 1 } }
+ }
+ }
{
\tl_set:Nx \l_siunitx_tmpa_tl
{
\int_use:N \l_siunitx_unit_prefix_base_int
- ^ { \int_use:N \l_siunitx_unit_prefix_int }
+ \exp_not:N \PrintSuperscript
+ { \int_use:N \l_siunitx_unit_prefix_int }
}
\siunitx_print:nV { number } \l_siunitx_tmpa_tl
\siunitx_unit_output_number_sep:
@@ -4678,7 +5063,7 @@
\ensuremath
{
\tex_mathchoice:D
- { \l_siunitx_number_unit_separator_tl }
+ { \l_siunitx_number_unit_product_tl }
{ \siunitx_unit_output_number_sep_aux: }
{ \siunitx_unit_output_number_sep_aux: }
{ \siunitx_unit_output_number_sep_aux: }
@@ -4690,7 +5075,7 @@
}
\cs_new_protected_nopar:Npn \siunitx_unit_output_number_sep_aux: {
\bool_if:NF \l_siunitx_omit_unit_space_bool
- { \siunitx_ensuremath:n { \l_siunitx_number_unit_separator_tl } }
+ { \siunitx_ensuremath:n { \l_siunitx_number_unit_product_tl } }
}
\cs_new_protected_nopar:Npn \siunitx_unit_output_pre_print: {
\tl_if_empty:NF \l_siunitx_pre_unit_tl
@@ -4724,6 +5109,9 @@
\siunitx_print:nV { unit } \l_siunitx_unit_tl
}
}
+\keys_define:nn { siunitx } {
+ preunit .tl_set:N = \l_siunitx_preunit_tl ,
+}
\tl_new:N \l_siunitx_pre_unit_tl
\int_new:N \l_siunitx_number_product_int
\cs_new_protected:Npn \siunitx_combined:nnnn #1#2#3#4 {
@@ -5118,7 +5506,7 @@
{ \cs_set_eq:NN \siunitx_table_collect_next: ##1 }
}
\tl_map_function:nN
- { \cs:w \end \endtabular \scan_stop: \siunitx_table_print: }
+ { \cs:w \end \scan_stop: \siunitx_table_print: }
\siunitx_table_collect_not_braced_aux_ii:N
\token_if_eq_meaning:NNT \siunitx_table_collect_next:
\siunitx_table_collect_get:
@@ -5150,22 +5538,20 @@
}
\skip_new:N \c_siunitx_one_fill_skip
\skip_set:Nn \c_siunitx_one_fill_skip { \c_zero_skip plus 1 fill }
-\skip_new:N \c_siunitx_table_correction_skip
\AtBeginDocument {
\@ifpackageloaded { colortbl }
{
- \skip_set:Nn \c_siunitx_table_correction_skip
- { \c_zero_skip plus -0.5 fill }
+ \cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction:
+ {
+ \skip_horizontal:n { \c_zero_skip plus -0.5 fill }
+ \tex_kern:D \c_zero_skip
+ }
}
{
- \skip_set:Nn \c_siunitx_table_correction_skip
- { \c_zero_skip }
+ \cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction:
+ { }
}
}
-\cs_new_protected_nopar:Npn \siunitx_table_colortbl_correction: {
- \skip_horizontal:n { \c_siunitx_table_correction_skip }
- \tex_kern:D \c_zero_skip
-}
\cs_new_protected_nopar:Npn \siunitx_table_align_left:n #1 {
\siunitx_table_colortbl_correction:
\skip_horizontal:n {#1}
@@ -5176,6 +5562,37 @@
\tex_kern:D \c_zero_skip
\siunitx_table_colortbl_correction:
}
+\cs_new_eq:NN \siunitx_table_column_begin:n \siunitx_table_align_left:n
+\cs_new_eq:NN \siunitx_table_column_end:n \siunitx_table_align_right:n
+\keys_define:nn { siunitx } {
+ table-column-width .code:n =
+ {
+ \dim_compare:nNnTF {#1} = { \c_zero_dim }
+ {
+ \cs_new_eq:NN \siunitx_table_column_begin:n
+ \siunitx_table_align_left:n
+ \cs_new_eq:NN \siunitx_table_column_end:n
+ \siunitx_table_align_right:n
+ }
+ {
+ \cs_set_protected_nopar:Npn \siunitx_table_column_begin:n ##1
+ {
+ \siunitx_table_colortbl_correction:
+ \tex_hbox:D to \dim_eval:n {#1}
+ \c_group_begin_token
+ \skip_horizontal:n {##1}
+ \tex_kern:D \c_zero_skip
+ }
+ \cs_set_protected_nopar:Npn \siunitx_table_column_end:n ##1
+ {
+ \skip_horizontal:n { \c_siunitx_one_fill_skip - ##1 }
+ \tex_kern:D \c_zero_skip
+ \hbox_set_inline_end:
+ \siunitx_table_colortbl_correction:
+ }
+ }
+ }
+}
\skip_new:N \l_siunitx_table_unit_align_skip
\keys_define:nn { siunitx } {
table-unit-alignment .choice:,
@@ -5199,9 +5616,9 @@
table-unit-alignment = center
}
\cs_new_protected_nopar:Npn \siunitx_table_print_s: {
- \siunitx_table_align_left:n { \l_siunitx_table_unit_align_skip }
- \siunitx_unit_output:Vn \l_siunitx_table_collect_tl { }
- \siunitx_table_align_right:n { \l_siunitx_table_unit_align_skip }
+ \siunitx_table_column_begin:n { \l_siunitx_table_unit_align_skip }
+ \siunitx_unit_output:Vn \l_siunitx_table_collect_tl { }
+ \siunitx_table_column_end:n { \l_siunitx_table_unit_align_skip }
}
\bool_new:N \l_siunitx_table_center_decimal_bool
\box_new:N \l_siunitx_table_fill_box
@@ -5223,6 +5640,8 @@
\skip_new:N \l_siunitx_table_number_align_skip
\skip_new:N \l_siunitx_table_text_align_skip
\keys_define:nn { siunitx } {
+ table-align-comparator .bool_set:N
+ = \l_siunitx_table_align_comparator_bool,
table-align-exponent .bool_set:N
= \l_siunitx_table_align_exp_bool,
table-align-text-post .bool_set:N
@@ -5298,6 +5717,7 @@
\l_siunitx_table_sign_mantissa_bool
}
\keys_set:nn { siunitx } {
+ table-align-comparator = true,
table-align-exponent = true,
table-align-text-post = true,
table-align-uncertainty = true,
@@ -5348,20 +5768,20 @@
\cs_new_protected_nopar:Npn \siunitx_table_print_S: {
\bool_if:NTF \l_siunitx_table_collect_pre_bool
{
- \siunitx_table_align_left:n { \l_siunitx_table_text_align_skip }
- \tl_use:N \l_siunitx_table_collect_pre_tl
- \siunitx_table_align_right:n
+ \siunitx_table_column_begin:n
+ { \l_siunitx_table_text_align_skip }
+ \tl_use:N \l_siunitx_table_collect_pre_tl
+ \siunitx_table_column_end:n
{ \l_siunitx_table_text_align_skip }
}
{
- \siunitx_table_align_left:n
+ \siunitx_table_column_begin:n
{ \l_siunitx_table_number_align_skip }
- \siunitx_table_print_S_aux:
- \siunitx_table_align_right:n
+ \siunitx_table_print_S_aux:
+ \siunitx_table_column_end:n
{ \l_siunitx_table_number_align_skip }
}
}
-
\cs_new_protected_nopar:Npn \siunitx_table_print_S_aux: {
\bool_if:NTF \l_siunitx_table_parse_only_bool
{
@@ -5507,7 +5927,10 @@
}
\siunitx_table_print_S_parse:
\bool_if:NTF \l_siunitx_table_comparator_bool
- { \siunitx_table_print_S_reserved_comparator: }
+ {
+ \bool_if:NT \l_siunitx_table_align_comparator_bool
+ { \siunitx_table_print_S_reserved_comparator: }
+ }
{
\prop_if_in:NnT \l_siunitx_number_out_prop { comparator }
{
@@ -5676,10 +6099,19 @@
}
\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_mantissa_aux:n #1 {
- \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
- { integer } {#1}
- \siunitx_table_print_S_get_integer:Nn
- \l_siunitx_number_out_prop {#1}
+ \bool_if:NTF \l_siunitx_table_align_comparator_bool
+ {
+ \siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
+ { integer } {#1}
+ \siunitx_table_print_S_get_integer:Nn
+ \l_siunitx_number_out_prop {#1}
+ }
+ {
+ \siunitx_table_print_S_measure_comparator_integer:N
+ \l_siunitx_table_model_prop
+ \siunitx_table_print_S_measure_comparator_integer_get:N
+ \l_siunitx_number_out_prop
+ }
\box_clear:N \l_siunitx_tmp_box
\tl_if_empty:NF \l_siunitx_tmpa_tl
{
@@ -5755,14 +6187,18 @@
\hbox_set_to_wd:Nnn \l_siunitx_table_result_box
{ \box_wd:N \l_siunitx_table_result_box } { \tex_hfil:D }
}
-
\bool_if:NF \l_siunitx_table_align_uncert_bool
{ \tex_hskip:D -\l_siunitx_table_space_dim }
\box_use:N \l_siunitx_table_result_box
}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_reserved_exponent: {
\dim_zero:N \l_siunitx_table_gap_dim
- \siunitx_table_print_S_reserved_exponent_product:
+ \tl_if_empty:NTF \l_siunitx_output_exponent_tl
+ { \siunitx_table_print_S_reserved_exponent_product: }
+ {
+ \bool_if:NF \l_siunitx_table_align_exp_bool
+ { \tex_hskip:D -\l_siunitx_table_space_dim }
+ }
\siunitx_table_print_S_measure:Nnn \l_siunitx_table_model_prop
{ exponent } { }
\siunitx_table_print_S_get_exponent:Nn
@@ -5817,7 +6253,6 @@
}
}
{ \siunitx_table_print_S_reserved_exponent_product_aux_ii: }
-
}
\cs_new_protected_nopar:Npn
\siunitx_table_print_S_reserved_exponent_product_aux_ii: {
@@ -5868,6 +6303,12 @@
\prop_get:NnN #1 { mantissa } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
{ \tl_clear:N \l_siunitx_tmpa_tl }
+ \bool_if:NF \l_siunitx_table_align_comparator_bool
+ {
+ \prop_get:NnN #1 { comparator } \l_siunitx_tmpb_tl
+ \quark_if_no_value:NF \l_siunitx_tmpb_tl
+ { \tl_put_left:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl }
+ }
}
\cs_new_protected_nopar:Npn \siunitx_table_print_S_get_marker:Nn #1#2 {
\tl_set:Nx \l_siunitx_tmpa_tl
@@ -5889,6 +6330,19 @@
\cs_new_protected_nopar:Npn
\siunitx_table_print_S_measure_comparator_integer:N #1
{
+ \siunitx_table_print_S_measure_comparator_integer_get:N #1
+ \tl_if_empty:NTF \l_siunitx_tmpa_tl
+ { \dim_set:Nn \l_siunitx_table_integer_dim { \c_zero_skip } }
+ {
+ \hbox_set:Nn \l_siunitx_tmp_box
+ { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
+ \dim_set:Nn \l_siunitx_table_integer_dim
+ { \box_wd:N \l_siunitx_tmp_box }
+ }
+ }
+\cs_new_protected_nopar:Npn
+ \siunitx_table_print_S_measure_comparator_integer_get:N #1
+ {
\prop_get:NnN #1 { comparator } \l_siunitx_tmpa_tl
\quark_if_no_value:NT \l_siunitx_tmpa_tl
{ \tl_clear:N \l_siunitx_tmpa_tl }
@@ -5899,14 +6353,6 @@
\quark_if_no_value:NT \l_siunitx_tmpb_tl
{ \tl_clear:N \l_siunitx_tmpb_tl }
\tl_put_right:NV \l_siunitx_tmpa_tl \l_siunitx_tmpb_tl
- \tl_if_empty:NTF \l_siunitx_tmpa_tl
- { \dim_set:Nn \l_siunitx_table_integer_dim { \c_zero_skip } }
- {
- \hbox_set:Nn \l_siunitx_tmp_box
- { \siunitx_print:nV { number } \l_siunitx_tmpa_tl }
- \dim_set:Nn \l_siunitx_table_integer_dim
- { \box_wd:N \l_siunitx_tmp_box }
- }
}
\cs_new_protected_nopar:Npn \siunitx_table_direct: {
\m@th
@@ -6194,7 +6640,7 @@
{ Only~one~complex~root~token~can~appear~in~a~single~number. }
\msg_set:nnnn { siunitx } { duplicate-decimal-token }
{ Duplicate~decimal~marker~token~'#1'~in~input. }
- { Only one decimal marker token can appear in a single number. }
+ { Only~one~decimal~marker~token~can~appear~in~a~single~number. }
\msg_set:nnnn { siunitx } { duplicate-exponent-token }
{ Duplicate~exponent~marker~token~'#1'~in~input. }
{ Only~one~exponent~marker~token~can~appear~in~a~single~number. }
@@ -6336,25 +6782,25 @@
\token_to_str:N { siunitx \token_to_str:N } \\
in~the~preamble~to~load~the~appropriate~code.
}
-\cs_new_protected_nopar:Npn \DeclareBinaryPrefix #1#2#3 {
+\NewDocumentCommand \DeclareBinaryPrefix { m m m } {
\siunitx_declare_prefix:Nnnn #1 {#2} { 2 } {#3}
}
-\cs_new_protected_nopar:Npn \DeclareSIPostPower #1#2 {
+\NewDocumentCommand \DeclareSIPostPower { m m } {
\siunitx_declare_power_after:Nn #1 {#2}
}
-\cs_new_protected_nopar:Npn \DeclareSIPrefix #1#2#3 {
+\NewDocumentCommand \DeclareSIPrefix { m m m } {
\siunitx_declare_prefix:Nnnn #1 {#2} { 10 } {#3}
}
-\cs_new_protected_nopar:Npn \DeclareSIPrePower #1#2 {
+\NewDocumentCommand \DeclareSIPrePower { m m } {
\siunitx_declare_power_before:Nn #1 {#2}
}
-\cs_new_protected_nopar:Npn \DeclareSIQualifier #1#2 {
+\NewDocumentCommand \DeclareSIQualifier { m m } {
\siunitx_declare_qualifier:Nn #1 {#2}
}
-\cs_new_protected_nopar:Npn \DeclareSIUnit #1#2 {
- \siunitx_declare_unit:Nnn #1 {#2} { }
+\NewDocumentCommand \DeclareSIUnit { O { } m m } {
+ \siunitx_declare_unit:Nnn #2 {#3} {#1}
}
-\cs_new_protected_nopar:Npn \DeclareSIUnitWithOptions #1#2#3 {
+\NewDocumentCommand \DeclareSIUnitWithOptions { m m m } {
\siunitx_declare_unit:Nnn #1 {#2} {#3}
}
\@onlypreamble \DeclareBinaryPrefix
@@ -6393,16 +6839,6 @@
\siunitx_range_numbers:nn {#2} {#3}
\group_end:
}
-\NewDocumentCommand \si { o m } {
- \group_begin:
- \IfNoValueTF {#1}
- { \siunitx_unit_output:nn {#2} { } }
- {
- \keys_set:nn { siunitx } {#1}
- \siunitx_unit_output:nn {#2} {#1}
- }
- \group_end:
-}
\NewDocumentCommand \SIlist { o > { \SplitList { ; } } m m } {
\group_begin:
\IfNoValueTF {#1}
@@ -6436,6 +6872,23 @@
\NewDocumentCommand \sisetup { m } {
\keys_set:nn { siunitx } {#1}
}
+\NewDocumentCommand \tablenum { o m } {
+ \IfNoValueF {#1}
+ { \keys_set:nn { siunitx } {#1} }
+ \tl_set:Nn \l_siunitx_table_collect_tl {#2}
+ \bool_set_false:N \l_siunitx_table_collect_pre_bool
+ \siunitx_table_print_S:
+}
+\NewDocumentCommand \si { o m } {
+ \group_begin:
+ \IfNoValueTF {#1}
+ { \siunitx_unit_output:nn {#2} { } }
+ {
+ \keys_set:nn { siunitx } {#1}
+ \siunitx_unit_output:nn {#2} {#1}
+ }
+ \group_end:
+}
\AtBeginDocument {
\cs_set:Npn \addtocontents #1#2
{
@@ -6463,6 +6916,7 @@
\cs_set_eq:NN \si \siunitx_bookmark_si:w
\cs_set_eq:NN \SI \siunitx_bookmark_SI:w
\cs_set_eq:NN \SIrange \siunitx_bookmark_SIrange:w
+ \cs_set_eq:NN \si \siunitx_bookmark_si:w
\cs_set_nopar:Npn \SIUnitSymbolAngstrom { \AA }
\cs_set_nopar:Npn \SIUnitSymbolArcminute { ' }
\cs_set_nopar:Npn \SIUnitSymbolArcsecond { '' }
@@ -6474,11 +6928,28 @@
\DeclareExpandableDocumentCommand \siunitx_bookmark_num:w { o m } {#2}
\DeclareExpandableDocumentCommand \siunitx_bookmark_numrange:w { o m m }
{ #2 \l_siunitx_range_phrase_tl #3 }
-\DeclareExpandableDocumentCommand \siunitx_bookmark_si:w { o m } {#2}
\DeclareExpandableDocumentCommand \siunitx_bookmark_SI:w { o m o m }
{ \IfNoValueF {#3} {#3} #2 ~ #4 }
+\DeclareExpandableDocumentCommand \siunitx_bookmark_SIlist:w
+ { o m m } { \siunitx_bookmark_SIlist_map:nn {#1} {#2} }
\DeclareExpandableDocumentCommand \siunitx_bookmark_SIrange:w
{ o m m m } { #2 ~ #4 \l_siunitx_range_phrase_tl #3 ~ #4 }
+\DeclareExpandableDocumentCommand \siunitx_bookmark_si:w { o m } {#2}
+\cs_new:Npn \siunitx_bookmark_SIlist_map:nn #1#2 {
+ \siunitx_bookmark_SIlist_map_aux:nw {#2} #1 ; \q_recursion_tail ;
+ \q_recursion_tail ; \q_recursion_stop
+}
+\cs_new:Npn \siunitx_bookmark_SIlist_map_aux:nw #1#2 ; #3 ; #4 {
+ #2 ~ #1
+ \quark_if_recursion_tail_stop:n {#3}
+ \quark_if_recursion_tail_stop_do:nn {#4}
+ {
+ \l_siunitx_list_separator_final_tl
+ #3 ~ #1
+ }
+ \l_siunitx_list_separator_tl
+ \siunitx_bookmark_SIlist_map_aux:nw {#1} #3 ; #4
+}
\AtBeginDocument {
\@ifpackageloaded { hyperref }
{ \pdfstringdefDisableCommands { \siunitx_contents_bookmarks: } }
@@ -6537,15 +7008,13 @@
\DeclareSIUnit \volt { V }
\DeclareSIUnit \watt { W }
\DeclareSIUnit \weber { Wb }
-\DeclareSIUnitWithOptions \arcmin { \arcminute }
- { number-unit-separator = }
-\DeclareSIUnitWithOptions \arcminute { \SIUnitSymbolArcminute }
- { number-unit-separator = }
-\DeclareSIUnitWithOptions \arcsecond { \SIUnitSymbolArcsecond }
- { number-unit-separator = }
+\DeclareSIUnit [ number-unit-product = ] \arcmin { \arcminute }
+\DeclareSIUnit [ number-unit-product = ]
+ \arcminute { \SIUnitSymbolArcminute }
+\DeclareSIUnit [ number-unit-product = ]
+ \arcsecond { \SIUnitSymbolArcsecond }
\DeclareSIUnit \day { d }
-\DeclareSIUnitWithOptions \degree { \SIUnitSymbolDegree }
- { number-unit-separator = }
+\DeclareSIUnit[ number-unit-product = ] \degree { \SIUnitSymbolDegree }
\DeclareSIUnit \hectare { ha }
\DeclareSIUnit \hour { h }
\DeclareSIUnit \litre { l }
@@ -6643,21 +7112,21 @@
DE .meta:n =
{
exponent-product = \cdot ,
- inter-unit-separator = { \, } ,
+ inter-unit-product = { \, } ,
output-decimal-marker = { , } ,
},
locale /
FR .meta:n =
{
exponent-product = \times ,
- inter-unit-separator = { \, } ,
+ inter-unit-product = { \, } ,
output-decimal-marker = { , } ,
},
locale /
UK .meta:n =
{
exponent-product = \times ,
- inter-unit-separator = \, ,
+ inter-unit-product = \, ,
output-decimal-marker = . ,
},
locale /
@@ -6668,7 +7137,7 @@
ZA .meta:n =
{
exponent-product = \times ,
- inter-unit-separator = \cdot ,
+ inter-unit-product = \cdot ,
output-decimal-marker = { , } ,
},
}
@@ -6721,7 +7190,6 @@
\c_siunitx_configuration_ext_tl
}
\ProcessKeysOptions { siunitx }
-%%
%% Copyright (C) 2008-2011 by
%% Joseph Wright <joseph.wright@morningstar2.co.uk>
%%
@@ -6729,9 +7197,7 @@
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
-%%
%% http://www.latex-project.org/lppl.txt
-%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Joseph Wright.
%%