diff options
Diffstat (limited to 'tex/context/base/core-mis.mkiv')
-rw-r--r-- | tex/context/base/core-mis.mkiv | 395 |
1 files changed, 0 insertions, 395 deletions
diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv index 299a01fa2..63e91143d 100644 --- a/tex/context/base/core-mis.mkiv +++ b/tex/context/base/core-mis.mkiv @@ -560,401 +560,6 @@ \unexpanded\def\xxbox {\bgroup\aftergroup\egroup\hbox\bgroup\txx\let\next=} -%D \macros -%D {definepairedbox, setuppairedbox, placepairedbox} -%D -%D Paired boxes, formally called legends, but from now on a -%D legend is just an instance, are primarily meant for -%D typesetting some text alongside an illustration. Although -%D there is quite some variation possible, the functionality is -%D kept simple, if only because in most cases such pairs are -%D typeset sober. -%D -%D The location specification accepts a pair, where the first -%D keyword specifies the arrangement, and the second one the -%D alignment. The first key of the location pair is one of -%D \type {left}, \type {right}, \type {top} or \type {bottom}, -%D while the second key can also be \type {middle}. -%D -%D The first box is just collected in an horizontal box, but -%D the second one is a vertical box that gets passed the -%D bodyfont and alignment settings. - -%D Today we would implement this using layers .... but for the -%D moment we keep it this way. - -% \startbuffer[test] -% \test left \test left,top \test left,bottom \test left,middle -% \test right \test right,top \test right,bottom \test right,middle -% \test top \test top,left \test top,right \test top,middle -% \test bottom \test bottom,left \test bottom,right \test bottom,middle -% \stopbuffer -% -% \def\showtest#1% -% {\pagina -% \typebuffer[demo] -% \def\test##1 -% {\startlinecorrection[blank] -% \getbuffer[demo]% -% \ruledhbox\placelegend -% [bodyfont=6pt,location={##1}] -% {\framed[width=.25\textwidth]{\tttf##1}} -% {#1} -% \stoplinecorrection} -% \getbuffer[test]} -% -% \startbuffer[demo] -% \setuplegend -% [width=\hsize,maxwidth=\makeupwidth, -% height=\vsize,maxheight=\makeupheight] -% \stopbuffer -% -% \showtest{These examples demonstrate the default settings.} -% -% \startbuffer[demo] -% \setuplegend -% [width=\textwidth, -% maxwidth=\textwidth] -% \stopbuffer -% -% \showtest{\input tufte } -% -% \startbuffer[demo] -% \setuplegend -% [width=.65\textwidth] -% \stopbuffer -% -% \showtest{\input knuth } -% -% \startbuffer[demo] -% \setuplegend -% [height=2cm] -% \stopbuffer -% -% \showtest{These examples demonstrate some other settings.} -% -% \startbuffer[demo] -% \setuplegend -% [width=.65\textwidth, -% height=2cm] -% \stopbuffer -% -% \showtest{These examples demonstrate some other settings.} -% -% \startbuffer[demo] -% \setuplegend -% [n=2,align=right,width=.5\textwidth] -% \stopbuffer -% -% \showtest{\input zapf } - -%D \macros -%D {setuplegend, placelegend} -%D -%D It makes sense to typeset a legend to a figure in \TEX\ -%D and not in a drawing package. The macro \type {\placelegend} -%D combines a figure (or something else) and its legend. This -%D command is just a paired box. -%D -%D The legend is placed according to \type {location}, being -%D \type {bottom} or \type {right}. The macro macro is used as -%D follows. -%D -%D \starttyping -%D \placefigure -%D {whow} -%D {\placelegend -%D {\externalfigure[cow]} -%D {\starttabulation -%D \NC 1 \NC head \NC \NR -%D \NC 2 \NC legs \NC \NR -%D \NC 3 \NC tail \NC \NR -%D \stoptabulation}} -%D -%D \placefigure -%D {whow} -%D {\placelegend -%D {\externalfigure[cow]} -%D {\starttabulation[|l|l|l|l|] -%D \NC 1 \NC head \NC 3 \NC tail \NC \NR -%D \NC 2 \NC legs \NC \NC \NC \NR -%D \stoptabulation}} -%D -%D \placefigure -%D {whow} -%D {\placelegend[n=2] -%D {\externalfigure[cow]} -%D {\starttabulation -%D \NC 1 \NC head \NC \NR -%D \NC 2 \NC legs \NC \NR -%D \NC 3 \NC tail \NC \NR -%D \stoptabulation}} -%D -%D \placefigure -%D {whow} -%D {\placelegend[n=2] -%D {\externalfigure[cow]} -%D {head \par legs \par tail}} -%D -%D \placefigure -%D {whow} -%D {\placelegend[n=2] -%D {\externalfigure[cow]} -%D {\startitemize[packed] -%D \item head \item legs \item tail \item belly \item horns -%D \stopitemize}} -%D -%D \placefigure -%D {whow} -%D {\placelegend[n=2,width=.8\hsize] -%D {\externalfigure[cow]} -%D {\startitemize[packed] -%D \item head \item legs \item tail \item belly \item horns -%D \stopitemize}} -%D \stoptyping - -\newsystemmode{pairedbox} - -\appendtoks - \global\resetsystemmode{pairedbox}% -\to \everyinsidefloat - -\newbox\firstpairedbox -\newbox\secondpairedbox - -\unexpanded\def\definepairedbox - {\dodoubleempty\dodefinepairedbox} - -\def\dodefinepairedbox[#1][#2]% - {\getparameters - [\??ld#1] - [\c!n=1, - \c!distance=\bodyfontsize, - \c!before=, - \c!after=, - \c!color=, - \c!style=, - \c!inbetween={\blank[\v!medium]}, - \c!width=\hsize, - \c!height=\vsize, - \c!maxwidth=\textwidth, % \makeupwidth, - \c!maxheight=\textheight, % \makeupheight, - \c!bodyfont=, - \c!align=, - \c!location=\v!bottom, - #2]% - \setvalue{\e!setup#1\e!endsetup}{\setuppairedbox[#1]}% - \setvalue{\e!place#1}{\placepairedbox[#1]}} - -\unexpanded\def\setuppairedbox - {\dodoubleempty\dosetuppairedbox} - -\def\dosetuppairedbox[#1]% - {\getparameters[\??ld#1]} - -\unexpanded\def\placepairedbox - {\bgroup\dodoubleempty\doplacepairedbox} - -\def\doplacepairedbox[#1][#2]% watch the hsize/vsize tricks - {\setuppairedbox[#1][#2]% % and don't change them - \copyparameters % brrr - [\??ld][\??ld#1] - [\c!n,\c!distance,\c!inbetween,\c!before,\c!after, - \c!width,\c!height,\c!maxwidth,\c!maxheight, - \c!color,\c!style,\c!bodyfont,\c!align,\c!location]% - \@@ldbefore\bgroup - \global\setsystemmode{pairedbox}% - \beforefirstpairedbox - \dowithnextbox - {\betweenbothpairedboxes - \dowithnextbox - {\afterbothpairedboxes - \egroup\@@ldafter - \egroup} - \vbox\bgroup - \insidesecondpairedbox - \let\next=} - \hbox} - -\setnewconstant\pairedlocationa\plusone -\setnewconstant\pairedlocationb\plusfour - -\def\beforefirstpairedbox - {\pairedlocationa\plusone % left - \pairedlocationb\plusfour % middle - \getfromcommacommand[\@@ldlocation][1]% - \processaction - [\commalistelement] - [ \v!left=>\pairedlocationa\zerocount, - \v!right=>\pairedlocationa\plusone, - \v!top=>\pairedlocationa\plustwo, - \v!bottom=>\pairedlocationa\plusthree]% - \getfromcommacommand[\@@ldlocation][2]% - \processaction - [\commalistelement] - [ \v!left=>\pairedlocationb\zerocount, - \v!right=>\pairedlocationb\plusone, - \v!high=>\pairedlocationb\plustwo, - \v!top=>\pairedlocationb\plustwo, - \v!low=>\pairedlocationb\plusthree, - \v!bottom=>\pairedlocationb\plusthree, - \v!middle=>\pairedlocationb\plusfour]} - -\def\betweenbothpairedboxes - {\switchtobodyfont[\@@ldbodyfont]% split under same regime - \setbox\firstpairedbox\flushnextbox - \ifnum\pairedlocationa<\plustwo - \hsize\wd\firstpairedbox % trick - \hsize\@@ldwidth - \scratchdimen\wd\firstpairedbox - \advance\scratchdimen \@@lddistance - \bgroup\advance\scratchdimen \hsize - \ifdim\scratchdimen>\@@ldmaxwidth\relax - \egroup - \hsize\@@ldmaxwidth - \advance\hsize -\scratchdimen - \else - \egroup - \fi - \else - \hsize\wd\firstpairedbox - \hsize\@@ldwidth % can be \hsize - \ifdim\hsize>\@@ldmaxwidth\relax \hsize\@@ldmaxwidth \fi % can be \hsize - \fi - \ifnum\@@ldn>\plusone - \setrigidcolumnhsize\hsize\@@lddistance\@@ldn - \fi} - -\def\afterbothpairedboxes - {\setbox\secondpairedbox\vbox - {\ifnum\@@ldn>1 - \rigidcolumnbalance\nextbox - \else - \flushnextbox - \fi}% - \ifnum\pairedlocationa<\plustwo\hbox\else\vbox\fi\bgroup % hide vsize - \forgetall - \ifnum\pairedlocationa<\plustwo - \scratchdimen\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox - \vsize\scratchdimen - \ifdim\scratchdimen<\@@ldheight\relax % can be \vsize - \scratchdimen\@@ldheight - \fi - \ifdim\scratchdimen>\@@ldmaxheight\relax - \scratchdimen\@@ldmaxheight - \fi - \valignpairedbox\firstpairedbox \scratchdimen - \valignpairedbox\secondpairedbox\scratchdimen - \else - \scratchdimen\maxoftwoboxdimens\wd\firstpairedbox\secondpairedbox - \halignpairedbox\firstpairedbox \scratchdimen - \halignpairedbox\secondpairedbox\scratchdimen - \scratchdimen\ht\secondpairedbox - \vsize\scratchdimen - \ifdim\ht\secondpairedbox<\@@ldheight\relax % can be \vsize - \scratchdimen\@@ldheight\relax % \relax needed - \fi - \ifdim\scratchdimen>\@@ldmaxheight\relax % todo: totale hoogte - \scratchdimen\@@ldmaxheight\relax % \relax needed - \fi - \ifdim\scratchdimen>\ht\secondpairedbox - \setbox\secondpairedbox\vbox to \scratchdimen - {\ifnum\pairedlocationa=\plusthree \vss\fi % - \box\secondpairedbox - \ifnum\pairedlocationa=\plustwo \vss\fi}% \kern\zeropoint - \fi - \fi - \ifcase\pairedlocationa - \box\secondpairedbox\hskip\@@lddistance\box\firstpairedbox \or - \box\firstpairedbox \hskip\@@lddistance\box\secondpairedbox\or - \box\secondpairedbox\endgraf \nointerlineskip \@@ldinbetween \box\firstpairedbox \or - \box\firstpairedbox \endgraf \nointerlineskip \@@ldinbetween \box\secondpairedbox\else - \fi - \egroup} - -\def\insidesecondpairedbox - {\forgetall - \setupalign[\@@ldalign]% - \tolerantTABLEbreaktrue % hm. - \blank[\v!disable]% - \everypar{\begstrut}} - -\def\maxoftwoboxdimens#1#2#3% - {#1\ifdim#1#2>#1#3 #2\else#3\fi} - -\def\valignpairedbox#1#2% - {\setbox#1\vbox to #2 - {\ifcase\pairedlocationb\or\or\or\vss\or\vss\fi - \box#1\relax - \ifcase\pairedlocationb\or\or\vss\or\or\vss\fi}} - -\def\halignpairedbox#1#2% - {\setbox#1\hbox to #2 - {\ifcase\pairedlocationb\or\hss\or\or\or\hss\fi - \box#1\relax - \ifcase\pairedlocationb\hss\or\or\or\or\hss\fi}} - -\definepairedbox[\v!legend] - -\unexpanded\def\placerelativetoeachother#1#2% - {\bgroup - \dowithnextbox - {\bgroup - \setbox0\box\nextbox - \dowithnextbox - {\setbox2\box\nextbox - #1{#2#########2\cr\box0\cr\box2\cr} - \egroup - \egroup} - \hbox} - \hbox} - -\unexpanded\def\placeontopofeachother{\placerelativetoeachother\halign\hss} -\unexpanded\def\placesidebyside {\placerelativetoeachother\valign\vss} - -% to be used in some other places! todo! -% -% divides \hsize in fractions, will be made a bit more -% clever and advanced when needed -% -% \horizontaldivision[n/m,elements,distance] -% -% \horizontaldivision[2/5,3,1em] -% \horizontaldivision[2/5,3,1em] -% \horizontaldivision[1/5,3,1em] -% -% \setuphorizontaldivision[afstand=,aantal=] (passend,passend) - -\unexpanded\def\setuphorizontaldivision - {\dodoubleargument\getparameters[\??fr]} - -\def\horizontaldivision - {\dosingleargument\dohorizontaldivision} - -\def\dohorizontaldivision[#1]% - {\dodohorizontaldivision[#1,,,,,,]} - -\def\dodohorizontaldivision[#1/#2,#3,#4,#5]% - {\doifelsenothing{#3} - {\doifelse\@@frn\v!fit - {\!!counta#2\relax} - {\!!counta\@@frn\relax}} - {\!!counta#3\relax}% - \doifelsenothing{#4} - {\doifelse\@@frdistance\v!fit - {\!!widtha\zeropoint} - {\!!widtha\@@frdistance}} - {\!!widtha#4}% - \advance\!!counta \minusone - \multiply\!!widtha \!!counta - \advance\hsize -\!!widtha - \divide\hsize #2\relax - \hsize#1\hsize} - -\setuphorizontaldivision - [\c!distance=\emwidth, - \c!n=\v!fit] - %D This one is for Daniel Pittman, who wanted tight fractions. We show %D three versions. First the simple one using \type {\low} and \type {high}: %D |