summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/siunitx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-07-23 22:06:02 +0000
committerKarl Berry <karl@freefriends.org>2008-07-23 22:06:02 +0000
commit52efa785279f9f2f1f79c0836a3a67eecaa4ed16 (patch)
tree2b77920a8f55b4065d442505b36db8f5436b7965 /Master/texmf-dist/source/latex/siunitx
parent903bcd69ed64192404fac218d3366dd3d35f9d0e (diff)
siunitx 1.0g (19jul08)
git-svn-id: svn://tug.org/texlive/trunk@9733 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/siunitx')
-rw-r--r--Master/texmf-dist/source/latex/siunitx/siunitx.dtx935
1 files changed, 539 insertions, 396 deletions
diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
index 0881810daa4..ddff73b2c7a 100644
--- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
+++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
@@ -225,7 +225,7 @@ dcolumn, rccol and numprint packages.
%</driver>
% \fi
%
-%\CheckSum{9511}
+%\CheckSum{9517}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -290,7 +290,8 @@ dcolumn, rccol and numprint packages.
%\DoNotIndex{\key@ifundefined,\newrobustcmd,\protected,\scriptspace}
%\DoNotIndex{\usebox,\tw@,\ifinner,\usepackage,\texttt,\textsf}
%\DoNotIndex{\NC@do,\loop,\l@ngrel@x,\g@addto@macro,\documentclass}
-%\DoNotIndex{\document\,\begin,\=,\@ehb,\\,\listfiles}
+%\DoNotIndex{\document\,\begin,\=,\@ehb,\\,\listfiles,\nullfont}
+%\DoNotIndex{\normalsize}
%
%\DoNotIndex{\pascalsecond,\amperemetresecond,\ohmmetre}
%\DoNotIndex{\newtonmetre,\newtonmetrenp}
@@ -305,7 +306,7 @@ dcolumn, rccol and numprint packages.
% raiseto,deci,mathnormal,numprint,electronvolt,selectlanguage,
% kibi,byte,molar,Molar,mmHg,mebi,torr,parsec,lightyear,clight,
% eVperc,addplot,color,milli,cm,Hz,kg,DeclareRobustCommand,
-% pascal,dalton}}
+% pascal,dalton,addtolocale}}
%
%\title{\currpkg\ --- A comprehensive (SI) units package^^A
% \thanks{This file describes version \fileversion, last revised
@@ -389,7 +390,7 @@ dcolumn, rccol and numprint packages.
% \item \cs{ang}\oarg{options}\marg{angle}
% \item \cs{sisetup}\marg{options}
%\end{itemize}
-% plus the |S| and |S| column types for decimal alignments and units
+% plus the |S| and |s| column types for decimal alignments and units
% in tables. These macros are designed for typesetting units and
% values with control of appearance and with intelligent processing.
%
@@ -2512,7 +2513,14 @@ dcolumn, rccol and numprint packages.
%\DescribeMacro{\addtolocale}
% To allow arbitrary macros to be stored in locales, the
% \cs{addtolocale} macro is provided. This ensures that arbitrary
-% text is only executed when using a locale, not when loading it.
+% text is only executed when using a locale, not when loading it. The
+% macro takes two arguments, \marg{locale} and \marg{code}.
+%\begin{LaTeXexample}
+% \addtolocale{DE}{TEST}
+% Some text as filler \\
+% \sisetup{locale=DE}
+% This example is rather trivial!
+%\end{LaTeXexample}
%
%\DescribeMacro{\requiresiconfigs}
% To load one or more configuration files from inside another
@@ -3170,11 +3178,11 @@ author.
% number, of course.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\newcommand*{\si@svn@ver}{v1.0f}
+\newcommand*{\si@svn@ver}{v1.0g}
\def\si@svn@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${%
\newcommand*{\si@svn@version}{%
#5/#6/#7\space\si@svn@ver\space}}
-\si@svn@id $Id: siunitx.dtx 106 2008-07-17 10:38:08Z joseph $
+\si@svn@id $Id: siunitx.dtx 113 2008-07-19 05:41:59Z joseph $
\ProvidesPackage{siunitx}
[\si@svn@version A comprehensive (SI) units package]
% \end{macrocode}
@@ -3268,6 +3276,12 @@ author.
%\end{macro}
%\end{macro}
%\end{macro}
+%\begin{macro}{\si@temptoks}
+% A token register is also handy.
+% \begin{macrocode}
+\newtoks{\si@temptoks}
+% \end{macrocode}
+%\end{macro}
%\begin{macro}{\si@packagecheck}
%\begin{macro}{\si@blockpkgs}
%\begin{macro}{\si@checkpkgs}
@@ -3317,11 +3331,11 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@ifdefinable}
+%\darg{macro}
% Using \cs{@ifdefinable} to check macro definitions gives a generic
% error. To give something more helpful, \cs{@ifundefined} is used,
% but this needs some \cs{expandafter} work. This way it can also be
-% used as a form of \cs{@ifundefined} for macro names.\\
-%\cs{si@ifdefinable}\marg{macro}
+% used as a form of \cs{@ifundefined} for macro names.
% \begin{macrocode}
\newcommand*{\si@ifdefinable}[1]{%
\expandafter\expandafter\expandafter\@ifundefined%
@@ -3330,9 +3344,10 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@addtolist}
-% It is quite useful to be able to add to a comma-separated list
-% of expandable items.\\
-%\cs{si@addtolist}\marg{macro}\marg{items}
+%\darg{macro}
+%\darg{items}
+% It is quite useful to be able to add to a comma-separated list of
+% expandable items.
% \begin{macrocode}
\newcommand*{\si@addtolist}[2]{%
\ifx\@empty#1\@empty
@@ -3343,11 +3358,10 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@addtocsname}
-%\begin{macro}{\si@temptoks}
-% A second item to add to a command sequence.\\
-%\cs{si@addtocsname}\marg{csname}\marg{tokens}
+%\darg{csname}
+%\darg{tokens}
+% A second item to add to a command sequence.
% \begin{macrocode}
-\newtoks{\si@temptoks}
\newcommand*{\si@addtocsname}[2]{%
\@ifundefined{#1}
{\expandafter\gdef\csname #1\endcsname{#2}}
@@ -3356,7 +3370,6 @@ author.
\expandafter\xdef\csname #1\endcsname{\the\si@temptoks}}}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%\begin{macro}{\si@ifmtarg}
%\begin{macro}{\si@xifmtarg}
%\begin{macro}{\si@ifnotmtarg}
@@ -3379,6 +3392,10 @@ author.
%\begin{macro}{\si@newcommand}
%\begin{macro}{\si@newcmd}
%\begin{macro}{\si@xargdef}
+%\darg{macro}
+%\doarg{num-args}
+%\doarg{default}
+%\darg{def}
% Some more copying, this time from \pkg{etoolbox}. Various macros
% need to be \emph{really} robust. This is achieved using the \eTeX\
% \cs{protected} primitive in various places. However, it would be
@@ -3386,10 +3403,7 @@ author.
% \pkg{etoolbox} has code for that, but to avoid needing to load it,
% the necessary stuff is copied here. The only changes form the
% original are names, and the use of \cs{newcommand*} for the
-% \cs{si@newcommand} macro.\\
-%\cs{si@newcommand}\marg{macro}\\
-%\cs{si@newcmd}\marg{macro}\oarg{num-args}\\
-%\cs{si@xargdef}\marg{macro}\oarg{num-args}\oarg{default}\marg{def}
+% \cs{si@newcommand} macro.
% \begin{macrocode}
\@ifpackageloaded{etoolbox}
{\let\si@newrobustcmd\newrobustcmd}
@@ -3432,15 +3446,11 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@log@err}
-%\begin{macro}{\si@log@warn}
-%\begin{macro}{\si@log@inf}
+%\darg{error}
+%\darg{explanation}
% Some handy re-usable macros are defined here. These all take names
-% beginning These pop up in various places. First errors, warnings
-% and information are handled. Package options are used to control
-% how much output is given.\\
-%\cs{si@log@err}\marg{error}\marg{explanation}\\
-%\cs{si@log@warn}\marg{warning}\\
-%\cs{si@log@inf}\marg{information}
+% beginning These pop up in various places. First errors are
+% handled.
% \begin{macrocode}
\newcommand*{\si@log@err}[2]{%
\ifsi@lognone\else
@@ -3450,6 +3460,13 @@ author.
\PackageError{siunitx}{#1}{#2}%
\fi
\fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@log@warn}
+%\begin{macro}{\si@log@inf}
+%\darg{text}
+% Then warnings and information.
+% \begin{macrocode}
\newcommand*{\si@log@warn}[1]{%
\ifsi@lognone\else
\ifsi@logmin\else
@@ -3464,10 +3481,11 @@ author.
\fi}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%\begin{macro}{\si@log@debug}
+%\darg{debug-info}
% The debug macro only gives output if the appropriate package option
-% is set.\\
-%\cs{si@log@debug}\marg{debug-information}
+% is set.
% \begin{macrocode}
\newcommand*{\si@log@debug}[1]{%
\ifsi@lognone\else
@@ -3477,20 +3495,18 @@ author.
\fi}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\subsection{String comparison}
%\begin{macro}{\si@str@ifchrstr}
%\begin{macro}{\si@str@chrstr}
+%\darg{char}
+%\darg{string}
% At various points, the package needs to compare two strings, to
% find if one occurs in the other. The first test is if a single
% character is part of a second string; this is used, for example, to
% check that a character is valid as input. The first argument is
% not expanded further, but the second is two allow division into
-% individual units.\\
-%\cs{si@str@ifchrstr}\marg{char}\marg{chars}\\
-%\cs{si@str@chrstr}\meta{char}\meta{chars}\cs{@empty}
+% individual units.
% \begin{macrocode}
\newcommand*{\si@str@ifchrstr}[2]{%
\begingroup
@@ -3518,13 +3534,13 @@ author.
%\end{macro}
%\begin{macro}{\si@str@ifonlychrs}
%\begin{macro}{\si@str@onlychrs}
+%\darg{string}
+%\darg{chars}
% The second test builds on the first. Here, a check is made to see
% if the first string is made up only of characters from the second
% string. In this case, the first string is expanded before
% testing. The second string will be expanded by the internal
-% character by character test.\\
-%\cs{si@str@ifonlychars}\marg{string}\marg{valid-chars}\\
-%\cs{si@str@onlychars}\meta{char}\meta{chars}\cs{@empty}
+% character by character test.
% \begin{macrocode}
\newcommand*{\si@str@ifonlychrs}[2]{%
\begingroup
@@ -3550,6 +3566,7 @@ author.
%
%\subsection{Option handling}
%\begin{macro}{\sisetup}
+%\darg{options}
% To allow modification of options at run time, a setup macro is
% provided.
% \begin{macrocode}
@@ -3557,10 +3574,11 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@opt@key}
+%\darg{keyname}
+%\darg{code}
% To aid maintenance, some shortcuts are defined for generating keys.
% These also allow the debugging messages to be added automatically
-% to every key. First of all the basic key definition.\\
-%\cs{si@opt@key}\marg{keyname}\marg{code}
+% to every key. First of all the basic key definition.
% \begin{macrocode}
\newcommand*{\si@opt@key}[2]{%
\define@key[si]{key}{#1}
@@ -3568,22 +3586,29 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@opt@cmdkey}
-%\begin{macro}{\si@opt@cmdkeys}
-% The command versions of the above.\\
-%\cs{si@opt@cmdkey}\oarg{default}\marg{keyname}\marg{function}\\
-%\cs{si@opt@cmdkeys}\oarg{default}\marg{keynames}
+%\doarg{default}
+%\darg{keyname}
+%\darg{function}
+% For a single command key, a function must be specified.
% \begin{macrocode}
\newcommand*{\si@opt@cmdkey}[3][]{%
\define@cmdkey[si]{key}[si@]{#2}[#1]{#3}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@opt@cmdkeys}
+%\doarg{default}
+%\darg{keyname}
+% Whereas multiple definitions do not take a function.
+% \begin{macrocode}
\newcommand*{\si@opt@cmdkeys}[2][]{%
\define@cmdkeys[si]{key}[si@]{#2}[#1]}
% \end{macrocode}
%\end{macro}
-%\end{macro}
%\begin{macro}{\si@opt@boolkey}
+%\doarg{function}
+%\darg{keyname}
% Keys which only take switch values; anything other than \opt{true}
-% or \opt{false} will generate a warning from \pkg{xkeyval}.\\
-%\cs{si@opt@boolkey}\oarg{optional-processing}\marg{keyname}
+% or \opt{false} will generate a warning from \pkg{xkeyval}.
% \begin{macrocode}
\newcommand*{\si@opt@boolkey}[2][]{%
\define@boolkey[si]{key}[si@]{#2}[true]
@@ -3591,11 +3616,13 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@opt@choicekey}
+%\doarg{default}
+%\darg{keyname}
+%\darg{choices}
+%\darg{function}
% A ``fill in the blanks'' choice key. In all cases, \cs{si@tempa}
% is used to hold the value given to the key, so that \cs{ifx}
-% testing can occur.\\
-%\cs{si@opt@choicekey}\oarg{default}\marg{keyname}\marg{choices}^^A
-%\marg{in-list}
+% testing can occur.
% \begin{macrocode}
\newcommand*{\si@opt@choicekey}[4][]{%
\define@choicekey*+[si]{key}{#2}[\si@tempa]{#3}[#1]
@@ -3604,13 +3631,15 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@opt@xchoicekey}
+%\darg{keyname}
+%\darg{choices}
+%\darg{initial-value}
% Several of the package options can take either a choice from a list
% of known options, or a value to be interpreted literally. To aid
% maintenance, the necessary code can be set up here. These keys all
% define a new macro, which must exist. The \cs{si@opt@xchoicekey}
% macro therefore ensures that this is defined, as well as setting up
-% the \pkg{xkeyval} key.\\
-%\cs{si@opt@xchoicekey}\marg{keyname}\marg{choices}\marg{initial}
+% the \pkg{xkeyval} key.
% \begin{macrocode}
\newcommand*{\si@opt@xchoicekey}[3]{%
\define@choicekey*+[si]{key}{#1}[\si@tempa]{#2}[#1]
@@ -3637,11 +3666,12 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@opt@compatkey}
+%\darg{package}
+%\darg{keyname}
% An all-in-one definition for a back-compatibility key. These
% should only be used at load time, so are automatically disabled
% once the package is loaded. Emulation is also automatically turned
-% on.\\
-%\cs{si@opt@compatkey}\marg{package}\marg{keyname}.
+% on.
% \begin{macrocode}
\newcommand*{\si@opt@compatkey}[2]{%
\define@boolkey[si]{key}[si@old@]{#2}[true]
@@ -3654,9 +3684,10 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@opt@disablekey}
+%\darg{keyname}
+%\darg{text}
% The ability to disable a key with a meaningful message is a must;
-% the warning will come from \currpkg, and not from \pkg{xkeyval}\\
-%\cs{si@opt@disablekey}\marg{keyname}\marg{warning}
+% the warning will come from \currpkg, and not from \pkg{xkeyval}.
% \begin{macrocode}
\newcommand*{\si@opt@disablekey}[2]{%
\key@ifundefined[si]{key}{#1}
@@ -4408,9 +4439,9 @@ author.
\let\mp\si@num@mp}
% \end{macrocode}
%\begin{macro}{\si@opt@proctform}
+%\darg{either \texttt{mant} or \texttt{exp}}
% Processing the number further uses the \cs{si@num@digits} macro.
-% The results are stored in the appropriate counter.\\
-%\cs{si@opt@proctform}\marg{mant/exp}
+% The results are stored in the appropriate counter.
% \begin{macrocode}
\newcommand*{\si@opt@proctform}[1]{%
\renewcommand*{\si@num@predec}{}%
@@ -5270,8 +5301,9 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@frc@mathsnf}
-% The maths mode system.\\
-%\cs{si@frc@mathsnf}\marg{numerator}\marg{denominator}
+%\darg{numerator}
+%\darg{denominator}
+% The maths mode system.
% \begin{macrocode}
\newcommand*{\si@frc@mathsnf}[2]{%
\begingroup
@@ -5308,8 +5340,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@frc@textnf}
-% A stripped down version of the \pkg{nicefrac} system for text mode.\\
-%\cs{si@frc@textnf}\marg{numerator}\marg{denominator}
+%\darg{numerator}
+%\darg{denominator}
+% A stripped down version of the \pkg{nicefrac} system for text mode.
% \begin{macrocode}
\newcommand*{\si@frc@textnf}[2]{%
\begingroup
@@ -5325,9 +5358,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@frc@ugly}
+%\darg{numerator}
% The \cs{si@frc@ugly} macro is needed to emulate the \opt{ugly}
-% option in \units, where output depends on the current mode.\\
-%\cs{si@frc@ugly}\marg{numerator}
+% option in \units, where output depends on the current mode.
% \begin{macrocode}
\newcommand*{\si@frc@ugly}[1]{%
\renewcommand*{\si@tempa}{#1}%
@@ -5384,9 +5417,8 @@ author.
%\end{macro}
%\begin{macro}{\si@fam@ifbtext}
%\begin{macro}{\si@fam@ifbmaths}
-% These tests check for bold in text and maths mode, respectively.\\
-%\cs{si@fam@ifbtext}\marg{code}\\
-%\cs{si@fam@ifbmaths}\marg{code}
+%\darg{code}
+% These tests check for bold in text and maths mode, respectively.
% \begin{macrocode}
\newcommand*{\si@fam@ifbtext}[1]{%
\if b\expandafter\@car\f@series\@nil
@@ -5411,9 +5443,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@fam@ifitext}
+%\darg{code}
% This test check for italic or slanted text in text mode, by
-% negation (upright text is |n|).\\
-%\cs{si@fam@ifitext}\marg{code}
+% negation (upright text is |n|).
% \begin{macrocode}
\newcommand*{\si@fam@ifitext}[1]{%
\if n\expandafter\@car\f@series\@nil\else
@@ -5674,14 +5706,15 @@ author.
%
%\subsection{Formatting numbers}
%\begin{macro}{\num}
+%\doarg{keyval options}
+%\darg{number}
% The system used here is modelled on that in \numprint; the
% input is broken down into single tokens, each one is examined and
% the result is re-assembled into an output number. However, various
% changes have been made to the system used, and so the macros here
% are not simply renamed copies of those in \numprint. The user
% macro \cs{num} sets any local keys, then calls the number
-% formatting macro on the processed number.\\
-%\cs{num}\oarg{options}\marg{num}
+% formatting macro on the processed number.
% \begin{macrocode}
\si@newrobustcmd*{\num}[2][]{%
\begingroup
@@ -5700,14 +5733,14 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@num}
+%\darg{number}
% This is the main processing macro. Unlike the related macro in
% \numprint, the output of this macro is not subjected to any font
% changes. That is left to one of the \cs{si@out@\ldots} macros. No
% grouping is applied here; any call to \cs{si@num} (or any of the
% sub-macros) must be within a group as the definitions used rely on
% this. Grouping is not applied here so that other macros can get
-% the various separated parts of the input.\\
-%\cs{si@num}\marg{num}
+% the various separated parts of the input.
% \begin{macrocode}
\newcommand*{\si@num}[1]{%
% \end{macrocode}
@@ -5774,12 +5807,11 @@ author.
%\end{macro}
%\begin{macro}{\si@num@ifvalid}
%\begin{macro}{\si@num@valid}
+%\darg{chars}
% Assuming that there is a non-space argument to \cs{si@num}, every
% character is checked to ensure it is valid in the context, so that
% further processing can occur without sanity checks. If the
-% character is valid, recursion occurs.\\
-%\cs{si@num@ifvalid}\marg{chars}\\
-%\cs{si@num@valid}\meta{char}\meta{chars}\cs{@empty}
+% character is valid, recursion occurs.
% \begin{macrocode}
\newcommand*{\si@num@ifvalid}[1]{%
\begingroup
@@ -5844,10 +5876,10 @@ author.
%\end{macro}
%\begin{macro}{\si@num@format}
%\begin{macro}{\si@num@arg}
+%\darg{number}
% The number processor starts by saving |#1| (odd things happen
% otherwise). A hook is also provided to allow modifications by
-% other macros.\\
-%\cs{si@num@format}\marg{num}
+% other macros.
% \begin{macrocode}
\newcommand*{\si@num@arg}{}
\newcommand*{\si@num@format}[1]{%
@@ -6103,15 +6135,14 @@ author.
%\end{macro}
%\begin{macro}{\si@num@sepmantexp}
%\begin{macro}{\si@num@mantexp}
+%\darg{number}
% Splitting the mantissa and exponent first checks for characters to
% gobble, which are simply thrown away. For any other input, there
% are two possibilities. If the character is an exponent marker,
% then the package switches from collecting the mantissa to
% collecting the exponent (after a sanity check). All other
% characters are added to either the mantissa or the exponent, as
-% appropriate.\\
-%\cs{si@num@sepmantexp}\marg{num}\\
-%\cs{si@num@mantexp}\meta{char}\meta{chars}\cs{@empty}
+% appropriate.
% \begin{macrocode}
\newcommand*{\si@num@sepmantexp}[1]{%
\expandafter\si@num@mantexp#1\@empty\@empty}
@@ -6149,31 +6180,36 @@ author.
%\end{macro}
%\begin{macro}{\si@num@addmnt}
%\begin{macro}{\si@num@addexp}
-%\begin{macro}{\si@num@addmntexp}
-% To allow \cs{expandafter} use in the above, the actual addition to the
-% appropriate macro is handled here.\\
-%\cs{si@num@addmnt}\marg{char}\\
-%\cs{si@num@addexp}\marg{char}\\
-%\cs{si@num@addmntexp}\marg{char}\marg{mant/exp}\marg{text}
+%\darg{char}
+% To allow \cs{expandafter} use in the above, the actual addition to
+% the appropriate macro is handled here. Two helper macros are
+% needed.
% \begin{macrocode}
\newcommand*{\si@num@addmnt}[1]{%
\si@num@addmntexp{#1}{mant}{mantissa}}
\newcommand*{\si@num@addexp}[1]{%
\si@num@addmntexp{#1}{exp}{exponent}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@addmntexp}
+%\darg{char}
+%\darg{either \texttt{mant} or \texttt{exp}}
+%\darg{info-text}
+% Then the business end.
+% \begin{macrocode}
\newcommand*{\si@num@addmntexp}[3]{%
\si@log@debug{Adding `#1' to #3 for `\si@num@arg'}%
\expandafter\protected@edef\csname si@num@#2\endcsname{%
\csname si@num@#2\endcsname#1}}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\si@num@sepsign}
+%\darg{either \texttt{mant} or \texttt{exp}}
% The input is now tested for a sign. If one exists, it is
% transferred into the \cs{si@num@}|#1sign| storage macro, with the
% remained of the number in \cs{si@num@}|#1|. The only check made
-% directly here is that there is something to process.\\
-%\cs{si@num@sepsign}\marg{mant/exp}
+% directly here is that there is something to process.
% \begin{macrocode}
\newcommand*{\si@num@sepsign}[1]{%
\expandafter\ifx\expandafter\@empty
@@ -6186,10 +6222,10 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@num@gensign}
+%\darg{either \texttt{mant} or \texttt{exp}}
% The sign generator starts by calling the procedure to check if the
% input contains a valid one- or two-digit sign. The results are
-% returned as \cs{si@num@sign} and \cs{si@num@value}.\\
-%\cs{si@num@gensign}\marg{mant/exp}
+% returned as \cs{si@num@sign} and \cs{si@num@value}.
% \begin{macrocode}
\newcommand*{\si@num@gensign}[1]{%
\expandafter\expandafter\expandafter\si@num@findsign
@@ -6224,8 +6260,7 @@ author.
% that \cs{pm} and \cs{mp} can be represented by |+-| and |-+|,
% respectively. To allow the user to alter the valid signs, but
% retain this conversion, the generic character test is used before
-% checking specific matches.\\
-%\cs{si@num@findsign}\meta{char}\meta{char}\meta{chars}\cs{@empty}
+% checking specific matches.
% \begin{macrocode}
\newcommand*{\si@num@sign}{}
\def\si@num@findsign#1#2#3\@empty{%
@@ -6293,11 +6328,10 @@ author.
%\end{macro}
%\begin{macro}{\si@num@addsign}
%\begin{macro}{\si@num@asign}
+%\darg{either \texttt{mant} or \texttt{exp}}
% The macro to add a sign to an unsigned number has to check whether
% this is a mantissa or an exponent. The result is still placed in
-% \cs{si@num@sign} for ease of processing later.\\
-%\cs{si@num@addsign}\marg{mant/exp}\\
-%\cs{si@num@asign}\marg{mantissa/exponent}
+% \cs{si@num@sign} for ease of processing later.
% \begin{macrocode}
\newcommand*{\si@num@addsign}[1]{%
\begingroup
@@ -6329,9 +6363,9 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@num@procnum}
+%\darg{either \texttt{mant} or \texttt{exp}}
% The control macro for processing the number (plus any extra
% characters).
-%\cs{si@num@finddigits}\marg{mant/exp}
% \begin{macrocode}
\newcommand*{\si@num@procnum}[1]{%
\expandafter\ifx\expandafter\@empty
@@ -6353,10 +6387,10 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@num@finddigits}
+%\darg{either \texttt{mant} or \texttt{exp}}
% The core digit processor divides the number into the parts before
% and after the decimal point marker. The temporary switch is used
-% to indicate finding a decimal marker.\\
-%\cs{si@num@finddigits}\marg{mant/exp}
+% to indicate finding a decimal marker.
% \begin{macrocode}
\newcommand*{\si@num@finddigits}[1]{%
\renewcommand*{\si@num@predec}{}%
@@ -6412,16 +6446,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@num@digits}
-%\begin{macro}{\si@num@pre}
-%\begin{macro}{\si@num@post}
-%\begin{macro}{\si@num@prepost}
% The \cs{si@num@digits} macro compares each character in the input
% against the list of characters valid at this stage: numbers,
% decimal markers and ``extra'' characters.
-%\cs{si@num@digits}\meta{char}\meta{chars}\cs{@empty}\\
-%\cs{si@num@pre}\marg{num}\\
-%\cs{si@num@pre}\marg{num}\\
-%\cs{si@num@prepost}\marg{num}\marg{pre/post}\marg{text}
% \begin{macrocode}
\def\si@num@digits#1#2\@empty{%
\si@str@ifchrstr{#1}{\si@numdecimal}
@@ -6458,44 +6485,59 @@ author.
\ifx\@empty#2\@empty\else
\si@num@digits#2\@empty\@empty
\fi}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@num@pre}
+%\begin{macro}{\si@num@post}
+%\darg{char}
+% Storage of the result is spun out.
+% \begin{macrocode}
\newcommand*{\si@num@pre}[1]{%
\si@num@prepost{#1}{pre}{integer}}
\newcommand*{\si@num@post}[1]{%
\si@num@prepost{#1}{post}{decimal}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@prepost}
+%\darg{char}
+%\darg{either \texttt{pre} or \texttt{post}}
+%\darg{info-text}
+% Then actually stored here.
+% \begin{macrocode}
\newcommand*{\si@num@prepost}[3]{%
\expandafter\protected@edef\csname si@num@#2dec\endcsname{%
\csname si@num@#2dec\endcsname#1}%
\si@log@debug{Adding `#1' to #3 part for `\si@num@arg'}}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\si@num@addprezero}
%\begin{macro}{\si@num@addpostzero}
-%\begin{macro}{\si@num@addpzero}
-% A similar set of macros are used for the padding zeros.\\
-%\cs{si@num@addpzero}\marg{pre/post}\marg{text}
+% A similar set of macros are used for the padding zeros.
% \begin{macrocode}
\newcommand*{\si@num@addprezero}{%
\si@num@addpzero{pre}{leading}}
\newcommand*{\si@num@addpostzero}{%
\si@num@addpzero{post}{trailing}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@addpzero}
+%\darg{either \texttt{pre} or \texttt{post}}
+% In this case, there is no argument to be passed along.
+% \begin{macrocode}
\newcommand*{\si@num@addpzero}[2]{%
\si@log@debug{Adding #2 zero for `\si@num@arg'}%
\@namedef{si@num@#1dec}{0}}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\si@num@unsign}
%\begin{macro}{\si@num@nosign}
+%\darg{either \texttt{mant} or \texttt{exp}}
% The trap for a sign with zero numerical input is made. First, a
% check is made to see if there is a sign to worry about. The pre-
% and post-decimal parts are then examined, to see if they contain
-% something other than ``0'' or an extra character.\\
-%\cs{si@num@unsign}\marg{mant/exp}\\
-%\cs{si@num@nosign}\marg{mant/exp}
+% something other than ``0'' or an extra character.
% \begin{macrocode}
\newcommand*{\si@num@unsign}[1]{%
\expandafter\ifx\expandafter\@empty
@@ -6539,9 +6581,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@num@sepdigits}
+%\darg{either \texttt{mant} or \texttt{exp}}
% The \cs{si@num@sepdigits} macro is only called if at least one of
-% the mantissa and exponent contain something to output.\\
-%\cs{si@num@sepdigits}\marg{mant/exp}
+% the mantissa and exponent contain something to output.
% \begin{macrocode}
\newcommand*{\si@num@sepdigits}[1]{%
% \end{macrocode}
@@ -6605,10 +6647,9 @@ author.
%\end{macro}
%\begin{macro}{\si@num@ifextra}
%\begin{macro}{\si@num@extra}
+%\darg{number}
% A relatively simple test for ``extra'' characters. Once again, a
-% bit of group trickery is used.\\
-%\cs{si@num@ifextra}\marg{integer}\\
-%\cs{si@num@extra}\meta{char}\meta{chars}\cs{@empty}
+% bit of group trickery is used.
% \begin{macrocode}
\newcommand*{\si@num@ifextra}[1]{%
\begingroup
@@ -6691,9 +6732,8 @@ author.
%\end{macro}
%\begin{macro}{\si@num@seperr}
%\begin{macro}{\si@num@finderr}
-% The usual hand-off is made for searching for an error.\\
-%\cs{si@num@seperr}\marg{pre/post}\\
-%\cs{si@num@finderr}\meta{char}\meta{chars}\cs{@empty}
+%\darg{either \texttt{pre} or \texttt{post}}
+% The usual hand-off is made for searching for an error.
% \begin{macrocode}
\newcommand*{\si@num@seperr}[1]{%
\si@switchfalse
@@ -6754,28 +6794,30 @@ author.
%\end{macro}
%\begin{macro}{\si@num@addtmpa}
%\begin{macro}{\si@num@addtmpb}
-%\begin{macro}{\si@num@addtmp}
+%\darg{number}
% Some quick methods for adding to the temporary macros with \cs{if}
-% expansion.\\
-%\cs{si@num@addtmpa}\marg{num}\\
-%\cs{si@num@addtmpb}\marg{num}\\
-%\cs{si@num@addtmp}\marg{a/b}\marg{num}
+% expansion.
% \begin{macrocode}
\newcommand*{\si@num@addtmpa}[1]{\si@num@addtmp{a}{#1}}
\newcommand*{\si@num@addtmpb}[1]{\si@num@addtmp{b}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@addtmp}
+%\darg{either \texttt{a} or \texttt{b}}
+%\darg{number}
+% The addition is committed.
+% \begin{macrocode}
\newcommand*{\si@num@addtmp}[2]{%
\expandafter\protected@edef\csname si@temp#1\endcsname{%
\csname si@temp#1\endcsname#2}}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\si@num@cntdigits}
%\begin{macro}{\si@num@cntdgt}
+%\darg{number}
% A recursive system for counting the number of characters in a given
-% input; only used here to count digits in a number.\\
-%\cs{si@num@cntdigits}\marg{num}\\
-%\cs{si@num@cntdgt}\meta{char}\meta{chars}\cs{@empty}
+% input; only used here to count digits in a number.
% \begin{macrocode}
\newcommand*{\si@num@cntdigits}[1]{%
\si@tempcnta\z@\relax
@@ -6815,8 +6857,7 @@ author.
%\begin{macro}{\si@num@lerr}
%\begin{macro}{\si@num@movedigit}
% When the error has more digits than the decimal part, some
-% shuffling is needed.\\
-%\cs{si@num@movedigit}\meta{char}\meta{chars}\cs{@empty}
+% shuffling is needed.
% \begin{macrocode}
\newcommand*{\si@num@largeerr}{%
\renewcommand*{\si@tempa}{}%
@@ -6873,14 +6914,8 @@ author.
%\begin{macro}{\si@num@round}
%\begin{macro}{\si@num@prernd}
%\begin{macro}{\si@num@postrnd}
-%\begin{macro}{\si@num@reverse}
-%\begin{macro}{\si@num@rev}
% Rounding a number is more complicated. The main macro here relies
-% on several others. The initial stage is to reverse the entire
-% number, to make life easier. This is then undone by the other
-% macros as the output is constructed.\\
-%\cs{si@num@reverse}\marg{macro}\\
-%\cs{si@num@rev}\meta{char}\meta{chars}\cs{@empty}
+% on several others, and is simply a set-up and hand-off system.
% \begin{macrocode}
\newcommand*{\si@num@prernd}{}
\newcommand*{\si@num@postrnd}{}
@@ -6894,6 +6929,17 @@ author.
\renewcommand*{\si@num@postdec}{}%
\si@switchfalse
\si@num@rnd}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@num@reverse}
+%\begin{macro}{\si@num@rev}
+%\darg{storage-macro}
+% The initial stage is to reverse the entire number, to make life
+% easier. This is then undone by the other macros as the output is
+% constructed.
+% \begin{macrocode}
\newcommand*{\si@num@reverse}[1]{%
\renewcommand*{\si@tempa}{}%
\expandafter\si@num@rev#1\@empty\@empty
@@ -6906,9 +6952,6 @@ author.
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\si@num@rnd}
%\begin{macro}{\si@num@rndpre}
%\begin{macro}{\si@num@rndpost}
@@ -6917,7 +6960,9 @@ author.
% between rounding before and after the decimal. The two routines
% are quite similar, but have subtly different requirements. Both
% take one character at a time from the input, increment if there is
-% a carry digit, check its value, and add to the output string.
+% a carry digit, check its value, and add to the output string. This
+% is very similar to the same routines used in other macro packages
+% to achieve the same thing.
% \begin{macrocode}
\newcommand*{\si@num@rnd}{%
\ifnum\si@tempcnta>\z@\relax
@@ -6981,12 +7026,12 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@num@int}
+%\darg{integer-part}
% The formatting code for separating thousands is taken more-or-less
% directly from \SIstyle. A few changes are made to fit the various
% conventions here. Following on from the code above, \cs{si@tempa}
% is used to store the integer part of the number, and \cs{si@tempb}
-% is used for the decimal part.\\
-%\cs{si@num@int}\marg{integer-part}
+% is used for the decimal part.
% \begin{macrocode}
\newcommand*{\si@num@int}[1]{%
\renewcommand*{\si@num@predec}{}%
@@ -7001,10 +7046,8 @@ author.
%\end{macro}
%\begin{macro}{\si@num@iffive}
%\begin{macro}{\si@num@five}
-% A test is needed for the presence of more than four characters.\\
-%\cs{si@num@iffive}\marg{num}\\
-%\cs{si@num@five}\meta{char}\meta{char}\meta{char}\meta{char}^^A
-%\meta{chars}\cs{end}
+%\darg{number}
+% A test is needed for the presence of more than four characters.
% \begin{macrocode}
\newcommand*{\si@num@iffive}[1]{%
\si@num@five#1\@empty\@empty\@empty\@empty\@empty\end}
@@ -7019,9 +7062,7 @@ author.
%\end{macro}
%\begin{macro}{\si@num@intfmt}
%\begin{macro}{\si@num@fiint}
-% The business end of the integer formatter.\\
-%\cs{si@num@intfmt}\marg{char}\marg{char}\marg{char}\marg{char}\\
-%\cs{si@num@fiint}\meta{chars}\cs{fi}\cs{fi}\cs{fi}
+% The business end of the integer formatter.
% \begin{macrocode}
\newcommand*{\si@num@intfmt}[4]{%
\ifx\@empty#2\@empty
@@ -7042,8 +7083,7 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@num@intsep}
-% For adding separation to integers, an extra function is needed.\\
-%\cs{si@num@intsep}\marg{char}\marg{char}\marg{char}\marg{char}
+% For adding separation to integers, an extra function is needed.
% \begin{macrocode}
\newcommand*{\si@num@intsep}[4]{%
\protected@edef\si@num@predec{\si@num@predec#1#2#3}%
@@ -7056,10 +7096,9 @@ author.
%\end{macro}
%\begin{macro}{\si@num@dec}
%\begin{macro}{\si@num@decfmt}
+%\darg{decimal-part}
% Formatting a decimal uses a similar mechanism, but with a few
-% alterations needed.\\
-%\cs{si@num@dec}\marg{decimal-part}\\
-%\cs{si@num@decfmt}\marg{char}\marg{char}\marg{char}\marg{char}
+% alterations needed.
% \begin{macrocode}
\newcommand*{\si@num@dec}[1]{%
\renewcommand*{\si@num@postdec}{}%
@@ -7118,10 +7157,10 @@ author.
%
%\subsection{Formatting angles}
%\begin{macro}{\ang}
+%\doarg{keyval options}
+%\darg{angle, either in decimal or deg;min;sec format}
% The approach used here is similar to that in \SIstyle, but has been
-% modified in a few ways.\\
-%\cs{ang}\oarg{options}\marg{decimal-angle}\\
-%\cs{ang}\oarg{options}|{|\meta{deg};\meta{min};\meta{sec}|}|
+% modified in a few ways.
% \begin{macrocode}
\si@newrobustcmd*{\ang}[2][]{%
\begingroup
@@ -7136,9 +7175,7 @@ author.
%\begin{macro}{\si@ang@parse}
% With the correct catcodes in place, processing can take place strip
% out the semi-colons. Here, the input must either contain no
-% semi-colons or two semi-colons.\\
-%\cs{si@ang@parse}\meta{num}|;|\meta{num}|;|\meta{num}|;|^^A
-%\meta{chars}\cs{@nil}
+% semi-colons or two semi-colons.
% \begin{macrocode}
\def\si@ang@parse#1;#2;#3;#4\@nil{%
\let\ifsi@ang@fixdp\ifsi@fixdp
@@ -7194,10 +7231,9 @@ author.
%\begin{macro}{\ifsi@ang@fixdp}
%\begin{macro}{\si@ang@fix}
%\begin{macro}{\si@ang@arcfix}
+%\darg{number}
% A check is needed so that rounding and zero filling are only
% applied to the seconds of an arc angle.
-%\cs{si@ang@fix}\marg{degree/minute/second}\\
-%\cs{si@ang@arcfix}\marg{degree/minute/second}
% \begin{macrocode}
\newif\ifsi@ang@fixdp
\newcommand*{\si@ang@fix}[1]{}
@@ -7218,11 +7254,11 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@ang@ifnum}
+%\darg{number}
% A test is required to check that the provided data consists of
% numbers which can actually be processed by \TeX. This is achieved
% by using \cs{si@num@ifvalid} with a fixed list of valid
-% characters.\\
-%\cs{si@ang@ifnum}\marg{num}
+% characters.
% \begin{macrocode}
\newcommand*{\si@ang@ifnum}[1]{%
\begingroup
@@ -7238,12 +7274,14 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@ang@arctodec}
+%\darg{degrees}
+%\darg{minutes}
+%\darg{seconds}
% The business end of converting arcs to decimal angles is relatively
% straight-forward, as it only needs one calculation. This has to be
% divided up, so that disaster does not strike if there are empty
% arguments; a check is also needed for the sign of the angle,
-% so that the maths makes sense.\\
-%\cs{si@ang@arctodec}\marg{dec}\marg{min}\marg{sec}
+% so that the maths makes sense.
% \begin{macrocode}
\newcommand*{\si@ang@arctodec}[3]{%
\let\si@ang@fix\@gobble
@@ -7286,11 +7324,11 @@ author.
%\begin{macro}{\si@ang@arcdeg}
%\begin{macro}{\si@ang@arcmin}
%\begin{macro}{\si@ang@arcsec}
+%\darg{number}
% The conversion macros for decimal to arc angles. Life is more
% complex here than above, even without the need for checks on the
% input. A number of separation steps are needed, each of which
-% needs a separate macro.\\
-%\cs{si@ang@dectoarc}\marg{angle}
+% needs a separate macro.
% \begin{macrocode}
\newcommand*{\si@ang@dectoarc}[1]{%
\let\si@ang@fix\si@ang@arcfix
@@ -7354,10 +7392,8 @@ author.
%\begin{macro}{\si@ang@sepint}
%\begin{macro}{\si@ang@sint}
%\begin{macro}{\si@ang@strippt}
-% Support macros for the conversion from decimal to arc angles.\\
-%\cs{si@ang@sepint}\marg{deg/min}\\
-%\cs{si@ang@sint}\meta{chars}.\meta{chars}\cs{@empty}\\
-%\cs{si@ang@strippt}\meta{chars}\texttt{pt}
+%\darg{either \texttt{deg} or \texttt{min}}
+% Support macros for the conversion from decimal to arc angles.
% \begin{macrocode}
\newcommand*{\si@ang@sepint}[1]{%
\expandafter\si@ang@sint\the\si@tempdima\@empty
@@ -7378,8 +7414,10 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@ang@notnum}
-% Not a \TeX\ number: complain.\\
-%\cs{si@ang@notnum}\marg{dec}\marg{min}\marg{sec}
+%\darg{degrees}
+%\darg{minutes}
+%\darg{seconds}
+% Not a \TeX\ number: complain.
% \begin{macrocode}
\newcommand*{\si@ang@notnum}[3]{%
\si@log@warn{Angle `#1;#2;#3' is not a pure
@@ -7395,9 +7433,11 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@ang@typeset}
+%\darg{degrees}
+%\darg{minutes}
+%\darg{seconds}
% The \cs{si@ang@set} macro does the work of assigning the degrees,
-% minutes and seconds, and actually typesetting the result.\\
-%\cs{si@ang@typeset}\marg{num}\marg{num}\marg{num}
+% minutes and seconds, and actually typesetting the result.
% \begin{macrocode}
\newcommand*{\si@ang@typeset}[3]{%
% \end{macrocode}
@@ -7415,8 +7455,13 @@ author.
\newcommand*{\si@ang@mins}{}%
\newcommand*{\si@ang@secs}{}%
\fi
+% \end{macrocode}
+%\begin{macro}{\si@ang@decimalsymbol}
+% The current definition of \cs{si@decimalsymbol} needs to be saved.
+% \begin{macrocode}
\protected@edef\si@ang@decimalsymbol{\si@decimalsymbol}%
% \end{macrocode}
+%\end{macro}
%\begin{macro}{\si@ang@movesign}
% Either the signs need to be moved, or this needs to be killed off.
% \begin{macrocode}
@@ -7488,18 +7533,18 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@ang@pad}
-% Padding is only added if requested; the zero is a literal.\\
-%\cs{si@ang@pad}\marg{num}
+%\darg{number}
+% Padding is only added if requested; the zero is a literal.
% \begin{macrocode}
\newcommand*{\si@ang@pad}[1]{\ifsi@ang@padsmall #1\fi}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@ang@num}
%\begin{macro}{\si@ang@signlessnum}
+%\darg{one of \texttt{degree}, \texttt{minute} or \texttt{second}}
+%\darg{number}
% Modified versions of \cs{num}, one to typeset angles without a
-% leading sign and the other with.\\
-%\cs{si@ang@num}\marg{degree/minute/second}\marg{num}\\
-%\cs{si@ang@signlessnum}\marg{degree/minute/second}\marg{num}
+% leading sign and the other with.
% \begin{macrocode}
\newcommand*{\si@ang@num}[2]{%
\begingroup
@@ -7520,20 +7565,24 @@ author.
%\begin{macro}{\si@ang@killdegree}
%\begin{macro}{\si@ang@killminute}
%\begin{macro}{\si@ang@killsecond}
-%\begin{macro}{\si@ang@astrosign}
-%\begin{macro}{\si@ang@decimalsymbol}
% A mechanism is needed to handle moving the angle unit signs for the
-% \opt{astroang} option. This requires two steps, producing the sign
-% over the decimal sign and preventing duplicate symbols appearing.
-% This is based on a suggestion from Morten H{\o}gholm, but using
-% \TeX\ internals as \cs{makebox} does not work here. Note the need
-% to correct for \cs{scriptspace} (thanks to Donald Arseneau for
-% that).\\
-%\cs{si@ang@astrosign}\marg{degree/minute/second}
+% \opt{astroang} option. First, some support macros are needed.
% \begin{macrocode}
\newcommand*{\si@ang@killdegree}{\let\si@sym@degree\relax}
\newcommand*{\si@ang@killminute}{\let\si@sym@minute\relax}
\newcommand*{\si@ang@killsecond}{\let\si@sym@second\relax}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@ang@astrosign}
+%\darg{one of \texttt{degree}, \texttt{minute} or \texttt{second}}
+% The method needs two steps, producing the sign over the decimal
+% sign and preventing duplicate symbols appearing. This is based on a
+% suggestion from Morten H{\o}gholm, but using \TeX\ internals as
+% \cs{makebox} does not work here. Note the need to correct for
+% \cs{scriptspace} (thanks to Donald Arseneau for that).
+% \begin{macrocode}
\newcommand*{\si@ang@astrosign}[1]{%
\renewcommand*{\si@decimalsymbol}{%
\setbox\si@tempboxa=\hbox{%
@@ -7563,10 +7612,6 @@ author.
\csname si@ang@kill#1\endcsname}}%
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\subsection{Tabular material}
% The automatic formatting and alignment of numerical data in columns
@@ -7595,6 +7640,7 @@ author.
%\end{macro}
%\begin{macro}{\NC@rewrite@S}
%\begin{macro}{\NC@rewrite@s}
+%\doarg{keyval options}
% Following the \numprint approach, the \cs{NC@rewrite@\ldots} macros
% are rewritten to collect the cell contents. This means messing
% with the internal macros of another package, but there is no other
@@ -7604,9 +7650,7 @@ author.
% \cs{@temptokena}, with the start and end macros unexpanded.
% Argument |#1| contains any user setup options for this column.
% Passing an argument at this stage will cause issues, so each column
-% type needs its own \texttt{begin} and \texttt{end} macros.\\
-%\cs{NC@rewrite@S}\oarg{options}
-%\cs{NC@rewrite@s}\oarg{options}
+% type needs its own \texttt{begin} and \texttt{end} macros.
% \begin{macrocode}
\renewcommand*{\NC@rewrite@S}[1][]{%
\edef\si@tempa{\the\@temptokena
@@ -7626,12 +7670,11 @@ author.
%\begin{macro}{\si@tab@begin@S}
%\begin{macro}{\si@tab@begin@s}
%\begin{macro}{\si@tab@gettok}
+%\doarg{keyval options}
% At this stage, the appropriate token gathering macro is activated,
% and the common starting macro is called. For the |S| column, the
% \opt{seperr} is turned off, and an error is set to be raised by any
-% ``x-part'' input.\\
-%\cs{si@tab@begin@S}\oarg{options}\\
-%\cs{si@tab@begin@s}\oarg{options}
+% ``x-part'' input.
% \begin{macrocode}
\newcommand*{\si@tab@begin@S}[1][]{%
\si@log@debug{Processing S column cell contents}%
@@ -7665,11 +7708,11 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@tab@begin}
+%\doarg{keyval options}
% The macro for gathering up input is common to both column types. It
% uses the method for \pkg{rccol}; the cell contents are collected by
% a second macro, which then stores all of the data in an appropriate
-% token store.\\
-%\cs{si@tab@begin}\oarg{options}
+% token store.
% \begin{macrocode}
\newcommand*{\si@tab@begin}[1][]{%
\begingroup
@@ -7687,6 +7730,7 @@ author.
%\changes{v1.0a}{2008/06/20}{Fixed issues with alignment of
% \texttt{s} column contents}
%\begin{macro}{\si@tab@next}
+%\darg{cell-contents}
% The two collection macros are very similar. Both compare the
% current input with a list of possible fixed values; this is pretty
% much a direct copy of \numprint. If the input is not on the list
@@ -7695,10 +7739,7 @@ author.
% from any text. For the |s| column, everything gets added to
% \cs{si@tab@toks} for later processing. Two separate macros are
% needed here as the fixed values are dependant on the column type,
-% and awkward errors pop up if a combined approach is tried.\\
-%\cs{si@tab@gettok@S}\marg{cell-contents}\\
-%\cs{si@tab@othertok}\marg{chars}\\
-%\cs{si@tab@gettok@s}\marg{cell-contents}
+% and awkward errors pop up if a combined approach is tried.
% \begin{macrocode}
\newcommand*{\si@tab@gettok@S}[1]{%
\ifx\tabularnewline#1\relax
@@ -8075,10 +8116,12 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@tab@sepcorr}
+%\darg{one of \texttt{mantpre}, \texttt{mantpost}, \texttt{exppre} or
+% \texttt{exppost}}
+%\darg{one of \texttt{pre}, \texttt{post} or \texttt{exp}}
% A spacing correction is needed \emph{if} the number of digits to be
% allowed for will lead to the introduction of a separator. A counter
-% and dimension are needed for the testing.\\
-%\cs{si@tab@sepcorr}\marg{count}\marg{dimen}
+% and dimension are needed for the testing.
% \begin{macrocode}
\newcommand*{\si@tab@sepcorr}[2]{%
\expandafter\si@tempcnta\expandafter\the
@@ -8107,28 +8150,36 @@ author.
%
%\subsection{Units}
%\begin{macro}{\SI}
-%\begin{macro}{\si}
+%\doarg{keyval options}
+%\darg{number}
% There are two types of user macros for the units system; those for
% defining new units, prefixes and powers, and those for using them.
-% There are two macros for using units, \cs{SI} and \cs{si},
-% which work in very similar ways. \cs{si} is just an alias for
-% \cs{SI} with no number; everything is handed off into an internal
-% macro. The internal macro also handles the optional prefix
-% argument to \cs{SI}\\
-%\cs{SI}\oarg{options}\marg{num}
-%\cs{si}\oarg{options}\marg{unit}
+% There are two macros for using units, \cs{SI} and \cs{si}, which
+% work in very similar ways. argument to \cs{SI}
% \begin{macrocode}
\si@newrobustcmd*{\SI}[2][]{%
\@ifnextchar[%]
{\si@SI[#1]{#2}}
{\si@SI[#1]{#2}[]}}
-\si@newrobustcmd*{\si}[2][]{\si@SI[#1]{}[]{#2}}
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\si}
+%\doarg{keyval options}
+%\darg{unit}
+% \cs{si} is just an alias for \cs{SI} with no number; everything is
+% handed off into an internal macro. The internal macro also handles
+% the optional prefix
+% \begin{macrocode}
+\si@newrobustcmd*{\si}[2][]{\si@SI[#1]{}[]{#2}}
+% \end{macrocode}
%\end{macro}
+
%\begin{macro}{\newunit}
%\begin{macro}{\renewunit}
%\begin{macro}{\provideunit}
+%\doarg{keyval options}
+%\darg{unit}
+%\darg{symbol}
% The \cs{newunit} and \cs{renewunit} macros create the new unit
% macros. To allow a mechanism for checking an existing definition,
% these macros simply carry out the appropriate tests, before handing
@@ -8136,10 +8187,7 @@ author.
% customised error is desirable. Other than that, the code here gives
% very similar results to \cs{newcommand} and \cs{renewcommand}.
% Finally, \cs{provideunit} adds the unit definition only if it does
-% not already exist.\\
-%\cs{newunit}\oarg{options}\marg{unit}\marg{symbol}\\
-%\cs{renewunit}\oarg{options}\marg{unit}\marg{symbol}\\
-%\cs{provideunit}\oarg{options}\marg{unit}\marg{symbol}
+% not already exist.
% \begin{macrocode}
\newcommand*{\newunit}[3][]{%
\si@ifdefinable{#2}
@@ -8162,16 +8210,14 @@ author.
%\begin{macro}{\newprefix}
%\begin{macro}{\renewprefix}
%\begin{macro}{\provideprefix}
+%\doarg{\texttt{binary}}
+%\darg{multiple}
+%\darg{powers-ten}
+%\darg{symbol}
% The multiples of units are defined here; very similar code is used
-% to the \cs{newunit}, \etc., macros. The multiple prefixes cannot take
-% an optional argument, and must represent some power. Hence the arguments
-% required are different.
-%\cs{newprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
-% \marg{symbol}\\
-%\cs{renewprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
-% \marg{symbol}\\
-%\cs{provideprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
-% \marg{symbol}
+% to the \cs{newunit}, \etc, macros. The multiple prefixes cannot
+% take an optional argument, and must represent some power. Hence
+% the arguments required are different.
% \begin{macrocode}
\newcommand*{\newprefix}[4][]{%
\si@ifdefinable{#2}
@@ -8194,13 +8240,12 @@ author.
%\begin{macro}{\newpower}
%\begin{macro}{\renewpower}
%\begin{macro}{\providepower}
+%\doarg{\texttt{post}}
+%\darg{number}
+%\darg{power}
% Here power multiples for units are set up. As with units and
% multiples, a layered approach is used to keep things easy to
-% maintain. The optional argument here is \emph{not} a \pkg{keyval}
-% one: only \opt{post} is a valid value.\\
-%\cs{newpower}\oarg{post}\marg{num}\marg{power}\\
-%\cs{renewpower}\oarg{post}\marg{num}\marg{power}\\
-%\cs{providepower}\oarg{post}\marg{num}\marg{power}
+% maintain.
% \begin{macrocode}
\newcommand*{\newpower}[3][]{%
\si@ifdefinable{#2}
@@ -8235,11 +8280,14 @@ author.
%\end{macro}
%\begin{macro}{\si@SI}
%\begin{macro}{\si@unt@SIopts}
+%\doarg{keyval options}
+%\darg{unit}
+%\doarg{preunit}
+%\darg{unit}
% The internal processing starts with \cs{si@SI}, which processes the
-% second optional argument to \cs{SI} (which is empty for
-% \cs{si}). Everything is set up in a group, and processing
-% begins by handling the options.\\
-%\cs{si@SI}\oarg{options}\marg{unit}\oarg{preunit}\marg{unit}
+% second optional argument to \cs{SI} (which is empty for \cs{si}).
+% Everything is set up in a group, and processing begins by handling
+% the options.
% \begin{macrocode}
\newcommand*{\si@unt@SIopts}{}
\def\si@SI[#1]#2[#3]#4{%
@@ -8317,13 +8365,13 @@ author.
%\end{macro}
%\begin{macro}{\si@unt@ifliteral}
%\begin{macro}{\ifsi@unt@littest}
+%\darg{unit}
% The next stage of the processor is to determine whether or not the
% argument of the unit macro is processable. For literal arguments,
% this is not the case, and the argument is typeset ``as is''. On
% the other hand, any units, \etc., declared by the package will work
% with the processor, and so need to be executed before typesetting
-% the result.\\
-%\cs{si@unt@ifliteral}\marg{text}
+% the result.
% \begin{macrocode}
\newif\ifsi@unt@littest
\newcommand*{\si@unt@ifliteral}[1]{%
@@ -8345,12 +8393,12 @@ author.
%\end{macro}
%\begin{macro}{\ifsi@unt@litout}
%\begin{macro}{\si@unt@printunit}
+%\darg{unit}
% The printing macro uses the above test to determine how to act. It
% then carries out the appropriate action: either typesetting or
% executing. A flag is also provided so that any macro units inside
% a partially-literal argument will work (this is also needed to
-% emulate \unitsdef).\\
-%\cs{si@unt@printunit}\marg{unit}
+% emulate \unitsdef).
% \begin{macrocode}
\newif\ifsi@unt@litout
\newcommand*{\si@unt@printunit}[1]{%
@@ -8472,9 +8520,11 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@unt@defunit}
+%\doarg{keyval options}
+%\darg{unit}
+%\darg{symbol}
% The internal macro for defining a unit does not check for
-% redefinition; that is done by the user macros.\\
-%\cs{si@unt@defunit}\oarg{options}\marg{unit}\marg{symbol}
+% redefinition; that is done by the user macros.
% \begin{macrocode}
\newcommand*{\si@unt@defunit}[3][]{%
\si@log@debug{Declaring unit \string#2 with \MessageBreak
@@ -8501,12 +8551,12 @@ author.
%\end{macro}
%\begin{macro}{\si@unt@withopt}
%\begin{macro}{\si@unt@noopt}
+%\darg{unit}
+%\darg{symbol}
% To allow the correct expansion, the potential optional argument to
% a unit macro has to come last. So \cs{@ifnextchar} is needed to
% detect it and pass data through. To keep variation down, when the
-% argument is not allowed, the empty |[]| is supplied.\\
-%\cs{si@unt@withopt}\marg{unit}\marg{symbol}\\
-%\cs{si@unt@noopt}\marg{unit}\marg{symbol}
+% argument is not allowed, the empty |[]| is supplied.
% \begin{macrocode}
\newcommand*{\si@unt@withopt}[2]{%
\@ifnextchar[%]
@@ -8517,10 +8567,12 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@unt@opt}
+%\darg{unit}
+%\darg{symbol}
+%\doarg{number}
% The optional argument to the unit macro (if present) is converted
% to a normal one for ease. The correct route for processing is then
-% picked.\\
-%\cs{si@unt@opt}\marg{unit}\marg{symbol}\oarg{num}
+% picked.
% \begin{macrocode}
\def\si@unt@opt#1#2[#3]{%
\ifsi@unt@littest
@@ -8546,9 +8598,11 @@ author.
%\end{macro}
%\begin{macro}{\si@unt@defprefix}
%\begin{macro}{\ifsi@unt@litprefix}
-% As with units, multiples are defined by an internal macro.\\
-%\cs{si@unt@defprefix}\oarg{binary}\marg{multiple}\marg{powers-ten}^^A
-% \marg{symbol}
+%\doarg{\texttt{binary}}
+%\darg{multiple}
+%\darg{powers-ten}
+%\darg{symbol}
+% As with units, multiples are defined by an internal macro.
% \begin{macrocode}
\newif\ifsi@unt@litprefix
\si@unt@litprefixtrue
@@ -8582,11 +8636,12 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@unt@defpower}
+%\doarg{\texttt{post}}
+%\darg{number}
+%\darg{power}
% The definition of powers is complicated by the need to handle both
% those given before units (such as \cs{cubic}) and those given after
-% (\eg~\cs{cubed}). This means that an optional argument is
-% needed.\\
-%\cs{si@unt@defpower}\oarg{post}\marg{power}\marg{num}
+% (\eg \cs{cubed}). This means that an optional argument is needed.
% \begin{macrocode}
\newcommand*{\si@unt@defpower}[3][]{%
\si@log@debug{Declaring power \string#2 with\MessageBreak
@@ -8614,11 +8669,13 @@ author.
%\end{macro}
%\begin{macro}{\si@unt@unithook}
%\begin{macro}{\si@unt@unit}
+%\darg{number}
+%\darg{unit}
+%\darg{symbol}
% The macro for units is actually a processor, rather than
% typesetting anything, which is handled elsewhere. The first
% argument to the macro is optional, but does not have square
-% brackets to keep things simple with gobbling.\\
-%\cs{si@unt@unit}\marg{num}\marg{unit}\marg{symbol}
+% brackets to keep things simple with gobbling.
% \begin{macrocode}
\newcommand*{\si@unt@unithook}{}
\newcommand*{\si@unt@unit}[3]{%
@@ -8656,9 +8713,10 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@unt@firstorsecond}
+%\darg{number}
+%\darg{unit-macro}
% At this stage, the flag will be set for the first item to be
-% processed whichever route the unit has been called by.\\
-%\cs{si@unt@firstorsecond}\marg{num}\marg{macro}
+% processed whichever route the unit has been called by.
% \begin{macrocode}
\newcommand*{\si@unt@firstorsecond}[2]{%
\ifsi@unt@first
@@ -8670,10 +8728,11 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@unt@first}
+%\darg{number}
+%\darg{unit-macro}
% For the first unit in the input, some extra tasks are needed.
% First, the optional argument for the unit macro needs to be
-% tested.\\
-%\cs{si@unt@first}\marg{num}\marg{unit}
+% tested.
% \begin{macrocode}
\newcommand*{\si@unt@first}[2]{%
\si@ifnotmtarg{#1}
@@ -8697,9 +8756,9 @@ author.
%\end{macro}
%\begin{macro}{\si@unt@setopts}
%\begin{macro}{\si@unt@setSIopts}
+%\darg{unit}
% A rather long set of \cs{expandafter} commands to get the options
-% to set safely.\\
-%\cs{si@unt@setopts}\marg{unit}
+% to set safely.
% \begin{macrocode}
\newcommand*{\si@unt@setopts}[1]{%
\expandafter\expandafter\expandafter\expandafter\expandafter
@@ -8727,11 +8786,12 @@ author.
%\end{macro}
%\begin{macro}{\si@unt@second}
%\begin{macro}{\si@unt@third}
+%\darg{number}
+%\darg{unit}
% For everything apart from the first item to be processed, spacing
% may need to be added to separated different units. The macro is
% divided into two, so that everything except the space can be added
-% in finalisation.\\
-%\cs{si@unt@second}\marg{num}\marg{unit}
+% in finalisation.
% \begin{macrocode}
\newcommand*{\si@unt@second}[2]{%
\si@ifnotmtarg{#1}
@@ -8774,8 +8834,10 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@unt@prefix}
-% Actual output of the prefixes.\\
-%\cs{si@unt@prefix}\marg{multiple}\marg{powers-ten}\marg{symbol}
+%\darg{multiple}
+%\darg{power-ten}
+%\darg{symbol}
+% Actual output of the prefixes.
% \begin{macrocode}
\newcommand*{\si@unt@prefix}[3]{%
\si@unt@firstorsecond{}{#1}%
@@ -8788,25 +8850,30 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@unt@addprefix}
-% To add the prefix, a little translation is needed.\\
-%\cs{si@unt@countprefix}\marg{gobble}\marg{gobble}\marg{symbol}
+%\darg{gobbled}
+%\darg{gobbled}
+%\darg{symbol}
+% To add the prefix, a little translation is needed.
% \begin{macrocode}
\newcommand*{\si@unt@addprefix}[3]{%
\si@unt@addtostack{prefix}{#3}}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@unt@prefixcnt}
-%\begin{macro}{\si@unt@countprefix}
-%\begin{macro}{\si@unt@invprefix}
-% On the other hand, to count the prefix numeral, the symbol is
-% thrown away.\\
-%\cs{si@unt@countprefix}\marg{multiple}\marg{powers-ten}\marg{gobble}
+% A storage area is created.
% \begin{macrocode}
\newcount\si@unt@prefixcnt
-\newcommand*{\si@unt@countprefix}[3]{%
% \end{macrocode}
-% A check is made for binary units.
+%\end{macro}
+%\begin{macro}{\si@unt@countprefix}
+%\begin{macro}{\si@unt@invprefix}
+%\darg{multiple}
+%\darg{powers-ten}
+%\darg{gobbled}
+% To count the prefix numeral, the symbol is thrown away. First, a
+% check is made for binary units.
% \begin{macrocode}
+\newcommand*{\si@unt@countprefix}[3]{%
\renewcommand*{\si@tempa}{binary}%
\expandafter\expandafter\expandafter\ifx\expandafter
\csname\expandafter\@gobble\string#1@opt@si\endcsname
@@ -8827,22 +8894,27 @@ author.
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
%\begin{macro}{\si@unt@litpower}
+%\darg{gobbled}
+%\darg{number}
% For literal power output, the number can't simply be dumped, so
-% a macro is needed.\\
-%\cs{si@unt@litpower}\marg{gobble}\marg{num}
+% a macro is needed.
% \begin{macrocode}
\newcommand*{\si@unt@litpower}[2]{\textsuperscript{#2}}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\ifsi@unt@prepower}
+% If a power is seen before a unit, tracking is needed.
+% \begin{macrocode}
+\newif\ifsi@unt@prepower
+% \end{macrocode}
+%\end{macro}
%\begin{macro}{\si@unt@power}
+%\darg{power}
+%\darg{number}
% The handling of powers starts by ensuring that ``pre'' powers
-% follow \cs{per} cleanly. Then a check is needed for inversion.\\
-%\cs{si@unt@power}\marg{power}\marg{num}
+% follow \cs{per} cleanly. Then a check is needed for inversion.
% \begin{macrocode}
-\newif\ifsi@unt@prepower
\newcommand*{\si@unt@power}[2]{%
\renewcommand*{\si@tempa}{post}%
\expandafter\expandafter\expandafter\ifx\expandafter
@@ -8927,7 +8999,6 @@ author.
%\end{macro}
%\end{macro}
%\end{macro}
-%\end{macro}
%\begin{macro}{\si@unt@invpower}
% A macro to change the sign of the current power.
% \begin{macrocode}
@@ -9005,15 +9076,22 @@ author.
%\end{macro}
%\begin{macro}{\si@unt@lastadda}
%\begin{macro}{\si@unt@lastaddb}
-%\begin{macro}{\si@unt@addtostack}
% Items cannot be added directly to the stacks (except the spacing
% stack, a) as the fractional handling may need to add the item to
-% either storage area. By indicating the type of data to be added to
-% the stack, problems can be avoided.\\
-%\cs{si@unt@addtostack}\marg{type}\marg{token}
+% either storage area. First, a track is kept of what has
+% been added at each stage.
% \begin{macrocode}
\newcommand*{\si@unt@lastadda}{}
\newcommand*{\si@unt@lastaddb}{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@addtostack}
+%\darg{type}
+%\darg{token}
+% By indicating the type of data to be added to the stack, problems
+% can be avoided.
+% \begin{macrocode}
\newcommand*{\si@unt@addtostack}[2]{%
\renewcommand*{\si@tempa}{#1}%
% \end{macrocode}
@@ -9029,12 +9107,12 @@ author.
{#1}{#2}}
% \end{macrocode}
%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\si@unt@preplussp}
-% The space added after a prefix needs to be ignored.\\
-%\cs{si@unt@preplussp}\marg{type}\marg{stack}\marg{token}^^A
-% \marg{gobble}
+%\darg{type}
+%\darg{stack}
+%\darg{token}
+%\darg{gobbled}
+% The space added after a prefix needs to be ignored.
% \begin{macrocode}
\newcommand*{\si@unt@preplussp}[2]{%
\renewcommand*{\si@tempa}{prefix+space}%
@@ -9049,8 +9127,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@unt@stack}
-% The macro for actually doing the stacking up.\\
-%\cs{si@unt@stack}\marg{type}\marg{tokens}
+%\darg{type}
+%\darg{token}
+% The macro for actually doing the stacking up.
% \begin{macrocode}
\newcommand*{\si@unt@stack}[2]{%
\expandafter\renewcommand\expandafter*\expandafter{%
@@ -9084,18 +9163,22 @@ author.
\@ne\relax}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\si@unt@holdspace}
-%\begin{macro}{\si@unt@addstack}
%\begin{macro}{\si@unt@holdstacka}
%\begin{macro}{\si@unt@holdstackb}
-% Depending on the nature of the addition, it is either held or added
-% to the stack. For the ``b'' space stack, a check is made to ensure
-% that a space cannot be added before the first item.\\
-%\cs{si@unt@holdspace}\marg{tokens}\\
-%\cs{si@unt@addstack}\marg{tokens}
+% The stacked material needs somewhere to live.
% \begin{macrocode}
\newcommand*{\si@unt@holdstacka}{}
\newcommand*{\si@unt@holdstackb}{}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@unt@holdspace}
+%\begin{macro}{\si@unt@addstack}
+%\darg{token}
+% Depending on the nature of the addition, it is either held or added
+% to the stack. For the ``b'' space stack, a check is made to ensure
+% that a space cannot be added before the first item.
+% \begin{macrocode}
\newcommand*{\si@unt@holdspace}[1]{%
\renewcommand*{\si@tempa}{b}%
\edef\si@tempb{\si@unt@checkstack}%
@@ -9119,8 +9202,6 @@ author.
% \end{macrocode}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
%\begin{macro}{\si@unt@stackout}
% The stack contents are actually typeset here. First the spacing
% between units and values is added.
@@ -9246,13 +9327,13 @@ author.
%\begin{macro}{\si@unt@out}
%\changes{v1.0d}{2008/06/25}{Sanitise one level of unit input
% only}
+%\darg{unit}
% The final part of the units system is the output routine. This has
% to cope with units not only as macros but also as direct input
% (\SIstyle-type input). Non-Latin characters are also handled
% cleanly. The \cs{scantokens} system deals with everything except
% full stops; these are left out so that a single level system can be
-% used \latin{via} a token register.\\
-%\cs{si@unt@out}\marg{unit}
+% used \latin{via} a token register.
% \begin{macrocode}
\begingroup
\catcode`\~=\active
@@ -9342,9 +9423,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@unt@sym}
+%\darg{charcode}
% A macro for declaring symbols: a copy of \cs{DeclareInputMath} from
-% \pkg{inputenc}.\\
-%\cs{si@unt@sym}\marg{charcode}
+% \pkg{inputenc}.
% \begin{macrocode}
\newcommand*{\si@unt@sym}[1]{%
\bgroup
@@ -9404,17 +9485,24 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\tothe}
-%\begin{macro}{\si@tothe}
%\begin{macro}{\raiseto}
+% The user macros for arbitraty powers are simple
+% calling macros to a common internal macro.
+% \begin{macrocode}
+\newcommand*{\tothe}{\si@tothe{\tothe}}
+\newcommand*{\raiseto}{\si@tothe{\raiseto}}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\si@tothe}
%\begin{macro}{\tothe@opt@si}
%\begin{macro}{\raiseto@opt@si}
+%\darg{either \texttt{\cs{tothe}} or \texttt{\cs{raiseto}}}
+%\darg{number}
% A macro for arbitrary powers, which comes after the unit and so
-% needs to be marked as such.\\
-%\cs{tothe}\marg{num}\\
-%\cs{raiseto}\marg{num}
+% needs to be marked as such. Two fake option-storage macros are
+% created so that everything works correctly.
% \begin{macrocode}
-\newcommand*{\tothe}{\si@tothe{\tothe}}
-\newcommand*{\raiseto}{\si@tothe{\raiseto}}
\newcommand*{\si@tothe}[2]{%
\ifsi@unt@littest
\expandafter\@gobbletwo
@@ -9432,30 +9520,28 @@ author.
%\end{macro}
%\end{macro}
%\end{macro}
-%\end{macro}
-%\end{macro}
%
%\subsection{Locales}
%\begin{macro}{\si@loc@load}
%\begin{macro}{\si@loc@sisetup}
+%\darg{locale}
% When loading a locale, the setup is saved rather than applied.
% Anything other than simple settings should be inside
-% \cs{addtolocale}, which is already defined.\\
-%\cs{si@loc@load}\marg{locale}
+% \cs{addtolocale}, which is already defined.
% \begin{macrocode}
\newcommand*{\si@loc@load}[1]{%
\let\si@loc@sisetup\sisetup
\renewcommand*{\sisetup}[1]{%
- \expandafter\gdef\csname si@loc@#1\endcsname{##1}}
+ \expandafter\gdef\csname si@loc@#1\endcsname{##1}}%
\si@loadfile{#1}%
\let\sisetup\si@loc@sisetup}
% \end{macrocode}
%\end{macro}
%\end{macro}
%\begin{macro}{\si@loc@set}
+%\darg{locale}
% Setting the locale transfers the settings to \cs{sisetup}, and runs
-% any extra macros.\\
-%\cs{si@loc@set}\marg{locale}
+% any extra macros.
% \begin{macrocode}
\newcommand*{\si@loc@set}[1]{%
\ifcsname si@loc@#1\endcsname
@@ -9482,8 +9568,8 @@ author.
%\begin{macro}{\si@loc@ltol}
%\changes{v1.0a}{2008/06/20}{\pkg{babel} support fixed for default
% document language}
-% The necessary loading for language modules occurs.\\
-%\cs{si@loc@ltol}\marg{list}
+%\darg{list of locales and languages}
+% The necessary loading for language modules occurs.
% \begin{macrocode}
\newcommand*{\si@loc@ltol}[1]{%
\def\si@tempa##1:##2\@nil{\si@loc@load{##1}}
@@ -9518,8 +9604,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\addtolocale}
-% Arbitrary macros may need to be added to the locale.\\
-%\cs{addtolocale}\marg{locale}\marg{commands}
+%\darg{locale}
+%\darg{commands}
+% Arbitrary macros may need to be added to the locale.
% \begin{macrocode}
\newcommand*{\addtolocale}[2]{%
\si@addtocsname{si@loc@#1@extra}{#2}}
@@ -9528,13 +9615,13 @@ author.
%
%\subsection{Output routine}
%\begin{macro}{\si@out}
+%\darg{text}
% With all of the setup done, the text can finally be typeset. This
% is done inside a \cs{text} block, which takes care of
% \cs{ensuremath}, \etc. First of all, the various catcode settings
% needed to get maths-in-text mode are made. \cs{makeatletter} is
% needed so that \cs{scantokens} still allows internal macros to
-% work.\\
-%\cs{si@out}\marg{text}
+% work.
% \begin{macrocode}
\begingroup
\catcode`\^=\active
@@ -9571,9 +9658,8 @@ author.
%\end{macro}
%\begin{macro}{\si@out@text}
%\begin{macro}{\si@out@maths}
-% Output occurs with the correct changes to superscript behaviour.\\
-%\cs{si@out@text}\marg{text}\\
-%\cs{si@out@maths}\marg{text}
+%\darg{text}
+% Output occurs with the correct changes to superscript behaviour.
% \begin{macrocode}
\gdef\si@out@text#1{%
\let^\si@out@sp
@@ -9590,11 +9676,11 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@out@sp}
+%\darg{text}
% \cs{textsuperscript} gives slightly different alignment of numbers
% to using |^| in text mode. To avoid this, a slightly different
% definition is used. Elsewhere \cs{textsuperscript} is used, as
-% the code above sorts out the text/maths mode issues.\\
-%\cs{si@out@sp}\marg{text}
+% the code above sorts out the text/maths mode issues.
% \begin{macrocode}
\newcommand*{\si@out@sp}[1]{\ensuremath{^{\text{#1}}}}
% \end{macrocode}
@@ -9613,9 +9699,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@out@num}
+%\darg{number}
% For numerical output, the default fonts are controlled slightly
-% differently to text output.\\
-%\cs{si@out@num}\marg{num}
+% differently to text output.
% \begin{macrocode}
\newcommand*{\si@out@num}[1]{%
\begingroup
@@ -9638,10 +9724,10 @@ author.
%\end{macro}
%\begin{macro}{\si@ifl@aded}
%\begin{macro}{\si@ifloaded}
-% A bit of borrowing from the \LaTeX\ kernel. A copy of \cs{@ifl@aded}
-% is needed as things aren't always done in the preamble by
-% \currpkg.\\
-%\cs{si@ifloaded}\marg{package}
+%\darg{package}
+% A bit of borrowing from the \LaTeX\ kernel. A copy of
+% \cs{@ifl@aded} is needed as things aren't always done in the
+% preamble by \currpkg.
% \begin{macrocode}
\newcommand*{\si@ifl@aded}{}
\let\si@ifl@aded\@ifl@aded
@@ -9651,12 +9737,12 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@loadfile}
-% Loading configuration files is handled here.\\
-%\cs{si@loadfile}\marg{file}
+%\darg{file}
+% Loading configuration files is handled here.
% \begin{macrocode}
\newcommand*{\si@loadfile}[1]{%
\si@ifloaded{#1}{}
- {\InputIfFileExists{\si@fileprefix#1.\si@extension}
+ {\si@InputIfFileExists{\si@fileprefix#1.\si@extension}
{}
{\si@log@err{Failed to load file
\si@fileprefix#1.\si@extension}
@@ -9664,17 +9750,58 @@ author.
found}}}}
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\ifsi@outerinput}
+% At various points, the package needs to know if the
+% currently-read configuration file is the
+% outer one.
+% \begin{macrocode}
+\newif\ifsi@outerinput\si@outerinputtrue
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@InputIfFileExists}
+% To allow reading configuration files after the start of the
+% document, a private copy of \cs{InputIfFileExists} is needed. The
+% main macro here simply checks if the modified version is needed.
+% \begin{macrocode}
+\let\si@InputIfFileExists\InputIfFileExists
+\AtBeginDocument{
+ \renewcommand*{\si@InputIfFileExists}{%
+ \ifsi@outerinput
+ \expandafter\si@outerinput
+ \else
+ \expandafter\InputIfFileExists
+ \fi}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\si@outerinput}
+%\darg{file}
+%\darg{true-code}
+%\darg{false-code}
+% The outer call to load a file needs to set |@| to a letter and turn
+% of printing using \cs{nullfont}.
+% \begin{macrocode}
+\newcommand*{\si@outerinput}[3]{%
+ \makeatletter
+ \nullfont
+ \si@outerinputfalse
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}\@@input \@filef@und\normalsize}
+ {#3}%
+ \normalsize
+ \makeatother}
+% \end{macrocode}
+%\end{macro}
%\begin{macro}{\requiresiconfigs}
-% The configuration files depend on each other.\\
-%\cs{requiresiconfigs}\marg{cfg-file}
+%\darg{config-file}
+% The configuration files depend on each other.
% \begin{macrocode}
\newcommand*{\requiresiconfigs}[1]{%
\@for\si@tempb:=#1\do{\si@loadfile{\si@tempb}}}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@loademfile}
-% For emulation files, an additional check is made.\\
-%\cs{si@loademfile}\marg{file}
+%\darg{file}
+% For emulation files, an additional check is made.
% \begin{macrocode}
\newcommand*{\si@loademfile}[1]{%
\@ifpackageloaded{#1}
@@ -9688,8 +9815,9 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@emclash}
-% A macro for emulation clashes.\\
-%\cs{si@emclash}\marg{package}\marg{package}
+%\darg{package}
+%\darg{package}
+% A macro for emulation clashes.
% \begin{macrocode}
\newcommand*{\si@emclash}[2]{%
\si@log@err{Emulation clash: `#1' and `#2'}
@@ -9698,10 +9826,11 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\si@emulating}
+%\darg{package}
+%\darg{version}
% For packages that are emulated, the \LaTeX\ mechanism to prevent
% re-loading is used. The list of packages to check at the start
-% of the document also has to be altered.\\
-%\cs{si@emulating}\marg{package}\marg{version}
+% of the document also has to be altered.
% \begin{macrocode}
\newcommand*{\si@emulating}[2]{%
\@namedef{ver@#1.sty}{#2 siunitx emulation of #1}%
@@ -9894,7 +10023,7 @@ author.
% powers.
% \begin{macrocode}
\ProvidesFile{si-prefix.cfg}
- [\csname si@svn@version\endcsname siunitx:
+ [\si@svn@version siunitx:
SI Multiple prefixes]
\newprefix{\yocto}{-24}{y}
\newprefix{\zepto}{-21}{z}
@@ -9999,7 +10128,7 @@ author.
% is an awkward one, but here the UK standard is used.
% \begin{macrocode}
\ProvidesFile{si-named.cfg}
- [\csname si@svn@version\endcsname siunitx: SI Named units]
+ [\si@svn@version siunitx: SI Named units]
\newunit{\becquerel}{Bq}
\newunit{\coulomb}{C}
\newunit{\farad}{F}
@@ -10095,7 +10224,7 @@ author.
% This requires \file{si-prefix.cfg} and \file{si-named.cfg}.
% \begin{macrocode}
\ProvidesFile{si-prefixed.cfg}
- [\csname si@svn@version\endcsname siunitx:
+ [\si@svn@version siunitx:
SI Prefixed units]
\requiresiconfigs{prefix,named,accepted,physical}
% \end{macrocode}
@@ -10382,7 +10511,7 @@ author.
% block for the appropriate option. First currents.
% \begin{macrocode}
\ProvidesFile{si-abbr.cfg}
- [\csname si@svn@version\endcsname siunitx: Abbreviated units]
+ [\si@svn@version siunitx: Abbreviated units]
\requiresiconfigs{prefix,named,accepted,physical}
\newunit{\pA}{\pico\ampere}
\newunit{\nA}{\nano\ampere}
@@ -10594,7 +10723,7 @@ author.
% These are defined here, although some are in very general use.
% \begin{macrocode}
\ProvidesFile{si-addn.cfg}
- [\csname si@svn@version\endcsname siunitx:
+ [\si@svn@version siunitx:
SI Additional units]
\newunit{\angstrom}{\si@sym@ringA}
\newunit{\are}{a}
@@ -10644,7 +10773,7 @@ author.
%\begin{macro}{\percent}
% \begin{macrocode}
\ProvidesFile{si-accepted.cfg}
- [\csname si@svn@version\endcsname siunitx: SI Accepted units]
+ [\si@svn@version siunitx: SI Accepted units]
\newunit{\minute}{min}
\newunit{\hour}{h}
\newunit{\Day}{d}
@@ -10693,7 +10822,7 @@ author.
% for a negative kern does make things a bit complicated.
% \begin{macrocode}
\ProvidesFile{si-physical.cfg}
- [\csname si@svn@version\endcsname siunitx:
+ [\si@svn@version siunitx:
SI Physically-measured units]
\newcommand*{\si@eVspacea}{\text{\kern-\si@eVcorra}}%
\newcommand*{\si@eVspaceb}{\text{\kern-\si@eVcorrb}}%
@@ -10730,7 +10859,7 @@ author.
% own definitions.
% \begin{macrocode}
\ProvidesFile{si-synchem.cfg}
- [\csname si@svn@version\endcsname siunitx: Units for
+ [\si@svn@version siunitx: Units for
synthetic chemists]
\requiresiconfigs{prefix}
\newunit{\mmHg}{mmHg}
@@ -10752,7 +10881,7 @@ author.
% Some units inspired by \pkg{hepunits}.
% \begin{macrocode}
\ProvidesFile{si-hep.cfg}
- [\csname si@svn@version\endcsname siunitx: Units for
+ [\si@svn@version siunitx: Units for
high-energy physics]
\requiresiconfigs{prefix,named}
% \end{macrocode}
@@ -10835,7 +10964,7 @@ author.
% For astronomy, the \cs{parsec} unit is needed.
% \begin{macrocode}
\ProvidesFile{si-astro.cfg}
- [\csname si@svn@version\endcsname siunitx:
+ [\si@svn@version siunitx:
Units for astronomy]
\newunit{\parsec}{pc}
\newunit{\lightyear}{ly}
@@ -10859,7 +10988,7 @@ author.
% \SIunits. First, the binary prefixes.
% \begin{macrocode}
\ProvidesFile{si-binary.cfg}
- [\csname si@svn@version\endcsname siunitx: Binary units]
+ [\si@svn@version siunitx: Binary units]
\newprefix[binary]{\kibi}{10}{Ki}
\newprefix[binary]{\mebi}{20}{Mi}
\newprefix[binary]{\gibi}{30}{Gi}
@@ -10902,7 +11031,7 @@ author.
% default values.\footnote{The package author is in the UK.}
% \begin{macrocode}
\ProvidesFile{si-UK.cfg}
- [\csname si@svn@version\endcsname siunitx: UK locale]
+ [\si@svn@version siunitx: UK locale]
\sisetup{
unitsep=thin,
expproduct=times,
@@ -10919,7 +11048,7 @@ author.
% The same as for the UK.
% \begin{macrocode}
\ProvidesFile{si-USA.cfg}
- [\csname si@svn@version\endcsname siunitx: USA locale]
+ [\si@svn@version siunitx: USA locale]
\sisetup{
unitsep=thin,
expproduct=times,
@@ -10936,7 +11065,7 @@ author.
% Germany, hopefully.
% \begin{macrocode}
\ProvidesFile{si-DE.cfg}
- [\csname si@svn@version\endcsname siunitx: Germany locale]
+ [\si@svn@version siunitx: Germany locale]
\sisetup{
unitsep=cdot,
valuesep=thin,
@@ -10953,7 +11082,7 @@ author.
% Design decisions taken from the same section of \SIstyle.
% \begin{macrocode}
\ProvidesFile{si-ZA.cfg}
- [\csname si@svn@version\endcsname siunitx:
+ [\si@svn@version siunitx:
South Africa locale]
\sisetup{
unitsep=cdot,
@@ -10986,7 +11115,7 @@ author.
% \units for conflicting options, so users probably expect none.
% \begin{macrocode}
\ProvidesFile{si-units.cfg}
- [\csname si@svn@version\endcsname siunitx: Emulation of units]
+ [\si@svn@version siunitx: Emulation of units]
\si@emulating{units}{1998/08/04 v0.9b}
\si@ifloaded{SIunits}
{\si@emclash{units}{SIunits}\endinput}{}
@@ -11008,13 +11137,14 @@ author.
\fi
% \end{macrocode}
%\begin{macro}{\unit}
+%\doarg{number}
+%\darg{unit}
% The \units version of \cs{unit} is similar to \cs{SI}. Here and
% in \cs{unitfrac} the \cs{num} macro is used; thus the number given
% really has to be a number. However, if users are using \currpkg
% rather than \units they should expect more checking of input. As
% the \units package uses the current mode, this has to be
-% detected.\\
-%\cs{unit}\oarg{num}\marg{unit}
+% detected.
% \begin{macrocode}
\si@newrobustcmd*{\unit}[2][]{%
\ifmmode
@@ -11025,8 +11155,10 @@ author.
% \end{macrocode}
%\end{macro}
%\begin{macro}{\unitfrac}
-% \cs{unitfrac} is a bit more of a hack.\\
-%\cs{unitfrac}\oarg{num}\marg{numerator}\marg{denominator}
+%\doarg{number}
+%\darg{numerator}
+%\darg{denominator}
+% \cs{unitfrac} is a bit more of a hack.
% \begin{macrocode}
\si@newrobustcmd*{\unitfrac}[3][]{%
\begingroup
@@ -11053,7 +11185,7 @@ author.
% clash.
% \begin{macrocode}
\ProvidesFile{si-unitsdef.cfg}
- [\csname si@svn@version\endcsname siunitx:
+ [\si@svn@version siunitx:
Emulation of unitsdef]
\si@emulating{unitsdef}{2005/01/04 v0.2}
\si@ifloaded{SIunits}
@@ -11502,7 +11634,7 @@ author.
% the macros in \SIstyle as given in the manual for that package.
% \begin{macrocode}
\ProvidesFile{si-sistyle.cfg}
- [\csname si@svn@version\endcsname siunitx: Emulation of
+ [\si@svn@version siunitx: Emulation of
SIstyle]
\si@emulating{sistyle}{2006/12/20 v2.3}
\sisetup{%
@@ -11594,9 +11726,10 @@ author.
%\end{macro}
%\end{macro}
%\begin{macro}{\si@sis@savefont}
+%\darg{setting}
+%\darg{argument}
% The font definitions need a bit of extra work doing. As both
-% settings here have |@| as a letter, all should be fine.\\
-%\cs{si@sis@savefont}\marg{setting}\marg{argument}
+% settings here have |@| as a letter, all should be fine.
% \begin{macrocode}
\newcommand*{\si@sis@savefont}[2]{%
\@namedef{si@sis@#1}{#2}%
@@ -11685,7 +11818,7 @@ author.
% \SIunits emulation starts in much the same way.
% \begin{macrocode}
\ProvidesFile{si-SIunits.cfg}
- [\csname si@svn@version\endcsname siunitx: Emulation of
+ [\si@svn@version siunitx: Emulation of
SIunits]
\si@emulating{SIunits}{2007/12/02 v1.36}
\sisetup{
@@ -11878,9 +12011,11 @@ author.
%\begin{macro}{\si@siu@newunit}
%\begin{macro}{\si@siu@power}
%\begin{macro}{\si@siu@newunithook}
+%\doarg{power}
+%\darg{numerator}
+%\darg{denominator}
% To save some code, making new units which need a \texttt{\ldots np}
-% variant is handled by a dedicated macro.\\
-%\cs{si@siu@addunit}\oarg{power}\marg{pre}\marg{post}
+% variant is handled by a dedicated macro.
% \begin{macrocode}
\newcommand*{\si@siu@newunit}[3][]{%
% \end{macrocode}
@@ -12028,8 +12163,8 @@ author.
\let\kilogramsquaremetrenp\kilogramsquaremetre
% \end{macrocode}
%\begin{macro}{\si@siu@newprefix}
-% To generate the prefixes correctly, a small saving in repetition.\\
-%\cs{si@siu@newprefix}\marg{prefix}
+%\darg{prefix}
+% To generate the prefixes correctly, a small saving in repetition.
% \begin{macrocode}
\newcommand*{\si@siu@newprefix}[1]{%
\edef\si@tempa{\expandafter\noexpand\csname #1d\endcsname}%
@@ -12245,7 +12380,7 @@ author.
% which are not really to be encouraged.
% \begin{macrocode}
\ProvidesFile{si-hepunits.cfg}
- [\csname si@svn@version\endcsname Emulation of siunitx:
+ [\si@svn@version Emulation of siunitx:
hepunits]
\si@emulating{hepunits}{2007/09/27}
\requiresiconfigs{SIunits,accepted,prefix,hep}
@@ -12400,7 +12535,7 @@ author.
% a little emulation and a few macros needed.
% \begin{macrocode}
\ProvidesFile{si-fancynum.cfg}
- [\csname si@svn@version\endcsname Emulation of siunitx:
+ [\si@svn@version Emulation of siunitx:
fancynum]
\si@emulating{fancynum}{2000/08/08 0.92}
\sisetup{decimalsymbol=cdot,digitsep=comma}
@@ -12462,7 +12597,7 @@ author.
% test is needed.
% \begin{macrocode}
\ProvidesFile{si-fancyunits.cfg}
- [\csname si@svn@version\endcsname Emulation of siunitx:
+ [\si@svn@version Emulation of siunitx:
fancyunits]
\si@emulating{fancyunits}{2007/02/01 v1.0.1}
\si@ifloaded{SIunits}
@@ -12663,8 +12798,14 @@ author.
\usepackage[scaled=0.95]{helvet}
\usepackage[version=3]{mhchem}
\usepackage[osf]{mathpazo}
-\usepackage{booktabs,array,url,courier,xspace,etoolbox,varioref}
+\usepackage{booktabs,array,url,courier,xspace,varioref}
\usepackage{upgreek,ifpdf,float,caption,longtable,babel}
+\begingroup
+ \@ifundefined{eTeXversion}
+ {\aftergroup\@gobble}
+ {\aftergroup\@firstofone}
+\endgroup
+{\usepackage{etoolbox}}
\floatstyle{plaintop}
\restylefloat{table}
\labelformat{figure}{\figurename~#1}
@@ -12820,9 +12961,11 @@ author.
\DeclareRobustCommand*{\XeTeX}
{X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX}
\providecommand*{\CTAN}{\textsc{ctan}}
-\patchcmd{\@addmarginpar}
- {\@latex@warning@no@line {Marginpar on page \thepage\space moved}}
- {\relax}{}{}
+\@ifpackageloaded{etoolbox}
+ {\patchcmd{\@addmarginpar}
+ {\@latex@warning@no@line {Marginpar on page \thepage\space moved}}
+ {\relax}{}{}}
+ {}
\newcounter{argument}
\g@addto@macro\endmacro{\setcounter{argument}{0}}
\newcommand*\darg[1]{%