diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-15 21:29:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-15 21:29:29 +0000 |
commit | c12f1a81ed7c1f6315906e59c84f49890cb0838f (patch) | |
tree | 43761087d37e568d1ae1954e034106af63227b57 /Master/texmf-dist/source/latex | |
parent | cb2b12a269ec694bc13a04ed7ae28f1708580cce (diff) |
ionumbers (15apr14)
git-svn-id: svn://tug.org/texlive/trunk@33457 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx | 191 |
1 files changed, 112 insertions, 79 deletions
diff --git a/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx b/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx index 69982d19fec..485d5b4fa9b 100644 --- a/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx +++ b/Master/texmf-dist/source/latex/ionumbers/ionumbers.dtx @@ -3,7 +3,8 @@ % % DocStrip file for ionumbers package % -% Copyright 2007-2009,2011 Christian Schneider <software(at)chschneider(dot)eu> +% Copyright 2007-2009,2011,2012,2014 +% Christian Schneider <software(at)chschneider(dot)eu> % % idea and parts of this package based on: ziffer.sty v2.1 % Copyright Martin Vaeth <vaeth@mathematik.uni-wuerzburg.de> @@ -38,10 +39,11 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{ionumbers} -%<package> [2011/06/15 v0.3.1-alpha restyle numbers in math mode] +%<package> [2014/04/06 v0.3.3 restyle numbers in math mode] %<*driver> \documentclass[a4paper]{ltxdoc} \usepackage{ionumbers} +\usepackage{hyperref} \EnableCrossrefs \CodelineIndex \RecordChanges @@ -84,10 +86,16 @@ % \changes{v0.3.0-alpha}{2011/06/09}{added options for variable grouping % lengths; extended \LaTeX{} test file} % \changes{v0.3.1-alpha}{2011/06/15}{fix in Makefile of package} +% \changes{v0.3.2-alpha}{2012/08/20}{added examples of usage} +% \changes{v0.3.3}{2014/04/06}{fixed problem when changing the font, +% e.\,g., when loading the \textsf{MnSymbol} package; the original character +% definitions are not hard-coded anymore, but copied +% from the definitions at the beginning of the document; thanks to Michael +% Sebastian Hitziger for his bug report} % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% \CheckSum{1303} +% \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 @@ -118,15 +126,15 @@ % % \title{The \textsf{ionumbers} package\thanks{This document corresponds % to \textsf{ionumbers}~\fileversion, dated~\filedate. Copyright -% 2007--2009,2011 Christian Schneider -% \texttt{<software(at)chschneider(dot)eu>}.}} +% 2007--2009,2011,2012,2014 Christian Schneider +% \texttt{<software(at)chschneider(dot)eu>}, \url{http://chschneider.eu}.}} % \author{Christian Schneider\\ \texttt{<software(at)chschneider(dot)eu>}} % % \maketitle % % \begin{center} -% \large\textbf{\textsf{Warning: This is alpha software and may -% contain serious bugs! Use with caution and on your own risk! Check output!}} +% \large\textbf{\textsf{Warning: Use with caution and on your own risk! +% Check output!}} % \end{center} % % \tableofcontents @@ -159,69 +167,76 @@ % \subsection{General rules} % % Every input \emph{in math mode} consisting of the following characters is -% treated by this package: |.,+-0123456789| These characters get macro +% treated by this package: |.,+-0123456789|. These characters get macro % definitions. A number is any combination of these characters without % anything---not even white spaces---in between them. There are two % exceptions/special cases: % % \begin{enumerate} % \item The separator characters |.| and |,| are not treated as part of the -% number at its end. This avoids problems with lists like -% |1, 2, 3, \ldots|, where the commas are not part of in the numbers. Note, -% however, that the commas are treated as part of the numbers in the first -% two appearances in |1,2,3,\ldots|, as the commas are immediately followed -% by a digit. Please input lists with white spaces after the separators as -% shown in the first case. +% number at its end. This avoids problems with comma-separated lists +% (see below). % \item The sign characters |+| and |-| will only be considered as part of % the number, if they appear at the begining of a number. % \end{enumerate} % -% 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. 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|.) 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. +% The lower case letter |e| plays a special role. An |e| immediatly following a +% number (as defined above) can be configured as begining of the exponential +% part. The letter |e| will be eaten from the input in this case and +% substituted by some configurable output. The next number following this |e| +% in the same group (even with other characters inbetween the |e| and the +% number) will be treated as exponential part and grouped with curly braces +% |{}|. +% +% It is a good practice to always add a space before/after each number such that +% \textsf{ionumbers} knows the beginning/end of a number and does not +% misinterpret other input as part of it. +% Below, you will find a couple of examples that might lead to surprising +% output, if this rule is not followed. % % \subsection{Caveats} % +% \emph{Comma-separated lists} of numbers must be input with a space after +% each comma to prevent |,| to be treated as part of the number. An example is +% the list |1, 2, 3, \ldots|, where the commas are not part of in the numbers. +% Note, however, that the commas are treated as part of the numbers in the first +% two appearances in |1,2,3,\ldots|, as the commas are immediately followed +% by a digit. Depending on the configuration, this may lead to strange spaces +% between the numbers, disappearing commas etc. +% +% If you use \emph{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}$. The simplest way to +% prevent undesired automatic grouping is to insert a space after each digit, +% e.\,g., as in |a_{1 2 3 4}|. +% % Please be aware that the first decimal separator of a number marks the % 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 decimal separator; option will be +% |autothousandths=true| (|.| is the decimal separator; options 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. -% -% 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. In some cases, e.\,g., |$1e \sqrt 2$| or |$1e^2$| with +% \emph{syntactically incorrect} (there must not be two decimal separators in +% one number!) and the output is \emph{not} a bug. +% +% The number following an |e| which has started the exponential part is treated +% as exponential part, \emph{even if there is arbitrary input inbetween}. +% Hence, the input |$1e \Pi 2| with package option |exponent=timestento| (will +% be explained later) leads to a superscript |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). +% Again, the input is \emph{syntactically incorrect} and you might want to +% prevent |e| from being treated as start of the exponential part by adding +% a space: |$1 e \sqrt 2$| or |$1 e^2$|. % % 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). +% \textsf{ziffer} package has the same problem, by the way.) % % \section{Conflicts with other packages} % @@ -715,21 +730,24 @@ % % 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 +\AtBeginDocument{ + \mathchardef\ion@point@original=\the\mathcode`. + \mathchardef\ion@comma@original=\the\mathcode`, + \mathchardef\ion@plus@original=\the\mathcode`+ + \mathchardef\ion@minus@original=\the\mathcode`- + \mathchardef\ion@zero@original=\the\mathcode`0 + \mathchardef\ion@one@original=\the\mathcode`1 + \mathchardef\ion@two@original=\the\mathcode`2 + \mathchardef\ion@three@original=\the\mathcode`3 + \mathchardef\ion@four@original=\the\mathcode`4 + \mathchardef\ion@five@original=\the\mathcode`5 + \mathchardef\ion@six@original=\the\mathcode`6 + \mathchardef\ion@seven@original=\the\mathcode`7 + \mathchardef\ion@eight@original=\the\mathcode`8 + \mathchardef\ion@nine@original=\the\mathcode`9 + \mathchardef\ion@e@original=\the\mathcode`e + \mathchardef\ion@E@original=\the\mathcode`E +} % \end{macrocode} % % Here the |\ion@|\meta{key}|@|\meta{value} macros are defined, begining with @@ -773,20 +791,20 @@ % % Next the definitions for the decimal output separator, \ldots % \begin{macrocode} -\mathchardef\ion@decimal@point="013A -\mathchardef\ion@decimal@comma="013B -\mathchardef\ion@decimal@punctpoint="613A -\mathchardef\ion@decimal@punctcomma="613B +\def\ion@decimal@point{\mathord{\ion@point@original}} +\def\ion@decimal@comma{\mathord{\ion@comma@original}} +\def\ion@decimal@punctpoint{\mathpunct{\ion@decimal@point}} +\def\ion@decimal@punctcomma{\mathpunct{\ion@decimal@comma}} \def\ion@decimal@default{\ion@decimal@point} % \end{macrocode} % % \ldots{} the thousands output separator, \ldots % \begin{macrocode} \def\ion@thousands@none{} -\mathchardef\ion@thousands@comma="013B -\mathchardef\ion@thousands@point="013A -\mathchardef\ion@thousands@punctcomma="613B -\mathchardef\ion@thousands@punctpoint="613A +\def\ion@thousands@point{\mathord{\ion@point@original}} +\def\ion@thousands@comma{\mathord{\ion@comma@original}} +\def\ion@thousands@punctpoint{\mathpunct{\ion@decimal@point}} +\def\ion@thousands@punctcomma{\mathpunct{\ion@decimal@comma}} \def\ion@thousands@apostrophe{^\prime} \def\ion@thousands@phantom{\phantom{\ion@point@original}} \def\ion@thousands@space{\,} @@ -796,10 +814,10 @@ % \ldots{} the thousandths output separator, \ldots % \begin{macrocode} \def\ion@thousandths@none{} -\mathchardef\ion@thousandths@comma="013B -\mathchardef\ion@thousandths@point="013A -\mathchardef\ion@thousandths@punctcomma="613B -\mathchardef\ion@thousandths@punctpoint="613A +\def\ion@thousandths@point{\mathord{\ion@point@original}} +\def\ion@thousandths@comma{\mathord{\ion@comma@original}} +\def\ion@thousandths@punctpoint{\mathpunct{\ion@decimal@point}} +\def\ion@thousandths@punctcomma{\mathpunct{\ion@decimal@comma}} \def\ion@thousandths@apostrophe{^\prime} \def\ion@thousandths@phantom{\phantom{\ion@point@original}} \def\ion@thousandths@space{\,} @@ -810,10 +828,10 @@ % \begin{macrocode} \def\ion@exponent@none{} \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@ite{\mathit{\ion@e@original}\ion@currnum@exponenttrue} +\def\ion@exponent@itE{\mathit{\ion@E@original}\ion@currnum@exponenttrue} +\def\ion@exponent@rme{\mathrm{\ion@e@original}\ion@currnum@exponenttrue} +\def\ion@exponent@rmE{\mathrm{\ion@E@original}\ion@currnum@exponenttrue} \def\ion@exponent@timestento{\times10\,\ion@currnum@exponenttrue% \ion@exponent@superscripttrue} \def\ion@exponent@cdottento{\cdot10\,\ion@currnum@exponenttrue% @@ -842,15 +860,30 @@ % in math mode. % \begin{macrocode} \def\ion@separators@math@active{\mathcode`,="8000\mathcode`.="8000\relax} -\def\ion@separators@math@inactive{\mathcode`,="613B\mathcode`.="013A\relax} \def\ion@signs@math@active{\mathcode`+="8000\mathcode`-="8000\relax} -\def\ion@signs@math@inactive{\mathcode`+="202B\mathcode`-="2200\relax} \def\ion@digits@math@active{\mathcode`0="8000\mathcode`1="8000\mathcode`2="8000% \mathcode`3="8000\mathcode`4="8000\mathcode`5="8000\mathcode`6="8000% \mathcode`7="8000\mathcode`8="8000\mathcode`9="8000\relax} -\def\ion@digits@math@inactive{\mathcode`0="7030\mathcode`1="7031% - \mathcode`2="7032\mathcode`3="7033\mathcode`4="7034\mathcode`5="7035% - \mathcode`6="7036\mathcode`7="7037\mathcode`8="7038\mathcode`9="7039\relax} +\def\ion@separators@math@inactive{% + \mathcode`,=\the\ion@comma@original% + \mathcode`.=\the\ion@point@original% + \relax} +\def\ion@signs@math@inactive{% + \mathcode`+=\the\ion@plus@original% + \mathcode`-=\the\ion@minus@original% + \relax} +\def\ion@digits@math@inactive{% + \mathcode`0=\the\ion@zero@original% + \mathcode`1=\the\ion@one@original% + \mathcode`2=\the\ion@two@original% + \mathcode`3=\the\ion@three@original% + \mathcode`4=\the\ion@four@original% + \mathcode`5=\the\ion@five@original% + \mathcode`6=\the\ion@six@original% + \mathcode`7=\the\ion@seven@original% + \mathcode`8=\the\ion@eight@original% + \mathcode`9=\the\ion@nine@original% + \relax} % \end{macrocode} % % Next the user interface for making |.,+-0123456789| active/inactive follows. |