From 1e72402c3201340b2bd4452ed11bfb45bccabc4a Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 18 Oct 2011 23:20:15 +0300 Subject: beta 2011.10.18 22:09 --- tex/context/base/anch-pgr.mkiv | 225 ++------------------- tex/context/base/buff-ver.lua | 1 + tex/context/base/buff-ver.mkiv | 46 ----- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4096 -> 4095 bytes tex/context/base/context-version.png | Bin 105995 -> 105822 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-env.lua | 2 + tex/context/base/font-ctx.lua | 4 + tex/context/base/font-ini.mkiv | 8 +- tex/context/base/lang-mis.mkiv | 30 +-- tex/context/base/luat-mac.lua | 91 +++++---- tex/context/base/m-chart.lua | 195 +++++++++++++----- tex/context/base/m-chart.mkvi | 7 +- tex/context/base/math-ali.mkiv | 99 ++------- tex/context/base/math-ini.mkiv | 2 +- tex/context/base/math-int.mkiv | 145 +++++++------ tex/context/base/mult-de.mkii | 2 + tex/context/base/mult-def.lua | 8 + tex/context/base/mult-en.mkii | 2 + tex/context/base/mult-fr.mkii | 2 + tex/context/base/mult-it.mkii | 2 + tex/context/base/mult-nl.mkii | 2 + tex/context/base/mult-pe.mkii | 2 + tex/context/base/mult-ro.mkii | 2 + tex/context/base/node-tra.lua | 9 + tex/context/base/pack-rul.mkiv | 112 +++++----- tex/context/base/page-mis.lua | 69 +++++++ tex/context/base/page-mis.mkiv | 134 ++++++------ tex/context/base/s-mod-00.mkiv | 2 - tex/context/base/spac-hor.mkiv | 4 +- tex/context/base/status-files.pdf | Bin 23921 -> 23938 bytes tex/context/base/status-lua.pdf | Bin 163589 -> 163715 bytes tex/context/base/strc-doc.mkiv | 4 +- tex/context/base/supp-fun.mkiv | 8 +- tex/context/base/supp-vis.mkiv | 17 -- tex/context/base/syst-aux.mkiv | 62 +++++- tex/context/base/tabl-ntb.mkiv | 6 +- tex/context/base/tabl-tab.mkiv | 47 +---- tex/context/base/type-otf.mkiv | 15 +- tex/context/base/typo-ini.mkiv | 2 +- tex/context/base/typo-mar.mkiv | 18 +- tex/context/interface/keys-cs.xml | 2 + tex/context/interface/keys-de.xml | 2 + tex/context/interface/keys-en.xml | 2 + tex/context/interface/keys-fr.xml | 2 + tex/context/interface/keys-it.xml | 2 + tex/context/interface/keys-nl.xml | 2 + tex/context/interface/keys-pe.xml | 2 + tex/context/interface/keys-ro.xml | 2 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 53 files changed, 676 insertions(+), 736 deletions(-) create mode 100644 tex/context/base/page-mis.lua (limited to 'tex') diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index f86805760..906dfd73e 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -1093,22 +1093,8 @@ %D \macros %D {stackposdown, stackposup, stackposleft,stackposright} %D -%D A non graphic example of the use of positioning, is to stack -%D text in for instance the margin. -%D -%D \stackposdown \inleft {some text}The text \type {some text} -%D goes into the left margin, and \stackposdown \inleft {some -%D more}\type {some more} as well. When they overlap, they -%D will not touch. -%D -%D Here we said \type {\stackposdown \inleft{some text}}. Instead -%D of \stackposleft \inleft {one}stacking \stackposleft \inleft -%D {two}vertically, one can stack horizontally by \stackposleft -%D \inleft {three}using \type {\stackposleft}. -%D -%D We can go in all four directions, using \type {\stackposdown}, -%D \type {\stackposup}, \type {\stackposleft} and \type -%D {\stackposright}. +%D This is sort of obsolete as we have now stacking in the +%D margin in a different way. \def\stackposdistance{.5em} @@ -1117,202 +1103,23 @@ \def\POSstackprefix{stack:} -\def\dostackposbox#1#2% +\unexpanded\def\dostackposbox#1#2% {\dowithnextbox - {#2{\previousautopos\currentautopos - \global\advance\currentautopos\plusone - \edef\currentposition {\POSstackprefix\number\currentautopos}% - \edef\previousposition{\POSstackprefix\number\previousautopos}% - \hpos\currentposition{\doifoverlappingelse\currentposition\previousposition{#1}{\flushnextbox}}}}% + {#2% + \bgroup + \previousautopos\currentautopos + \global\advance\currentautopos\plusone + \edef\currentposition {\POSstackprefix\number\currentautopos}% + \edef\previousposition{\POSstackprefix\number\previousautopos}% + \hpos\currentposition{\doifoverlappingelse\currentposition\previousposition{#1}{\flushnextbox}% + \egroup}}% \hbox} -\def\stackposup {\dostackposbox{\raise\lineheight\flushnextbox}} -\def\stackposdown {\dostackposbox{\lower\lineheight\flushnextbox}} -\def\stackposleft {\dostackposbox{\copy\nextbox\hskip\nextboxwd\hskip\stackposdistance}} -\def\stackposright{\dostackposbox{\hskip\stackposdistance\hskip\nextboxwd\flushnextbox}} - -% obsolete -% -% %D \macros -% %D {stackeddown} -% %D -% %D However, a better implementation is possible with the -% %D following macro. We now have an extra key \type {stack} for -% %D margin settings. When set to \type {yes}, this macro comes -% %D into action. -% -% % Because there can be many stacked items in a line and successive lines, we -% % play dirty and adapt the position and height of the current node so that -% % this becomes visible to a next pass. -% % -% % \startbuffer -% % \inleft {test 1} test 1 \inleft {test 2} test 2 \endgraf -% % \inleft {test 3} test 3 -% % \stopbuffer -% % \getbuffer \typebuffer \flushstatus \page -% % -% % \startbuffer -% % \inleft {test 1} test 1 \inleft {test 2} test 2 \inleft {test 3} test 3 \endgraf -% % \inleft {test 4} test 4 -% % \stopbuffer -% % \getbuffer \typebuffer \flushstatus \page -% % -% % \startbuffer -% % \inleft {test 1} test 1 \endgraf -% % \inleft {test 2} test 2 \endgraf -% % \inleft {test 3} test 3 -% % \stopbuffer -% % \getbuffer \typebuffer \flushstatus \page -% % -% % \startbuffer -% % \inleft {test 1\\test 1} test 1 \inleft {test 2} test 2 \endgraf -% % \inleft {test 3} test 3 -% % \stopbuffer -% % \getbuffer \typebuffer \flushstatus \page -% % -% % \startbuffer -% % \inleft {test 1\\test 1\\test 1\\test 1\\test 1} test 1 \endgraf -% % test 2 \endgraf -% % \inleft {test 3} test 3 -% % \stopbuffer -% % \getbuffer \typebuffer \flushstatus \page -% % -% % \startbuffer -% % \inleft{test 1} test \inleft{test 2} test \inleft{test 3\\test 3} test -% % \stopbuffer -% % \getbuffer \typebuffer \flushstatus \page -% % -% % \startbuffer -% % \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test \endgraf -% % \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test -% % \stopbuffer -% % \getbuffer \typebuffer \flushstatus \page -% -% \newdimen\laststackvmove % use \scratchdimenone instead of skip -% -% \def\stackeddown -% {\bgroup -% % this macro assumes a few things and is meant to work for margin notes -% \dowithnextbox -% {\global\advance\currentautopos\plusone -% \global\laststackvmove\zeropoint -% \hpos{\POSstackprefix\number\currentautopos} -% {\edef\next -% {\nextboxht\the\nextboxht -% \nextboxdp\the\nextboxdp -% \nextboxwd\the\nextboxwd}% -% \previousautopos\currentautopos -% \scratchdimen\zeropoint -% \scratchcounter\zerocount -% \doloop -% {\advance\previousautopos\minusone -% \edef\currentposition {\POSstackprefix\number\currentautopos}% -% \edef\previousposition{\POSstackprefix\number\previousautopos}% -% \ifnum\MPp\currentposition=\MPp\previousposition\relax -% %\registerstatus{doing \number\currentautopos/\number\previousautopos}% -% \doifoverlappingelse\currentposition\previousposition -% {\scratchskip\dimexpr -% \MPy\currentposition -% -\MPy\previousposition -% -\MPd\currentposition % untested -% +\MPd\previousposition % untested -% +\MPh\currentposition -% \relax\relax % second relax realy needed, forgotten while dimexpressing -% % todo: also take depth into account -% \ifdim\scratchskip<\scratchdimen -% %\registerstatus{no \the\scratchskip}% -% \else -% %\registerstatus{yes \the\scratchskip}% -% \scratchdimen\scratchskip -% \fi}% -% \donothing % {\registerstatus{next}}% -% \ifnum\previousautopos<\zerocount\exitloop\fi -% \else -% \exitloop -% \fi}% -% \ifdim\scratchdimen=\zeropoint \else -% \bgroup -% \edef\currentposition{\POSstackprefix\number\currentautopos}% -% \scratchskip\scratchdimen -% \advance\scratchskip\MPh\currentposition -% \scratchdimen-\scratchdimen -% \advance\scratchdimen\MPy\currentposition -% %\registerstatus{old \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% -% \expanded{\replacepospxywhd -% {\currentposition}{\MPp\currentposition}{\MPx\currentposition}{\the\scratchdimen}% -% {\MPw\currentposition}{\the\scratchskip}{\MPd\currentposition}}% -% %\registerstatus{new \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% -% \egroup -% \global\laststackvmove\scratchdimen % new -% \setbox\nextbox\iftracepositions\@EA\ruledhbox\else\@EA\hbox\fi -% {\lower\scratchdimen\flushnextbox}% -% \next -% %\registerstatus{\strut}% -% \fi -% \flushnextbox}% -% \egroup}} -% -% %D The next hack make sure that margin texts near faulty -% %D strutted lines are handled ok. -% -% \newif\ifrepositionmarginbox \repositionmarginboxtrue -% -% \newcount\currentmarginpos -% -% \def\dopositionmarginbox#1% -% {\bgroup -% \ifrepositionmarginbox -% \global\advance\currentmarginpos\plusone -% %\setposition{\s!margin:\number\currentmarginpos}% not always -% \ifcase\marginrepositionmethod -% % nothing -% \or -% % nothing -% \or -% % stack / page check yet untested -% \setposition{\s!margin:\number\currentmarginpos}% -% \scratchdimen\MPy{\s!margin:\number\currentmarginpos}% -% \global\advance\currentmarginpos\plusone -% \advance\scratchdimen -\MPy{\s!margin:\number\currentmarginpos}% -% \advance\scratchdimen -\strutdp -% % new but bugged -% % \setbox#1\hbox -% % {\hskip-\MPx{\s!margin:\number\currentmarginpos}% -% % \hskip\MPx{head:\the\realpageno}% -% % \box#1}% -% % so far -% \setbox#1\hbox -% {\setposition{\s!margin:\number\currentmarginpos}% -% \raise\scratchdimen\box#1}% -% \or -% % move up -% \setposition{\s!margin:\number\currentmarginpos}% -% \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax -% \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\currentmarginpos}\relax -% \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% -% \fi -% \or -% % move up, assume end of par -% \setposition{\s!margin:\number\currentmarginpos}% -% \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax -% \getnoflines\margincontentheight -% \advance\noflines\minusone -% \scratchdimen\noflines\lineheight -% \else -% \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\currentmarginpos}\relax -% \fi -% \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% -% \fi -% \dp#1\zeropoint -% \ht#1\zeropoint -% \fi -% \graphicvadjust{\dontleavehmode\box#1}% dontleavehmode is needed to get direction right -% \egroup} -% -% % \setnewconstant\marginrepositionmethod\plusone % sidemethod -% % \setnewconstant\margincontentmethod \plusthree % textmethod % beware: 1 = old method -% % \setnewconstant\marginpagecheckmethod \plusone % splitmethod - +\unexpanded\def\stackposup {\dostackposbox{\raise\lineheight\flushnextbox}} +\unexpanded\def\stackposdown {\dostackposbox{\lower\lineheight\flushnextbox}} +\unexpanded\def\stackposleft {\dostackposbox{\copy\nextbox\hskip\nextboxwd\hskip\stackposdistance}} +\unexpanded\def\stackposright{\dostackposbox{\hskip\stackposdistance\hskip\nextboxwd\flushnextbox}} + %D \macros %D {GFC, GTC, GSC} %D diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua index 522bf0c4c..c7366d871 100644 --- a/tex/context/base/buff-ver.lua +++ b/tex/context/base/buff-ver.lua @@ -670,6 +670,7 @@ local function getrange(lines,first,last,range) -- 1,3 1,+3 fromhere,tothere if last < 0 then last = noflines + last end + local range = settings.range local what = settings_to_array(range) local r_first, r_last = what[1], what[2] local f, l = tonumber(r_first), tonumber(r_last) diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index f0f25991e..cca92cc67 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -155,52 +155,6 @@ \def\doinitializevisualizer#1% {\ifproductionrun\ctxcommand{loadvisualizer("#1")}\fi} -% \definetype[typeTEX][option=tex] -% -% \typeTEX|\example---oeps|. this---ligates---again. -% \typeTEX{\example---oeps}. this---ligates---again. -% \type {\example---oeps}. this---ligates---again. - -%D \startbuffer -%D \setuptyping[TEX][escape=yes] -%D -%D \startTEX -%D /BTEX\em sometex/ETEX -%D /BTEX\em sometex/ETEX \after -%D \before /BTEX\em sometex/ETEX -%D \before /BTEX\em sometex/ETEX \after -%D \before /BTEX\em sometex/ETEX \inbetween /BTEX\em sometex/ETEX \after -%D \before \after -%D \stopTEX -%D \stopbuffer -%D -%D \typebuffer \start \getbuffer \stop -%D -%D \startbuffer -%D \setuptyping[TEX][escape={[[,]]}] -%D -%D \startTEX -%D [[\em sometex]] -%D [[\em sometex]] \after -%D \before [[\em sometex]] -%D \before [[\em sometex]] \after -%D \before [[\em sometex]] \inbetween [[\em sometex]] \after -%D \before \after -%D \stopTEX -%D \stopbuffer -%D -%D \typebuffer \start \getbuffer \stop -%D -%D \startbuffer -%D \setuptyping[TEX][escape=//] -%D -%D \startTEX -%D //\em sometex -%D \before //\em sometex -%D \stopTEX -%D -%D \typebuffer \start \getbuffer \stop - %D Verbatim command are very sensitive to argument processing, %D which is a direct result of the \CATCODES\ being fixed at %D reading time. diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 3edc92b36..454326b97 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.10.17 10:36} +\newcontextversion{2011.10.18 22:09} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 5d451d3c2..1747b8c53 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.10.17 10:36} +\newcontextversion{2011.10.18 22:09} %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-version.pdf b/tex/context/base/context-version.pdf index f0c4f4aee..42e949c07 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 6dea04295..542cb6e37 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index a853a81a6..a5cb432a0 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.10.17 10:36} +\edef\contextversion{2011.10.18 22:09} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index c2f999216..c98936a32 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.10.17 10:36} +\edef\contextversion{2011.10.18 22:09} %D For those who want to use this: diff --git a/tex/context/base/core-env.lua b/tex/context/base/core-env.lua index 737904d23..543dc188f 100644 --- a/tex/context/base/core-env.lua +++ b/tex/context/base/core-env.lua @@ -74,6 +74,8 @@ setmetatableindex(tex.ifs, function(t,k) return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper end) +-- todo : global + function tex.settrue(name) texcount[name] = 0 end diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index d47fc11d9..4a902c1e4 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -1367,3 +1367,7 @@ to scale virtual characters.

