diff options
24 files changed, 2192 insertions, 2100 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 35a2aae12..6b78510a6 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -17,101 +17,9 @@ \unprotect -\newbox\nestednextbox \prependtoks \let\nextbox\nestednextbox \to \everybeforepagebody +\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} -\def\dostartcolumnsetspan[#1][#2][#3]% [#3] gobbles space - {\endgraf % else rubish output if forgotten - \vskip \zeropoint % make sure otr is done, otherwise last line problems - \bgroup - \forgetall - \ifnum\columnsetlevel>\zerocount\else - % of course we needed a one-column fall back for tm - \columnsetspanhsize\hsize - \nofcolumns\plusone - \mofcolumns\plusone - \fi - \setupframedtexts[cs:#1] - [\c!breedte=\columnsetspanhsize, - \c!regelcorrectie=\v!uit, - \c!dieptecorrectie=\v!uit, - #2]% - % determine widths - \!!countc\framedtextparameter{cs:#1}\c!n - % \!!countd\numexpr(\nofcolumns-\mofcolumns+\plusone)% - \!!countd\nofcolumns - % n <= n of columns - \ifnum\!!countc>\!!countd \!!countc\!!countd \fi - \advance\!!countd -\mofcolumns - \advance\!!countd \plusone - % n <= n of available columns (alternative a) - \doif{\framedtextparameter{cs:#1}\c!variant}\v!a - {\ifnum\!!countc>\!!countd \!!countc\!!countd \fi}% - % here it all starts - \setcolumnsetspanhsize\mofcolumns\!!countc % a/b used - \hsize\columnsetspanhsize - \setbox\scratchbox\vbox\bgroup - \dostartframedtext[cs:#1][\v!geen]% geen nils placement - \vskip-\struttotal\par\verticalstrut\par - \ifnum\columnsetlevel>\zerocount - \framedtextparameter{cs:#1}\c!voor - \fi - \def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}} - -\def\dostopcolumnsetspan#1% - {\par - \verticalstrut - \kern-2\struttotal - \verticalstrut - \ifnum\columnsetlevel>\zerocount - \doifsomething{\framedtextparameter{cs:#1}\c!na} - {\framedtextparameter{cs:#1}\c!na - \kern\zeropoint}% otherwise blanks disappear, better be a switch - \else - \endgraf - \fi - \dostopframedtext - \egroup - % frozen keeps grid snapping okay - \setbox\scratchbox\frozenhbox to \hsize - {\dontcomplain - \alignedline{\framedtextparameter{cs:#1}\c!plaats}\v!midden - {\lower\strutdepth\box\scratchbox}}% - \dp\scratchbox\zeropoint % else wrong snap insidefloat -% -% to be tested first: -% -% \setbox\scratchbox\frozenhbox to \hsize -% {\dontcomplain -% \chardef\alignstrutmode\zerocount -% \alignedline{\framedtextparameter{cs:#1}\c!plaats}\v!midden -% {\box\scratchbox}}% -% - \ifinsidefloat - \box\scratchbox - \else\ifnum\columnsetlevel>\zerocount - % we only set \columnsetspacing when asked for, else bottom problems - % don't change this any more (test naw) - \chardef\columnslotspacing\framedtextparameter{cs:#1}\c!nregels\relax - % todo: nboven/onder & \chardef\columnslotlocation2 - %\OTRSETstoreincolumnslotHERE\scratchbox - \edef\floatmethod{\framedtextparameter{cs:#1}\c!default}% - \@EA\uppercasestring\floatmethod\to\floatmethod - % todo : \v!hier -> here enzovoorts - \OTRSETstoreincolumnslot\floatmethod\scratchbox - % watch out: no \dochecknextindentation{tag} - \checknextindentation[\framedtextparameter{cs:#1}\c!springvolgendein] - \else - % of course we needed a one-column fall back for tm; brrr, the box has now too - % much height (try \ruledvbox); don't change this without testing techniek - \scratchdimen\ht\scratchbox - \advance\scratchdimen-\strutdp - \ht\scratchbox\scratchdimen - \framedtextparameter{cs:#1}\c!voor - \snaptogrid\vbox{\box\scratchbox}% - \framedtextparameter{cs:#1}\c!na - \fi\fi - \egroup - \endgraf} +\def\showsetupsdefinition[#1]{\showvalue{\??su:#1}} % will be a MyWay % @@ -150,84 +58,6 @@ % \input ward % % \stoptext - -\let\@@efgrid\empty - -\def\dosetdimensionfiguresize#1#2#3% - {#1\relax - \doifsomething\@@efmaxbreedte - {\ifdim\figwid>\@@efmaxbreedte\global\figwid\@@efmaxbreedte#2\relax\fi}% - \doifsomething\@@efmaxhoogte - {\ifdim\fighei>\@@efmaxhoogte \global\fighei\@@efmaxhoogte #3\relax\fi}% - \processaction - [\@@efgrid] - [ \v!ja=>\getnoflines\fighei - \global\fighei\noflines\lineheight, - \v!hoogte=>\getrawnoflines\fighei - \global\fighei\noflines\lineheight - \global\advance\fighei\strutdepth, - \v!passend=>\getrawnoflines\fighei - \global\fighei\noflines\lineheight]} - -\def\splittblbox#1% #1 <> 0/2 - {\ifinsidefloat - \unvbox#1% - \else - % spacing between rows gets lost in split - \setbox4\vbox - {\doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}}% - \setbox2\vbox - {}% - \dorecurse\noftblheadlines - {\setbox0\vsplit#1 to \lineheight - \setbox2\vbox{\unvcopy2\unvcopy0}}% - \ifcase\noftblheadlines\else\unvcopy2\fi - \donefalse - \doloop - {\setbox0\vsplit#1 to \lineheight - \ifdim\pagegoal<\maxdimen - \setbox0\vbox{\unvbox0}% - \dimen0\ht0 - \advance\dimen0\ht4 - \advance\dimen0\pagetotal - \ifdim\dimen0>\pagegoal - \bgroup \pagina \egroup % make sure that local vars are kept - \ifcase\noftblheadlines\else\unvcopy2\fi - \fi - \fi - \ifdone - \doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}% - \fi - \unvbox0 - %\allowbreak - \bgroup - \scratchcounter\recurselevel - \advance\scratchcounter\noftblheadlines - \setupTBLcell{\number\scratchcounter}1 - \ifx\@@tblsplitafter\relax - \allowbreak - \else - \doifelsenothing\@@tblsplitafter - \allowbreak - {\scratchcounter\realpageno - \@@tblsplitafter - \ifnum\scratchcounter<\realpageno - \ifcase\noftblheadlines\else\unvcopy2\fi - \fi}% - \fi - \egroup - \ifvoid#1 \exitloop \else \donetrue \fi}% - \fi} - -% \bTABLE[split=repeat] -% \bTABLEhead -% \bTR \bTH lxxxeft \eTH\bTD right \eTD\eTR -% \eTABLEhead -% \bTABLEbody -% \dorecurse{100}{\bTR[after={\pagina[bigpreference]}] \bTD left \eTD\bTD right \eTD\eTR} -% \dorecurse{100}{\bTR\bTD left \eTD\bTD right \eTD\eTR} -% \eTABLEbody -% \eTABLE % new, continuous blocks, \som \par \startdoorlopendblok ... @@ -245,19 +75,19 @@ \setbox\nextbox\hbox{\lower\scratchdimen\box\nextbox}% \ht\nextbox\strutheight \dp\nextbox\strutdepth -\setbox\nextbox\vbox - {\indent\box\nextbox - \endgraf - \nobreak - \advance\noflines\minusone - \dorecurse\noflines{\crlf\nobreak}}% -\verticalstrut -\endgraf -\nobreak -\offinterlineskip -\kern-2\lineheight -\nobreak -\unvbox\nextbox + \setbox\nextbox\vbox + {\indent\box\nextbox + \endgraf + \nobreak + \advance\noflines\minusone + \dorecurse\noflines{\crlf\nobreak}}% + \verticalstrut + \endgraf + \nobreak + \offinterlineskip + \kern-2\lineheight + \nobreak + \unvbox\nextbox \prevdepth\strutdepth % evt (eerst testen) een signal zodat een direct volgend blok goed gaat) \egroup} @@ -268,74 +98,12 @@ \def\stopdoorlopendblok {\egroup} -\def\disablelanguagespecifics{\def\installcompoundcharacter##1 ##2{}} - -\appendtoks - \disablelanguagespecifics -\to \everyenableXML - -\installoutput\discardpage - {\setbox\scratchbox\box\normalpagebox} - -\unexpanded\def\referencepagenumber[#1]% - {\doifelsenothing{#1}{?}% \prepare had got lost - {\preparepaginaprefix\??rf\paginaprefix\??rf[#1]\translatednumber[#1]}} - \def\defineXMLstore {\doquadrupleargument\dodefineXMLstore[\saveXMLasdata]} \def\defineXMLgstore{\doquadrupleargument\dodefineXMLstore[\gsaveXMLasdata]} \def\dodefineXMLstore[#1][#2][#3][#4]% element attribute prefix % will become faster {\defineXMLargument[#2][#3=\s!dummy]{#1{#4:\XMLop{#3}}}} -\def\OTRONEsometopsfloat[#1]% - {\ifdim\topinserted=\zeropoint - \topofinserttrue - \else - \topofinsertfalse - \fi - \global\advance\topinserted \ht\floatbox - \global\advance\topinserted \dp\floatbox - \global\advance\topinserted \floatbottomskip - \insert\topins - {\forgetall - \iftopofinsert - \topskipcorrection % [xx] new: see icare topbleed - \kern-\lineskip\par\prevdepth\maxdimen - \else - %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back - \betweenfloatblanko - \fi - \flushfloatbox - \blanko[\@@bknawit]}% - \doinsertfloatinfo} - -\def\OTRONEdotopinsertions - {\ifvoid\topins\else - \ifgridsnapping - \box\topins - \vskip-\topskip \vskip\strutheight % [xx] new: see icare topbleed - \else - \unvbox\topins - \fi - \fi - \global\topinserted\zeropoint} - - -\def\tightlayer[#1]% - {\hbox - {\def\currentlayer{#1}% todo: left/right - \hsize\layerparameter\c!breedte - \vsize\layerparameter\c!hoogte - \composedlayer{#1}}} - -\def\dodosetobject#1#2#3% - {\bgroup - \globalpushmacro\crossreferenceobject \objectreferenced - \inobjecttrue - \dowithnextbox - {\globalpopmacro\crossreferenceobject - \dododosetobject{#1}{#2}{#3}\egroup}} - % Just a simple and fast hanger, for usage in macros. \def\setuphanging @@ -357,16 +125,6 @@ {\endgraf \egroup} -\def\doifdimensionelse#1% - {\afterassignment\dodoifdimensionelse\scratchdimen#1pt\relax} - -\def\dodoifdimensionelse#1% - {\ifx#1\relax - \expandafter\secondoftwoarguments - \else % #1=p ... t\relax - \expandafter\thirdoffourarguments - \fi} - \def\definepushbutton % name optional setup {\dodoubleempty\dodefinepushbutton} @@ -440,8 +198,6 @@ %%%%%%%% todo: \chardef\snapstruts=1 => d=l-h -\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} - \def\useMPvariables {\dodoubleargument\douseMPvariables} @@ -465,30 +221,6 @@ \startlinetableanalysis\processXMLfile{#1}\stoplinetableanalysis \startlinetablerun \processXMLfile{#1}\stoplinetablerun \egroup} - -\def\startlinetablepart - {\global\linetablesubcol\zerocount - \setbox\scratchbox\hbox\bgroup - \doconvertfont{\linetablerparameter\c!letter}% - \startcolor[\linetablerparameter\c!kleur]% - \ignorespaces} - -\def\stoplinetablepart - {\ifnum\linetablepart>\zerocount - \unskip \unskip % remove last intercolumn skip (distance+fill) - \fi - \stopcolor - \egroup - \iflinetablepreroll \else - \ifcase\linetablepart - % we're collecting the repeater - \else - \scratchdimen\hsize \advance\scratchdimen-\wd\scratchbox\relax - \ifdim\scratchdimen>\linetableparameter\c!rek\else - \setbox\scratchbox\hbox to \hsize{\unhbox\scratchbox}% - \fi - \fi - \fi} % experimental: \synchronizegrid bla bla bla @@ -609,19 +341,6 @@ \TABLEnoalign{\kern-\lineheight}% \fi} -\def\showexternalfigured - {\bgroup - \immediate\openout\scratchwrite=mpfigs.mp - \def\presetfigure[##1][##2]% - {\getfiguredimensionsonly[##1]% \pagefigure[##1]% - \immediate\write\scratchwrite - {registerfigure("##1",\figurewidth,\figureheight)}} - \pushendofline - \readjobfile\@@exfile\donothing\donothing - \popendofline - \immediate\closeout\scratchwrite - \egroup} - % between alignment lines certain rules apply, and even a % simple test can mess up a table, which is why we have a % special test facility @@ -1067,47 +786,6 @@ % \global\divide#1 \!!ten\relax % \global\multiply#1 #2#3#4\relax]} -\def\complexTableTB[#1]{\TABLEnoalign{\blanko[#1]}} -\def\simpleTableTB {\TABLEnoalign{\blanko}} - -\def\TabulateTB - {\complexorsimpleTable{TB}} - -\def\doTableinterline% #1 - {\ifnum\currentTABLEcolumn>\maxTABLEcolumn - \chuckTABLEautorow - \else\ifnum\currentTABLEcolumn=\zerocount - \TABLEnoalign - {\globalletempty\checkTABLEautorow - \globalletempty\chuckTABLEautorow}% - \else - \setTABLEerror\TABLEmissingcolumn - \handleTABLEerror - \fi\fi - \complexorsimpleTable} % {#1} - -\def\TableHL{\doTableinterline{HL}} -\def\TableTB{\doTableinterline{TB}} - -\appendtoks\let\TB\TableTB \to\everytable -\appendtoks\let\TB\TabulateTB\to\everytabulate - -% \starttabulate -% \NC text \NC text \NC \NR -% \TB[small] -% \NC text \NC text \NC \NR -% \TB[4*big] -% \NC text \NC text \NC \NR -% \stoptabulate -% -% \starttable[|||] -% \VL text \VL text \VL \AR -% \TB[small] -% \VL text \VL text \VL \AR -% \TB[4*big] -% \VL text \VL text \VL \AR -% \stoptable - % still needed for uguide \let\placefloatlabel \placefloatcaption diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index a6a049ad4..9db58bf70 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -8,14 +8,14 @@ %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. % dec 07 2001 : cont-en.efmt : 4,035,912 -\catcode`\{=1 \catcode`\}=2 +\catcode`\{=1 \catcode`\}=2 -\def\contextversion{2003.9.25} +\def\contextversion{2003.9.26} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type{tex -i} or \type{whatevertex} using @@ -29,26 +29,26 @@ %D manipulation macros. The first one loads \PLAIN\ \TEX, as %D minimal as possible. -%input syst-tex.tex +%input syst-tex.tex -\input syst-pln.tex % stripped plain +\input syst-pln.tex % stripped plain \input syst-prm.tex % saved primitives (will be extended) -\input syst-etx.tex % etex -\input syst-omg.tex % omega +\input syst-etx.tex % etex +\input syst-omg.tex % omega \input syst-gen.tex \input syst-ext.tex \input syst-new.tex \input syst-con.tex -\input math-pln.tex % basic plain math +\input math-pln.tex % basic plain math %D To enable selective loading, we say: \CONTEXTtrue -%D In order to conveniently load files, we need a few -%D support modules. +%D In order to conveniently load files, we need a few +%D support modules. \input supp-ini.tex \input supp-fil.tex @@ -83,10 +83,10 @@ \input supp-ran.tex \input supp-ali.tex -%D The next module deals with language specific typographic -%D extensions. +%D The next module deals with language specific typographic +%D extensions. -\input typo-ini.tex +\input typo-ini.tex %D Verbatim typesetting is implemented in a separate class of %D modules. The pretty typesetting modules are loaded at run @@ -94,9 +94,9 @@ \input verb-ini.tex % replaces supp-ver -%D The following modules are not sequentially dependent, -%D i.e. they have ugly dependencies, which will be cleaned -%D up by adding more overloading. +%D The following modules are not sequentially dependent, +%D i.e. they have ugly dependencies, which will be cleaned +%D up by adding more overloading. %D When loading the font, color and special modules, we need a %D bit more advanced file handling as well as some general @@ -107,16 +107,16 @@ \input core-fil.tex \input core-con.tex -%D We already need some synonyms (patterns). At runtime this -%D file will be reloaded. +%D We already need some synonyms (patterns). At runtime this +%D file will be reloaded. -\input cont-fil.tex +\input cont-fil.tex %D \CONTEXT\ does not implement its own table handling. We %D just go for the best there is and load \TABLE. Just to be %D sure we do it here, before we redefine \type{|}. -\input thrd-tab.tex +\input thrd-tab.tex %D Here comes the last support modules. They take care of %D some language specific things. @@ -127,12 +127,12 @@ %D The next few modules do what their names state. They %D load additional definition modules when needed. -\input enco-ini.tex -\input filt-ini.tex -\input hand-ini.tex -\input regi-ini.tex +\input enco-ini.tex +\input filt-ini.tex +\input hand-ini.tex +\input regi-ini.tex \input lang-ini.tex -\input unic-ini.tex +\input unic-ini.tex \input colo-ini.tex %input colo-sep.tex @@ -159,17 +159,18 @@ \input lang-sla.tex \input lang-ura.tex -\input lang-vn.tex % vietnamese, will be grouped +\input lang-vn.tex % vietnamese, will be grouped %D All kind of symbols are handled in: \input symb-ini.tex %D Next we load some core macro's. These implement the -%D macros' that are seen by the users. The order of loading -%D is important, due to dependancies. +%D macros' that are seen by the users. The order of loading +%D is important, due to dependancies. \input core-gen.tex +\input core-new.tex \input core-uti.tex \input core-mar.tex \input core-mak.tex @@ -179,34 +180,33 @@ \input core-vis.tex %input core-con.tex \input core-rul.tex -\input core-new.tex \input core-tab.tex \input core-nav.tex \input core-ref.tex -\input core-obj.tex +\input core-obj.tex \input core-buf.tex -\input core-lst.tex -\input core-num.tex -\input core-itm.tex -\input core-des.tex +\input core-lst.tex +\input core-num.tex +\input core-itm.tex +\input core-des.tex \input core-mat.tex -\input core-syn.tex -%input core-mul.tex % moved -\input core-spa.tex -\input core-sys.tex +\input core-syn.tex +%input core-mul.tex % moved +\input core-spa.tex +\input core-sys.tex -% experimental otr +% experimental otr -\input page-ini.tex -\input page-not.tex -\input page-one.tex -\input page-lay.tex +\input page-ini.tex +\input page-not.tex +\input page-one.tex +\input page-lay.tex \input page-log.tex \input page-txt.tex -\input page-sid.tex -\input page-flt.tex -\input page-mul.tex -\input page-set.tex +\input page-sid.tex +\input page-flt.tex +\input page-mul.tex +\input page-set.tex \input page-lyr.tex \input page-mak.tex \input page-num.tex @@ -217,17 +217,17 @@ \input core-job.tex -% so far +% so far -\input core-sec.tex +\input core-sec.tex \input page-imp.tex \input core-tbl.tex \input core-int.tex \input core-ntb.tex -\input core-ltb.tex +\input core-ltb.tex -%D Like languages, fonts, encodings and symbols, \METAPOST\ -%D support is also organized in its own class of modules. +%D Like languages, fonts, encodings and symbols, \METAPOST\ +%D support is also organized in its own class of modules. \input meta-ini.tex \input meta-pag.tex @@ -235,10 +235,10 @@ %D On which the next one depends: -\input core-pos.tex +\input core-pos.tex -%D A few more languages, that have specifics using core -%D functionality: +%D A few more languages, that have specifics using core +%D functionality: \input lang-chi.tex @@ -263,9 +263,9 @@ \input type-ini.tex \input prop-ini.tex -\input prop-lay.tex % needs core-ref.tex +\input prop-lay.tex % needs core-ref.tex -\input math-ini.tex % after enco-ini.tex +\input math-ini.tex % after enco-ini.tex %D Now we're ready for more core modules. @@ -274,18 +274,18 @@ \input core-mis.tex -\input core-fig.tex % after page body +\input core-fig.tex % after page body \input core-par.tex \input core-box.tex -%D Language specific spacing. +%D Language specific spacing. \input lang-spa.tex -%D Only the basic XML parser and remapper are part of the core. +%D Only the basic XML parser and remapper are part of the core. %D These macrosa re loaded last since they overload and|/|or -%D extend previously defined ones. +%D extend previously defined ones. \input xtag-ini.tex \input xtag-ext.tex @@ -296,7 +296,7 @@ \input xtag-rng.tex %input xtag-ent.tex -%D How about this: +%D How about this: \input meta-xml.tex @@ -312,10 +312,10 @@ \input cont-log.tex -%D Defaults go here (more will be moved to this module -%D later): +%D Defaults go here (more will be moved to this module +%D later): -\input core-def.tex +\input core-def.tex %D At run time, a few more files are loaded, like: %D @@ -326,7 +326,7 @@ %D \som \type{cont-fil}: filename and module synonyms %D \stopopsomming -%D Just to keep the user busy for a while, we say: +%D Just to keep the user busy for a while, we say: \startinterface english @@ -410,7 +410,7 @@ \stopinterface \edef\copyrightversion - {Copyright 1990-\the\normalyear\normalspace / + {Copyright 1990-\the\normalyear\normalspace / PRAGMA ADE / J. Hagen - A.F. Otten} \writeline\writestring{\copyrightversion}\writeline @@ -424,25 +424,25 @@ \doifparentfileelse{context}{\donothing}{\endinput} -%D Unless we're generating a \type {cont-..} format, we also -%D do the following. +%D Unless we're generating a \type {cont-..} format, we also +%D do the following. %D Except from english, no hyphenation patterns are loaded %D yet. Users can specify their needs in the next module: -\loaduserspecifications +\loaduserspecifications -%D Next we default to the same language as the interface. +%D Next we default to the same language as the interface. \unprotect -\installlanguage [\s!en] [\c!status=\v!start] +\installlanguage [\s!en] [\c!status=\v!start] -\startinterface english +\startinterface english \installlanguage [\s!uk] [\c!status=\v!start] -\stopinterface +\stopinterface \appendtoks \language [\s!en] \to \everyjob \appendtoks \mainlanguage [\s!en] \to \everyjob @@ -454,7 +454,7 @@ \appendtoks \language [\s!de] \to \everyjob \appendtoks \mainlanguage [\s!de] \to \everyjob -\stopinterface +\stopinterface \startinterface dutch @@ -463,44 +463,44 @@ \appendtoks \language [\s!nl] \to \everyjob \appendtoks \mainlanguage [\s!nl] \to \everyjob -\stopinterface +\stopinterface -\startinterface czech +\startinterface czech \installlanguage [\s!cz] [\c!status=\v!start] \appendtoks \language [\s!cz] \to \everyjob \appendtoks \mainlanguage [\s!cz] \to \everyjob -\stopinterface +\stopinterface -\startinterface italian +\startinterface italian \installlanguage [\s!it] [\c!status=\v!start] \appendtoks \language [\s!it] \to \everyjob \appendtoks \mainlanguage [\s!it] \to \everyjob -\stopinterface +\stopinterface -\startinterface romanian +\startinterface romanian \installlanguage [\s!ro] [\c!status=\v!start] \appendtoks \language [\s!ro] \to \everyjob \appendtoks \mainlanguage [\s!ro] \to \everyjob -\stopinterface +\stopinterface \protect -%D Finally we (pre)load some fonts. +%D Finally we (pre)load some fonts. \setupbodyfont [cmr,rm,12pt] %D The next hook can be used to generate a local (extended) -%D format. This file is only searched for at the current -%D path. +%D format. This file is only searched for at the current +%D path. % \readlocfile{cont-def.tex} % {\writestatus{loading}{adding extensions from cont-def}} diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex index 458e6198f..b4182de1a 100644 --- a/tex/context/base/core-fig.tex +++ b/tex/context/base/core-fig.tex @@ -643,12 +643,30 @@ \global\figwid\@@efmaxbreedte \fi}}} +% \def\dosetdimensionfiguresize#1#2#3% +% {#1\relax +% \doifsomething\@@efmaxbreedte +% {\ifdim\figwid>\@@efmaxbreedte\global\figwid\@@efmaxbreedte#2\relax\fi}% +% \doifsomething\@@efmaxhoogte +% {\ifdim\fighei>\@@efmaxhoogte \global\fighei\@@efmaxhoogte #3\relax\fi}} + +\let\@@efgrid\empty + \def\dosetdimensionfiguresize#1#2#3% {#1\relax \doifsomething\@@efmaxbreedte {\ifdim\figwid>\@@efmaxbreedte\global\figwid\@@efmaxbreedte#2\relax\fi}% \doifsomething\@@efmaxhoogte - {\ifdim\fighei>\@@efmaxhoogte \global\fighei\@@efmaxhoogte #3\relax\fi}} + {\ifdim\fighei>\@@efmaxhoogte \global\fighei\@@efmaxhoogte #3\relax\fi}% + \processaction + [\@@efgrid] + [ \v!ja=>\getnoflines\fighei + \global\fighei\noflines\lineheight, + \v!hoogte=>\getrawnoflines\fighei + \global\fighei\noflines\lineheight + \global\advance\fighei\strutdepth, + \v!passend=>\getrawnoflines\fighei + \global\fighei\noflines\lineheight]} \def\setdimensionfiguresize {\ifdim\figwid>\zeropoint\relax @@ -943,7 +961,7 @@ \c!object=\@@exobject,\c!preset=\v!ja, \c!pagina=0,\c!sturing=\v!nee,\c!preview=\v!nee,\c!herhaal=\v!nee, \c!maxbreedte=\@@exmaxbreedte,\c!maxhoogte=\@@exmaxhoogte, - \c!schaal=,\c!breedte=,\c!hoogte=,\c!scherm=,\c!regels=, + \c!schaal=,\c!breedte=,\c!hoogte=,\c!scherm=,\c!regels=,\c!grid=, %\c!voorgrondkleur=, \c!splitsen=, \c!factor=,\c!hfactor=,\c!bfactor=]% @@ -1536,6 +1554,19 @@ \popendofline \egroup} +\def\showexternalfigured % to be documented; this one builds a dimension file for + {\bgroup % metapost/metafun + \immediate\openout\scratchwrite=mpfigs.mp + \def\presetfigure[##1][##2]% + {\getfiguredimensionsonly[##1]% \pagefigure[##1]% + \immediate\write\scratchwrite + {registerfigure("##1",\figurewidth,\figureheight)}} + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \immediate\closeout\scratchwrite + \egroup} + \def\startpagefigure {\dodoubleempty\dostartpagefigure} @@ -1949,6 +1980,7 @@ \c!kader=\v!uit, \c!achtergrond=, % new \c!splitskleur=white, +% \c!grid=, \c!plaats={\v!lokaal,\v!globaal}] \setupexternalfigures diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex index 91c963770..aaf273a5a 100644 --- a/tex/context/base/core-job.tex +++ b/tex/context/base/core-job.tex @@ -377,52 +377,6 @@ \def\deelomgeving #1 % {\doexecutefileonce{#1}} -\def\setups - {\dosingleargument\dosetups} - -\def\dosetups[#1]% - {\iffirstargument - \def\next{\dodosetups{#1}}% - \else - \let\next\dodosetups - \fi - \next} - -\def\dodosetups#1% - {\processcommalist[#1]\dododosetups} - -\def\dodososetups#1% - {\getvalue{\??su#1}} - -\def\doifsetupselse#1% - {\doifdefinedelse{\??su#1}} - -\long\@EA\def\csname\e!start\v!instellingen\endcsname#1 % - {\bgroup - \catcode`\^^M=\@@ignore - \xdostartsetups{#1}} - -\expanded - {\long\noexpand\def\noexpand\xdostartsetups##1##2\csname\e!stop\v!instellingen\endcsname - {\egroup - \long\noexpand\setvalue{\??su##1}{##2}}} - -\def\startsetups % for international purposes - {\bgroup\doifnextcharelse[\startsetupsA\startsetupsB\stopsetups} - -\def\startlocalsetups % for nested purposes - {\bgroup\doifnextcharelse[\startsetupsA\startsetupsB\stoplocalsetups} - -\def\startsetupsA#1[#2]% - {\catcode`\^^M=\@@ignore - \dostartsetups#1{#2}} - -\def\startsetupsB#1#2 % space delimited - {\startsetupsA#1[#2]}% - -\long\def\dostartsetups#1#2% watch out: not \grabuntil - {\dograbuntil#1{\egroup\long\setvalue{\??su#2}}} - % Het <pagina>-karakter (FormFeed), wordt omgezet in \par \catcode`\^^L=\@@endofline diff --git a/tex/context/base/core-ltb.tex b/tex/context/base/core-ltb.tex index 1e5353669..bec04c804 100644 --- a/tex/context/base/core-ltb.tex +++ b/tex/context/base/core-ltb.tex @@ -11,31 +11,31 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\beginTEX - \expandafter \endinput +\beginTEX + \expandafter \endinput \endTEX -% This module is experimental, undocumented, and currently only set up -% eTeX. It provides a mechanism for typesetting very large tables, -% spanning many pages horizontally and vertically, with repeated -% header lines and (entry) columns, tab tracking, color, etc. In does -% two passes over a table, which is why the table goes into a -% buffer or file. As said, tables can be real huge. +% This module is experimental, undocumented, and currently only set up +% eTeX. It provides a mechanism for typesetting very large tables, +% spanning many pages horizontally and vertically, with repeated +% header lines and (entry) columns, tab tracking, color, etc. In does +% two passes over a table, which is why the table goes into a +% buffer or file. As said, tables can be real huge. -% \BH \BC .. \EC \BC .. \EC \EH % append -% \BR \BC .. \EC \BC .. \EC \ER +% \BH \BC .. \EC \BC .. \EC \EH % append +% \BR \BC .. \EC \BC .. \EC \ER % -% or +% or % -% \NC .. \NC .. \NC \NR (todo: optional last \NC) +% \NC .. \NC .. \NC \NR (todo: optional last \NC) -% alternative: +% alternative: % -% (1) direct run, save content in macro, but only if needed +% (1) direct run, save content in macro, but only if needed % -% todo +% todo % -% (2) buffered table content +% (2) buffered table content % % \startbuffer % \startlinetablehead @@ -45,12 +45,12 @@ % \stopbuffer % % \processlinetablebuffer[buffer] -% -% in buffer : head and body % -% (3) unbuffered run, multipass +% in buffer : head and body % -% - run with starting width zero / prev run +% (3) unbuffered run, multipass +% +% - run with starting width zero / prev run % - clip on prev run % - flush real widths @@ -84,11 +84,11 @@ \let\linetablerow \!!zerocount \let\linetablerows \!!zerocount -\initializetablebox \zerocount % holds repeater +\initializetablebox \zerocount % holds repeater \chardef\linetablehmode \zerocount -\chardef\linetablepage \zerocount -\chardef\linetablerepeat\zerocount +\chardef\linetablepage \zerocount +\chardef\linetablerepeat\zerocount \def\setuplinetable {\dotripleempty\dosetuplinetable} @@ -107,7 +107,7 @@ \c!regels=\!!maxcard, \c!nx=\plusone, \c!nlinks=0, - \c!herhaal=\v!ja, % when \c!nlinks>0, repeat on both pages + \c!herhaal=\v!ja, % when \c!nlinks>0, repeat on both pages \c!voor=, \c!na=, \c!tussen=\pagina, @@ -118,7 +118,7 @@ \c!rechteroffset=\linetableparameter\c!linkeroffset, \c!maxbreedte=\zeropoint, \c!breedte=5em, - \c!hoogte=\v!passend, % \v!regel = faster + \c!hoogte=\v!passend, % \v!regel = faster \c!achtergrond=, \c!achtergrondkleur=] @@ -143,10 +143,10 @@ \def\linetablerparameter#1% faster, leaner and meaner {\csname - \ifnum\linetablerow=\zerocount % geen ifcase + \ifnum\linetablerow=\zerocount % geen ifcase \ifcsname\??ler\v!hoofd#1\endcsname \??ler\v!hoofd#1% - \else\ifcsname\??ler0#1\endcsname + \else\ifcsname\??ler0#1\endcsname \??ler0#1% \else \s!empty @@ -164,7 +164,7 @@ \def\setnoftableslines {\doifelse{\linetableparameter\c!regels}\v!passend - {% nearly the same as core-tab, so same bugs + {% nearly the same as core-tab, so same bugs \ifdim\pagegoal<\maxdimen \scratchdimen\pagegoal \advance\scratchdimen -\pagetotal @@ -176,7 +176,7 @@ \global\advance\scratchdimen -\strutdp \global\advance\scratchdimen -\parskip \fi\fi - \getrawnoflines\scratchdimen + \getrawnoflines\scratchdimen \xdef\noflinetablelines{\the\noflines}} {\xdef\noflinetablelines{\linetableparameter\c!regels}}} @@ -199,40 +199,40 @@ \global\advance\linetablecolumn\plusone}% \global\linetablecolumn\scratchcounter \fi - \chardef\linetablemode + \chardef\linetablemode \iflinetablepreroll \ifdim\scratchdimen>\zeropoint \zerocount \else \plustwo \fi \else \zerocount \fi \ifcase\linetablemode - \ifcase\linetablehmode - % nothing + \ifcase\linetablehmode + % nothing \or % fit, keep it simple \or - \chardef\linetablemode\plusone % line + \chardef\linetablemode\plusone % line \else - % some already calculated height + % some already calculated height \fi \fi - \setbox\scratchbox\hbox + \setbox\scratchbox\hbox \bgroup - \dontcomplain + \dontcomplain \hskip\linetablecparameter\c!linkeroffset\relax % 0 = width, unknown height - % 1 = width, fixed height - % 2 = no width, auto hsize + % 1 = width, fixed height + % 2 = no width, auto hsize \ifnum\linetablemode<\plustwo \advance\scratchdimen-\linetablecparameter\c!linkeroffset \advance\scratchdimen-\linetablecparameter\c!rechteroffset \fi - \ifcase\linetablemode + \ifcase\linetablemode \dosetraggedcommand{\linetablecparameter\c!uitlijnen}% - \vtop \ifdim\linetableheight>\zeropoint to\linetableheight \fi \bgroup - \hsize\scratchdimen + \vtop \ifdim\linetableheight>\zeropoint to\linetableheight \fi \bgroup + \hsize\scratchdimen \raggedcommand - \else + \else \setalignmentswitch{\linetablecparameter\c!uitlijnen}% \hbox \ifcase\linetablemode \or to\scratchdimen \fi \bgroup \ifcase\alignmentswitch\hss\or\hss\fi @@ -241,9 +241,9 @@ \begstrut \ignorespaces} \def\stoplinetablecell - {\unskip \endstrut + {\unskip \endstrut \dostopattributes - \ifcase\linetablemode + \ifcase\linetablemode \endgraf \else \ifcase\alignmentswitch\else\hss\fi @@ -261,15 +261,15 @@ \egroup} \def\savelinetablepart - {\global\setbox\tablebox\linetablepart - \ifnum\linetablepart=\zerocount - \box\scratchbox % just storing + {\global\setbox\tablebox\linetablepart + \ifnum\linetablepart=\zerocount + \box\scratchbox % just storing \else - \vbox + \vbox {\ifvoid\tablebox\linetablepart\else\unvbox\tablebox\linetablepart\fi \doif{\linetablerparameter\c!achtergrond}\v!kleur {\backgroundline[\linetablerparameter\c!achtergrondkleur]}% - {\box\scratchbox}% is also arg to \backgroundline + {\box\scratchbox}% is also arg to \backgroundline \endgraf \linetablerparameter\c!na}% \fi} @@ -277,10 +277,10 @@ \def\flushlinetableparts {\doglobal\increment\linetableline \ifnum\linetableline<\noflinetablelines - % keep collecting + % keep collecting \else - \iflinetablepreroll - % forget about them + \iflinetablepreroll + % forget about them \else \doifelse{\linetableparameter\c!regels}\v!passend {\scratchdimen\pagetotal}% @@ -291,12 +291,12 @@ \ifnum\recurselevel>\plusone \setbox\scratchbox\vbox to \scratchdimen{\vss}% \dp\scratchbox\strutdepth - \wd\scratchbox\hsize - \box\scratchbox + \wd\scratchbox\hsize + \box\scratchbox \else \obeydepth \fi - \fi + \fi \dp\tablebox\linetablepart\strutdepth \hbox to \hsize{\box\tablebox\linetablepart\hss}% \ifnum\linetablepart<\noflinetableparts\relax @@ -305,37 +305,61 @@ \ifnum\linetablerows<\noflinetablerows\relax \linetableparameter\c!tussen \else - % after, later - \fi + % after, later + \fi \chardef\linetableheadstatus\plusthree - \global\setbox\tablebox\zerocount\emptybox % here + \global\setbox\tablebox\zerocount\emptybox % here \fi - % reset \linetablerow will be an option, currently - % starts at zero after split - \globallet\linetablerow\!!zerocount + % reset \linetablerow will be an option, currently + % starts at zero after split + \globallet\linetablerow\!!zerocount \globallet\linetableline\!!zerocount \global\chardef\linetablepage\zerocount \global\linetablewidth\zeropoint \setnoftableslines \fi} +% \def\startlinetablepart +% {\global\linetablesubcol\zerocount +% \setbox\scratchbox\hbox\bgroup\ignorespaces} + +% \def\stoplinetablepart +% {\ifnum\linetablepart>\zerocount +% \unskip \unskip % remove last intercolumn skip (distance+fill) +% \fi +% \egroup +% \iflinetablepreroll \else +% \ifcase\linetablepart +% % we're collecting the repeater +% \else +% \scratchdimen\hsize \advance\scratchdimen-\wd\scratchbox\relax +% \ifdim\scratchdimen>\linetableparameter\c!rek\else +% \setbox\scratchbox\hbox to \hsize{\unhbox\scratchbox}% +% \fi +% \fi +% \fi} + \def\startlinetablepart {\global\linetablesubcol\zerocount - \setbox\scratchbox\hbox\bgroup\ignorespaces} + \setbox\scratchbox\hbox\bgroup + \doconvertfont{\linetablerparameter\c!letter}% + \startcolor[\linetablerparameter\c!kleur]% + \ignorespaces} \def\stoplinetablepart - {\ifnum\linetablepart>\zerocount + {\ifnum\linetablepart>\zerocount \unskip \unskip % remove last intercolumn skip (distance+fill) \fi + \stopcolor \egroup \iflinetablepreroll \else \ifcase\linetablepart - % we're collecting the repeater + % we're collecting the repeater \else \scratchdimen\hsize \advance\scratchdimen-\wd\scratchbox\relax \ifdim\scratchdimen>\linetableparameter\c!rek\else \setbox\scratchbox\hbox to \hsize{\unhbox\scratchbox}% - \fi + \fi \fi \fi} @@ -355,55 +379,55 @@ %%% \donefalse \ifcase\linetablerepeat\else - % van te voren berekenen + % van te voren berekenen \scratchcounter\linetablecolumn\advance\scratchcounter-2 \ifnum\linetablerepeat=\scratchcounter - \donetrue % collecting repeater + \donetrue % collecting repeater \fi \fi %%%% - \ifdone - % collecting repeater + \ifdone + % collecting repeater \else \ifnum\linetablecolumn>\getvalue{\??le::\linetablepart}\relax - \donetrue + \donetrue \fi - \fi + \fi \ifdone \stoplinetablepart \iflinetablepreroll \else \savelinetablepart - \fi + \fi \ifcase\linetablepage \or \global\chardef\linetablepage \plustwo \else \global\chardef\linetablepage \plusone - \fi + \fi \doglobal\increment\linetablepart - \global\linetablewidth\wd\tablebox\zerocount + \global\linetablewidth\wd\tablebox\zerocount \startlinetablepart \fi \else \donefalse \!!doneafalse \ifcase\linetablerepeat\else - % van te voren berekenen + % van te voren berekenen \scratchcounter\linetablecolumn \advance\scratchcounter-2 \ifnum\linetablerepeat=\scratchcounter - \donetrue % collecting repeater + \donetrue % collecting repeater \fi - \fi - \ifdone + \fi + \ifdone \!!doneatrue - % collecting repeater - \else\ifdim\linetablewidth>\hsize + % collecting repeater + \else\ifdim\linetablewidth>\hsize \donetrue \else \global\advance\linetablewidth\linetablecparameter\c!afstand\relax - \ifdim\linetablewidth>\hsize % ? + \ifdim\linetablewidth>\hsize % ? \donetrue \fi - \fi\fi + \fi\fi \ifdone \stoplinetablepart \savelinetablepart @@ -411,21 +435,21 @@ \global\chardef\linetablepage \plustwo \else \global\chardef\linetablepage \plusone - \fi + \fi \doglobal\increment\linetablepart \ifnum\linetablepart>\noflinetableparts \globallet\noflinetableparts\linetablepart \initializetablebox\linetablepart - \fi + \fi \global\linetablewidth\wd\linetablecell \startlinetablepart - \if!!doneb \else \ifcase\linetablerepeat \else - % check for left/right page + \if!!doneb \else \ifcase\linetablerepeat \else + % check for left/right page \ifcase\linetablepage\donetrue\or\donetrue\or\donefalse\fi\ifdone - % insert repeater - \global\advance\linetablewidth\wd\tablebox\zerocount + % insert repeater + \global\advance\linetablewidth\wd\tablebox\zerocount \iflinetablepreroll\kern\wd\else\unhcopy\fi\tablebox\zerocount - \fi + \fi \fi \fi \fi \iflinetablepreroll \else @@ -436,24 +460,24 @@ \fi \fi} -% \linetableparameter\c!var -> \@@levar (when no classes) +% \linetableparameter\c!var -> \@@levar (when no classes) \def\startlinetablerun % to do: quit when nested {\bgroup - \inlinetabletrue - % autowidth + \inlinetabletrue + % autowidth \doif{\linetableparameter\c!maxbreedte}\v!passend {\setuplinetable[\c!maxbreedte=\zeropoint]}% \processaction [\linetableparameter\c!rek] [\v!nee=>{\setuplinetable[\c!rek=\maxdimen]},% no stretch - \v!ja=>{\setuplinetable[\c!rek=\zeropoint]}]% max stretch + \v!ja=>{\setuplinetable[\c!rek=\zeropoint]}]% max stretch \chardef\linetablerepeat\linetableparameter\c!nlinks - \chardef\linetablesplitstatus % = + \chardef\linetablesplitstatus % = \ifdim\linetableparameter\c!maxbreedte>\zeropoint - \zerocount \else \plusone + \zerocount \else \plusone \fi - % optional prevdepth correction + % optional prevdepth correction \iflinetablepreroll \globallet\noflinetablerows\!!zerocount \else @@ -472,8 +496,8 @@ \ifcase\linetablerepeat \globallet\linetablepart\!!plusone \else - \globallet\linetablepart\!!zerocount % repeater - \fi + \globallet\linetablepart\!!zerocount % repeater + \fi \globallet\linetablestep\!!plusone \globallet\linetableline\!!zerocount \globallet\linetablerow \!!zerocount @@ -481,7 +505,7 @@ \global\linetablesubcol \zerocount \global\linetablewidth \zeropoint \setnoftableslines - \checklinetablepage + \checklinetablepage \let\BR\linetableBR \let\ER\linetableER \let\BH\linetableBR @@ -490,11 +514,11 @@ \let\EC\linetableEC \let\NC\linetableNC \let\NR\linetableNR - \flushlinetablehead} + \flushlinetablehead} \def\stoplinetablerun {\globallet\linetableline\!!maxcard - \chardef\linetableheadstatus\zerocount % blocked + \chardef\linetableheadstatus\zerocount % blocked \flushlinetableparts \iflinetablepreroll \else \linetableparameter\c!na @@ -542,7 +566,7 @@ \def\linetableBR {\dosingleempty\dolinetableBR} -\def\dolinetableBR[#1]% #1 not yet implemented +\def\dolinetableBR[#1]% #1 not yet implemented {\ifnum\linetableheadstatus=1\else \doglobal\increment\linetablerow \doglobal\increment\linetablerows @@ -551,27 +575,27 @@ \global\linetablesubcol\plusone % \linetableheight\linetablerparameter\c!hoogte % -% \ifx\linetableheight\empty -% % nothing -% \else\ifx\linetableheight\v!passend +% \ifx\linetableheight\empty +% % nothing +% \else\ifx\linetableheight\v!passend % % keep it simple -% \else\ifx\linetableheight\v!regel +% \else\ifx\linetableheight\v!regel % \chardef\linetablemode\plusone % \else -% \!!heighta\linetableheight +% \!!heighta\linetableheight % \advance\!!heighta-\strutdepth % \fi\fi\fi % \linetableheight\zeropoint \edef\!!stringa{\linetablerparameter\c!hoogte}% - \ifx\!!stringa\empty + \ifx\!!stringa\empty \chardef\linetablehmode\zerocount - \else\ifx\!!stringa\v!passend - \chardef\linetablehmode\plusone - \else\ifx\!!stringa\v!regel + \else\ifx\!!stringa\v!passend + \chardef\linetablehmode\plusone + \else\ifx\!!stringa\v!regel \chardef\linetablehmode\plustwo \else - \linetableheight\!!stringa + \linetableheight\!!stringa \advance\linetableheight-\strutdepth \fi\fi\fi % @@ -589,10 +613,10 @@ \def\linetableER {\stoplinetablecell - % no \box\linetablecell, i.e. dummy columnn, last \NC \NR + % no \box\linetablecell, i.e. dummy columnn, last \NC \NR \stoplinetablepart \savelinetablepart - \advance\linetablecolumn \minusone + \advance\linetablecolumn \minusone \ifnum\linetablecolumn>\noflinetablecolumns \xdef\noflinetablecolumns{\number\linetablecolumn}% \fi @@ -602,9 +626,9 @@ \ifcase\linetablerepeat \globallet\linetablepart\!!plusone \else - \globallet\linetablepart\!!zerocount % repeater + \globallet\linetablepart\!!zerocount % repeater \fi - \checklinetablepage + \checklinetablepage \flushlinetablehead} \def\checklinetablepage @@ -616,13 +640,13 @@ \def\flushlinetablehead {\ifcase\linetableheadstatus - % 0 blocked - \or - % 1 doing head + % 0 blocked + \or + % 1 doing head \or - % 2 head done + % 2 head done \or - % 3 trigger flush + % 3 trigger flush \chardef\linetableheadstatus\plusone \the\@@linetablehead\relax \chardef\linetableheadstatus\plustwo @@ -659,37 +683,37 @@ \dorecurse\noflinetablecolumns % global, from last run {\linetableparameter\c!n} {%\writestatus{linetable}{\recurselevel->\getvalue{\??lew\recurselevel}}% \setevalue{\??lec\recurselevel\c!breedte}{\getvalue{\??lew\recurselevel}}% - \letgvalue{\??lew\recurselevel}\!!zeropoint}} % init next table + \letgvalue{\??lew\recurselevel}\!!zeropoint}} % init next table -% todo: store in box instead of macro +% todo: store in box instead of macro \newtoks \@@linetablehead \long\def\startlinetablehead#1\stoplinetablehead {\ifinlinetable \@@linetablehead\emptytoks - \fi - \chardef\linetableheadstatus3 % full + \fi + \chardef\linetableheadstatus3 % full \@@linetablehead{#1}% \ifinlinetable \flushlinetablehead \fi} -\def\linetableBH - {\ifx\EC\relax - % signal, grabbing lines +\def\linetableBH + {\ifx\EC\relax + % signal, grabbing lines \else - \@@linetablehead\emptytoks - \fi - \pushmacro\BC - \pushmacro\EC + \@@linetablehead\emptytoks + \fi + \pushmacro\BC + \pushmacro\EC \def\BC##1\EC{\appendtoks##1\to\@@linetablehead}% - \let\EC\relax} % signal + \let\EC\relax} % signal -\def\linetableEH +\def\linetableEH {\popmacro\EC \popmacro\BC - \@EA\startlinetablehead\the\@@linetablehead\stoplinetablehead} + \@EA\startlinetablehead\the\@@linetablehead\stoplinetablehead} \let\startlinetablebody\donothing \let\stoplinetablebody \donothing @@ -698,7 +722,7 @@ {\dosingleempty\doprocesslinetablebuffer} \def\doprocesslinetablebuffer[#1]% - {\bgroup + {\bgroup \let\startlinetable\donothing \let\stoplinetable \donothing \startlinetableanalysis\getbuffer[#1]\stoplinetableanalysis @@ -706,18 +730,18 @@ \egroup} \def\processlinetablefile#1% - {\bgroup + {\bgroup \let\startlinetable\donothing \let\stoplinetable \donothing \startlinetableanalysis\readfile{#1}\donothing\donothing\stoplinetableanalysis \startlinetablerun \readfile{#1}\donothing\donothing\stoplinetablerun \egroup} -\protect \endinput +\protect \endinput \doifnotmode{demo}{\endinput} -% to be documented, see stan's ledger styles for an example +% to be documented, see stan's ledger styles for an example \setuplinetable[n=6,m={2,2,2},regels=25] @@ -729,7 +753,7 @@ \starttext -\showframe \showstruts +\showframe \showstruts \setupcolors[state=start] diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index f16bdb603..7a1f7910c 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -2278,6 +2278,7 @@ \let \@@efbreedte\@@xybreedte \let \@@efhoogte \@@xyhoogte \let \@@efregels \@@xyregels + \let \@@efgrid \@@xygrid \let \@@epx \!!zeropoint \let \@@epy \!!zeropoint \edef\@@epw {\the\nextboxwd}% @@ -2301,7 +2302,7 @@ \getparameters [\??xy] [\c!schaal=,\c!breedte=,\c!hoogte=,\c!regels=, - \c!factor=,\c!hfactor=,\c!bfactor=, + \c!factor=,\c!hfactor=,\c!bfactor=,\c!grid=, \c!sx=1,\c!sy=1,#1]% \dowithnextbox {\dontshowcomposition diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex index a675ce0ed..aee564701 100644 --- a/tex/context/base/core-new.tex +++ b/tex/context/base/core-new.tex @@ -193,8 +193,8 @@ \let\stopmode \donothing \let\stopnotmode\donothing -\long\def\dostopmode #1\stopmode {} -\long\def\dostopnotmode#1\stopnotmode{} +\long\def\dostopmode #1\stopmode {} +\long\def\dostopnotmode#1\stopnotmode{} \def\doifallmodeselse{\unprotect\dodoifallmodeselse} \def\doifallmodes {\unprotect\dodoifallmodes} @@ -220,8 +220,111 @@ \let\stopallmodes \donothing \let\stopnotallmodes\donothing -\long\def\dostopallmodes #1\stopallmodes {} -\long\def\dostopnotallmodes#1\stopnotallmodes{} +\long\def\dostopallmodes #1\stopallmodes {} +\long\def\dostopnotallmodes#1\stopnotallmodes{} + +% \def\setups +% {\dosingleargument\dosetups} +% +% \def\dosetups[#1]% +% {\iffirstargument +% \def\next{\dodosetups{#1}}% +% \else +% \let\next\dodosetups +% \fi +% \next} +% +% \def\dodosetups#1% +% {\processcommalist[#1]\dododosetups} +% +% \def\dododosetups#1% +% {\getvalue{\??su#1}} +% +% \def\doifsetupselse#1% +% {\doifdefinedelse{\??su#1}} +% +% \long\@EA\def\csname\e!start\v!instellingen\endcsname#1 % +% {\bgroup +% \catcode`\^^M=\@@ignore +% \xdostartsetups{#1}} +% +% \expanded +% {\long\noexpand\def\noexpand\xdostartsetups##1##2\csname\e!stop\v!instellingen\endcsname +% {\egroup +% \long\noexpand\setvalue{\??su##1}{##2}}} +% +% \def\startsetups % for international purposes +% {\bgroup\doifnextcharelse[{\startsetupsA\stopsetups}{\startsetupsB\stopsetups}} +% +% \def\startlocalsetups % for nested purposes +% {\bgroup\doifnextcharelse[{\startsetupsA\stoplocalsetups}{\startsetupsB\stoplocalsetups}} +% +% \def\startsetupsA#1[#2]% +% {\catcode`\^^M=\@@ignore +% \dostartsetups#1{#2}} +% +% \def\startsetupsB#1#2 % space delimited +% {\startsetupsA#1[#2]}% +% +% \long\def\dostartsetups#1#2% watch out: not \grabuntil +% {\dograbuntil#1{\egroup\long\setvalue{\??su#2}}} + +\expanded + {\long\def\@EA\noexpand\csname\e!start\v!instellingen\endcsname + {\bgroup\noexpand\doifnextcharelse[% + {\noexpand\startsetupsA\@EA\noexpand\csname\e!stop\v!instellingen\endcsname} + {\noexpand\startsetupsB\@EA\noexpand\csname\e!stop\v!instellingen\endcsname}}} + +\letvalue{\e!stop\v!instellingen}\relax + +\def\setups % {..} or [..] + {\doifnextcharelse\bgroup\dosetupsA\dosetupsB} + +\def\dosetupsA #1{\processcommalist[#1]\dosetups} % {..} +\def\dosetupsB[#1]{\processcommalist[#1]\dosetups} % [..] + +\def\dosetups#1% the grid option will be extended to other main modes + {\executeifdefined{\??su\ifgridsnapping\v!grid\fi:#1}{\csname\??su:#1\endcsname}\relax} + +\def\doifsetupselse#1% to be done: grid + {\doifdefinedelse{\??su:#1}} + +\def\startsetups % for international purposes + {\bgroup\doifnextcharelse[{\startsetupsA\stopsetups}{\startsetupsB\stopsetups}} + +\def\startlocalsetups % for nested purposes + {\bgroup\doifnextcharelse[{\startsetupsA\stoplocalsetups}{\startsetupsB\stoplocalsetups}} + +\let\stopsetups \relax +\let\stoplocalsetups\relax + +\def\startsetupsA#1% + {\catcode`\^^M\@@ignore + \dotripleempty\dostartsetups[#1]} + +\def\startsetupsB#1#2 % space delimited / kind of obsolete + {\catcode`\^^M\@@ignore + \dodostartsetups#1\empty{#2}} + +\def\dostartsetups + {\ifthirdargument + \@EA\startsetupsC + \else + \@EA\startsetupsD + \fi} + +\def\startsetupsC[#1][#2][#3]% [..] [..] + {\dodostartsetups#1{#2}{#3}} + +\def\startsetupsD[#1][#2][#3]% [..] + {\dodostartsetups#1\empty{#2}} + +\long\def\dodostartsetups#1#2#3% watch out: not \grabuntil + {\dograbuntil#1{\egroup\long\setvalue{\??su#2:#3}}} + +\def\systemsetupsprefix{*} + +\def\systemsetups#1{\dosetups{\systemsetupsprefix#1}} % new % @@ -394,7 +497,7 @@ \bgroup -\gdef\cleanedupcolon{:} \catcode`:=\@@active +\gdef\cleanedupcolon{:} \catcode`:=\@@active \gdef\cleanuplabel#1% {\bgroup\let:\cleanedupcolon @@ -422,4 +525,4 @@ \egroup -\protect \endinput +\protect \endinput
\ No newline at end of file diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex index 6aa6cc0c6..b85c87c61 100644 --- a/tex/context/base/core-ntb.tex +++ b/tex/context/base/core-ntb.tex @@ -710,6 +710,51 @@ % \def\splittblbox#1% #1 <> 0/2 % {\unvbox#1} +% \def\splittblbox#1% #1 <> 0/2 +% {\ifinsidefloat +% \unvbox#1% +% \else +% % spacing between rows gets lost in split +% \setbox4\vbox +% {\doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}}% +% \setbox2\vbox +% {}% +% \dorecurse\noftblheadlines +% {\setbox0\vsplit#1 to \lineheight +% \setbox2\vbox{\unvcopy2\unvcopy0}}% +% \ifcase\noftblheadlines\else\unvcopy2\fi +% \donefalse +% \doloop +% {\setbox0\vsplit#1 to \lineheight +% \ifdim\pagegoal<\maxdimen +% \setbox0\vbox{\unvbox0}% +% \dimen0\ht0 +% \advance\dimen0\ht4 +% \advance\dimen0\pagetotal +% \ifdim\dimen0>\pagegoal +% \bgroup \pagina \egroup % make sure that local vars are kept +% \ifcase\noftblheadlines\else\unvcopy2\fi +% \fi +% \fi +% \ifdone +% \doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}% +% \fi +% \unvbox0 +% \allowbreak +% \ifvoid#1 \exitloop \else \donetrue \fi}% +% \fi} + + +% \bTABLE[split=repeat] +% \bTABLEhead +% \bTR \bTH lxxxeft \eTH\bTD right \eTD\eTR +% \eTABLEhead +% \bTABLEbody +% \dorecurse{100}{\bTR[after={\pagina[bigpreference]}] \bTD left \eTD\bTD right \eTD\eTR} +% \dorecurse{100}{\bTR\bTD left \eTD\bTD right \eTD\eTR} +% \eTABLEbody +% \eTABLE + \def\splittblbox#1% #1 <> 0/2 {\ifinsidefloat \unvbox#1% @@ -740,7 +785,23 @@ \doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}% \fi \unvbox0 - \allowbreak + %\allowbreak + \bgroup + \scratchcounter\recurselevel + \advance\scratchcounter\noftblheadlines + \setupTBLcell{\number\scratchcounter}1 + \ifx\@@tblsplitafter\relax + \allowbreak + \else + \doifelsenothing\@@tblsplitafter + \allowbreak + {\scratchcounter\realpageno + \@@tblsplitafter + \ifnum\scratchcounter<\realpageno + \ifcase\noftblheadlines\else\unvcopy2\fi + \fi}% + \fi + \egroup \ifvoid#1 \exitloop \else \donetrue \fi}% \fi} @@ -1114,4 +1175,47 @@ \fi \fi} +%D Spacing: +% +% \starttabulate +% \NC text \NC text \NC \NR +% \TB[small] +% \NC text \NC text \NC \NR +% \TB[4*big] +% \NC text \NC text \NC \NR +% \stoptabulate +% +% \starttable[|||] +% \VL text \VL text \VL \AR +% \TB[small] +% \VL text \VL text \VL \AR +% \TB[4*big] +% \VL text \VL text \VL \AR +% \stoptable + +\def\complexTableTB[#1]{\TABLEnoalign{\blanko[#1]}} +\def\simpleTableTB {\TABLEnoalign{\blanko}} + +\def\TabulateTB + {\complexorsimpleTable{TB}} + +\def\doTableinterline% #1 + {\ifnum\currentTABLEcolumn>\maxTABLEcolumn + \chuckTABLEautorow + \else\ifnum\currentTABLEcolumn=\zerocount + \TABLEnoalign + {\globalletempty\checkTABLEautorow + \globalletempty\chuckTABLEautorow}% + \else + \setTABLEerror\TABLEmissingcolumn + \handleTABLEerror + \fi\fi + \complexorsimpleTable} % {#1} + +\def\TableHL{\doTableinterline{HL}} +\def\TableTB{\doTableinterline{TB}} + +\appendtoks\let\TB\TableTB \to\everytable +\appendtoks\let\TB\TabulateTB\to\everytabulate + \protect \endinput
\ No newline at end of file diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex index 8b1edaaff..82428db4f 100644 --- a/tex/context/base/core-obj.tex +++ b/tex/context/base/core-obj.tex @@ -2,14 +2,14 @@ %D [ file=core-obj, %D version=1998.01.15, %D title=\CONTEXT\ Core Macros, -%D subtitle=Object Handling, +%D subtitle=Object Handling, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. \writestatus{loading}{Context Core Macros / Object Handling} @@ -50,57 +50,57 @@ 31: obiect duplicat -- \stopmessages -%D \macros +%D \macros %D {setobject,getobject,ifinobject} %D %D Boxes can be considered reuable objects. Unfortunaltely once %D passed to the \DVI\ file, such objects cannot be reused. In %D \PDF\ however, reusing is possible and sometimes even a -%D necessity. Therefore, \CONTEXT\ supports reusable objects. -%D +%D necessity. Therefore, \CONTEXT\ supports reusable objects. +%D %D During the \TEX\ processing run, boxes can serve the purpose %D of objects, and the \DVI\ driver module implements objects -%D using packed boxes. -%D +%D using packed boxes. +%D %D The \PDF\ and \PDFTEX\ driver modules implement objects %D using \PDF\ forms. There is no (real) restriction on the -%D number of objects there. -%D +%D number of objects there. +%D %D The first application of objects in \CONTEXT\ concerned %D \METAPOST\ graphics and fill||in form fields. The first %D application can save lots of bytes, while the latter use is -%D more a necessity than byte saving. -%D +%D more a necessity than byte saving. +%D %D \starttypen %D \setobject{class}{name}\somebox{} %D \getobject{class}{name} %D \stoptypen -%D +%D %D Here \type{\somebox} can be whatever box specification suits %D \TEX. We save the dimensions of an object, although some %D drivers will do so themselves. This means that when for %D instance using \PDFTEX\ we could save a hash entry plus some %D 20+ memory locations per object by delegating this -%D housekeeping to the driver. The current approach permits -%D us to keep the box characteristic too. +%D housekeeping to the driver. The current approach permits +%D us to keep the box characteristic too. \newif\ifinobject \def\objectplaceholder{NOT YET FLUSHED}% -\def\presetobject#1#2% \global added +\def\presetobject#1#2% \global added {\blabelgroup - \ifundefined{\r!object#1::#2}% + \ifundefined{\r!object#1::#2}% \global\@EA\let\csname\r!object#1::#2\endcsname\objectplaceholder \fi \elabelgroup} \def\dosetobject#1#2#3% \initializepaper this will move to \everyshipout {\initializepaper - \blabelgroup - \ifundefined{\r!object#2::#3}% + \blabelgroup + \ifundefined{\r!object#2::#3}% \elabelgroup \expandafter\dodosetobject - \else % tzt, overload internal referenced objects to save entries + \else % tzt, overload internal referenced objects to save entries \elabelgroup \expandafter\gobblefivearguments \fi {#1}{#2}{#3}} @@ -112,22 +112,30 @@ %D Somehow there is a rounding error problem in either \PDFTEX\ %D or in viewers, or maybe it is conforming the specs. The next %D variable compensate for it by removing the rather tight -%D clip. +%D clip. \def\objectoffset{1cm} {} -\def\dodosetobject#1#2#3% +% \def\dodosetobject#1#2#3% +% {\bgroup +% \inobjecttrue +% \dowithnextbox{\dododosetobject{#1}{#2}{#3}\egroup}} + +\def\dodosetobject#1#2#3% {\bgroup + \globalpushmacro\crossreferenceobject \objectreferenced \inobjecttrue - \dowithnextbox{\dododosetobject{#1}{#2}{#3}\egroup}} + \dowithnextbox + {\globalpopmacro\crossreferenceobject + \dododosetobject{#1}{#2}{#3}\egroup}} \def\dododosetobject#1#2#3% {\blabelgroup \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox - \scratchdimen\objectoffset + \scratchdimen\objectoffset \@EA\xdef\csname\r!object#2::#3\endcsname - {\noexpand\dohandleobject{#2}{#3}% + {\noexpand\dohandleobject{#2}{#3}% {\ifhbox\nextbox\hbox\else\vbox\fi}% %{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% @@ -151,13 +159,13 @@ % \def\dogetobject#1#2#3#4#5#6% % {\initializepaper -% \forgetall +% \forgetall % \dontshowcomposition % \setbox\scratchbox\vbox % {\doinsertobject{#1}{#2}}% % \setbox\scratchbox#3% -% {\vbox to #5\s!sp -% {\ifdim\ht\scratchbox>#5\s!sp +% {\vbox to #5\s!sp +% {\ifdim\ht\scratchbox>#5\s!sp % % or \ifdim\wd\scratchbox>#4\s!sp % \vss\hbox to #4\s!sp{\hss\box\scratchbox\hss}\vss % \else @@ -171,13 +179,13 @@ \def\dogetobject#1#2#3#4#5#6#7% {\initializepaper - \forgetall + \forgetall \dontshowcomposition \setbox\scratchbox\vbox {\doinsertobject{#1}{#2}}% \setbox\scratchbox#3% - {\vbox to #5\s!sp - {\ifdim\ht\scratchbox>#5\s!sp + {\vbox to #5\s!sp + {\ifdim\ht\scratchbox>#5\s!sp % or \ifdim\wd\scratchbox>#4\s!sp \vss\hbox to #4\s!sp{\hss\box\scratchbox\hss}\vss \else @@ -185,7 +193,7 @@ \fi}}% \scratchdimen#7\s!sp \setbox\nextbox\hbox - {\hskip-\scratchdimen\lower\scratchdimen\flushnextbox}% + {\hskip-\scratchdimen\lower\scratchdimen\flushnextbox}% \wd\scratchbox#4\s!sp \ht\scratchbox#5\s!sp \dp\scratchbox#6\s!sp @@ -198,15 +206,15 @@ %D \getobjectdimensions{class}{name} %D \stoptypen %D -%D The results are reported in \type {\objectwidth}, \type -%D {\objectheight} and \type {\objectdepth}. +%D The results are reported in \type {\objectwidth}, \type +%D {\objectheight} and \type {\objectdepth}. -% \def\dogetobjectdimensions#1#2#3#4#5#6% +% \def\dogetobjectdimensions#1#2#3#4#5#6% % {\def\objectwidth {#4\s!sp}% % \def\objectheight{#5\s!sp}% % \def\objectdepth {#6\s!sp}} -\def\dogetobjectdimensions#1#2#3#4#5#6#7% +\def\dogetobjectdimensions#1#2#3#4#5#6#7% {\def\objectwidth {#4\s!sp}% \def\objectheight{#5\s!sp}% \def\objectdepth {#6\s!sp}% @@ -219,31 +227,31 @@ \let\objectdepth \!!zeropoint \labelcsname\r!object#1::#2\endcsname} -%D Apart from this kind of objects, that have typeset content, -%D we can have low level driver specific objects. Both types -%D can have references to internal representations, hidden for -%D the user. We keep track of such references by means of a -%D dedicated cross reference mechanism. Normally, objects are -%D defined before they are used, but forward referencing -%D sometimes occurs. -%D +%D Apart from this kind of objects, that have typeset content, +%D we can have low level driver specific objects. Both types +%D can have references to internal representations, hidden for +%D the user. We keep track of such references by means of a +%D dedicated cross reference mechanism. Normally, objects are +%D defined before they are used, but forward referencing +%D sometimes occurs. +%D %D \starttypen %D \dosetobjectreference {class} {identifier} {reference value} {page} %D \dogetobjectreference {class} {identifier} \csname %D \stoptypen -%D +%D %D These commands are to be called by the \type{\startobject}, %D \type{\stopobject} and \type{\insertobject} specials. -\def\objectreferenced{\global\chardef\crossreferenceobject\plusone} +\def\objectreferenced{\global\chardef\crossreferenceobject\plusone} \def\driverreferenced{\global\chardef\crossreferenceobject\zerocount} \objectreferenced \def\checkobjectreferences {\startnointerference - \protectlabels + \protectlabels \doutilities{objectreferences}\jobname\empty\relax\relax \global\let\checkobjectreferences\relax \stopnointerference} @@ -271,9 +279,9 @@ {\writeutilitycommand{\objectreference{#1}{#2}{#3}{\noexpand\realfolio}}}% \dowritereference \fi - %\ifundefined{\r!driver#1::#2}% could have been be replaced ! + %\ifundefined{\r!driver#1::#2}% could have been be replaced ! \setxvalue{\r!driver#1::#2}{{#3}{\noexpand\realfolio}}% - %\fi % so no test ! ! ! ! (pdftex fails on undefined objects) + %\fi % so no test ! ! ! ! (pdftex fails on undefined objects) \elabelgroup} \def\dosetdriverreference @@ -305,7 +313,7 @@ %D \macros %D {doifobjectfoundelse,doifobjectreferencefoundelse} %D -%D To prevent redundant definition of objects, one can use +%D To prevent redundant definition of objects, one can use %D the next tests: %D %D \starttypen @@ -354,16 +362,16 @@ %D \macros %D {doifobjectssupportedelse} %D -%D Starting with reuse of graphics, we will implement object -%D reuse when possible. To enable mechanisms to determine +%D Starting with reuse of graphics, we will implement object +%D reuse when possible. To enable mechanisms to determine %D what method to use, we provide: %D %D \starttypen %D \doifobjectssupportedelse{true action}{false action} %D \stoptypen %D -%D As we can see, currently objects depend on the special -%D driver. +%D As we can see, currently objects depend on the special +%D driver. \newif\ifobjectssupported \objectssupportedtrue @@ -376,8 +384,8 @@ %D There is a conceptual problem here. Objects are not possible %D in \DVI, unless faked like in \type {spec-dvi}. This means -%D that we must be careful in loading special drivers that do -%D support objects while we still want to be able to use the -%D \DVI\ output. +%D that we must be careful in loading special drivers that do +%D support objects while we still want to be able to use the +%D \DVI\ output. -\protect \endinput +\protect \endinput diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index ce0683431..09823c6f7 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -1759,6 +1759,24 @@ % \widowpenalty=\defaultwidowpenalty\relax % \clubpenalty =\defaultclubpenalty \relax +\beginTEX widowpenalties clubpenalties interlinepenalties + + \newcount \widowpenalties + \newcount \clubpenalties + \newcount \interlinepenalties + +\endTEX + +% \setpenalties\widowpenalties2\maxdimen +% +% expands to \widowpenalty \maxdimen \maxdimen \zeropoint + +\def\setpenalties#1#2#3% + {#1\numexpr(#2+1)\space\doexpandedrecurse{\numexpr(#2)}{#3}\zeropoint\relax} + +\def\doexpandedrecurse#1#2% + {\ifnum#1>\zerocount#2\@EA\doexpandedrecurse\@EA{\the\numexpr(#1-1)}{#2}\fi} + \newif\ifgridsnapping % to be sure \def\defaultwidowpenalty {2000} % was: 1000 @@ -1767,19 +1785,63 @@ \def\defaultgridwidowpenalty {0} \def\defaultgridclubpenalty {0} -\def\synchronizecriteria - {\dosingleempty\dosynchronizecriteria} +% The original approach: +% +% \def\setdefaultpenalties +% {\ifgridsnapping +% \widowpenalty\defaultgridwidowpenalty +% \clubpenalty \defaultgridclubpenalty +% \else +% \widowpenalty\defaultwidowpenalty +% \clubpenalty \defaultclubpenalty +% \fi} +% +% However, we will use setups: -\def\dosynchronizecriteria[#1]% - {\ifgridsnapping - \widowpenalty\defaultgridwidowpenalty - \clubpenalty \defaultgridclubpenalty - \else - \widowpenalty\defaultwidowpenalty - \clubpenalty \defaultclubpenalty - \fi} +\def\setdefaultpenalties + {\setups[\systemsetupsprefix\s!default]} + +\startsetups [\systemsetupsprefix\v!reset] + \widowpenalties \minusone + \clubpenalties \minusone + \interlinepenalties \minusone +\stopsetups + +\startsetups [\systemsetupsprefix\s!default] + + \setups[\systemsetupsprefix\s!reset] + + \widowpenalty\defaultwidowpenalty + \clubpenalty \defaultclubpenalty + +\stopsetups + +\startsetups [\v!grid] [\systemsetupsprefix\s!default] + + \setups[\systemsetupsprefix\v!reset] + + \widowpenalty\defaultgridwidowpenalty + \clubpenalty \defaultgridclubpenalty + +\stopsetups + +% as an illustration: + +\startsetups [\systemsetupsprefix\v!streng] + + \setups[\v!reset] + + \setpenalties\widowpenalties2\maxdimen + \setpenalties\clubpenalties 2\maxdimen + \brokenpenalty \maxdimen + +\stopsetups + +\setdefaultpenalties % will happen later in \setuplayout + +% Suggested by GB (not the name -): -\synchronizecriteria +\def\rapfillskip{.5\hsize plus .092\hsize minus .5\hsize} % D.A.'s value % Bovendien definieren we enkele extra \fill's: diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index ad3d14a6d..caf6229d7 100644 --- a/tex/context/base/lang-ini.tex +++ b/tex/context/base/lang-ini.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D Todo : --language=pl,en,nl : nl incs number of language +%D Todo : --language=pl,en,nl : nl incs number of language %D This module implements the (for the moment still simple) %D multi||language support of \CONTEXT, which should not be @@ -139,8 +139,8 @@ \newcounter\loadedlanguage %D Let's start with setting the lowercase code of quotes, so -%D that we get proper hyphenation in languages like Dutch, -%D French and Czech. +%D that we get proper hyphenation in languages like Dutch, +%D French and Czech. \lccode`\'=`\' @@ -157,7 +157,7 @@ \def\setupcurrentlanguage[#1]{\def\currentlanguage{#1}} -%D The internal macros will be defined later. +%D The internal macros will be defined later. %D \macros %D {installlanguage} @@ -299,7 +299,7 @@ \def\installlanguage {\dodoubleargument\doinstalllanguage} -%D Handy +%D Handy \def\preloadallpatterns {\gdef\preloadallpatterns##1% @@ -333,7 +333,7 @@ \let\normalpatterns\patterns -\def\dodoloadpatterns#1#2#3#4% beware, loaded language also incr +\def\dodoloadpatterns#1#2#3#4% beware, loaded language also incr {\normallanguage\loadedlanguage % when not really needed %\letvalue{\??la\??la#2}\loadedlanguage \bgroup @@ -370,14 +370,14 @@ \egroup \increment\loadedlanguage} -%D Since we can only load patterns in ini\TeX, we nil the -%D loading before dumping (which saves a bit of memory, but -%D strangely enough not in the format). +%D Since we can only load patterns in ini\TeX, we nil the +%D loading before dumping (which saves a bit of memory, but +%D strangely enough not in the format). -\appendtoks +\appendtoks \gdef\doloadpatterns{\increment\loadedlanguage\gobbletwoarguments}% \globallet\dodoloadpatterns\gobblefourarguments -\to \everydump +\to \everydump %D \macros %D {setuplanguage} @@ -390,7 +390,7 @@ {\dodoubleargument\dosetuplanguage} \def\dosetuplanguage[#1][#2]% - {\getparameters[\??la#1][#2]% + {\getparameters[\??la#1][#2]% \doif{#1}\currentlanguage\docomplexlanguage} %D The values \type {\c!leftsentence} and \type @@ -493,6 +493,9 @@ \newevery \everylanguage \relax \newevery \everyresetlanguagespecifics \relax +\def\disablelanguagespecifics + {\ignorecompoundcharacter} + \def\setnormallanguage#1% {\dosetnormallanguage{:\currentencoding:\currentmapping:}{#1}{% \dosetnormallanguage{:\currentencoding:\s!default :}{#1}{% @@ -503,7 +506,7 @@ {\edef\currentdefaultlanguage{\defaultlanguage\currentlanguage}% \def\synchronizepatterns{\setnormallanguage {\csname\??la\currentlanguage\s!patterns\endcsname}}% called often - \donefalse + \donefalse \synchronizepatterns \ifdone\else \def\synchronizepatterns{\setnormallanguage\currentlanguage}% @@ -520,16 +523,16 @@ \fi \fi \fi - \the\everylanguage + \the\everylanguage \enablelanguagespecifics[\currentlanguage]% -% strange, what is this doing here, dangerous for {il2,ec} +% strange, what is this doing here, dangerous for {il2,ec} % \edef\languagemapping{\csname\??la\currentlanguage\s!mapping\endcsname}% % \ifx\languagemapping\empty\else % \fastenablemapping\languagemapping % \fi \lefthyphenmin 0\csname\??la\currentlanguage\s!lefthyphenmin \endcsname \righthyphenmin0\csname\??la\currentlanguage\s!righthyphenmin\endcsname\relax - % will be definable + % will be definable \doifelsevalue{\??la\currentlanguage\c!spatiering}\v!ruim \nonfrenchspacing\frenchspacing} @@ -541,15 +544,15 @@ \beginETEX -\def\complexlanguage[#1]% - {\edef\askedlanguage{#1}% +\def\complexlanguage[#1]% + {\edef\askedlanguage{#1}% \ifx\askedlanguage\empty \else \ifcsname\l!prefix!\askedlanguage\endcsname \edef\askedlanguage{\csname\l!prefix!\askedlanguage\endcsname}% \ifx\currentlanguage\askedlanguage \else \let\currentlanguage\askedlanguage \docomplexlanguage - \fi + \fi \else \showmessage\m!linguals6{#1}% \fi @@ -569,7 +572,7 @@ \ifx\currentlanguage\askedlanguage \else \let\currentlanguage\askedlanguage \docomplexlanguage - \fi + \fi \fi \fi} @@ -589,8 +592,8 @@ \ifx\currentmainlanguage\askedlanguage \else \let\currentmainlanguage\askedlanguage \let\currentlanguage\askedlanguage - \docomplexlanguage - \fi + \docomplexlanguage + \fi \fi \fi} @@ -606,8 +609,8 @@ \ifx\currentmainlanguage\askedlanguage \else \let\currentmainlanguage\askedlanguage \let\currentlanguage\askedlanguage - \docomplexlanguage - \fi + \docomplexlanguage + \fi \fi \fi} @@ -641,7 +644,7 @@ \def\languageparameter#1% {\csname\??la\defaultlanguage\currentlanguage#1\endcsname} -% moved +% moved % % %D \macros % %D {leftguillemot,rightguillemot,leftsubguillemot,rightsubguillemot, @@ -671,36 +674,36 @@ % %D % %D But in other fonts, these definitions can give problems, so % %D we just say: -% +% % \def\lowerleftsingleninequote {,} % \def\lowerleftdoubleninequote {,,} % \def\upperleftsingleninequote {'} % \def\upperleftdoubleninequote {''} % \def\upperleftsinglesixquote {`} % \def\upperleftdoublesixquote {``} -% +% % \def\lowerrightsingleninequote {,} % \def\lowerrightdoubleninequote {,,} % \def\upperrightsingleninequote {'} % \def\upperrightdoubleninequote {''} % \def\upperrightsinglesixquote {`} % \def\upperrightdoublesixquote {``} -% +% % %D Yes I know, they are ugly: -% +% % \def\leftfakeguillemot % {\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle\ll$}}} -% +% % \def\rightfakeguillemot % {\hbox{\raise.25ex\hbox{$\scriptscriptstyle\gg$}}} -% +% % \def\leftsubfakeguillemot % {\dontleavehmode\hbox{\raise.25ex\hbox{$\scriptscriptstyle<$}}} -% +% % \def\rightsubfakeguillemot % {\hbox{\raise.25ex\hbox{$\scriptscriptstyle>$}}} -%D New (see nomarking and nolist): +%D New (see nomarking and nolist): \def\splitsequence#1#2% {\doifelse{#1}\v!nee @@ -825,7 +828,7 @@ % \bgroup \normallanguage255 \patterns{} \egroup % \def\nopatterns{\normallanguage255 } -\def\nopatterns{\normallanguage\minusone} +\def\nopatterns{\normallanguage\minusone} %D We default to the language belonging to the interface. This %D is one of the few places outside the interface modules where diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index d1b3553ec..7c26c04f1 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -1063,6 +1063,9 @@ proces: proces process sectienummer: sectienummer sectionnumber abschnittsnummer cislooddilu numerosezione numarsectiune +setups: setups setups + setups setups + setups setups snijwit: snijwit cutspace cutspace cutspace cutspace cutspace % GB diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex index 5f799f39b..4a726a15d 100644 --- a/tex/context/base/mult-sys.tex +++ b/tex/context/base/mult-sys.tex @@ -379,6 +379,7 @@ \definesystemvariable {de} % DEel \definesystemvariable {dl} % DunneLijnen \definesystemvariable {dn} % DoorNummeren +\definesystemvariable {dm} % DefineMeasure \definesystemvariable {do} % DefinieerOpmaak \definesystemvariable {du} % DUmmy \definesystemvariable {ds} % DoorSpringen diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex index e7cded9e8..3100aded7 100644 --- a/tex/context/base/page-ini.tex +++ b/tex/context/base/page-ini.tex @@ -2,7 +2,7 @@ %D [ file=page-ini, %D version=2000.10.20, %D title=\CONTEXT\ Page Macros, -%D subtitle=Initializations, +%D subtitle=Initializations, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] @@ -11,20 +11,20 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\writestatus{loading}{Context Page Macros / Initializations} +\writestatus{loading}{Context Page Macros / Initializations} -%D This class of modules implements the output routines and -%D floating body support. Although the modules are relatively -%D new, the code herein is rather old. This reordering was -%D needed when column sets were implemented and sharing code -%D started to make sense. +%D This class of modules implements the output routines and +%D floating body support. Although the modules are relatively +%D new, the code herein is rather old. This reordering was +%D needed when column sets were implemented and sharing code +%D started to make sense. -%D The history shows from the code, since both column -%D mechanism use a different way of looping over columns. +%D The history shows from the code, since both column +%D mechanism use a different way of looping over columns. \unprotect -% message will be distributed +% message will be distributed \startmessages dutch library: systems title: systeem @@ -317,7 +317,7 @@ title: layout 1: teksthøyde tilpasset med -- på side -- 2: -- ganger forskjøvet tekst plassert - 3: -- ganger tekst forskjøvet + 3: -- ganger tekst forskjøvet 4: margblokker aktive 5: margblokker inaktive 6: delside sett -- behandlet (størrelse --) @@ -331,7 +331,7 @@ title: aranjamente 1: textheight adaptat cu -- la pagina -- 2: textul amanat de -- ori a fost plasat - 3: textul amanat de -- ori + 3: textul amanat de -- ori 4: blocuri marginale active 5: blocuri marginale inactive 6: setul -- de subpagini procesat (dimensiunea --) @@ -351,14 +351,14 @@ \let \recalculatelayout \relax -\fi +\fi \ifx\recalculatelogos\undefined \let \recalculatelogos \relax \let \addlogobackground \gobbleoneargument % <box> -\fi +\fi \ifx\recalculatebackgrounds\undefined @@ -369,18 +369,18 @@ \let \addprintbackground \gobbleoneargument % <box> \let \addstatusinfo \gobbleoneargument % <box> -\fi +\fi \ifx\realpageno\undefined \countdef\realpageno\zerocount \realpageno\plusone -\fi +\fi -\ifx\realfolio\undefined +\ifx\realfolio\undefined + + \def\realfolio{\the\realpageno} - \def\realfolio{\the\realpageno} - \fi \newcount\nofshipouts @@ -388,7 +388,7 @@ \appendtoks \global\advance\nofshipouts\plusone \to \everyaftershipout - + % principle: % % multiple otr's @@ -507,7 +507,7 @@ 9: kontrola nerovnost 10: zbyl (mene nez) 1 radek 11: plovouci objekt je pro sloupec prilis siroky - 12: plovouci objekt je presunut do nasledujiciho sloupce / -- + 12: plovouci objekt je presunut do nasledujiciho sloupce / -- 13: siroky plovouci objekt je presunut nad sloupce \stopmessages @@ -562,26 +562,26 @@ 13: blocul lat este mutat in partea de sus a coloanelor \stopmessages -\ifx\dosetuplayout\undefined % overloaded in page-lay ! +\ifx\dosetuplayout\undefined % overloaded in page-lay ! \def\setuplayout{\dodoubleempty\getparameters[\??ly]} -\fi +\fi -%D In case we're not running \ETEX, we need to bypass a -%D couple of primitives. +%D In case we're not running \ETEX, we need to bypass a +%D couple of primitives. \beginTEX \...discards \chardef \savingvdiscards \zerocount - \let \splitdiscards \relax - \let \pagediscards \relax + \let \splitdiscards \relax + \let \pagediscards \relax \endTEX -% ONE = single column +% ONE = single column % MUL = multi column -% SET = columns sets +% SET = columns sets \def\@@OTR{OTR} @@ -593,8 +593,8 @@ {\csname\@@OTR \ifcsname\@@OTR\OTRidentifier\strippedcsname#1\endcsname \OTRidentifier - \else\ifcsname\@@OTR\OTRdefault\strippedcsname#1\endcsname % fallback - \OTRdefault + \else\ifcsname\@@OTR\OTRdefault\strippedcsname#1\endcsname % fallback + \OTRdefault \fi\fi \strippedcsname#1\endcsname} @@ -605,7 +605,7 @@ \def\OTRcommand#1% {\csname\@@OTR \@EA\ifx\csname\@@OTR\OTRidentifier\strippedcsname#1\endcsname\relax - \@EA\ifx\csname\@@OTR\OTRdefault\strippedcsname#1\endcsname\relax % fallback + \@EA\ifx\csname\@@OTR\OTRdefault\strippedcsname#1\endcsname\relax % fallback \else \OTRdefault \fi @@ -616,7 +616,7 @@ \endTEX -% obsolete +% obsolete \def\installotr#1% andere naam, beter \connectotr of zo {\def\OTRidentifier{#1}} @@ -626,7 +626,7 @@ \def\OTRdefault {#2}} %D The initialization of the \type {\hsize} and \type {\vsize} -%D depends on the OTR used. +%D depends on the OTR used. \def\setvsize {\OTRcommand\setvsize} \def\sethsize {\OTRcommand\sethsize} @@ -642,7 +642,7 @@ \def\doflushfloats {\OTRcommand\doflushfloats} \def\flushfloatbox {\OTRcommand\flushfloatbox} \def\docheckiffloatfits {\OTRcommand\docheckiffloatfits} - + \def\someherefloat {\OTRcommand\someherefloat} \def\somefixdfloat {\OTRcommand\somefixdfloat} \def\somepagefloat {\OTRcommand\somepagefloat} @@ -655,19 +655,19 @@ \def\synchronizehsize {\OTRcommand\synchronizehsize} \def\gotonextpage {\OTRcommand\gotonextpage } -\def\gotonextpageX {\OTRcommand\gotonextpageX} % will become obsolete +\def\gotonextpageX {\OTRcommand\gotonextpageX} % will become obsolete -% beter een \installotr#1 met #1 = macro en auto test +% beter een \installotr#1 met #1 = macro en auto test -\newif \iftraceotr +\newif \iftraceotr \newif \ifinotr -\newtoks \mainoutput -\newcount\otrlevel +\newtoks \mainoutput +\newcount\otrlevel -% When issuing two \par\penalty-\@M's, only the first -% triggers the otr; obscure feature or optimization? +% When issuing two \par\penalty-\@M's, only the first +% triggers the otr; obscure feature or optimization? -\def\outputcounter{-100010} % -10010 +\def\outputcounter{-100010} % -10010 \def\doinvokeoutput {\iftraceotr @@ -685,15 +685,15 @@ \outputmessage-{special}{#1}} \def\dodotracedoutput#1% - {\outputmessage+{traced}{#1/\the\outputpenalty}% + {\outputmessage+{traced}{#1/\the\outputpenalty}% \writestatus\m!otr{c:\number\mofcolumns,v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}% \dodoinvokeoutput{#1}% \writestatus\m!otr{c:\number\mofcolumns,v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}% \outputmessage-{traced}{#1/\the\outputpenalty}} -\def\installoutput#1#2% \invoke \action +\def\installoutput#1#2% \invoke \action {\decrement\outputcounter - \edef#1{\noexpand\doinvokeoutput{\outputcounter}}% + \edef#1{\noexpand\doinvokeoutput{\outputcounter}}% \setvalue{\@@OTR\outputcounter}{#2}} \def\invokeoutputroutine @@ -708,30 +708,33 @@ \mainoutput{\invokeoutputroutine} \output{\inotrtrue\the\mainoutput} -\installoutput\synchronizeoutput % maybe add pagediscards +\installoutput\synchronizeoutput % maybe add pagediscards {\ifvoid\normalpagebox\else\unvbox\normalpagebox\fi} + +\installoutput\discardpage + {\setbox\scratchbox\box\normalpagebox} -%D In order to force consistent use of variables, we -%D predefine a lot of them here. +%D In order to force consistent use of variables, we +%D predefine a lot of them here. -%D The next two registers can be used to store pre column -%D material as well as footnotes or so. +%D The next two registers can be used to store pre column +%D material as well as footnotes or so. \newbox\precolumnbox \newdimen\precolumnboxheight \newbox\postcolumnbox \newdimen\postcolumnboxheight -%D We reserve a counter for the number of columns as well as -%D the current column. Both are not to be changed by users! +%D We reserve a counter for the number of columns as well as +%D the current column. Both are not to be changed by users! \newcount\nofcolumns \nofcolumns = 1 \newcount\mofcolumns \mofcolumns = 1 -\chardef\maxnofcolumns = 50 +\chardef\maxnofcolumns = 50 \chardef\allocatednofcolumns = 0 -%D The next dimensions reports the final column height +%D The next dimensions reports the final column height -\newdimen\finalcolumnheights +\newdimen\finalcolumnheights \newcount\finalcolumnlines %D During initialization the temporary boxes are allocated. @@ -796,7 +799,7 @@ %D and only parameter can do something with \type %D {\currentcolumnbox}. In case of the mid columns, \type %D {\firstcolumnbox} and \type {\lastcolumnbox} are handled -%D outside these macro's. +%D outside these macro's. \def\dohandlecolumn#1% {\mofcolumns\recurselevel @@ -811,20 +814,20 @@ \def\dohandlemidcolumns#1% {\dohandleallcolumns - {\ifnum\recurselevel>\plusone + {\ifnum\recurselevel>\plusone \ifnum\recurselevel<\nofcolumns \dohandlecolumn{#1}% \fi \fi}} -%D This register can be used as a temporary storage for page -%D content. +%D This register can be used as a temporary storage for page +%D content. \newbox\restofpage %D Features. -\newif\ifintermediatefootnotes +\newif\ifintermediatefootnotes \newif\ifcarryoverfootnotes %\carryoverfootnotestrue \newif\iflastcolumnfootnotes %\lastcolumnfootnotestrue \newif\ifbalancecolumns %\balancecolumnstrue @@ -834,11 +837,11 @@ \newif\ifinheritcolumns \inheritcolumnsfalse \newif\ifheightencolumns \heightencolumnsfalse -\newif\ifbalancingcolumns -\newif\ifcollectingcontent +\newif\ifbalancingcolumns +\newif\ifcollectingcontent \newif\ifcolumnoverflow \newif\iffinalflushingfloats -\newif\ifpackflushedfloats \packflushedfloatstrue % for the moment +\newif\ifpackflushedfloats \packflushedfloatstrue % for the moment \newdimen\intercolumnwidth \newdimen\localcolumnwidth @@ -857,18 +860,18 @@ %D The \type {\ifdim} test is needed, because otherwise the %D last line of a text end up on top of the baseline instead of -%D on the baseline, as is the case with preceding pages. -%D Also, a \type {\vfil} better than a \type {\vfill}. +%D on the baseline, as is the case with preceding pages. +%D Also, a \type {\vfil} better than a \type {\vfill}. -\def\eject {\par\penalty-\@M } % == {\par\break} % plain -\def\supereject {\par\penalty-\@MM} % also plain +\def\eject {\par\penalty-\@M } % == {\par\break} % plain +\def\supereject {\par\penalty-\@MM} % also plain \def\doejectpage {\par\ifdim\pagetotal>\pagegoal\else\normalvfil\fi} \def\ejectpage {\doejectpage\eject} \def\superejectpage{\doejectpage\supereject} -% floats -% +% floats +% % \def\ejectinsert % {\flushnotes % \bgroup @@ -882,18 +885,18 @@ \bgroup \noftopfloats\plusthousand \nofbotfloats\zerocount - % this is needed in case a float that has been stored - % ends up at the current page; this border case occurs when + % this is needed in case a float that has been stored + % ends up at the current page; this border case occurs when % the calculated room is 'eps' smaller that the room available - % when just flushing; so now we have (maybe optional): + % when just flushing; so now we have (maybe optional): \pagebaselinecorrection % alas, this is tricky but needed (first surfaced in prikkels) \doflushfloats \egroup} \def\ejectdummypage - {\ejectinsert - \hardespatie % will be different + {\ejectinsert + \hardespatie % will be different \vfill \gotonextpage} @@ -907,13 +910,13 @@ \unvbox\normalpagebox \penalty\outputpenalty \fi - % not really needed, replaced by \flushsavedfloats + % not really needed, replaced by \flushsavedfloats \ifnum\outputpenalty>-\@MM \else % better use a proper otr signal - \dosupereject + \dosupereject \fi - % but does not hurt either + % but does not hurt either \inpagebodytrue % needed for enabling \blanko ! - \flushsavedfloats % was \dosetbothinserts; only otr one ! + \flushsavedfloats % was \dosetbothinserts; only otr one ! \setvsize % this is needed for interacting components, like floats and multicolumns \adaptfuzzypagegoal} % watch this hack! @@ -937,7 +940,7 @@ \setpagecounters \message{[-\the\realpageno]}% \setbox\scratchbox\hbox - {%\the\everyshipout % still needed here ? + {%\the\everyshipout % still needed here ? \dopagebody#1#2}% \deadcycles\zerocount \gotonextrealpage @@ -966,17 +969,17 @@ \ifnum\outputpenalty>-\@MM \else \dosupereject \fi - \doflushspread + \doflushspread \douitstellen} -\ifx\doflushspread\undefined \let\doflushspread\relax \fi +\ifx\doflushspread\undefined \let\doflushspread\relax \fi \def\dooutput {\finaloutput\unvbox\normalpagebox} \maxdeadcycles=1000 -% will be installable tracer; better use chardef +% will be installable tracer; better use chardef \newif\ifvoorlopig \voorlopigfalse @@ -990,16 +993,16 @@ \def\plaatsversieaanduiding% nog engels maken {\ifcase\conceptmode - % nothing - \or - % simple + % nothing + \or + % simple \vskip\!!sixpoint \hbox to \zetbreedte {\infofont Concept: \currentdate \hss\reportpagedimensions}% - \or - % extensive + \or + % extensive \vskip\!!sixpoint \hbox to \zetbreedte {\infofont @@ -1019,10 +1022,10 @@ \overfullrule\zeropoint \processaction % \v!definitief=> [#1] - [ \v!concept=>\chardef\conceptmode\plusone,% simple banner - \v!file=>\chardef\conceptmode\plustwo,% full banner - \v!voorlopig=>\chardef\conceptmode\plustwo % full banner plus - \overfullrule5\s!pt]} % info in the margin + [ \v!concept=>\chardef\conceptmode\plusone,% simple banner + \v!file=>\chardef\conceptmode\plustwo,% full banner + \v!voorlopig=>\chardef\conceptmode\plustwo % full banner plus + \overfullrule5\s!pt]} % info in the margin \def\versie {\dosingleargument\doversie} @@ -1030,14 +1033,14 @@ %\def\addstatusinfo % {\ifvoorlopig % \@EA\doaddstatusinfo -% \else\ifcase\conceptmode +% \else\ifcase\conceptmode % \@EAEAEA\gobbleoneargument % \else % \@EAEAEA\doaddstatusinfo % \fi\fi} \def\addstatusinfo - {\ifcase\conceptmode + {\ifcase\conceptmode \@EA\gobbleoneargument \else \@EA\doaddstatusinfo @@ -1045,12 +1048,12 @@ \def\doaddstatusinfo#1% {\setbox#1\vbox to \papierhoogte - {\vsmashbox#1\box#1% + {\vsmashbox#1\box#1% \offinterlineskip - \vskip\kopwit + \vskip\kopwit \hsize\papierbreedte \hfill\hbox{\plaatstestinfo\hskip.5cm}\vss - \settexthoffset\hskip\texthoffset % brrrr + \settexthoffset\hskip\texthoffset % brrrr %\tlap{\plaatsversieaanduiding}\vskip.5cm}} \vbox to 1cm{\vss\plaatsversieaanduiding\vss}}} @@ -1062,7 +1065,7 @@ {#2 \ascii}% \gdef\totaltestinfo {\global\setbox#1\vbox - {\unvbox#1\relax + {\unvbox#1\relax \infofont \setupinterlinespace \hbox {\strut @@ -1079,9 +1082,9 @@ % this will be inserts some day -% \installinsertion\referentieinfobox -% \installinsertion\registerinfobox -% \installinsertion\floatinfobox +% \installinsertion\referentieinfobox +% \installinsertion\registerinfobox +% \installinsertion\floatinfobox \newbox\referentieinfobox \newbox\registerinfobox @@ -1125,12 +1128,12 @@ \newif\ifinpagebody -\ifx\pushcolor\undefined +\ifx\pushcolor\undefined \let \pushcolor \relax \let \popcolor \relax \let \startcolorpage \relax \let \stopcolorpage \relax -\fi +\fi % bewaren tvb documentatie % @@ -1166,7 +1169,7 @@ \newtoks\afterpage \newtoks\aftereverypage \newtoks\beforepage \newtoks\beforeeverypage -\chardef\showgridstate=0 +\chardef\showgridstate=0 \def\showgrid {\dosingleempty\doshowgrid} @@ -1198,21 +1201,21 @@ \newif\ifpagebodyornaments \pagebodyornamentstrue \newif\ifarrangingpages \arrangingpagesfalse -\appendtoks +\appendtoks \global\pagebodyornamentstrue -\to \everyaftershipout +\to \everyaftershipout \let\poparrangedpages\relax \let\pusharrangedpage\relax -\ifx\shiftprintpagebox\undefined +\ifx\shiftprintpagebox\undefined \let\shiftprintpagebox\gobbleoneargument \let\shiftpaperpagebox\gobbleoneargument -\fi +\fi \ifx\registerpageposition\undefined \let\registerpageposition\gobbleoneargument -\fi +\fi \def\reportarrangedpage#1% {\showmessage\m!systems @@ -1221,7 +1224,7 @@ \newif\ifsavepagebody \newbox\savedpagebody % \def\buildpagebody#1#2% -% {\ifsavepagebody\global\setbox\savedpagebody\fi +% {\ifsavepagebody\global\setbox\savedpagebody\fi % \vbox % {\beginrestorecatcodes % \forgetall % igv problemen, check: \boxmaxdepth\maxdimen @@ -1233,14 +1236,14 @@ % % \getbackgroundbox % % \getlogobox % \bgroup % else footnotes get inconsistent font/baseline -% % \doconvertfont\@@lyletter\empty +% % \doconvertfont\@@lyletter\empty % \dostartattributes\??ly\c!letter\c!kleur\empty -% \offinterlineskip +% \offinterlineskip % \gettextboxes % \dostopattributes % \egroup % \fi -% \getmainbox#1#2}% including footnotes +% \getmainbox#1#2}% including footnotes % \ifpagebodyornaments % \addmainbackground \pagebox % \addlogobackground \pagebox @@ -1251,16 +1254,16 @@ % \addpagebackground \pagebox % \fi % \registerpageposition\pagebox -% \ifarrangingpages +% \ifarrangingpages % \shiftpaperpagebox \pagebox % \v!papier % \else % \clippagebox \pagebox -% \addpagecutmarks \pagebox +% \addpagecutmarks \pagebox % \replicatepagebox \pagebox % \scalepagebox \pagebox % \mirrorpaperbox \pagebox % \rotatepaperbox \pagebox -% \addpagecolormarks \pagebox +% \addpagecolormarks \pagebox % \centerpagebox \pagebox % \addprintbackground\pagebox % \mirrorprintbox \pagebox @@ -1273,12 +1276,12 @@ % \endrestorecatcodes}% % \ifsavepagebody\copy\savedpagebody\fi} -% beware, \??ly is used before defined, i.e. bad module design +% beware, \??ly is used before defined, i.e. bad module design \setuplayout[\c!methode=\v!normaal] \def\buildpagebody#1#2% - {\ifsavepagebody\global\setbox\savedpagebody\fi + {\ifsavepagebody\global\setbox\savedpagebody\fi \vbox {\beginrestorecatcodes \forgetall % igv problemen, check: \boxmaxdepth\maxdimen @@ -1287,22 +1290,22 @@ % the following plugin uses and sets pagebox; beware: this % will change and is for my (hh) personal experiments \executeifdefined{\??ly\c!methode\@@lymethode}% - {\getvalue{\??ly\c!methode\v!normaal}}#1#2% - % the finishing touch + {\getvalue{\??ly\c!methode\v!normaal}}#1#2% + % the finishing touch \ifpagebodyornaments \addpagebackground \pagebox \fi \registerpageposition\pagebox - \ifarrangingpages + \ifarrangingpages \shiftpaperpagebox \pagebox % \v!papier \else \clippagebox \pagebox - \addpagecutmarks \pagebox + \addpagecutmarks \pagebox \replicatepagebox \pagebox \scalepagebox \pagebox \mirrorpaperbox \pagebox \rotatepaperbox \pagebox - \addpagecolormarks \pagebox + \addpagecolormarks \pagebox \centerpagebox \pagebox \addprintbackground\pagebox \mirrorprintbox \pagebox @@ -1321,12 +1324,12 @@ \ifpagebodyornaments \bgroup % else footnotes get inconsistent font/baseline \dostartattributes\??ly\c!letter\c!kleur\empty - \offinterlineskip + \offinterlineskip \gettextboxes \dostopattributes \egroup \fi - \getmainbox#1#2}% including footnotes + \getmainbox#1#2}% including footnotes \ifpagebodyornaments \addmainbackground \pagebox \addlogobackground \pagebox @@ -1336,7 +1339,7 @@ \def\finishpagebox#1% {\ifarrangingpages - \addpagecutmarks #1% + \addpagecutmarks #1% \addpagecolormarks#1% \centerpagebox #1% \mirrorprintbox #1% @@ -1348,8 +1351,12 @@ \appendtoks \restoreglobalbodyfont \to \everybeforepagebody \appendtoks \restorecolumnsettings \to \everybeforepagebody +\ifx\nestednewbox\undefined \newbox\nestednextbox \fi + +\prependtoks \let\nextbox\nestednextbox \to \everybeforepagebody + \def\dopagebody#1#2% - {%\getallmarks % now in following token register + {%\getallmarks % now in following token register \the\everybeforepagebody \startcolorpage \gotonextsubpage % nog eens: als in pagina (tbv standaard opmaak) @@ -1374,7 +1381,7 @@ \let\checkpageversion=\relax -% not here +% not here \newif\ifpaginageblokkeerd \paginageblokkeerdfalse @@ -1382,9 +1389,9 @@ {\dodoubleempty\dotestpage} \def\dotestpage[#1][#2]% - {%\relax % needed before \if + {%\relax % needed before \if \endgraf - \ifpaginageblokkeerd \else \ifdim\pagegoal<\maxdimen + \ifpaginageblokkeerd \else \ifdim\pagegoal<\maxdimen \ifdim\pagetotal<\pagegoal % \relax \scratchdimen\lineheight \multiply\scratchdimen#1\relax @@ -1395,11 +1402,11 @@ \ifsecondargument \advance\scratchdimen#2\relax \fi - % quite inaccurate, better pagegoal 1pt or so - \ifdim\scratchdimen>.99\pagegoal + % quite inaccurate, better pagegoal 1pt or so + \ifdim\scratchdimen>.99\pagegoal \penalty-\!!tenthousand\relax \fi - \fi + \fi \else \goodbreak \fi \fi} @@ -1413,16 +1420,16 @@ \ifdim\pagegoal<\maxdimen \ifdim\pagetotal<\pagegoal % \relax \scratchdimen\pagegoal \advance\scratchdimen-\pagetotal - \ifdim\lastskip<\parskip - \advance\scratchdimen \parskip + \ifdim\lastskip<\parskip + \advance\scratchdimen \parskip \fi \ifsecondargument \advance\scratchdimen#2% \fi - \getrawnoflines\scratchdimen % raw ! - % \message{[\number#1>\number\noflines ?}\wait + \getrawnoflines\scratchdimen % raw ! + % \message{[\number#1>\number\noflines ?}\wait \ifnum#1>\noflines - \column + \column \fi \else \penalty-\!!tenthousand % untested ! ! \column @@ -1432,7 +1439,7 @@ % was: \resetsectionmarks\firstsection, zie \handelpaginaaf -\def\page {\pagebreak} % the short form of \pagebreak (mult-com one) +\def\page {\pagebreak} % the short form of \pagebreak (mult-com one) \def\pagina{\pagebreak} % for the moment, keep this one \def\resetpagebreak @@ -1458,9 +1465,9 @@ {\flushnotes \executepagebreakhandler\v!ja} -\def\complexpagebreak[#1]% if empty, do nothing and avoid processing, - {\flushnotes % see head's; watch how we group - \doifsomething{#1}{\bgroup\executepagebreakhandlers{#1}\egroup}} +\def\complexpagebreak[#1]% if empty, do nothing and avoid processing, + {\flushnotes % see head's; watch how we group + \doifsomething{#1}{\bgroup\executepagebreakhandlers{#1}\egroup}} \def\executepagebreakhandlers#1% {\processcommacommand[#1]\executepagebreakhandler} @@ -1493,13 +1500,13 @@ \installpagebreakhandler \v!ja {\ifpaginageblokkeerd\else \ejectinsert - \gotonextpage - \ifbinnenkolommen % this will move to MUL + \gotonextpage + \ifbinnenkolommen % this will move to MUL \ejectpage % anders soms geen overgang \fi \fi} -\installpagebreakhandler \v!opmaak % ?? +\installpagebreakhandler \v!opmaak % ?? {\ifpaginageblokkeerd\else \eject \fi} @@ -1514,7 +1521,7 @@ \installpagebreakhandler \v!voorkeur {\ifpaginageblokkeerd\else - \ifbinnenkolommen % this will move to MUL + \ifbinnenkolommen % this will move to MUL \dosomebreak\goodbreak \else \testpage[3][\zeropoint]% @@ -1569,7 +1576,7 @@ \doifoddpageelse \donothing{\resetcurrentsectionmarks\ejectdummypage}} -\installpagebreakhandler \v!viertal % not yet ok inside columnsets +\installpagebreakhandler \v!viertal % not yet ok inside columnsets {\ifdubbelzijdig \!!counta\realpageno \!!countb\realpageno @@ -1596,7 +1603,7 @@ \od \filluparrangedpages} -% nb: \executepagebreakhandler\v!hoofd in other ones +% nb: \executepagebreakhandler\v!hoofd in other ones \installpagebreakhandler \v!hoofd {\doifnotvalue{\??tk\v!hoofd\c!status}\v!stop @@ -1609,14 +1616,14 @@ % \definepagebreak % [chapter] % [yes,header,right] -% +% % \setuphead % [chapter] % [page=chapter, % header=empty, % footer=chapter] -% public page handler, beware: definepage already in use (core-ref) +% public page handler, beware: definepage already in use (core-ref) % % \definepagebreak[instance][forsure] % \definepagebreak[forsure][yes,+4] @@ -1634,10 +1641,10 @@ % \setupbackgrounds[state=repeat] % \setupbackgrounds[text][text][background=whatever] % \couplepage[chapter][before={\defineoverlay[whatever][ON]}] -% \setuphead[chapter][before={\pagetype[chapter]}] -% \chapter{First} \page test \chapter{second} \page test +% \setuphead[chapter][before={\pagetype[chapter]}] +% \chapter{First} \page test \chapter{second} \page test -\long\def\installcolumnbreakhandler#1#2#3% #1=otr-id #2=tag +\long\def\installcolumnbreakhandler#1#2#3% #1=otr-id #2=tag {\long\setvalue{\??cn:#1:#2}{#3}} \def\definecolumnbreak @@ -1658,12 +1665,12 @@ {\executecolumnbreakhandler\v!ja} \def\complexcolumnbreak[#1]% if empty, do nothing and avoid processing - {\doifsomething{#1}{\executecolumnbreakhandlers{#1}}} + {\doifsomething{#1}{\executecolumnbreakhandlers{#1}}} \def\executecolumnbreakhandlers#1% {\processcommacommand[#1]\executecolumnbreakhandler} -\def\executecolumnbreakhandler#1% here no commalist +\def\executecolumnbreakhandler#1% here no commalist {\edef\@@columnspecification{#1}% \doifdefinedelse{\??cn:\OTRidentifier:\@@columnspecification} {\getvalue{\??cn:\OTRidentifier:\@@columnspecification}} @@ -1687,12 +1694,12 @@ \let\ignorerestoftext\donothing -\prependtoks % only ignore in a symmetrical doc - \globallet\ignorerestoftext\doignorerestoftext +\prependtoks % only ignore in a symmetrical doc + \globallet\ignorerestoftext\doignorerestoftext \to \everystarttext -\appendtoks - \ignorerestoftext +\appendtoks + \ignorerestoftext \to \everylastshipout \newif\ifgeselecteerd \geselecteerdtrue @@ -1732,11 +1739,11 @@ {\doifsomething\paginasoort {\processcommacommand[\paginasoort]\dodonapagina}} -% Dit wordt eigenlijk nooit en moet worden vervangen door +% Dit wordt eigenlijk nooit en moet worden vervangen door % het meer algemene mechanisme. \def\dosoortpagina[#1]% - {\edef\desoortpagina{#1}% + {\edef\desoortpagina{#1}% \ifx\desoortpagina\empty \else \@EA\doglobal\@EA\addtocommalist\@EA{\desoortpagina}\paginasoort \ifselecteren @@ -1790,19 +1797,19 @@ \od \fi} -\newif\ifregistertextareas +\newif\ifregistertextareas \newif\iftracetextareas \newbox\registertextbox -% \def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box +% \def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box % {\hbox{\box#3}} \def\enabletextarearegistration{\global\registertextareastrue} -\def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box +\def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box {\hbox\bgroup - \ifregistertextareas \ifx\registerMPtextarea\undefined \else + \ifregistertextareas \ifx\registerMPtextarea\undefined \else \setbox\registertextbox\null \wd\registertextbox\wd#3% \ht\registertextbox\ht#3% @@ -1810,11 +1817,11 @@ \ifcase#1\or % 1 \setbox\registertextbox\hbox{\lower\strutdp\box\registertextbox}% \fi - \ifcase#2\or % 1 + \ifcase#2\or % 1 \setbox\registertextbox\hbox{\raise\topskip\hbox{\lower\strutht\box\registertextbox}}% \dp\registertextbox\strutdp \fi - \dp\registertextbox\strutdp % needed + \dp\registertextbox\strutdp % needed %\setbox\registertextbox\hbox % {\iftracetextareas\gray\boxrulewidth2pt\ruledhbox\fi % {\registerMPtextarea{\box\registertextbox}}}% @@ -1822,8 +1829,8 @@ {\registerMPtextarea{\box\registertextbox}}% \smashbox\registertextbox \box\registertextbox - \fi \fi + \fi \fi \box#3% \egroup} -\protect \endinput +\protect \endinput diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex index 3ab1b1d6f..373b65d67 100644 --- a/tex/context/base/page-lay.tex +++ b/tex/context/base/page-lay.tex @@ -440,6 +440,8 @@ {\showmessage\m!systems{10}{##1}}}}% \processcommalist[#1]\docommando} +\ifx\setups\undefined \def\setups[#1]{\setdefaultpenalties} \fi + \def\recalculatelayout {\global\linkermargebreedte \layoutparameter\c!linkermarge \global\rechtermargebreedte\layoutparameter\c!rechtermarge @@ -453,7 +455,7 @@ \global\kopwit \layoutparameter\c!kopwit \setlayoutdimensions % the rest of the `dimensions' \doifelse\@@lygrid\v!ja\gridsnappingtrue\gridsnappingfalse - \synchronizecriteria[\layoutparameter\c!criterium]% see elsewhere + \setups[\layoutparameter\c!setups]% depends on gridsnapping ! \simplesetupwhitespace \simplesetupblank \global\snijwit\layoutparameter\c!snijwit @@ -1193,7 +1195,7 @@ \c!dx=\!!zeropoint, \c!dy=\!!zeropoint, \c!grid=\v!nee, - \c!criterium=\s!default, + \c!setups=\systemsetupsprefix\s!default, \c!clipoffset=\!!zeropoint, \c!regels=0, \c!kolommen=1, diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex index b40e36337..bd76ab558 100644 --- a/tex/context/base/page-lyr.tex +++ b/tex/context/base/page-lyr.tex @@ -2,7 +2,7 @@ %D [ file=page-lyr, %D version=2000.10.20, %D title=\CONTEXT\ Page Macros, -%D subtitle=Layers, +%D subtitle=Layers, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] @@ -11,29 +11,29 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\writestatus{loading}{Context Page Macros / Layers} +\writestatus{loading}{Context Page Macros / Layers} \unprotect -% When being backgrounds layers get the background offset -% displacement. Should be an option, on by default +% When being backgrounds layers get the background offset +% displacement. Should be an option, on by default % (compatibility). %D The layering mechanism implemented here is independent of %D the output routine, but future extensions may depend on a -%D more close cooperation. +%D more close cooperation. %D First we overload a macro from \type {core-rul}. From now on %D we accept a (optional) argument: the specific layer it %D will go in. This means that we can move an overlay from one %D background to the other using the dimensions of the parent. -\ifx\undefined\defineoverlay \message{loaded to early} \wait \fi +\ifx\undefined\defineoverlay \message{loaded to early} \wait \fi \def\defineoverlay {\dotripleempty\dodefineoverlay} -\def\dodefineoverlay[#1][#2][#3]% overlay [layer] content +\def\dodefineoverlay[#1][#2][#3]% overlay [layer] content {\ifthirdargument \writestatus{BEWARE}{This (overlay definition) has changed!}% temp \def\docommando##1% @@ -47,24 +47,24 @@ \fi \processcommalist[#1]\docommando} -%D When tracing is turned on, a couple of boxes will -%D show up as well as the reference point. +%D When tracing is turned on, a couple of boxes will +%D show up as well as the reference point. \newif\iftracelayers % \tracelayerstrue -%D This handy constant saved some string memory. +%D This handy constant saved some string memory. \def\@@layerbox{@@layerbox} -%D \macros +%D \macros %D {definelayer} %D -%D Each layer gets its own (global) box. This also means that -%D the data that goes into a layer, is typeset immediately. -%D Each layer automatically gets an associated overlay, +%D Each layer gets its own (global) box. This also means that +%D the data that goes into a layer, is typeset immediately. +%D Each layer automatically gets an associated overlay, %D which can be used in any background assignment. -% todo : links/rechts +% todo : links/rechts \def\definelayer {\dodoubleargument\dodefinelayer} @@ -77,7 +77,7 @@ \c!x=\!!zeropoint,\c!y=\!!zeropoint,\c!positie=\v!nee, \c!regel=0,\c!kolom=0, \c!breedte=\nextboxwd,\c!hoogte=\nextboxht, - \c!offset=\!!zeropoint,\c!rotatie=, % geen 0 ! + \c!offset=\!!zeropoint,\c!rotatie=, % geen 0 ! \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, \c!plaats=rb,\c!positie=\v!nee,\c!pagina=, \c!methode=\v!overlay, @@ -95,11 +95,11 @@ \resetlayer[#1]% \fi} -%D \macros +%D \macros %D {setuplayer} %D -%D After a layer is defined, you can change its -%D characteristics. +%D After a layer is defined, you can change its +%D characteristics. \def\setuplayer {\dodoubleargument\dosetuplayer} @@ -108,17 +108,17 @@ {\def\docommando##1{\getparameters[\??ll##1][#2]}% \processcommalist[#1]\docommando} -%D \macros +%D \macros %D {setlayer} -%D +%D %D Data is moved into a layer with the following macro. When %D \type {position} is set, relative positioning is used, with %D the current point as reference point. Otherwise the topleft -%D corner is used as reference point. -%D -%D \starttypen -%D \setlayer [identifier] [optional parameters] {data} -%D \stoptypen +%D corner is used as reference point. +%D +%D \starttypen +%D \setlayer [identifier] [optional parameters] {data} +%D \stoptypen \def\currentlayerdata{0} @@ -158,7 +158,7 @@ \let\lastlayerxpos\!!zeropoint \let\lastlayerypos\!!zeropoint -% todo left/right +% todo left/right \def\setlastlayerpos#1% {\edef\layerpage{\MPp{lyr:\currentlayerdata}}% @@ -176,7 +176,7 @@ \def\dodefinelayerpreset[#1][#2]% {\setvalue{\??ll\??ll#1}{\dopresetlayer{#2}}} -\def\dopresetlayer#1#2#3% #1=list #2=tag #3=list +\def\dopresetlayer#1#2#3% #1=list #2=tag #3=list {\getparameters[\??ll#2][#1,#3]} \letempty\currentlayer @@ -187,18 +187,18 @@ \newdimen\layerheight \def\dododosetlayer[#1][#2][#3]% will be sped up - {% we use the global width, never change this + {% we use the global width, never change this \def\currentlayer{#1}% \@@layerxsiz\layerparameter\c!breedte \@@layerysiz\layerparameter\c!hoogte \layerwidth \@@layerxsiz \layerheight\@@layerysiz - % preroll + % preroll \getparameters[\??ll#1][#3]% - % presets and real roll + % presets and real roll \doifdefined{\??ll\??ll\layerparameter\c!preset} {\getvalue{\??ll\??ll\layerparameter\c!preset}{#1}{#3}}% - % that was real slow + % that was real slow \doifvalue{\??ll#1\c!positie}\v!overlay % slow {\getparameters[\??ll#1] [\c!breedte=\zeropoint, @@ -210,14 +210,14 @@ [\c!plaats=\v!hoog, \c!rotatie=\layerparameter\c!rotatie] {\flushnextbox}}}% - % no, not local + % no, not local % \@@layerxsiz\layerparameter\c!breedte - % \@@layerysiz\layerparameter\c!hoogte - % never change that + % \@@layerysiz\layerparameter\c!hoogte + % never change that \@@layerxpos\layerparameter\c!x \@@layerypos\layerparameter\c!y \doifelsevalue{\??ll#1\c!hoffset}\v!max - {\@@layerxoff\@@layerxsiz} + {\@@layerxoff\@@layerxsiz} {\@@layerxoff\layerparameter\c!hoffset}% \doifelsevalue{\??ll#1\c!voffset}\v!max {\@@layeryoff\@@layerysiz} @@ -246,7 +246,7 @@ \advance\scratchcounter\layoutlines \advance\scratchcounter\plusone \setevalue{\??ll#1\c!regel}{\the\scratchcounter}% - \fi + \fi \ifdim\@@layerysiz>\zeropoint \advance\@@layerypos-\@@layerysiz \@@layerypos-\@@layerypos @@ -259,7 +259,7 @@ \advance\scratchcounter \layoutcolumns \advance\scratchcounter \plusone \setevalue{\??ll#1\c!kolom}{\the\scratchcounter}% - \fi + \fi \ifdim\@@layerxsiz>\zeropoint \advance\@@layerxpos-\@@layerxsiz \@@layerxpos-\@@layerxpos @@ -277,11 +277,11 @@ {\edef\layerpage{:\layerpage}% \doifundefined{\@@layerbox#2#1\layerpage} {\global\expandafter\newbox\csname\@@layerbox#2#1\layerpage\endcsname}}% - \dontcomplain % more comfortable + \dontcomplain % more comfortable \global\setbox\csname\@@layerbox#2#1\layerpage\endcsname\vbox - to \layerparameter\c!hoogte % new, otherwise no negative y possible + to \layerparameter\c!hoogte % new, otherwise no negative y possible {\offinterlineskip - \hsize\layerparameter\c!breedte % new, keep box small + \hsize\layerparameter\c!breedte % new, keep box small \ifvoid\csname\@@layerbox#1\layerpage\endcsname\else \ht\csname\@@layerbox#2#1\layerpage\endcsname\zeropoint \dp\csname\@@layerbox#2#1\layerpage\endcsname\zeropoint @@ -297,13 +297,13 @@ \setbox\nextbox\hbox {\alignedbox[\layerparameter\c!plaats]\vbox{\flushnextbox}}% \fi - \ifnum\layerparameter\c!regel=\zerocount\else % no \ifcase, can be negative + \ifnum\layerparameter\c!regel=\zerocount\else % no \ifcase, can be negative \advance\@@layerypos \layerparameter\c!regel\lineheight - \advance\@@layerypos \topskip + \advance\@@layerypos \topskip \advance\@@layerypos-\lineheight \advance\@@layerypos-\nextboxht \fi - \ifnum\layerparameter\c!kolom=\zerocount\else % no \ifcase, can be negative + \ifnum\layerparameter\c!kolom=\zerocount\else % no \ifcase, can be negative \advance\@@layerxpos \layoutcolumnoffset{\layerparameter\c!kolom}% \fi \ifdone @@ -330,15 +330,15 @@ %D not even that complicated. It mainly comes down to skipping %D to the right place and placing a box on top of or below the %D existing content. In the case of position tracking, another -%D reference point is chosen. +%D reference point is chosen. %D \macros -%D {flushlayer} +%D {flushlayer} %D %D When we flush a layer, we flush both the main one and the -%D page dependent one (when defined). This feature is more -%D efficient in \ETEX\ since there testing for an undefined -%D macro does not takes hash space. +%D page dependent one (when defined). This feature is more +%D efficient in \ETEX\ since there testing for an undefined +%D macro does not takes hash space. % \unexpanded\def\flushlayer[#1]% % {\doifnotvalue{\??ll#1\c!status}{\v!stop} @@ -346,12 +346,12 @@ % {\doflushlayer1{#1}{#1}} % {\doflushlayer0{#1}{#1:\realfolio}} % \stopoverlay}} -% +% % \def\doflushlayer#1#2#3% % {\ifundefined{\@@layerbox#3}% % \ifcase#1\else\writestatus{layer}{unknown layer #3}\fi % \else -% \doifvalue{\??ll#2\c!optie}{\v!test} +% \doifvalue{\??ll#2\c!optie}{\v!test} % {\traceboxplacementtrue\tracelayerstrue}% % \iftracelayers \ruledvbox \else \vbox \fi to \overlayheight % {\forgetall @@ -363,7 +363,7 @@ % \doifnotvalue{\??ll#2\c!positie}{\v!ja} % {\doifvalue{\??ll#2\c!status}{\v!herhaal} % {\let\next\copy}}% -% \fi +% \fi % \next\csname\@@layerbox#3\endcsname % \hss}% % \vss}% @@ -372,15 +372,15 @@ \unexpanded\def\flushlayer[#1]% {\doifelsevalue{\??ll#1\c!dubbelzijdig}\v!ja {\doifundefinedelse{\@@layerbox#1}% - {\dodoflushlayerA[#1]} + {\dodoflushlayerA[#1]} {\doifbothsidesoverruled \dodoflushlayerB[#1][\v!links]% left \orsideone - \dodoflushlayerB[#1][\v!rechts]% right + \dodoflushlayerB[#1][\v!rechts]% right \orsidetwo \dodoflushlayerB[#1][\v!links]% left \od}} - {\dodoflushlayerA[#1]}} + {\dodoflushlayerA[#1]}} \def\dodoflushlayerA[#1]% {\doifnotvalue{\??ll#1\c!status}\v!stop @@ -398,7 +398,7 @@ {\dodoflushlayer0{#1}{#2#1:\realfolio}} \stopoverlay}} -% \def\dodoflushlayer#1#2#3% +% \def\dodoflushlayer#1#2#3% % {\ifundefined{\@@layerbox#3}% % \ifcase#1\else\writestatus{layer}{unknown layer #3}\fi % \else @@ -407,8 +407,8 @@ % \doifelsevalue{\??ll#2\c!methode}\v!tekst\donetrue\donefalse % \iftracelayers \ruledvbox \else \vbox \fi \ifdone \else to \overlayheight \fi % {\forgetall -% \hbox \ifdone \else to \overlaywidth \fi -% {% klopt dit? #3 en niet #2 ? +% \hbox \ifdone \else to \overlaywidth \fi +% {% klopt dit? #3 en niet #2 ? % \doifvalue{\??ll#3\realfolio\c!positie}\v!ja % {\xypos{lyr:#3:\realfolio}}% % \let\next\box @@ -416,13 +416,13 @@ % \doifnotvalue{\??ll#2\c!positie}\v!ja % {\doifvalue{\??ll#2\c!status}\v!herhaal % {\let\next\copy}}% -% \fi +% \fi % \next\csname\@@layerbox#3\endcsname % \hss}% % \vss}% % \fi} -\def\dodoflushlayer#1#2#3% +\def\dodoflushlayer#1#2#3% {\ifundefined{\@@layerbox#3}% \ifcase#1\else\writestatus{layer}{unknown layer #3}\fi \else @@ -431,8 +431,8 @@ \doifelsevalue{\??ll#2\c!methode}\v!tekst\donetrue\donefalse \iftracelayers \ruledvbox \else \vbox \fi \ifdone \else to \overlayheight \fi {\forgetall - \hbox \ifdone \else to \overlaywidth \fi - {% klopt dit? #3 en niet #2 ? + \hbox \ifdone \else to \overlaywidth \fi + {% klopt dit? #3 en niet #2 ? \doifvalue{\??ll#3\realfolio\c!positie}\v!ja {\xypos{lyr:#3:\realfolio}}% \let\next\box @@ -440,7 +440,7 @@ \doifnotvalue{\??ll#2\c!positie}\v!ja {\doifvalue{\??ll#2\c!status}\v!herhaal {\let\next\copy}}% - \fi + \fi \doifoverlayelse{#3} {\next\csname\@@layerbox#3\endcsname}% {\startlayoutcomponent{l:#3}{layer #3}% @@ -451,58 +451,65 @@ \fi} %D \macros -%D {composedlayer} +%D {composedlayer,placelayer,tightlayer} %D -%D This is a handy shortcut, which saves a couple of braces -%D when we use it as parameter. This name also suits better -%D to other layering commands. +%D This is a handy shortcut, which saves a couple of braces +%D when we use it as parameter. This name also suits better +%D to other layering commands. \def\composedlayer#1{\flushlayer[#1]} \let\placelayer\flushlayer +\def\tightlayer[#1]% + {\hbox + {\def\currentlayer{#1}% todo: left/right + \hsize\layerparameter\c!breedte + \vsize\layerparameter\c!hoogte + \composedlayer{#1}}} + %D \macros -%D {resetlayer} +%D {resetlayer} %D -%D This macro hardly needs an explanation (and is seldom -%D needed as well). +%D This macro hardly needs an explanation (and is seldom +%D needed as well). \def\doresetlayer#1% - {\ifundefined{\@@layerbox#1}\else + {\ifundefined{\@@layerbox#1}\else \global\setbox\csname\@@layerbox#1\endcsname\emptybox \fi} \def\resetlayer[#1]% {\doresetlayer{#1}% \doifvalue{\??ll#1\c!dubbelzijdig}\v!ja % kind of redundant test - {\doresetlayer{\v!links #1}% - \doresetlayer{\v!rechts#1}}% - \doresetlayer{#1:\realfolio}} + {\doresetlayer{\v!links #1}% + \doresetlayer{\v!rechts#1}}% + \doresetlayer{#1:\realfolio}} %D \macros %D {setMPlayer} -%D -%D The following layer macro uses the positions that are -%D registered by \METAPOST. +%D +%D The following layer macro uses the positions that are +%D registered by \METAPOST. %D %D \starttypen -%D \definelayer[test] -%D +%D \definelayer[test] +%D %D \setMPlayer [test] [somepos-1] {Whatever we want here!} %D \setMPlayer [test] [somepos-2] {Whatever we need there!} %D \setMPlayer [test] [somepos-3] {\externalfigure[cow.mps][width=2cm]} -%D +%D %D \startuseMPgraphic{oeps} -%D draw fullcircle scaled 10cm withcolor red ; -%D register ("somepos-1",2cm,3cm,center currentpicture) ; -%D register ("somepos-2",8cm,5cm,(-1cm,-2cm)) ; -%D register ("somepos-3",0cm,0cm,(-2cm,2cm)) ; +%D draw fullcircle scaled 10cm withcolor red ; +%D register ("somepos-1",2cm,3cm,center currentpicture) ; +%D register ("somepos-2",8cm,5cm,(-1cm,-2cm)) ; +%D register ("somepos-3",0cm,0cm,(-2cm,2cm)) ; %D \stopuseMPgraphic -%D +%D %D \getMLlayer[test]{\useMPgraphic{oeps}} %D \stoptypen -%D -%D The last line is equivalent to +%D +%D The last line is equivalent to %D %D \starttypen %D \framed @@ -530,8 +537,8 @@ \c!kader=\v!uit, \c!offset=\v!overlay,#2]} -% Some day this (old) mechanism will be combined/integrated -% in overlays +% Some day this (old) mechanism will be combined/integrated +% in overlays \newskip\xposition \newskip\yposition \newskip\xdimension \newskip\ydimension @@ -583,7 +590,7 @@ \dodoubleargument\getparameters[\??ps]} \def\calculateposition#1#2#3#4#5#6#7#8#9% - {\setdimensionwithunit\scratchskip{#1}\@@pseenheid + {\setdimensionwithunit\scratchskip{#1}\@@pseenheid \scratchskip#8\scratchskip \scratchskip#9\scratchskip \advance\scratchskip #4\relax @@ -612,7 +619,7 @@ \calculateposition{#4}\@@psystap\yposition \@@psyoffset\scratchdimen\ydimension\yoffset \@@psyschaal\@@psyfactor - \vbox to \zeropoint % kan beter. + \vbox to \zeropoint % kan beter. {\vskip\yposition \hbox to \zeropoint {\hskip\xposition @@ -631,7 +638,7 @@ \resetpositioning -\setuppositioning +\setuppositioning [\c!eenheid=\s!cm, \c!factor=1, \c!schaal=1, @@ -641,4 +648,4 @@ \c!xoffset=\!!zeropoint, \c!yoffset=\!!zeropoint] -\protect \endinput +\protect \endinput diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex index 20c079306..d25def347 100644 --- a/tex/context/base/page-num.tex +++ b/tex/context/base/page-num.tex @@ -2,7 +2,7 @@ %D [ file=page-num, % moved here from main-001 %D version=1997.03.31, %D title=\CONTEXT\ Core Macros, -%D subtitle=Numbering, +%D subtitle=Numbering, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] @@ -13,7 +13,7 @@ \writestatus{loading}{Context Core Macros / Numbering} -\unprotect +\unprotect % \gotonextsubpage : voor de pagebody % \subpaginanummer : alleen in de voet/kopregels @@ -36,15 +36,15 @@ [\s!subpage] [\c!wijze=\@@snwijze] -% hard to sync +% hard to sync % % \def\resetsubpaginanummer% % {\resetnummer[\s!subpage]% % \global\subpageno=\ruwenummer[\s!subpage]} % -% better sync +% better sync -\newif\ifresettingsubpagenumber +\newif\ifresettingsubpagenumber \def\resetsubpaginanummer {\global\resettingsubpagenumbertrue} @@ -58,7 +58,7 @@ \processaction [\@@snstatus] [ \v!stop=>\ifsubpaging - \resetsubpaginanummer % new, see sync + \resetsubpaginanummer % new, see sync \else \subpagingfalse \fi @@ -114,8 +114,8 @@ \def\gotonextsubpage % overlapt behoorlijk met realpage macro {\global\let\checksubpages\relax - \ifresettingsubpagenumber - \resetnummer[\s!subpage]% + \ifresettingsubpagenumber + \resetnummer[\s!subpage]% \global\resettingsubpagenumberfalse \fi \ifsubpaging @@ -258,7 +258,7 @@ \global\let\checkrealpage\relax} \def\savenofpages - {\bgroup + {\bgroup \advance\realpageno \minusone \savecurrentvalue\lastpage\realfolio \advance\userpageno \minusone @@ -303,13 +303,13 @@ \def\stelpaginanummerin {\dosingleargument\dostelpaginanummerin} -% long time used alternative +% long time used alternative % % \def\verlaagpaginanummer % {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen} % {\verlaagnummer[\s!page]% % \setuserpageno{\ruwenummer[\s!page]}}} -% +% % \def\verhoogpaginanummer % {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen} % {\verhoognummer[\s!page]% @@ -342,7 +342,7 @@ \dosynchronizepagenumber} \letvalue{\??pn+\v!handhaaf}\dosynchronizepagenumber -% so far +% so far \def\checkpagecounter% {\checknummer{\s!page}} @@ -506,18 +506,18 @@ {\dodopaginaprefix{#1}% \donexttracklevel{#1}} -\def\paginaprefix#1[#2]% +\def\paginaprefix#1[#2]% {\bgroup \edef\paginatype{#1}% - \edef\postprefix{\@@filternumberpart[#2]}% + \edef\postprefix{\@@filternumberpart[#2]}% \let\donexttrackcommando\dopaginaprefix \donexttrackcommando\firstsection \egroup} -%D It was Marco Kuhlmann who uncovered the missing strut. This -%D was a pretty old bug kind of covered up by the fact that non +%D It was Marco Kuhlmann who uncovered the missing strut. This +%D was a pretty old bug kind of covered up by the fact that non %D oldstyle numbers are about as high as strutheight. Rather -%D interesting that it went unnoticed for so long. +%D interesting that it went unnoticed for so long. \unexpanded\def\@@plaatspaginanummer % called in empty tests {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} @@ -525,7 +525,7 @@ \@@nmcommando{\doattributes\??nm\c!letter\c!kleur {\completepagenumber}}}}} -\def\@@plaatspaginascheider% still used ? +\def\@@plaatspaginascheider% still used ? {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} {\@@nmtekstscheider}} @@ -546,15 +546,15 @@ \donexttracklevel{##1}}% \donexttrackcommando{\firstsection}} -\unexpanded\def\completepagenumber - {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} +\unexpanded\def\completepagenumber + {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} {\@@nmlinks\labeltexts\v!paginanummer{\pageprefixes\pagenumber}\@@nmrechts}} \unexpanded\def\placepagenumber {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} {\labeltexts\v!paginanummer{\pagenumber}}} -% Nog een variant; wat is een goeie naam? +% Nog een variant; wat is een goeie naam? % \unexpanded\def\placexxpagenumber % {\@@plaatspaginanummer} @@ -563,8 +563,12 @@ \def\translatednumber{\@@filterpagepart} +% \unexpanded\def\referencepagenumber[#1]% +% {\doifelsenothing{#1}{?}{\paginaprefix\??rf[#1]\translatednumber[#1]}} + \unexpanded\def\referencepagenumber[#1]% - {\doifelsenothing{#1}{?}{\paginaprefix\??rf[#1]\translatednumber[#1]}} + {\doifelsenothing{#1}{?}% \prepare had got lost + {\preparepaginaprefix\??rf\paginaprefix\??rf[#1]\translatednumber[#1]}} \stelpaginanummerin [\c!status=\v!start, @@ -574,4 +578,4 @@ [\c!wijze=\v!per\v!deel, \c!status=\v!stop] -\protect \endinput +\protect \endinput diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex index 38f633437..f236a411e 100644 --- a/tex/context/base/page-one.tex +++ b/tex/context/base/page-one.tex @@ -342,11 +342,22 @@ \global\botinserted\zeropoint \OTRONEdosetbotinserts \fi} +% \def\OTRONEdotopinsertions +% {\ifvoid\topins\else +% \ifgridsnapping +% \box\topins % not \topsnaptogrid{\box\topins}% +% \else +% \unvbox\topins +% \fi +% \fi +% \global\topinserted\zeropoint} + \def\OTRONEdotopinsertions {\ifvoid\topins\else \ifgridsnapping - \box\topins % not \topsnaptogrid{\box\topins}% - \else + \box\topins + \vskip-\topskip \vskip\strutheight % [xx] new: see icare topbleed + \else \unvbox\topins \fi \fi @@ -545,6 +556,27 @@ \goodbreak}% \doinsertfloatinfo} +% \def\OTRONEsometopsfloat[#1]% +% {\ifdim\topinserted=\zeropoint +% \topofinserttrue +% \else +% \topofinsertfalse +% \fi +% \global\advance\topinserted \ht\floatbox +% \global\advance\topinserted \dp\floatbox +% \global\advance\topinserted \floatbottomskip +% \insert\topins +% {\forgetall +% \iftopofinsert +% \kern-\lineskip\par\prevdepth\maxdimen +% \else +% %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back +% \betweenfloatblanko +% \fi +% \flushfloatbox +% \blanko[\@@bknawit]}% +% \doinsertfloatinfo} + \def\OTRONEsometopsfloat[#1]% {\ifdim\topinserted=\zeropoint \topofinserttrue @@ -557,6 +589,7 @@ \insert\topins {\forgetall \iftopofinsert + \topskipcorrection % [xx] new: see icare topbleed \kern-\lineskip\par\prevdepth\maxdimen \else %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex index abe6331e7..518da3132 100644 --- a/tex/context/base/page-set.tex +++ b/tex/context/base/page-set.tex @@ -2507,7 +2507,13 @@ {\endgraf % else rubish output if forgotten \vskip \zeropoint % make sure otr is done, otherwise last line problems \bgroup -\forgetall + \forgetall + \ifnum\columnsetlevel>\zerocount\else + % of course we needed a one-column fall back for tm + \columnsetspanhsize\hsize + \nofcolumns\plusone + \mofcolumns\plusone + \fi \setupframedtexts[cs:#1] [\c!breedte=\columnsetspanhsize, \c!regelcorrectie=\v!uit, @@ -2530,19 +2536,23 @@ \setbox\scratchbox\vbox\bgroup \dostartframedtext[cs:#1][\v!geen]% geen nils placement \vskip-\struttotal\par\verticalstrut\par - \framedtextparameter{cs:#1}\c!voor + \ifnum\columnsetlevel>\zerocount + \framedtextparameter{cs:#1}\c!voor + \fi \def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}} -% \chardef\columnslotlocation2 - \def\dostopcolumnsetspan#1% {\par \verticalstrut \kern-2\struttotal \verticalstrut - \doifsomething{\framedtextparameter{cs:#1}\c!na} - {\framedtextparameter{cs:#1}\c!na - \kern\zeropoint}% otherwise blanks disappear, better be a switch + \ifnum\columnsetlevel>\zerocount + \doifsomething{\framedtextparameter{cs:#1}\c!na} + {\framedtextparameter{cs:#1}\c!na + \kern\zeropoint}% otherwise blanks disappear, better be a switch + \else + \endgraf + \fi \dostopframedtext \egroup % frozen keeps grid snapping okay @@ -2562,7 +2572,7 @@ % \ifinsidefloat \box\scratchbox - \else + \else\ifnum\columnsetlevel>\zerocount % we only set \columnsetspacing when asked for, else bottom problems % don't change this any more (test naw) \chardef\columnslotspacing\framedtextparameter{cs:#1}\c!nregels\relax @@ -2574,7 +2584,16 @@ \OTRSETstoreincolumnslot\floatmethod\scratchbox % watch out: no \dochecknextindentation{tag} \checknextindentation[\framedtextparameter{cs:#1}\c!springvolgendein] - \fi + \else + % of course we needed a one-column fall back for tm; brrr, the box has now too + % much height (try \ruledvbox); don't change this without testing techniek + \scratchdimen\ht\scratchbox + \advance\scratchdimen-\strutdp + \ht\scratchbox\scratchdimen + \framedtextparameter{cs:#1}\c!voor + \snaptogrid\vbox{\box\scratchbox}% + \framedtextparameter{cs:#1}\c!na + \fi\fi \egroup \endgraf} @@ -2588,4 +2607,4 @@ % \startcolumnsetspan[two] \input tufte \stopcolumnsetspan % \stopcolumnset -\protect \endinput +\protect \endinput
\ No newline at end of file diff --git a/tex/context/base/s-pre-09.tex b/tex/context/base/s-pre-09.tex index 78e26ca95..cba452973 100644 --- a/tex/context/base/s-pre-09.tex +++ b/tex/context/base/s-pre-09.tex @@ -11,21 +11,21 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D I made this style when I had to give a presentation on -%D the \MAPS\ bibliography production for several user group -%D meetings. This style is rather tuned for combinations of -%D examples and explanations. The colors match the \MAPS\ -%D bibliography colors. +%D I made this style when I had to give a presentation on +%D the \MAPS\ bibliography production for several user group +%D meetings. This style is rather tuned for combinations of +%D examples and explanations. The colors match the \MAPS\ +%D bibliography colors. \startmode[asintended] \setupbodyfont[lbr] \stopmode \setupbodyfont[14.4pt] -%D A couple of years later, in 2001 this style was documented -%D and made public. While documenting, I also changed box -%D building on top of overlays into the now available layer -%D positioning. So, this styles demonstrates quite some -%D tricks. +%D A couple of years later, in 2001 this style was documented +%D and made public. While documenting, I also changed box +%D building on top of overlays into the now available layer +%D positioning. So, this styles demonstrates quite some +%D tricks. \setuppapersize [S6][S6] @@ -40,41 +40,41 @@ %D Local environments can be set by using the setups commands. %D For downward compatibility, we keep supporting the \type -%D {\...Settings} hooks. Using local environments is seldom -%D needed. +%D {\...Settings} hooks. Using local environments is seldom +%D needed. \let\TextSettings \empty \let\SampleSettings\empty -\startsetups text \TextSettings \stopsetups -\startsetups sample \SampleSettings \stopsetups +\startsetups [text] \TextSettings \stopsetups +\startsetups [sample] \SampleSettings \stopsetups -%D The dimensions are kind of fixed. +%D The dimensions are kind of fixed. \def\FrameWidth {448pt} \def\FrameHeight {348pt} \def\FrameOffset {24pt} \def\FrameSkip {12pt} -%D But they {\em can} and {\em will} be changed. +%D But they {\em can} and {\em will} be changed. \def\FrameWidth {408pt} \def\FrameHeight {318pt} -%D The funny values come from the $3:4$ display aspect +%D The funny values come from the $3:4$ display aspect %D ratio. \setupcolors [state=start] -\definecolor[PageColor] [s=.40] -\definecolor[TextColor] [s=.90] -\definecolor[InteractionColor][r=.40] -\definecolor[LineColor] [r=.60,g=.60] +\definecolor[PageColor] [s=.40] +\definecolor[TextColor] [s=.90] +\definecolor[InteractionColor][r=.40] +\definecolor[LineColor] [r=.60,g=.60] -%D Of course we go interactive and since we will probably -%D open other documents, we make sure that the viewer opens a -%D new window. +%D Of course we go interactive and since we will probably +%D open other documents, we make sure that the viewer opens a +%D new window. \setupinteraction [color=InteractionColor, @@ -85,31 +85,31 @@ \setupinteractionscreen [option=max] -%D Before we come to the real macros, we do a little bit of -%D tuning. +%D Before we come to the real macros, we do a little bit of +%D tuning. \setupitemize - [1][packed] + [1][packed] \setuptyping [blank=medium] -%D Apart from the titlepage, the page gets a simple colored -%D background. Later we will activate the background. +%D Apart from the titlepage, the page gets a simple colored +%D background. Later we will activate the background. \setupbackgrounds [page] [backgroundcolor=PageColor] -%D Everything gets frames by a nice \METAPOST\ frame. +%D Everything gets frames by a nice \METAPOST\ frame. \defineoverlay [background] [\uniqueMPgraphic{background}] \startuniqueMPgraphic{background} - path p ; color c, w, d ; - c := \MPcolor{PageColor} ; - w := \MPcolor{TextColor} ; - d := \MPcolor{LineColor} ; + path p ; color c, w, d ; + c := \MPcolor{PageColor} ; + w := \MPcolor{TextColor} ; + d := \MPcolor{LineColor} ; p := unitsquare xscaled OverlayWidth yscaled OverlayHeight ; pickup pencircle scaled (1.5*\FrameSkip) ; draw p withcolor c ; @@ -118,17 +118,17 @@ draw p withcolor d ; \stopuniqueMPgraphic -%D We will present samples and explanation pair||wise, so -%D we need a hyperlink that skips a page. +%D We will present samples and explanation pair||wise, so +%D we need a hyperlink that skips a page. \defineoverlay [nextpage] [\overlaybutton{nextpage}] \defineoverlay [previouspage] [\overlaybutton{previouspage}] \defineoverlay [skippage] [\overlaybutton{page(+2)}] -%D Layers are normally used to position multiple content on -%D a specific overlay. Here we will use them to position +%D Layers are normally used to position multiple content on +%D a specific overlay. Here we will use them to position %D only and since the samples and text will swap place, we -%D will use quite a few layers. +%D will use quite a few layers. \defineoverlay [text] [\composedlayer{text}] \defineoverlay [sample] [\composedlayer{sample}] @@ -136,43 +136,43 @@ %D There are three positions. When combined, the sample and %D text windows overlap, otherwise the lone window is -%D centered. We could have used one layer and reversed the -%D order by setting the \type {direction} parameter, but -%D this approach is more readable. +%D centered. We could have used one layer and reversed the +%D order by setting the \type {direction} parameter, but +%D this approach is more readable. \definelayer - [text] + [text] [x=\makeupwidth,y=\makeupheight,location=lt, hoffset=-\FrameSkip,voffset=-\FrameSkip] \definelayer - [sample] + [sample] [hoffset=\FrameSkip,voffset=\FrameSkip] \definelayer - [common] - [x=.5\makeupwidth,y=.5\makeupheight,location=c] + [common] + [x=.5\makeupwidth,y=.5\makeupheight,location=c] %D The topic is put in the lower right corner of the text -%D window. +%D window. \defineoverlay [topic] [\composedlayer{topic}] \definelayer - [topic] + [topic] [x=\FrameWidth,y=\FrameHeight,location=lt, hoffset=-\FrameOffset,voffset=-\FrameSkip] -%D The topic is put in a framed box. That way we can make -%D sure that it gets a background, which looks better when -%D it covers something else. Otherwise we could have stuct +%D The topic is put in a framed box. That way we can make +%D sure that it gets a background, which looks better when +%D it covers something else. Otherwise we could have stuct %D to: -%D +%D %D \starttypen %D \def\Topic#1% %D {\setlayer[topic]{\color[PageColor]{\bfb\setstrut#1}}} %D \stoptypen -%D +%D %D But, we go for the nice alternative: \def\Topic#1% @@ -184,10 +184,10 @@ background=color,backgroundcolor=TextColor] {#1}}}} -%D The sample as well as the explanation will be collected in -%D a buffer. That way we can reuse the content. We could +%D The sample as well as the explanation will be collected in +%D a buffer. That way we can reuse the content. We could %D have used a box instead, but can we be sure that the content -%D is not adapting itself? So, buffers we use. +%D is not adapting itself? So, buffers we use. \resetbuffer[sample] \resetbuffer[text] @@ -200,9 +200,9 @@ frame=off,align=normal,strut=no,before=,after=, background={background,nextpage}] -%D We safe some keying in by combining things in one macro. +%D We safe some keying in by combining things in one macro. -\def\DoSampleText#1#2#3% kind layer overlays +\def\DoSampleText#1#2#3% kind layer overlays {\setupframedtexts[SampleText][background={background,#3}] \setlayer[#2] {\startSampleText[none] @@ -217,24 +217,24 @@ \def\StopSample {\startstandardmakeup - \DoSampleText{sample}{common}{nextpage} + \DoSampleText{sample}{common}{nextpage} \stopstandardmakeup \resetbuffer[sample]} \def\StopText {\startstandardmakeup - \DoSampleText{text}{common}{topic,nextpage} + \DoSampleText{text}{common}{topic,nextpage} \stopstandardmakeup \resetbuffer[text]} \setupbackgrounds[page][background={color,nextpage}] \setupbackgrounds[text][background=common] -%D When we combine sample and text, we get slightly -%D different definitions. As you can see we generate two -%D pages. Watch how we manipulate the order of the -%D overlays and teh nature of the buttons. Here data -%D abstraction really pays off. +%D When we combine sample and text, we get slightly +%D different definitions. As you can see we generate two +%D pages. Watch how we manipulate the order of the +%D overlays and teh nature of the buttons. Here data +%D abstraction really pays off. \def\StartIdea {\bgroup @@ -245,68 +245,68 @@ {\setupbackgrounds[page][background={color,skippage}] \setupbackgrounds[text][background={text,sample}] \startstandardmakeup - \DoSampleText{sample}{sample}{previouspage} + \DoSampleText{sample}{sample}{previouspage} \DoSampleText{text} {text} {topic,nextpage} \stopstandardmakeup \setupbackgrounds[page][background={color,nextpage}] \setupbackgrounds[text][background={sample,text}] \startstandardmakeup \DoSampleText{sample}{sample}{previouspage} - \DoSampleText{text} {text} {topic,nextpage} + \DoSampleText{text} {text} {topic,nextpage} \stopstandardmakeup \egroup} %D The rest of the definitions takes care of the title page. -%D Please don't steal this one for your own documents. - -\defineoverlay[joke] [\useMPgraphic{joke}{n=0}] % not to be changed! +%D Please don't steal this one for your own documents. + +\defineoverlay[joke] [\useMPgraphic{joke}{n=0}] % not to be changed! \startuseMPgraphic{joke}{n} StartPage ; - path p, q ; numeric w ; pair xy ; + path p, q ; numeric w ; pair xy ; set_grid(OverlayWidth,OverlayHeight,OverlayWidth/8,OverlayHeight/8) ; - if \MPvar{n}=1 : - p := fulldiamond ; fill Page withcolor \MPcolor{TextColor} ; + if \MPvar{n}=1 : + p := fulldiamond ; fill Page withcolor \MPcolor{TextColor} ; else : - p := fullsquare ; fill Page withcolor \MPcolor{PageColor} ; - fi ; - forever : + p := fullsquare ; fill Page withcolor \MPcolor{PageColor} ; + fi ; + forever : xy := center Page randomized (OverlayWidth,OverlayHeight) ; - if new_on_grid(xpart xy, ypart xy) : - q := (p xyscaled (OverlayWidth/5,OverlayHeight/5)) - randomized (\FrameSkip,\FrameSkip) - shifted xy ; + if new_on_grid(xpart xy, ypart xy) : + q := (p xyscaled (OverlayWidth/5,OverlayHeight/5)) + randomized (\FrameSkip,\FrameSkip) + shifted xy ; w := (\FrameSkip) randomized (\FrameSkip/2) ; - draw q withcolor \MPcolor{PageColor} withpen pencircle scaled (1.5w) ; - fill q withcolor \MPcolor{TextColor} ; - draw q withcolor \MPcolor{LineColor} withpen pencircle scaled ( w) ; - fi ; + draw q withcolor \MPcolor{PageColor} withpen pencircle scaled (1.5w) ; + fill q withcolor \MPcolor{TextColor} ; + draw q withcolor \MPcolor{LineColor} withpen pencircle scaled ( w) ; + fi ; exitif grid_full ; - endfor ; + endfor ; StopPage ; \stopuseMPgraphic \defineoverlay[fuzzy][\useMPgraphic{fuzzy}] \startuseMPgraphic{fuzzy} - path p ; numeric w ; - p := (fullsquare xyscaled (OverlayWidth,OverlayHeight)) - randomized (\FrameSkip,\FrameSkip) ; + path p ; numeric w ; + p := (fullsquare xyscaled (OverlayWidth,OverlayHeight)) + randomized (\FrameSkip,\FrameSkip) ; w := (\FrameSkip) randomized (\FrameSkip/2) ; - draw p withcolor \MPcolor{PageColor} withpen pencircle scaled (1.5w) ; - fill p withcolor \MPcolor{TextColor} ; - draw p withcolor \MPcolor{LineColor} withpen pencircle scaled ( w) ; + draw p withcolor \MPcolor{PageColor} withpen pencircle scaled (1.5w) ; + fill p withcolor \MPcolor{TextColor} ; + draw p withcolor \MPcolor{LineColor} withpen pencircle scaled ( w) ; \stopuseMPgraphic -%D This time we use a fit window, but with a slightly randomized -%D frame, our trademark so to say. +%D This time we use a fit window, but with a slightly randomized +%D frame, our trademark so to say. \def\StartTitlePage {\bgroup \setupbackgrounds[page][background={joke,nextpage}] \startstandardmakeup \switchtobodyfont[big] - \setupframedtexts + \setupframedtexts [SampleText] [background=fuzzy, foregroundcolor=PageColor, @@ -325,56 +325,56 @@ \def\TitlePage#1% {\StartTitlePage#1\StopTitlePage} -%D Let's nill some error prone presentation macros. +%D Let's nill some error prone presentation macros. \let\Subject \Topic \let\Topics \gobbleoneargument \let\Subjects \relax -%D We will avoid \citeer {overfull} messages. +%D We will avoid \citeer {overfull} messages. -\dontcomplain +\dontcomplain \doifnotmode{demo}{\endinput} -%D The (rather silly) demo section. +%D The (rather silly) demo section. -\starttext +\starttext \setupbodyfont[12pt] \TitlePage{Quotes, Quotes\\and more quotes} \StartIdea - \StartSample - \input knuth \par + \StartSample + \input knuth \par \StopSample - \StartText + \StartText \Topic{Tufte} - \input tufte \par + \input tufte \par \StopText \StopIdea \StartIdea - \StartSample - \input materie \par + \StartSample + \input materie \par \StopSample - \StartText - \input reich \par + \StartText + \input reich \par \StopText \StopIdea -\StartText - \input tufte \par +\StartText + \input tufte \par \StopText \StartIdea - \StartSample - \input knuth \par + \StartSample + \input knuth \par \StopSample - \StartText - \input tufte \par + \StartText + \input tufte \par \StopText \StopIdea -\stoptext +\stoptext diff --git a/tex/context/base/s-pre-10.tex b/tex/context/base/s-pre-10.tex index 1320e3bc6..67a867ec7 100644 --- a/tex/context/base/s-pre-10.tex +++ b/tex/context/base/s-pre-10.tex @@ -63,7 +63,7 @@ %D Because we build up the text window step by step, we will %D separate the entries by white space. -\startsetups always +\startsetups [always] \setupwhitespace[big] \setupblank[big] \stopsetups @@ -110,7 +110,7 @@ %D addition of subtexts (each subtext goes into its own %D buffer). -\def\DoSampleText#1#2#3% +\def\DoSampleText#1#2#3% {\setupframedtexts[SampleText][background={background,#3}] \bgroup \setups[#1]% @@ -126,8 +126,8 @@ \egroup} %D Since we are no longer swapping windows, we end up with a -%D much simplier \type {\Stopidea} macro. We don't reset -%D samples at the inner level. +%D much simplier \type {\Stopidea} macro. We don't reset +%D samples at the inner level. \def\StartIdea% {\bgroup @@ -149,7 +149,7 @@ %D within a sequence. \def\SetTextWidth - {\ifnum\TextN<1 % yes or no, may change + {\ifnum\TextN<1 % yes or no, may change \scratchdimen=\makeupwidth \advance\scratchdimen by -\SampleTextWidth \advance\scratchdimen by \FrameSkip @@ -166,8 +166,8 @@ \doifnotmode{demo}{\endinput} -%D The demo section. The original presentation uses proper -%D graphics and has better spacing. +%D The demo section. The original presentation uses proper +%D graphics and has better spacing. \def\SomeSymbol#1#2{\definedfont[ContextNavigation at #1]\char#2} @@ -287,20 +287,20 @@ \StopIdea \StartIdea - \StartSample + \StartSample \SomeSymbol{6cm}{3} \StopSample - \StartSubText + \StartSubText \unknown\ and yet another for first \unknown \StopSubText \StopIdea \StartIdea - \StartSample - \SomeSymbol{6cm}{4} + \StartSample + \SomeSymbol{6cm}{4} \StopSample - \StartSubText - \unknown\ and of course for last. + \StartSubText + \unknown\ and of course for last. \StopSubText \StopIdea diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex index 6c51a94d8..777c99454 100644 --- a/tex/context/base/supp-lan.tex +++ b/tex/context/base/supp-lan.tex @@ -12,7 +12,7 @@ %C details. %D This module needs a drastic update: can be made simplier -%D and faster; code can move to core module. +%D and faster; code can move to core module. %D Also, commenting the previous versions code will clear up %D some memory. @@ -791,9 +791,9 @@ {\convertargument#1\to\ascii \setvalue{\@tmd@\ascii}} -\definetextmodediscretionary {} % empty case, also handled in parser +\definetextmodediscretionary {} % empty case, also handled in parser {\prewordbreak\compoundhyphen\allowbreak\postwordbreak} - + \definetextmodediscretionary = {\prewordbreak\textmodediscretionary} @@ -829,14 +829,14 @@ \definetextmodediscretionary > {\endofsubsentencespacing\prewordbreak\endofsubsentence} -\definetextmodediscretionary . % not yet definitive +\definetextmodediscretionary . % not yet definitive {\prewordbreak\midsentence\prewordbreak} \definetextmodediscretionary ^ {\prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}% \allowbreak\postwordbreak} -\definetextmodediscretionary : +\definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:} %\space\aftergroup\ignorespaces} @@ -869,10 +869,10 @@ %D Done somewhere else: \type {\enableactivediscretionaries}. -%D \macros +%D \macros %D {directdiscretionary} %D -%D In those situations where the nature of characters is +%D In those situations where the nature of characters is %D less predictable, we can use the more direct approach: \def\directdiscretionary#1% @@ -978,6 +978,12 @@ \def\restorecompoundcharacter#1% new {\catcode`#1=\csname\@nn@\string#1\endcsname\relax} +%D We can also ignore definitions (needed in for instance \XML). Beware, +%D this macro is supposed to be used grouped! + +\def\ignorecompoundcharacter + {\def\installcompoundcharacter##1 ##2{}} + %D In handling the compound characters we have to take care of %D \type{\bgroup} and \type{\egroup} tokens, so we end up with %D a multi||step interpretation macro. We look ahead for a @@ -1390,13 +1396,13 @@ % % {\hsize1cm\hyphenatedstring{ABXXXXXXXXXXC-12345-12345}} -%D \macros +%D \macros %D {disablediscretionaries,disablecompoundcharacter} -%D -%D Occasionally we need to disable this mechanism. For the -%D moment we assume that \type {|} is used. +%D +%D Occasionally we need to disable this mechanism. For the +%D moment we assume that \type {|} is used. -\def\disablediscretionaries +\def\disablediscretionaries {\def|##1|{\string##1}% \def\directdiscretionary##1{\string##1}} diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex index 8970025e5..14c5beccc 100644 --- a/tex/context/base/syst-ext.tex +++ b/tex/context/base/syst-ext.tex @@ -8,8 +8,8 @@ %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. \writestatus{loading}{Context System Macro's / Extras} @@ -18,7 +18,7 @@ \unprotect -%D \macros +%D \macros %D {rawgetparameters} %D %D A raw and dirty alternative for \type {\getparameters}; no @@ -43,8 +43,8 @@ %D specified \type {\doglobal} action. The last and often only %D global assignment in a macro is done with %D \type {\dodoglobal}, but all preceding ones with -%D \type {\redoglobal}. When using only alternatives, one can -%D reset this mechanism with \type {\resetglobal}. +%D \type {\redoglobal}. When using only alternatives, one can +%D reset this mechanism with \type {\resetglobal}. \def\doglobal {\let\redoglobal\global @@ -56,7 +56,7 @@ \resetglobal -%D New: +%D New: \def\doglobal {\ifx\redoglobal\relax @@ -69,46 +69,46 @@ \def\@@dodoglobal {\resetglobal\global} -\def\saveglobal - {\let\@@dodoglobal\dodoglobal - \let\@@redoglobal\redoglobal} - -\def\restoreglobal - {\let\redoglobal\@@redoglobal - \let\dodoglobal\@@dodoglobal} - -%D A very useful application of this macro is \type {\newif}, -%D \TEX's fake boolean type. Not being a primitive, -%D \type {\global} hopelessly fails here. But a slight -%D adaption of Knuth's original macro permits: -%D +\def\saveglobal + {\let\@@dodoglobal\dodoglobal + \let\@@redoglobal\redoglobal} + +\def\restoreglobal + {\let\redoglobal\@@redoglobal + \let\dodoglobal\@@dodoglobal} + +%D A very useful application of this macro is \type {\newif}, +%D \TEX's fake boolean type. Not being a primitive, +%D \type {\global} hopelessly fails here. But a slight +%D adaption of Knuth's original macro permits: +%D %D \starttypen %D \doglobal\newif\iftest %D \stoptypen -%D +%D %D Of course one can still say: %D %D \starttypen -%D \global\testtrue +%D \global\testtrue %D \global\testfalse %D \stoptypen %D -%D Apart from the prefixes, a few more \type{\expandafters} +%D Apart from the prefixes, a few more \type{\expandafters} %D are needed: \def\newif#1% - {\count@\escapechar + {\count@\escapechar \escapechar\m@ne \expandafter\expandafter\expandafter \redoglobal\expandafter\expandafter\expandafter \edef\@if#1{true}{\let\noexpand#1\noexpand\iftrue}% \expandafter\expandafter\expandafter - \redoglobal\expandafter\expandafter\expandafter + \redoglobal\expandafter\expandafter\expandafter \edef\@if#1{false}{\let\noexpand#1\noexpand\iffalse}% \dodoglobal\@if#1{false}% - \escapechar\count@} + \escapechar\count@} -%D Also new: +%D Also new: \def\define#1% {\ifx#1\undefined @@ -178,7 +178,7 @@ %D \stoptypen %D %D In the first test, \TEX\ continues it's search for the -%D second number after reading \type{\pseudocounter}, while +%D second number after reading \type{\pseudocounter}, while %D in the second test, it stops reading after having %D encountered a real one. Tests like the first one therefore %D can give unexpected results, for instance execution @@ -201,27 +201,27 @@ % \scratchcounter=\incrementsign\scratchcounter % \advance\scratchcounter #1\relax % \dodoglobal\edef#1{\the\scratchcounter}} -% +% % \def\dododoincrement#1% % {\dodododoincrement(#1,1)} -% +% % \def\dodoincrement(#1% % {\doifnextcharelse,% % {\dodododoincrement(#1}{\dodododoincrement(#1,1}} -% +% % \def\doincrement#1% % {\def\incrementsign{#1}% % \doifnextcharelse(\dodoincrement\dododoincrement} -% +% % \def\increment{\doincrement+} % \def\decrement{\doincrement-} -% +% % And this is the one optimized for speed: -% maxcounter = 2\maxdimen=1 +% maxcounter = 2\maxdimen=1 -\def\!!zerocount {0} % alongside \zerocount -\def\!!minusone {-1} % alongside \minusone +\def\!!zerocount {0} % alongside \zerocount +\def\!!minusone {-1} % alongside \minusone \def\!!plusone {1} % alongside \plusone \beginTEX @@ -254,7 +254,7 @@ \fastincrement#1% \fi\fi} -\def\dodecrement#1% 10% faster alternative +\def\dodecrement#1% 10% faster alternative {\ifx#1\undefined %\dodoglobal\edef#1{-1}% \dodoglobal\let#1\!!minusone @@ -310,16 +310,16 @@ %D that signals the next macro that something just happened. %D This macro can take any action depending on the previous %D signal. Signals must be unique and the next macro takes care -%D of that. +%D of that. %D %D \starttypen %D \newsignal\somesignal %D \stoptypen %D -%D Signals old dimensions and can be used in skips, kerns and -%D tests like \type{\ifdim}. +%D Signals old dimensions and can be used in skips, kerns and +%D tests like \type{\ifdim}. -\newdimen\maximumsignal % step is about 0.00025pt +\newdimen\maximumsignal % step is about 0.00025pt \def\newsignal#1% {\ifx#1\undefined @@ -329,22 +329,22 @@ %D \macros %D {newskimen} -%D +%D %D \TEX\ offers 256 \DIMENSIONS\ and \SKIPS. Unfortunately this %D amount is too small to suit certain packages. Therefore when -%D possible one should use: -%D +%D possible one should use: +%D %D \starttypen %D \newskimen\tempskimen %D \stoptypen -%D +%D %D This commands allocates a \DIMENSION\ or a \SKIP, depending %D on the availability. One should be aware of the difference %D between both. When searching for some glue \TEX\ goes on %D searching till it's sure that no other glue component if %D found. This search can be canceled by using \type{\relax} -%D when possible and needed. -%D +%D when possible and needed. +%D %D \starttypen %D \def\newskimen#1% %D {\ifx#1\undefined @@ -353,12 +353,12 @@ %D \else %D \newdimen#1\relax %D \fi -%D \fi} +%D \fi} %D \stoptypen -%D -%D In order to make this macro work in plain \TEX\ too, we -%D use the following alternative, which fools \TEX\ about -%D the new commands being \type {\outer} ones. +%D +%D In order to make this macro work in plain \TEX\ too, we +%D use the following alternative, which fools \TEX\ about +%D the new commands being \type {\outer} ones. \def\newskimen#1% {\ifx#1\undefined @@ -369,13 +369,13 @@ %D {strippedcsname} %D %D The next macro can be very useful when using \type{\csname} -%D like in: +%D like in: %D %D \starttypen %D \csname if\strippedcsname\something\endcsname %D \stoptypen %D -%D This expands to \type{\ifsomething}. +%D This expands to \type{\ifsomething}. \def\strippedcsname {\expandafter\gobbleoneargument\string} @@ -383,51 +383,51 @@ %D \macros %D {savenormalmeaning} %D -%D We will use this one in: +%D We will use this one in: \def\savenormalmeaning#1% {\ifundefined{normal\strippedcsname#1}% - \letvalue{normal\strippedcsname#1}#1% + \letvalue{normal\strippedcsname#1}#1% \fi} %D \macros -%D {newconditional, -%D settrue, setfalse, +%D {newconditional, +%D settrue, setfalse, %D ifconditional} -%D -%D \TEX's lacks boolean variables, although the \PLAIN\ format -%D implements \type{\newif}. The main disadvantage of this -%D scheme is that it takes three hash table entries. A more -%D memory saving alternative is presented here. A conditional -%D is defined by: -%D +%D +%D \TEX's lacks boolean variables, although the \PLAIN\ format +%D implements \type{\newif}. The main disadvantage of this +%D scheme is that it takes three hash table entries. A more +%D memory saving alternative is presented here. A conditional +%D is defined by: +%D %D \starttypen %D \newconditional\doublesided %D \setfalse -%D -%D Setting a conditional is done by \type{\settrue} and -%D \type{\setfalse}: -%D +%D +%D Setting a conditional is done by \type{\settrue} and +%D \type{\setfalse}: +%D %D \starttypen %D \settrue\doublesided %D \setfalse -%D -%D while testing is accomplished by: -%D +%D +%D while testing is accomplished by: +%D %D \starttypen %D \ifconditional\doublesided ... \else ... \fi %D \setfalse -%D -%D We cannot use the simple scheme: +%D +%D We cannot use the simple scheme: %D %D \starttypen %D \def\settrue#1{\let#1=\iftrue} %D \def\settrue#1{\let#1=\iffalse} %D \stoptypen %D -%D Such an implementation gives problems with nested -%D conditionals. The next implementation is abaou as fast -%D and just as straightforward: +%D Such an implementation gives problems with nested +%D conditionals. The next implementation is abaou as fast +%D and just as straightforward: \def\settrue #1{\chardef#1\zerocount} \def\setfalse#1{\chardef#1\plusone} @@ -437,13 +437,13 @@ %D \macros %D {ifzeropt} -%D -%D The next macro is both cosmetic and byte saving. It is -%D pretty \type{\if}||safe too. It can be used in cases +%D +%D The next macro is both cosmetic and byte saving. It is +%D pretty \type{\if}||safe too. It can be used in cases %D like: %D -%D \starttypen -%D \ifzeropt \somedimen ... \else ... \fi +%D \starttypen +%D \ifzeropt \somedimen ... \else ... \fi %D \stoptypen \let\ifzeropt\ifcase @@ -453,11 +453,11 @@ %D dostepwiserecurse, %D for} %D -%D \TEX\ does not offer us powerfull for||loop mechanisms. On +%D \TEX\ does not offer us powerfull for||loop mechanisms. On %D the other hand its recursion engine is quite unique. We %D therefore identify the for||looping macros by this method. %D The most simple alternative is the one that only needs a -%D number. +%D number. %D %D \starttypen %D \dorecurse {n} {whatever we want} @@ -486,10 +486,10 @@ %D \type{\recurselevel} concern the outer loop, while the third %D and fifth one concern the inner loop. The depth of the %D nesting is available for inspection in \type{\recursedepth}. -%D -%D Both \type{\recurselevel} and \type{\recursedepth} are +%D +%D Both \type{\recurselevel} and \type{\recursedepth} are %D macros. The real \COUNTERS\ are hidden from the user because -%D we don't want any interference. +%D we don't want any interference. \newcount\outerrecurse \newcount\innerrecurse @@ -500,8 +500,8 @@ \let\nextrecurse\relax %D Acceptable: -%D -%D \starttypen +%D +%D \starttypen %D \long\def\dostepwiserecurse#1#2#3% %D {\let\nextrecurse\gobblefourarguments %D \ifnum#3>0\relax\ifnum#2<#1\relax\else @@ -512,10 +512,10 @@ %D \fi\fi %D \nextrecurse{#1}{#2}{#3}} %D \stoptypen -%D -%D Better: -%D -%D \starttypen +%D +%D Better: +%D +%D \starttypen %D \long\def\dostepwiserecurse#1#2#3% %D {\let\nextrecurse\gobblefourarguments %D \ifnum#3>0\relax \ifnum#2<#1\relax \else @@ -524,13 +524,13 @@ %D \def\nextrecurse{\dosetstepwiserecurse<}% %D \fi \fi \fi %D \nextrecurse{#1}{#2}{#3}} -%D +%D %D \def\@@irecurse{@@irecurse} % stepper -%D \def\@@nrecurse{@@nrecurse} % number of steps -%D \def\@@srecurse{@@srecurse} % step -%D \def\@@drecurse{@@drecurse} % direction, < or > -%D \def\@@arecurse{@@arecurse} % action -%D +%D \def\@@nrecurse{@@nrecurse} % number of steps +%D \def\@@srecurse{@@srecurse} % step +%D \def\@@drecurse{@@drecurse} % direction, < or > +%D \def\@@arecurse{@@arecurse} % action +%D %D \long\def\dosetstepwiserecurse#1#2#3#4#5% %D {\global\advance\outerrecurse 1 %D \setevalue{\@@drecurse\recursedepth}{#1}% @@ -539,10 +539,10 @@ %D \setevalue{\@@srecurse\recursedepth}{\number#4}% %D \long\setvalue{\@@arecurse\recursedepth}{#5}% %D \dodorecurse} -%D +%D %D \def\donorecurse %D {} -%D +%D %D \def\dododorecurse %D {\edef\recurselevel{\csname\@@irecurse\recursedepth\endcsname}% %D \getvalue{\@@arecurse\recursedepth}% @@ -551,7 +551,7 @@ %D \advance\innerrecurse \csname\@@srecurse\recursedepth\endcsname %D \setevalue{\@@irecurse\recursedepth}{\the\innerrecurse}% %D \dodorecurse} -%D +%D %D \def\dodorecurse %D {\ifnum\csname\@@irecurse\recursedepth\endcsname %D \csname\@@drecurse\recursedepth\endcsname @@ -560,20 +560,20 @@ %D \else %D \expandafter\dododorecurse %D \fi} -%D +%D %D \def\nododorecurse %D {\global\advance\outerrecurse -1 %D \edef\recurselevel{\csname\@@irecurse\recursedepth\endcsname}} %D \stoptypen -%D -%D Cleaner and much faster: +%D +%D Cleaner and much faster: \def\@@irecurse{@@ir@@} % ecurse} % stepper -\def\@@arecurse{@@ar@@} % ecurse} % action +\def\@@arecurse{@@ar@@} % ecurse} % action % \mathchardef -\long\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 +\long\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone \long\global\@EA\def\csname\@@arecurse\recursedepth\endcsname{#4}% \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel @@ -595,57 +595,57 @@ \fi \fi\expanded{\nextrecurse{\number#1}{\number#2}{\number#3}}} -\beginETEX \numexpr +\beginETEX \numexpr -\long\def\dodostepwiserecurse#1#2#3% from to step +\long\def\dodostepwiserecurse#1#2#3% from to step {\ifnum#1>#2\relax \@EA\nodostepwiserecurse \else \def\recurselevel{#1}% \@EAEAEA\redostepwiserecurse\@EA - \fi\@EA{\the\numexpr\recurselevel+#3\relax}{#2}{#3}} + \fi\@EA{\the\numexpr\recurselevel+#3\relax}{#2}{#3}} \endETEX -\beginTEX +\beginTEX -\long\def\dodostepwiserecurse#1#2#3% from to step +\long\def\dodostepwiserecurse#1#2#3% from to step {\ifnum#1>#2\relax \@EA\nodostepwiserecurse \else \def\recurselevel{#1}% \innerrecurse#1\advance\innerrecurse#3\relax \@EAEAEA\redostepwiserecurse\@EA - \fi\@EA{\the\innerrecurse}{#2}{#3}} + \fi\@EA{\the\innerrecurse}{#2}{#3}} \endTEX \def\redostepwiserecurse {\csname\@@arecurse\recursedepth\endcsname\dodostepwiserecurse} -\beginETEX \numexpr +\beginETEX \numexpr -\long\def\dodostepwisereverse#1#2#3% from to step +\long\def\dodostepwisereverse#1#2#3% from to step {\ifnum#1<#2\relax \@EA\nodostepwiserecurse \else \def\recurselevel{#1}% \@EAEAEA\redostepwisereverse\@EA - \fi\@EA{\the\numexpr\recurselevel#3\relax}{#2}{#3}} + \fi\@EA{\the\numexpr\recurselevel#3\relax}{#2}{#3}} \endETEX -\beginTEX +\beginTEX -\long\def\dodostepwisereverse#1#2#3% from to step +\long\def\dodostepwisereverse#1#2#3% from to step {\ifnum#1<#2\relax \@EA\nodostepwiserecurse \else \def\recurselevel{#1}% - \innerrecurse#1\relax + \innerrecurse#1\relax \advance\innerrecurse#3\relax \@EAEAEA\redostepwisereverse\@EA - \fi\@EA{\the\innerrecurse}{#2}{#3}} + \fi\@EA{\the\innerrecurse}{#2}{#3}} \endTEX @@ -682,8 +682,8 @@ %D \dostepwiserecurse {10} {1} {-2} {...} %D \stoptypen %D -%D Because the simple case is used often, we implement it -%D more efficiently: +%D Because the simple case is used often, we implement it +%D more efficiently: \long\def\dorecurse#1% {\ifcase#1\relax @@ -710,26 +710,26 @@ \beginETEX \numexpr -\long\def\dodorecurse#1#2% from to +\long\def\dodorecurse#1#2% from to {\ifnum#1>#2\relax \@EA\nodorecurse \else \def\recurselevel{#1}% \@EAEAEA\redorecurse - \fi\@EA{\the\numexpr\recurselevel+1\relax}{#2}} + \fi\@EA{\the\numexpr\recurselevel+1\relax}{#2}} \endETEX \beginTEX -\long\def\dodorecurse#1#2% from to +\long\def\dodorecurse#1#2% from to {\ifnum#1>#2\relax \@EA\nodorecurse \else \def\recurselevel{#1}% \innerrecurse#1\advance\innerrecurse\plusone \@EAEAEA\redorecurse - \fi\@EA{\the\innerrecurse}{#2}} + \fi\@EA{\the\innerrecurse}{#2}} \endTEX @@ -742,7 +742,7 @@ %D The third alternative looks a bit different and uses a %D pseudo counter. When this macro is nested, we have to use -%D different counters. This time we use keywords. +%D different counters. This time we use keywords. %D %D \starttypen %D \def\alfa{2} \def\beta{100} \def\gamma{3} @@ -754,11 +754,11 @@ %D \for \n=55 \to 100 \step 2 \do {... \n ...} %D \stoptypen %D -%D Only in the third example we need to predefine \type{\n}. +%D Only in the third example we need to predefine \type{\n}. %D The use of \type{\od} as a dilimiter would have made nested -%D use more problematic. +%D use more problematic. -% maybe this one will becoem obsolete +% maybe this one will becoem obsolete \def\for#1=#2\to#3\step#4\do#5% {\dostepwiserecurse{#2}{#3}{#4} @@ -767,47 +767,47 @@ %D \macros %D {doloop,exitloop} %D -%D Sometimes loops are not determined by counters, but by -%D (a combinations of) conditions. We therefore implement a -%D straightforward loop, which can only be left when we -%D explictly exit it. Nesting is supported. First we present -%D a more extensive alternative. +%D Sometimes loops are not determined by counters, but by +%D (a combinations of) conditions. We therefore implement a +%D straightforward loop, which can only be left when we +%D explictly exit it. Nesting is supported. First we present +%D a more extensive alternative. %D %D \starttypen %D \doloop %D {Some kind of typesetting punishment \par %D \ifnum\pageno>100 \exitloop \fi} %D \stoptypen -%D -%D When needed, one can call for \type{\looplevel} and +%D +%D When needed, one can call for \type{\looplevel} and %D \type{\loopdepth}. %D -%D If we write this macros from scratch, we end up with -%D something like the ones described above: -%D +%D If we write this macros from scratch, we end up with +%D something like the ones described above: +%D %D \starttypen -%D \def\@@eloop{@@eloop} % exit +%D \def\@@eloop{@@eloop} % exit %D \def\@@iloop{@@iloop} % stepper %D \def\@@aloop{@@aloop} % action -%D +%D %D \newcount\outerloop -%D +%D %D \def\loopdepth% %D {\the\outerloop} -%D +%D %D \def\exitloop% %D {\setevalue{\@@eloop\loopdepth}{0}} -%D +%D %D \long\def\doloop#1% %D {\global\advance\outerloop by 1 %D \setevalue{\@@iloop\loopdepth}{1}% %D \setevalue{\@@eloop\loopdepth}{1}% %D \long\setvalue{\@@aloop\loopdepth}{#1}% %D \dodoloop} -%D +%D %D \def\dodonoloop% %D {\global\advance\outerloop by -1\relax} -%D +%D %D \def\dododoloop% %D {\edef\looplevel{\getvalue{\@@iloop\loopdepth}}% %D \innerrecurse=\looplevel @@ -816,41 +816,41 @@ %D \getvalue{\@@aloop\loopdepth}% %D \edef\looplevel{\getvalue{\@@iloop\loopdepth}}% %D \dodoloop} -%D +%D %D \def\dodoloop% %D {\ifnum\getvalue{\@@eloop\loopdepth}=0 %D \expandafter\dodonoloop %D \else %D \expandafter\dododoloop -%D \fi} -%D +%D \fi} +%D %D \def\doloop% %D {\dostepwiserecurse{1}{\maxdimen}{1}} -%D +%D %D \def\exitloop %D {\setvalue{\@@irecurse\recursedepth}{\maxdimen}} -%D +%D %D \def\looplevel{\recurselevel} %D \def\loopdepth{\recursedepth} %D \stoptypen -%D -%D We don't have to declare new counters for \type{\looplevel} -%D and \type{\loopdepth} because we can use \type{\recurselevel} -%D and \type{\recursedepth}. %D -%D We prefer however a more byte saving implementation, that -%D executes of course a bit slower. -%D +%D We don't have to declare new counters for \type{\looplevel} +%D and \type{\loopdepth} because we can use \type{\recurselevel} +%D and \type{\recursedepth}. +%D +%D We prefer however a more byte saving implementation, that +%D executes of course a bit slower. +%D %D \starttypen %D \def\doloop% %D {\dostepwiserecurse1\maxdimen1} -%D +%D %D \def\exitloop% %D {\letvalue{\@@irecurse\recursedepth}\maxdimen} %D \stoptypen -%D -%D Although, the next version is faster because it used the -%D simple loop. +%D +%D Although, the next version is faster because it used the +%D simple loop. \let\endofloop\donothing @@ -863,9 +863,9 @@ \beginETEX \numexpr -\long\def\dodoloop#1% +\long\def\dodoloop#1% {\def\recurselevel{#1}% - \@EA\redoloop\@EA{\the\numexpr\recurselevel+1\relax}} + \@EA\redoloop\@EA{\the\numexpr\recurselevel+1\relax}} \endETEX @@ -874,7 +874,7 @@ \long\def\dodoloop#1% {\def\recurselevel{#1}% \innerrecurse#1\advance\innerrecurse\plusone - \@EA\redoloop\@EA{\the\innerrecurse}} + \@EA\redoloop\@EA{\the\innerrecurse}} \endTEX @@ -885,29 +885,29 @@ {\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse \minusone } -\def\exitloop % \exitloop quits at end +\def\exitloop % \exitloop quits at end {\let\endofloop\nodoloop} -\long\def\exitloopnow#1\endofloop % \exitloopnow quits directly +\long\def\exitloopnow#1\endofloop % \exitloopnow quits directly {\nodoloop} %D The loop is executed at least once, so beware of situations -%D like: +%D like: %D %D \starttypen -%D \doloop {\exitloop some commands} +%D \doloop {\exitloop some commands} %D \stoptypen %D %D It's just a matter of putting the text into the \type{\if} -%D statement that should be there anyway, like in: +%D statement that should be there anyway, like in: %D %D \starttypen -%D \doloop {\ifwhatever \exitloop \else some commands\fi} +%D \doloop {\ifwhatever \exitloop \else some commands\fi} %D \stoptypen %D -%D You can also quit a loop immediately, by using \type -%D {\exitloopnow} instead. Beware, this is more sensitive -%D for conditional errors. +%D You can also quit a loop immediately, by using \type +%D {\exitloopnow} instead. Beware, this is more sensitive +%D for conditional errors. %D \macros %D {newevery,everyline,EveryLine,EveryPar} @@ -925,31 +925,31 @@ %D basis. Just by calling \type{\EveryPar{}} and %D \type{\EveryLine{}} we restore the old situation. %D -%D The definition command \type{\DoWithEvery} will be quite -%D unreadable, so let's first show an implementation that -%D shows how things are done: +%D The definition command \type{\DoWithEvery} will be quite +%D unreadable, so let's first show an implementation that +%D shows how things are done: %D -%D \starttypen +%D \starttypen %D \newtoks \everyline %D \newtoks \oldeveryline %D \newif \ifeveryline -%D +%D %D \def\DoWithEvery#1#2#3#4% %D {#3\else\edef\next{\noexpand#2={\the#1}}\next\fi %D \edef\next{\noexpand#1={\the#2\the\scratchtoks}}\next %D #4} -%D +%D %D \def\doEveryLine% %D {\DoWithEvery\everyline\oldeveryline\ifeveryline\everylinetrue} -%D +%D %D \def\EveryLine% %D {\afterassignment\doEveryLine\scratchtoks} %D -%D The real implementation is a bit more complicated but we -%D prefer something more versatile. +%D The real implementation is a bit more complicated but we +%D prefer something more versatile. -% the old one -% +% the old one +% % \def\DoWithEvery#1% % {\csname if\strippedcsname#1\endcsname \else % \edef\next% @@ -962,10 +962,10 @@ % {\@EA\the\csname old\strippedcsname#1\endcsname\the\scratchtoks}}% % \next % \csname\strippedcsname#1true\endcsname} -% +% % \def\dowithevery#1% % {\@EA\afterassignment\csname do\strippedcsname#1\endcsname\scratchtoks} -% +% % \def\newevery#1#2% % {\ifx#1\undefined\newtoks#1\fi % \ifx#2\relax\else\ifx#2\undefined @@ -975,7 +975,7 @@ % \def#2{\dowithevery#2}% % \fi\fi} % -% cleaner and more efficient +% cleaner and more efficient %\def\dowithevery#1% % {\def\dodowithevery% @@ -988,7 +988,7 @@ % \next}% % \afterassignment\dodowithevery\scratchtoks} % -% more efficient: +% more efficient: \def\dodowithevery#1% {\ifcase\csname c\strippedcsname#1\endcsname \expandafter\chardef @@ -1003,10 +1003,10 @@ {\def\next{\dodowithevery#1}% \afterassignment\next\scratchtoks} -\bgroup \let\newtoks\relax % plain safe (\outer) +\bgroup \let\newtoks\relax % plain safe (\outer) \gdef\newevery#1#2% - {\ifx#1\undefined\csname newtoks\endcsname#1\fi % plain safe (\outer) + {\ifx#1\undefined\csname newtoks\endcsname#1\fi % plain safe (\outer) \ifx#2\relax\else\ifx#2\undefined \expandafter\newtoks\csname t\strippedcsname#1\endcsname \expandafter\chardef\csname c\strippedcsname#1\endcsname\zerocount @@ -1015,59 +1015,59 @@ \egroup -%D The first \type {\outer} hack is needed to trick \TEX\ -%D into thinking that \type {\newtoks} is no outer macro, -%D the second hack is needed due to some funny interaction -%D between outer macros and \type {\if} at expansion time. +%D The first \type {\outer} hack is needed to trick \TEX\ +%D into thinking that \type {\newtoks} is no outer macro, +%D the second hack is needed due to some funny interaction +%D between outer macros and \type {\if} at expansion time. -%D This one permits definitions like: +%D This one permits definitions like: \newevery \everypar \EveryPar \newevery \everyline \EveryLine -%D and how about: +%D and how about: \newevery \neverypar \NeveryPar -%D Which we're going to use indeed! When the second argument -%D equals \type {\relax}, the first token list is created -%D unless it is already defined. +%D Which we're going to use indeed! When the second argument +%D equals \type {\relax}, the first token list is created +%D unless it is already defined. -%D Technically spoken we could have used the method we are -%D going to present in the visual debugger. First we save -%D the primitive \type{\everypar}: -%D -%D \starttypen +%D Technically spoken we could have used the method we are +%D going to present in the visual debugger. First we save +%D the primitive \type{\everypar}: +%D +%D \starttypen %D \let\normaleverypar=\everypar %D \stoptypen %D -%D Next we allocate a \TOKENLIST\ named \type{\everypar}, -%D which means that \type{\everypar} is no longer a primitive -%D but something like \type{\toks44}. +%D Next we allocate a \TOKENLIST\ named \type{\everypar}, +%D which means that \type{\everypar} is no longer a primitive +%D but something like \type{\toks44}. %D -%D \starttypen +%D \starttypen %D \newtoks\everypar %D \stoptypen %D -%D Because \TEX\ now executes \type{\normaleverypar} instead -%D of \type{\everypar}, we are ready to assign some tokens to +%D Because \TEX\ now executes \type{\normaleverypar} instead +%D of \type{\everypar}, we are ready to assign some tokens to %D this internally known and used \TOKENLIST. -%D -%D \starttypen +%D +%D \starttypen %D \normaleverypar={all the things the system wants to do \the\everypar} %D \stoptypen -%D -%D Where the user can provide his own tokens to be expanded -%D every time he expects them to expand. -%D -%D \starttypen +%D +%D Where the user can provide his own tokens to be expanded +%D every time he expects them to expand. +%D +%D \starttypen %D \everypar={something the user wants to do} %D \stoptypen -%D -%D We don't use this method because it undoubtly leads to -%D confusing situations, especially when other packages are -%D used, but it's this kind of tricks that make \TEX\ so -%D powerful. +%D +%D We don't use this method because it undoubtly leads to +%D confusing situations, especially when other packages are +%D used, but it's this kind of tricks that make \TEX\ so +%D powerful. %D \macros %D {convertargument,convertcommand,convertvalue} @@ -1111,7 +1111,7 @@ % \dodoglobal\edef#2{\convertedcommand\convertedargument}} \long\def\convertargument#1\to#2% - {\long\def#2{#1}% saves a restore + {\long\def#2{#1}% saves a restore \dodoglobal\edef#2{\convertedcommand#2}} \long\def\convertcommand#1\to#2% @@ -1124,20 +1124,20 @@ %D In \ETEX\ we can use \type {\detokenize} and gain some %D speed, but in general far less that 1\% for \type -%D {\convertargument} and nil for \type {\convertcommand}. -%D This macro is more robust than the pure \TEX\ one, -%D something I found out when primitives like \type +%D {\convertargument} and nil for \type {\convertcommand}. +%D This macro is more robust than the pure \TEX\ one, +%D something I found out when primitives like \type %D {\jobname} were fed (or something undefined). -\beginETEX \detokenize +\beginETEX \detokenize \long\def\convertargument#1\to#2% {\dodoglobal\edef#2{\detokenize{#1}}} - -% \long\def\convertcommand#1\to#2% + +% \long\def\convertcommand#1\to#2% % {\@EA\dodoglobal\@EA\edef\@EA#2\@EA{\@EA\detokenize\@EA{#1}}} - -\long\def\convertcommand#1\to#2% + +\long\def\convertcommand#1\to#2% {\dodoglobal\edef#2{\@EA\detokenize\@EA{#1}}} \endETEX @@ -1145,8 +1145,8 @@ %D When you try to convert a primitive command, you'll find %D out that the \ETEX\ method fails on for instance \type %D {\jobname} in the sense that it returns the filename -%D instead of just \type {\jobname}. So far this does not -%D give real problems. +%D instead of just \type {\jobname}. So far this does not +%D give real problems. %D This is typically a macro that one comes to after reading %D the \TEX book carefully. Even then, the definite solution @@ -1157,26 +1157,26 @@ %D \def\doconvertargument#1->#2\\\\{#2} %D \stoptypen %D -%D The \type{-}, the delimiter \type{\\\\} and the the second +%D The \type{-}, the delimiter \type{\\\\} and the the second %D argument are completely redundant. % %D As said, the \TEX\ alternative fails on expanding primitives, -% %D like in: -% %D +% %D like in: +% %D % %D \starttypen % %D \convertcommand\someprimitive\to\ascii % %D \stoptypen -% %D -% %D Because these primitives convert to themselves, we can use -% %D the backslash as a signal to treat them different. At the -% %D cost of slightly more overhead we can therefore define a +% %D +% %D Because these primitives convert to themselves, we can use +% %D the backslash as a signal to treat them different. At the +% %D cost of slightly more overhead we can therefore define a % %D more robust alternative. The catcode trickery is needed to -% %D get the backslash into the test as character (and not as -% %D escape, letter or whatever code else). +% %D get the backslash into the test as character (and not as +% %D escape, letter or whatever code else). % % % % does not work: -% % -% % \beginTEX +% % +% % \beginTEX % % % % \let\dodoconvertargument\doconvertargument % % @@ -1186,13 +1186,13 @@ % % *gdef*doconvertargument#1% % % {*ifx#1\*else*expandafter*dodoconvertargument*fi#1} % % *egroup -% % +% % % % \endTEX %D \macros %D {showvalue,showargument} %D -%D Two handy macros for testing purposes only: +%D Two handy macros for testing purposes only: \def\showvalue#1% {\expandafter\show\csname#1\endcsname} @@ -1206,13 +1206,13 @@ %D We can use both commands in testing, but alas, not all %D meanings expand to something \type {->}. This is no problem %D in the \ETEX\ implementation, but since we want -%D compatibility, we need: +%D compatibility, we need: %D -%D \starttypen +%D \starttypen %D \doifmeaningelse {\next} {\something} {true} {false} -%D \stoptypen +%D \stoptypen %D -%D Watch the one level expansion of the second argument. +%D Watch the one level expansion of the second argument. \def\doifmeaningelse#1#2% {\edef\!!stringa{\meaning#1}% @@ -1226,15 +1226,15 @@ %D \macros %D {doifsamestringselse,doifsamestring,doifnotsamestring} %D -%D The next comparison macro converts the arguments into -%D expanded strings. This command can be used to compare for -%D instance \type {\jobname} with a name stored in a macro. +%D The next comparison macro converts the arguments into +%D expanded strings. This command can be used to compare for +%D instance \type {\jobname} with a name stored in a macro. \def\@@doifsamestringelse#1#2% {\edef\!!stringa{#1}% \edef\!!stringb{#2}% \convertcommand\!!stringa\to\!!stringa - \convertcommand\!!stringb\to\!!stringb + \convertcommand\!!stringb\to\!!stringb \ifx\!!stringa\!!stringb} \def\doifsamestringelse#1#2% @@ -1279,8 +1279,8 @@ %D \stoptypen %D %D The first three calls result in the threefold message -%D \type{OK}, the fourth one shows the three elements of -%D \type{\first}. The command \type{\ExpandFirstAfter} takes +%D \type{OK}, the fourth one shows the three elements of +%D \type{\first}. The command \type{\ExpandFirstAfter} takes %D care of (first) arguments that are delimited by \type{[ ]}, %D but the faster \type{\ExpandAfter} does not. @@ -1369,7 +1369,7 @@ %D \hbox to \hsize{\rubish} %D \stoptypen %D -%D As we will see in the core modules, this macro permits +%D As we will see in the core modules, this macro permits %D constructions like: %D %D \starttypen @@ -1403,7 +1403,7 @@ %D %D We don't explicitly test if the macro is defined. -\def\assignifempty#1#2% can be sped up +\def\assignifempty#1#2% can be sped up {\doifsomething{#1}{\def#1{#2}}} % {\doifnot{#1}{}{\def#1{#2}}} %D \macros @@ -1484,8 +1484,8 @@ \def\gobbleuntilrelax#1\relax {} -%D The next one simply expands the pickup up tokens. -%D +%D The next one simply expands the pickup up tokens. +%D %D \starttypen %D \processuntil{sequence} %D \stoptypen @@ -1559,7 +1559,7 @@ %D Here \TEX\ typesets \type{\bf the right way} unbreakable %D at the end of the line. The solution mentioned before does %D not work here. -%D +%D %D \starttypen %D \long\unexpanded\def\groupedcommand#1#2% %D {\bgroup @@ -1570,25 +1570,25 @@ %D \afterassignment\BeforeGroup %D \let\next=} %D \stoptypen -%D -%D We used this method some time until the next alternative -%D was needed. From now on we support both -%D -%D \starttypen +%D +%D We used this method some time until the next alternative +%D was needed. From now on we support both +%D +%D \starttypen %D to be \bold{bold} or not, that's the question %D \stoptypen -%D -%D and -%D -%D \starttypen +%D +%D and +%D +%D \starttypen %D to be {\bold bold} or not, that's the question %D \stoptypen -%D +%D %D This alternative checks for a \type{\bgroup} token first. %D The internal alternative does not accept the box handling %D mentioned before, but further nesting works all right. The %D extra \type{\bgroup}||\type{\egroup} is needed to keep -%D \type{\AfterGroup} both into sight and local. +%D \type{\AfterGroup} both into sight and local. \long\def\HandleGroup#1#2% {\bgroup @@ -1614,20 +1614,20 @@ %D \next{#1}{#2}}% %D \futurelet\next\dogroupedcommand} %D \stoptypen -%D -%D From the missing paragraph number one can deduce that the -%D last macro is not the real one yet. I considered it a -%D nuisance that -%D +%D +%D From the missing paragraph number one can deduce that the +%D last macro is not the real one yet. I considered it a +%D nuisance that +%D %D \starttypen -%D \kleur[groen] -%D {as grass} +%D \kleur[groen] +%D {as grass} %D \stoptypen -%D +%D %D was not interpreted as one would expect. This is due to the %D fact that \type{\futurelet} obeys blank spaces, and a %D line||ending token is treated as a blank space. So the final -%D implementation became: +%D implementation became: %\long\unexpanded\def\groupedcommand#1#2% % {\bgroup @@ -1635,23 +1635,23 @@ % {\ifx\next\bgroup % \def\\{\egroup\HandleGroup{#1}{#2}}% % \else\ifx\next\blankspace -% \def\\ {\egroup\groupedcommand{#1}{#2}}% +% \def\\ {\egroup\groupedcommand{#1}{#2}}% % \else % \def\\{\egroup\HandleNoGroup{#1}{#2}}% % \fi\fi % \\}% % \futurelet\next\dogroupedcommand} % -% compatible ? +% compatible ? \long\unexpanded\def\groupedcommand#1#2% - {\doifnextcharelse\bgroup + {\doifnextcharelse\bgroup {\HandleGroup{#1}{#2}}{\HandleNoGroup{#1}{#2}}} -%D Users should be aware of the fact that grouping can -%D interfere with ones paragraph settings that are executed -%D after the paragraph is closed. One should therefore -%D explictly close the paragraph with \type{\par}, else the +%D Users should be aware of the fact that grouping can +%D interfere with ones paragraph settings that are executed +%D after the paragraph is closed. One should therefore +%D explictly close the paragraph with \type{\par}, else the %D settings will be forgotten and not applied. So it's: %D %D \starttypen @@ -1678,7 +1678,7 @@ \def\showdefinederror#1#2% {\writestatus{system}{#1 #2 replaces a macro, use CAPITALS!}} - + \def\checkdefined#1#2#3% {\doifdefined{#3}{\showdefinederror{#2}{#3}}} @@ -1743,7 +1743,7 @@ %D The original definition was: %D -%D \starttypen +%D \starttypen %D \def\doGotoPar %D {\ifx\nextchar\blankspace %D \@EA\GotoPar @@ -1752,21 +1752,21 @@ %D \else %D \@EAEAEA\dodoGotoPar %D \fi\fi} -%D +%D %D \def\dodoGotoPar %D {\the\BeforePar %D \BeforePar\emptytoks %D \nextchar} -%D +%D %D \def\GotoPar %D {\afterassignment\doGotoPar\let\nextchar=} -%D \stoptypen +%D \stoptypen %D Its big brother \type{\GetPar} redefines the \type{\par} %D primitive, which can lead to unexpected results, depending %D in the context. %D -%D \starttypen +%D \starttypen %D \def\GetPar %D {\expanded %D {\BeforePar @@ -1780,31 +1780,31 @@ %D \BeforePar\emptytoks %D \AfterPar\emptytoks}}}% %D \GotoPar} -%D \stoptypen +%D \stoptypen %D However, we can implement a better alternative by using: %D -%D \starttypen +%D \starttypen %D \def\dowithpar#1#2% -%D {\def\handlepar##1\par{#1##1#2}% -%D \def\gobblepar\par{\dowithpar{#1}{#2}}% +%D {\def\handlepar##1\par{#1##1#2}% +%D \def\gobblepar\par{\dowithpar{#1}{#2}}% %D \doifnextcharelse\par\gobblepar\handlepar} %D \stoptypen -%D -%D Or, nicer +%D +%D Or, nicer \def\redowithpar\par - {\doifnextcharelse\par\redowithpar\dodowithpar}% + {\doifnextcharelse\par\redowithpar\dodowithpar}% \def\dowithpar#1#2% - {\def\dodowithpar##1\par{#1##1#2}% + {\def\dodowithpar##1\par{#1##1#2}% \redowithpar\par} \def\redogotopar\par - {\doifnextcharelse\par\redogotopar\dodogotopar}% + {\doifnextcharelse\par\redogotopar\dodogotopar}% \def\dogotopar#1% - {\def\dodogotopar{#1}% + {\def\dodogotopar{#1}% \redogotopar\par} %D The previosuly defined macros now become: @@ -1873,7 +1873,7 @@ %D \stoptypen %D %D A second and better implementation was: -%D +%D %D \starttypen %D \def\dowithpargument#1% %D {\def\nextpar##1 \par{#1{##1}}% @@ -1882,10 +1882,10 @@ %D {\nextarg} %D {\nextpar}} %D \stoptypen -%D -%D We ended up with an alternative that also accepts en empty -%D argument. This command permits for instance chapters to -%D have no title. +%D +%D We ended up with an alternative that also accepts en empty +%D argument. This command permits for instance chapters to +%D have no title. %\def\dowithpargument#1% % {\def\nextpar##1 \par{#1{##1}}% @@ -1981,7 +1981,7 @@ %D a row. In both commands, the \type{n*} is optional. When this %D specification is missing, the command executes once. -% ! ! ! obsolete ! ! ! +% ! ! ! obsolete ! ! ! \def\dorepeat[#1]% {\dodorepeat#1*\empty*\relax} @@ -2005,7 +2005,7 @@ % \else % \dorecurse{#1}{#5{#2#3}}% % \fi} -% +% % more complex but better: \long\def\dodorepeatwithcommand#1*#2#3*#4\relax#5% @@ -2026,32 +2026,32 @@ \dorecurse{#1}{#5{#2#3}}% \fi\fi\fi} -%D \macros +%D \macros %D {normalbgroup,normalgroup} %D -%D No comment. +%D No comment. \let\normalbgroup\bgroup \let\normalegroup\egroup -%D \macros +%D \macros %D {doifstringinstringelse} %D %D The next macro is meant for situations where both strings -%D are macros. This save some unneeded expansion. +%D are macros. This save some unneeded expansion. %D %D \starttypen -%D \long\def\doifstringinstringelse#1#2% +%D \long\def\doifstringinstringelse#1#2% %D {\p!doifinstringelse#1#2% %D \@EA\firstoftwoarguments %D \else %D \@EA\secondoftwoarguments %D \fi} -%D \stoptypen +%D \stoptypen %D %D A bit faster is: -\def\pp!doifstringinstringelse#1% +\def\pp!doifstringinstringelse#1% {\if#1@% \@EA\secondoftwoarguments \else @@ -2059,9 +2059,9 @@ \fi} \long\def\doifstringinstringelse#1#2% - {\long\@EA\def\@EA\p!doifstringinstringelse\@EA##\@EA1#1##2##3\war - {\pp!doifstringinstringelse##2}% - \@EA\@EA\@EA\p!doifstringinstringelse\@EA#2#1@@\war} + {\long\@EA\def\@EA\p!doifstringinstringelse\@EA##\@EA1#1##2##3\war + {\pp!doifstringinstringelse##2}% + \@EA\@EA\@EA\p!doifstringinstringelse\@EA#2#1@@\war} %D \macros %D {appendtoks,prependtoks,appendtoksonce,prependtoksonce, @@ -2082,20 +2082,20 @@ %D macros are clones of the ones implemented in page~378 of %D Knuth's \TeX book. %D -%D A simple implementation, one that does not handle braces -%D at the outer level, is: -%D +%D A simple implementation, one that does not handle braces +%D at the outer level, is: +%D %D \starttypen %D \def\appendtoks#1\to#2% %D {\scratchtoks={#1}% %D \expanded{\dodoglobal\noexpand#2{\the#2\the\scratchtoks}}} -%D +%D %D \def\prependtoks#1\to#2% %D {\scratchtoks={#1}% %D \expanded{\dodoglobal\noexpand#2{\the\scratchtoks\the#2}}} %D \stoptypen %D -%D But here we prefer: +%D But here we prefer: \newtoks\@@scratchtoks @@ -2107,7 +2107,7 @@ % \long\def\doappendtoks#1\to#2% % {\@@scratchtoks\@EA{\gobbleoneargument#1}% % \expanded{\dodoglobal\noexpand#2{\the#2\the\@@scratchtoks}}} -% +% % \long\def\doprependtoks#1\to#2% % {\@@scratchtoks\@EA{\gobbleoneargument#1}% % \expanded{\dodoglobal\noexpand#2{\the\@@scratchtoks\the#2}}} @@ -2119,26 +2119,26 @@ % \def\dodoappendtoks#1% % {\expanded{\dodoglobal\noexpand#1{\the#1\the\@@scratchtoks}}} -% +% % \def\dodoprependtoks#1% % {\expanded{\dodoglobal\noexpand#1{\the\@@scratchtoks\the#1}}} -% +% % \long\def\doappendtoks#1\to% % {\@@scratchtoks\@EA{\gobbleoneargument#1}\dodoappendtoks} -% +% % \long\def\doprependtoks#1\to% % {\@@scratchtoks\@EA{\gobbleoneargument#1}\dodoprependtoks} -% +% % \long\def\doappendtoksonce#1\to#2% % {\@@scratchtoks\@EA{\gobbleoneargument#1}% % \doifintokselse\@@scratchtoks{#2}{}{\dodoappendtoks{#2}}} -% +% % \long\def\doprependtoksonce#1\to#2% % {\@@scratchtoks\@EA{\gobbleoneargument#1}% % \doifintokselse\@@scratchtoks{#2}{}{\dodoprependtoks{#2}}} % -% A slightly (but in the case of large arguments -% significantly) faster alternative is given below: +% A slightly (but in the case of large arguments +% significantly) faster alternative is given below: \def\dodoappendtoks {\dodoglobal\@@toks\@EAEAEA{\@EA\the\@EA\@@toks\the\@@scratchtoks}} @@ -2164,24 +2164,24 @@ \@@scratchtoks\@EA{\gobbleoneargument#1}% \doifintokselse\@@scratchtoks\@@toks\donothing\dodoprependtoks} -%D The test macro: +%D The test macro: %D -%D \starttypen -%D \def\doifintokselse#1#2% #1 en #2 zijn toks +%D \starttypen +%D \def\doifintokselse#1#2% #1 en #2 zijn toks %D {\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA %D \edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB %D \doifinstringelse\asciiA\asciiB} -%D \stoptypen +%D \stoptypen %D -%D Better: -%D -%D \starttypen -%D \def\doifintokselse#1#2% #1 en #2 zijn toks +%D Better: +%D +%D \starttypen +%D \def\doifintokselse#1#2% #1 en #2 zijn toks %D {\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA %D \edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB %D \doifstringinstringelse\asciiA\asciiB} -%D \stoptypen -%D +%D \stoptypen +%D %D Even better: \def\doifintokselse#1#2% #1 en #2 zijn toks @@ -2189,12 +2189,12 @@ \@EA\convertargument\the#2\to\asciiB \doifstringinstringelse\asciiA\asciiB} -%D Also: +%D Also: \def\appendetoks #1\to{\expanded{\appendtoks #1}\to} \def\prependetoks#1\to{\expanded{\prependtoks#1}\to} -%D Hm. +%D Hm. \def\flushtoks#1% {\@@scratchtoks#1\relax @@ -2278,7 +2278,7 @@ \setxvalue{#1}{\the\scratchcounter}} \def\resetcounter#1% - {\letgvalue{#1}\zerocountervalue} + {\letgvalue{#1}\zerocountervalue} \def\setcounter#1#2% {\scratchcounter#2% @@ -2286,9 +2286,9 @@ %D \macros %D {savecounter,restorecounter} -%D -%D These two commands can be used to save and restore counter -%D values. Only one level is saved. +%D +%D These two commands can be used to save and restore counter +%D values. Only one level is saved. \def\savecounter#1% {{\scratchcounter\getvalue {#1}\setxvalue{!#1}{\the\scratchcounter}}} @@ -2298,11 +2298,11 @@ % == {\setxvalue{#1}{\getvalue{!#1}}} -%D The next \ETEX\ based solution is some 15\% faster, which -%D goes unnoticed in any normal run, simply because these -%D macros are not used milions of times. +%D The next \ETEX\ based solution is some 15\% faster, which +%D goes unnoticed in any normal run, simply because these +%D macros are not used milions of times. -\beginETEX \numexpr +\beginETEX \numexpr \def\makecounter#1% {\global\@EA\let\csname#1\endcsname\zerocountervalue} % see earlier @@ -2319,7 +2319,7 @@ \def\resetcounter#1% {\global\@EA\let\csname#1\endcsname\zerocountervalue} -\def\setcounter#1#2% +\def\setcounter#1#2% {\@EA\xdef\csname#1\endcsname{\the\numexpr(#2)}} \def\savecounter#1% @@ -2357,10 +2357,10 @@ {\def#3{##2}}% \@EA\dosplitstring#1@@@#2@@@\\} -%D \macros +%D \macros %D {splitstring} %D -%D A bonus macro. +%D A bonus macro. %\def\splitstring#1\at#2\to#3\and#4% % {\def\dosplitstring##1#2##2@@@##3\\% @@ -2372,30 +2372,30 @@ {\def#3{##1}\def#4{##2}}% \@EA\dosplitstring#1#2#2\\} -%D \macros +%D \macros %D {beforetestandsplitstring, %D aftertestandsplitstring, %D testandsplitstring} -%D -%D The next alternatives are for Simon Pepping. This time -%D the result is empty when no split is done. +%D +%D The next alternatives are for Simon Pepping. This time +%D the result is empty when no split is done. % \def\beforetestandsplitstring#1\at#2\to#3% % {\def\dosplitstring##1#2##2#2##3\\{\doifelsenothing % {##3}{\let#3\empty}{\def#3{##1}}}% % \@EA\dosplitstring#1#2#2\\} -% +% % \def\aftertestandsplitstring#1\at#2\to#3% % {\def\dosplitstring ##1#2##2@@@##3\\{\doifelsenothing % {##3}{\let#3\empty}{\def#3{##2}}}% % \@EA\dosplitstring #1@@@#2@@@\\} -% +% % \def\testandsplitstring#1\at#2\to#3\and#4% % {\def\dosplitstring##1#2##2#2##3\\{\doifelsenothing % {##3}{\let#3\empty\let#4\empty}{\def#3{##1}\def#4{##2}}}% % \@EA\dosplitstring#1#2#2\\} -% -% faster: +% +% faster: \def\beforetestandsplitstring#1\at#2\to#3% {\def\dosplitstring##1#2##2#2##3##4\\% @@ -2420,8 +2420,8 @@ %D \starttypen %D \removesubstringtest-\from first-last\to\nothyphenated %D \stoptypen -%D -%D Which in terms of \TEX\ looks like: +%D +%D Which in terms of \TEX\ looks like: %\def\removesubstring#1\from#2\to#3% % {\doifinstringelse{#1}{#2} @@ -2465,33 +2465,33 @@ %D %D Removing an item takes more time than adding one. %D -%D A fast appending alternative, without any testing, is -%D also provided: +%D A fast appending alternative, without any testing, is +%D also provided: %D %D \starttypen %D \appendtocommalist {something} \name %D \prependtocommalist {something} \name %D \stoptypen -%D -%D This can be implemented as follows: %D -%D \starttypen +%D This can be implemented as follows: +%D +%D \starttypen %D \def\appendtocommalist#1#2% %D {\ifx#2\empty %D \dodoglobal\edef#2{#1}% -%D \else % no test on empty +%D \else % no test on empty %D \dodoglobal\edef#2{#2,#1}% %D \fi} -%D +%D %D \def\prependtocommalist#1#2% %D {\ifx#2\empty %D \dodoglobal\edef#2{#1}% -%D \else % no test on empty +%D \else % no test on empty %D \dodoglobal\edef#2{#1,#2}% %D \fi} -%D \stoptypen -%D -%D The faster alternatives are: +%D \stoptypen +%D +%D The faster alternatives are: \def\appendtocommalist#1#2% {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}} @@ -2499,9 +2499,9 @@ \def\prependtocommalist#1#2% {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}} -%D The old ones are: +%D The old ones are: %D -%D \starttypen +%D \starttypen %D \def\addtocommalist#1#2% %D {\ifx#2\empty %D \dodoglobal\edef#2{#1}% @@ -2512,7 +2512,7 @@ %D {\resetglobal} %D {\dodoglobal\edef#2{#2,#1}}% %D \fi} -%D +%D %D \def\pretocommalist#1#2% %D {\ifx#2\empty %D \dodoglobal\edef#2{#1}% @@ -2523,29 +2523,29 @@ %D {\resetglobal} %D {\dodoglobal\edef#2{#1,#2}}% %D \fi} -%D -%D \def\doremovefromcommalist#1#2#3% nog \doglobal +%D +%D \def\doremovefromcommalist#1#2#3% nog \doglobal %D {\edef\!!stringa{,,#3,,}% %D \beforesplitstring\!!stringa\at,#1#2,\to\!!stringb %D \aftersplitstring\!!stringa\at,#1#2,\to\!!stringc %D \edef#3{\!!stringb,\!!stringc}% %D \aftersplitstring#3\at,,\to#3\relax %D \beforesplitstring#3\at,,\to#3} -%D +%D %D \def\removefromcommalist#1#2% %D {\doremovefromcommalist{ }{#1}{#2}% %D \doremovefromcommalist{}{#1}{#2}% %D \dofrontstrip#2% %D \dodoglobal\edef#2{#2}} -%D \stoptypen +%D \stoptypen %D -%D Significantly faster (especially for longer lists): +%D Significantly faster (especially for longer lists): -\def\addtocommalist#1#2% {item} \cs +\def\addtocommalist#1#2% {item} \cs {\rawdoifinsetelse{#1}#2\resetglobal {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}} -\def\pretocommalist#1#2% {item} \cs +\def\pretocommalist#1#2% {item} \cs {\rawdoifinsetelse{#1}#2\resetglobal {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}} @@ -2583,14 +2583,14 @@ %D \macros %D {substituteincommalist} %D -%D Slow but seldom used, so for the moment we stick to this -%D implementation. +%D Slow but seldom used, so for the moment we stick to this +%D implementation. %D -%D \starttypen +%D \starttypen %D \substituteincommalist{old}{new}{list} -%D \stoptypen +%D \stoptypen -\def\substituteincommalist#1#2#3% old, new, list (slooow) +\def\substituteincommalist#1#2#3% old, new, list (slooow) {\edef\!!stringb{#1}% \edef\!!stringd{#2}% \let\!!stringa#3% @@ -2607,7 +2607,7 @@ \fi}% \@EA\rawprocesscommacommand\@EA[\!!stringa]\dosubstituteincommalist} -%D A not so useful macro: +%D A not so useful macro: \def\dodofrontstrip[#1#2]#3% {\ifx#1\space @@ -2622,27 +2622,27 @@ \@EA\dodofrontstrip\@EA[#1]#1% \fi} -%D \macros +%D \macros %D {replaceincommalist} %D -%D The next macro can be used to replace an indexed element +%D The next macro can be used to replace an indexed element %D in a commalist: %D -%D \starttypen +%D \starttypen %D \replaceincommalist\MyList{2} -%D \stoptypen +%D \stoptypen %D -%D Element~2 will be replaced by the current meaning of the macro -%D \type {\newcommalistelement}. The old meaning is saved in -%D \type {\commalistelement}. The replacement honors grouped items, -%D like in: +%D Element~2 will be replaced by the current meaning of the macro +%D \type {\newcommalistelement}. The old meaning is saved in +%D \type {\commalistelement}. The replacement honors grouped items, +%D like in: %D %D \starttypen %D \def\MyList{a,b,c,d,e,f} \replaceincommalist\MyList{3} %D \def\MyList{a,b,c,d,e,f} \replaceincommalist\MyList{3} %D \def\MyList{a,{b,c},d,e,f} \replaceincommalist\MyList{3} %D \def\MyList{a,b,c,{d,e,f}} \replaceincommalist\MyList{3} -%D \stoptypen +%D \stoptypen \let\newcommalistelement\empty @@ -2680,9 +2680,9 @@ \@EA\processcommalist\@EA[#1]\doreplaceincommalist \dodoglobal\let#1\newcommalist} -%D \macros +%D \macros %D {globalprocesscommalist} -%D +%D %D The commalist processing commands are characterized by the %D fact that the way they handle expansion as well as the fact %D that they can be nested. This makes them kind of useless for @@ -2725,7 +2725,7 @@ \def\withoutpt#1{\withoutunit{#1}{pt}} \def\withoutcm#1{\withoutunit{#1}{cm}} -%D A bit faster and more robust alternative is one that +%D A bit faster and more robust alternative is one that %D manipulates the \CATCODES. {\catcode`\.=\@@other @@ -2795,13 +2795,13 @@ %D \popmacro\macro %D \stoptypen %D -%D Beware: global! +%D Beware: global! \def\@s@{@s@} -\beginTEX +\beginTEX -\def\globalpushmacro#1% we can use a faster incement here +\def\globalpushmacro#1% we can use a faster incement here {\@EA\doglobal\@EA\increment\csname\@s@:\string#1\endcsname \global\@EA\let\csname\csname\@s@:\string#1\endcsname:\string#1\endcsname#1} @@ -2811,7 +2811,7 @@ % this one can be used to push a value over an \egroup -\def\localpushmacro#1% +\def\localpushmacro#1% {\@EA\doglobal\@EA\increment\csname\@s@::\string#1\endcsname \global\@EA\let\csname\csname\@s@::\string#1\endcsname::\string#1\endcsname#1} @@ -2821,30 +2821,30 @@ \endTEX -% * niet nodig, in @s@ stoppen +% * niet nodig, in @s@ stoppen \beginETEX \newcount -\def\globalpushmacro#1% +\def\globalpushmacro#1% {\ifcsname\@s@*\string#1\endcsname \else - \@EA\newcount\csname\@s@*\string#1\endcsname + \@EA\newcount\csname\@s@*\string#1\endcsname \fi \global\advance\csname\@s@*\string#1\endcsname \plusone \global\@EA\let\csname\the\csname\@s@*\string#1\endcsname*\string#1\endcsname#1} - + \def\globalpopmacro#1% \global\let - {%\ifcsname\@s@*\string#1\endcsname + {%\ifcsname\@s@*\string#1\endcsname \global\@EA\let\@EA#1\csname\the\csname\@s@*\string#1\endcsname*\string#1\endcsname - \global\advance\csname\@s@*\string#1\endcsname \minusone + \global\advance\csname\@s@*\string#1\endcsname \minusone %\else % \message{error in \string#1}\wait }%\fi} % this one can be used to push a value over an \egroup -\def\localpushmacro#1% +\def\localpushmacro#1% {\ifcsname\@s@**\string#1\endcsname \else - \@EA\newcount\csname\@s@**\string#1\endcsname + \@EA\newcount\csname\@s@**\string#1\endcsname \fi \global\advance\csname\@s@**\string#1\endcsname \plusone \global\@EA\let\csname\the\csname\@s@**\string#1\endcsname**\string#1\endcsname#1} @@ -2927,9 +2927,9 @@ % {\before\box\nextbox % \let\before=\between % \doprocesstokens} -% \hbox\bgroup}% +% \hbox\bgroup}% % \else -% \expandafter\if\space\next +% \expandafter\if\space\next % \before\white % \else % \before\next @@ -2938,10 +2938,10 @@ % \let\next=\doprocesstokens % \fi\fi % \next} -% +% % \def\doprocesstokens% the space after = is essential % {\afterassignment\dodoprocesstokens\let\next= } -% +% % \def\processtokens#1#2#3#4#5% % {\bgroup % \def\lastcharacter{\lastcharacter}% @@ -2961,12 +2961,12 @@ \else\ifx\nextprocessedtoken\bgroup \def\nextprocessedtoken {\dowithnextbox - {\before{\copy\nextbox}% \before can use nextbox several times + {\before{\copy\nextbox}% \before can use nextbox several times \let\before\between \doprocesstokens} - \hbox\bgroup}% + \hbox\bgroup}% \else - \expandafter\if\space\nextprocessedtoken + \expandafter\if\space\nextprocessedtoken \after\white \let\before\savedbefore \else @@ -3018,10 +3018,10 @@ %D Faster but spoiling inheritance (copying parameters): %D -%D \starttypen +%D \starttypen %D \def\doifelsevaluesomething#1#2#3% %D {\expandafter\ifx\csname#1\endcsname\empty#3\else#2\fi} -%D +%D %D \def\doifvaluesomething#1#2% %D {\expandafter\ifx\csname#1\endcsname\empty\else#2\fi} %D @@ -3111,8 +3111,8 @@ %D \macros %D {doifemptyelsevalue, doifemptyvalue, doifnotemptyvalue} -%D -%D Also handy: +%D +%D Also handy: \def\doifemptyelsevalue#1% {\@EA\ifx\csname#1\endcsname\empty @@ -3138,11 +3138,11 @@ %D \macros %D {doifallcommonelse} %D -%D A complete match of two sets can be tested with -%D \type {\doifallcommonelse}, where the first two -%D arguments are sets. +%D A complete match of two sets can be tested with +%D \type {\doifallcommonelse}, where the first two +%D arguments are sets. -%\def\doifallcommonelse#1#2#3#4% +%\def\doifallcommonelse#1#2#3#4% % {\def\p!docommoncheck##1% % {\doifnotinset{##1}{#2}{\donefalse}% % \ifdone\else\quitcommalist\fi}% @@ -3150,7 +3150,7 @@ % \processcommalist[#1]\p!docommoncheck % \ifdone#3\else#4\fi} -\def\@@doifallcommonelse#1#2#3#4% slow +\def\@@doifallcommonelse#1#2#3#4% slow {\def\p!docommoncheck##1% {\doifnotinset{##1}{#4}\donefalse \ifdone\else\expandafter\quitcommalist\fi}% @@ -3188,28 +3188,28 @@ {\uppercase{\ifinstringelse{$#1$}{$#2$}}% \expandafter\firstofoneargument \else - \expandafter\gobbleoneargument + \expandafter\gobbleoneargument \fi} \def\p!DOIFNOT#1#2% {\uppercase{\ifinstringelse{$#1$}{$#2$}}% - \expandafter\gobbleoneargument + \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} \def\p!DOIFELSE#1#2% {\uppercase{\ifinstringelse{$#1$}{$#2$}}% - \expandafter\firstoftwoarguments + \expandafter\firstoftwoarguments \else - \expandafter\secondoftwoarguments + \expandafter\secondoftwoarguments \fi} -\def\p!DOIFINSTRINGELSE#1#2% +\def\p!DOIFINSTRINGELSE#1#2% {\uppercase{\ifinstringelse{#1}{#2}}% - \expandafter\firstoftwoarguments + \expandafter\firstoftwoarguments \else - \expandafter\secondoftwoarguments + \expandafter\secondoftwoarguments \fi} \def\DOIF {\ExpandBothAfter\p!DOIF} @@ -3274,7 +3274,7 @@ %D We can of course gobble more arguments using the %D appropriate gobbling command. -\newif\ifexecuted % general purpose +\newif\ifexecuted % general purpose \def\executeifdefined#1#2% {\ifundefined{#1}% @@ -3284,10 +3284,10 @@ \fi \next} -%D Just for fun I times the next alternative: it was roughly -%D timed about 15\% faster than the default (10+ sec to 9 sec)! +%D Just for fun I times the next alternative: it was roughly +%D timed about 15\% faster than the default (10+ sec to 9 sec)! -\def\executeifdefined#1% #2 / never change this one again +\def\executeifdefined#1% #2 / never change this one again {\ifundefined{#1}% \expandafter\secondoftwoarguments \else @@ -3297,7 +3297,7 @@ \beginETEX -\def\executeifdefined#1% #2 / never change this one again +\def\executeifdefined#1% #2 / never change this one again {\ifcsname#1\endcsname \expandafter\firstoftwoarguments \else @@ -3307,19 +3307,19 @@ \endETEX -%D This one also has the advantage that it is fully -%D expandable and that it can be used after an assignment. +%D This one also has the advantage that it is fully +%D expandable and that it can be used after an assignment. -%D \macros +%D \macros %D {executeifdefinedcs} %D -%D An also fully expandable variant is the following: -%D +%D An also fully expandable variant is the following: +%D %D \starttypen %D \executeifdefinedcs{a}{b} %D \stoptypen -%D -%D In dit geval zijn beide argumenten csnames. +%D +%D In dit geval zijn beide argumenten csnames. \def\executeifdefinedcs#1#2% {\csname\ifundefined{#1}#2\else#1\fi\endcsname} @@ -3332,22 +3332,22 @@ %D \stoptypen %D %D For the moment we don't need this one, so we stick to the -%D faster one. +%D faster one. %D \macros %D {executeandforget} -%D -%D The following macros were requested by Simon. Watch the -%D global variant. -%D -%D \starttypen +%D +%D The following macros were requested by Simon. Watch the +%D global variant. +%D +%D \starttypen %D \executeandforget\SomeCommand %D \doglobal\executeandforget\AnotherCommand -%D \stoptypen +%D \stoptypen \def\executeandforget#1% {\global\let\@@expanded#1% - \dodoglobal\let#1\relax + \dodoglobal\let#1\relax \@@expanded} %D \macros @@ -3364,7 +3364,7 @@ %D argument must be broken into words when made interactive. %D Watch the use of \type{\noexpand}. -%D Is this one still needed? +%D Is this one still needed? % \long\def\doifsomespaceelse#1#2#3% % {\def\p!doifsomespaceelse##1 ##2##3\war% @@ -3426,7 +3426,7 @@ \dodoglobal\advance#2 -\scratchdimen} %D Both commands can be preceded by \type{\doglobal}. Here we -%D use \type{\redo} first, because \type{\dodo} resets the +%D use \type{\redo} first, because \type{\dodo} resets the %D global character. %D \macros @@ -3446,7 +3446,7 @@ %D \processseparatedlist[alfa+beta+gamma][+]\message %D \stoptypen -%D First we show the simple alternative: +%D First we show the simple alternative: %D %D \starttypen %D \def\processseparatedlist[#1][#2]#3% @@ -3466,8 +3466,8 @@ %D \doprocessseparatedlist#1#2]#2} %D \stoptypen %D -%D However, we want to handle all situations, like: -%D +%D However, we want to handle all situations, like: +%D %D \startbuffer %D \processseparatedlist[{aap noot}] [ ]{\def\xxx} \show\xxx %D \processseparatedlist[{aap} {noot}][ ]{\def\xxx} \show\xxx @@ -3477,8 +3477,8 @@ %D %D \typebuffer \getbuffer %D -%D Therefore we smuggle a \type {\relax} in front of the -%D argument, which we remove afterwards. +%D Therefore we smuggle a \type {\relax} in front of the +%D argument, which we remove afterwards. \def\doprocessseparatedlist#1]#2[#3]#4% {\def\dodoprocessseparatedlist##1##2#3% @@ -3497,18 +3497,18 @@ \def\processseparatedlist[% {\doprocessseparatedlist\relax} -%D \macros +%D \macros %D {processlist} %D -%D An even more general list processing macro is the +%D An even more general list processing macro is the %D following one: %D %D \starttypen -%D \processlist{beginsym}{endsym}{separator}\docommando list +%D \processlist{beginsym}{endsym}{separator}\docommando list %D \stoptypen -%D +%D %D This one supports arbitrary open and close symbols as well -%D as user defined separators. +%D as user defined separators. %D %D \starttypen %D \processlist(){=>}\docommando(a=>b=>c=>d) @@ -3532,15 +3532,15 @@ {\doprocesslist\relax}% \dodoprocesslist} -% %D \macros +% %D \macros % %D {dohonorgroupedargument} % %D -% %D The previous macro uses yet another auxiliary macro to -% %D handle the special case. -% +% %D The previous macro uses yet another auxiliary macro to +% %D handle the special case. +% % \def\dohonorgroupedargument#1[% % {\doifnextcharelse\bgroup{\dodohonorgroupedargument#1}{#1[}} -% +% % \def\dodohonorgroupedargument#1#2% % {#1[{{#2}}} @@ -3565,7 +3565,7 @@ {\p!dodogetparameter[##1==\relax]}% \processcommalist[#2]\p!dogetparameter} -% too ugly +% too ugly % % %D \macros % %D {DoAfterFi,DoAfterFiFi} @@ -3581,24 +3581,24 @@ % %D It saves us a \type{\next} construction. Skipping % %D \type{\else...\fi} is more tricky, so this one is not % %D provided. -% +% % \def\DoAfterFi#1\fi{\fi#1} % \def\DoAfterFiFi#1\fi#2\fi{\fi\fi#1} - + %D \macros %D {untextargument %D untexcommand} -%D -%D When manipulating data(bases) and for instance generating -%D index entries, the next three macros can be of help: -%D +%D +%D When manipulating data(bases) and for instance generating +%D index entries, the next three macros can be of help: +%D %D \starttypen %D \untextargument{...}\to\name %D \untexcommand {...}\to\name %D \stoptypen -%D -%D They remove braces and backslashes and give us something to -%D sort. +%D +%D They remove braces and backslashes and give us something to +%D sort. \def\untexsomething% {\begingroup @@ -3617,30 +3617,30 @@ %D \macros %D {ScaledPointsToBigPoints,ScaledPointsToWholeBigPoints} -%D -%D One characteristic of \POSTSCRIPT\ and \PDF\ is that both -%D used big points (\TEX's bp). The next macros convert points -%D and scaled points into big points. -%D +%D +%D One characteristic of \POSTSCRIPT\ and \PDF\ is that both +%D used big points (\TEX's bp). The next macros convert points +%D and scaled points into big points. +%D %D \starttypen %D \ScaledPointsToBigPoints {number} \target %D \ScaledPointsToWholeBigPoints {number} \target %D \stoptypen -%D -%D The magic factor $72/72.27$ can be found in most \TEX\ -%D related books. +%D +%D The magic factor $72/72.27$ can be found in most \TEX\ +%D related books. -\def\ScaledPointsToBigPoints #1{\PointsToBigPoints {#1sp}} +\def\ScaledPointsToBigPoints #1{\PointsToBigPoints {#1sp}} \def\ScaledPointsToWholeBigPoints#1{\PointsToWholeBigPoints{#1sp}} -\def\PointsToBigPoints#1#2% +\def\PointsToBigPoints#1#2% {\scratchdimen#1% - \scratchdimen.996264\scratchdimen + \scratchdimen.996264\scratchdimen \edef#2{\withoutpt{\the\scratchdimen}}} -\def\PointsToWholeBigPoints#1#2% +\def\PointsToWholeBigPoints#1#2% {\scratchdimen#1% - \scratchdimen.996264\scratchdimen + \scratchdimen.996264\scratchdimen \scratchcounter\scratchdimen \advance\scratchcounter \medcard \divide\scratchcounter \maxcard @@ -3648,35 +3648,35 @@ %D \macros %D {PointsToReal} -%D -%D Points can be stripped from their suffix by using -%D \type{\withoutpt}. The next macro enveloppes this macro. -%D +%D +%D Points can be stripped from their suffix by using +%D \type{\withoutpt}. The next macro enveloppes this macro. +%D %D \starttypen %D \PointsToReal {dimension} \target -%D \stoptypen +%D \stoptypen \def\PointsToReal#1#2% - {\scratchdimen#1% + {\scratchdimen#1% \edef#2{\withoutpt{\the\scratchdimen}}} -%D \macros +%D \macros %D {dontleavehmode} -%D -%D Sometimes when we enter a paragraph with some command, the -%D first token gets the whole first line. We can prevent this +%D +%D Sometimes when we enter a paragraph with some command, the +%D first token gets the whole first line. We can prevent this %D by saying: -%D +%D %D \starttypen %D \dontleavehmode %D \stoptypen -%D -%D This command is used in for instance the language module +%D +%D This command is used in for instance the language module %D \type{lang-ini}. %\def\dontleavehmode{\ifhmode\else\ifmmode\else$ $\fi\fi} % -% The (thanks to Taco) better alternative (mathsurround): +% The (thanks to Taco) better alternative (mathsurround): \def\dontleavehmode {\ifhmode\else \ifmmode\else @@ -3693,7 +3693,7 @@ %D \lowercasestring somestring\to\somestring %D \stoptypen %D -%D the first argument may be a \type{\macro}. +%D the first argument may be a \type{\macro}. \def\uppercasestring#1\to#2% {\edef#2{#1}\@EA\uppercase\@EA{\@EA\dodoglobal\@EA\edef\@EA#2\@EA{#2}}} @@ -3704,79 +3704,79 @@ %D \macros %D {handletokens} %D -%D With the next macro we enter a critical area of macro +%D With the next macro we enter a critical area of macro %D expansion. What we want is a macro that looks like: -%D +%D %D \starttypen %D \handletokens some tokens\with \somemacro %D \stoptypen -%D -%D At first sight the next implementation will suffice, but -%D running this one shows that we loose the spaces. This is no +%D +%D At first sight the next implementation will suffice, but +%D running this one shows that we loose the spaces. This is no %D surprise because we grab arguments and spaces preceding those -%D are just ignored. -%D +%D are just ignored. +%D %D \starttypen %D \def\nohandletokens#1\end% %D {} -%D +%D %D \def\dohandletokens#1#2\end% -%D {\ifx#1\endoftoken +%D {\ifx#1\endoftoken %D \expandafter\nohandletokens %D \else %D \docommando{#1}% %D \expandafter\dohandletokens %D \fi %D #2\end} -%D +%D %D \long\def\handletokens#1\with#2% %D {\let\docommando=#2\relax %D \dohandletokens#1\endoftoken\end} %D \stoptypen -%D -%D A second approach therefore grabs the individual characters -%D by using \type{\afterassignment}, in which case the space is -%D read in as space. -%D +%D +%D A second approach therefore grabs the individual characters +%D by using \type{\afterassignment}, in which case the space is +%D read in as space. +%D %D \starttypen %D \def\dodohandletokens% %D {\ifx\next\end \else %D \docommando{\next}% %D \expandafter\dohandletokens %D \fi} -%D +%D %D \def\dohandletokens %D {\afterassignment\dodohandletokens\let\next= } -%D +%D %D \long\def\handletokens#1\with#2% %D {\let\docommando=#2% %D \dohandletokens#1\end} %D \stoptypen -%D A bonus example: +%D A bonus example: %D -%D \starttypen +%D \starttypen %D \hbox{\handletokens tekst en meer tekst\with\ruledhbox} -%D +%D %D \def\weetikveel#1{\if#1\blankspace\space\else\ruledhbox{#1}\fi} -%D +%D %D \hbox{\handletokens tekst en meer tekst\with\weetikveel} -%D \stoptypen +%D \stoptypen %D \macros %D {counttoken,counttokens} %D -%D For the few occasions that we want to know the number of -%D specific tokens in a string, we can use: -%D +%D For the few occasions that we want to know the number of +%D specific tokens in a string, we can use: +%D %D \starttypen %D \counttoken token\in string\to \count %D \counttokens string\to \count %D \stoptypen -%D -%D This macro, that for instance is used in \type{cont-tab}, -%D takes a real counter. The macro can be preceded by \type -%D {\doglobal}. +%D +%D This macro, that for instance is used in \type{cont-tab}, +%D takes a real counter. The macro can be preceded by \type +%D {\doglobal}. \def\counttoken#1\in#2\to#3% {\redoglobal#3\zerocount @@ -3804,7 +3804,7 @@ % \handletokens#1\with\docounttoken % \resetglobal} -\def\counttokens#1\to#2% +\def\counttokens#1\to#2% {\redoglobal#2\zerocount \def\docounttoken##1{\dodoglobal\advance#2\plusone}% \handletokens#1\with\docounttoken @@ -3813,9 +3813,9 @@ %D \macros %D {splitofftokens} %D -%D Running this one not always gives the expected results. -%D Consider for instance the macro for which I originally -%D wrote this token handler. +%D Running this one not always gives the expected results. +%D Consider for instance the macro for which I originally +%D wrote this token handler. \long\def\splitofftokens#1\from#2\to#3% {\ifnum#1>\zerocount @@ -3825,7 +3825,7 @@ \advance\scratchcounter \minusone \edef#3{#3##1}% \fi}% - % \let#3\empty % #3 can be #2, so: + % \let#3\empty % #3 can be #2, so: \@EA\let\@EA#3\@EA\empty \@EA\handletokens#2\with\dosplitofftokens \else @@ -3833,16 +3833,16 @@ \fi} %D This macro can be called like: -%D -%D \startbuffer[example] +%D +%D \startbuffer[example] %D \splitofftokens10\from01234567 890123456789\to\test [\test] %D \stopbuffer -%D +%D %D However, the characters that we expect to find in %D \type{\test} just don;t show up there. The reason for this %D is not that logical but follows from \TEX's sometimes -%D mysterious way of expanding. Look at this: -%D +%D mysterious way of expanding. Look at this: +%D %D \startbuffer[next] %D \def\next{a} \edef\test{\next} [\test] %D \let\next=b \edef\test{\test\next} [\test] @@ -3850,33 +3850,33 @@ %D \let\next=d \edef\test{\test\next} [\test] %D \let\next=e \@EA\edef\@EA\test\@EA{\test\next} [\test] %D \stopbuffer -%D +%D %D \typebuffer[next] -%D -%D Careful reading shows that inside an \type{\edef} macro's +%D +%D Careful reading shows that inside an \type{\edef} macro's %D that are \type{\let} are not expanded! -%D +%D %D \unprotect\haalbuffer[next]\protect -%D -%D That's why we finally end up with a macro that looks -%D ahead by using an assignment, this time by using \type +%D +%D That's why we finally end up with a macro that looks +%D ahead by using an assignment, this time by using \type %D {\futurelet}, and grabbing an argument as well. That -%D way we can handle the sentinal, a blank space and grouped -%D tokens. +%D way we can handle the sentinal, a blank space and grouped +%D tokens. \def\dohandletokens {\futurelet\nexthandledtoken\dodohandletokens} \long\def\handletokens#1\with#2% - {\global\let\dododohandletokens#2% + {\global\let\dododohandletokens#2% \dohandletokens#1\end} %D A previous version said \type{\docommando=#2}, but to enable %D use in alignments, I decided to use another placeholder, one -%D that is not sensitive to the global assignment. +%D that is not sensitive to the global assignment. %D This alternatives does not handle grouped tokens well, so -%D next we had (for a short moment): +%D next we had (for a short moment): %D %D \starttypen %D \def\dodohandletokens#1% @@ -3887,10 +3887,10 @@ %D \dododohandletokens{#1}% %D \expandafter\dohandletokens %D \fi} -%D \stoptypen +%D \stoptypen %D -%D This one failed on a trailing space, something we -%D encounter in \JAVASCRIPT\ cleaning. +%D This one failed on a trailing space, something we +%D encounter in \JAVASCRIPT\ cleaning. %D %D \starttypen %D \def\dodohandletokens#1% @@ -3901,11 +3901,11 @@ %D \dododohandletokens{#1}% %D \expandafter\dohandletokens %D \fi} -%D \stoptypen +%D \stoptypen %D %D So, now we have: -\def\dodohandletokens % can be sped up +\def\dodohandletokens % can be sped up {\ifx\nexthandledtoken\blankspace \def\next * {\dododohandletokens{ }\dohandletokens}% \else\ifx\nexthandledtoken\end @@ -3915,12 +3915,12 @@ \fi\fi \next *} -%D This macro is tested on: -%D +%D This macro is tested on: +%D %D \def\xxx#1{[#1]} -%D +%D %D \startregels -%D \handletokens abc\with\xxx +%D \handletokens abc\with\xxx %D \handletokens a b c\with\xxx %D \handletokens a b c\with\xxx %D \handletokens a{bc}d\with\xxx @@ -3928,37 +3928,37 @@ %D \stopregels %D %D And our previous example shows up as: -%D +%D %D \haalbuffer[example] -%D \macros +%D \macros %D {iftrialtypesetting} -%D +%D %D The next boolean is at first sight a strange one. Sometimes %D one does a trial typesetting run, for instance to determine %D dimensions. Some mechanisms, like object inclusion, can fail %D on such trials. Temporary setting the next boolean to true, -%D helps a lot. +%D helps a lot. \newif\iftrialtypesetting %D \macros %D {startlocal, startglobal} %D -%D The next four macros are rather self explaining: +%D The next four macros are rather self explaining: %D %D \starttypen %D \startlocal -%D whatever assignments +%D whatever assignments %D \stoplocal %D %D \startglobal -%D whatever assignments +%D whatever assignments %D \stopglobal %D \stoptypen %D -%D These macros are meant for those who know the difference -%D between local and global assignments and are aware of the +%D These macros are meant for those who know the difference +%D between local and global assignments and are aware of the %D possible unwanted side effect \def\dostartglobaldefs#1#2% @@ -3982,10 +3982,10 @@ %D \macros %D {twodigitrounding} %D -%D When using \type {\special}s or \type {\pdfliteral}s, it -%D sometimes makes sense to limit the precission. The next -%D macro rounds a real number to two digits. It takes one -%D argument and only works in \ETEX. +%D When using \type {\special}s or \type {\pdfliteral}s, it +%D sometimes makes sense to limit the precission. The next +%D macro rounds a real number to two digits. It takes one +%D argument and only works in \ETEX. \beginTEX @@ -4015,8 +4015,8 @@ %D \def\starthans% %D {\processcontent{stophans}\test{\message{\test}\wait}} %D \stoptypen -%D -%D This macro is first used in the tabulation macros. +%D +%D This macro is first used in the tabulation macros. \def\processcontent#1% {\begingroup\@EA\doprocesscontent\csname#1\endcsname} @@ -4030,8 +4030,8 @@ %\endTEX -% Hm. Side effect, spaces after \type{\test} in verbatim. -% must set eof token +% Hm. Side effect, spaces after \type{\test} in verbatim. +% must set eof token %\beginETEX \scantokens % @@ -4042,10 +4042,10 @@ % %\endETEX -%D \macros +%D \macros %D {dogobblesingleempty, dogobbledoubleempty} %D -%D These two macros savely grab and dispose two arguments. +%D These two macros savely grab and dispose two arguments. \def\dogobblesingleempty{\dosingleempty\dodogobblesingleempty} \def\dogobbledoubleempty{\dodoubleempty\dodogobbledoubleempty} @@ -4053,39 +4053,39 @@ \def\dodogobblesingleempty [#1]{} \def\dodogobbledoubleempty[#1][#2]{} -\let\gobblesingleempty\dogobblesingleempty % also used -\let\gobbledoubleempty\dogobbledoubleempty % also used +\let\gobblesingleempty\dogobblesingleempty % also used +\let\gobbledoubleempty\dogobbledoubleempty % also used %D \macros %D {sortcommalist,sortcommacommand, %D donumericcompare,comparedresult} -%D +%D %D Sometimes we need to sort a commalist, so here is Taco's %D solution. This will in many cases be a list that is stored %D in a \type{\csname}, so both commalist and commacommands are %D supported. The sorting algorithm is very simple, so the list -%D should not be too long or sorting will be very slow. +%D should not be too long or sorting will be very slow. %D -%D \starttypen +%D \starttypen %D \sortcommalist[10,2,4,5,6,1,2,3,4,10,20]\donumericcompare %D -%D \def\test{10,2,4,5,6,1,2,3,4,10,20} +%D \def\test{10,2,4,5,6,1,2,3,4,10,20} %D %D \sortcommacommand[\test]\donumericcompare -%D \stoptypen +%D \stoptypen %D -%D In both cases, the result is available in the macro \type +%D In both cases, the result is available in the macro \type %D {\sortedcommalist}. -%D +%D %D Parameter \type{#2} is a macro that should accept two %D parameters, and it has to decide which one is larger, by %D setting the counter \type{\comparedresult} to~0 (for equal), %D 1~(if it's first argument is larger), or~2 (if it's second -%D argument is larger). +%D argument is larger). %D -%D As said, these macro are largely written by Taco, and are -%D (maybe therefore) also the first application of \type -%D {\replaceincommalist}. +%D As said, these macro are largely written by Taco, and are +%D (maybe therefore) also the first application of \type +%D {\replaceincommalist}. \newcount\comparedresult @@ -4120,7 +4120,7 @@ \def\docompareitems#1% {\doifnotempty{#1} {\@EA\comparecommand\@EA{\!!tempa}{#1}\relax - %\ifcase\compareresult % equal + %\ifcase\compareresult % equal \ifnum\comparedresult<2 \ifnum\scratchcounter=\commalistsize \@EA\@EA\@EA\def\@EA\@EA\@EA\sortedcommalist @@ -4138,13 +4138,13 @@ \fi}% \advance\scratchcounter \plusone} % bug, was \minusone -%D The macro \type{\donumericcompare} considers everything +%D The macro \type{\donumericcompare} considers everything %D that is not a number to be larger than any number. \def\donumericcompare#1#2% {\doifnumberelse{#1} {\doifnumberelse{#2} - {\ifnum#1>#2\relax + {\ifnum#1>#2\relax \comparedresult\plusone % #1 is larger \else\ifnum#1<#2\relax \comparedresult\plustwo % #2 is larger @@ -4156,19 +4156,19 @@ %D \macros %D {@saveprimitive} -%D -%D The next definition originates in the \type {amsgen} package. In -%D case some preceding package redefined a primitive that we also -%D want to redefine, we had better do some checking to make sure -%D that we are able to save the primitive meaning for internal use. -%D Primitive control sequences can be distinguished by the fact that -%D \type {\string} and \type {\meaning} return the same information. +%D +%D The next definition originates in the \type {amsgen} package. In +%D case some preceding package redefined a primitive that we also +%D want to redefine, we had better do some checking to make sure +%D that we are able to save the primitive meaning for internal use. +%D Primitive control sequences can be distinguished by the fact that +%D \type {\string} and \type {\meaning} return the same information. \def\@saveprimitive#1#2% {\begingroup \edef\@tempa{\string#1}% \edef\@tempb{\meaning#1}% - \ifx\@tempa\@tempb + \ifx\@tempa\@tempb \global\let#2#1% %\debuggerinfo{prim}{Saving \string#1 as \string#2}% \else @@ -4176,7 +4176,7 @@ %\ifx\@tempa\@tempb % \debuggerinfo{prim}{Saving \string#1 as \string#2}% %\else - % \debuggerinfo{prim}{Can't define \string#2 properly; + % \debuggerinfo{prim}{Can't define \string#2 properly; % primitive \noexpand#1 is no longer primitive}% %\fi \fi @@ -4186,17 +4186,17 @@ {\begingroup \@EA\edef\@EA\@tempa\@EA{\@EA\gobbleoneargument\string#1}% \@EA\let\csname normal\@tempa\endcsname\relax - \@EA\@saveprimitive\@EA#1\csname normal\@tempa\endcsname + \@EA\@saveprimitive\@EA#1\csname normal\@tempa\endcsname \endgroup } -%D In this macro, the message only shows up when the debugging -%D is turned on. +%D In this macro, the message only shows up when the debugging +%D is turned on. -%D \macros +%D \macros %D {@True, @False, @Not, @And} %D -%D Some predicate logic functions, used in for instance the -%D math module. +%D Some predicate logic functions, used in for instance the +%D math module. \def\@True {00} \def\@False {01} @@ -4206,31 +4206,31 @@ %D \macros %D {setdimensionwithunit, freezedimensionwithunit} %D -%D The next assignments are all valid: +%D The next assignments are all valid: %D -%D \starttypen +%D \starttypen %D \setdimensionwithunit\scratchdimen{10} {cm} %D \setdimensionwithunit\scratchdimen{10cm}{cm} %D \setdimensionwithunit\scratchdimen{10cm}{} %D \freezedimensionwithunit\SomeWidth{\textwidth} %D \freezedimensionwithunit\SomeDepth{\dp\strutbox} -%D \stoptypen +%D \stoptypen %D -%D As an alternative for the next macro we can use a global -%D assignment inside a box. The \type{\empty}'s permits -%D gobbling while preventing spurious \type{\relax}'s. +%D As an alternative for the next macro we can use a global +%D assignment inside a box. The \type{\empty}'s permits +%D gobbling while preventing spurious \type{\relax}'s. -\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick +\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick {\afterassignment\gobblefourarguments#1=#2#3pt\relax\empty\empty\empty\empty} \def\freezedimensionwithunit#1#2% {\setdimensionwithunit\scratchdimen#1{#2}\edef#1{\the\scratchdimen}} -%D \macros +%D \macros %D {doifsometokselse} %D %D Not that fast I guess, but here's a way to test for token -%D registers being empty. +%D registers being empty. \def\doifsometokselse#1% % #2#3% {\edef\!!stringa{\the#1}% @@ -4242,12 +4242,12 @@ %D \macros %D {startstrictinspectnextcharacter} -%D +%D %D This one if for Taco's bibliography module: \let\normalinspectnextcharacter\inspectnextcharacter -\def\strictinspectnextcharacter% no user macro ! +\def\strictinspectnextcharacter% no user macro ! {\ifx\nexttoken\charactertoken \expandafter\!!stringa \else @@ -4261,26 +4261,26 @@ {\let\inspectnextcharacter\normalinspectnextcharacter} %D \macros -%D {gobblespacetokens} +%D {gobblespacetokens} %D %D This macro needs a speed-up! -%\def\gobblespacetokens -% {\doifnextcharelse\empty\donothing\donothing} % no {}\do\do ! +%\def\gobblespacetokens +% {\doifnextcharelse\empty\donothing\donothing} % no {}\do\do ! -\def\gobblespacetokens +\def\gobblespacetokens {\afterassignment\nexttoken\let\nexttoken=} %D \macros %D {verbatimargument} %D -%D As the name says, this macro converts its argument to a -%D (rather safe) string. +%D As the name says, this macro converts its argument to a +%D (rather safe) string. \def\verbatimstring#1% {\convertargument#1\to\ascii\ascii} -%D These are needed in ordinal number conversions: +%D These are needed in ordinal number conversions: \def\lastdigit#1% {\@EA\thelastdigit\number#1\relax} @@ -4296,8 +4296,8 @@ %D \macros %D {serializecommalist} -%D -%D Concatenate commalists: +%D +%D Concatenate commalists: \def\serializecommalist[#1]% {\let\serializedcommalist\empty @@ -4308,24 +4308,24 @@ %D {purenumber} %D %D Sometimes we need control over when \TEX\ stops reading a -%D number, especially in full expandable macros where using -%D \type {\relax} would lead to disasters. -%D -%D \starttypen -%D \ifodd\purenumber{...}\space ... \else ... \fi -%D \stoptypen -%D -%D Here we use a space as number delimiter in combination -%D with a space- and relax-less \type {\purenumber}. This +%D number, especially in full expandable macros where using +%D \type {\relax} would lead to disasters. +%D +%D \starttypen +%D \ifodd\purenumber{...}\space ... \else ... \fi +%D \stoptypen +%D +%D Here we use a space as number delimiter in combination +%D with a space- and relax-less \type {\purenumber}. This %D macro works ok with \type {\the}, \type {\number} as well -%D as \ETEX's \type {\numexpr}. +%D as \ETEX's \type {\numexpr}. \def\purenumber#1{\@EA\firstofoneargument\@EA{\number#1}} %D \macros %D {filterfromvalue} %D -%D \starttypen +%D \starttypen %D \setvalue{xx}{{A}{B}{C}} %D %D \filterfromvalue{xx}{3}{3} @@ -4335,7 +4335,7 @@ %D %D An alternative is to store 'max' in the list, say: %D -%D \starttypen +%D \starttypen %D \setvalue{xx}{3{A}{B}{C}} %D %D \filterfromvalues{xx}{3} @@ -4344,10 +4344,10 @@ %D \stoptypen %D %D I'll implement this when I'm in \quotation {writing dirty -%D macros mood}. +%D macros mood}. \def\filterfromvalue#1#2#3% value max n - {\@EA\@EAEAEA\csname % we use the fact that an + {\@EA\@EAEAEA\csname % we use the fact that an \@EA\ifx\csname#1\endcsname\relax % undefined cs has become \relax \strippedcsname\gobbleoneargument % which we then gobble here \else @@ -4379,4 +4379,41 @@ \fi \endcsname\csname#1\endcsname} -\protect \endinput +%D \macros +%D {definemeasure} +%D +%D \starttypen +%D \definemeasure[mywidth][\dimexpr(\textwidth-1cm)] +%D +%D ... \measure{mywidth} ... +%D \stoptypen + +\def\??dm{@@dm} % brrr + +\def\definemeasure + {\dodoubleargument\dodefinemeasure} + +\def\dodefinemeasure[#1][#2]% + {\setvalue{\??dm#1}{#2}} + +\def\setmeasure#1{\setvalue{\??dm#1}} % quick way + +\def\measure#1% + {\ifcsname\??dm#1\endcsname\csname\??dm#1\endcsname\else\zeropoint\fi} + +%D \macros +%D {doifdimensionelse} +%D +%D This is a dirty one: we simply append a unit and discard it when needed. + +\def\doifdimensionelse#1% + {\afterassignment\dodoifdimensionelse\scratchdimen#1pt\relax} + +\def\dodoifdimensionelse#1% + {\ifx#1\relax + \expandafter\secondoftwoarguments + \else % #1=p ... t\relax + \expandafter\thirdoffourarguments + \fi} + +\protect \endinput
\ No newline at end of file diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index d275fc986..282aea035 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -13,12 +13,12 @@ \writestatus{loading}{Context XML Macros (initialization)} -%D Beware: don't rely on \longempty things, since this may -%D change! +%D Beware: don't rely on \longempty things, since this may +%D change! -%D To be sure: +%D To be sure: -\newif\ifprocessingXML +\newif\ifprocessingXML \beginTEX \writestatus{XML}{sorry, XML is only supported in (pdf)etex} @@ -26,8 +26,8 @@ \endinput \endTEX -%D This module is highly optimized for speed, which sometimes -%D reads to rather unreadable code. Sorry for this. +%D This module is highly optimized for speed, which sometimes +%D reads to rather unreadable code. Sorry for this. \beginETEX XML @@ -45,8 +45,8 @@ \endETEX -% todo: XMLfullsave == also attributes -% csnames +% todo: XMLfullsave == also attributes +% csnames % XMLelse -> elseXML %D Remark: some hard coded character things will be replaced @@ -91,7 +91,7 @@ %D either or not using delimited arguments. And, when moving %D data around, there is always the expansion problem to deal %D with. -%D +%D %D As can be expected, we have to map begin and end tags onto %D \CONTEXT's start- and stopcommands. This is the easy part. %D When we have to pass the content of an element to a macro @@ -100,18 +100,18 @@ %D {m-sgml.tex} already. New in this core module is nested %D grabbing. Also new here is the support for namespaces and %D extensive attribute handling. On the other hand, recursive -%D traceback of attributes is no longer supported. Because +%D traceback of attributes is no longer supported. Because %D this feature was not really used, we can hereby safely we -%D declare the \type {m-sgml.tex} module obsolete. -%D +%D declare the \type {m-sgml.tex} module obsolete. +%D %D In order to be able to incorporate \XML\ style definitions %D into basic \TEX\ styles, we will provide some basic %D functionality in the core itself. Some of the functionality %D can be set up with this general command. We use a token %D list register to handle post||setup actions. This permits -%D us to extend this command. +%D us to extend this command. -\unprotect +\unprotect \newtoks\aftersetupXMLprocessing @@ -121,12 +121,12 @@ \def\dosetupXMLprocessing[#1]% {\getparameters[\??xp][#1]\the\aftersetupXMLprocessing} -\protect +\protect -%D Formally an \XML\ file starts with an unique sequence -%D \type {<?xml}, but in most of the unilities that come with -%D \CONTEXT\ we will be more tolerant, and gobble preceding -%D spaces. +%D Formally an \XML\ file starts with an unique sequence +%D \type {<?xml}, but in most of the unilities that come with +%D \CONTEXT\ we will be more tolerant, and gobble preceding +%D spaces. \def\XMLbanner#1{\string<\string ?xml version='1.0' #1\string ?\string>} @@ -156,21 +156,21 @@ \unprotect \def\@@XML {XML:} -\def\@@XMLentity {\@@XML ent} % &crap; +\def\@@XMLentity {\@@XML ent} % &crap; \def\@@XMLelement {\@@XML ele} % <this> </this> <that/> \def\@@XMLvariable {\@@XML var} % key="val" \def\@@XMLvalue {\@@XML val} % key="val" \def\@@XMLpars {\@@XML par} % -\def\@@XMLdata {\@@XML dat} % mem buffer +\def\@@XMLdata {\@@XML dat} % mem buffer \def\@@XMLcode {\@@XML cod} % named mem buffers -\def\@@XMLinstruction {\@@XML ins} % <? -\def\@@XMLmap {\@@XML map} % mapping on context attr -\def\@@XMLlist {\@@XML lst} % +\def\@@XMLinstruction {\@@XML ins} % <? +\def\@@XMLmap {\@@XML map} % mapping on context attr +\def\@@XMLlist {\@@XML lst} % \def\@@XMLnamespace {\@@XML nam} % namespace:element \def\@@XMLurlspace {\@@XML url} % \def\@@XMLescape {\@@XML esc} % <! -\def\@@XMLdepth {\@@XML dep} % used to track nesting -\def\@@XMLdopth {\@@XML dop} % used to track nesting +\def\@@XMLdepth {\@@XML dep} % used to track nesting +\def\@@XMLdopth {\@@XML dop} % used to track nesting \def\@@XMLsave {\@@XML sav} % namespace for saved elements \newtoks\XMLtoks @@ -181,14 +181,14 @@ \newif\iftraceXMLelements %newif\ifprocessingXML -\newcount\XMLlevel % scratchcounter -\newcount\XMLdepth % used here +\newcount\XMLlevel % scratchcounter +\newcount\XMLdepth % used here \newtoks\everyenableXML %D We will implement the parser by making a few characters %D active. For that reason we also have to save their -%D original meaning. +%D original meaning. %D \macros %D {enableXML} @@ -232,53 +232,53 @@ B.unexpanded.def<B.doXMLelementE.let&=.doXMLentityE * internally the # becomes two #'s (before expanding, during -* the parsing stage) which is why we let the first # gobble +* the parsing stage) which is why we let the first # gobble * the second one * -* since this only takes place when reading arguments, as in -* \startXMLdata ... cum, suis, we can take place of it -* there; this is needed because reading from file goes wrong -* (eating up argument) +* since this only takes place when reading arguments, as in +* \startXMLdata ... cum, suis, we can take place of it +* there; this is needed because reading from file goes wrong +* (eating up argument) .unexpanded.gdef.enableXML* B.catcode`.!=.@@other* - .catcode`.?=.@@other* - .catcode`.:=.@@other* active in french - .catcode`.;=.@@other* active in french + .catcode`.?=.@@other* + .catcode`.:=.@@other* active in french + .catcode`.;=.@@other* active in french .catcode`.&=.@@active .let&=.doXMLentity* .catcode`.<=.@@active .unexpanded.def<B.doXMLelementE* - .catcode`.>=.@@other + .catcode`.>=.@@other .catcode`."=.@@other - .catcode`./=.@@other + .catcode`./=.@@other .catcode`.'=.@@other - .catcode`.~=.@@other + .catcode`.~=.@@other * .catcode`.#=.@@active .def#B&hash;E* - .catcode`.#=.@@other + .catcode`.#=.@@other .ifcase.XMLtokensreduction .entitleXMLescapetokens .or .reduceXMLescapetokens - .else + .else .ignoreXMLescapetokens - .fi + .fi .processingXMLtrue .the.everyenableXML E .gdef.activateXMLescapetokens* - B.catcode`.$=.@@active - .catcode`.%=.@@active - .catcode`.\=.@@active - .catcode`.^=.@@active - .catcode`._=.@@active - .catcode`.{=.@@active - .catcode`.}=.@@active - .catcode`.|=.@@active + B.catcode`.$=.@@active + .catcode`.%=.@@active + .catcode`.\=.@@active + .catcode`.^=.@@active + .catcode`._=.@@active + .catcode`.{=.@@active + .catcode`.}=.@@active + .catcode`.|=.@@active E .gdef.entitleXMLescapetokens* B.activateXMLescapetokens* - .def#B&tex-hash;E* + .def#B&tex-hash;E* .def$B&tex-dollar;E* .def%B&tex-percent;E* .def\B&tex-backslash;E* @@ -303,7 +303,7 @@ E .gdef.ignoreXMLescapetokens* - B.catcode`.$=.@@other * or letter ? + B.catcode`.$=.@@other * or letter ? .catcode`.%=.@@other .catcode`.\=.@@other .catcode`.^=.@@other @@ -313,25 +313,25 @@ .catcode`.|=.@@other E -* The following macro can be invokes when reading from -* an auxiliary file. +* The following macro can be invokes when reading from +* an auxiliary file. -.unexpanded.gdef.enableXMLelements* - B.catcode60=.@@active * .catcode`.<=.@@active +.unexpanded.gdef.enableXMLelements* + B.catcode60=.@@active * .catcode`.<=.@@active .catcode62=.@@other * .catcode`.>=.@@other .unexpanded.def<B.doXMLelementE* .processingXMLtrue E -.unexpanded.gdef.disableXMLelements* - B.catcode60=.@@active * .catcode`.<=.@@active +.unexpanded.gdef.disableXMLelements* + B.catcode60=.@@active * .catcode`.<=.@@active .catcode62=.@@other * .catcode`.>=.@@other - .let<.relax * new + .let<.relax * new .processingXMLfalse E -.global.let<.relax * new -.global.let&.relax * new +.global.let<.relax * new +.global.let&.relax * new .egroup @@ -400,17 +400,17 @@ %D mess up with catcodes. We probably have to treat a few %D more catcode and first character cases. We need to use %D \type {\begingroup} here, otherwise we get funny spaces in -%D math. +%D math. -%D Maybe I will remove grouping here and introduce \type -%D {\obeyXMLlines}. +%D Maybe I will remove grouping here and introduce \type +%D {\obeyXMLlines}. %D By using a few {\expandafter}'s we can avoid a \type {\next} %D construction. We could speed the first char test up a bit %D by using an installer and something \typ {\getvalue %D {#1doXMLelement}} (todo). -\protect % we need an normal ! ? +\protect % we need an normal ! ? % \long\def\doXMLelement#1% % {\if#1!\expandafter \xparseXMLescape \else @@ -426,15 +426,15 @@ \expandthree \xparseXMLelement \fi\fi #1} -% does it end with ? or ?> +% does it end with ? or ?> \long\def\xparseXMLescape !#1 {\parseXMLescape{#1}} \long\def\xparseXMLprocess ?#1 #2>{\parseXMLprocess{#1}{#2}} \long\def\xparseXMLelement #1>{\parseXMLelement #1 >} -%D The escape handler takes care of the fuzzy \type {<!} -%D constructs. Unfortunately, we need to catch \type {<--text} -%D too, so we need another handler: +%D The escape handler takes care of the fuzzy \type {<!} +%D constructs. Unfortunately, we need to catch \type {<--text} +%D too, so we need another handler: \long\def\xparseXMLescape !#1#2% {\if#1-% @@ -463,7 +463,7 @@ {\unspaceargument#1\to\ascii % get rid of {}, like in {CDATA[} \long\setvalue{\@@XMLescape:\ascii}{#2}} -\def\parseXMLescape#1% #2> parsing takes place in macros +\def\parseXMLescape#1% #2> parsing takes place in macros {\executeifdefined{\@@XMLescape:#1}{\csname\@@XMLescape:\s!default\endcsname}} %D In our case, processing instructions are only needed if @@ -475,27 +475,27 @@ %D The processing instructions handler is implemented as %D follows. -\long\def\defineXMLprocessor[#1]#2% +\long\def\defineXMLprocessor[#1]#2% {\long\setvalue{\@@XMLinstruction:#1}{#2}} -% \def\parseXMLprocess#1#2% +% \def\parseXMLprocess#1#2% % {\executeifdefined{\@@XMLinstruction:#1}\gobbleoneargument{#2}} -%D Because we support \type {.. ?>} as well as \type {.. >} -%D end||of||pi situations, we need to clean up the ending +%D Because we support \type {.. ?>} as well as \type {.. >} +%D end||of||pi situations, we need to clean up the ending %D \type {?}. -\protect +\protect \long\def\cleanupXMLprocess#1% {\docleanupXMLprocess#1 ? \relax} -\long\def\docleanupXMLprocess#1? #2\relax +\long\def\docleanupXMLprocess#1? #2\relax {\def\currentXMLprocess{#1}} -\unprotect +\unprotect -\def\parseXMLprocess#1#2% +\def\parseXMLprocess#1#2% {\cleanupXMLprocess{#2}% \convertcommand#1\to\ascii %\writestatus{xml-process}{\ascii} @@ -505,7 +505,7 @@ \noexpand\gobbleoneargument {\expandafter\noexpand\currentXMLprocess}}} -%D One never knows: +%D One never knows: \let\normalparseXMLescape \parseXMLescape \let\normalparseXMLelement\parseXMLelement @@ -520,7 +520,7 @@ \let\currentXMLidentifier\empty % name or name/ \let\currentXMLnamespace \empty % the (remapped) namespace \let\originalXMLnamespace\empty % the unremapped namespace -\let\rawXMLidentifier \empty +\let\rawXMLidentifier \empty \def\rawXMLnamespace {\ifx\currentXMLnamespace\empty\else\currentXMLnamespace:\fi} @@ -542,38 +542,38 @@ \chardef\endXMLtag =2 \chardef\emptyXMLtag=3 -%D We do a rather hard coded scan for the namespace attribute. This -%D is needed because its value determines further namespace related -%D actions. +%D We do a rather hard coded scan for the namespace attribute. This +%D is needed because its value determines further namespace related +%D actions. \def\openXMLargument{ /} - + \long\def\parseXMLelement#1#2 #3>% - {\def\currentXMLarguments{#3}% including end / - \if#1/% + {\def\currentXMLarguments{#3}% including end / + \if#1/% \chardef\kindofXMLelement\endXMLtag \def\currentXMLelement{#2}% \else \docleanupXMLelement#1#2/\empty\relax - \fi + \fi \ifx\currentXMLarguments\openXMLargument \chardef\kindofXMLelement\emptyXMLtag \fi \@EA\splitoffXMLnamespace\currentXMLelement::\relax \ifcase\kindofXMLelement - % can't happen - \or - % begintag or emptytag with arguments or space before / + % can't happen + \or + % begintag or emptytag with arguments or space before / \the\everyXMLelement % only for begin/empty tag ! \ifx\currentXMLarguments\empty \else \dogetXMLarguments\rawXMLelement#3>% \fi \or - % no arguments + % no arguments \or - % empty element without arguments (but possible presets) - \the\everyXMLelement - \fi + % empty element without arguments (but possible presets) + \the\everyXMLelement + \fi \ifcase\kindofXMLelement\or \let\currentXMLidentifier \rawXMLidentifier \edef\currentXMLfullidentifier {\rawXMLelement }% @@ -588,7 +588,7 @@ \executeXMLelement} \long\def\docleanupXMLelement#1/#2#3\relax - {\def\currentXMLelement{#1}% watch out: \empty == begin or empty tag + {\def\currentXMLelement{#1}% watch out: \empty == begin or empty tag \chardef\kindofXMLelement\ifx#2\empty\beginXMLtag\else\emptyXMLtag\fi} \def\@@traceXMLelement @@ -618,7 +618,7 @@ \let\originalXMLnamespace\currentXMLnamespace \checkXMLnamespace\rawXMLidentifier} -\def\xsplitoffXMLnamespace% fast resplit +\def\xsplitoffXMLnamespace% fast resplit {\ifcsname\@@XMLnamespace:\currentXMLnamespace\endcsname \csname\@@XMLnamespace:\currentXMLnamespace\endcsname \fi} @@ -629,42 +629,42 @@ %D The namespace attribute checking is part of the element %D parser, since the value of \type {xmlns} may influence other -%D namespace mapping. +%D namespace mapping. \def\@@XMLns{xmlns} \def\checkXMLnamespaceattr#1% xmlns:\@@XMLname="\XMLns" - {\edef\XMLns{#1}% + {\edef\XMLns{#1}% \ifx\XMLns\empty \else \ifcsname\@@XMLurlspace:\XMLns\endcsname - % get remapped namespace (from url) + % get remapped namespace (from url) % \edef\XMLns{\csname\@@XMLurlspace:\XMLns\endcsname}% \@EA\let\@EA\XMLns\csname\@@XMLurlspace:\XMLns\endcsname - % remap this one - \ifx\@@XMLname\empty - % not watertight since no implicit grouping + % remap this one + \ifx\@@XMLname\empty + % not watertight since no implicit grouping \xautoXMLnamespace\XMLns \else \xremapXMLnamespace\@@XMLname\XMLns - % redo namespace remapping of self if needed - \ifx\XMLns\currentXMLnamespace - % i'm still not sure if this is ok + % redo namespace remapping of self if needed + \ifx\XMLns\currentXMLnamespace + % i'm still not sure if this is ok \else \xsplitoffXMLnamespace \fi \fi - \fi + \fi \fi} -%D Although not really needed, we clean up the arguments. +%D Although not really needed, we clean up the arguments. % \long\def\cleanupXMLarguments % {\ifnum\kindofXMLelement=\emptyXMLtag -% \ifx\currentXMLarguments\empty \else +% \ifx\currentXMLarguments\empty \else % \@EA\docleanupXMLarguments\currentXMLarguments/\empty % \fi % \fi} -% +% % \long\def\docleanupXMLarguments#1/#2\empty % {\edef\currentXMLarguments{#1}} % @@ -672,7 +672,7 @@ \long\def\cleanupXMLarguments {\ifnum\kindofXMLelement=\emptyXMLtag - \ifx\currentXMLarguments\empty \else + \ifx\currentXMLarguments\empty \else \@EA\docleanupXMLarguments\currentXMLarguments/ \relax \fi \fi} @@ -680,17 +680,17 @@ \long\def\docleanupXMLarguments#1/ #2\relax % space added earlier {\edef\currentXMLarguments{#1}} -\def\executeXMLelementA % no fallback +\def\executeXMLelementA % no fallback {\ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname - \csname\@@XMLelement:\currentXMLfullidentifier\endcsname + \csname\@@XMLelement:\currentXMLfullidentifier\endcsname \fi} -\def\executeXMLelementB % default fallback +\def\executeXMLelementB % default fallback {\csname \@@XMLelement:% \ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname \currentXMLfullidentifier \else - \defaultXMLelementID % was \s!default + \defaultXMLelementID % was \s!default \fi \endcsname} @@ -701,22 +701,22 @@ \else\ifcsname\@@XMLelement:\currentXMLidentifier\endcsname \currentXMLidentifier \else - \defaultXMLelementID % was \s!default + \defaultXMLelementID % was \s!default \fi\fi \endcsname} \def\executeXMLelementD - {\csname + {\csname \ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname \@@XMLelement:\currentXMLfullidentifier \else\ifcsname\@@XMLelement:\currentXMLidentifier\endcsname \@@XMLelement:\currentXMLidentifier \else - \executeXMLelementDD % less skipping and thereby faster + \executeXMLelementDD % less skipping and thereby faster \fi\fi \endcsname} -\def\executeXMLelementDD % now forget about tex mapping +\def\executeXMLelementDD % now forget about tex mapping {\ifcsname\normal@@XMLelement:\currentXMLfullidentifier\endcsname \normal@@XMLelement:\currentXMLfullidentifier \else\ifcsname\normal@@XMLelement:\currentXMLidentifier\endcsname @@ -727,27 +727,27 @@ \def\setXMLfallbackmode#1% {\ifcase#1\relax - \let\executeXMLelement \executeXMLelementA - \let\automateXMLnamespace\automateXMLnamespaceA - \or % 1 - \let\executeXMLelement \executeXMLelementB - \let\automateXMLnamespace\automateXMLnamespaceB - \or % 2 - \let\executeXMLelement \executeXMLelementC - \let\automateXMLnamespace\automateXMLnamespaceC + \let\executeXMLelement \executeXMLelementA + \let\automateXMLnamespace\automateXMLnamespaceA + \or % 1 + \let\executeXMLelement \executeXMLelementB + \let\automateXMLnamespace\automateXMLnamespaceB + \or % 2 + \let\executeXMLelement \executeXMLelementC + \let\automateXMLnamespace\automateXMLnamespaceC \or % 3 - \let\executeXMLelement \executeXMLelementD - \let\automateXMLnamespace\automateXMLnamespaceD + \let\executeXMLelement \executeXMLelementD + \let\automateXMLnamespace\automateXMLnamespaceD \fi} -\setXMLfallbackmode3 % was 2 +\setXMLfallbackmode3 % was 2 -%D An example of fall back modes is given below. +%D An example of fall back modes is given below. %D The automated namespace stuff is new and yet undocumented %D (see resource libraries for usage). -\def\xautoXMLnamespace#1% fast internal one +\def\xautoXMLnamespace#1% fast internal one {\ifcsname\@@XMLnamespace-#1\endcsname\else \@EA\appendtoks\csname\@@XMLnamespace-#1\endcsname\to\autoXMLnamespaces \fi @@ -758,26 +758,26 @@ \def\doautoXMLnamespace#1% \done is set before list {\ifdone\else\automateXMLnamespace#1\fi} -\def\automateXMLnamespaceA#1% +\def\automateXMLnamespaceA#1% {\ifcsname\@@XMLelement:#1:\checkedXMLnamespace\endcsname \let\currentXMLnamespace#1% \else\ifcsname\@@XMLelement:#1:\checkedXMLnamespace/\endcsname \let\currentXMLnamespace#1% - \fi\fi} + \fi\fi} \let\automateXMLnamespaceB\automateXMLnamespaceA \let\automateXMLnamespaceC\automateXMLnamespaceA -\def\automateXMLnamespaceD#1% +\def\automateXMLnamespaceD#1% {\ifcsname\@@XMLelement:#1:\checkedXMLnamespace\endcsname \let\currentXMLnamespace#1% \else\ifcsname\normal@@XMLelement:#1:\checkedXMLnamespace\endcsname \let\currentXMLnamespace#1% \else - \automateXMLnamespaceDD#1% + \automateXMLnamespaceDD#1% \fi\fi} -\def\automateXMLnamespaceDD#1% +\def\automateXMLnamespaceDD#1% {\ifcsname\@@XMLelement:#1:\checkedXMLnamespace/\endcsname \let\currentXMLnamespace#1% \else\ifcsname\normal@@XMLelement:#1:\checkedXMLnamespace/\endcsname @@ -785,7 +785,7 @@ \fi\fi} %D Later we will implement the error handler, here we handle -%D the default case. +%D the default case. \def\someXMLelementID#1% {\ifnum\kindofXMLelement=\endXMLtag /\fi @@ -795,24 +795,24 @@ \def\defaultXMLelementID {\someXMLelementID\s!default} -%D It is possible to keep track of nesting automatically, -%D but this would kind of prohibit things like \type -%D {\ignorespaces}. In the future we may provide an -%D automatic depth tracking as an alternative (exclusive) -%D mode of operation combined with space grabbing. +%D It is possible to keep track of nesting automatically, +%D but this would kind of prohibit things like \type +%D {\ignorespaces}. In the future we may provide an +%D automatic depth tracking as an alternative (exclusive) +%D mode of operation combined with space grabbing. \def\beginXMLelement - {\global\advance\XMLdepth\plusone + {\global\advance\XMLdepth\plusone \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\currentXMLelement} \def\endXMLelement - {\global\advance\XMLdepth\minusone} + {\global\advance\XMLdepth\minusone} -% 0 = nothing +% 0 = nothing % 1 = unknown -% 2 = current element +% 2 = current element -\chardef\XMLancestormode=2 % never change this one globally +\chardef\XMLancestormode=2 % never change this one globally \def\XMLancestor#1% {\ifnum\numexpr(\XMLdepth-#1)>0 @@ -832,70 +832,70 @@ \def\XMLpureparent {\XMLpureancestor\plusone} -% \defineXMLenvironment[one] +% \defineXMLenvironment[one] % {\beginXMLelement} % {\endXMLelement} -% -% \defineXMLenvironment[two] +% +% \defineXMLenvironment[two] % {\beginXMLelement % \starttabulate -% \NC ancestor 1 \NC \XMLancestor{1} \NC \NR -% \NC ancestor 2 \NC \XMLancestor{2} \NC \NR -% \NC ancestor 3 \NC \XMLancestor{3} \NC \NR -% \NC ancestor 4 \NC \XMLancestor{4} \NC \NR +% \NC ancestor 1 \NC \XMLancestor{1} \NC \NR +% \NC ancestor 2 \NC \XMLancestor{2} \NC \NR +% \NC ancestor 3 \NC \XMLancestor{3} \NC \NR +% \NC ancestor 4 \NC \XMLancestor{4} \NC \NR % \stoptabulate} % {\endXMLelement} -% +% % \startbuffer -% <x:one> <x:two> <one> <two> </two> </one> </x:two> </x:one> +% <x:one> <x:two> <one> <two> </two> </one> </x:two> </x:one> % \stopbuffer -% +% % {fallback A: \setXMLfallbackmode 0 \processXMLbuffer}\par % {fallback B: \setXMLfallbackmode 1 \processXMLbuffer}\par % {fallback C: \setXMLfallbackmode 2 \processXMLbuffer}\par -% todo: split #1 into raws en reconstruct, set current etc, push and pop +% todo: split #1 into raws en reconstruct, set current etc, push and pop % % \def\beginXMLelement % {\dosingleempty\dobeginXMLelement} -% +% % \def\dobeginXMLelement[#1]% -% {\global\advance\XMLdepth 1 +% {\global\advance\XMLdepth 1 % \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\currentXMLelement % \global\@EA\edef\csname\@@XMLdopth:\the\XMLdepth\endcsname{\ownXMLelement}% % \iffirstargument\edef\ownXMLelement{#1}\fi} -% +% % \def\endXMLelement % {\@EA\let\@EA\ownXMLelement\csname\@@XMLdopth:\the\XMLdepth\endcsname % \global\advance\XMLdepth -1 } -%D \defineXMLenvironment[one] +%D \defineXMLenvironment[one] %D {\beginXMLelement} %D {\endXMLelement} -%D -%D \defineXMLenvironment[two] +%D +%D \defineXMLenvironment[two] %D {\beginXMLelement %D \starttabulate -%D \NC parent 1 \NC \XMLparent{1} \NC \NR -%D \NC parent 2 \NC \XMLparent{2} \NC \NR -%D \NC parent 3 \NC \XMLparent{3} \NC \NR -%D \NC parent 4 \NC \XMLparent{4} \NC \NR +%D \NC parent 1 \NC \XMLparent{1} \NC \NR +%D \NC parent 2 \NC \XMLparent{2} \NC \NR +%D \NC parent 3 \NC \XMLparent{3} \NC \NR +%D \NC parent 4 \NC \XMLparent{4} \NC \NR %D \stoptabulate} %D {\endXMLelement} -%D +%D %D \startbuffer -%D <x:one> <x:two> <one> <two> </two> </one> </x:two> </x:one> +%D <x:one> <x:two> <one> <two> </two> </one> </x:two> </x:one> %D \stopbuffer -%D +%D %D fallback A: \setXMLfallbacklevel0 \processXMLbuffer %D fallback B: \setXMLfallbacklevel1 \processXMLbuffer %D fallback C: \setXMLfallbacklevel2 \processXMLbuffer -%D Here we do the namespace (re)mapping. More examples are -%D provided in the manual. +%D Here we do the namespace (re)mapping. More examples are +%D provided in the manual. %D %D \starttypen -%D \supportXMLnamespace [test] % needed to get a namespace working +%D \supportXMLnamespace [test] % needed to get a namespace working %D \skipXMLnamespace [test] % slow %D \ignoreXMLnamespace [test] % faster %D \defineXMLenvironment [rubish:itemize] {[} {]} @@ -909,8 +909,8 @@ \newtoks\autoXMLnamespaces -%D The automatically mapped namespaces (the fallbacks so to -%D day) are collected in a token list. +%D The automatically mapped namespaces (the fallbacks so to +%D day) are collected in a token list. \let\checkedXMLnamespace\empty @@ -918,13 +918,13 @@ {\edef\checkedXMLnamespace{#1}% \ifcsname\@@XMLnamespace:\currentXMLnamespace\endcsname \csname\@@XMLnamespace:\currentXMLnamespace\endcsname - % forced namespace + % forced namespace \else\ifcsname\@@XMLelement:\currentXMLelement\endcsname - % natural element + % natural element \else\ifcsname\@@XMLelement:\currentXMLelement/\endcsname - % natural element + % natural element \else - % locate fallback + % locate fallback \donefalse\the\autoXMLnamespaces \fi\fi\fi} @@ -945,9 +945,9 @@ \def\ignoreXMLnamespace[#1]% {\letvalue{\@@XMLnamespace:#1}\doXMLignorenamespace} -\def\doXMLignorenamespace % \let binnen def +\def\doXMLignorenamespace % \let binnen def {\long\@EA\def\csname\@@XMLelement:\checkedXMLnamespace\endcsname - {\@EA\redoXMLignore\@EA{\checkedXMLnamespace}}} % EA ? + {\@EA\redoXMLignore\@EA{\checkedXMLnamespace}}} % EA ? \def\remapXMLnamespace {\dodoubleargument\doremapXMLnamespace} @@ -965,14 +965,14 @@ \def\dosupportXMLnamespace[#1]% {\setvalue{\@@XMLnamespace:#1}{\def\currentXMLnamespace{#1}}} -\def\xremapXMLnamespace#1#2% fast internal one +\def\xremapXMLnamespace#1#2% fast internal one {\@EA\edef\csname\@@XMLnamespace:#1\endcsname {\def\noexpand\currentXMLnamespace{#2}}} \def\autoXMLnamespace[#1]% {\xautoXMLnamespace{#1}} -\def\xautoXMLnamespace#1% fast internal one +\def\xautoXMLnamespace#1% fast internal one {\ifcsname\@@XMLnamespace-#1\endcsname\else \@EA\appendtoks\csname\@@XMLnamespace-#1\endcsname\to\autoXMLnamespaces \fi @@ -998,8 +998,8 @@ \def\doremapXMLurlspace[#1][#2]% {\setvalue{\@@XMLurlspace:#1}{#2}} -%D Entities needs a bit more work, as well as a connection -%D with the encoding handlers. +%D Entities needs a bit more work, as well as a connection +%D with the encoding handlers. % we need to be able to do: % @@ -1013,13 +1013,13 @@ % % so we need an ifless implementation -% \eacute -> simplified -> e (via raw encoding) -% -> raw -> eacute (via handler) +% \eacute -> simplified -> e (via raw encoding) +% -> raw -> eacute (via handler) % % naming sucks -\newif\ifXMLrawentities % proper fallback -\newif\ifXMLsimpleentities % last resort +\newif\ifXMLrawentities % proper fallback +\newif\ifXMLsimpleentities % last resort \def\simpleXMLencoding{raw} @@ -1041,17 +1041,17 @@ {\dododefineXMLentity{#1}{\ifXMLsimpleentities#2\else#3\fi}} \def\dododefineXMLentity#1#2% - {\unspaceargument#1\to\ascii % #1 can be {[} or so + {\unspaceargument#1\to\ascii % #1 can be {[} or so \long\setvalue{\@@XMLentity:\@EA\firstofoneargument\ascii}{#2}} -\def\setXMLentity#1% fast one +\def\setXMLentity#1% fast one {\long\@EA\def\csname\@@XMLentity:#1\endcsname} -%D May this wile become dodo (more in tune with rest); -%D beware: also remapped in xtag-map. +%D May this wile become dodo (more in tune with rest); +%D beware: also remapped in xtag-map. -\def\doXMLentity#1#2;% interesting: # is now ## - {\if\string#1\letterhash +\def\doXMLentity#1#2;% interesting: # is now ## + {\if\string#1\letterhash \@EA\parseXMLcharacter \else\ifXMLrawentities \@EAEAEA\firstofoneargument @@ -1061,16 +1061,16 @@ %D Here we need to get rid of the double hash and act upon the %D number. Proper hex/oct number support can be implemented by -%D redefining \type {\executeXMLcharacter}. +%D redefining \type {\executeXMLcharacter}. -% \def\parseXMLcharacter#1% gobble the ##x -% {\@EA\executeXMLcharacter\@EA{\gobblethreearguments#1}} +% \def\parseXMLcharacter#1% gobble the ##x +% {\@EA\executeXMLcharacter\@EA{\gobblethreearguments#1}} +% +% single hash now +% +% \def\parseXMLcharacter#1% +% {\@EA\executeXMLcharacter\@EA{\gobbleoneargument#1}} % -% single hash now -% -% \def\parseXMLcharacter#1% -% {\@EA\executeXMLcharacter\@EA{\gobbleoneargument#1}} -% % \def\executeXMLcharacter#1% can be overloaded % {\ifnum"#1<256 % \@EA\getXMLcharacter @@ -1079,13 +1079,13 @@ % \else % \@EAEAEA\unknownXMLcharacter % \fi\fi{\number"#1}} -% -% \unexpanded\def\getXMLcharacter#1{\rawcharacter{#1}} +% +% \unexpanded\def\getXMLcharacter#1{\rawcharacter{#1}} -\def\parseXMLcharacter#1% - {\@EA\executeXMLcharacter\gobbleoneargument#1\empty\relax} - -\def\executeXMLcharacter#1#2\relax +\def\parseXMLcharacter#1% + {\@EA\executeXMLcharacter\gobbleoneargument#1\empty\relax} + +\def\executeXMLcharacter#1#2\relax {\if#1x% \@EA\executeXMLhexcharacter \else @@ -1113,7 +1113,7 @@ \@EAEAEA\unknownXMLcharacter \fi\fi{\number"#1}} -% == +% == % % \def\executeXMLhexcharacter x#1\relax % {\uppercase{\ifnum"#1}<256 @@ -1142,52 +1142,52 @@ \@EA\unicodechar % was: \rawcharacter \fi{#1}} -\def\unknownXMLcharacter#1{[#1]} +\def\unknownXMLcharacter#1{[#1]} -% \useXMLfilter[ent] -% +% \useXMLfilter[ent] +% % \defineXMLsingular[test]{{\simplifyXMLentities\XMLpar{test}{bla}{}}} -% +% % \startXMLdata % <test bla="Óblaébla&tex;and$andüziezoྙ" /> % \stopXMLdata -% +% % \defineXMLentity[45]{|it works|} % {|-|} -% +% % \startXMLdata % text-.text % textEFtext % \stopXMLdata -%D May be this will change a bit ... +%D May be this will change a bit ... -\def\executeXMLentity#1% named one +\def\executeXMLentity#1% named one {\getXMLentity{#1}} %\def\expandedXMLentity#1% -% {\ifcsname\@@XMLentity:#1\endcsname\csname\@@XMLentity:#1\endcsname\fi} +% {\ifcsname\@@XMLentity:#1\endcsname\csname\@@XMLentity:#1\endcsname\fi} % %\unexpanded\def\getXMLentity#1% -% {\ifcsname\@@XMLentity:#1\endcsname\csname\@@XMLentity:#1\endcsname\fi} +% {\ifcsname\@@XMLentity:#1\endcsname\csname\@@XMLentity:#1\endcsname\fi} % %\def\expandedXMLentity#1% -% {\csname\@@XMLentity:#1\endcsname} +% {\csname\@@XMLentity:#1\endcsname} % %\unexpanded\def\getXMLentity#1% -% {\csname\@@XMLentity:#1\endcsname} +% {\csname\@@XMLentity:#1\endcsname} -\newif\ifautoXMLentities % fall back on context commands +\newif\ifautoXMLentities % fall back on context commands \def\expandedXMLentity#1% {\ifcsname\@@XMLentity:#1\endcsname \@EA \execXMLentity \else\ifautoXMLentities \@EAEAEA \autoXMLentity \else \@EAEAEA \crapXMLentity - \fi\fi{#1}} + \fi\fi{#1}} -\def\execXMLentity#1% +\def\execXMLentity#1% {\csname\@@XMLentity:#1\endcsname} -\def\crapXMLentity#1% +\def\crapXMLentity#1% {\inframed[\c!offset=.1ex]{\tttf#1}} \def\autoXMLentity#1% @@ -1232,7 +1232,7 @@ \let\dosetXMLattributeA\gobbleoneargument \def\dosetXMLattributeB#1% - {\ifx\@@XMLspac\originalXMLnamespace + {\ifx\@@XMLspac\originalXMLnamespace \@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLname\endcsname{#1}% \fi} @@ -1270,7 +1270,7 @@ \let\dosetXMLattribute\dosetXMLattributeD \fi} -\setXMLattributemode{2} % a reasonable default +\setXMLattributemode{2} % a reasonable default \let\@@XMLspac\empty % argumentnamespace @@ -1288,7 +1288,7 @@ % \long\def\doparseXMLarguments#1% space goes ok % {\if#1>% % \let\dodoparseXMLarguments\empty -% \else\if#1=% +% \else\if#1=% % \edef\@@XMLname{\the\XMLtoks}% % \XMLtoks\emptytoks % \else\if#1"% @@ -1307,7 +1307,7 @@ % \dodoparseXMLarguments} % % The next speed optimization is suggested by Taco. Since we -% are dealing with validated code, we can grab larger chunks. +% are dealing with validated code, we can grab larger chunks. \long\def\doparseXMLarguments#1% space goes ok {\if#1>% @@ -1341,8 +1341,8 @@ \edef\@@XMLspac{#1}% \fi} -% ok ? -% +% ok ? +% % \def\dodoparseXMLargumentsX#1=#2% % {\edef\@@XMLname{\the\XMLtoks#1}% % \@EA\getXMLNSSSS\@@XMLname:\relax @@ -1353,9 +1353,9 @@ % \@EA\dodoparseXMLargumentsS % \fi} -% Storing \type {#1} in a macro in order to minimize the -% amount of data passed as argument does not improve -% performance, so we keep the readable form. +% Storing \type {#1} in a macro in order to minimize the +% amount of data passed as argument does not improve +% performance, so we keep the readable form. \def\dodoparseXMLargumentsD#1"{\dosetXMLargument{#1}} \def\dodoparseXMLargumentsS#1'{\dosetXMLargument{#1}} @@ -1376,7 +1376,7 @@ \let\dodoparseXMLarguments\doparseXMLarguments \dodoparseXMLarguments} -\def\dosetXMLargument#1% ugly alternative +\def\dosetXMLargument#1% ugly alternative {\ifXMLnamespace \XMLnamespacefalse \ifx\@@XMLspac\@@XMLns @@ -1422,7 +1422,7 @@ \bgroup \enableXMLexpansion \let\getXMLentity\expandedXMLentity - #1% simplify maps entities back to _ and alike + #1% simplify maps entities back to _ and alike \expanded{\global\globalscratchtoks{\csname#2\endcsname}}% \egroup \@EA\edef\csname#2\endcsname{\the\globalscratchtoks}% @@ -1446,7 +1446,7 @@ %D \starttabulate[||||] %D \HL %D \NC \bf mode \NC \bf call \NC \bf result \NC\NR -%D \HL +%D \HL %D \NC 0\NC\asciistr{\XMLpar {fx:root} {crap} {}} \NC dirt \NC\NR %D \NC \NC\asciistr{\XMLpar {fx:root} {junk} {}} \NC \NC\NR %D \NC \NC\asciistr{\XMLNSpar {fx:root} {fx} {crap} {}}\NC \NC\NR @@ -1468,10 +1468,10 @@ %D \NC \NC\asciistr{\XMLNSpar {fx:root} {xml} {lang} {}}\NC en \NC\NR %D \HL %D \stoptabulate} -%D +%D %D \remapXMLurlspace [http://www.w3.org/1999/XSL/Format] [fx] %D \stopbuffer -%D +%D %D \startbuffer[xml] %D <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" %D fo:crap="rubish" @@ -1480,14 +1480,14 @@ %D crap="dirt" /> %D \stopbuffer %D -%D \typebuffer[tex] \processTEXbuffer[tex] +%D \typebuffer[tex] \processTEXbuffer[tex] %D \typebuffer[xml] \processXMLbuffer[xml] %D The previous macros were the basic parser and their working %D is left to the imagination of the reader. These macros -%D will be improved over time. We use rather low level -%D definitions so that the mappings will run as fast as -%D possible. +%D will be improved over time. We use rather low level +%D definitions so that the mappings will run as fast as +%D possible. \bgroup \catcode`<=\@@active @@ -1539,7 +1539,7 @@ \next} \long\gdef\dododefineXMLenvironment#1#2#3% - {\long\setvalue{\@@XMLelement:#1/}{#2#3}% + {\long\setvalue{\@@XMLelement:#1/}{#2#3}% \long\setvalue{\@@XMLelement:#1}{#2}% \long\setvalue{\@@XMLelement:/#1}{#3}} @@ -1704,11 +1704,11 @@ % command element [map] [parlst] begin end -\long\def\defineXMLmethod#1#2#3#4#5#6% +\long\def\defineXMLmethod#1#2#3#4#5#6% {\ifsecondargument \setXMLarguments{#2}{#3}{#4}% \else - \resetXMLarguments{#2}% new + \resetXMLarguments{#2}% new \fi #1{#2}{#5}{#6}} @@ -1727,6 +1727,10 @@ \presetXMLarguments\rawXMLidentifier \to \everyXMLelement +\appendtoks + \disablelanguagespecifics % interesting what kind of things are needed ... +\to \everyenableXML + \long\def\longempty{} \long\def\longspace{ } @@ -1735,16 +1739,16 @@ % \expandafter\secondoftwoarguments % \else % \expandafter\firstoftwoarguments -% \fi} +% \fi} % % \def\doifXMLdata#1% always empty at start [gets a long assignment] % {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty % \expandafter\gobbleoneargument % \else % \expandafter\firstofoneargument -% \fi} +% \fi} % -% \let\doifXMLdataelse\doifelseXMLdata +% \let\doifXMLdataelse\doifelseXMLdata \def\doifelseXMLdata#1% always empty at start [gets a long assignment] {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty @@ -1762,16 +1766,16 @@ \let\doifXMLdataelse\doifelseXMLdata -\def\doifelseXMLempty#1% +\def\doifelseXMLempty#1% {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty \expandafter\firstoftwoarguments \else\@EA\ifx\csname\@@XMLdata:#1\endcsname\longspace \expandthree\firstoftwoarguments \else \expandthree\secondoftwoarguments - \fi\fi} + \fi\fi} -% test case: +% test case: % % \defineXMLenvironmentsave[test] % {} @@ -1780,7 +1784,7 @@ % \message{/} % \message{\doifelseXMLempty{test}{}{not }empty} % \wait} -% +% % \startXMLdata % <test>xxx</test> % <test></test> @@ -1813,11 +1817,11 @@ \let\XMLpopdata\XMLflushdata -\def\XMLappend#1#2% let to empty expands to nothing -) +\def\XMLappend#1#2% let to empty expands to nothing -) {\long\@EA\edef\csname\@@XMLdata:#1\endcsname {\csname\@@XMLdata:#1\endcsname#2}} -\def\XMLprepend#1#2% let to empty expands to nothing -) +\def\XMLprepend#1#2% let to empty expands to nothing -) {\long\@EA\edef\csname\@@XMLdata:#1\endcsname {#2\csname\@@XMLdata:#1\endcsname}} @@ -1846,7 +1850,7 @@ \enableXMLexpansion \simplifyXMLelements \simplifyXMLentities - \let\getXMLentity\expandedXMLentity % should this go in \simplify ? + \let\getXMLentity\expandedXMLentity % should this go in \simplify ? \xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}% \egroup \convertcommand\@@XML@@string\to#1} @@ -1854,7 +1858,7 @@ \def\XMLshow#1% {\showvalue{\@@XMLdata:#1}} -\def\XMLunspace#1% kan sneller +\def\XMLunspace#1% kan sneller {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty\else \long\@EA\edef\csname\@@XMLdata:#1\endcsname {\@EAEAEA\dounspaced\csname\@@XMLdata:#1\endcsname\end}% @@ -1923,14 +1927,14 @@ \def\setXMLpar#1#2% {\@EA\def\csname\@@XMLvariable:#1:#2\endcsname} -\def\TEXpar#1#2% +\def\TEXpar#1#2% {\csname#1\interfaced{#2}\endcsname} -\let\texXMLpar\TEXpar % soon obsolete +\let\texXMLpar\TEXpar % soon obsolete \let\XMLtex\TEXpar -% handy one +% handy one \def\XMLtyp#1#2#3% {\ifcsname\@@XMLvariable:#1:#2\endcsname @@ -1960,9 +1964,9 @@ \fi} \def\doifXMLvarelse#1#2% geen etex, \relax too - {\ifcsname\@@XMLvariable:#1:#2\endcsname + {\ifcsname\@@XMLvariable:#1:#2\endcsname %\expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\relax -% \message{#1 #2 -> relax}\wait +% \message{#1 #2 -> relax}\wait %\fi \expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\empty \@EAEAEA\secondoftwoarguments @@ -1974,7 +1978,7 @@ \fi} \def\doifXMLvar#1#2% geen etex, \relax too - {\ifcsname\@@XMLvariable:#1:#2\endcsname + {\ifcsname\@@XMLvariable:#1:#2\endcsname \expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\empty \@EAEAEA\gobbleoneargument \else @@ -1985,7 +1989,7 @@ \fi} \def\doifXMLvalelse#1#2% geen etex, \relax too - {\ifcsname\@@XMLvalue:#1:#2\endcsname + {\ifcsname\@@XMLvalue:#1:#2\endcsname \expandafter\ifx\csname\@@XMLvalue:#1:#2\endcsname\empty \@EAEAEA\secondoftwoarguments \else @@ -2017,10 +2021,10 @@ \def\ownXMLelement{\rawXMLnamespace\rawXMLidentifier} -\def\XMLop#1% ownpar +\def\XMLop#1% ownpar {\csname\@@XMLvariable:\ownXMLelement:#1\endcsname} -\def\XMLtp#1% texpar +\def\XMLtp#1% texpar {\csname\@@XMLmapmap\interfaced{#1}\endcsname} \def\doifelseXMLop#1{\doifelse{\XMLop{#1}}} @@ -2061,7 +2065,7 @@ {\begingroup \protectXMLdata \dostartXMLcode} - + \long\def\dostartXMLcode[#1] #2 \stopXMLcode {\@EA\gdef\csname\@@XMLcode:#1\endcsname{\startXMLdata#2\stopXMLdata}% \endgroup} @@ -2102,7 +2106,7 @@ % % currently: -\unexpanded\def\XMLdata % # safe +\unexpanded\def\XMLdata % # safe {\begingroup \protectXMLdata \doXMLdata} @@ -2173,7 +2177,7 @@ %D Loading specific modules takes place with \type %D {\useXMLfilters}. -% todo: flag +% todo: flag \def\useXMLfilter[#1]% {\processcommalist[#1]\douseXMLfilter} @@ -2223,7 +2227,7 @@ % \dosplitstring#2@@#1@@\end} \long\gdef\docountXMLgrouped#1\end#2\end % 1 relax is enough since it's - {\long\def\dosplitstring##1#1##2\relax\relax##3\end % another regime + {\long\def\dosplitstring##1#1##2\relax\relax##3\end % another regime {\def\ascii{##2}% \ifx\ascii\empty \else \advance\scratchcounter \plusone @@ -2231,7 +2235,7 @@ \fi}% \dosplitstring#2\relax\relax#1\relax\relax\end} -\long\unexpanded\gdef\getXMLgrouped#1% #1 kan weg % klopt dit nu? +\long\unexpanded\gdef\getXMLgrouped#1% #1 kan weg % klopt dit nu? {\groupedtoks\emptytoks \scratchcounter\zerocount \edef\theXMLnamespace @@ -2270,19 +2274,19 @@ \def\doXMLifequalelse#1#2% {\@EA\@@ifequal#1\relax\@@and#2\relax\@@then} -%D \starttypen +%D \starttypen %D \defineXMLenvironment[test][a=1] %D {\XMLownifequalelse{a}{2}{YES}{NO}} %D {} -%D +%D %D \defineXMLenvironment[test][a=1] %D {\XMLifequalelse{test}{a}{1}{YES}{NO}} %D {} -%D +%D %D \startXMLdata %D <test a="1">test</test> %D \stopXMLdata -%D \stoptypen +%D \stoptypen \def\XMLyes#1{\XMLownifequalelse{#1}{yes}{#1}{}} |