diff options
Diffstat (limited to 'tex/context/base/supp-vis.tex')
-rw-r--r-- | tex/context/base/supp-vis.tex | 221 |
1 files changed, 124 insertions, 97 deletions
diff --git a/tex/context/base/supp-vis.tex b/tex/context/base/supp-vis.tex index bf982d82f..93bb5126e 100644 --- a/tex/context/base/supp-vis.tex +++ b/tex/context/base/supp-vis.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. %D \gdef\ShowBufferedExample% private typeseting macro %D {\startregelcorrectie @@ -53,8 +53,8 @@ %D that does not support buffering. In \CONTEXT\ we show the %D commands in the margin, use bit more advanced way of %D numbering, and typeset the source in \TEX nicolored -%D verbatim. Sorry for this inconvenience.\fi -%D +%D verbatim. Sorry for this inconvenience.\fi +%D %D Depending on my personal needs and those of whoever uses it, %D the macros will be improved in terms of visualization, %D efficiency and compatibility. These rather low level @@ -62,7 +62,7 @@ %D visualize baselines, the page layout and whatever deserves %D attention. Most of those macros can be found in \type %D {core-vis} and other core modules. Their integration in -%D \CONTEXT\ prohibits generic applications. +%D \CONTEXT\ prohibits generic applications. \ifx \undefined \writestatus \input supp-mis.tex \fi @@ -124,10 +124,10 @@ %D \macros %D {normaloffinterlineskip} %D -%D The next hack is needed because in \CONTEXT\ we redefine -%D \type{\offinterlineskip}. +%D The next hack is needed because in \CONTEXT\ we redefine +%D \type{\offinterlineskip}. -\ifx\undefined\normaloffinterlineskip +\ifx\undefined\normaloffinterlineskip \let\normaloffinterlineskip\offinterlineskip \fi @@ -141,10 +141,10 @@ %D baseline behavior. Especially \type{\vtop}'s need our %D special attention. -\ifx \normalhbox \undefined \let \normalhbox = \hbox \fi -\ifx \normalvbox \undefined \let \normalvbox = \vbox \fi -\ifx \normalvtop \undefined \let \normalvtop = \vtop \fi -\ifx \normalvcenter \undefined \let \normalvcenter = \vcenter \fi +\ifx \normalhbox \undefined \let \normalhbox = \hbox \fi +\ifx \normalvbox \undefined \let \normalvbox = \vbox \fi +\ifx \normalvtop \undefined \let \normalvtop = \vtop \fi +\ifx \normalvcenter \undefined \let \normalvcenter = \vcenter \fi %D \macros %D {normalhskip, @@ -238,14 +238,14 @@ %D option off in those (unpredictable) situations, we just %D redefine a few \PLAIN\ macros. -\ifx\tlap\undefined +\ifx\tlap\undefined \def\rlap#1{\normalhbox to \zeropoint{#1\normalhss}} \def\llap#1{\normalhbox to \zeropoint{\normalhss#1}} \def\blap#1{\normalvbox to \zeropoint{#1\normalvss}} \def\tlap#1{\normalvbox to \zeropoint{\normalvss#1}} -\fi +\fi \def~{\normalpenalty\!!tenthousand\ } @@ -253,9 +253,9 @@ %D {makeruledbox} %D %D Ruled boxes can be typeset is many ways. Here we present -%D just one alternative. This implementation may be a little -%D complicated, but it supports all three kind of boxes. The -%D next command expects a \BOX\ specification, like: +%D just one alternative. This implementation may be a little +%D complicated, but it supports all three kind of boxes. The +%D next command expects a \BOX\ specification, like: %D %D \starttypen %D \makeruledbox0 @@ -263,9 +263,9 @@ %D \macros %D {baselinerule,baselinefill} -%D +%D %D We can make the baseline of a box visible, both dashed and -%D as a rule. The line is drawn on top of the baseline. All +%D as a rule. The line is drawn on top of the baseline. All %D we have to say is: %D %D \starttypen @@ -281,7 +281,7 @@ %D \macros %D {iftoprule,ifbottomrule,ifleftrule,ifrightrule} -%D +%D %D Rules can be turned on and off, but by default we have: %D %D \starttypen @@ -300,7 +300,7 @@ %D \macros %D {boxrulewidth} -%D +%D %D The width in the surrounding rules can be specified by %D assigning an apropriate value to the dimension used. This %D module defaults the width to: @@ -389,21 +389,21 @@ %D Just in case one didn't notice: the rules are in fact layed %D over the box. This way the contents of a box cannot %D visually interfere with the rules around (upon) it. A more -%D advanced version of ruled boxes can be found in one of the -%D core modules of \CONTEXT. There we take offsets, color, +%D advanced version of ruled boxes can be found in one of the +%D core modules of \CONTEXT. There we take offsets, color, %D rounded corners, backgrounds and alignment into account too. %D \macros %D {ruledhbox, %D ruledvbox,ruledvtop, %D ruledvcenter} -%D +%D %D These macro's can be used instead of \type{\hbox}, %D \type{\vbox}, \type{\vtop} and, when in math mode, %D \type{\vcenter}. They just do what their names state. Using %D an auxiliary macro would save us a few words of memory, but -%D it would make their appearance even more obscure. -%D +%D it would make their appearance even more obscure. +%D %D \startbuffer %D \hbox %D {\strut @@ -459,11 +459,11 @@ %D \startbuffer %D \hbox -%D {$\vcenter{\hsize.2\hsize +%D {$\vcenter{\hsize.2\hsize %D alfa \par beta}$ -%D $\vcenter to 3cm{\hsize.2\hsize +%D $\vcenter to 3cm{\hsize.2\hsize %D alfa \par beta \par gamma}$ -%D $\vcenter{\hsize.2\hsize +%D $\vcenter{\hsize.2\hsize %D alfa \par beta}$} %D \stopbuffer %D @@ -562,6 +562,33 @@ \negativefalse \else \negativetrue \fi} +% etex +% +% \def\investigateskip#1% +% {\relax +% \ifdim\scratchskip=\zeropoint +% \ifdim\gluestretch\scratchskip=\zeropoint +% \ifdim\glueshrink\scratchskip=\zeropoint +% \flexiblefalse +% \else +% \flexibletrue +% \fi +% \else +% \flexibletrue +% \fi +% \else +% \flexibletrue +% \fi +% \ifdim#1=\zeropoint\relax +% \zerotrue \else +% \zerofalse \fi +% \ifdim#1<\zeropoint\relax +% \positivefalse \else +% \positivetrue \fi +% \ifdim#1>\zeropoint\relax +% \negativefalse \else +% \negativetrue \fi} + \def\investigatecount#1% {\relax \flexiblefalse @@ -610,32 +637,32 @@ %D \macros %D {ifcenteredvcue,normalvcue} %D -%D Depending on the context, one can force visual vertical cues -%D being centered along \type{\hsize} or being put at the -%D current position. Although centering often looks better, -%D we've chosen the second alternative as default. The main -%D reason for doing so is that often when we don't set the -%D \type{\hsize} ourselves, \TEX\ takes the value of the -%D surrounding box. As a result the visual cues can migrate -%D outside the current context. -%D -%D This behavior is accomplished by a small but effective -%D auxiliary macro, which behavior can be influenced by the -%D boolean \type{\centeredvcue}. By saying -%D -%D \starttypen +%D Depending on the context, one can force visual vertical cues +%D being centered along \type{\hsize} or being put at the +%D current position. Although centering often looks better, +%D we've chosen the second alternative as default. The main +%D reason for doing so is that often when we don't set the +%D \type{\hsize} ourselves, \TEX\ takes the value of the +%D surrounding box. As a result the visual cues can migrate +%D outside the current context. +%D +%D This behavior is accomplished by a small but effective +%D auxiliary macro, which behavior can be influenced by the +%D boolean \type{\centeredvcue}. By saying +%D +%D \starttypen %D \centeredvcuetrue %D \stoptypen -%D -%D one turns centering on. As said, we turn it off. +%D +%D one turns centering on. As said, we turn it off. \newif\ifcenteredvcue \centeredvcuefalse \def\normalvcue#1% {\normalhbox \ifcenteredvcue to \hsize \fi {\normalhss#1\normalhss}} -%D We could have used the more robust version -%D +%D We could have used the more robust version +%D %D \starttypen %D \def\normalvcue% %D {\normalhbox \ifcenteredvcue to \hsize \fi @@ -643,9 +670,9 @@ %D \aftergroup\normalhss\aftergroup\egroup %D \let\next=} %D \stoptypen -%D -%D or the probably best one: -%D +%D +%D or the probably best one: +%D %D \starttypen %D \def\normalvcue% %D {\hbox \ifcenteredvcue to \hsize @@ -656,9 +683,9 @@ %D \fi %D \let\next=} %D \stoptypen -%D -%D Because we don't have to preserve \CATCODES\ and only use -%D small arguments, we stick to the first alternative. +%D +%D Because we don't have to preserve \CATCODES\ and only use +%D small arguments, we stick to the first alternative. %D \macros %D {testrulewidth} @@ -681,11 +708,11 @@ %D \macros %D {visiblestretch} -%D +%D %D A second variable is introduced because of the stretch %D components of \SKIPS. At the cost of some accuracy we can -%D make this stretch visible. -%D +%D make this stretch visible. +%D %D \starttypen %D \visiblestretchtrue %D \stoptypen @@ -736,8 +763,8 @@ \egroup} %D The horizontal fillers differ in their boundary -%D visualization. Watch the small dots. Fillers can be -%D combined within reasonable margins. +%D visualization. Watch the small dots. Fillers can be +%D combined within reasonable margins. %D %D \startregelcorrectie %D \baselinerulefalse @@ -761,7 +788,7 @@ %D \baselinerulefalse %D \ruledhbox to \hsize %D {\strut -%D \type{\hfil}\type{\hfil}\ruledhfil\ruledhfil +%D \type{\hfil}\type{\hfil}\ruledhfil\ruledhfil %D test% %D \ruledhfil\type{\hfil}} %D \stopregelcorrectie @@ -831,12 +858,12 @@ \dontcomplain \normaloffinterlineskip \setvisiblevfilbox0\to422% - \setbox2\normalvcue + \setbox2\normalvcue {\normalhskip -#3\testrulewidth\copy0}% \smashbox2% \copy2 \bgroup - \setbox2\normalvcue + \setbox2\normalvcue {\normalhskip -2\testrulewidth\copy0}% \smashbox2% \copy2 @@ -876,9 +903,9 @@ %D {\hsize.18\hsize %D \type{\vfillneg}\ruledvfillneg last line}} %D \stopregelcorrectie -%D +%D %D Keep in mind that \type{\vfillneg} is not part of \PLAIN\ -%D \TEX, but are mimmicked by a macro. +%D \TEX, but are mimmicked by a macro. \unexpanded\def\ruledvss {\doruledvfiller\normalvss\normalvfilneg{2}} @@ -960,7 +987,7 @@ \fi \normalhfill \ifflexible - \normalhskip\ifnegative\else-\fi\scratchskip + \normalhskip\ifnegative\else-\fi\scratchskip \normalhskip2\testrulewidth \cleaders \normalhbox @@ -1064,9 +1091,9 @@ %D %D \ShowBufferedExample %D -%D We have to postpone \type{\prevdepth}. Although this -%D precaution probably is not completely waterproof, it works -%D quite well. +%D We have to postpone \type{\prevdepth}. Although this +%D precaution probably is not completely waterproof, it works +%D quite well. \def\dodoruledvskip {\nextdepth\prevdepth @@ -1122,12 +1149,12 @@ \smashbox0% \fi \ifvisiblestretch - \ifflexible - \skip2\scratchskip + \ifflexible + \skip2\scratchskip \advance\skip2 -1\scratchskip - \divide\skip2 2 - \advance\scratchskip -\skip2 - \normalvskip\skip2 + \divide\skip2 2 + \advance\scratchskip -\skip2 + \normalvskip\skip2 \fi \fi \normalpenalty\!!tenthousand @@ -1180,8 +1207,8 @@ %D %D Positive and negative kerns are placed on top or below the %D baseline, so we are able to track their added result. We -%D didn't mention spacings of 0~pt yet. Zero values are -%D visualized a bit different, because we want to see them +%D didn't mention spacings of 0~pt yet. Zero values are +%D visualized a bit different, because we want to see them %D anyhow. \def\doruledhkern @@ -1255,8 +1282,8 @@ %D %D \ShowBufferedExample %D -%D Like before, we have to postpone \type{\prevdepth}. If we -%D leave out this trick, we got ourselves some wrong spacing. +%D Like before, we have to postpone \type{\prevdepth}. If we +%D leave out this trick, we got ourselves some wrong spacing. \def\dodoruledvkern {\nextdepth\prevdepth @@ -1299,7 +1326,7 @@ \smashbox0% \setbox0\normalvbox {\ifnegative\normalvskip\scratchskip\fi - \normalvcue + \normalvcue {\ifnegative\normalhskip-16\testrulewidth\fi\box0}}% \smashbox0% \normalpenalty\!!tenthousand @@ -1332,7 +1359,7 @@ \normalkern} %D A a bit more \TEX nice solution is: -%D +%D %D \starttypen %D \unexpanded\def\ruledkern% %D {\csname ruled\ifvmode v\else h\fi kern\endcsname\normalkern} @@ -1393,7 +1420,7 @@ \def\doruledvglue {\endgraf % \par - \nextdepth\prevdepth + \nextdepth\prevdepth \visualhrule\!!height\zeropoint \normalpenalty\!!tenthousand \ruledvkern\normalvskip\scratchskip @@ -1646,7 +1673,7 @@ \def\doruledvpenalty {\ifdim\pagegoal=\maxdimen \else - \nextdepth\prevdepth + \nextdepth\prevdepth \dontinterfere \dontcomplain \investigatecount\scratchcounter @@ -1673,7 +1700,7 @@ \smashbox0% \normalpenalty\!!tenthousand \nointerlineskip - \dp0\nextdepth % not \prevdepth=\nextdepth + \dp0\nextdepth % not \prevdepth=\nextdepth \normalvbox {\normalvcue{\box0}}% \fi @@ -1692,7 +1719,7 @@ \expandafter\ruledhpenalty \fi} -%D At the cost of some more tokens, a bit more clever +%D At the cost of some more tokens, a bit more clever %D implementation would be: %D %D \starttypen @@ -1778,19 +1805,19 @@ %D for turning the options on, one for turning them off, and a %D boolean for enabling the mechanism outside the scope of the %D user. The first two macros only do their job when we are -%D actually showing the composition. +%D actually showing the composition. %D %D \starttypen %D \showingcompositiontrue %D \showcomposition %D \stoptypen -%D +%D %D Because the output routine can do tricky things, like %D multiple column typesetting and manipulation of the %D pagebody, shifting things around and so on, the macro %D \type{\dontshowcomposition} best can be called when we enter %D this routine. Too much visual cues just don't make sense. In -%D \CONTEXT\ this has been taken care of. +%D \CONTEXT\ this has been taken care of. \newif\ifshowingcomposition @@ -1820,8 +1847,8 @@ %D \showmakeup %D \stoptypen %D -%D For the sake of those who don't (yet) use \CONTEXT\ we -%D preset \type{\defaulttestrulewidth} to the already set +%D For the sake of those who don't (yet) use \CONTEXT\ we +%D preset \type{\defaulttestrulewidth} to the already set %D value. Otherwise we default to a bodyfontsize related value. %D %D \starttypen @@ -1843,11 +1870,11 @@ \protect -%D \ifCONTEXT \let\next=\relax \else \let\next=\endinput +%D \ifCONTEXT \let\next=\relax \else \let\next=\endinput %D The documented source you have been reading was processed %D using some surrogate makeup. When this file is processed %D in \CONTEXT, a few more examples show up here, like a local -%D table of contents and a local register. +%D table of contents and a local register. %D \fi \next % %D Lets end with some more advanced examples. When visualized, @@ -1855,15 +1882,15 @@ % %D % %D {\showmakeup\plaatsinhoud[criterium=vorige]} % %D -%D Lets end with some more advanced examples. -%D Definitions and enumerations come in many flavors. The -%D next one for instance is defined as: +%D Lets end with some more advanced examples. +%D Definitions and enumerations come in many flavors. The +%D next one for instance is defined as: %D %D \starttypen %D \definedescription[test][place=left,hang=3,width=6em] %D \stoptypen %D -%D When applied to some text, this would look like: +%D When applied to some text, this would look like: %D %D \bgroup %D \showmakeup @@ -1872,11 +1899,11 @@ %D \test{visual\\debugger} I would be very pleased if \TEX\ %D had two more primitives: \type{\vnop} and \type{\hnop}. Both %D should act and show up as normal boxes, but stay invisible -%D for \TEX\ when it's doing calculations. The \type{\vnop} -%D for instance should not interact with the internal mechanism +%D for \TEX\ when it's doing calculations. The \type{\vnop} +%D for instance should not interact with the internal mechanism %D responsible for the disappearing skips, kerns and penalties -%D at a pagebreak. As long as we don't have these two boxtypes, -%D visual debugging will never be perfect. +%D at a pagebreak. As long as we don't have these two boxtypes, +%D visual debugging will never be perfect. %D %D \egroup %D |