summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/supp-num.mkiv
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/supp-num.mkiv
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/supp-num.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/supp-num.mkiv128
1 files changed, 20 insertions, 108 deletions
diff --git a/Master/texmf-dist/tex/context/base/supp-num.mkiv b/Master/texmf-dist/tex/context/base/supp-num.mkiv
index 68b775403e3..be0df026da4 100644
--- a/Master/texmf-dist/tex/context/base/supp-num.mkiv
+++ b/Master/texmf-dist/tex/context/base/supp-num.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Numbers,
%D author=Hans Hagen,
%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
@@ -45,30 +45,30 @@
%D \stopbuffer
%D
%D \typebuffer
-%D
-%D This is typset as:
-%D
-%D \startlines
-%D \getbuffer
-%D \stoplines
+%
+% This is typset as:
+%
+% \startlines
+% \getbuffer
+% \stoplines
%D
%D The sign can be typeset as is or within the space of a
%D digit.
%D
%D \startbuffer
%D \setdigitsign 0 \digits +12.345,90
-%D \setdigitmode 1 \digits +12.345,90
-%D \setdigitmode 2 \digits +12.345,90
-%D \setdigitmode 3 \digits +12.345,90
+%D \setdigitsign 1 \digits +12.345,90
+%D \setdigitsign 2 \digits +12.345,90
+%D \setdigitsign 3 \digits +12.345,90
%D \stopbuffer
%D
%D \typebuffer
%D
-%D This is typset as:
-%D
-%D \startlines
-%D \getbuffer
-%D \stoplines
+% This is typset as:
+%
+% \startlines
+% \getbuffer
+% \stoplines
\chardef\digitoutputmode=1 % 0..6
\chardef\digitsignmode =0 % 0..3
@@ -95,10 +95,7 @@
%D the grouped call, the other branch handles the fuzzy
%D delimited calls.
-\ifx\mbox\undefined \let\mbox\normalhbox \fi
-
-% \unexpanded\def\digits
-% {\bgroup\let~@\doifnextbgroupelse\dodigits\grabdigit}
+\ifdefined\mbox \else \let\mbox\hbox \fi
\unexpanded\def\digits
{\bgroup
@@ -357,10 +354,10 @@
%D \stopbuffer
%D
%D \typebuffer
-%D
-%D \startlines
-%D \getbuffer
-%D \stoplines
+%
+% \startlines
+% \getbuffer
+% \stoplines
%D \macros
%D {Digits}
@@ -417,88 +414,3 @@
\fi\fi}
\protect \endinput
-
-
-\endinput
-
-\def\digitszeropadding {\zeroamount}
-\def\digitsnegative {\mathematics\negative}
-\def\digitspositive {\mathematics\positive}
-\def\digitsspace {\hphantom{0}}
-\def\digitsseparatorspace{\hphantom{.}}
-\def\digitssignspace {\hphantom{+}}
-\def\digitshighspace {\hphantom{\mathematics\positive}}
-\def\digitspower {\high}
-
-\starttext
-
-% print(table.serialize(table.keys(jobs)))
-
-local P, S, R, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.Cs
-
-local done = false
-local swap = false
-local digit = R("09")
-local sign = S("+-")
-local power = S("^e")
-local space = S(" ~@_")
-local comma = P(",")
-local period = P(".")
-local signspace = P("/")
-local positive = P("p")
-local negative = P("n")
-local highspace = P("s")
-local padding = P("=")
-
-local space = space / "\\digitsspace"
-local digit = digit / function(s) done = true return s end
-local separator = comma / function(s) if not done then return "\\digitsseparatorspace" elseif swap then return "." else return "," end end
- + period / function(s) if not done then return "\\digitsseparatorspace" elseif swap then return "," else return "." end end
-local signspace = signspace / "\\digitssignspace"
-local positive = positive / "\\digitspositive"
-local negative = negative / "\\digitsnegative"
-local highspace = highspace / "\\digitshighspace"
-local power = power/"" * (Cs((sign + signspace)^0 * digit^1) / function(s) return "\\digitspower{" .. s .. "}" end)
-local padding = padding / "\\digitszeropadding"
-
-local replace = lpeg.Cs (
- (sign + signspace + positive + negative + highspace)^0
- * (separator^0 * (space + digit)^1)^1
- * power^0
-)
-
-local function digits(str)
- done = false
---~ swap = true
- local str = lpeg.match(replace,str)
--- print(str)
- tex.sprint(tex.ctxcatcodes,"\\dontleavehmode",str,"\\par")
-end
--- namespaces.register("digits")
-
-digits("12")
-digits("~~~.~~~.~~~.68.712,34")
-digits("~~~.~~~.~~~.68.712,34")
-digits("___.___.111.68.712,34")
-digits("111.111.111.68.712,34")
-digits("12.345,90")
-digits("12.345.000")
-digits("12,34")
-digits("392.857.230.68.712,34")
-digits("1234")
-digits("123.222,00")
-digits("123.222,==")
-digits("123.222,00^10")
-digits("123.222,00e10")
-digits("/123.222,00e-12")
-digits("-123.222,00e-12")
--- digits("+123.222,00e-12")
-digits("n123.222,00e-12")
-digits("s123.222,00e-12")
-digits("p123.222,00e/12")
-
-\stopluacode
-[[\digitsseparatorspace]]
-\stoptext
-
-