-- end -- end -- end + +function commands.setfontofid(id) + context.getvalue(csnames[id]) +end diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index d77733a29..832806547 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -1623,7 +1623,7 @@ %D unwanted loop, we temporary redefine \type{\c!text}. For %D the moment this in only place that some trickery is needed %D to fool the multilingual interface. However, long ago -%D we decided to stick to \s!text in definitions as it closely +%D we decided to stick to \type {\s!text} in definitions as it closely %D relates to the math model where text, script and scriptscript %D are used untranslated. Also, we are now english at the low %D level so it cannot go wrong anymore. @@ -4102,7 +4102,7 @@ %D The last implementation of \type {\getglyph} permits %D definitions like: %D -%D \starttypings +%D \starttyping %D \definefontsynonym [EuroSans] [eurose] %D \definefontsynonym [EuroSansBold] [euroseb] %D \definefontsynonym [EuroSansItalic] [eurosei] @@ -4636,5 +4636,9 @@ \unexpanded\edef\vsone#1{#1\utfchar{"FE00}} % used \unexpanded\edef\vstwo#1{#1\utfchar{"FE01}} % not used but handy for testing +% new: + +\unexpanded\def\setfontofid#1{\ctxcommand{setfontofid(#1)}} + \protect \endinput diff --git a/tex/context/base/lang-mis.mkiv b/tex/context/base/lang-mis.mkiv index 8f130e881..71b23e580 100644 --- a/tex/context/base/lang-mis.mkiv +++ b/tex/context/base/lang-mis.mkiv @@ -13,17 +13,8 @@ \writestatus{loading}{ConTeXt Language Macros / Compounds} -%D \gdef\starttest -%D {\blank -%D \noindent -%D \halign\bgroup\tt##\hskip2em&##\hskip2em&##\cr} -%D -%D \gdef\stoptest -%D {\egroup -%D \blank} -%D -%D \gdef\test#1% -%D {\defconvertedargument\ascii{#1}\ascii&\hyphenatedword{#1}\cr} +%D \gdef\starttest#1\stoptest{\starttabulate[|l|l|p|]#1\stoptabulate} +%D \gdef\test #1{\NC\detokenize{#1}\NC\hyphenatedword{#1}\NC#1\NC\NR} \unprotect @@ -131,31 +122,30 @@ %D compound words is using \type{||}, which is installed by: %D %D \starttyping -%D \installdiscretionaries || - +%D \installdiscretionary | - %D \stoptyping %D %D Some alternative definitions are: %D %D \startbuffer -%D \installdiscretionaries ** - -%D \installdiscretionaries ++ - -%D \installdiscretionaries // - -%D \installdiscretionaries ~~ - +%D \installdiscretionary * - +%D \installdiscretionary + - +%D \installdiscretionary / - +%D \installdiscretionary ~ - %D \stopbuffer %D %D \typebuffer %D %D after which we can say: %D -%D \bgroup -%D \getbuffer +%D \start \getbuffer %D \starttest %D \test {test**test**test} %D \test {test++test++test} %D \test {test//test//test} %D \test {test~~test~~test} %D \stoptest -%D \egroup +%D \stop %D \macros %D {compoundhyphen, @@ -447,7 +437,7 @@ % \ifx\normalcompound\undefined \let\normalcompound=| \fi -%D \installdiscretionary | + +%D \installdiscretionary | + %D \installdiscretionary + = \def\defaultdiscretionaryhyphen{\compoundhyphen} diff --git a/tex/context/base/luat-mac.lua b/tex/context/base/luat-mac.lua index 4bc028f5c..5189759a5 100644 --- a/tex/context/base/luat-mac.lua +++ b/tex/context/base/luat-mac.lua @@ -122,9 +122,9 @@ local grammar = { "converter", texcode = pushlocal * startcode * spaces - * name - * spaces - * (declaration + furthercomment + (1 - newline - space))^0 + * (name * spaces)^1 -- new: multiple + -- * (declaration + furthercomment + (1 - newline - space))^0 + * ((declaration * (space^0/""))^1 + furthercomment + (1 - newline - space))^0 -- accepts #a #b #c * V("texbody") * stopcode * poplocal, @@ -230,45 +230,52 @@ if resolvers.schemes then end ---~ print(macros.preprocessed([[\def\bla#bla{bla#{bla}}]])) ---~ print(macros.preprocessed([[\def\bla#bla{#{bla}bla}]])) ---~ print(macros.preprocessed([[\def\blä#{blá}{blà:#{blá}}]])) ---~ print(macros.preprocessed([[\def\blä#bla{blà:#bla}]])) ---~ print(macros.preprocessed([[\setvalue{xx}#bla{blà:#bla}]])) ---~ print(macros.preprocessed([[\def\foo#bar{\setvalue{xx#bar}{#bar}}]])) ---~ print(macros.preprocessed([[\def\bla#bla{bla:#{bla}}]])) ---~ print(macros.preprocessed([[\def\bla_bla#bla{bla:#bla}]])) ---~ print(macros.preprocessed([[\def\test#oeps{test:#oeps}]])) ---~ print(macros.preprocessed([[\def\test_oeps#oeps{test:#oeps}]])) ---~ print(macros.preprocessed([[\def\test#oeps{test:#{oeps}}]])) ---~ print(macros.preprocessed([[\def\test#{oeps:1}{test:#{oeps:1}}]])) ---~ print(macros.preprocessed([[\def\test#{oeps}{test:#oeps}]])) ---~ print(macros.preprocessed([[\def\test#{oeps}{test:#oeps \halign{##\cr #oeps\cr}]])) ---~ print(macros.preprocessed([[\def\test#{oeps}{test:#oeps \halign{##\cr #oeps\cr}}]])) ---~ print(macros.preprocessed([[% test ---~ \def\test#oeps{#oeps} % {test} ---~ % test ---~ ---~ % test ---~ two ---~ %test]])) ---~ print(macros.preprocessed([[ ---~ \def\scrn_button_make_normal#namespace#current#currentparameter#text% ---~ {\ctxlua{structures.references.injectcurrentset(nil,nil)}% ---~ % \hbox attr \referenceattribute \lastreferenceattribute {\localframed[#namespace:#current]{#text}}} ---~ \hbox attr \referenceattribute \lastreferenceattribute {\directlocalframed[#namespace:#current]{#text}}} ---~ ]])) ---~ ---~ print(macros.preprocessed([[ ---~ \def\definefoo[#name]% ---~ {\setvalue{start#name}{\dostartfoo{#name}}} ---~ \def\dostartfoo#name% ---~ {\def\noexpand\next#content\expandafter\noexpand\csname stop#name\endcsname{#name : #content}% ---~ \next} ---~ \def\dostartfoo#name% ---~ {\normalexpanded{\def\noexpand\next#content\expandafter\noexpand\csname stop#name\endcsname}{#name : #content}% ---~ \next} ---~ ]])) +-- print(macros.preprocessed( +-- [[ +-- \starttexdefinition unexpanded test #aa #bb #cc +-- test +-- \stoptexdefinition +-- ]])) + +-- print(macros.preprocessed([[\def\bla#bla{bla#{bla}}]])) +-- print(macros.preprocessed([[\def\bla#bla{#{bla}bla}]])) +-- print(macros.preprocessed([[\def\blä#{blá}{blà:#{blá}}]])) +-- print(macros.preprocessed([[\def\blä#bla{blà:#bla}]])) +-- print(macros.preprocessed([[\setvalue{xx}#bla{blà:#bla}]])) +-- print(macros.preprocessed([[\def\foo#bar{\setvalue{xx#bar}{#bar}}]])) +-- print(macros.preprocessed([[\def\bla#bla{bla:#{bla}}]])) +-- print(macros.preprocessed([[\def\bla_bla#bla{bla:#bla}]])) +-- print(macros.preprocessed([[\def\test#oeps{test:#oeps}]])) +-- print(macros.preprocessed([[\def\test_oeps#oeps{test:#oeps}]])) +-- print(macros.preprocessed([[\def\test#oeps{test:#{oeps}}]])) +-- print(macros.preprocessed([[\def\test#{oeps:1}{test:#{oeps:1}}]])) +-- print(macros.preprocessed([[\def\test#{oeps}{test:#oeps}]])) +-- print(macros.preprocessed([[\def\test#{oeps}{test:#oeps \halign{##\cr #oeps\cr}]])) +-- print(macros.preprocessed([[\def\test#{oeps}{test:#oeps \halign{##\cr #oeps\cr}}]])) +-- print(macros.preprocessed([[% test +-- \def\test#oeps{#oeps} % {test} +-- % test +-- +-- % test +-- two +-- %test]])) +-- print(macros.preprocessed([[ +-- \def\scrn_button_make_normal#namespace#current#currentparameter#text% +-- {\ctxlua{structures.references.injectcurrentset(nil,nil)}% +-- % \hbox attr \referenceattribute \lastreferenceattribute {\localframed[#namespace:#current]{#text}}} +-- \hbox attr \referenceattribute \lastreferenceattribute {\directlocalframed[#namespace:#current]{#text}}} +-- ]])) +-- +-- print(macros.preprocessed([[ +-- \def\definefoo[#name]% +-- {\setvalue{start#name}{\dostartfoo{#name}}} +-- \def\dostartfoo#name% +-- {\def\noexpand\next#content\expandafter\noexpand\csname stop#name\endcsname{#name : #content}% +-- \next} +-- \def\dostartfoo#name% +-- {\normalexpanded{\def\noexpand\next#content\expandafter\noexpand\csname stop#name\endcsname}{#name : #content}% +-- \next} +-- ]])) -- Just an experiment: -- diff --git a/tex/context/base/m-chart.lua b/tex/context/base/m-chart.lua index 1545e66c5..772ae47f2 100644 --- a/tex/context/base/m-chart.lua +++ b/tex/context/base/m-chart.lua @@ -6,44 +6,60 @@ if not modules then modules = { } end modules ['x-flow'] = { license = "see context related readme files" } --- when we can resolve mpcolor at the lua end we will use metapost.graphic(....) directly +-- when we can resolve mpcolor at the lua end we will +-- use metapost.graphic(....) directly + +-- todo: labels moduledata.charts = moduledata.charts or { } local gsub, match, find, format, lower = string.gsub, string.match, string.find, string.format, string.lower local lpegmatch = lpeg.match +local setmetatableindex = table.setmetatableindex + +local points = number.points + +local variables = interfaces.variables -local points = number.points -local variables = interfaces.variables +local v_yes = variables.yes +local v_no = variables.no +local v_none = variables.none +local v_standard = variables.standard +local v_start = variables.start +local v_overlay = variables.overlay +local v_round = variables.round +local v_test = variables.test local defaults = { chart = { name = "", option = "", backgroundcolor = "", - width = 0, - height = 0, - dx = 0, - dy = 0, + width = 100*65436, + height = 50*65436, + dx = 30*65436, + dy = 30*65436, offset = 0, bodyfont = "", dot = "", + hcompact = variables_no, + vcompact = variables_no, }, shape = { -- FLOS rulethickness = 65436, default = "", - framecolor = "green", - backgroundcolor = "yellow", + framecolor = "darkblue", + backgroundcolor = "lightgray", }, focus = { -- FLOF rulethickness = 65436, - framecolor = "red", - backgroundcolor = "yellow", + framecolor = "darkred", + backgroundcolor = "gray", }, line = { -- FLOL rulethickness = 65436, - radius = 65436, - color = "blue", + radius = 10*65436, + color = "darkgreen", corner = "", dash = "", arrow = "", @@ -87,7 +103,7 @@ local validlabellocations = { b = "b", bottom = "b", } -table.setmetatableindex(validshapes,function(t,k) +setmetatableindex(validshapes,function(t,k) local l = gsub(lower(k)," ","") local v = rawget(t,l) if not v then @@ -123,6 +139,36 @@ function commands.flow_stop_chart() data, hash, temp = nil, nil, nil end +-- function commands.flow_set(chartname,chartdata) +-- local hash = { } +-- local data = { } +-- charts[name] = { +-- data = data, +-- hash = hash, +-- } +-- for i=1,#chartdata do +-- local di = data[i] +-- local name = di.name or "" +-- if name then +-- data[#data+1] = { +-- name = name, +-- labels = di.labels or { }, +-- comments = di.comments or { }, +-- exits = di.exits or { }, +-- connections = di.connections or { }, +-- settings = di.settings or { }, +-- x = di.x or 1, +-- y = di.y or 1, +-- } +-- hash[name] = i +-- end +-- end +-- end + +function commands.flow_reset(chartname) + charts[name] = nil +end + function commands.flow_set_current_cell(n) temp = data[tonumber(n)] or { } end @@ -223,20 +269,43 @@ local function inject(includedata,data,hash) y = si.y + yoffset, settings = settings, } - table.setmetatableindex(t,si) + setmetatableindex(t,si) data[#data+1] = t hash[si.name or #data] = t end end -local function expanded(chart) +local function pack(data,field) + local list, max = { }, 0 + for e=1,#data do + local d = data[e] + local f = d[field] + list[f] = true + if f > max then + max = f + end + end + for i=1,max do + if not list[i] then + for e=1,#data do + local d = data[e] + local f = d[field] + if f > i then + d[field] = f - 1 + end + end + end + end +end + +local function expanded(chart,chartsettings) local expandeddata = { } local expandedhash = { } local expandedchart = { data = expandeddata, hash = expandedhash, } - table.setmetatableindex(expandedchart,chart) + setmetatableindex(expandedchart,chart) local data = chart.data local hash = chart.hash for i=1,#data do @@ -248,13 +317,41 @@ local function expanded(chart) expandedhash[di.name or #expandeddata] = di end end + -- + expandedchart.settings = chartsettings or { } + -- make locals + chartsettings.shape = chartsettings.shape or { } + chartsettings.focus = chartsettings.focus or { } + chartsettings.line = chartsettings.line or { } + chartsettings.set = chartsettings.set or { } + chartsettings.split = chartsettings.split or { } + chartsettings.chart = chartsettings.chart or { } + setmetatableindex(chartsettings.shape,defaults.shape) + setmetatableindex(chartsettings.focus,defaults.focus) + setmetatableindex(chartsettings.line ,defaults.line ) + setmetatableindex(chartsettings.set ,defaults.set ) + setmetatableindex(chartsettings.split,defaults.split) + setmetatableindex(chartsettings.chart,defaults.chart) + -- + if chartsettings.chart.vcompact == v_yes then + pack(expandeddata,"y") + end + if chartsettings.chart.hcompact == v_yes then + pack(expandeddata,"x") + end + -- for i=1,#expandeddata do local cell = expandeddata[i] local settings = cell.settings if not settings then - cell.settings = chart.settings + cell.settings = chartsettings else - table.setmetatableindex(settings,chart.settings) + settings.shape = settings.shape or { } + settings.focus = settings.focus or { } + settings.line = settings.line or { } + setmetatableindex(settings.shape,chartsettings.shape) + setmetatableindex(settings.focus,chartsettings.focus) + setmetatableindex(settings.line ,chartsettings.line) end end return expandedchart @@ -263,11 +360,14 @@ end local splitter = lpeg.splitat(",") -function commands.flow_set_location(str) -- handle include differently - -- wrong: delay real x,y, only store relative - local x, y = lpegmatch(splitter,str) +function commands.flow_set_location(x,y) + if type(x) == "string" and not y then + x, y = lpegmatch(splitter,x) + end if not x or x == "" then x = last_x + elseif type(x) == "number" then + -- ok elseif x == "+" then x = last_x + 1 elseif x == "-" then @@ -279,6 +379,8 @@ function commands.flow_set_location(str) -- handle include differently end if not y or y == "" then y = last_y + elseif type(y) == "number" then + -- ok elseif y == "+" then y = last_y + 1 elseif x == "-" then @@ -296,12 +398,12 @@ end function commands.flow_set_connection(location,displacement,name) local dx, dy = lpegmatch(splitter,displacement) - dx = tonumber(dx) or 1 - dy = tonumber(dy) or 1 + dx = tonumber(dx) + dy = tonumber(dy) temp.connections[#temp.connections+1] = { location = location, - dx = dx - 1, - dy = dy - 1, + dx = dx or 0, + dy = dy or 0, name = name, } end @@ -356,12 +458,13 @@ local function process_cells(chart,xoffset,yoffset) for i=1,#data do local cell = visible(chart,data[i]) if cell then + local settings = cell.settings + local shapesettings = settings.shape local shape = cell.shape if not shape or shape == "" then - shape = settings.shape.default or "none" + shape = shapesettings.default or "none" end - if shape ~= variables.none then - local settings = cell.settings + if shape ~= v_none then local shapedata = validshapes[shape] context("flow_begin_sub_chart ;") if shapedata.kind == "line" then @@ -380,7 +483,6 @@ local function process_cells(chart,xoffset,yoffset) context("flow_shape_fill_color := \\MPcolor{%s} ;", shapesettings.backgroundcolor) context("flow_shape_line_width := %s ; " , points(shapesettings.rulethickness)) end - context("bodyfontsize := 10pt ;") -- todo context("flow_peepshape := false ;") -- todo context("flow_new_shape(%s,%s,%s) ;",cell.x+xoffset,cell.y+yoffset,shapedata.number) context("flow_end_sub_chart ;") @@ -417,10 +519,10 @@ local function process_connections(chart,xoffset,yoffset) local where_cell = where[where_cell] or "left" local where_other = where[where_other] or "right" local linesettings = settings.line - context("flow_smooth := %s ;", linesettings.corner == variables.round and "true" or "false") - context("flow_dashline := %s ;", linesettings.dash == variables.yes and "true" or "false") - context("flow_arrowtip := %s ;", linesettings.arrow == variables.yes and "true" or "false") - context("flow_touchshape := %s ;", linesettings.offset == variables.none and "true" or "false") + context("flow_smooth := %s ;", linesettings.corner == v_round and "true" or "false") + context("flow_dashline := %s ;", linesettings.dash == v_yes and "true" or "false") + context("flow_arrowtip := %s ;", linesettings.arrow == v_yes and "true" or "false") + context("flow_touchshape := %s ;", linesettings.offset == v_none and "true" or "false") context("flow_dsp_x := %s ; flow_dsp_y := %s ;",connection.dx or 0, connection.dy or 0) context("flow_connection_line_color := \\MPcolor{%s} ;",linesettings.color) context("flow_connection_line_width := 2pt ;",points(linesettings.rulethickness)) @@ -486,6 +588,10 @@ local function process_texts(chart,xoffset,yoffset) end local function getchart(settings) + if not settings then + print("no settings given") + return + end local chartname = settings.chart.name if not chartname then print("no name given") @@ -496,9 +602,7 @@ local function getchart(settings) print("no such chart",chartname) return end - chart.settings = settings - table.setmetatableindex(settings,defaults) - chart = expanded(chart) + chart = expanded(chart,settings) local _, _, nx, ny = check_cells(chart,0,0,0,0,0,0) chart.from_x = chart.settings.chart.x or 1 chart.from_y = chart.settings.chart.y or 1 @@ -506,6 +610,7 @@ local function getchart(settings) chart.to_y = chart.settings.chart.ny or ny chart.nx = chart.to_x - chart.from_x + 1 chart.ny = chart.to_y - chart.from_y + 1 +-- inspect(chart) return chart end @@ -514,16 +619,16 @@ local function makechart(chart) context.begingroup() context.forgetall() -- - local bodyfont = settings.chart.bodyfont - if bodyfont ~= "" then - context.switchtobodyfont { bodyfont } - end + -- local bodyfont = settings.chart.bodyfont + -- if bodyfont ~= "" then + -- context.switchtobodyfont { bodyfont } + -- end -- context.startMPcode() context("if unknown context_flow : input mp-char.mpiv ; fi ;") context("flow_begin_chart(0,%s,%s);",chart.nx,chart.ny) -- - if settings.chart.option == variables.test or settings.chart.dot == variables.yes then + if settings.chart.option == v_test or settings.chart.dot == v_yes then context("flow_show_con_points := true ;") context("flow_show_mid_points := true ;") context("flow_show_all_points := true ;") @@ -564,9 +669,9 @@ local function makechart(chart) context("flow_connection_dash_size := %s ;", points(radius)) -- local offset = settings.chart.offset -- todo: pass string - if offset == variables.none or offset == variables.overlay or offset == "" then + if offset == v_none or offset == v_overlay or offset == "" then offset = -2.5 * radius -- or rulethickness? - elseif offset == variables.standard then + elseif offset == v_standard then offset = radius -- or rulethickness? end context("flow_chart_offset := %s ;",points(offset)) @@ -585,7 +690,7 @@ function commands.flow_make_chart(settings) local chart = getchart(settings) if chart then local settings = chart.settings - if settings.split.state == variables.start then + if settings.split.state == v_start then local nx = chart.settings.split.nx local ny = chart.settings.split.ny local x = 1 diff --git a/tex/context/base/m-chart.mkvi b/tex/context/base/m-chart.mkvi index dc92259d2..2d9ad33ae 100644 --- a/tex/context/base/m-chart.mkvi +++ b/tex/context/base/m-chart.mkvi @@ -183,6 +183,7 @@ \insidefloattrue \dontcomplain \setupFLOWchart[#settings]% + \setupbodyfont[\FLOWchartparameter\c!bodyfont]% \ctxcommand{flow_make_chart { chart = { name = "#name", @@ -193,8 +194,10 @@ dx = \number\dimexpr\FLOWchartparameter\c!dx, dy = \number\dimexpr\FLOWchartparameter\c!dy, offset = \number\dimexpr\FLOWchartparameter\c!offset, - bodyfont = "\FLOWchartparameter\c!bodyfont", + % bodyfont = "\FLOWchartparameter\c!bodyfont", dot = "\FLOWchartparameter\c!dot", % private option + hcompact = "\FLOWchartparameter\c!hcompact", % undocumented option + vcompact = "\FLOWchartparameter\c!vcompact", % undocumented option }, shape = { rulethickness = \number\dimexpr\FLOWshapeparameter\c!rulethickness, @@ -428,7 +431,7 @@ \text {start} \connection [bl] {one} \stopFLOWcell - \startFLOWcell + \startFLOWcell[framecolor=darkred] \name {one} % \destination{CloseDocument} \location {2,2} diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index 4204f0d2b..b33838737 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -179,11 +179,6 @@ \dostoptagged % finish cell \dodoubleempty\math_alignment_NR_indeed} % use xx from tabulate -% amstex compatibility mode: (ugly, will disappear) -% \def\notag{\def\\{&\crcr}}% -% \doifelse{#2}{*}{\def\\{&\crcr}}{\def\\{&\doalignNR[+][]\crcr}}% -% end of compatibility mode - \appendtoks \glet\math_alignment_NC\math_alignment_NC_first \unexpanded\def\NC{\math_alignment_NC}% messy, due to lookahead (we cannot use a flag) @@ -311,17 +306,6 @@ %D %D \startbuffer %D \placeformula \startformula \startalign -%D a &= b \\ -%D c &= d \notag \\ -%D &= e \notag \\ -%D &= f \\ -%D \stopalign \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D \startbuffer -%D \placeformula \startformula \startalign %D \NC a \NC \eq b \NR[+] %D \NC c \NC \neq d \NR %D \NC \NC \neq f \NR[for:demo-b-1] @@ -334,53 +318,6 @@ %D \typebuffer \getbuffer %D %D \startbuffer -%D \placeformula \startformula \startalign[*] -%D a &= b \\ -%D c &= d \\ -%D &= e \\ -%D &= f \\ -%D \stopalign \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D \startbuffer -%D \placeformula \startformula \startalign -%D x &= y \\ -%D a &= b \\ -%D \stopalign \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D \startbuffer -%D \placeformula \startformula \startalign[m=3] -%D x &= y & x &= y & z &= t \\ -%D a &= b & p &= q & w &= s \\ -%D \stopalign \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D \startbuffer -%D \placeformula \startformula \startalign[m=3,distance=0pt] -%D x &= y &= x &= y &= z &= t \\ -%D a &= b &= p &= q &= w &= s \\ -%D \stopalign \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D \startbuffer -%D \placeformula \startformula \startalign[n=5,distance=0pt] -%D x &= yy &= xx &= yy &= zz \\ -%D a &= b &= p &= q &= w \\ -%D \stopalign \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D \startbuffer %D \placeformula \startformula \startalign[n=3,align={left,middle,right}] %D \NC l \NC = \NC r \NR %D \NC left \NC = \NC right \NR @@ -895,23 +832,23 @@ \penalty\predisplaypenalty \beforedisplayspace} -% %D \macros -% %D {substack} -% %D -% %D Preliminary code: -% %D -% %D \starttyping -% %D \startformula -% %D \sum_{% -% %D \startsubstack -% %D i = 1 \NR -% %D i \neq n \NR -% %D i \neq m -% %D \stopsubstack -% %D }a_i -% %D \stopformula -% %D \stoptyping - +% \macros +% {substack} +% +% Preliminary code: +% +% \starttyping +% \startformula +% \sum_{% +% \startsubstack +% i = 1 \NR +% i \neq n \NR +% i \neq m +% \stopsubstack +% }a_i +% \stopformula +% \stoptyping +% % \unexpanded\def\startsubstack % {\begingroup % \emptyhbox @@ -928,7 +865,7 @@ % \mathsurround\zeropoint % \everycr\emptytoks % \halign\bgroup\hfil$\scriptstyle\mathstrut##$\hfil\crcr} - +% % \unexpanded\def\stopsubstack % {\crcr % \egroup diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 511b9226e..075935f4d 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -346,7 +346,7 @@ \let\hbox\mbox \to\everymathematics} -%D needed for sin, cos etc (todo: store #1 so that we can export it) +%D The next hack is needed needed for sine, cosine etc. \let\mathfunction\firstofoneargument diff --git a/tex/context/base/math-int.mkiv b/tex/context/base/math-int.mkiv index de3ff2608..6ad089bf6 100644 --- a/tex/context/base/math-int.mkiv +++ b/tex/context/base/math-int.mkiv @@ -16,14 +16,15 @@ \unprotect %D \startbuffer -%D $\int_a^b f(x) dx$ and also -%D $\iint_a^b f(x,y) dxdy$, $\iiint_a^b f(x,y) dxdy$, -%D $\iiiint_a^b f(x) dx$ +%D $\int _a^b f(x) dx $ and also +%D $\iint _a^b f(x,y) dxdy$, +%D $\iiint _a^b f(x,y) dxdy$, +%D $\iiiint _a^b f(x) dx $. %D \startformula -%D \int_a^b f(x) dx \quad -%D \iint_a^b f(x) dx \quad -%D \iiint_a^b f(x) dx \quad -%D \iiiint_a^b f(x) dx \quad +%D \int _a^b f(x) dx \quad +%D \iint _a^b f(x) dx \quad +%D \iiint _a^b f(x) dx \quad +%D \iiiint _a^b f(x) dx \quad %D \stopformula %D \stopbuffer %D @@ -33,81 +34,97 @@ %D %D Limits: \setupmathematics[integral=limits] \getbuffer +%D Adapted to mkiv by HH from code by AM. + +\ifx\v!integral\undefined \def\v!integral{integral} \fi + \newconstant\mathintlimitmode % 0 nolimits 1 displaylimits 2 limits -\def\intlimits - {\ifcase\mathintlimitmode \nolimits \or \displaylimits \or \limits \fi} +\def\intlimits % also used elsewhere + {\ifcase\mathintlimitmode + \nolimits + \or + \displaylimits + \or + \limits + \fi} -\ifx\v!integral\undefined \def\v!integral{integral} \fi +\letvalue{\??mo::\v!integral::nolimits}\zerocount +\letvalue{\??mo::\v!integral::displaylimits}\plusone +\letvalue{\??mo::\v!integral::limits}\plustwo \appendtoks - \processaction - [\mathematicsparameter\v!integral] - [ nolimits=>\mathintlimitmode\zerocount, - displaylimits=>\mathintlimitmode\plusone, - limits=>\mathintlimitmode\plustwo]% + \mathintlimitmode\executeifdefined{\??mo::\v!integral::limits}\zerocount \to \everysetupmathematics \setupmathematics [\v!integral=nolimits] -%D More integrals (AM): - -%def\integralrepeatsymbol{\intop} -\def\integralrepeatsymbol{{\int}} - -% \def\repeatintegral#1% -% {\scratchtoks\emptytoks -% \let\dointlimits\donothing -% \let\dodointlimits\intlimits -% \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks}% -% \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks -% \edef\dodorepeatintegral{\the\scratchtoks}% -% \futurelet\next\dorepeatintegral} - -% \definemathcommand [iint] {\repeatintegral\plusone } -% \definemathcommand [iiint] {\repeatintegral\plustwo } -% \definemathcommand [iiiint] {\repeatintegral\plusthree} - -\def\fakerepeatintegral#1% - {\scratchtoks\emptytoks - \dorecurse{#1}{\appendtoks \integralrepeatsymbol \dointkern \to \scratchtoks}% - \appendtoks \intop \dointlimits \dodointlimits \to \scratchtoks - \edef\dodorepeatintegral{\the\scratchtoks}} - -\def\repeatintegral#1#2#3% - {\let\dointlimits\donothing - \let\dodointlimits\intlimits +%D The following code is used for fallbacks and might become obsolete once +%D we have enough \OPENTYPE\ math fonts. + +\def\math_repeated_integal_i + {\int} + +\def\math_repeated_integal_ii + {\math_repeated_integal_i + \math_repeated_integral_kern + \math_repeated_integal_i + \math_repeat_integral_finish + \intlimits} + +\def\math_repeated_integal_iii + {\math_repeated_integal_i + \math_repeated_integral_kern + \math_repeated_integal_ii} + +\def\math_repeated_integal_iiii + {\math_repeated_integal_i + \math_repeated_integral_kern + \math_repeated_integal_iii} + +\unexpanded\def\math_repeat_integral#1% + {\let\math_repeat_integral_finish\donothing \iffontchar\textfont\zerocount#1\relax - %\edef\dodorepeatintegral{\utfchar{#1}}% - \let\dodorepeatintegral#2% + \expandafter\math_repeat_integral_real \else - \fakerepeatintegral{#3}% - \fi - \futurelet\next\dorepeatintegral} + \expandafter\math_repeat_integral_fake + \fi} -% This is a temporary solution, as we will make a virtual glyph in lm. +\def\math_repeat_integral_fake#1#2% + {\let\math_repeat_integral_fake_symbol#2% + \futurelet\next\math_repeat_integral_fake_indeed} -\definemathcommand [iint] {\repeatintegral{"222B}\normaliint \plusone } -\definemathcommand [iiint] {\repeatintegral{"222C}\normaliiint \plustwo } -\definemathcommand [iiiint] {\repeatintegral{"222D}\normaliiiint\plusthree} +\def\math_repeat_integral_real#1#2% + {#1} -%D If the \type{\limits} option is used after \type{\iint}, use -%D \type{\mathop} and fudge the left hand space a bit to make the -%D subscript visually centered. +\definemathcommand [iint] {\math_repeat_integral{"0222C}\normalint \math_repeated_integal_ii } % double +\definemathcommand [iiint] {\math_repeat_integral{"0222D}\normaliint \math_repeated_integal_iii } % tripple +\definemathcommand [iiiint] {\math_repeat_integral{"FFFFF}\normaliiint\math_repeated_integal_iiii} % quadruple -\def\dointkern +\def\math_repeated_integral_kern {\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}} -\def\dorepeatintegral - {\ifx\next\limits \dointlimitcorrection \else - \ifx\next\displaylimits \dointlimitcorrection \else - \ifx\next\nolimits \donothing \else - \ifcase\mathintlimitmode\else \dointlimitcorrection \fi\fi\fi\fi - \dodorepeatintegral} - -\def\dointlimitcorrection +\def\math_repeat_integral_fake_indeed + {\ifx\next\limits + \math_repeated_integral_correction + \else\ifx\next\displaylimits + \math_repeated_integral_correction + \else\ifx\next\nolimits + % nothing + \else\ifcase\mathintlimitmode + % nothing + \else + \math_repeated_integral_correction + \fi\fi\fi\fi + \math_repeat_integral_fake_symbol} + +\def\math_repeated_integral_correction {\mkern-7mu\mathchoice{\mkern-2mu}{}{}{}% - \mathop\bgroup\mkern7mu\mathchoice{\mkern2mu}{}{}{}\let\dointlimits\egroup} + \mathop\bgroup\mkern7mu\mathchoice{\mkern2mu}{}{}{}\let\math_repeat_integral_finish\egroup} + +%D If the \type{\limits} option is used after \type {\iint}, use \type +%D {\mathop} and fudge the left hand space a bit to make the subscript +%D visually centered. \protect \endinput diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index 845c2272f..589ed7bac 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -689,6 +689,7 @@ \setinterfaceconstant{global}{global} \setinterfaceconstant{grid}{gritter} \setinterfaceconstant{hang}{haengend} +\setinterfaceconstant{hcompact}{hcompact} \setinterfaceconstant{headalign}{headalign} \setinterfaceconstant{headcolor}{kopffarbe} \setinterfaceconstant{headcommand}{headcommand} @@ -1023,6 +1024,7 @@ \setinterfaceconstant{validate}{validieren} \setinterfaceconstant{values}{values} \setinterfaceconstant{vcommand}{vbefehl} +\setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{veroffset}{kopfoffset} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{voffset}{voffset} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index d862b80e5..da43faec5 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -6471,6 +6471,14 @@ return { }, }, ["constants"]={ + ["hcompact"]={ + ["en"]="hcompact", + ["nl"]="hcomprimeer", + }, + ["vcompact"]={ + ["en"]="vcompact", + ["nl"]="vcomprimeer", + }, ["keys"]={ ["en"]="keys", ["nl"]="sleutels", -- brrr diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index f40bcc096..55918c294 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -689,6 +689,7 @@ \setinterfaceconstant{global}{global} \setinterfaceconstant{grid}{grid} \setinterfaceconstant{hang}{hang} +\setinterfaceconstant{hcompact}{hcompact} \setinterfaceconstant{headalign}{headalign} \setinterfaceconstant{headcolor}{headcolor} \setinterfaceconstant{headcommand}{headcommand} @@ -1023,6 +1024,7 @@ \setinterfaceconstant{validate}{validate} \setinterfaceconstant{values}{values} \setinterfaceconstant{vcommand}{vcommand} +\setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{veroffset}{veroffset} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{voffset}{voffset} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 4ae1731c1..8c01e1810 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -689,6 +689,7 @@ \setinterfaceconstant{global}{global} \setinterfaceconstant{grid}{grille} \setinterfaceconstant{hang}{suspend} +\setinterfaceconstant{hcompact}{hcompact} \setinterfaceconstant{headalign}{headalign} \setinterfaceconstant{headcolor}{couleurtete} \setinterfaceconstant{headcommand}{commandetete} @@ -1023,6 +1024,7 @@ \setinterfaceconstant{validate}{valider} \setinterfaceconstant{values}{values} \setinterfaceconstant{vcommand}{vcommande} +\setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{veroffset}{veroffset} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{voffset}{voffset} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 8832d288a..3600da43d 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -689,6 +689,7 @@ \setinterfaceconstant{global}{globale} \setinterfaceconstant{grid}{griglia} \setinterfaceconstant{hang}{sospendi} +\setinterfaceconstant{hcompact}{hcompact} \setinterfaceconstant{headalign}{headalign} \setinterfaceconstant{headcolor}{coloretesta} \setinterfaceconstant{headcommand}{headcommand} @@ -1023,6 +1024,7 @@ \setinterfaceconstant{validate}{verifica} \setinterfaceconstant{values}{values} \setinterfaceconstant{vcommand}{vcomando} +\setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{veroffset}{veroffset} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{voffset}{voffset} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index de91ef8b3..56ce14940 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -689,6 +689,7 @@ \setinterfaceconstant{global}{globaal} \setinterfaceconstant{grid}{grid} \setinterfaceconstant{hang}{hang} +\setinterfaceconstant{hcompact}{hcomprimeer} \setinterfaceconstant{headalign}{kopuitlijnen} \setinterfaceconstant{headcolor}{kopkleur} \setinterfaceconstant{headcommand}{kopcommando} @@ -1023,6 +1024,7 @@ \setinterfaceconstant{validate}{valideer} \setinterfaceconstant{values}{waarden} \setinterfaceconstant{vcommand}{vcommando} +\setinterfaceconstant{vcompact}{vcomprimeer} \setinterfaceconstant{veroffset}{kopoffset} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{voffset}{voffset} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 61d5b72c7..e3624cd44 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -689,6 +689,7 @@ \setinterfaceconstant{global}{سراسری} \setinterfaceconstant{grid}{توری} \setinterfaceconstant{hang}{بیاویز} +\setinterfaceconstant{hcompact}{hcompact} \setinterfaceconstant{headalign}{headalign} \setinterfaceconstant{headcolor}{رنگ‌سر} \setinterfaceconstant{headcommand}{فرمان‌سر} @@ -1023,6 +1024,7 @@ \setinterfaceconstant{validate}{تاییداعتبار} \setinterfaceconstant{values}{values} \setinterfaceconstant{vcommand}{vcommand} +\setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{veroffset}{آفست‌عم} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{voffset}{آفست‌ع} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index 72b4f2366..f3385fb3f 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -689,6 +689,7 @@ \setinterfaceconstant{global}{global} \setinterfaceconstant{grid}{grid} \setinterfaceconstant{hang}{suspenda} +\setinterfaceconstant{hcompact}{hcompact} \setinterfaceconstant{headalign}{headalign} \setinterfaceconstant{headcolor}{culoaretitlu} \setinterfaceconstant{headcommand}{headcommand} @@ -1023,6 +1024,7 @@ \setinterfaceconstant{validate}{verifica} \setinterfaceconstant{values}{values} \setinterfaceconstant{vcommand}{comandav} +\setinterfaceconstant{vcompact}{vcompact} \setinterfaceconstant{veroffset}{veroffset} \setinterfaceconstant{vfil}{vfil} \setinterfaceconstant{voffset}{voffset} diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index 3b5b1d018..706b2fc10 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -666,9 +666,18 @@ local pts = function(n) end end +local nopts = function(n) + if not n or n == 0 then + return "0" + else + return format("%.5f",n*ptfactor) + end +end + number.points = points number.basepoints = basepoints number.pts = pts +number.nopts = nopts --~ function nodes.thespec(s) --~ local stretch_order = s.stretch_order diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 5245208a2..beb6eee91 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -1584,12 +1584,9 @@ %D \stopformula %D \stopbuffer %D -%D \typebuffer -%D -%D \getbuffer +%D \typebuffer \getbuffer %D -%D However, we got into troubles when we want to nest sub- and -%D superscripts, like in +%D And: %D %D \startbuffer %D \startformula @@ -1597,23 +1594,7 @@ %D \stopformula %D \stopbuffer %D -%D \typebuffer -%D -%D \getbuffer -%D -%D Therefore, we can best use \type {\super} and \type {\suber} -%D instead of \type {^} and \type {_}. Both commands take care -%D of proper font switching. -%D -%D \startbuffer -%D \startformula -%D x \times \mframed{y} \times y\super{\mframed{z}\suber{\mframed{z}}} -%D \stopformula -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer +%D \typebuffer \getbuffer %D %D As usual, one can specify in what way the text should be %D framed. One should be aware of the fact that, inorder to @@ -1623,13 +1604,11 @@ %D %D \startbuffer %D \startformula -%D x \times y\super{\mframed[framecolor=red]{z}\suber{z}} +%D x \times y^{\mframed[framecolor=red]{z}_{z}} %D \stopformula %D \stopbuffer %D -%D \typebuffer -%D -%D \getbuffer +%D \typebuffer \getbuffer %D %D For inline use, we also provide the \type {\inmframed} %D alternative: we want $x \times \inmframed{y}$ in inline @@ -1877,44 +1856,49 @@ %D \bgroup %D \showstruts %D \dontcomplain -%D \startlinecorrection -%D \halign{#\enskip&#\enskip&#\enskip&#\enskip&#\enskip&#\cr -%D \framed[width=.2\hsize, height=.2\hsize, align=] {a\par b\par c}& -%D \framed[width=.2\hsize, height=broad, align=] {a\par b\par c}& -%D \framed[width=.2\hsize, height=fit, align=] {a\par b\par c}& -%D \framed[width=fit, height=.2\hsize, align=] {a\par b\par c}& -%D \framed[width=fit, height=broad, align=] {a\par b\par c}& -%D \framed[width=fit, height=fit, align=] {a\par b\par c}\cr -%D \noalign{\vskip1em} -%D \framed[width=.2\hsize, height=.2\hsize, align=yes] {a\par b\par c}& -%D \framed[width=.2\hsize, height=broad, align=yes] {a\par b\par c}& -%D \framed[width=.2\hsize, height=fit, align=yes] {a\par b\par c}& -%D \framed[width=fit, height=.2\hsize, align=yes] {a\par b\par c}& -%D \framed[width=fit, height=broad, align=yes] {a\par b\par c}& -%D \framed[width=fit, height=fit, align=yes] {a\par b\par c}\cr -%D \noalign{\vskip1em} -%D \framed[width=.2\hsize, height=.2\hsize, align=right] {a\par b\par c}& -%D \framed[width=.2\hsize, height=broad, align=right] {a\par b\par c}& -%D \framed[width=.2\hsize, height=fit, align=right] {a\par b\par c}& -%D \framed[width=fit, height=.2\hsize, align=right] {a\par b\par c}& -%D \framed[width=fit, height=broad, align=right] {a\par b\par c}& -%D \framed[width=fit, height=fit, align=right] {a\par b\par c}\cr -%D \noalign{\vskip1em} -%D \framed[width=.2\hsize, height=.2\hsize, align=left] {a\par b\par c}& -%D \framed[width=.2\hsize, height=broad, align=left] {a\par b\par c}& -%D \framed[width=.2\hsize, height=fit, align=left] {a\par b\par c}& -%D \framed[width=fit, height=.2\hsize, align=left] {a\par b\par c}& -%D \framed[width=fit, height=broad, align=left] {a\par b\par c}& -%D \framed[width=fit, height=fit, align=left] {a\par b\par c}\cr -%D \noalign{\vskip1em} -%D \framed[width=.2\hsize, height=.2\hsize, align=middle] {a\par b\par c}& -%D \framed[width=.2\hsize, height=broad, align=middle] {a\par b\par c}& -%D \framed[width=.2\hsize, height=fit, align=middle] {a\par b\par c}& -%D \framed[width=fit, height=.2\hsize, align=middle] {a\par b\par c}& -%D \framed[width=fit, height=broad, align=middle] {a\par b\par c}& -%D \framed[width=fit, height=fit, align=middle] {a\par b\par c}\cr} -%D \stoplinecorrection -%D \blank[2*big] +%D \starttabulate[|c|c|c|c|c|c|] +%D % \HL +%D \NC \framed[width=.2\hsize, height=.2\hsize, align=] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=broad, align=] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=fit, align=] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=.2\hsize, align=] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=broad, align=] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=fit, align=] {a\endgraf b\endgraf c} +%D \NC \NR +%D % \HL +%D \NC \framed[width=.2\hsize, height=.2\hsize, align=yes] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=broad, align=yes] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=fit, align=yes] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=.2\hsize, align=yes] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=broad, align=yes] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=fit, align=yes] {a\endgraf b\endgraf c} +%D \NC \NR +%D % \HL +%D \NC \framed[width=.2\hsize, height=.2\hsize, align=right] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=broad, align=right] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=fit, align=right] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=.2\hsize, align=right] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=broad, align=right] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=fit, align=right] {a\endgraf b\endgraf c} +%D \NC \NR +%D % \HL +%D \NC \framed[width=.2\hsize, height=.2\hsize, align=left] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=broad, align=left] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=fit, align=left] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=.2\hsize, align=left] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=broad, align=left] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=fit, align=left] {a\endgraf b\endgraf c} +%D \NC \NR +%D % \HL +%D \NC \framed[width=.2\hsize, height=.2\hsize, align=middle] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=broad, align=middle] {a\endgraf b\endgraf c} +%D \NC \framed[width=.2\hsize, height=fit, align=middle] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=.2\hsize, align=middle] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=broad, align=middle] {a\endgraf b\endgraf c} +%D \NC \framed[width=fit, height=fit, align=middle] {a\endgraf b\endgraf c} +%D \NC \NR +%D % \HL +%D \stoptabulate %D \egroup %D \stoppostponing diff --git a/tex/context/base/page-mis.lua b/tex/context/base/page-mis.lua new file mode 100644 index 000000000..21c122fa2 --- /dev/null +++ b/tex/context/base/page-mis.lua @@ -0,0 +1,69 @@ +if not modules then modules = { } end modules ['page-mis'] = { + version = 1.001, + comment = "companion to page-mis.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: adapt message + +local sortedkeys = table.sortedkeys + +local cache = { } + +local function flush(page) + local c = cache[page] + if c then + for i=1,#c do + context.viafile(c[i]) + end + cache[page] = nil + end +end + +local function setnextpage() + tex.setcount("global","postponed_page_blocks_next_page",next(cache) and sortedkeys(cache)[1] or -1) +end + +function commands.flushpostponedblocks(page) + -- we need to flush previously pending pages as well and the zero + -- slot is the generic one so that one is always flushed + local t = sortedkeys(cache) + local p = tonumber(page) or tex.count.realpageno or 0 + for i=1,#t do + local ti = t[i] + if ti <= p then + flush(ti) + else + break + end + end + setnextpage() +end + +function commands.registerpostponedblock(page) + if type(page) == "string" then + if string.find(page,"^+") then + page = tex.count.realpageno + (tonumber(page) or 1) -- future delta page + else + page = tonumber(page) or 0 -- preferred page or otherwise first possible occasion + end + end + if not page then + page = 0 + end + local c = cache[page] + if not c then + c = { } + cache[page] = c + end + c[#c+1] = buffers.raw("postponedblock") + buffers.erase("postponedblock") + if page == 0 then + interfaces.showmessage("layouts",3,#c) + else + interfaces.showmessage("layouts",3,string.format("%s (realpage: %s)",#c,page)) + end + setnextpage() +end diff --git a/tex/context/base/page-mis.mkiv b/tex/context/base/page-mis.mkiv index 387b5164c..808f42aa6 100644 --- a/tex/context/base/page-mis.mkiv +++ b/tex/context/base/page-mis.mkiv @@ -13,6 +13,8 @@ \writestatus{loading}{ConTeXt Page Macros / Misc Float Things} +\registerctxluafile{page-mis}{1.001} + \unprotect \newif\ifmarginblocks @@ -133,10 +135,23 @@ {\dostopattributes \egroup \@@mbafter} - -\newcount\nofpostponedblocks -\newif\ifinpostponing +\setupmarginblocks + [\c!state=\v!start, + \c!location=\v!inmargin, + \c!width=\rightmarginwidth, + \c!style=, + \c!color=, + \c!align=, + \c!left=, + \c!right=, + \c!top=, + \c!inbetween=\blank, + \c!bottom=\vfill, + \c!before=, + \c!after=] + +% postponing \newevery\everytopofpage\relax @@ -159,32 +174,56 @@ % % \starttext \dorecurse{4}{\input tufte \page} \stoptext -\newtoks \postponedpageblocks -\newcount \nofpostponedpageblocks - -% \ifinpostponing: handhaven, want gebruikt in stijlen ! ! ! ! ! - -\def\dodoflushpostponedblocks - {\bgroup % we need the font switch, else problems inside split verbatim - \setnormalcatcodes % postponing in verbatim - \restoreglobalbodyfont - \global\pagetotal\zeropoint - \global\inpostponingtrue - \the\postponedpageblocks - \dorecurse\nofpostponedblocks - {\getbuffer[pbuf-\recurselevel]}% - \doflushfloats % new but potential dangerous - \global\nofpostponedblocks\zerocount - \global\inpostponingfalse +%D There is no real need to use \LUA\ here but the bookkeeping +%D is somewhat easier and we also can erase buffers easier when +%D we keep a local cache, especially as we can flush per page. + +\newif \ifinpostponing % prevents nesting +\newcount\postponed_page_blocks_next_page % set at the lua end + +\unexpanded\setvalue{\e!start\v!postponing}% + {\bgroup + \obeylines + \doifnextoptionalelse{\egroup\postponed_page_block_start}{\egroup\postponed_page_block_start[0]}} + +\unexpanded\setvalue{\e!stop\v!postponing}% + {\ctxcommand{registerpostponedblock("\currentpostponedpage")}\relax} + +\def\postponed_page_block_start[#1]% + {\edef\currentpostponedpage{#1}% + \dostartbuffer[postponedblock][\e!start\v!postponing][\e!stop\v!postponing]} + +% officially we should flush again after a flush as there can be new future pages +% but that will be looked into when we run into it + +\unexpanded\def\postponed_page_block_flush + {\bgroup + \inpostponingtrue % for old times sake + \global\pagetotal\zeropoint % here? still needed? (was after flush pagefloats) + \the\everytopofpage\relax + %\flushrestfloats + \doflushpagefloats + \setnormalcatcodes % postponing in verbatim + \restoreglobalbodyfont % otherwise problems inside split verbatim + \ctxcommand{flushpostponedblocks()}% + \relax + \doflushfloats % new but potential dangerous \egroup} \def\doflushpostponedblocks - {\ifinpostponing \else - \ifcase\nofpostponedblocks \else \dodoflushpostponedblocks \fi - \ifcase\nofpostponedpageblocks \else \dodoflushpostponedblocks \fi - \fi} - -\def\doflushpostponedcontent + {\ifinpostponing + % probably a nested flush + \else\ifnum\postponed_page_blocks_next_page=\zerocount + \postponed_page_block_flush + %\doflushpostponedblocks + \else\ifnum\postponed_page_blocks_next_page>\realpageno + % not yet + \else + \postponed_page_block_flush + %\doflushpostponedblocks + \fi\fi\fi} + +\def\doflushpostponedcontent % called in page-one {\bgroup \setsystemmode\v!postponing \the\everytopofpage @@ -193,47 +232,4 @@ \doflushpostponedblocks \egroup} -\def\getpostponedblock#1#2% - {\doif{#1}\realfolio{\getbuffer[rbuf-#2]}} % no \ifnum, avoid \fi - -% beware, \dosingleempty conflicts with buffers (feeds back the \par) - -\setvalue{\e!start\v!postponing}% - {\bgroup - \obeylines - \doifnextoptionalelse{\egroup\nodostartpostponing}{\egroup\dodostartpostponing}} - -\def\nodostartpostponing[#1]% - {\global\advance\nofpostponedpageblocks\plusone % hm, never reset? - \bgroup % a little bit of misusing grouping - \doifinstring{+}{#1}\advance \realpageno#1\relax % ugly but efficient - \doglobal\appendetoks\noexpand\getpostponedblock - {\realfolio}{\number\nofpostponedpageblocks}\to\postponedpageblocks - \egroup - \showmessage\m!layouts3{\number\nofpostponedpageblocks}% - \dostartbuffer[rbuf-\number\nofpostponedpageblocks]% - [\e!start\v!postponing][\e!stop\v!postponing]} - -\def\dodostartpostponing - {\global\advance\nofpostponedblocks\plusone - \showmessage\m!layouts3{\number\nofpostponedblocks}% - \expanded{\dostartbuffer[pbuf-\number\nofpostponedblocks][\e!start\v!postponing][\e!stop\v!postponing]}} - -% Setups: - -\setupmarginblocks - [\c!state=\v!start, - \c!location=\v!inmargin, - \c!width=\rightmarginwidth, - \c!style=, - \c!color=, - \c!align=, - \c!left=, - \c!right=, - \c!top=, - \c!inbetween=\blank, - \c!bottom=\vfill, - \c!before=, - \c!after=] - \protect \endinput diff --git a/tex/context/base/s-mod-00.mkiv b/tex/context/base/s-mod-00.mkiv index 3752f85ca..fe1f25bb7 100644 --- a/tex/context/base/s-mod-00.mkiv +++ b/tex/context/base/s-mod-00.mkiv @@ -18,8 +18,6 @@ \mainlanguage[en] % better not here -\usemodule[units] - \unprotect % beter: diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index 4fd50b398..d0ede466d 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -524,8 +524,8 @@ \def\dodefinenarrower[#1][#2]% {\getparameters[\??sl#1][\s!parent=\??sl,#2]% - \setvalue{\e!start#1}{\dodoubleempty\dostartnarrower[#1]}% - \setvalue{\e!stop #1}{\dostopnarrower}} + \unexpanded\setvalue{\e!start#1}{\dodoubleempty\dostartnarrower[#1]}% + \unexpanded\setvalue{\e!stop #1}{\dostopnarrower}} \unexpanded\def\setupnarrower {\dodoubleempty\dosetupnarrower} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 54df95bb0..eaaa02a99 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index fd1fc48b5..1af9db895 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-doc.mkiv b/tex/context/base/strc-doc.mkiv index 3b3d50048..ce85095d7 100644 --- a/tex/context/base/strc-doc.mkiv +++ b/tex/context/base/strc-doc.mkiv @@ -201,7 +201,9 @@ \let\currentstructurecounter \!!zerocount \let\previousstructurecounter\!!zerocount -\def\setstructuresynchronization#1% +% todo: a direct flusher (needed when hidden) + +\def\setstructuresynchronization#1% todo: use ctxcontext {\xdef\currentstructureattribute {\ctxlua {tex.write(structures.references.setinternalreference("\currentstructurereferenceprefix","\currentstructurereference",\nextinternalreference,"\interactionparameter\c!focus"))}}% \xdef\currentstructuresynchronize{\ctxlatelua{structures.lists.enhance(#1)}}} diff --git a/tex/context/base/supp-fun.mkiv b/tex/context/base/supp-fun.mkiv index 3a1c7f2ea..e31074e4d 100644 --- a/tex/context/base/supp-fun.mkiv +++ b/tex/context/base/supp-fun.mkiv @@ -33,7 +33,7 @@ %D %D \startbuffer %D \DroppedCaps -%D {\color[green]} {cmbx12} +%D {\color[green]} {SerifBold} %D {2.2\baselineskip} {2pt} {\baselineskip} {2} %D Let's start %D \stopbuffer @@ -58,7 +58,7 @@ %D %D \startbuffer %D \DroppedCaps -%D {\color[red]} {cmbx12} +%D {\color[red]} {SerifBold} %D {\baselineskip} {0pt} {0pt} {1} %D This simple %D \stopbuffer @@ -70,7 +70,7 @@ %D %D \startbuffer %D \DroppedCaps -%D {\color[red]} {cmbx12} +%D {\color[red]} {SerifBold} %D {2\baselineskip} {0pt} {\baselineskip} {2} %D Is this ugly %D \stopbuffer @@ -98,7 +98,7 @@ %D \startbuffer %D \def\MyDroppedCaps% %D {\DroppedCaps -%D {\color[green]} {cmbx12} +%D {\color[green]} {SerifBold} %D {5\baselineskip} {3pt} {3\baselineskip} {4}} %D %D \MyDroppedCaps The implementation diff --git a/tex/context/base/supp-vis.mkiv b/tex/context/base/supp-vis.mkiv index 22a745b13..460020306 100644 --- a/tex/context/base/supp-vis.mkiv +++ b/tex/context/base/supp-vis.mkiv @@ -47,16 +47,6 @@ %D \egroup %D \stoplinecorrection} -%D Although an integral part of \CONTEXT, this module is one -%D of the support modules. Its stand alone character permits -%D use in \PLAIN\ \TEX\ or \TEX\ based macropackages. -%D \ifCONTEXT \else If in some examples the verbatim listings -%D don't show up nice, this is due to processing by a system -%D that does not support buffering. In \CONTEXT\ we show the -%D commands in the margin, use bit more advanced way of -%D numbering, and typeset the source in \TEX nicolored -%D verbatim. Sorry for this inconvenience.\fi -%D %D Depending on my personal needs and those of whoever uses it, %D the macros will be improved in terms of visualization, %D efficiency and compatibility. These rather low level @@ -1863,13 +1853,6 @@ \protect -%D \ifCONTEXT \let\next=\relax \else \let\next=\endinput -%D The documented source you have been reading was processed -%D using some surrogate makeup. When this file is processed -%D in \CONTEXT, a few more examples show up here, like a local -%D table of contents and a local register. -%D \fi \next - %D Lets end with some more advanced examples. %D Definitions and enumerations come in many flavors. The %D next one for instance is defined as: diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index f73f4436c..513d8761b 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -15,6 +15,9 @@ %D obsolete once we've redone the bibliography module. Of course %D the handy helpers will stay. +% no longs +% more unexpanded + \registerctxluafile{syst-aux}{1.001} %D This is a stripped down combination of: @@ -3212,6 +3215,40 @@ % % [\test] +% todo: pick up keywords: +% +% \starttexdefinition unexpanded bagger .... + +% \bgroup \obeylines +% +% \gdef\starttexdefinition% +% {\bgroup% +% \obeylines% +% \dostarttexdefinition} +% +% \gdef\dostarttexdefinition #1 +% {\catcode\endoflineasciicode\ignorecatcode% +% \doifinstringelse\letterhash{\detokenize{#1}}\dodostarttexdefinition\nonostarttexdefinition#1 +% } +% +% \gdef\dodostarttexdefinition#1 #2 +% {\dododostarttexdefinition{#1}{#2}} +% +% \gdef\dododostarttexdefinition#1#2#3\stoptexdefinition% +% {\egroup% +% \expandafter\def\csname#1\endcsname#2{#3}} +% +% \gdef\nonostarttexdefinition#1 +% {\nononostarttexdefinition{#1}{}} +% +% \gdef\nononostarttexdefinition#1#2#3\stoptexdefinition% +% {\egroup% +% \expandafter\def\csname#1\endcsname{#3}} +% +% \egroup + +\def\s!unexpanded{unexpanded} + \bgroup \obeylines \gdef\starttexdefinition% @@ -3224,17 +3261,30 @@ \doifinstringelse\letterhash{\detokenize{#1}}\dodostarttexdefinition\nonostarttexdefinition#1 } -\long\gdef\dodostarttexdefinition#1 #2 - {\dododostarttexdefinition{#1}{#2}} - -\long\gdef\dododostarttexdefinition#1#2#3\stoptexdefinition% +\gdef\dodostarttexdefinition#1 #2 + {\edef\texdefinitionname{#1}% + \ifx\texdefinitionname\s!unexpanded% + \expandafter\dododostarttexdefinitionU% + \else% + \expandafter\dododostarttexdefinitionN% + \fi% + {#1}#2 + } + +\gdef\dododostarttexdefinitionU#1#2 #3 + #4\stoptexdefinition% + {\egroup% #1=unexpanded + \unexpanded\expandafter\def\csname#2\endcsname#3{#4}} + +\gdef\dododostarttexdefinitionN#1#2 + #3\stoptexdefinition% {\egroup% \expandafter\def\csname#1\endcsname#2{#3}} -\long\gdef\nonostarttexdefinition#1 +\gdef\nonostarttexdefinition#1 {\nononostarttexdefinition{#1}{}} -\long\gdef\nononostarttexdefinition#1#2#3\stoptexdefinition% +\gdef\nononostarttexdefinition#1#2#3\stoptexdefinition% {\egroup% \expandafter\def\csname#1\endcsname{#3}} diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index 4cddb50c7..573b18858 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -61,13 +61,11 @@ % \placefigure[left]{}{} % \startlinecorrection \dontleavehmode \bTABLE % \bTR \bTD oeps \eTD \eTR -% \eTABLE -% \stoplinecorrection +% \eTABLE \stoplinecorrection % \placefigure[right]{}{} % \startlinecorrection \dontleavehmode \bTABLE % \bTR \bTD oeps \eTD \eTR -% \eTABLE -% \stoplinecorrection +% \eTABLE \stoplinecorrection % \stoptext %D To Do: diff --git a/tex/context/base/tabl-tab.mkiv b/tex/context/base/tabl-tab.mkiv index 0e95af3b7..870bb2d8e 100644 --- a/tex/context/base/tabl-tab.mkiv +++ b/tex/context/base/tabl-tab.mkiv @@ -1165,10 +1165,9 @@ %D \stoptable %D \stopbuffer %D -%D \startcombination -%D {\tracetablesfalse\getbuffer} {\type{\tracetablesfalse}} -%D {\tracetablestrue\getbuffer} {\type{\tracetablestrue}} -%D \stopcombination +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection %D %D This table is specified as: %D @@ -1189,37 +1188,9 @@ %D \VL beta \VL 2 \VL\AR %D \VL gamma \VL 3 \VL\AR %D \HL -%D \stoptable -%D \stopbuffer -%D -%D When we use the split table feature, we get a bit more -%D information. -%D -%D {\tracetablesfalse\getbuffer} -%D -%D Sometimes in tables information shows up that is not typed -%D in by the user. These messages give a cue in what aspect a -%D table definition is wrong. -%D -%D \startbuffer -%D \starttable[||||] -%D \HL -%D \VL first second \VL third \VL\AR -%D \HL -%D \VL alfa \VL 1 \VL a \VL\AR -%D \VL beta \VL 2 \VL b \VL -%D \VL gamma \VL \THREE{3} c \VL\AR -%D \HL -%D \stoptable +%D \stoptables %D \stopbuffer %D -%D \typebuffer -%D -%D Those terrible table has three errors, which all show up in -%D typeset messages. Errors cannot always recovered 100\% and -%D therefore can result in two or more succesive messages, like -%D in the last row. -%D %D \getbuffer %D %D Some simple color support is provided: @@ -1292,16 +1263,14 @@ %D instead of brackets because we need brackets to specify the %D format. %D -%D \startbuffer +%D \starttyping %D \starttable{|q[00,000]|Q[00,00]|} %D \HL %D \VL -1,2 \VL 12,35 \VL\FR %D \VL 11,203 \VL 2,4 \VL\LR %D \HL %D \stoptable -%D \stopbuffer -%D -%D \ShowExample +%D \stoptyping %D %D Although a more efficient implementation is possible |<|we %D can for instance share common macros|>| we just adapt a copy @@ -1382,7 +1351,7 @@ % We cannot define \unexpanded\def\dostoptable a ssomehow lookahead % in alignments fail then, so we relax it and define it locally. -\let\stoptabel\relax +\let\stoptable\relax \def\dostoptable {\dochucktableautorow % before the tail, else noalign problem @@ -1403,7 +1372,7 @@ %D Before we can grab the argument, we have to make sure that %D the \CATCODES\ are set. The first stage takes care of that. -\def\firststagestarttable% +\def\firststagestarttable {\bgroup \global\intabletrue \secondstagestarttable} diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv index 621cd1bea..141d860c8 100644 --- a/tex/context/base/type-otf.mkiv +++ b/tex/context/base/type-otf.mkiv @@ -681,6 +681,20 @@ \definefontsynonym [SansBoldItalic] [name:dejavusanscondensedboldoblique] [features=default] \stoptypescript + \definefontfeature[dejavu-condensed-mono][extend=.8] + + \starttypescript [mono] [dejavu-condensed] [name] + \setups[font:fallback:mono] + % \definefontsynonym [Mono] [name:dejavusansmonocondensed] [features=none] + % \definefontsynonym [MonoBold] [name:dejavusansmonoboldcondensed] [features=none] + % \definefontsynonym [MonoItalic] [name:dejavusansmonoobliquecondensed] [features=none] + % \definefontsynonym [MonoBoldItalic] [name:dejavusansmonoboldobliquecondensed] [features=none] + \definefontsynonym [Mono] [name:dejavusansmono] [features=dejavu-condensed-mono] + \definefontsynonym [MonoBold] [name:dejavusansmonobold] [features=dejavu-condensed-mono] + \definefontsynonym [MonoItalic] [name:dejavusansmonooblique] [features=dejavu-condensed-mono] + \definefontsynonym [MonoBoldItalic] [name:dejavusansmonoboldoblique] [features=dejavu-condensed-mono] + \stoptypescript + % \starttypescript [mono] [dejavu-condensed] [name] % \setups[font:fallback:mono] % \definefontsynonym [Mono] [name:dejavusansmono] [features=none] @@ -693,7 +707,6 @@ \definetypeface [dejavu-condensed] [rm] [serif] [dejavu-condensed] [default] \definetypeface [dejavu-condensed] [ss] [sans] [dejavu-condensed] [default] \definetypeface [dejavu-condensed] [tt] [mono] [dejavu-condensed] [default] - % \definetypeface [dejavu-condensed] [tt] [mono] [dejavu] [default] \definetypeface [dejavu-condensed] [mm] [math] [xits] [default] [rscale=auto] \stoptypescript diff --git a/tex/context/base/typo-ini.mkiv b/tex/context/base/typo-ini.mkiv index 8c288bb63..d05fcecb0 100644 --- a/tex/context/base/typo-ini.mkiv +++ b/tex/context/base/typo-ini.mkiv @@ -39,7 +39,7 @@ \def\vhbox{\ifvertical\vbox\else\hbox\fi} -%D \marcros +%D \macros %D {everyresettypesetting} \newtoks\everyresettypesetting diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv index 1ae33704c..2c5cff635 100644 --- a/tex/context/base/typo-mar.mkiv +++ b/tex/context/base/typo-mar.mkiv @@ -305,17 +305,17 @@ % text -\definemargindata [inleft] [\v!left ] [\c!margin=\c!margin,\c!width=\leftmarginwidth ,\c!align=\v!flushright] -\definemargindata [inright] [\v!right] [\c!margin=\c!margin,\c!width=\rightmarginwidth,\c!align=\v!flushleft] -\definemargindata [inouter] [\v!outer] [\c!margin=\c!margin,\c!width=\outermarginwidth,\c!align=\v!inner] -\definemargindata [ininner] [\v!inner] [\c!margin=\c!margin,\c!width=\innermarginwidth,\c!align=\v!outer] +\definemargindata [inleft] [\v!left ] [\c!margin=\v!margin,\c!width=\leftmarginwidth ,\c!align=\v!flushright] +\definemargindata [inright] [\v!right] [\c!margin=\v!margin,\c!width=\rightmarginwidth,\c!align=\v!flushleft] +\definemargindata [inouter] [\v!outer] [\c!margin=\v!margin,\c!width=\outermarginwidth,\c!align=\v!inner] +\definemargindata [ininner] [\v!inner] [\c!margin=\v!margin,\c!width=\innermarginwidth,\c!align=\v!outer] % no longer auto auto-other -\definemargindata [inmargin] [\v!left] [\c!margin=\c!margin,\c!width=\leftmarginwidth, \c!align=\v!flushright] -\definemargindata [inother] [\v!right] [\c!margin=\c!margin,\c!width=\rightmarginwidth,\c!align=\v!flushleft] +\definemargindata [inmargin] [\v!left] [\c!margin=\v!margin,\c!width=\leftmarginwidth, \c!align=\v!flushright] +\definemargindata [inother] [\v!right] [\c!margin=\v!margin,\c!width=\rightmarginwidth,\c!align=\v!flushleft] -\definemargindata [margintext] [\v!left] [\c!margin=\c!margin,\c!width=\leftmarginwidth, \c!align=\v!flushright,\c!stack=\v!yes] +\definemargindata [margintext] [\v!left] [\c!margin=\v!margin,\c!width=\leftmarginwidth, \c!align=\v!flushright,\c!stack=\v!yes] \setupmarginframed [\v!left ] [\c!method=\v!first,\c!align=\v!flushright,\s!parent=\??mf] % we could autoparent when no define yet \setupmarginframed [\v!right] [\c!method=\v!first,\c!align=\v!flushleft, \s!parent=\??mf] @@ -333,8 +333,8 @@ \let\margintitle \margintext \let\inothermargin\inother % for old times sake -%definemargindata [inouterextra] [\v!outer] [\c!margin=\c!edge,\c!location=\v!outer,\c!width=\outeredgewidth,\c!align=\v!outer,\c!category=\v!edge] -%definemargindata [ininnerextra] [\v!inner] [\c!margin=\c!edge,\c!location=\v!inner,\c!width=\inneredgewidth,\c!align=\v!inner,\c!category=\v!edge] +%definemargindata [inouterextra] [\v!outer] [\c!margin=\v!edge,\c!location=\v!outer,\c!width=\outeredgewidth,\c!align=\v!outer,\c!category=\v!edge] +%definemargindata [ininnerextra] [\v!inner] [\c!margin=\v!edge,\c!location=\v!inner,\c!width=\inneredgewidth,\c!align=\v!inner,\c!category=\v!edge] % %definemarginframed [inouterextra] [\v!outer] %definemarginframed [ininnerextra] [\v!inner] diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 924631fe4..ec4abd887 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 1e016113e..fff289231 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 3caeac551..f89b03479 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 13e301fb5..7720ff77e 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index a60d20e20..eadef06f8 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 4968ee465..7f2423256 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 867198ff4..1017bf867 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 4c855cc5e..82bd2fd6e 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -695,6 +695,7 @@ + @@ -1029,6 +1030,7 @@ + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index be7ae91a6..a115ae001 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/17/11 10:36:04 +-- merge date : 10/18/11 22:09:27 do -- begin closure to overcome local limits and interference -- cgit v1.2.3