524288000 7uˆl–Ü4ý(Ð;�½p-©‹Fÿ�þ\e·Ön2¶ˆ(ÜŒ€þõ „m2ÏôÀò?÷u%D \module %D [ file=pack-mrl, % was pack-rul/core-rul, %D version=1998.10.16, %D title=\CONTEXT\ Packaging Macros, %D subtitle=More Rules, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \writestatus{loading}{ConTeXt Packaging Macros / More Rules} %D The (re)implementation of margin rules has been moved elsewhere. \unprotect %D \macros %D {setupblackrules,blackrule} %D %D The graphic capabilities of \TEX\ do not go beyond simple filled rules, except of %D course when using specials or, in \MKIV, manipulate node lists. Let's start with %D a warning: using this commands is far more slower than using the \TEX\ primitives %D \type {\hrule} and \type {\vrule}, but they save us some tokens. The %D characteristics of these rule drawing command can be set by: %D %D \showsetup{setupblackrules} %D %D The simple command draws only one rule. Its optional argument can be used to %D specify the dimensions. By setting the width, height or depth to \type {max}, one %D gets the natural dimensions. %D %D \showsetup{blackrule} \installcorenamespace{blackrules} \installsimplecommandhandler \??blackrules {blackrules} \??blackrules \unexpanded\def\blackrule {\hpack\bgroup \doifelsenextoptionalcs\pack_black_rule_pickup\pack_black_rule_indeed} \def\pack_black_rule_pickup[#1]% {\setupcurrentblackrules[#1]% \pack_black_rule_indeed} \def\pack_black_rule_indeed {\edef\p_width {\directblackrulesparameter\c!width }% \edef\p_height{\directblackrulesparameter\c!height}% \edef\p_depth {\directblackrulesparameter\c!depth }% \ifx\p_height\v!max \setstrut \else\ifx\p_depth\v!max \setstrut \fi\fi \useblackrulesstyleandcolor\c!style\c!color \ifcsname\??blackruletype\directblackrulesparameter\c!type\endcsname \lastnamedcs \else \vrule \fi \ifx\p_width \v!max\s!width \emwidth\else\ifx\p_width \empty\else\s!width \p_width \fi\fi \ifx\p_height\v!max\s!height\strutht\else\ifx\p_height\empty\else\s!height\p_height\fi\fi \ifx\p_depth \v!max\s!depth \strutdp\else\ifx\p_depth \empty\else\s!depth \p_depth \fi\fi \egroup} \setupblackrules [\c!width=\emwidth, \c!height=\exheight, \c!depth=\zeropoint, \c!color=] %D \macros %D {blackrules} %D %D One can call for a sequence of black rules, if needed equally spaced over the %D given width. %D %D \showsetup{blackrules} %D %D The two alternative calls are therefore: %D %D \startbuffer %D Tell me, is this according to the \blackrules[n=6]? %D These \blackrules[alternativevariant=b,n=10,distance=.2em,width=4cm] are quite clear. %D \stopbuffer %D %D \typebuffer %D %D or: %D %D \startlines %D \getbuffer %D \stoplines %D %D We could of course have implemented this macro using \type {\leaders}, but this %D would probably have taken more tokens. \unexpanded\def\blackrules % probably never used {\hpack\bgroup \doifelsenextoptionalcs\pack_black_rules_pickup\pack_black_rules_indeed} \def\pack_black_rules_pickup[#1]% {\setupcurrentblackrules[#1]% \pack_black_rules_indeed} \def\pack_black_rules_indeed % no max handling here {\scratchwidth \directblackrulesparameter\c!width \scratchheight \directblackrulesparameter\c!height \scratchdepth \directblackrulesparameter\c!depth \scratchdistance\directblackrulesparameter\c!distance \scratchcounter \directblackrulesparameter\c!n \edef\p_alternative{\blackrulesparameter\c!alternative}% \ifx\p_alternative\c!b % why not just check distance \ifnum\scratchcounter=\plusone \scratchdistance\zeropoint \else \scratchwidth\dimexpr(\scratchwidth-\scratchcounter\scratchdistance+\scratchdistance)/\scratchcounter\relax \fi \fi \useblackrulesstyleandcolor\c!style\c!color % a typical case of where we can use a simple loop or