summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2008-04-18 14:17:00 +0200
committerHans Hagen <pragma@wxs.nl>2008-04-18 14:17:00 +0200
commitd948cb4eddff16f17051d8078b4c55cdd8e8f681 (patch)
tree633b47f4e9bf041c8b17002daf06d7e735bbc7b7 /tex
parent66c43ffc47e4bf28c112bc5c593d1853212f7715 (diff)
downloadcontext-d948cb4eddff16f17051d8078b4c55cdd8e8f681.tar.gz
stable 2008.04.18 14:17
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-buf.lua58
-rw-r--r--tex/context/base/core-buf.mkiv2
-rw-r--r--tex/context/base/core-int.tex757
-rw-r--r--tex/context/base/core-nav.tex2
-rw-r--r--tex/context/base/core-pos.lua73
-rw-r--r--tex/context/base/core-pos.mkiv4
-rw-r--r--tex/context/base/core-ref.tex6
-rw-r--r--tex/context/base/font-tfm.lua7
-rw-r--r--tex/context/base/l-dir.lua57
-rw-r--r--tex/context/base/l-lpeg.lua18
-rw-r--r--tex/context/base/luat-tex.lua14
-rw-r--r--tex/context/base/lxml-ini.lua14
-rw-r--r--tex/context/base/mlib-pps.lua1
-rw-r--r--tex/context/base/mult-sys.tex12
-rw-r--r--tex/context/base/page-mul.tex4
-rw-r--r--tex/context/base/syst-gen.tex2
-rw-r--r--tex/context/base/unic-ini.mkii3
-rw-r--r--tex/context/base/x-mmp.mkiv46
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-fr.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
27 files changed, 490 insertions, 608 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 2a4f9ac50..37c9facfa 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2008.04.16 17:34}
+\newcontextversion{2008.04.18 14:17}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index cf6aec247..f1c5dd750 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -42,7 +42,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2008.04.16 17:34}
+\edef\contextversion{2008.04.18 14:17}
%D For those who want to use this:
diff --git a/tex/context/base/core-buf.lua b/tex/context/base/core-buf.lua
index b1e956603..4203486f6 100644
--- a/tex/context/base/core-buf.lua
+++ b/tex/context/base/core-buf.lua
@@ -57,8 +57,6 @@ function buffers.grab(name,begintag,endtag,data)
end
buffers.data[name] = buffers.data[name]:gsub("[\010\013]$","")
if buffers.flags.store_as_table then
- -- todo: specific splitter, do we really want to erase the spaces?
- --~ buffers.data[name] = string.split(buffers.data[name]," *[\010\013]")
buffers.data[name] = buffers.data[name]:splitlines()
end
end
@@ -84,7 +82,7 @@ buffers.commands.empty_line_command = "\\doverbatimemptyline"
function buffers.verbatimbreak(n,m)
if buffers.flags.optimize_verbatim then
- if (n==2) or (n==m) then
+ if n == 2 or n == m then
texsprint(buffers.commands.no_break)
else
texsprint(buffers.commands.do_break)
@@ -92,34 +90,76 @@ function buffers.verbatimbreak(n,m)
end
end
+function buffers.strip(lines)
+ local first, last = 1, #lines
+ for i=first,last do
+ if #lines[i] == 0 then
+ first = first + 1
+ else
+ break
+ end
+ end
+ for i=last,first,-1 do
+ if #lines[i] == 0 then
+ last = last - 1
+ else
+ break
+ end
+ end
+ return first, last, last - first + 1
+end
+
function buffers.type(name)
local lines = buffers.data[name]
local action = buffers.typeline
if lines then
if type(lines) == "string" then
- lines = lines:splitlines() -- lines:split(" *[\010\013]")
+ lines = lines:splitlines()
end
- local line, n, m = 0, 0, #lines
- for i=1,m do
+ local line, n = 0, 0
+ local first, last, m = buffers.strip(lines)
+ for i=first,last do
n, line = action(lines[i], n, m, line)
end
end
end
+--~ function buffers.typefile(name)
+--~ local t = input.openfile(name)
+--~ local action = buffers.typeline
+--~ if t then
+--~ local line, n, m = 0, 0, t.noflines
+--~ while true do
+--~ str = t.reader(t)
+--~ if str then
+--~ n, line = action(str, n, m, line)
+--~ else
+--~ break
+--~ end
+--~ end
+--~ t.close()
+--~ end
+--~ end
+
function buffers.typefile(name)
local t = input.openfile(name)
local action = buffers.typeline
if t then
- local line, n, m = 0, 0, t.noflines
+ local lines = { }
while true do
- str = t.reader(t)
+ local str = t.reader()
if str then
- n, line = action(str, n, m, line)
+ lines[#lines+1] = str
else
break
end
end
t.close()
+ local line, n = 0, 0
+ local first, last, m = buffers.strip(lines)
+ for i=first,last do
+ n, line = action(lines[i], n, m, line)
+ end
end
end
diff --git a/tex/context/base/core-buf.mkiv b/tex/context/base/core-buf.mkiv
index 09f4f552e..c313fc450 100644
--- a/tex/context/base/core-buf.mkiv
+++ b/tex/context/base/core-buf.mkiv
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% this will become a proper new verbatim module
+
\unprotect
\registerctxluafile{core-buf}{1.001}
diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex
index 38763ea4b..003a9a390 100644
--- a/tex/context/base/core-int.tex
+++ b/tex/context/base/core-int.tex
@@ -157,10 +157,6 @@
\unprotect
-\definesystemconstant {link}
-
-\definesystemvariable {lk}
-
% \expand vs \expanded
% linked registers implementeren als een koppeling == mooier
@@ -177,13 +173,13 @@
{\expanded{\definetwopasslist{\s!link:#1}}%
\expanded{\doloadtwopassdata{\s!link:#1}}%
\getfirsttwopassdata{\s!link:#1}%
- \setxvalue{\s!link:#1:f}{\twopassdata}%
+ \letgvalue{\s!link:#1:f}\twopassdata
\getlasttwopassdata{\s!link:#1}%
- \setxvalue{\s!link:#1:l}{\twopassdata}%
- \setxvalue{\s!link:#1:s}{\noftwopassitems}%
+ \letgvalue{\s!link:#1:l}\twopassdata
+ \letgvalue{\s!link:#1:s}\noftwopassitems
\gettwopassdata{\s!link:#1}%
- \setxvalue{\s!link:#1:c}{\twopassdata}%
- \setxvalue{\s!link:#1:n}{\twopassdata}}}
+ \letgvalue{\s!link:#1:c}\twopassdata
+ \letgvalue{\s!link:#1:n}\twopassdata}}
\def\koppeling[#1]#2%
{\bgroup
@@ -191,38 +187,37 @@
\doglobal\increment\numberoflinks
\gettwopassdata{\s!link:#1}%
\edef\numberoflinks{0\getvalue{\s!link:#1:s}}%
- \edef\firstlink{0\getvalue{\s!link:#1:f}}%
- \edef\lastlink{0\getvalue{\s!link:#1:l}}%
- \edef\currentlink{0\getvalue{\s!link:#1:n}}%
- \edef\prevlink{0\getvalue{\s!link:#1:c}}%
+ \edef\firstlink {0\getvalue{\s!link:#1:f}}%
+ \edef\lastlink {0\getvalue{\s!link:#1:l}}%
+ \edef\currentlink {0\getvalue{\s!link:#1:n}}%
+ \edef\prevlink {0\getvalue{\s!link:#1:c}}%
\iftwopassdatafound
\edef\nextlink{0\twopassdata}%
- \setxvalue{\s!link:#1:n}{\nextlink}%
- \setxvalue{\s!link:#1:c}{\currentlink}%
+ \letgvalue{\s!link:#1:n}\nextlink
+ \letgvalue{\s!link:#1:c}\currentlink
\else
- \edef\nextlink {0\getvalue{\s!link:#1:l}}%
+ \edef\nextlink{0\getvalue{\s!link:#1:l}}%
\fi
\lazysavetwopassdata{\s!link:#1}{\numberoflinks}{\noexpand\realfolio}%
- \ifnum\noflinks<2
+ \ifnum\noflinks<\plustwo
\locationfalse
\fi
\iflocation
\hbox
- {%\setupinteraction[\c!width=\!!zeropoint]%
- \setinteractionparameter\c!width\!!zeropoint
- \doganaareenpagina\??lk\gotobegincharacter\firstlink\hss
- \ifnum\noflinks>2
- \hskip\@@lkafstand
- \doganaareenpagina\??lk\gobackwardcharacter\prevlink\hss
+ {\setinteractionparameter\c!width\!!zeropoint
+ \dogotosomepage\??lk\gotobegincharacter\firstlink\hss
+ \ifnum\noflinks>\plustwo
+ \hskip\@@lkdistance
+ \dogotosomepage\??lk\gobackwardcharacter\prevlink\hss
\fi
- \hskip\@@lkafstand
+ \hskip\@@lkdistance
#2\relax
- \hskip\@@lkafstand
- \ifnum\noflinks>2
- \doganaareenpagina\??lk\goforwardcharacter\nextlink\hss
- \hskip\@@lkafstand
+ \hskip\@@lkdistance
+ \ifnum\noflinks>\plustwo
+ \dogotosomepage\??lk\goforwardcharacter\nextlink\hss
+ \hskip\@@lkdistance
\fi
- \doganaareenpagina\??lk\gotoendcharacter\lastlink}%
+ \dogotosomepage\??lk\gotoendcharacter\lastlink}%
\else
\hbox{#2}%
\fi
@@ -239,8 +234,7 @@
\gettwopassdata{\s!link:#1}%
\let\currentlink\twopassdata
\let\nextlink\twopassdata
- \setxvalue{\s!link:#1:}%
- {\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}}}
+ \setxvalue{\s!link:#1:}{\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}}}
\def\koppeling[#1]#2%
{\bgroup
@@ -254,29 +248,26 @@
\edef\prevlink {0##4}%
\edef\currentlink{0##5}}%
\expanded{\next[\getvalue{\s!link:#1:}]}%
- \edef\nextlink
- {0\iftwopassdatafound\twopassdata\else\lastlink\fi}%
- \setxvalue{\s!link:#1:}%
- {\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}%
+ \edef\nextlink{0\iftwopassdatafound\twopassdata\else\lastlink\fi}%
+ \setxvalue{\s!link:#1:}{\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}%
\lazysavetwopassdata{\s!link:#1}{\numberoflinks}{\noexpand\realfolio}%
- \ifnum\noflinks<2
+ \ifnum\noflinks<\plustwo
\locationfalse
\fi
\iflocation
\hbox
- {%\setupinteraction[\c!width=\!!zeropoint]%
- \setinteractionparameter\c!width\!!zeropoint
+ {\setinteractionparameter\c!width\!!zeropoint
#2\relax
- \hskip\@@lkafstand
- \doganaareenpagina\??lk\gotobegincharacter\firstlink\hss
- \ifnum\noflinks>2
- \doganaareenpagina\??lk\gobackwardcharacter\prevlink\hss
+ \hskip\@@lkdistance
+ \dogotosomepage\??lk\gotobegincharacter\firstlink\hss
+ \ifnum\noflinks>\plustwo
+ \dogotosomepage\??lk\gobackwardcharacter\prevlink\hss
\fi
- \ifnum\noflinks>2
- \doganaareenpagina\??lk\goforwardcharacter\nextlink\hss
- \hskip\@@lkafstand
+ \ifnum\noflinks>\plustwo
+ \dogotosomepage\??lk\goforwardcharacter\nextlink\hss
+ \hskip\@@lkdistance
\fi
- \doganaareenpagina\??lk\gotoendcharacter\lastlink}%
+ \dogotosomepage\??lk\gotoendcharacter\lastlink}%
\else
\hbox{#2}%
\fi
@@ -286,36 +277,22 @@
\def\docalculateinteractionscreen
{\doifelse\@@scwidth\v!fit
- {\!!widtha\leftedgewidth
- \advance\!!widtha \leftedgedistance
- \advance\!!widtha \leftmarginwidth
- \advance\!!widtha \leftmargindistance
+ {\!!widtha\leftcombitotal
\ifdim\backspace>\!!widtha\ifdim\backspace>\zeropoint\relax
\advance\backspace -\!!widtha
\fi\fi
- \advance\!!widtha \makeupwidth
- \advance\!!widtha \rightmargindistance
- \advance\!!widtha \rightmarginwidth
- \advance\!!widtha \rightedgedistance
- \advance\!!widtha \rightedgewidth
- \scratchdimen\@@scbackspace
- \advance\scratchdimen \@@schoroffset
- \advance\!!widtha 2\scratchdimen}
+ \advance\!!widtha\rightcombitotal
+ \advance\!!widtha 2\dimexpr\@@scbackspace+\@@schoroffset\relax}
{\doifelse\@@scwidth\v!max
{\!!widtha\printpaperwidth}
{\!!widtha\@@scwidth}}%
\doifelse\@@scheight\v!fit
- {\!!heighta\topheight
- \advance\!!heighta \topdistance
+ {\!!heighta\dimexpr\topheight+\topdistance\relax
\ifdim\topspace>\!!heighta\ifdim\topspace>\zeropoint\relax
\advance\topspace -\!!heighta
\fi\fi
- \advance\!!heighta \makeupheight
- \advance\!!heighta \bottomdistance
- \advance\!!heighta \bottomheight
- \scratchdimen\@@sctopspace
- \advance\scratchdimen \@@scveroffset
- \advance\!!heighta 2\scratchdimen}
+ \advance\!!heighta \dimexpr\makeupheight+\bottomdistance+\bottomheight\relax
+ \advance\!!heighta 2\dimexpr\@@sctopspace+\@@scveroffset\relax}
{\doifelse\@@scheight\v!max
{\!!heighta\printpaperheight}
{\!!heighta\@@scheight}}%
@@ -698,54 +675,6 @@
\def\dosetlocationboxnone#1[#2]#3[#4]%
{\global\skippedmenuitemtrue}
-% the following version looks ok but is not, since it is unaware of
-% some reference properties
-%
-% \def\setlocationboxyes#1%
-% {\locationclicktrue
-% \ifx\currentouterreference\empty
-% \ifrealreferencepage\!!doneatrue\else\!!doneafalse\fi
-% \else
-% \!!doneafalse
-% \fi
-% \if!!donea
-% \ifcase\csname\??am\??am\csname#1\c!samepage\endcsname\endcsname\relax
-% \copycsname#1\c!color\endcsname\csname#1\c!contrastcolor\endcsname
-% \@EAEAEA\dosetlocationboxyes
-% \or
-% \@EAEAEA\dosetlocationboxempty
-% \or
-% \@EAEAEA\dosetlocationboxno
-% \or
-% \@EAEAEA\dosetlocationboxnone
-% \fi
-% \else
-% \@EA\dosetlocationboxcontent
-% \fi{#1}}
-%
-% \def\setlocationboxnop#1%
-% {\locationclickfalse
-% \ifcase\csname\??am\??am\csname#1\c!unknownreference\endcsname\endcsname\relax
-% \@EA\dosetlocationboxyes
-% \or
-% \@EA\dosetlocationboxempty
-% \or
-% \@EA\dosetlocationboxno
-% \or
-% \@EA\dosetlocationboxnone
-% \fi{#1}}
-%
-% \def\setlocationbox#1[#2]#3[#4]%
-% {\bgroup % really needed !
-% \edef\permittedreferences{\csname#1\c!obstruction\endcsname}%
-% \doifreferencepermittedelse{#4}
-% {\setlocationboxyes{#1}[#2]{#3}[#4]}
-% {\setlocationboxnop{#1}[#2]{#3}[#4]}%
-% \egroup}
-%
-% \def\setlocationboxraw#1[#2]#3[#4]%
-% {\localframed[#1][#2]{\dolocationattributes{#1}\c!style\c!color{#3}}}
-
\def\setlocationboxyes#1[#2]#3[#4]%
{\locationclicktrue
\setbox\locationbox\hbox
@@ -796,20 +725,6 @@
{\setlocationboxnop{#1}[#2]{#3}[#4]}%
\egroup}
-\def\dodosetlocationcommanditem#1#2#3[#4]#5\\%
- {\bgroup
- \leavevmode
- \doifelse{#5}{[]}
- {\doifassignmentelse{#4}{#3}{\setlocationbox{\??am#1}[]{#3}[#4]}}
- {#3}%
- \ifskippedmenuitem \else
- \getvalue{\??am#1#2}%
- \fi
- \egroup}
-
-\def\dosetlocationcommanditem#1#2#3%
- {\dodosetlocationcommanditem{#1}{#2}#3[]\\}
-
\def\setlocationnop#1[#2]#3%
{\localframed[#1][#2]{#3}}
@@ -820,18 +735,8 @@
% \v!empty=>\chardef\handleunknownmenuitem=1\relax,
% \v!no=>\chardef\handleunknownmenuitem=2\relax]%
\getvalue{\??am#1#3}\relax
- \ifextendedmenu
- \setamboxcommands{#1}{#4}%
- \def\next
- {\ignorespaces#2}%
- \else
- \def\dolocationcommand##1%
- {\dosetlocationcommanditem{#1}{#4}{##1}}%
- \def\next
- {\processcommalist[#2]\dolocationcommand}%
- \fi
- \next
- \unskip
+ \setamboxcommands{#1}{#4}%
+ \ignorespaces#2\unskip
\getvalue{\??am#1#5}}
\newcounter\currentamposition
@@ -845,8 +750,9 @@
\the\everysetmenucommands}
\def\menu@@amboxcommand#1\\%
- {\bgroup
- \leavevmode\ignorespaces#1\unskip\relax
+ {\dontleavehmode
+ \bgroup
+ \ignorespaces#1\unskip\relax
\ifskippedmenuitem \else
\getvalue{\??am\currentmenu\currentsubmenu}%
\fi
@@ -867,7 +773,6 @@
{\@@amboxcommand\setlocationbox{\??am\currentmenu}[\c!frame=\v!off,\c!background=]{\ignorespaces#2\unskip}[#1]\\}%
\def\menu@nop#1\\%
- %{\@@amboxcommand\phantom{\localframed[\??am\currentmenu][]{#1}}\\}%
{\@@amboxcommand\setlocationboxraw{\??am\currentmenu}[\c!frame=\v!off,\c!background=,\c!empty=\v!yes]{\ignorespaces#1\unskip}[]\\}%
\def\menu@txt#1\\%
@@ -897,27 +802,27 @@
% beware : never change the concept of pbgoffset
+\def\menuparameter#1{\csname\??am\currentmenu#1\endcsname}
+
\def\@@amhbox#1#2#3#4%
{\def\currentmenu{#3}%
\testinteractionmenu{#3}%
\iflocationmenupermitted
\bgroup
\showcomposition
- \def\dolocationcommand##1{\dosetlocationcommanditem{#3}{##1}}%
- \dimen0=\makeupwidth
- \advance\dimen0 \pagebackgroundhoffset
- \advance\dimen0 \pagebackgroundhoffset
- \advance\dimen0 -\getvalue{\??am#3\c!leftoffset}%
- \advance\dimen0 -\getvalue{\??am#3\c!rightoffset}%
- \setbox0\hbox to \dimen0
- {\forgetall
- \executeamboxcommands{#3}{#4}\c!left\c!middle\c!right}%
- \setbox0\hbox{\do@@ammenuposition{#3}{\box0}}%
- \wd0=\makeupwidth
- % geen \ht=#2 setting (yet)
- \hskip-\pagebackgroundhoffset
- \hskip \getvalue{\??am#3\c!leftoffset}%
- \box0\relax
+ \scratchdimen\dimexpr
+ \makeupwidth
+ +\pagebackgroundhoffset
+ +\pagebackgroundhoffset
+ -\menuparameter\c!leftoffset
+ -\menuparameter\c!rightoffset
+ \relax
+ \setbox\scratchbox\hbox to \scratchdimen
+ {\forgetall\executeamboxcommands{#3}{#4}\c!left\c!middle\c!right}%
+ \setbox\scratchbox\hbox{\do@@ammenuposition{#3}{\box\scratchbox}}%
+ \wd\scratchbox\makeupwidth % geen \ht=#2 setting (yet)
+ \hskip\dimexpr-\pagebackgroundhoffset+\menuparameter\c!leftoffset\relax
+ \box\scratchbox
\egroup
\else
#1\relax
@@ -929,28 +834,29 @@
\iflocationmenupermitted
\bgroup
\showcomposition
- \dimen0=\textheight
- \advance\dimen0 \pagebackgroundvoffset
- \advance\dimen0 \pagebackgroundvoffset
- \advance\dimen0 \pagebackgrounddepth
- \advance\dimen0 -\getvalue{\??am#3\c!topoffset}%
- \advance\dimen0 -\getvalue{\??am#3\c!bottomoffset}%
- \setbox0\vbox to \dimen0
- {\forgetall % Voor't geval de afstand
+ \scratchdimen\dimexpr
+ \textheight
+ +\pagebackgroundvoffset
+ +\pagebackgroundvoffset
+ +\pagebackgrounddepth
+ -\menuparameter\c!topoffset
+ -\menuparameter\c!bottomoffset
+ \relax
+ \setbox\scratchbox\vbox to \scratchdimen
+ {\forgetall % Voor't geval de afstand
%\setupblank[\v!standard]% % (tijdelijk) is aangepast.
\restorestandardblank
\hsize#2\relax
\executeamboxcommands{#3}{#4}\c!before\c!inbetween\c!after}%
- \setbox0\vbox{\hbox{\do@@ammenuposition{#3}{\box0}}}%
- \setbox0\vbox
- {\vskip-\pagebackgroundvoffset
- \vskip\getvalue{\??am#3\c!topoffset}%
- \ht0=\zeropoint
- \box0
+ \setbox\scratchbox\vbox{\hbox{\do@@ammenuposition{#3}{\box\scratchbox}}}%
+ \setbox\scratchbox\vbox
+ {\ht\scratchbox\zeropoint
+ \vskip\dimexpr-\pagebackgroundvoffset+\endcsname\c!topoffset\relax
+ \box\scratchbox
\vskip\pagebackgroundvoffset}% overbodig
- \ht0=\textheight
- \wd0=#2\relax
- \box0
+ \ht\scratchbox\textheight
+ \wd\scratchbox#2\relax
+ \box\scratchbox
\egroup
\else
#1\relax
@@ -973,47 +879,47 @@
\def\horizontalinteractionmenu#1#2#3#4%
{\ifdim#2>\zeropoint % new
- \dimen2\zeropoint
- \setbox0\hbox
+ \scratchdimen\zeropoint
+ \setbox\scratchbox\hbox
{\def\docommand##1%
{\doifnotvalue{\??am##1\c!state}\v!none
- {\hskip\dimen2
+ {\hskip\scratchdimen
\setbox2\hbox to #2
{\getvalue{\??am##1#3}\interactionmenu[##1]\getvalue{\??am##1#4}}%
\doifelsevalue{\??am##1\c!distance}\v!overlay
- {\dimen2\zeropoint
+ {\scratchdimen\zeropoint
\wd2\zeropoint}%
- {\dimen2=\getvalue{\??am##1\c!distance}}%
+ {\scratchdimen\getvalue{\??am##1\c!distance}}%
\box2}}%
\startinteraction
\processcommacommand[\getvalue{\??am#1}]\docommand
\stopinteraction}%
- \wd0=#2\relax
- \box0\relax
+ \wd\scratchbox#2\relax
+ \box\scratchbox
\fi}
\def\verticalinteractionmenu#1#2#3#4%
{\ifdim#2>\zeropoint % new
- \dimen2\zeropoint
- \setbox0\vbox
+ \scratchdimen\zeropoint
+ \setbox\scratchbox\vbox
{\def\docommand##1%
{\doifnotvalue{\??am##1\c!state}\v!none
- {\vskip\dimen2
+ {\vskip\scratchdimen
\setbox2\vbox to #2
{\getvalue{\??am##1#3}\interactionmenu[##1]\getvalue{\??am##1#4}}%
\doifelsevalue{\??am##1\c!distance}\v!overlay
- {\dimen2\zeropoint
+ {\scratchdimen\zeropoint
\offinterlineskip
\dp2\zeropoint
\ht2\zeropoint}%
- {\dimen2=\getvalue{\??am##1\c!distance}}%
+ {\scratchdimen\getvalue{\??am##1\c!distance}}%
\box2}}%
\startinteraction
\processcommacommand[\getvalue{\??am#1}]\docommand
\stopinteraction}%
- \ht0=#2\relax
- \dp0\zeropoint
- \box0\relax
+ \ht\scratchbox#2\relax
+ \dp\scratchbox\zeropoint
+ \box\scratchbox
\fi}
\letvalue{\??am\v!left }\empty
@@ -1030,14 +936,10 @@
\dodummypageskip{#1}%
\fi}
-\setvalue{\??am\??am\c!menu\v!left}%
- {\horizontalinteractionmenu\v!left\leftedgewidth\c!left\c!right}
-\setvalue{\??am\??am\c!menu\v!right}%
- {\horizontalinteractionmenu\v!right\rightedgewidth\c!left\c!right}
-\setvalue{\??am\??am\c!menu\v!top}%
- {\verticalinteractionmenu\v!top\topheight\c!before\c!after}
-\setvalue{\??am\??am\c!menu\v!bottom}%
- {\verticalinteractionmenu\v!bottom\bottomheight\c!before\c!after}
+\setvalue{\??am\??am\c!menu\v!left }{\horizontalinteractionmenu\v!left \leftedgewidth \c!left \c!right}
+\setvalue{\??am\??am\c!menu\v!right }{\horizontalinteractionmenu\v!right \rightedgewidth\c!left \c!right}
+\setvalue{\??am\??am\c!menu\v!top }{\verticalinteractionmenu \v!top \topheight \c!before\c!after}
+\setvalue{\??am\??am\c!menu\v!bottom}{\verticalinteractionmenu \v!bottom\bottomheight \c!before\c!after}
% this can be implemented with the following command (which
% is new, undocumented, experimental, untested, etc etc)
@@ -1047,12 +949,8 @@
\def\dodefineinteractionmenuclass[#1][#2]% tag hori|veri
{\doifelse{#2}\v!vertical
- {\setvalue{\??am\??am\c!menu#1}%
- {\verticalinteractionmenu
- {#1}{\getvalue{\??am#1\c!width}}\c!before\c!after}}
- {\setvalue{\??am\??am\c!menu#1}%
- {\horizontalinteractionmenu
- {#1}{\getvalue{\??am#1\c!height}}\c!left\c!right}}}
+ {\setvalue{\??am\??am\c!menu#1}{\verticalinteractionmenu {#1}{\getvalue{\??am#1\c!width }}\c!before\c!after}}
+ {\setvalue{\??am\??am\c!menu#1}{\horizontalinteractionmenu{#1}{\getvalue{\??am#1\c!height}}\c!left\c!right }}}
% \setupinteraction[menu=on,state=start]
%
@@ -1107,33 +1005,18 @@
%D We also need an explicit position control some day. I'll
%D do that when I need it. [The stacking order.]
-% for the moment we will support the old method
-%
-% \stelinteractionmenuin[right][{abc[xyz]},...]
-% \stelinteractionmenuin[right][key=val,...]
-
\newif\ifextendedmenu
-\def\defineinteractionmenu
- {\dotripleempty\dodefineinteractionmenu}
-
-\def\dodefineinteractionmenu[#1][#2]% compatibility hack
- {\defconvertedargument\ascii{#2}% will disappear soon
- \doifinstringelse[\ascii
- \dodosetupinteractionlistmenux
- \dododefineinteractionmenu
- [#1][#2]}
-
% [name] [location]
% [name] [location] [pars]
-\def\dododefineinteractionmenu[#1][#2][#3]%
+\def\defineinteractionmenu
+ {\dotripleempty\dodefineinteractionmenu}
+
+\def\dodefineinteractionmenu[#1][#2][#3]%
{% main settings
\letvalue{\??am\c!menu#1}\empty
- % \setvalue{\??am\c!menu#1}%
- % {\extendedmenufalse\dointeractionmenu{#1}{}}%
- \setvalue{\@@dodolistelement#1}%
- {\def\dosomelistelement{\dodomenulistelement{#1}}}%
+ \setvalue{\@@dodolistelement#1}{\def\dosomelistelement{\dodomenulistelement{#1}}}%
\presetlocalframed[\??am#1]%
% register location
\expanded{\addtocommalist{#1}\@EA\noexpand\csname\??am#2\endcsname}%
@@ -1152,27 +1035,15 @@
\def\setupinteractionmenu
{\dodoubleargument\dosetupinteractionmenu}
-\def\dosetupinteractionmenu[#1][% compatibillity hack
- {\doifnextcharelse\bgroup % will disappear soon
- {\dodosetupinteractionlistmenuy[#1][}
- {\dodosetupinteractionmenu [#1][}}
-
-\def\dodosetupinteractionlistmenux[#1][#2][#3]% compatibillity hack
- {\setvalue{\??am\c!menu#1}{\extendedmenufalse\dointeractionmenu{#1}{#2}}}
-
-\def\dodosetupinteractionlistmenuy[#1][#2]% compatibillity hack
- {\setvalue{\??am\c!menu#1}%
- {\extendedmenufalse\dointeractionmenu{#1}{#2}}}
-
-\def\dodosetupinteractionmenu[#1][#2]%
+\def\dosetupinteractionmenu[#1][#2]%
{\def\docommand##1{\getparameters[\??am##1][#2]}%
\processcommalist[#1]\docommand}
-\setvalue{\??am\??am\v!yes }{0}
-\setvalue{\??am\??am\v!empty}{1}
-\setvalue{\??am\??am\v!no }{2}
-\setvalue{\??am\??am\v!none}{3}
-\setvalue{\??am\??am }{1} % default
+\expandafter\chardef\csname\??am\??am\v!yes \endcsname\zerocount
+\expandafter\chardef\csname\??am\??am\v!empty\endcsname\plusone
+\expandafter\chardef\csname\??am\??am\v!no \endcsname\plustwo
+\expandafter\chardef\csname\??am\??am\v!none \endcsname\plusthree
+\expandafter\chardef\csname\??am\??am \endcsname\plusone % default
\processbetween{\v!interactionmenu}\dostartinteractionmenu
@@ -1188,7 +1059,7 @@
\def\dodomenulistelement#1#2#3#4#5#6#7%
{\setbox0=\hbox
{\let\gotolocation\gobbleoneargument % hack to catch last []
-%\locationclickfalse % ipv ^
+ %\locationclickfalse % ipv ^
\docheckrealreferencepage{#7}%
\setlocationboxyes
{\??am#1}% % needed !
@@ -1246,13 +1117,6 @@
\setlocationbox{\??am#1}[]{#3}[#4]%
\egroup}
-\def\domenubox[#1][#2]#3%
- {\bgroup
- \def\setlocationbox##1[##2]##3[##4]%
- {\localframed[##1][##2]{\dolocationattributes{##1}\c!style\c!color{##3}}}%
- \domenubutton[#1][#2]#3[]%
- \egroup}
-
\def\menubox
{\dodoubleempty\domenubox}
@@ -1381,66 +1245,71 @@
\egroup
\fi\fi}
-% Dit is leuke toepassing van glue!
+% A nice application of glue. All this code will be rewritten and
+% generalized.
-\newbox\meterbox
+\newbox\interactionbarbox
\newif\ifbarsymbol
-\def\doganaareenpagina#1#2#3% nog checken !
+\def\dogotosomepage#1#2#3% nog checken !
{\checkreferences % nodig ??
- \iflocation
- \ifnum#3=\realpageno
- {#2}%
+ \hbox
+ {\iflocation
+ \ifnum#3=\realpageno
+ #2%
+ \else
+ \gotorealpage\empty\empty{#3}{\doifsomething{#1}{\dolocationattributes{#1}\c!style\c!color}{#2}}%
+ \fi
\else
- \doifelsenothing{#1}
- {\hbox{\gotorealpage{}{}{#3}
- {#2}}}
- {\hbox{\gotorealpage{}{}{#3}
- {\dolocationattributes{#1}\c!style\c!color{#2}}}}%
- \fi
- \else
- {#2}%
- \fi}
+ #2%
+ \fi}}
+
+\def\dogotosomecontrastpage#1#2#3% nog checken, may replace previous
+ {\checkreferences % nodig ??
+ \hbox
+ {\iflocation
+ \ifnum#3=\realpageno
+ \gotorealpage\empty\empty{#3}{\doifsomething{#1}{\dolocationattributes{#1}\c!style\c!contrastcolor}{#2}}%
+ \else
+ \gotorealpage\empty\empty{#3}{\doifsomething{#1}{\dolocationattributes{#1}\c!style\c!color}{#2}}%
+ \fi
+ \else
+ #2%
+ \fi}}
\presetlocalframed[\??ib]
-\def\interactionbara
- {\iflocation
+\def\interactionbara % we need better control over contrastcolor
+ {\iflocation % maybe just use gotopage and set colors
\bgroup
- %\setupinteraction[\c!width=\!!zeropoint]%
- \setinteractionparameter\c!width\!!zeropoint
- \setupblackrules[\c!height=\v!max,\c!depth=\v!max]% maten ??
- \!!widthb\@@ibwidth
- \advance\!!widthb -2.75em\relax
- \!!widtha\!!widthb
- \divide\!!widtha \lastpage\relax
+ \setinteractionparameter\c!width\zeropoint
+ \setupblackrules[\c!height=\v!max,\c!depth=\v!max]%
+ \!!widthb\dimexpr\@@ibwidth-2.75\emwidth\relax
+ \!!widtha\dimexpr\!!widthb/\lastpage\relax
\bgroup
- \advance\realpageno \minusone
- \ifvoid\meterbox
+ \advance\realpageno\minusone
+ \ifvoid\interactionbarbox
\bgroup
\processaction
[\@@ibstep]
- [ \v!small=>\dimen0=.25em\relax,
- \v!medium=>\dimen0=.5em\relax,
- \v!big=>\dimen0=1em\relax,
- \s!unknown=>\dimen0=\!!widtha]%
- \ifdim\!!widtha<\dimen0\relax
- \!!counta\dimen0\relax
- \!!countb\!!widtha
- \divide\!!counta \!!countb
+ [ \v!small=>\scratchdimen.25\emwidth,
+ \v!medium=>\scratchdimen.5\emwidth,
+ \v!big=>\scratchdimen\emwidth,
+ \s!unknown=>\scratchdimen\!!widtha]%
+ \ifdim\!!widtha<\scratchdimen\relax
+ \!!counta\numexpr\scratchdimen/\!!widtha\relax
\else
\!!counta\@@ibstep\relax
\fi
- \!!widtha=\!!counta\!!widtha
- \setbox0\hbox{\blackrule[\c!width=\!!widtha]}%
- \global\setbox\meterbox\hbox to \!!widthb
+ \!!widtha\!!counta\!!widtha
+ \setbox\scratchbox\hbox{\blackrule[\c!width=\!!widtha,\c!color=middlegray]}% color here, else no mkiv
+ \global\setbox\interactionbarbox\hbox to \!!widthb
{\hss
- % brrr
- \for \teller=1 \to \lastpage \step \!!counta \do
- {\gotorealpage{}{}{\teller}{\copy0}}%
+ \dostepwiserecurse\plusone\lastpage\!!counta
+ {\gotorealpage\empty\empty\recurselevel{\copy\scratchbox}}%
\hss}%
- \global\wd\meterbox\zeropoint
+ \global\wd\interactionbarbox\zeropoint
\egroup
\fi
\egroup
@@ -1448,40 +1317,34 @@
\strut
\hbox to \@@ibwidth
{\dontcomplain
- \setupblackrules[\c!width=1em]%
- \doganaareenpagina\??ib\blackrule\firstpage
+ \setupblackrules[\c!width=\emwidth]%
+ \dogotosomecontrastpage\??ib\blackrule\firstpage
\hss
- \color[middlegray]{\copy\meterbox}%
+ \copy\interactionbarbox
\hbox to \!!widthb
- {\ifdim\!!widtha<1em\relax
- \!!widtha=1em\relax
+ {\ifdim\!!widtha<\emwidth
+ \!!widtha\emwidth
\fi
\setupblackrules[\c!width=\!!widtha]%
\ifnum\realpageno>\plusone
- \!!counta\realpageno
- \advance\!!counta -2\relax
+ \!!counta\numexpr\realpageno-\plustwo\relax
\hskip\zeropoint\!!plus\!!counta \s!sp\relax % cm gives overflow
- % or just: \hskip\zeropoint\!!plus\!!counta \relax % cm gives overflow
- \doganaareenpagina\??ib\blackrule\prevpage
+ \dogotosomepage\??ib\blackrule\prevpage
\fi
- \color[\@@ibcontrastcolor]{\blackrule[\c!width=.5em]}%
+ \dogotosomecontrastpage\??ib{\blackrule[\c!width=.5em]}\realpageno
\ifnum\realpageno<\lastpage\relax
- \doganaareenpagina\??ib\blackrule\nextpage
- \!!counta\lastpage
- \advance\!!counta -\realpageno
- \advance\!!counta \minusone
+ \dogotosomepage\??ib\blackrule\nextpage
+ \!!counta\numexpr\lastpage-\realpageno-\plusone\relax
\hskip\zeropoint\!!plus\!!counta \s!sp\relax % cm gives overflow
- % or just \hskip\zeropoint\!!plus\!!counta\relax % cm gives overflow
\fi}%
\hss
- \doganaareenpagina\??ib\blackrule\lastpage}%
+ \dogotosomecontrastpage\??ib\blackrule\lastpage}%
\egroup
\fi}
\def\interactionbarb
{\ifnum\lastpage>\firstpage\relax
- \interactionbuttons
- [\v!firstpage,\v!previouspage,\v!nextpage,\v!lastpage]%
+ \interactionbuttons[\v!firstpage,\v!previouspage,\v!nextpage,\v!lastpage]%
\fi}
\def\interactionbarc
@@ -1489,27 +1352,17 @@
\ifnum\lastpage>\plusone
\hbox to \@@ibwidth
{\setupblackrules[\c!height=\@@ibheight,\c!depth=\@@ibdepth]%
- \def\gotox##1%
- {\doganaareenpagina{}{\blackrule[\c!width=##1]}}%
- \dimen0=\@@ibwidth\relax
- \advance\dimen0 -4em
- \!!counta\lastpage
- \advance\!!counta \minusone
- \divide\dimen0 \!!counta
- \!!counta\realpageno
- \advance\!!counta \minusone
- \!!widtha\!!counta\dimen0
- \!!countb\lastpage
- \advance\!!countb -\realpageno
- \!!widthb\!!countb\dimen0
+ \scratchdimen\dimexpr(\@@ibwidth-4\emwidth)/\numexpr\lastpage+\minusone\relax\relax
+ \!!widtha\numexpr\realpageno+\minusone\relax\scratchdimen
+ \!!widthb\numexpr\lastpage-\realpageno\relax\scratchdimen
\startcolor[\locationcolor\@@ibcolor]%
- \gotox{1em}\firstpage
+ \dogotosomepage\empty{\blackrule[\c!width=\emwidth]}\firstpage
\hss
- \gotox\!!widtha\prevpage
- \color[\@@ibcontrastcolor]{\blackrule[\c!width=1em]}%
- \gotox\!!widthb\nextpage
+ \dogotosomepage\empty{\blackrule[\c!width=\!!widtha]}\prevpage
+ \color[\@@ibcontrastcolor]{\blackrule[\c!width=\emwidth]}%
+ \dogotosomepage\empty{\blackrule[\c!width=\!!widthb]}\nextpage
\hss
- \gotox{1em}\lastpage
+ \dogotosomepage\empty{\blackrule[\c!width=\emwidth]}\lastpage
\stopcolor}%
\fi
\fi}
@@ -1517,42 +1370,29 @@
\def\interactionbard
{\iflocation\ifshowingsubpage
\ifnum\nofsubpages>\plusone
- \hbox
- \bgroup
- %\setupinteraction[\c!width=\!!zeropoint]%
- \setinteractionparameter\c!width\!!zeropoint
- \ifbarsymbol % beter: 3 chars assign en 3*box
- \setupsymbolset[\@@iasymbolset]%
- \setbox0\hbox{\symbol[\v!previous]}%
- \setbox2\hbox{\symbol[\v!somewhere]}%
- \setbox4\hbox{\symbol[\v!next]}%
- \else
- \setbox0\hbox
- {\vrule
- \!!height\@@ibheight
- \!!depth\@@ibdepth
- \!!width\@@ibwidth}%
- \setbox2\copy0
- \setbox4\copy0
- \fi
- \startcolor[\locationcolor\@@ibcolor]%
- \for\teller=1\to\nofsubpages\step1\do % brr, \dostepwiserecurse
- {\bgroup
- \increment(\teller,\firstsubpage)\relax
- \decrement\teller\relax
- \ifnum\teller<\realpageno\relax
- \gotorealpage{}{}{\teller}{\copy0}\relax
- \else\ifnum\teller=\realpageno\relax
- \color
- [\@@ibcontrastcolor]
- {\gotorealpage{}{}{\teller}{\copy2}}%
- \else
- \gotorealpage{}{}{\teller}{\copy4}\relax
- \fi\fi
- \egroup
- \hskip\@@ibdistance}%
- \unskip
- \stopcolor
+ \hbox \bgroup
+ \setinteractionparameter\c!width\!!zeropoint
+ \ifbarsymbol
+ \setupsymbolset[\@@iasymbolset]%
+ \def\dogotox##1%
+ {\hbox{\symbol[\ifcase##1 \v!previous\or\v!somewhere\or\v!next\fi]}}%
+ \else
+ \def\dogotox##1%
+ {\hbox{\vrule\!!height\@@ibheight\!!depth \@@ibdepth\!!width \@@ibwidth}}%
+ \fi
+ \dostepwiserecurse\plusone\nofsubpages\plusone
+ {\bgroup
+ \scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax
+ \ifnum\scratchcounter<\realpageno\relax
+ \dogotosomecontrastpage\??ib{\dogotox0}\scratchcounter
+ \else\ifnum\scratchcounter=\realpageno\relax
+ \dogotosomecontrastpage\??ib{\dogotox1}\scratchcounter
+ \else
+ \dogotosomecontrastpage\??ib{\dogotox2}\scratchcounter
+ \fi\fi
+ \egroup
+ \hskip\@@ibdistance}%
+ \unskip % not needed
\egroup
\fi
\fi\fi}
@@ -1561,72 +1401,54 @@
{\iflocation\ifshowingsubpage
\ifnum\nofsubpages>\plusone
\bgroup
- \!!widthb\@@ibdistance
- \multiply\!!widthb \nofsubpages
- \advance\!!widthb -\@@ibdistance % (n-1)
- \!!widtha\@@ibwidth
- \advance\!!widtha -\!!widthb
- \divide\!!widtha \nofsubpages\relax
+ \!!widthb\dimexpr\nofsubpages\dimexpr\@@ibdistance\relax-\@@ibdistance\relax % (n-1)
+ \!!widtha\dimexpr(\@@ibwidth-\!!widthb)/\nofsubpages\relax
\ifdim\!!widtha<\@@ibdistance\relax
\interactionbarf
\else
- %\setupinteraction[\c!width=\!!zeropoint]%
\setinteractionparameter\c!width\!!zeropoint
\noindent
\hbox to \@@ibwidth
\bgroup
\ifbarsymbol
\setupsymbolset[\@@iasymbolset]%
- \setbox0\hbox{\symbol[\v!previous]}%
- \setbox2\hbox{\symbol[\v!somewhere]}%
- \setbox4\hbox{\symbol[\v!next]}%
+ \def\dogotox##1%
+ {\hbox{\symbol[\ifcase##1 \v!previous\or\v!somewhere\or\v!next\fi}}%
\else
- \setbox0\hbox
- {\vrule
- \!!height\@@ibheight
- \!!depth\@@ibdepth
- \!!width\!!widtha}%
- \setbox2\copy0
- \setbox4\copy0
+ \def\dogotox##1%
+ {\hbox{\vrule\!!height\@@ibheight\!!depth\@@ibdepth\!!width\!!widtha}}%
\fi
- \startcolor[\locationcolor\@@ibcolor]%
- \for\teller=1\to\nofsubpages\step1\do
+ \dostepwiserecurse\plusone\nofsubpages\plusone
{\bgroup
- \increment(\teller,\firstsubpage)\relax
- \decrement\teller\relax
- \ifnum\teller<\realpageno\relax
- \gotorealpage{}{}{\teller}{\copy0}\relax
- \else\ifnum\teller=\realpageno\relax
- \color
- [\@@ibcontrastcolor]
- {\gotorealpage{}{}{\teller}{\copy2}}%
+ \scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax
+ \ifnum\scratchcounter<\realpageno\relax
+ \dogotosomecontrastpage\??ib{\dogotox0}\scratchcounter
+ \else\ifnum\scratchcounter=\realpageno\relax
+ \dogotosomecontrastpage\??ib{\dogotox1}\scratchcounter
\else
- \gotorealpage{}{}{\teller}{\copy4}\relax
+ \dogotosomecontrastpage\??ib{\dogotox2}\scratchcounter
\fi\fi
\egroup
\hss}%
\unskip
- \stopcolor
\egroup
\fi
\egroup
\fi
\fi\fi}
-\def\interactionbarf% !! KAN WORDEN GECOMBINEERD MET D !!
+\def\interactionbarf % !! KAN WORDEN GECOMBINEERD MET D !!
{\iflocation\ifshowingsubpage
\ifnum\nofsubpages>\plusone
- %\setupinteraction[\c!width=\!!zeropoint]%
\setinteractionparameter\c!width\!!zeropoint
\noindent
\hbox to \@@ibwidth
\bgroup
\!!countb\zerocount
- \loop
+ \loop % todo: \doloop
\advance\!!countb \plusone
- \!!countc\nofsubpages
- \divide\!!countc \!!countb
- \advance\!!countc \plusone
+ %\!!countc\nofsubpages \divide\!!countc \!!countb \advance\!!countc \plusone
+ \!!countc\numexpr(\nofsubpages/\!!countb)+\plusone\relax % rounding
\!!widthb\@@ibdistance
\multiply\!!widthb \!!countc
\advance\!!widthb -\@@ibdistance
@@ -1635,83 +1457,74 @@
\divide\!!widtha \!!countc
\ifdim\!!widtha<\@@ibdistance\relax
\repeat
-\advance\!!countc -2
-\!!widtha-\@@ibdistance
-\!!widtha=\!!countc\!!widtha
-\advance\!!widtha \@@ibwidth
-\advance\!!countc \plusone
-\divide\!!widtha \!!countc
+ \ifnum\!!countc>\plusone
+ % this is not that well tested
+ \advance\!!countc \minustwo
+ \!!widtha-\@@ibdistance
+ \!!widtha\!!countc\!!widtha
+ \advance\!!widtha \@@ibwidth
+ \advance\!!countc \plusone
+ \divide\!!widtha \!!countc
+ \fi
\ifbarsymbol
\setupsymbolset[\@@iasymbolset]%
- \setbox0\hbox{\symbol[\v!previous]}%
- \setbox4\hbox{\symbol[\v!somewhere]}%
- \setbox8\hbox{\symbol[\v!next]}%
- \setbox2\copy4
- \setbox6\copy4
+ \def\dogotox##1%
+ {\hbox{\symbol[\ifcase##1 \v!previous\or\v!somewhere\or\v!somewhere\or\v!somewhere\or\v!next\fi}}%
\else
- \setbox0\hbox
- {\vrule
- \!!height\@@ibheight
- \!!depth\@@ibdepth
- \!!width\!!widtha}%
- \setbox4\copy0
- \setbox8\copy0
- \setbox2\hbox
- {\vrule
- \!!height.5\ht0
- \!!depth.5\dp0
- \!!width\!!widtha}%
- \ht2\ht0
- \dp2\dp0
- \setbox6\copy2
+ \def\dogotox##1%
+ {\hbox
+ {\!!heighta\@@ibheight
+ \!!deptha\@@ibdepth
+ \ifcase##1\relax
+ \vrule\!!height \!!heighta\!!depth \!!deptha\!!width\!!widtha
+ \or
+ \vrule\!!height.5\!!heighta\!!depth.5\!!deptha\!!width\!!widtha
+ \or
+ \vrule\!!height \!!heighta\!!depth \!!deptha\!!width\!!widtha
+ \or
+ \vrule\!!height.5\!!heighta\!!depth.5\!!deptha\!!width\!!widtha
+ \or
+ \vrule\!!height \!!heighta\!!depth \!!deptha\!!width\!!widtha
+ \fi}}%
\fi
- \def\gotox##1%
- {\ifnum\teller=\realpageno
- \color
- [\@@ibcontrastcolor]
- {\gotorealpage{}{}{\teller}{\copy##1}}%
- \else
- \gotorealpage{}{}{\teller}{\copy##1}%
- \fi
- \!!countf\zerocount
- \hss}%
- \startcolor[\locationcolor\@@ibcolor]%
- \!!countc\realpageno \advance\!!countc -2
- \!!countd\realpageno \advance\!!countd 2
+ \!!countc\numexpr\realpageno-\plustwo\relax
+ \!!countd\numexpr\realpageno+\plustwo\relax
+ \ifnum\!!countc<\plusone \!!countc\plusone \fi
\!!countf\zerocount
- \for\teller=\firstsubpage\to\lastsubpage\step1\do
+ \dostepwiserecurse\firstsubpage\lastsubpage\plusone
{\!!doneafalse
\advance\!!countf \plusone
- \ifnum\teller=\firstsubpage\relax \!!doneatrue \fi
- \ifnum\teller=\lastsubpage\relax \!!doneatrue \fi
- \ifnum\teller>\!!countc \ifnum\teller<\!!countd \!!doneatrue \fi\fi
+ \ifnum\recurselevel=\firstsubpage\relax \!!doneatrue \fi
+ \ifnum\recurselevel=\lastsubpage\relax \!!doneatrue \fi
\if!!donea
- \ifnum\teller<\realpageno
- \gotox0%
- \else\ifnum\teller>\realpageno
- \gotox4%
+ \ifnum\recurselevel<\realpageno
+ \dogotosomecontrastpage\??ib{\dogotox0}\recurselevel
+ \else\ifnum\recurselevel>\realpageno
+ \dogotosomecontrastpage\??ib{\dogotox2}\recurselevel
\else
- \gotox8%
+ \dogotosomecontrastpage\??ib{\dogotox4}\recurselevel
\fi\fi
+ \hss
+ \!!countf\zerocount
\else\ifnum\!!countf=\!!countb
- \ifnum\teller<\realpageno
- \gotox2%
- \else\ifnum\teller>\realpageno
- \gotox6%
+ \ifnum\recurselevel<\realpageno
+ \dogotosomecontrastpage\??ib{\dogotox1}\recurselevel
+ \else\ifnum\recurselevel>\realpageno
+ \dogotosomecontrastpage\??ib{\dogotox3}\recurselevel
\else
- \gotox4%
+ \dogotosomecontrastpage\??ib{\dogotox2}\recurselevel
\fi\fi
+ \hss
+ \!!countf\zerocount
\fi\fi}%
\unskip
- \stopcolor
\egroup
\fi
\fi\fi}
\def\interactionbarg
{\ifnum\lastsubpage>\firstsubpage\relax
- \interactionbuttons
- [\v!firstsubpage,\v!previoussubpage,\v!nextsubpage,\v!lastsubpage]%
+ \interactionbuttons[\v!firstsubpage,\v!previoussubpage,\v!nextsubpage,\v!lastsubpage]%
\fi}
\def\checkinteractionbar#1#2#3%
@@ -1721,7 +1534,7 @@
\def\complexinteractionbar[#1]%
{\doifelse{#1}\v!reset
- {\global\setbox\meterbox\box\voidb@x}%
+ {\global\setbox\interactionbarbox\box\voidb@x}%
{\bgroup
\iflocation
\checksubpages % goes wrong / loads \numberofpages too
@@ -1730,10 +1543,10 @@
{\startinteraction
\processaction % breedte defaults !
[\@@ibalternative]
- [ c=>\checkinteractionbar{.5em}\v!max \v!max,
+ [ c=>\checkinteractionbar{10em}\v!max \v!max,
d=>\checkinteractionbar{.5em}{.5em} \!!zeropoint,
- e=>\checkinteractionbar{.5em}{.5em} \!!zeropoint,
- f=>\checkinteractionbar{.5em}{.5em} \!!zeropoint,
+ e=>\checkinteractionbar{10em}{.5em} \!!zeropoint,
+ f=>\checkinteractionbar{10em}{.5em} \!!zeropoint,
\s!default=>\checkinteractionbar{10em}\v!broad\!!zeropoint,
\s!unknown=>\checkinteractionbar{10em}\v!broad\!!zeropoint]%
\doifelse\@@ibsymbol\v!yes
@@ -2427,35 +2240,27 @@
\c!rightoffset=\!!zeropoint]
\def\placeleftedgetextblock % Is \hss/\hsize really needed here?
- {\hbox to \leftedgewidth % (check outer level and settings)
- {\hsize\leftedgewidth
- \hss
- \interactionmenus[\v!left]}}
+ {\hbox to \leftedgewidth % (check outer level and settings)
+ {\hsize\leftedgewidth\hss\interactionmenus[\v!left]}}
\def\placerightedgetextblock % Is \hss/\hsize really needed here?
- {\hbox to \rightedgewidth % (check outer level and settings)
- {\hsize\rightedgewidth
- \interactionmenus[\v!right]%
- \hss}}
+ {\hbox to \rightedgewidth % (check outer level and settings)
+ {\hsize\rightedgewidth\interactionmenus[\v!right]\hss}}
\def\placetoptextblock
{\vbox to \topheight
{\vsize\topheight
-% \getvalue{\??tk\v!boven\v!tekst\c!voor}
- \getvalue{\??tk\v!top\c!before}
- \interactionmenus[\v!top]
-% \getvalue{\??tk\v!boven\v!tekst\c!na}
- \getvalue{\??tk\v!top\c!after}
+ \csname\??tk\v!top\c!before\endcsname
+ \interactionmenus[\v!top]%
+ \csname\??tk\v!top\c!after\endcsname
\kern\zeropoint}}
\def\placebottomtextblock
{\vbox to \bottomheight
{\vsize\bottomheight
-% \getvalue{\??tk\v!onder\v!tekst\c!voor}
- \getvalue{\??tk\v!bottom\c!before}
- \interactionmenus[\v!bottom]
-% \getvalue{\??tk\v!onder\v!tekst\c!na}
- \getvalue{\??tk\v!bottom\c!after}
+ \csname\??tk\v!bottom\c!before\endcsname
+ \interactionmenus[\v!bottom]%
+ \csname\??tk\v!bottom\c!after\endcsname
\kern\zeropoint}}
\ifx\leftedgetextcontent\undefined \else
diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex
index 2457d735c..045a05123 100644
--- a/tex/context/base/core-nav.tex
+++ b/tex/context/base/core-nav.tex
@@ -250,7 +250,7 @@
%D situations where the typeface is handled by the calling
%D macro.
-\def\interactioncolor
+\def\interactioncolor % todo \??ia as argument
{\iflocation
\ifrealreferencepage
\@@iacontrastcolor
diff --git a/tex/context/base/core-pos.lua b/tex/context/base/core-pos.lua
index d5c365031..8fff3e350 100644
--- a/tex/context/base/core-pos.lua
+++ b/tex/context/base/core-pos.lua
@@ -16,80 +16,79 @@ if not jobs then jobs = { } end
if not job then jobs['main'] = { } end job = jobs['main']
if not job.positions then job.positions = { } end
-function job.MPp(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[1]) else tex.sprint('0' ) end end
-function job.MPx(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[2]) else tex.sprint('0pt') end end
-function job.MPy(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[3]) else tex.sprint('0pt') end end
-function job.MPw(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[4]) else tex.sprint('0pt') end end
-function job.MPh(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[5]) else tex.sprint('0pt') end end
-function job.MPd(id) local jpi = job.positions[id] if jpi then tex.sprint(jpi[6]) else tex.sprint('0pt') end end
+local texprint = tex.print
+local positions = job.positions
+local concat = table.concat
+local format = string.format
+
+function job.MPp(id) local jpi = positions[id] texprint((jpi and jpi[1]) or '0' ) end
+function job.MPx(id) local jpi = positions[id] texprint((jpi and jpi[2]) or '0pt') end
+function job.MPy(id) local jpi = positions[id] texprint((jpi and jpi[3]) or '0pt') end
+function job.MPw(id) local jpi = positions[id] texprint((jpi and jpi[4]) or '0pt') end
+function job.MPh(id) local jpi = positions[id] texprint((jpi and jpi[5]) or '0pt') end
+function job.MPd(id) local jpi = positions[id] texprint((jpi and jpi[6]) or '0pt') end
+
+-- the following are only for MP so there we can leave out the pt
function job.MPxy(id)
- local jpi = job.positions[id]
+ local jpi = positions[id]
if jpi then
- tex.sprint('('..jpi[2]..','..jpi[3]..')')
+ texprint(format('(%s,%s)',jpi[2],jpi[3]))
else
- tex.sprint('(0pt,0pt)')
+ texprint('(0,0)')
end
end
function job.MPll(id)
- local jpi = job.positions[id]
+ local jpi = positions[id]
if jpi then
- tex.sprint('('..jpi[2]..'-'..-jpi[3]..','..jpi[6]..')')
+ texprint(format('(%s,%s-%s)',jpi[2],jpi[3],jpi[6]))
else
- tex.sprint('(0pt,0pt)')
+ texprint('(0,0)')
end
end
function job.MPlr(id)
- local jpi = job.positions[id]
+ local jpi = positions[id]
if jpi then
- tex.sprint('('..jpi[2]..'+'..jpi[4]..','..jpi[3]..'-'..jpi[6]..')')
+ texprint(format('(%s+%s,%s-%s)',jpi[2],jpi[4],jpi[3],jpi[6]))
else
- tex.sprint('(0pt,0pt)')
+ texprint('(0,0)')
end
end
function job.MPur(id)
- local jpi = job.positions[id]
+ local jpi = positions[id]
if jpi then
- tex.sprint('('..jpi[2]..'+'..jpi[4]..','..jpi[3]..'+'..jpi[5]..')')
+ texprint(format('(%s+%s,%s+%s)',jpi[2],jpi[4],jpi[3],jpi[5]))
else
- tex.sprint('(0pt,0pt)')
+ texprint('(0,0)')
end
end
function job.MPul(id)
- local jpi = job.positions[id]
+ local jpi = positions[id]
if jpi then
- tex.sprint('('..jpi[2]..','..jpi[3]..'+'..jpi[5]..')')
+ texprint(format('(%s,%s+%s)',jpi[2],jpi[3],jpi[5]))
else
- tex.sprint('(0pt,0pt)')
+ texprint('(0,0)')
end
end
-- todo
function job.MPpos(id)
- local jpi = job.positions[id]
+ local jpi = positions[id]
if jpi then
- tex.sprint(table.concat(jpi,',',1,6))
+ texprint(concat(jpi,',',1,6))
else
- tex.sprint('0,0pt,0pt,0pt,0pt,0pt')
+ texprint('0,0,0,0,0,0')
end
end
-function job.MPplus(id,n)
- local jpi = job.positions[id]
- if jpi then
- tex.sprint(jpi[n] or '0pt')
- else
- tex.sprint('0pt')
- end
+function job.MPplus(id,n,default)
+ local jpi = positions[id]
+ texprint((jpi and jpi[n]) or default)
end
function job.MPrest(id,default) -- 7 or 8 ?
- local jpi = job.positions[id]
- if jpi then
- tex.sprint(jpi[7] or default)
- else
- tex.sprint(default)
- end
+ local jpi = positions[id]
+ texprint((jpi and jpi[7]) or default)
end
diff --git a/tex/context/base/core-pos.mkiv b/tex/context/base/core-pos.mkiv
index 7c80984dc..ad57a8ed1 100644
--- a/tex/context/base/core-pos.mkiv
+++ b/tex/context/base/core-pos.mkiv
@@ -55,8 +55,8 @@
\def\MPul #1{\ctxlua{job.MPul("#1")}}
\def\MPpos#1{\ctxlua{job.MPpos("#1")}}
-\def\MPplus#1#2{\ctxlua{job.MPplus("#1",#2)}}
-\def\MPrest#1#2{\ctxlua{job.MPrest("#1","#2")}}
+\def\MPplus#1#2#3{\ctxlua{job.MPplus("#1",#2,"#3")}}
+\def\MPrest #1#2{\ctxlua{job.MPrest("#1","#2")}}
\def\doifpositionelse#1{\ctxlua{cs.testcase(job.positions['#1'])}}
diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex
index 4308426e9..3b56cc86a 100644
--- a/tex/context/base/core-ref.tex
+++ b/tex/context/base/core-ref.tex
@@ -1600,11 +1600,11 @@
\def\gotodestination#1#2#3#4#5% url file destination page data
{\iflocation
\ifusepagedestinations
- \gotorealpage{#1}{#2}{#4}{#5}%
+ \gotorealpage{#1}{#2}{\number#4}{#5}%
\else
\dohandlegoto
{#5}%
- {\the\everyreference\dostartgotolocation\buttonwidth\buttonheight{#1}{#2}{#3}{#4}}%
+ {\the\everyreference\dostartgotolocation\buttonwidth\buttonheight{#1}{#2}{#3}{\number#4}}%
{\dostopgotolocation}%
\fi
\else
@@ -1615,7 +1615,7 @@
{\iflocation
\dohandlegoto
{#4}%
- {\dostartgotorealpage\buttonwidth\buttonheight{#1}{#2}{#3}}%
+ {\dostartgotorealpage\buttonwidth\buttonheight{#1}{#2}{\number#3}}%
{\dostopgotorealpage}%
\else
{#4}%
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index 8efc01b52..4acdc2c8b 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -191,9 +191,10 @@ function fonts.tfm.do_scale(tfmtable, scaledpoints)
for k,v in pairs(tfmtable) do
t[k] = (type(v) == "table" and { }) or v
end
- if tfmtable.fonts then
- t.fonts = table.fastcopy(tfmtable.fonts)
- end
+-- new
+if tfmtable.fonts then
+ t.fonts = table.fastcopy(tfmtable.fonts)
+end
-- local zerobox = { 0, 0, 0, 0 }
local tp = t.parameters
for k,v in pairs(tfmtable.parameters) do
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index 0600d72fa..b6c70d264 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -85,29 +85,29 @@ if lfs then do
dir.glob_pattern = glob_pattern
- local function glob(pattern, action)
- local t = { }
- local path, rest, patt, recurse
- local action = action or function(name) t[#t+1] = name end
- local pattern = pattern:gsub("^%*%*","./**")
- local pattern = pattern:gsub("/%*/","/**/")
- path, rest = pattern:match("^(/)(.-)$")
- if path then
- path = path
- else
- path, rest = pattern:match("^([^/]*)/(.-)$")
- end
- if rest then
- patt = rest:gsub("([%.%-%+])", "%%%1")
- end
- patt = patt:gsub("%*", "[^/]*")
- patt = patt:gsub("%?", "[^/]")
- patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*")
- if path == "" then path = "." end
- recurse = patt:find("%.%*/") ~= nil
- glob_pattern(path,patt,recurse,action)
- return t
- end
+ --~ local function glob(pattern, action)
+ --~ local t = { }
+ --~ local path, rest, patt, recurse
+ --~ local action = action or function(name) t[#t+1] = name end
+ --~ local pattern = pattern:gsub("^%*%*","./**")
+ --~ local pattern = pattern:gsub("/%*/","/**/")
+ --~ path, rest = pattern:match("^(/)(.-)$")
+ --~ if path then
+ --~ path = path
+ --~ else
+ --~ path, rest = pattern:match("^([^/]*)/(.-)$")
+ --~ end
+ --~ if rest then
+ --~ patt = rest:gsub("([%.%-%+])", "%%%1")
+ --~ end
+ --~ patt = patt:gsub("%*", "[^/]*")
+ --~ patt = patt:gsub("%?", "[^/]")
+ --~ patt = patt:gsub("%[%^/%]%*%[%^/%]%*", ".*")
+ --~ if path == "" then path = "." end
+ --~ recurse = patt:find("%.%*/") ~= nil
+ --~ glob_pattern(path,patt,recurse,action)
+ --~ return t
+ --~ end
local P, S, R, C, Cc, Cs, Ct, Cv, V = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Cv, lpeg.V
@@ -121,13 +121,13 @@ if lfs then do
P("**") / ".*" +
P("*") / "[^/]*" +
P("?") / "[^/]" +
- P(".") / "%." +
- P("+") / "%+" +
- P("-") / "%-" +
+ P(".") / "%%." +
+ P("+") / "%%+" +
+ P("-") / "%%-" +
P(1)
)^0 )
- function glob(str)
+ local function glob(str)
local split = pattern:match(str)
if split then
local t = { }
@@ -136,7 +136,8 @@ if lfs then do
local recurse = base:find("**")
local start = root .. path
local result = filter:match(start .. base)
- -- print(str, start, result)
+--~ print(str, start, result)
+--~ print(start, result)
glob_pattern(start,result,recurse,action)
return t
else
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 1645912dc..bee903549 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -40,14 +40,16 @@ function lpeg.splitter(pattern, action)
return (((1-lpeg.P(pattern))^1)/action+1)^0
end
-
-local crlf = lpeg.P("\r\n")
-local cr = lpeg.P("\r")
-local lf = lpeg.P("\n")
-local space = lpeg.S(" \t\f\v")
-local newline = crlf + cr + lf
-local spacing = space^0 * newline
-local content = lpeg.Cs((1-spacing)^1) * spacing^-1 * (spacing * lpeg.Cc(""))^0
+local crlf = lpeg.P("\r\n")
+local cr = lpeg.P("\r")
+local lf = lpeg.P("\n")
+local space = lpeg.S(" \t\f\v")
+local newline = crlf + cr + lf
+local spacing = space^0 * newline
+
+local empty = spacing * lpeg.Cc("")
+local nonempty = lpeg.Cs((1-spacing)^1) * spacing^-1
+local content = (empty + nonempty)^1
local capture = lpeg.Ct(content^0)
diff --git a/tex/context/base/luat-tex.lua b/tex/context/base/luat-tex.lua
index 78e4501a1..c241bcf80 100644
--- a/tex/context/base/luat-tex.lua
+++ b/tex/context/base/luat-tex.lua
@@ -67,14 +67,24 @@ if texconfig and not texlua then
input.logger('= ' .. tag .. ' closer (' .. unicode.utfname[u] .. ')',filename)
input.show_close(filename)
end,
+--~ getline = function(n)
+--~ local line = t.lines[n]
+--~ if not line or line == "" then
+--~ return ""
+--~ else
+--~ local translator = input.filters.utf_translator
+--~ return (translator and translator(line)) or line
+--~ end
+--~ end,
reader = function(self)
self = self or t
local current, lines = self.current, self.lines
if current >= #lines then
return nil
else
- self.current = current + 1
- local line = lines[self.current]
+ current = current + 1
+ self.current = current
+ local line = lines[current]
if line == "" then
return ""
else
diff --git a/tex/context/base/lxml-ini.lua b/tex/context/base/lxml-ini.lua
index 7963e73f6..800328ba4 100644
--- a/tex/context/base/lxml-ini.lua
+++ b/tex/context/base/lxml-ini.lua
@@ -358,6 +358,11 @@ function lxml.setsetup(id,pattern,setup)
if trace then
texio.write_nl(format("lpath matched -> %s -> skipped", command))
end
+ elseif setup == "+" then
+ dtdk.command = true
+ if trace then
+ texio.write_nl(format("lpath matched -> %s -> text", command))
+ end
else
dtdk.command = command
if trace then
@@ -380,6 +385,15 @@ function lxml.setsetup(id,pattern,setup)
texio.write_nl(format("lpath matched -> %s:%s -> skipped", ns, tg))
end
end
+ elseif b == "+" then
+ dtdk.command = true
+ if trace then
+ if ns == "" then
+ texio.write_nl(format("lpath matched -> %s -> text", tg))
+ else
+ texio.write_nl(format("lpath matched -> %s:%s -> text", ns, tg))
+ end
+ end
else
dtdk.command = a .. tg
if trace then
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index a2d64e225..f4b784455 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -757,6 +757,7 @@ function metapost.graphic_extra_pass()
metapost.process(current_format, {
"beginfig(0); ",
"_trial_run_ := false ;",
+ "_tt_n_ := 0 ;", -- resettextexts
join(metapost.text_texts_data()," ;\n"),
current_graphic,
"endfig ;"
diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex
index 62d6931d6..2b17c9590 100644
--- a/tex/context/base/mult-sys.tex
+++ b/tex/context/base/mult-sys.tex
@@ -119,32 +119,23 @@
\definesystemconstant {next}
\definesystemconstant {pickup}
-
\definesystemconstant {ascii}
\definesystemconstant {default}
\definesystemconstant {unknown}
-
\definesystemconstant {action}
\definesystemconstant {compare}
-
\definesystemconstant {do}
\definesystemconstant {dodo}
-
\definesystemconstant {complex}
\definesystemconstant {simple}
-
\definesystemconstant {start}
\definesystemconstant {stop}
-
\definesystemconstant {dummy}
-
\definesystemconstant {local}
\definesystemconstant {global}
-
\definesystemconstant {done}
-
\definesystemconstant {font}
-
+\definesystemconstant {link}
\definesystemconstant {section} \let\v!sectionlevel\s!section % for old times sake
%D A more experienced \TEX\ user will recognize the next four
@@ -476,6 +467,7 @@
\definesystemvariable {lf} % LocalFigures
\definesystemvariable {lg} % taal (LanGuage)
\definesystemvariable {li} % LIjst
+\definesystemvariable {lk} % LinK
\definesystemvariable {ll} % Layers
\definesystemvariable {lx} % LayerteXt
\definesystemvariable {ln} % LijNen
diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex
index 5cd66a420..e8375d2e0 100644
--- a/tex/context/base/page-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -914,7 +914,7 @@
\bgroup
\ifcase\clevernotes\or
\getmulticolumnlines
- \advance\nofcolumnlines -2 % ?
+ \advance\nofcolumnlines \minustwo
\scratchdimen\nofcolumnlines\lineheight
\advance\scratchdimen \topskip
\setbox0\hbox
@@ -931,7 +931,7 @@
\scratchdimen\ht\firstcolumnbox
\advance\scratchdimen -\openstrutdepth % \strutdp
\getnoflines\scratchdimen
- \advance\noflines -2
+ \advance\noflines \minustwo
\scratchdimen\noflines\lineheight
\advance\scratchdimen \topskip
\setbox0\hbox
diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex
index 02d238a31..626c1445b 100644
--- a/tex/context/base/syst-gen.tex
+++ b/tex/context/base/syst-gen.tex
@@ -365,6 +365,8 @@
\newcount \zerocount
\newcount \minusone
\minusone = -1
+\newcount \minustwo
+ \minustwo = -2
\chardef \plusone = 1
\chardef \plustwo = 2
diff --git a/tex/context/base/unic-ini.mkii b/tex/context/base/unic-ini.mkii
index 000d7f948..ac1851fb6 100644
--- a/tex/context/base/unic-ini.mkii
+++ b/tex/context/base/unic-ini.mkii
@@ -163,6 +163,9 @@
%D `#4-\utf@g)}
%D \stoptyping
+% beware, unless surrounded by \numexpr .. \relax, a division
+% results in a float until the final result is calculated
+
\def\utfdiv#1{\the\numexpr (#1-\utf@g)/\utf@h \relax}
\def\utfmod#1{\the\numexpr#1-\utf@h*((#1-\utf@g)/\utf@h)\relax}
diff --git a/tex/context/base/x-mmp.mkiv b/tex/context/base/x-mmp.mkiv
index 32bf4671c..17cef5b55 100644
--- a/tex/context/base/x-mmp.mkiv
+++ b/tex/context/base/x-mmp.mkiv
@@ -13,10 +13,7 @@
% -- ignored: malignmark
% -- luacode will be moved to x-mmp.lua
-
-% \defineXMLentity[textspace] {\enspace}
-% \defineXMLentity[textcomma] {{,}}
-% \defineXMLentity[textperiod] {{.}}
+% -- { } # % _ ^ & etc escapen, {} in mathtype entities; mo/mtext
\startluacode
do
@@ -25,18 +22,30 @@
local texsprint = tex.sprint
- local replacements = {
--- [" "] = utf.char(0x2002), -- "&textspace;" -> tricky, no &; in mkiv
--- ["."] = "{.}",
--- [","] = "{,}",
- }
+ -- an alternative is to remap to private codes, where we can have
+ -- different properties .. to be done
- local reppattern = "([ %.%,])"
+ local n_replacements = {
+ -- [" "] = utf.char(0x2002), -- "&textspace;" -> tricky, no &; in mkiv
+ ["."] = "{.}",
+ [","] = "{,}",
+ }
+ local o_replacements = {
+ ["{"] = "\\{",
+ ["}"] = "\\}",
+ }
function lxml.mml.prepare_number(id,pattern)
local str = xml.content(lxml.id(id),pattern) or ""
str = str:gsub("^%s*(.-)%s*$","%1")
- str = str:gsub(reppattern,replacements)
+ str = str:gsub(".",n_replacements)
+ texsprint(str)
+ end
+
+ function lxml.mml.prepare_operator(id,pattern)
+ local str = xml.content(lxml.id(id),pattern) or ""
+ str = str:gsub("^%s*(.-)%s*$","%1")
+ str = str:gsub(".",o_replacements)
texsprint(str)
end
@@ -199,17 +208,19 @@
\startxmlsetups mml:mn % todo: mathvariant mathsize mathcolor mathbackground
\begingroup
- \rm \ctxlua{lxml.mml.prepare_number("#1","*")}
+ \mr \ctxlua{lxml.mml.prepare_number("#1","*")}
\endgroup
\stopxmlsetups
-\startxmlsetups mml:mn % todo: mathvariant mathsize mathcolor mathbackground
- \mathop{\hbox{\mr \ctxlua{lxml.mml.prepare_number("#1","*")}}}% we need . and , properly spaced
-\stopxmlsetups
-
+% hbox will make . and , behave ok, see rep patterns above as alternative
+%
+% \startxmlsetups mml:mn % todo: mathvariant mathsize mathcolor mathbackground
+% % problem, we need an hbox because of . ,
+% \mathop{\hbox{\mr \ctxlua{lxml.mml.prepare_number("#1","*")}}}% we need . and , properly spaced
+% \stopxmlsetups
\startxmlsetups mml:mo
- \edef\MMPoperator{\xmlstripped{#1}{*}}
+ \edef\MMPoperator{\ctxlua{lxml.mml.prepare_operator("#1","*")}}
\doifXMLentityelse{\detokenize\expandafter{\MMPoperator}} {
\getXMLentity\MMPoperator
} {
@@ -365,7 +376,6 @@
% \limits
% \stopsetups
-
\startsetups mml:mover
\mathop {
\edef\mmlovertoken{\xmlraw{#1}{/mml:mo[position()==2]}}
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index a2108f1e5..86fc4d151 100644
--- a/tex/context/interface/keys-cz.xml
+++ b/tex/context/interface/keys-cz.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.04.16 17:34">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.04.18 14:17">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index 0a85bb17e..cdd1c702e 100644
--- a/tex/context/interface/keys-de.xml
+++ b/tex/context/interface/keys-de.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.04.16 17:34">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.04.18 14:17">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index d85a3b7b2..ce537a676 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.04.16 17:34">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.04.18 14:17">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml
index 367608830..fb056b816 100644
--- a/tex/context/interface/keys-fr.xml
+++ b/tex/context/interface/keys-fr.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.04.16 17:34">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.04.18 14:17">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index 5188c2818..097b3f054 100644
--- a/tex/context/interface/keys-it.xml
+++ b/tex/context/interface/keys-it.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.04.16 17:34">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.04.18 14:17">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index 011e6aa05..63e719905 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.04.16 17:34">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.04.18 14:17">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index ece576eba..7ac866069 100644
--- a/tex/context/interface/keys-ro.xml
+++ b/tex/context/interface/keys-ro.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.04.16 17:34">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.04.18 14:17">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>