summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-12-24 23:27:00 +0000
committerKarl Berry <karl@freefriends.org>2008-12-24 23:27:00 +0000
commitb32f575da15f39882f8c3e83c838ef841cba2304 (patch)
treebcc66dba59bb83b0586b115e26142664077217d9 /Master/texmf-dist/source
parent4d5b0d9afc48f2d8e9ae1e3198a4b9adf142deae (diff)
ionumbers update (24dec08)
git-svn-id: svn://tug.org/texlive/trunk@11706 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/ionumbers/Makefile18
-rw-r--r--Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx346
2 files changed, 266 insertions, 98 deletions
diff --git a/Master/texmf-dist/source/latex/ionumbers/Makefile b/Master/texmf-dist/source/latex/ionumbers/Makefile
index 7f8740747b9..a0f196f3c16 100644
--- a/Master/texmf-dist/source/latex/ionumbers/Makefile
+++ b/Master/texmf-dist/source/latex/ionumbers/Makefile
@@ -21,13 +21,14 @@
#
PACKAGE := ionumbers
+TESTFILE := ionumbers_test
PDFLATEX := pdflatex
MAKEINDEX := makeindex
-.PHONY: all pkg doc clean distclean
+.PHONY: all pkg doc test clean distclean
-all: pkg doc
+all: pkg doc test
%.sty: %.ins %.dtx
$(RM) $@
@@ -42,17 +43,24 @@ all: pkg doc
%.gls: %.glo
$(MAKEINDEX) -s gglo.ist -o $@ $<
-%.pdf: %.dtx %.sty %.ind %.gls
+$(PACKAGE).pdf: %.pdf: %.dtx %.sty %.ind %.gls
+ $(PDFLATEX) -interaction=nonstopmode $<
+ $(PDFLATEX) -interaction=nonstopmode $<
+ $(PDFLATEX) -interaction=nonstopmode $<
+
+$(TESTFILE).pdf: %.pdf: %.tex $(PACKAGE).sty
$(PDFLATEX) -interaction=nonstopmode $<
$(PDFLATEX) -interaction=nonstopmode $<
$(PDFLATEX) -interaction=nonstopmode $<
pkg: $(PACKAGE).sty
+test: $(TESTFILE).pdf
+
doc: $(PACKAGE).pdf
clean:
- $(RM) *.aux *.glo *.gls *.idx *.ilg *.ind *.log *.toc
+ $(RM) *.aux *.glo *.gls *.idx *.ilg *.ind *.log *.toc *~
distclean: clean
- $(RM) $(PACKAGE).sty $(PACKAGE).pdf
+ $(RM) $(PACKAGE).sty $(PACKAGE).pdf $(TESTFILE).pdf
diff --git a/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx b/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx
index 211237e341a..5f8717378ba 100644
--- a/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx
+++ b/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx
@@ -38,7 +38,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{ionumbers}
-%<package> [2008/11/02 v0.2.1-alpha restyle numbers in math mode]
+%<package> [2008/12/21 v0.2.3-alpha restyle numbers in math mode]
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage{ionumbers}
@@ -69,13 +69,20 @@
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% \changes{v0.2.0-alpha}{2008/10/27}{Initial .dtx version}
-% \changes{v0.2.1-alpha}{2008/11/02}{Replaced website by e-mail address in
-% all fields containing contact information}
+% \changes{v0.2.0-alpha}{2008/10/27}{initial .dtx version}
+% \changes{v0.2.1-alpha}{2008/11/02}{replaced website by e-mail address in all
+% fields containing contact information}
+% \changes{v0.2.2-alpha}{2008/12/21}{fixed problem with single digit numbers
+% without \{\}-grouping; conflict with \textsf{amsmath}/\textsf{amsopn}
+% documented and handled with warning messages; thanks to Robert N\"{u}rnberg
+% for reporting these two problems}
+% \changes{v0.2.3-alpha}{2008/12/21}{saved one \texttt{\textbackslash if} and
+% made sign/digit macros a bit clearer}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% \CheckSum{1096}
+% %\CheckSum{1096}
+% \CheckSum{0}
%
% \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
@@ -113,7 +120,7 @@
%
% \begin{center}
% \large\textbf{\textsf{Warning: This is alpha software and may
-% contain serious bugs!}}
+% contain serious bugs! Use with caution and on your own risk! Check output!}}
% \end{center}
%
% \tableofcontents
@@ -139,17 +146,6 @@
% may be output as `$26\times10\,^{6}$'.
% \end{abstract}
%
-% \section{Conflicts with other packages}
-%
-% This package potentially conflicts with any other package that defines a
-% macro for any of the following characters: |.,+-0123456789|
-%
-% There are tests for these cases and warning or error messages may be output.
-% Please load \textsf{ionumbers} as last package to be able to detect as
-% many conflicts as possible. As there is no way to detect conflicts in all
-% cases, please report any package known to conflict with
-% \textsf{ionumbers} to the author.
-%
% \section{Details of number handling}
%
% \subsection{General rules}
@@ -174,10 +170,12 @@
%
% The lower case letter |e| plays a special role. An |e| following immediatly a
% number (without any white space or other input in between) can be configured
-% as begining of the exponential part of a number. The letter is eaten from the
+% as begining of the exponential part. The letter |e| will be eaten from the
% input in this case and substituted by some configurable output. (It is
% virtually impossible to handle it the same way as the other and assigning a
-% macro definition to |e|.)
+% macro definition to |e|.) In this case the number following an |e| in the
+% same group will be grouped with curly braces |{}|. This is important to
+% understand, e.\,g., the spacing in cases when that number begins with a sign.
%
% \subsection{Caveats}
%
@@ -185,24 +183,61 @@
% begining of the thousandths part of a number; every part of a number
% appearing left to the first decimal separator is the thousands part. That is
% why, the input |$1.234.567$| with (only) the package option
-% |autothousandths=true| (|.| is the thousands separator; option will be
+% |autothousandths=true| (|.| is the decimal separator; option will be
% explained later) will lead to `$1.234.\,567$' in the output. Note the small
% space after the second point as a result of |234.567| being treated as
% thousandths part. The thousandths separator---by default a small space---will
% be output between the third and fourth digit of the thousandths part; the
% additional point from the input will not be omitted. The input is
% syntactically incorrect (there must not be two decimal separators in one
-% number) and the output is \emph{not} a bug of this package.
+% number) and the output is \emph{not} a bug.
%
% A number following an |e| treated as exponential part of a number may be
% typeset as superscript (depending on the configuration). In the case of an
% exponential part there \emph{may} be arbitrary input between |e| and the
% number in the exponent. Especially, the input |$1e \Pi 2| with package option
% |exponent=timestento| (will be explained later) leads to a superscript
-% |2| in the output: `$1\times10\,\Pi^{2}$'. Again, the input is
-% syntactically incorrect and there is no easy way to circumvent |e| from being
-% treated as begining of the exponential part in this case (at least, I did not
-% find it).
+% |2| in the output. In some cases, e.\,g., |$1e \sqrt 2$| or |$1e^2$| with
+% |e| configured as begining of the exponential part, even an error occurs.
+% Again, the input is syntactically incorrect and there is no easy way to
+% circumvent |e| from being treated as begining of the exponential part in these
+% cases (at least, I did not find it).
+%
+% In some rare cases, e.\,g., |$\sqrt ,$| or |$a^.$|, the usage of point and
+% comma without curly braces |{}| around them will lead to an error. In these
+% cases please add curly braces |{}| around the point or comma. (The
+% \textsf{ziffer} package has the same problem.)
+%
+% If you use, e.\,g., indexes consisting of four or more digits together with
+% automatic grouping of thousands, the grouping will also apply to the
+% indexes. So |a_{1234}| might be output as $a_{1,234}$. Possibilities to
+% prevent undesired automatic grouping are on the one hand input as
+% |a_{1 2 3 4}| (with a space after at least every third digit) or on the other
+% hand selectively switching of automatic grouping (see below).
+%
+% \section{Conflicts with other packages}
+%
+% This package potentially conflicts with any other package that defines a
+% macro for any of the following characters: |.,+-0123456789|
+%
+% There are tests for these cases and warning or error messages may be output.
+% Please load \textsf{ionumbers} as \emph{last package} to be able to detect as
+% many conflicts as possible. As there is no way to detect conflicts in any
+% case, please report any package known to conflict with \textsf{ionumbers} to
+% the author.
+%
+% Packages known to conflict with \textsf{ionumbers} are:
+% \begin{mydescription}
+% \item[\textsf{ziffer}] this package can be replaced by \textsf{ionumbers}
+% except for \textsf{ziffer}'s special handling of |--| enabled by
+% |\ZifferStrichAn|
+% \item[\textsf{dcolumn}] workaround: disable \textsf{ionumbers} for tabulars
+% (e.\,g., put them inside |\ionumbersoff|\marg{\ldots})
+% \item[\textsf{amsmath}/\textsf{amsopn}] load \textsf{ionumbers} as last
+% package and disable \textsf{ionumbers} for |\operatorname|\marg{\ldots}
+% (e.\,g., put it inside\\
+% |\ionumbersoff|\marg{\ldots})
+% \end{mydescription}
%
% \section{Usage}
%
@@ -218,8 +253,10 @@
% The following options configure the meaning of separators in the \LaTeX{}
% input file:
% \begin{mydescription}
-% \item[\texttt{comma}=\meta{value}] comma `|,|' will be treated as \meta{value}
-% \item[\texttt{point}=\meta{value}] point `|.|' will be treated as \meta{value}
+% \item[\texttt{comma}=\meta{value}] comma `|,|' will be treated as
+% \meta{value}
+% \item[\texttt{point}=\meta{value}] point `|.|' will be treated as
+% \meta{value}
% \end{mydescription}
%
% The following \meta{value}s can be chosen for both of them:
@@ -245,21 +282,26 @@
% the input file. The \emph{output} of the \emph{meanings} is configured via
% the following options:
% \begin{mydescription}
-% \item[\texttt{thousands}=\meta{value}] thousands separator will be output as \meta{value}
-% \item[\texttt{decimal}=\meta{value}] decimal separator will be output as \meta{value}
-% \item[\texttt{thousandths}=\meta{value}] thousandths separator will be \meta{value}
-% \item[\texttt{exponent}=\meta{value}] exponent separator will be output as \meta{value}
+% \item[\texttt{thousands}=\meta{value}] thousands separator will be output as
+% \meta{value}
+% \item[\texttt{decimal}=\meta{value}] decimal separator will be output as
+% \meta{value}
+% \item[\texttt{thousandths}=\meta{value}] thousandths separator will be
+% \meta{value}
+% \item[\texttt{exponent}=\meta{value}] exponent separator will be output as
+% \meta{value}
% \end{mydescription}
%
-% The list of valid \meta{value}s for |thousands|, |decimal|, and |thousandths| is:
+% The list of valid \meta{value}s for |thousands|, |decimal|, and |thousandths|
+% is:
% \begin{mydescription}
% \item[\texttt{none}] will be ignored (no output)
% \item[\texttt{point}] normal point; this is the default point without
% \textsf{ionumbers}
% \item[\texttt{comma}] normal comma
% \item[\texttt{punctpoint}] punctuation point (point followed by small space)
-% \item[\texttt{punctcomma}] punctuation comma (point followed by small space);
-% this is the default comma without \textsf{ionumbers}
+% \item[\texttt{punctcomma}] punctuation comma (point followed by small
+% space); this is the default comma without \textsf{ionumbers}
% \item[\texttt{apostrophe}] apostrophe (actually |$^\prime$|; \emph{not} for
% |decimal|)
% \item[\texttt{phantom}] space with width of a point (|$\phantom{.}$|;
@@ -270,9 +312,16 @@
% |thousandths|)
% \end{mydescription}
%
-% The list of valid \meta{value}s for |exponent| is:
+% If a number is handled as exponent, it will be put into curly braces |{}|
+% for correct output of, e.\,g., signs without spacing around them (mathord).
+% In the following list of valid \meta{value}s for |exponent| a number
+% immediatly following an |e| will be handled as exponent, unless specified
+% otherwise:
% \begin{mydescription}
-% \item[\texttt{none}] will be ignored (no output)
+% \item[\texttt{none}] will be ignored (not output; following number
+% \emph{not} handled as exponent)
+% \item[\texttt{original}] a simple character `e' (following number
+% \emph{not} handled as exponent)
% \item[\texttt{ite/itE}] italic lower/upper case letter `e'
% \item[\texttt{rme/rmE}] roman lower/upper case letter `e'
% \item[\texttt{timestento}] |$\times10\,$| with following number output as
@@ -280,7 +329,7 @@
% \item[\texttt{cdottento}] |$\cdot10\,$| with following number output as
% superscript
% \item[\texttt{wedge}] |$^\wedge$|
-% \item[\texttt{default}] default behaviour of \textsf{ionumbers} (|ite|)
+% \item[\texttt{default}] default behaviour of \textsf{ionumbers} (|original|)
% \end{mydescription}
%
% \subsection{Package options concerning automatic grouping}
@@ -594,10 +643,11 @@
\newcommand*\renewionumbersexponent{%
\@ifstar{\renewionumbersexponent@@}{\renewionumbersexponent@}}
\newcommand*\renewionumbersexponent@[2]{\expandafter\renewcommand%
- \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}}}
+ \expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}%
+ \ion@currnum@exponent}}
\newcommand*\renewionumbersexponent@@[2]{\expandafter\renewcommand%
\expandafter*\csname ion@exponent@#1\endcsname{\ionumbersoff{#2}%
- \ion@exponent@superscripttrue}}
+ \ion@currnum@exponent\ion@exponent@superscripttrue}}
% \end{macrocode}
% \end{macro}
%
@@ -606,13 +656,23 @@
% \subsection{Internal macros holding definitions for \meta{key}=\meta{value}
% pairs}
%
-% First of all, macros with the original character definitions of |.,+-| are
-% defined.
+% First of all, macros with the original character definitions are defined.
% \begin{macrocode}
\mathchardef\ion@point@original="013A
\mathchardef\ion@comma@original="613B
\mathchardef\ion@plus@original="202B
\mathchardef\ion@minus@original="2200
+\mathchardef\ion@zero@original="7030
+\mathchardef\ion@one@original="7031
+\mathchardef\ion@two@original="7032
+\mathchardef\ion@three@original="7033
+\mathchardef\ion@four@original="7034
+\mathchardef\ion@five@original="7035
+\mathchardef\ion@six@original="7036
+\mathchardef\ion@seven@original="7037
+\mathchardef\ion@eight@original="7038
+\mathchardef\ion@nine@original="7039
+\mathchardef\ion@e@original="7165
% \end{macrocode}
%
% Here the |\ion@|\meta{key}|@|\meta{value} macros are defined, begining with
@@ -692,14 +752,17 @@
% \ldots{} and the exponent output separator are given.
% \begin{macrocode}
\def\ion@exponent@none{}
-\mathchardef\ion@exponent@ite="7165
-\mathchardef\ion@exponent@itE="7145
-\mathchardef\ion@exponent@rme="7065
-\mathchardef\ion@exponent@rmE="7045
-\def\ion@exponent@timestento{\times10\,\ion@exponent@superscripttrue}
-\def\ion@exponent@cdottento{\cdot10\,\ion@exponent@superscripttrue}
-\def\ion@exponent@wedge{^\wedge}
-\def\ion@exponent@default{\ion@exponent@ite}
+\def\ion@exponent@original{\ion@e@original}
+\def\ion@exponent@ite{\mathchar"7165\ion@currnum@exponenttrue}
+\def\ion@exponent@itE{\mathchar"7145\ion@currnum@exponenttrue}
+\def\ion@exponent@rme{\mathchar"7065\ion@currnum@exponenttrue}
+\def\ion@exponent@rmE{\mathchar"7045\ion@currnum@exponenttrue}
+\def\ion@exponent@timestento{\times10\,\ion@currnum@exponenttrue%
+ \ion@exponent@superscripttrue}
+\def\ion@exponent@cdottento{\cdot10\,\ion@currnum@exponenttrue%
+ \ion@exponent@superscripttrue}
+\def\ion@exponent@wedge{^\wedge\ion@currnum@exponenttrue}
+\def\ion@exponent@default{\ion@exponent@original}
% \end{macrocode}
%
% ---------------------------------------------------------------------
@@ -764,11 +827,11 @@
%
% The macro definitions for the characters |.,+-0123456789| are hold in the
% following macros. Number processing works by looking at the next character
-% and performing on or more from the following actions:
+% and performing one or more from the following actions:
% \begin{itemize}
% \item the currently configured output for the character will be added to
-% the end of |\ion@comma@curr| by |\ion@currnum@pushback|;
-% |\ion@comma@curr| stores the currently processed number
+% the end of |\ion@currnum| by |\ion@currnum@append|;
+% |\ion@currnum| stores the currently processed number
% \item only for comma/point: the corresponding |after...| macro will be
% issued
% \item the currently processed number will be output via
@@ -776,19 +839,20 @@
% \item the |e| will be eaten and replaced by its configured output
% \end{itemize}
% The conditions in the macro definitions should be self-explanatory for each
-% character.
-%
+% character. The extra |\ion@startnumber| is required to avoid problems with
+% input like |$a_0$| or |$\sqrt 2$|, where curly braces around |0| and |2| have
+% been omitted.
% \begin{macrocode}
\def\ion@comma{%
\ion@ifnextdigit{%
- \ion@currnum@pushback*{\ion@comma@curr}\ion@aftercomma@curr%
+ \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr%
}{%
\ion@ifnextseparator{%
- \ion@currnum@pushback*{\ion@comma@curr}\ion@aftercomma@curr%
+ \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr%
\@warning{Too many separators}%
}{%
\ion@ifnextchar e{%
- \ion@currnum@pushback*{\ion@comma@curr}\ion@aftercomma@curr%
+ \ion@currnum@append*{\ion@comma@curr}\ion@aftercomma@curr%
\ion@currnum@output\ion@exponent@curr\@gobble%
}{%
\ion@currnum@output\ion@comma@original%
@@ -798,14 +862,14 @@
}
\def\ion@point{%
\ion@ifnextdigit{%
- \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr%
+ \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr%
}{%
\ion@ifnextseparator{%
- \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr%
+ \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr%
\@warning{Too many separators}%
}{%
\ion@ifnextchar e{%
- \ion@currnum@pushback*{\ion@point@curr}\ion@afterpoint@curr%
+ \ion@currnum@append*{\ion@point@curr}\ion@afterpoint@curr%
\ion@currnum@output\ion@exponent@curr\@gobble%
}{%
\ion@currnum@output\ion@point@original%
@@ -814,36 +878,51 @@
}%
}
\def\ion@plus{%
+ \ion@iffirstchar{%
+ \ion@plus@original%
+ }{%
+ \ion@currnum@append*{\ion@plus@original}%
+ }%
\ion@ifnextdigit{%
- \ion@currnum@pushback*{\ion@plus@original}%
+ %% nothing
}{%
\ion@ifnextseparator{%
- \ion@currnum@pushback*{\ion@plus@original}%
+ %% nothing
}{%
\ion@ifnextsign{%
- \ion@currnum@pushback*{\ion@plus@original}\@warning{Too many signs}%
+ \@warning{Too many signs}%
}{%
- \ion@currnum@output\ion@plus@original%
+ \ion@currnum@output%
}%
}%
}%
}
\def\ion@minus{%
+ \ion@iffirstchar{%
+ \ion@minus@original%
+ }{%
+ \ion@currnum@append*{\ion@minus@original}%
+ }%
\ion@ifnextdigit{%
- \ion@currnum@pushback*{\ion@minus@original}%
+ %% nothing
}{%
\ion@ifnextseparator{%
- \ion@currnum@pushback*{\ion@minus@original}%
+ %% nothing
}{%
\ion@ifnextsign{%
- \ion@currnum@pushback*{\ion@minus@original}\@warning{Too many signs}%
+ \@warning{Too many signs}%
}{%
- \ion@currnum@output\ion@minus@original%
+ \ion@currnum@output%
}%
}%
}%
}
-\def\ion@zero{\ion@currnum@pushback{\mathchar"7030}%
+\def\ion@zero{%
+ \ion@iffirstchar{%
+ \ion@zero@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@zero@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -858,7 +937,12 @@
}%
}%
}
-\def\ion@one{\ion@currnum@pushback{\mathchar"7031}%
+\def\ion@one{%
+ \ion@iffirstchar{%
+ \ion@one@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@one@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -873,7 +957,12 @@
}%
}%
}
-\def\ion@two{\ion@currnum@pushback{\mathchar"7032}%
+\def\ion@two{%
+ \ion@iffirstchar{%
+ \ion@two@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@two@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -888,7 +977,12 @@
}%
}%
}
-\def\ion@three{\ion@currnum@pushback{\mathchar"7033}%
+\def\ion@three{%
+ \ion@iffirstchar{%
+ \ion@three@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@three@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -903,7 +997,12 @@
}%
}%
}
-\def\ion@four{\ion@currnum@pushback{\mathchar"7034}%
+\def\ion@four{%
+ \ion@iffirstchar{%
+ \ion@four@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@four@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -918,7 +1017,12 @@
}%
}%
}
-\def\ion@five{\ion@currnum@pushback{\mathchar"7035}%
+\def\ion@five{%
+ \ion@iffirstchar{%
+ \ion@five@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@five@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -933,7 +1037,12 @@
}%
}%
}
-\def\ion@six{\ion@currnum@pushback{\mathchar"7036}%
+\def\ion@six{%
+ \ion@iffirstchar{%
+ \ion@six@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@six@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -948,7 +1057,12 @@
}%
}%
}
-\def\ion@seven{\ion@currnum@pushback{\mathchar"7037}%
+\def\ion@seven{%
+ \ion@iffirstchar{%
+ \ion@seven@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@seven@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -963,7 +1077,12 @@
}%
}%
}
-\def\ion@eight{\ion@currnum@pushback{\mathchar"7038}%
+\def\ion@eight{%
+ \ion@iffirstchar{%
+ \ion@eight@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@eight@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -978,7 +1097,12 @@
}%
}%
}
-\def\ion@nine{\ion@currnum@pushback{\mathchar"7039}%
+\def\ion@nine{%
+ \ion@iffirstchar{%
+ \ion@nine@original\ion@currnum@append{}%
+ }{%
+ \ion@currnum@append{\ion@nine@original}%
+ }%
\ion@ifnextdigit{%
%% nothing
}{%
@@ -1020,6 +1144,26 @@
\endgroup
% \end{macrocode}
%
+% If one of |+-0123456789| is the first character of a number and this number
+% not part of an exponent, then argument `1' will be used; otherwise argument
+% `2' will be used. This macro is required to handle single characters not
+% grouped in curly braces |{}| in expressions like |$a^0$| or |$\sqrt 2$|
+% correctly.
+% \begin{macrocode}
+\def\ion@iffirstchar#1#2{%
+ \ifion@currnum@exponent%
+ #2%
+ \else%
+ \ifion@currnum@firstchar%
+ #1%
+ \else
+ #2%
+ \fi%
+ \fi%
+ \ion@currnum@firstcharfalse%
+}
+% \end{macrocode}
+%
% Now the macros for the conditions in the above definitions follow. There are
% tests for a digit |0123456789|, \ldots
% \begin{macrocode}
@@ -1114,12 +1258,17 @@
Do not load both packages in the same document}{}}{}}
\newcommand*{\ion@problem@package}[2]{%
\@ifpackageloaded{#1}{\PackageWarning{ionumbers}%
- {Loading #1 and ionumbers is\MessageBreak%
- problematic!\MessageBreak%
+ {Loading #1 and ionumbers is problematic!\MessageBreak%
#2}{}}}
+
\AtBeginDocument{%
\ion@conflict@package{ziffer}%
\ion@problem@package{dcolumn}{Use `tabular's inside \string\ionumbersoff}%
+ \ion@problem@package{amsmath}{Load ionumbers after amsmath}%
+ \ion@problem@package{amsmath}{Use \string\operatorname\space inside
+ \string\ionumbersoff}%
+ \ion@problem@package{amsopn}{Use \string\operatorname\space inside
+ \string\ionumbersoff}%
}
% \end{macrocode}
%
@@ -1196,8 +1345,8 @@
% internal macro to be able to automatically group digits. The basic idea when
% adding single characters is
% \begin{itemize}
-% \item remember, whether we processing the thousands or the thousandths part
-% of a number (|\ifion@beforedecimal|)
+% \item remember, whether we are processing the thousands or the thousandths
+% part of a number (|\ifion@beforedecimal|)
% \item calculate the number of digits processed modulo 3 plus 1 in the
% current part and
% \begin{itemize}
@@ -1215,8 +1364,10 @@
%
% First of all, the |if|s, counters and empty separator macros are initialized.
% \begin{macrocode}
+\newif\ifion@currnum@firstchar\ion@currnum@firstchartrue
\newif\ifion@beforedecimal\ion@beforedecimaltrue
\newif\ifion@noexplicitthousands\ion@noexplicitthousandstrue
+\newif\ifion@currnum@exponent\ion@currnum@exponentfalse
\newif\ifion@exponent@superscript\ion@exponent@superscriptfalse
\newcount\ion@thousands@currpos\ion@thousands@currpos=0
\newcount\ion@thousandths@currpos\ion@thousandths@currpos=0
@@ -1227,16 +1378,18 @@
\def\ion@thousandths@sep{}
% \end{macrocode}
%
-% The macro |\ion@currnum@pushback| adds the character in its argument to
-% the end of |\ion@currnum|. In the starred version adding an empty separator
+% The macro |\ion@currnum@append| adds the character in its argument to the
+% end of |\ion@currnum|. In the starred version adding of an empty separator
% macros is omitted.
% \begin{macrocode}
-\newcommand{\ion@currnum@pushback}{\@ifstar{\ion@currnum@pushback@@}%
- {\ion@currnum@pushback@}}
-\newcommand*{\ion@currnum@pushback@@}[1]{%
+\newcommand{\ion@currnum@append}{%
+ \ion@currnum@firstcharfalse%
+ \@ifstar{\ion@currnum@append@@}{\ion@currnum@append@}%
+}
+\newcommand*{\ion@currnum@append@@}[1]{%
\ion@addto@macro{\ion@currnum}{#1}%
}
-\newcommand*{\ion@currnum@pushback@}[1]{%
+\newcommand*{\ion@currnum@append@}[1]{%
\ifion@beforedecimal%
%% push back (empty) separator and character
\ifcase\ion@thousands@currpos%
@@ -1294,19 +1447,26 @@
\def\ion@thousandths@sep{\ion@thousandths@curr}%
\fi%
%% output number
- \ifion@exponent@superscript%
- ^{\ion@currnum}%
- \else%
+ \ifion@currnum@exponent%
+ \ifion@exponent@superscript%
+ ^{\ion@currnum}%
+ \else%
+ {\ion@currnum}%
+ \fi%
+ \else
\ion@currnum%
- \fi%
+ \fi
\endgroup%
%% reset stuff for next number
\ion@thousands@currpos=0%
\ion@thousandths@currpos=0%
\def\ion@currnum{}%
+ \ion@currnum@firstchartrue%
\ion@beforedecimaltrue%
\ion@noexplicitthousandstrue%
- \ion@exponent@superscriptfalse}
+ \ion@currnum@exponentfalse%
+ \ion@exponent@superscriptfalse%
+}
% \end{macrocode}
%
% This macro is identical to |\l@addto@macro| from \textsf{koma-script bundle}.