From 333ecddc7acc53b73aae17ad7b8a7f36d423f989 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 10 Dec 2010 15:15:00 +0100 Subject: beta 2010.12.10 15:15 --- tex/context/base/supp-box.mkiv | 605 +++++------------------------------------ 1 file changed, 64 insertions(+), 541 deletions(-) (limited to 'tex/context/base/supp-box.mkiv') diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index 2ccb29149..a66d7b97d 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -11,16 +11,16 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D This module implements some box manipulation macros. Some -%D are quite simple, some are more advanced and when understood -%D well, all can be of use. - -%D No longer generic, why bother. - \writestatus{loading}{ConTeXt Support Macros / Boxes} \unprotect +\registerctxluafile{supp-box}{1.001} + +%D This module implements some box manipulation macros. Some +%D are quite simple, some are more advanced and when understood +%D well, all can be of use. +%D %D \macros %D {strutdp,strutht,strutwd} %D @@ -33,19 +33,14 @@ \def\strutdp{\dp\strutbox} \def\strutht{\ht\strutbox} \def\strutwd{\wd\strutbox} - + %D \macros %D {resetbox, emptybox} %D %D Let's start with an easy one. The next macro hides the %D ugly \type {@} in \type {\voidb@x}. -\ifx\voidbox\undefined \newbox\voidbox \fi -\ifx\voidb@x\undefined \let\voidb@x\voidbox \fi - -\def\emptybox {\box \voidbox} -\def\unvoidbox {\unhbox\voidbox} -\def\resetbox#1{\setbox#1\box\voidbox} +\ifx\voidbox\undefined \newbox\voidbox \fi %D \macros %D {nextdepth} @@ -219,7 +214,7 @@ %D \NC tb \NC \ruledhbox{\smash [tb]{This is some great smashing, isn't it?}} \NC \NR %D \NC whd \NC \ruledhbox{\smash[whd]{This is some great smashing, isn't it?}} \NC \NR %D \stoptabulate - + %D \macros %D {phantom, hphantom, vphantom, mathstrut} %D @@ -263,7 +258,7 @@ %D We also define plain's \type {\mathstrut}. \unexpanded\def\mathstrut{\vphantom{(}} - + %D \macros %D {getboxheight} %D @@ -301,7 +296,7 @@ \def\getboxheight#1\of#2\box#3% {\def\next{#1\dimexpr\ht\registercount+\dp\registercount\relax}% \afterassignment\next\registercount=#3} - + %D For a long time the following three macros were part of %D the grid snapping core module, but it makes more sense to %D have them here so that users can see them. @@ -350,48 +345,6 @@ \newcount\noflines \newdimen\noflinesheight -% \def\getnoflines {\xdogetnoflines\plusone } % compensated -% \def\getroundednoflines{\xdogetnoflines\plustwo } % rounded -% \def\getrawnoflines {\xdogetnoflines\plusthree} % truncated -% -% \def\xdogetnoflines#1#2% -% {\noflinesheight#2\relax -% \ifzeropt\noflinesheight -% \noflines\zerocount -% \else\ifdim\noflinesheight>\zeropoint -% \ifcase#1\or -% \advance\noflinesheight-\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \advance\noflines\plusone -% \or -% \advance\noflinesheight\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \or -% \advance\noflinesheight\roundingeps -% \advance\noflinesheight.5\openlineheight -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \fi -% \else -% \ifcase#1\or -% \advance\noflinesheight\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \advance\noflines\minusone -% \or -% \advance\noflinesheight-\roundingeps -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \or -% \advance\noflinesheight-\roundingeps -% \advance\noflinesheight-.5\openlineheight -% \divide\noflinesheight\openlineheight -% \noflines\noflinesheight -% \fi -% \fi\fi} - \def\getnoflines#1% {\noflinesheight#1\relax \ifzeropt\noflinesheight @@ -475,23 +428,24 @@ %D \determinenoflines{\definedfont[Sans at 40pt]test\\test} %D \stoptyping -\def\determinenoflines % can be mkiv'd +\def\dodeterminenoflines % can be mkiv'd + {\beginofshapebox + \unvbox\nextbox + \endofshapebox + % \global\count1\zerocount + % \reshapebox{\global\advance\count1\plusone}% + % \egroup\noflines\count1 }% + \scratchcounter\zerocount + \reshapebox{\global\advance\scratchcounter\plusone}% + \expandafter\egroup\expandafter\noflines\the\scratchcounter\relax} + +\def\determinenoflines {\bgroup \forgetall \let\crlf\endgraf \let\\\endgraf - \dowithnextbox - {\beginofshapebox - \unvbox\nextbox - \endofshapebox - % \global\count1\zerocount - % \reshapebox{\global\advance\count1\plusone}% - % \egroup\noflines\count1 }% - \scratchcounter\zerocount - \reshapebox{\global\advance\scratchcounter\plusone}% - \expandafter\egroup\expandafter\noflines\the\scratchcounter\relax - }\vbox} - + \dowithnextbox{\dodeterminenoflines}\vbox} + %D \macros %D {doiftextelse, doiftext} %D @@ -517,7 +471,7 @@ \def\doiftext#1#2% {\doiftextelse{#1}{#2}\donothing} - + %D \macros %D {dowithnextbox,nextbox} %D @@ -833,8 +787,6 @@ \def\shapesignal{.12345678pt} % or 12345sp -% todo: in etex lastnode - \def\reshapebox#1% {\doreshapebox {#1}% @@ -853,7 +805,7 @@ \else \setbox\newshapebox\normalvbox {\unvcopy\oldshapebox - \resetbox\newshapebox + \setbox\newshapebox\emptybox \shapecounter\zerocount \doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}}% \setbox\newshapebox\box\tmpshapebox @@ -861,59 +813,6 @@ \ifx\originalshapebox\undefined \let\originalshapebox\oldshapebox \fi -% %D The old traditional tex variant: -% -% \def\insertshapesignal -% {\normalhbox to \shapesignal{\strut\hss}% plus \strut -% \prevdepth\strutdp} % never \nointerlineskip -% -% \def\restoreshapebox % compensates for the signal -% {\global\setbox\tmpshapebox\vbox{\vskip-\lineheight\unvcopy\oldshapebox}} -% -% \def\shapeboxstrut % put this in front if needed ! -% {\vrule\!!width\zeropoint\!!height\ht\shapebox\!!depth\dp\shapebox} -% -% \def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip -% {\ifzeropt\lastskip % \ifdim\lastskip=\zeropoint\relax -% \ifzeropt\lastkern % \ifdim\lastkern=\zeropoint\relax -% \ifcase\lastpenalty % \ifnum\lastpenalty=\zerocount -% \setbox\shapebox\lastbox -% \ifvoid\shapebox -% \unskip\unpenalty\unkern -% \else -% \ifdim\wd\shapebox=\shapesignal\relax -% \exitloop -% \else -% \shapecounter\zerocount -% \global\setbox\tmpshapebox\normalvbox{#1\unvbox\tmpshapebox}% -% \fi -% \fi -% \else -% \shapepenalty\lastpenalty -% \global\setbox\tmpshapebox\normalvbox{#2\unvbox\tmpshapebox}% -% \unpenalty -% \fi -% \else -% \shapekern\lastkern -% \global\setbox\tmpshapebox\normalvbox{#3\unvbox\tmpshapebox}% -% \unkern -% \fi -% \else -% \shapeskip\lastskip -% \global\setbox\tmpshapebox\normalvbox{#4\unvbox\tmpshapebox}% -% \unskip -% \fi -% \ifnum\shapecounter>100 % can be less -% \global\reshapingfailedtrue -% \message{!!forced exit from shapebox!!}% -% \restoreshapebox -% \exitloop -% \else -% \advance\shapecounter \plusone -% \fi} -% -% But now that the lastnode bugfixes are wide spread we can use: -% % We will turn this into a \MKIV\ variant. \def\insertshapesignal @@ -1047,142 +946,47 @@ %D of \type {\normalhbox}, since it manages the height and depth of %D the line. -% \def\shapedhbox -% {\dowithnextbox -% {\nextboxht\zeropoint -% \nextboxdp\zeropoint -% \flushnextbox} -% \normalhbox} - \def\shapedhbox % lines with non strutted dimensions have {\expanded{\dowithnextbox % interlineskip so if we want the original {\nextboxht\the\ht\shapebox % spacing, we need to preserve the original \nextboxdp\the\dp\shapebox % height and depth which is definitely \noexpand\flushnextbox}} % needed if we apply struts to the 'new' \normalhbox} % box or do something that changed ist size - + %D \macros %D {hyphenatedword, %D hyphenatedpar, %D hyphenatedfile, %D dohyphenateword} %D -%D The next one is a tricky one. \PLAIN\ \TEX\ provides -%D \type{\showhyphens} for showing macros on the terminal. When -%D preparing a long list of words we decided to show the -%D hyphens, but had to find out that the \PLAIN\ alternative -%D can hardly be used and|/|or adapted to typesetting. The next -%D two macros do the job and a little more. First we define the -%D (slightly adapted) plain variant: - -\def\showhyphens#1% - {\begingroup - \setbox\scratchbox\vbox - {\parfillskip\zerocount - \hsize\maxdimen - %\tenrm - \pretolerance\minusone - \tolerance\minusone - \hbadness\zerocount - \showboxdepth\zerocount - \ #1}% - \endgroup} - -%D The simple command \type{\hyphenatedword} accepts one -%D argument and gives the hyphenated word. This macro calls for +%D We no longer use the pure \TEX\ variant. In due time we will +%D report some more advanced statistics. %D %D \starttyping -%D \dohyphenateword {n} {pre} {word} +%D \showhyphens{dohyphenatedword} %D \stoptyping -%D -%D The next examples tell more than lots of words: -%D -%D \startbuffer -%D \dohyphenateword{0} {} {dohyphenatedword} -%D \dohyphenateword{1} {...} {dohyphenatedword} -%D \dohyphenateword{2} {...} {dohyphenatedword} -%D \stopbuffer -%D -%D \typebuffer -%D -%D Here, \type{\hyphenatedword{dohyphenatedword}} is the -%D shorter alternative for the first line. -%D -%D \startvoorbeeld -%D \getbuffer -%D \stopvoorbeeld -%D -%D These macros are slow but effective and not that hard to -%D program at all. -\ifx\scantokens\undefined \let\scantokens\firstofoneargument \fi +\def\doshowhyphenatednextbox + {\ctxlua{commands.showhyphenatedinlist(tex.box[\number\nextbox].list)}} -\def\dohyphenateword#1#2#3% - {\bgroup - \setbox\scratchbox\normalhbox - {\dontcomplain - \nopenalties % \widowpenalty \clubpenalty \brokenpenalty \doublehyphendemerits \finalhyphendemerits \adjdemerits - \hyphenpenalty \zerocount - \exhyphenpenalty\zerocount - \setbox0\normalvbox - {\hsize\zeropoint - \hskip\zeropoint\relax % really needed - \ifnum#1<\zeropoint - \obeyspaces - \obeylines - \def\obeyedspace{\hskip\zeropoint\hbox to \onepoint{}\hskip\zeropoint}% - \let\obeyedline \obeyedspace - \ifcase-#1\or - \def\next{#3\relax}\scantokens\expandafter{\next}% relax catches lookahead problem - % also ok: \scantokens{#3}% % as in \hyphenatedword{spanish|?|} - \or - \readfile{#3}\donothing\donothing - \else - #3% - \fi - \else - #3% - \fi}% - \ifnum#1>\zerocount - \dorecurse{#1} - {\setbox2\normalhbox - {\splittopskip\openstrutheight - \vsplit0 to \baselineskip}}% - #2% - \fi - \doloop - {\setbox2\normalhbox - {\splittopskip\openstrutheight - \vsplit0 to \baselineskip}% - \setbox2\normalhbox - {\unhbox2 - \setbox2\lastbox - \normalvbox - {\unvbox2 - \setbox2\lastbox - \normalhbox{\unhbox2}}}% - \ifnum#1<\zeropoint\ifdim\wd2=\onepoint\space\else\box2\allowbreak\fi\else\box2\fi - \ifzeropt\ht0 \exitloop\fi}% % \ifdim\ht0=\zeropoint\exitloop\fi}% - \removeunwantedspaces}% - \ifnum#1>\zerocount - \ht\scratchbox\strutht - \dp\scratchbox\strutdp - \box\scratchbox - \else - \unhbox\scratchbox - \fi - \egroup} - -\def\hyphenatedword{\dohyphenateword\zerocount\empty} -\def\hyphenatedpar {\dohyphenateword\minusone \empty} -\def\hyphenatedfile{\dohyphenateword{-2}\empty} +\def\showhyphens{\dowithnextbox\doshowhyphenatednextbox\hbox} -%D You may want to give the following call a try: +%D The following macros are seldom used but handy for tracing. %D %D \starttyping -%D \hyphenatedpar{\readfile{zapf}{}{}}\endgraf +%D \hyphenatedword{dohyphenatedword} +%D \hyphenatedpar {\dorecurse{10}{dohyphenatedword }} +%D \hyphenatedfile{tufte} %D \stoptyping - + +\def\dohyphenatednextbox + {\ctxlua{commands.hyphenatedlist(tex.box[\number\nextbox])}% + \unhbox\nextbox} + +\def\hyphenatedword {\dowithnextbox\dohyphenatednextbox \hbox} +\def\hyphenatedpar {\dowithnextbox\dohyphenatednextbox \hbox} +\def\hyphenatedfile#1{\dowithnextbox\dohyphenatednextbox \hbox{\readfile{#1}\donothing\donothing}} + %D \macros %D {processtokens} %D @@ -1249,7 +1053,7 @@ \let\savedbefore\before \doprocesstokens#5\lastcharacter \endgroup} - + %D \macros %D {doboundtext} %D @@ -1273,7 +1077,7 @@ \advance\scratchdimen -\wd0 \ifdim\scratchdimen>\zeropoint\relax#1\fi}% -\def\doboundtext#1#2#3% +\def\doboundtext#1#2#3% still used? {\normalhbox {\setbox\scratchbox\normalhbox{#1}% \scratchdimen#2\relax @@ -1283,7 +1087,7 @@ \handletokens#1\with\dodoboundtext \fi \box\scratchbox}} - + %D \macros %D {limitatetext} %D @@ -1479,7 +1283,7 @@ #1% \fi \egroup} - + %D \macros %D {processisolatedwords, %D betweenisolatedwords,nothingbetweenisolatedwords} @@ -1644,7 +1448,7 @@ \def\setbetweenisolatedwords#1% {\gdef\localbetweenisolatedwords{#1}} - + %D \macros %D {sbox} %D @@ -1716,7 +1520,7 @@ \next \egroup}% \normalhbox} - + %D \macros %D {centeredbox, centerednextbox} %D @@ -1836,7 +1640,7 @@ \normalvbox to \vsize{\vss\normalhbox to \hsize{\hss\flushnextbox\hss}\vss}% \egroup}% \normalhbox} - + %D \macros %D {setrigidcolumnhsize,rigidcolumnbalance,rigidcolumnlines} %D @@ -1994,35 +1798,6 @@ \box\scratchbox \egroup} -% % to be done: start halfway a line combined with one line -% % extra to start with (skip) and one line less than counted. -% -% \def\stopvboxtohbox% -% {\egroup -% \setbox2=\normalvbox -% {\forgetall\unhcopy0\par\xdef\globalvhlines{\the\prevgraf}}% -% \setbox2=\normalvbox -% {\unvbox2 -% \setbox2=\lastbox -% \setbox2=\normalhbox{\unhbox2}% -% \xdef\globalvhwidth{\the\wd2}}% -% \decrement\globalvhlines -% \dimen0=\globalvhwidth -% \dimen0=\normalvboxtohboxfactor\dimen0 -% \advance\dimen0 by \globalvhlines\lineheight -% \dp0=\zeropoint -% \ht0=\dimen0 -% %\writestatus{guessed size} -% % {w:\the\wd0\space\space -% % b:\the\baselineskip\space -% % l:\globalvhlines\space -% % e:\globalvhwidth\space -% % h:\the\dimen0}% -% \box0 -% \egroup} - -% todo: \scratchbox - \def\convertvboxtohbox {\setvboxtohbox \makehboxofhboxes @@ -2037,32 +1812,12 @@ \setbox0\normalhbox{\box2\unhbox0}% \repeat} -% \def\makehboxofhboxes -% {\setbox0\emptyhbox -% \doloop % \doloop { .. \exitloop .. } -% {% \dorecurse{3}{\unskip\unpenalty}% get rid of ... (better do this in a shapeloop) -% \setbox2\lastbox -% \ifhbox2 -% \setbox0\normalhbox{\box2\unhbox0}% -% \else -% \exitloop -% \fi}} - -% \def\flushboxesonly % feed this into \makehboxofhboxes -% {\dowithnextbox -% {\beginofshapebox -% \unvbox\nextbox -% \endofshapebox -% \doreshapebox{\box\shapebox}{}{}{}% get rid of penalties etc -% \innerflushshapebox} -% \vbox} - \def\removehboxes {\setbox0\lastbox \ifhbox0 {\removehboxes}\unhbox0 \fi} - + %D \macros %D {unhhbox} %D @@ -2134,7 +1889,7 @@ %D %D Not that nice a definition, but effective. Note the stretch %D we've build in the line that connects the two paragraphs. - + %D \macros %D {doifcontent} %D @@ -2184,7 +1939,7 @@ %D %D Where the last call of course does not show up in this %D document, but definitely generates a confusing message. - + %D \macros %D {processboxes} %D @@ -2196,7 +1951,7 @@ \def\processboxes#1% {\bgroup \def\doprocessbox{#1}% #1 can be redefined halfway - \resetbox\processbox + \setbox\processbox\emptybox \afterassignment\dogetprocessbox\let\next=} \def\endprocessboxes @@ -2237,31 +1992,6 @@ %D %D \leavevmode\getbuffer -% \def\dooverlaybox% -% {\ifhmode\unskip\fi -% \ifdim\nextboxht>\ht\processbox -% \setbox\processbox\normalvbox to \nextboxht -% {\vss\box\processbox\vss}% -% \else -% \setbox\nextbox\normalvbox to \ht\processbox -% {\vss\flushnextbox\vss}% -% \fi -% \scratchdimen=\wd -% \ifdim\nextboxwd>\wd\processbox -% \nextbox -% \else -% \processbox -% \fi -% \setbox\processbox=\normalhbox to \scratchdimen -% {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% -% \hskip-\scratchdimen -% \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} -% -% \def\startoverlay% -% {\bgroup -% \let\stopoverlay\egroup -% \processboxes\dooverlaybox} - \def\dooverlaybox {\ifhmode\unskip\fi \scratchdimen\dp @@ -2297,36 +2027,6 @@ \let\stopoverlay\relax -% %D \macros -% %D {starthspread} -% %D -% %D In a similar way we can build a horizontal box, spread -% %D over the available width. -% %D -% %D \startbuffer -% %D \starthspread -% %D {hans} -% %D {ton} -% %D {oeps} -% %D \stophspread -% %D -% %D \stopbuffer -% %D -% %D \typebuffer -% %D -% %D shows up as: -% %D -% %D \leavevmode\getbuffer -% -% \def\dohspread -% {\flushnextbox -% \def\dohspread{\hfil\flushnextbox}} -% -% \def\starthspread -% {\normalhbox to \hsize \bgroup -% \let\stophspread\egroup -% \processboxes\dohspread} - %D \macros %D {fakebox} %D @@ -2350,7 +2050,7 @@ \def\fakebox {\bgroup \afterassignment\dofakebox\scratchcounter} - + %D \macros %D {lbox,rbox,cbox,tbox,bbox} %D @@ -2464,7 +2164,7 @@ \@EA\afterassignment\@EA\docommand\@EA\scratchdimen \fi}% \docommand} - + %D Some new, still undocumented features: % limitatetext -> beter {text} als laatste !! @@ -2502,7 +2202,7 @@ \fi} \egroup} \normalvbox} - + %D Some more undocumented macros (used in m-chart). \newif\iftraceboxplacement % \traceboxplacementtrue @@ -2536,12 +2236,6 @@ \newdimen\boxhdisplacement \newdimen\boxvdisplacement -%\def\rightbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=.5\ht0\advance\dimen0 -.5\dp0 -% \boxcursor\hskip\boxoffset\lower\dimen0\box0}} - \def\rightbox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2550,12 +2244,6 @@ \global\advance\boxvdisplacement-.5\dp0 \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} -%\def\leftbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=.5\ht0\advance\dimen0 -.5\dp0 -% \boxcursor\hskip-\wd0\hskip-\boxoffset\lower\dimen0\box0}} - \def\leftbox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2565,12 +2253,6 @@ \global\advance\boxvdisplacement-.5\dp0 \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} -%\def\topbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \dp0 -% \boxcursor\hskip-.5\wd0\raise\dimen0\box0}} - \def\topbox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2579,12 +2261,6 @@ \global\advance\boxvdisplacement-\boxoffset \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} -%\def\bottombox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \ht0 -% \boxcursor\hskip-.5\wd0\lower\dimen0\box0}} - \def\bottombox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2593,13 +2269,6 @@ \global\advance\boxvdisplacement\boxoffset \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} -%\def\lefttopbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \dp0 -% \advance\boxoffset\wd0 -% \boxcursor\hskip-\boxoffset\raise\dimen0\box0}} - \def\lefttopbox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2609,12 +2278,6 @@ \global\advance\boxvdisplacement-\boxoffset \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} -%\def\righttopbox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \dp0 -% \boxcursor\hskip\boxoffset\raise\dimen0\box0}} - \def\righttopbox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2623,13 +2286,6 @@ \global\advance\boxvdisplacement-\boxoffset \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} -%\def\leftbottombox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \ht0 -% \advance\boxoffset\wd0 -% \boxcursor\hskip-\boxoffset\lower\dimen0\box0}} - \def\leftbottombox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2639,12 +2295,6 @@ \global\advance\boxvdisplacement\boxoffset \boxcursor\hskip\boxhdisplacement\lower\boxvdisplacement\box0}} -%\def\rightbottombox#1% -% {\normalhbox -% {\setbox0=\placedbox{#1}% -% \dimen0=\boxoffset\advance\dimen0 \ht0 -% \boxcursor\hskip\boxoffset\lower\dimen0\box0}} - \def\rightbottombox#1% {\normalhbox {\setbox0\placedbox{#1}% @@ -2683,7 +2333,7 @@ \global\boxhdisplacement\boxoffset \global\boxvdisplacement-\boxoffset \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}} - + %D \macros %D {obox} %D @@ -2695,7 +2345,7 @@ {\advance\hsize-#1\advance\hsize-#2\advance\vsize-#3\advance\vsize-#4\relax} {\forgetall\vbox to \vsize{\vskip#3\hbox to \hsize{\hskip#1\box\nextbox\hss}\vss}\egroup} \vbox} - + %D \macros %D {toplinebox} %D @@ -2713,7 +2363,7 @@ \flushnextbox \fi}% \tbox} - + %D \macros %D {initializeboxstack,savebox,foundbox} %D @@ -2734,60 +2384,6 @@ %D \normalhbox{y:\foundbox{two}{a}} \par %D \stoptyping -% we keep it around as a demonstration of good old tex code: -% -% \def\@@stackbox{boxstack:b:} -% \def\@@stackmax{boxstack:m:} -% \def\@@stacktag{boxstack:t:} -% \def\@@stacklst{boxstack:l:} -% -% \def\initializeboxstack#1% -% {\ifundefined{\@@stackbox#1}% -% \@EA\newbox\csname\@@stackbox#1\endcsname -% \else -% \global\setbox\csname\@@stackbox#1\endcsname\emptyvbox -% \def\docommand##1{\global\letbeundefined{\@@stacktag#1:##1}}% -% \processcommacommand[\getvalue{\@@stacklst#1}]\docommand -% \fi -% \letgvalueempty{\@@stacklst#1}% -% \letgvalue{\@@stackmax#1}\!!zeropoint} -% -% \def\savebox#1#2% stack name -% {\dowithnextbox -% {\doifdefined{\@@stackbox#1} -% {\@EA\doglobal\@EA\increment\csname\@@stackmax#1\endcsname -% \setxvalue{\@@stacktag#1:#2}{\csname\@@stackmax#1\endcsname}% -% \setxvalue{\@@stacklst#1}{\getvalue{\@@stacklst#1},#2}% -% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox -% {\forgetall -% \setbox\scratchbox\normalvbox{\flushnextbox} -% \ht\scratchbox\onepoint -% \dp\scratchbox\zeropoint -% \unvbox\csname\@@stackbox#1\endcsname -% \offinterlineskip -% \allowbreak -% \box\scratchbox}}}% -% \normalvbox} -% -% \def\foundbox#1#2% -% {\normalvbox -% {\doifdefined{\@@stackbox#1} -% {\doifdefined{\@@stacktag#1:#2} -% {\setbox\scratchbox\normalvbox -% {\splittopskip\zeropoint -% \setbox0\copy\csname\@@stackbox#1\endcsname -% \dimen0=\getvalue{\@@stacktag#1:#2}\points -% \advance\dimen0 -\onepoint -% \setbox2\vsplit0 to \dimen0 -% \ifdim\ht0>\onepoint -% \setbox0\vsplit0 to \onepoint -% \fi -% \unvbox0\setbox0\lastbox\unvbox0}% -% \unvbox\scratchbox}}}} -% -% \def\doifboxelse#1#2% -% {\doifdefinedelse{\@@stacktag#1:#2}} - \def\@@stackbox{@box@} \def\@@stacklst{@xob@} @@ -2827,8 +2423,6 @@ #4% \fi} -\endETEX - %D \macros %D {removedepth, obeydepth} %D @@ -2896,71 +2490,6 @@ \def\raisebox{\doraiselowerbox\raise} \def\lowerbox{\doraiselowerbox\lower} -% maybe some day we need this -% -% \def\appendvbox#1% % uses \box8 -% {\bgroup -% \ifdim\prevdepth<\zeropoint -% \ifdim\pagetotal=\zeropoint -% \setbox8=\normalvtop{\unvcopy#1}% -% \hrule\c!!height\zeropoint -% \kern-\ht8 -% \box#1\relax -% \else -% \box#1\relax -% \fi -% \else -% \dimen0=\prevdepth -% \hrule\c!!height\zeropoint -% \setbox8=\normalvtop{\unvcopy#1}% -% \dimen2=\baselineskip -% \advance\dimen2 by -\dimen0 -% \advance\dimen2 by -\ht8 -% \kern\dimen2 -% \box#1\relax -% \fi -% \egroup} - -% %D Also new: -% %D -% %D \startbuffer -% %D \normbox[1cm][bba]{m} % b(efore) a(fter) v(box) s(trut) f(rame) -% %D \normbox[1cm][bba]{m} -% %D \normbox[1cm][bba]{m} -% %D \stopbuffer -% %D -% %D \typebuffer -% %D \getbuffer -% -% \def\dodonormbox#1#2#3#4#5#6#7% -% {\doifnumberelse{#1} -% {\dimen0=#1}{\setbox0=#3{#1}\dimen0=#50}% -% \doifinstringelse{f}{#2} -% {\let\next#4}{\let\next#3}% -% \next to \dimen0 -% {\counttoken b\in#2\to\!!counta\dorecurse{\!!counta}{#6}#6% -% #7\nextbox -% \counttoken a\in#2\to\!!counta\dorecurse{\!!counta}{#6}#6}} -% -% \def\donormbox[#1][#2]% -% {\bgroup -% \doifinstringelse{v}{#2} -% {\let\next\normalvbox} -% {\let\next\normalhbox}% -% \dowithnextbox -% {\ifvbox\nextbox -% \let\\=\par -% \dodonormbox{#1}{#2}\normalvbox\ruledvbox\ht\vfil\unvbox -% \else -% \let\\=\space -% \dodonormbox{#1}{#2}\normalhbox\ruledhbox\wd\hfil\unhbox -% \fi -% \egroup}% -% \next} -% -% \def\normbox -% {\dodoubleempty\donormbox} - % vcenter in text, we kunnen vcenter overloaden \def\halfwaybox @@ -3020,12 +2549,6 @@ %D %D A prelude to an extended \TEX: -% \def\setboxllx #1#2{\bgroup\scratchdimen#2\expanded{\egroup\noexpand\setevalue{b@@x\number#1}{\the\scratchdimen}}} -% \def\setboxlly #1#2{\bgroup\scratchdimen#2\expanded{\egroup\noexpand\setevalue{b@@y\number#1}{\the\scratchdimen}}} -% -% \def\gsetboxllx#1#2{\bgroup\scratchdimen#2\setxvalue{b@@x\number#1}{\the\scratchdimen}\egroup} -% \def\gsetboxlly#1#2{\bgroup\scratchdimen#2\setxvalue{b@@y\number#1}{\the\scratchdimen}\egroup} - \def\setboxllx#1#2{\setevalue{b@@x\number#1}{\the\dimexpr#2\relax}} \def\setboxlly#1#2{\setevalue{b@@y\number#1}{\the\dimexpr#2\relax}} -- cgit v1.2.3