diff options
Diffstat (limited to 'tex')
30 files changed, 539 insertions, 634 deletions
diff --git a/tex/context/base/back-ini.mkiv b/tex/context/base/back-ini.mkiv index 8ece8f6e1..fc8759c14 100644 --- a/tex/context/base/back-ini.mkiv +++ b/tex/context/base/back-ini.mkiv @@ -61,13 +61,13 @@ \let \dotransformnextbox\gobblesixarguments % and pass last box %D \macros -%D {doovalbox} +%D {back_ovalbox} %D %D When we look at the implementation, this is a complicated %D one. There are seven arguments. %D %D \starttyping -%D \doovalbox {w} {h} {d} {linewidth} {radius} {stroke} {fill} {variant} +%D \back_ovalbox {w} {h} {d} {linewidth} {radius} {stroke} {fill} {variant} %D \stoptyping %D %D This command has to return a \type{\vbox} which can be used @@ -75,7 +75,7 @@ %D degrees, the stroke and fill are~\type{1} (true) of~\type{0} %D (false). -\let \doovalbox \gobbleeightarguments +\let\back_ovalbox \gobbleeightarguments %D \macros %D {dostartclipping,dostopclipping} diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index 332d7ea89..5b5781531 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -260,7 +260,7 @@ % for the moment here %D \macros -%D {doovalbox} +%D {back_ovalbox} %D %D Drawing frames with round corners is inherited from the %D main module. @@ -273,7 +273,7 @@ % \def\back_oval_calculate#1#2#3% % {\PointsToBigPoints{\dimexpr#2+#3\relax}#1} -\unexpanded\def\doovalbox#1#2#3#4#5#6#7#8% +\unexpanded\def\back_ovalbox#1#2#3#4#5#6#7#8% {\forcecolorhack \bgroup % \scratchdimen#4% @@ -303,8 +303,8 @@ \PointsToBigPoints{\dimexpr #2-\scratchdimen}\yymax \PointsToBigPoints{\dimexpr-#3+\scratchdimen}\yymin % - \edef\dostroke{#6}% - \edef\dofill{#7}% + \edef\dostroke{\number#6}% + \edef\dofill{\number#7}% \edef\mode{\number#8 \space}% % no \ifcase, else \relax in pdfcode \setbox\scratchbox\hbox diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 1f6c6d8a3..e1a501530 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.07.04 23:48} +\newcontextversion{2012.07.06 19:11} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index d262e6821..185ee6c6f 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.07.04 23:48} +\newcontextversion{2012.07.06 19:11} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 7a28f0951..bd8355785 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 962970781..3e516fa8d 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index af378d0ba..0d017a7ce 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.07.04 23:48} +\edef\contextversion{2012.07.06 19:11} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 29a2432db..05ef64b22 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.07.04 23:48} +\edef\contextversion{2012.07.06 19:11} %D For those who want to use this: diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv index 66f2a4380..5a92ebf4f 100644 --- a/tex/context/base/core-sys.mkiv +++ b/tex/context/base/core-sys.mkiv @@ -150,14 +150,34 @@ %D But anyway, in \MKIV\ we avoid most of the complications anyway as we %D deal with much at the \LUA\ end. -\def\complexstart[#1]{\bgroup\getvalue{\e!start#1}} -\def\complexstop [#1]{\getvalue{\e!stop #1}\egroup} - -\let\simplestart\bgroup -\let\simplestop \egroup - -\definecomplexorsimple\start -\definecomplexorsimple\stop +\unexpanded\def\start + {\dosingleempty\syst_start} + +\def\syst_start + {\bgroup + \iffirstargument + \expandafter\syst_start_yes + \else + \expandafter\syst_start_nop + \fi} + +\def\syst_start_yes[#1]% + {\edef\m_syst_start_stop{#1}% + \ifx\m_syst_start_stop\empty + \let\syst_stop_indeed\donothing + \else\ifcsname\e!start\m_syst_start_stop\endcsname + \let\expandafter\syst_stop_indeed\csname\e!stop\m_syst_start_stop\endcsname + \csname\e!start\currentstartstop\expandafter\expandafter\expandafter\endcsname + \else + \let\syst_stop_indeed\donothing + \fi\fi} + +\def\syst_start_nop[#1]% + {\let\syst_stop_indeed\donothing} + +\unexpanded\def\stop + {\syst_stop_indeed + \egroup} % \c!before \c!after \c!inbetween \c!commands \c!style \c!color diff --git a/tex/context/base/math-arr.mkiv b/tex/context/base/math-arr.mkiv index 91bb7889b..ddce05ece 100644 --- a/tex/context/base/math-arr.mkiv +++ b/tex/context/base/math-arr.mkiv @@ -98,7 +98,7 @@ \setvalue{\??matharrowsettings\v!big }{\def\m_math_arrows_extra{20}} \setvalue{\??matharrowsettings\v!normal }{} \setvalue{\??matharrowsettings }{} -\setvalue{\??matharrowsettings\s!unknown}{\doifnumberelse\p_mathspacing{\let\m_math_arrows_extra\p_mathspacing}\donothing} +\setvalue{\??matharrowsettings\s!unknown}{\doifnumberelse\p_math_spacing{\let\m_math_arrows_extra\p_math_spacing}\donothing} \def\math_arrows_construct#1#2#3#4#5% hm, looks like we do a double mathrel (a bit cleaned up .. needs checking) {\begingroup @@ -106,7 +106,7 @@ \def\m_math_arrows_extra {0}% \edef\p_math_spacing{#1}% \csname\??matharrowsettings - \ifcsname\??matharrowsettings\p_mathspacing\endcsname\p_mathspacing\else\s!unknown\fi + \ifcsname\??matharrowsettings\p_math_spacing\endcsname\p_math_spacing\else\s!unknown\fi \endcsname \mathsurround\zeropoint \muskip0=\muexpr\m_math_arrows_factor\muexpr\thirdoffourarguments #2\onemuskip\relax+\m_math_arrows_extra\onemuskip+\firstoffourarguments #2\onemuskip\relax diff --git a/tex/context/base/meta-pag.mkiv b/tex/context/base/meta-pag.mkiv index 6cea270e3..b9d9fc6ae 100644 --- a/tex/context/base/meta-pag.mkiv +++ b/tex/context/base/meta-pag.mkiv @@ -75,8 +75,8 @@ InnerEdgeWidth:=\the\inneredgewidth; OuterEdgeDistance:=\the\outeredgedistance; OuterEdgeWidth:=\the\outeredgewidth; - PageOffset:=\the\pageoffset; - PageDepth:=\the\pagedepth; + PageOffset:=\the\pagebackgroundoffset; + PageDepth:=\the\pagebackgrounddepth; LayoutColumns:=\the\layoutcolumns; LayoutColumnDistance:=\the\layoutcolumndistance; LayoutColumnWidth:=\the\layoutcolumnwidth; diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index fbd5d585d..a3d2e8ecb 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -204,7 +204,7 @@ return { -- "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", -- - "endgraf", "endpar", "everyendpar", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "normalspace", + "endgraf", "endpar", "everyendpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "normalspace", -- "executeifdefined", -- diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv index fdeff699d..03e7f44e5 100644 --- a/tex/context/base/mult-sys.mkiv +++ b/tex/context/base/mult-sys.mkiv @@ -253,6 +253,9 @@ \definesystemconstant {multi} \definesystemconstant {indeed} +\def\s!parent{=>} % 1% faster +\def\s!child {<=} % 1% faster + \definesystemconstant {hasnumber} \definesystemconstant {hastitle} \definesystemconstant {hascaption} diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua index f68e89954..5b2b32a51 100644 --- a/tex/context/base/node-res.lua +++ b/tex/context/base/node-res.lua @@ -230,7 +230,8 @@ function pool.rule(width,height,depth,dir) if width then n.width = width end if height then n.height = height end if depth then n.depth = depth end - if dir then n.dir = dir end +-- if dir then n.dir = dir end + n.dir = dir or "TLT" -- bug in luatex return n end diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 2803cd518..b757dfdce 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -13,35 +13,27 @@ \writestatus{loading}{ConTeXt Packaging Macros / Ruled Content} -%D The code here is expanded lots of time as framed is used in -%D many places. This is why the code here is (and gets) optimized -%D as much as possible. Also, by avoiding packaging and expansion -%D we also keep tracing reasonable. For instance, multiple stacked -%D backgrounds can slow down a run if not optimized this way. - -% eventually this will use the commandhandler code (same trick as -% with itemize) +%D The code here is expanded lots of time as framed is used in many places. This is +%D why the code here is (and gets) optimized as much as possible. Also, by avoiding +%D packaging and expansion we also keep tracing reasonable. For instance, multiple +%D stacked backgrounds can slow down a run if not optimized this way. \registerctxluafile{pack-rul}{1.001} \unprotect -\definesystemvariable {fc} % FramedContent -\definesystemvariable {od} % Omlijnd Defaults (simple) -> check page-bck too \definesystemvariable {ol} % OmLijnd -> check scrn-fld too %D \macros %D {linewidth, setuplinewidth} %D -%D This module deals with rules (lines) in several ways. First -%D we introduce two macros that can be used to set some common -%D characteristics. +%D This module deals with rules (lines) in several ways. First we introduce two +%D macros that can be used to set some common characteristics. %D %D \showsetup{setuplinewidth} %D -%D The linewidth is available in \type{\linewidth}. The -%D preset value of .4pt equals the default hard coded \TEX\ -%D rule width. +%D The linewidth is available in \type{\linewidth}. The preset value of .4pt equals +%D the default hard coded \TEX\ rule width. \newdimen\linewidth @@ -67,7 +59,7 @@ \to \everysetupscreens \setupscreens - [\c!screen=0.90] % was 0.95 but that's hardly visible + [\c!screen=.90] % was .95 but that's hardly visible %D The parameter handler: @@ -77,41 +69,26 @@ \installcorenamespace{framedleft} \installcorenamespace{framedright} -\let\currentframed\s!unknown % brrr must have a value - -% \def\framedparameter #1{\csname\doframedparameter\currentframed{#1}\endcsname} -% \def\framedparameterhash#1{\doframedparameterhash \currentframed#1} +\installcorenamespace{regularframed} +\installcorenamespace{simplifiedframed} -\def\framedparameter #1{\csname\ifcsname\currentframed#1\endcsname\currentframed#1\else\expandafter\doframedparentparameter\csname\currentframed\s!parent\endcsname{#1}\fi\endcsname} -\def\framedparameterhash#1{\ifcsname\currentframed#1\endcsname\currentframed\else\expandafter\doframedparentparameterhash\csname\currentframed\s!parent\endcsname#1\fi} +\installcommandhandler \??framed {framed} \??framed -\def\doframedparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\doframedparentparameter \csname#1\s!parent\endcsname{#2}\fi} -\def\doframedparameterhash#1#2{\ifcsname#1#2\endcsname #1\else\expandafter\doframedparentparameterhash\csname#1\s!parent\endcsname#2\fi} +\let\pack_framed_framedparameter \framedparameter +\let\pack_framed_framedparameterhash\framedparameterhash +\let\pack_framed_setupcurrentframed \setupcurrentframed -\def\doframedparentparameter #1#2{\ifx#1\relax\s!empty\else\doframedparameter #1{#2}\fi} -\def\doframedparentparameterhash#1#2{\ifx#1\relax \else\doframedparameterhash#1#2\fi} +\def\pack_framed_initialize + {\let\framedparameter \pack_framed_framedparameter + \let\framedparameterhash\pack_framed_framedparameterhash + \let\setupcurrentframed \pack_framed_setupcurrentframed + \inframedtrue} -\def\doframedparentparameter#1#2{\ifx#1\relax\doframedrootparameter#2\else\doframedparameter#1{#2}\fi} -\def\doframedrootparameter #1{\ifcsname\??framed#1\endcsname\??framed#1\else\s!empty\fi} - -\def\useframedstyleandcolor#1#2% style color - {\edef\currentstyleparameter{\framedparameter#1}% - \edef\currentcolorparameter{\framedparameter#2}% - \ifx\currentstyleparameter\empty\else\dousestyleparameter\currentstyleparameter\fi - \ifx\currentcolorparameter\empty\else\dousecolorparameter\currentcolorparameter\fi} +%D A helper: \def\frameddimension#1{\the\dimexpr\framedparameter{#1}\relax} -% \unexpanded\def\installsomebackground#1#2{\inheritlocalframed[\??ma#1#2][\??od]} - -\let\normalframedparameter \framedparameter -\let\normalframedparameterhash\framedparameterhash - -\def\pack_framed_initialize#1% will be inlined - {\inframedtrue - \edef\currentframed{#1}% - \let\framedparameter \normalframedparameter - \let\framedparameterhash\normalframedparameterhash} +%D Inheritance: \def\installinheritedframed#1% {\normalexpanded{\doinstallinheritedframed @@ -120,20 +97,22 @@ \expandafter\noexpand\csname #1parameterhash\endcsname \expandafter\noexpand\csname do#1parameter\endcsname \expandafter\noexpand\csname do#1parentparameter\endcsname - \expandafter\noexpand\csname do#1rootparameter\endcsname + \expandafter\noexpand\csname root#1parameter\endcsname + \expandafter\noexpand\csname setupcurrent#1\endcsname \expandafter\noexpand\csname inherited#1framed\endcsname \noexpand\??framed}} % if needed we can have a variant -\unexpanded\def\doinstallinheritedframed#1#2#3#4#5#6#7#8% - {\def#5##1##2{\ifx##1\relax#6{##2}\else#4##1{##2}\fi}% - \def#6##1{\ifcsname#8##1\endcsname#8##1\else\s!empty\fi}% - \unexpanded\def#7% +\unexpanded\def\doinstallinheritedframed#1#2#3#4#5#6#7#8#9% + {\def#5##1##2{\ifx##1\relax#6{##2}\else#4{##1}{##2}\fi}% + \def#6##1{\ifcsname#9:##1\endcsname#9:##1\else\s!empty\fi}% root + \unexpanded\def#8% {\bgroup \bgroup \inframedtrue - \let\currentframed #1% not used (more for tracing) + \let\currentframed #1% \let\framedparameter #2% \let\framedparameterhash#3% + \let\setupcurrentframed #7% \pack_framed_process_indeed}} \unexpanded\def\installframedcommandhandler#1#2#3% @@ -150,12 +129,11 @@ % for regular framed -\getparameters - [\??framed] +\setupframed [\c!width=\v!fit, \c!height=\v!broad, %\c!lines=, - \c!offset=0.25ex, % \defaultframeoffset + \c!offset=.25ex, % \defaultframeoffset \c!empty=\v!no, \c!frame=\v!on, %\c!topframe=, @@ -170,11 +148,12 @@ %\c!foregroundstyle=, %\c!background=, %\c!backgroundscreen=, + \c!backgroundscreen=\defaultbackgroundscreen, %\c!backgroundcolor=, \c!backgroundoffset=\zeropoint, %\c!framecolor=, \c!frameoffset=\zeropoint, - \c!backgroundcorner=\framedparameter\c!corner, + \c!backgroundcorner=\framedparameter\c!corner, % use \p_ here \c!backgroundradius=\framedparameter\c!radius, \c!backgrounddepth=\framedparameter\c!depth, \c!framecorner=\framedparameter\c!corner, @@ -196,21 +175,21 @@ \c!toffset=\zeropoint, \c!boffset=\zeropoint] -% for backgrounds +%D For backgrounds and such: -\getparameters - [\??od] % for fast version +\defineframed + [\??simplifiedframed] [\c!frame=\v!off, \c!depth=\zeropoint, \c!offset=\v!overlay, - %\c!component=, - %\c!region=, + \c!component=, + \c!region=, \c!radius=.5\bodyfontsize, \c!rulethickness=\linewidth, \c!corner=\v!rectangular, \c!backgroundoffset=\zeropoint, \c!frameoffset=\zeropoint, - \c!backgroundcorner=\framedparameter\c!corner, + \c!backgroundcorner=\framedparameter\c!corner, % use \p_ here \c!backgroundradius=\framedparameter\c!radius, \c!backgrounddepth=\framedparameter\c!depth, \c!framecorner=\framedparameter\c!corner, @@ -222,8 +201,14 @@ \c!toffset=\zeropoint, \c!boffset=\zeropoint] -%D We will communicate through module specific variables, current -%D framed parameters and some reserved dimension registers. +\unexpanded\def\definesimplifiedframed[#1]% no settings + {\defineframed[#1][\??simplifiedframed]% + \expandafter\let\csname#1\endcsname\undefined} + +\expandafter\let\csname\??simplifiedframed\endcsname\undefined + +%D We will communicate through module specific variables, current framed +%D parameters and some reserved dimension registers. \newdimen\d_framed_target_wd \newdimen\d_framed_target_ht @@ -281,16 +266,10 @@ \fi} \def\pack_framed_filled_box_round - {\normalexpanded{\doovalbox - {\the\d_framed_target_wd}% - {\the\d_framed_target_ht}% - {\the\d_framed_target_dp}% - {\the\dimexpr\d_framed_linewidth\relax}% - {\the\dimexpr\p_framed_backgroundradius\relax}% - {0}% - {1}% - {\ifx\p_framed_backgroundcorner\v!round0\else\number\p_framed_backgroundcorner\fi}% - }} + {\back_ovalbox + \d_framed_target_wd \d_framed_target_ht \d_framed_target_dp + \d_framed_linewidth \p_framed_backgroundradius + \zerocount \plusone {\ifx\p_framed_backgroundcorner\v!round0\else\number\p_framed_backgroundcorner\fi}} \def\pack_framed_stroked_box {\edef\p_framed_framecorner{\framedparameter\c!framecorner}% @@ -313,16 +292,10 @@ % \pack_framed_stroked_box_normal % later \def\pack_framed_stroked_box_round - {\normalexpanded{\doovalbox - {\the\d_framed_target_wd}% - {\the\d_framed_target_ht}% - {\the\d_framed_target_dp}% - {\the\dimexpr\d_framed_linewidth\relax}% - {\the\dimexpr\p_framed_frameradius\relax}% - {1}% - {0}% - {\ifx\p_framed_framecorner\v!round0\else\number\p_framed_framecorner\fi}% - }} + {\back_ovalbox + \d_framed_target_wd \d_framed_target_ht \d_framed_target_dp + \d_framed_linewidth \p_framed_frameradius + \plusone \zerocount {\ifx\p_framed_framecorner\v!round0\else\number\p_framed_framecorner\fi}} % a lot of weird corners % @@ -382,8 +355,8 @@ \def\pack_framed_background_box_gray_indeed % can be more direct but who cares, just compatibility {\colored[s=\p_framed_backgroundscreen]{\pack_framed_filled_box}} -%D It won't be a surprise that we not only provide gray boxes, -%D but also colored ones. Here it is: +%D It won't be a surprise that we not only provide gray boxes, but also colored +%D ones. Here it is: \def\pack_framed_background_box_color {\edef\p_framed_backgroundcolor{\framedparameter\c!backgroundcolor}% @@ -399,10 +372,9 @@ %D overlaywidth, overlayheight, overlaydepth, %D overlaycolor, overlaylinecolor, overlaylinewidth} %D -%D Before we define the macro that actually takes card of the -%D backgrounds, we introduce overlays. An overlay is something -%D that contrary to its name lays {\em under} the text. An -%D example of an overlay definition is: +%D Before we define the macro that actually takes card of the backgrounds, we +%D introduce overlays. An overlay is something that contrary to its name lays {\em +%D under} the text. An example of an overlay definition is: %D %D \startbuffer[tmp-1] %D \defineoverlay @@ -432,17 +404,16 @@ %D %D \showsetup{defineoverlay} %D -%D This macro's definition is a bit obscure, due the many -%D non||used arguments and the two step call that enable the -%D setting of the width, height and depth variables. -%D Multiple backgrounds are possible and are specified as: +%D This macro's definition is a bit obscure, due the many non||used arguments and +%D the two step call that enable the setting of the width, height and depth +%D variables. Multiple backgrounds are possible and are specified as: %D %D \starttyping %D \framed[background={one,two,three}]{Three backgrounds!} %D \stoptyping %D -%D Most drawing packages only know width and height. Therefore -%D the dimensions have a slightly different meaning here: +%D Most drawing packages only know width and height. Therefore the dimensions have a +%D slightly different meaning here: %D %D \startitemize[packed] %D \item \type{\overlaywidth }: width of the overlay @@ -464,9 +435,8 @@ \newtoks\everyoverlay -%D An example of an initialization is the following (overlays -%D can contain text and be executed under an regime where -%D interlineskip is off). +%D An example of an initialization is the following (overlays can contain text +%D and be executed under an regime where interlineskip is off). \installcorenamespace{overlay} \installcorenamespace{overlaybuiltin} @@ -527,8 +497,8 @@ \expandafter\secondoftwoarguments \fi} -%D The content of the box will be (temporary) saved in a box. We -%D also have an extra box for backgrounds. +%D The content of the box will be (temporary) saved in a box. We also have an +%D extra box for backgrounds. \newbox\b_framed_normal \newbox\b_framed_extra @@ -584,8 +554,8 @@ \expandafter\pack_framed_process_backgrounds \fi#2} -% beware, a backgroundbox can be empty which is another reason -% why we set the width to zero instead of back-skipping +%D Beware, a backgroundbox can be empty which is another reason why we set the +%D width to zero instead of back-skipping. \newdimen\framedbackgroundwidth \newdimen\framedbackgroundheight @@ -624,8 +594,7 @@ \egroup}} \def\pack_framed_overlay_initialize_indeed - {%\writestatus{!!!!}{<<<<<}% - \edef\overlaywidth {\the\d_framed_target_wd\space}% + {\edef\overlaywidth {\the\d_framed_target_wd\space}% \edef\overlayheight {\the\dimexpr\d_framed_target_ht+\d_framed_target_dp\relax\space}% \edef\overlaydepth {\the\d_framed_target_dp\space}% \edef\overlaycolor {\framedparameter\c!backgroundcolor}% let ? @@ -636,8 +605,8 @@ \edef\overlayoffset {\the\framedbackgroundoffset\space}% \backgroundoffset % we steal this one \let\pack_framed_overlay_initialize\relax} -%D One can explictly insert the foreground box. For that -%D purpose we introduce the overlay \type {foreground}. +%D One can explictly insert the foreground box. For that purpose we introduce the +%D overlay \type {foreground}. %D %D We predefine two already familiar backgrounds: @@ -645,14 +614,13 @@ \letvalue{\??overlaybuiltin\v!color }\pack_framed_background_box_color \letvalue{\??overlaybuiltin\v!foreground}\pack_framed_background_box_content % replaces: \defineoverlay[\v!foreground][\foregroundbox] -%D We can specify overlays as a comma separated list of -%D overlays, a sometimes handy feature. - -%D Besides backgrounds (overlays) we also need some macros to -%D draw outlines (ruled borders). Again we have to deal with -%D square and round corners. The first category can be handled -%D by \TEX\ itself, the latter one depends on the driver. This -%D macro also support a negative offset. +%D We can specify overlays as a comma separated list of overlays, a sometimes +%D handy feature. +%D +%D Besides backgrounds (overlays) we also need some macros to draw outlines (ruled +%D borders). Again we have to deal with square and round corners. The first category +%D can be handled by \TEX\ itself, the latter one depends on the driver. This macro +%D also support a negative offset. \def\pack_framed_add_outline {\setbox\b_framed_normal\hbox % rules on top of box @@ -756,11 +724,10 @@ % frame=off,rightframe=small,leftframe=small,topframe=small,bottomframe=on] % {} -%D The next few macros are probably the most misused ones in -%D \CONTEXT. They deal with putting rules around boxes, provide -%D backgrounds, offer alignment features, and some more. We -%D start with defining some booleans. These give an impression -%D of what we are going to take into account. +%D The next few macros are probably the most misused ones in \CONTEXT. They deal +%D with putting rules around boxes, provide backgrounds, offer alignment features, +%D and some more. We start with defining some booleans. These give an impression of +%D what we are going to take into account. % todo : \c_framed_hasoffset % faster : \let\c_framed_hasoffset\falseconditional @@ -778,67 +745,72 @@ %D \macros %D {framed, setupframed} %D -%D Ruled boxes are typeset using \type{\framed}. This command -%D is quite versatile and, although some users will probably -%D seldom use it, one cannot overlook its features. +%D Ruled boxes are typeset using \type{\framed}. This command is quite versatile +%D and, although some users will probably seldom use it, one cannot overlook its +%D features. %D -%D \showsetup{setupframed} -%D \showsetup{framed} +%D \showsetup{setupframed} +%D \showsetup{framed} %D -%D This general macro is a special version of an even more -%D general case, that can easily be linked into other macros -%D that need some kind of framing. The local version is called -%D with an extra parameter: the variable identifier. The reason -%D for passing this identifier between brackets lays in the -%D mere fact that this way we can use the optional argument -%D grabbers. +%D This general macro is a special version of an even more general case, that can +%D easily be linked into other macros that need some kind of framing. The local +%D version is called with an extra parameter: the variable identifier. The reason +%D for passing this identifier between brackets lays in the mere fact that this way +%D we can use the optional argument grabbers. \def\defaultframeoffset{.25ex} -\def\presetlocalframed [#1]{\letvalue {#1\s!parent}\??framed} -\def\inheritlocalframed[#1]#2[#3]{\setevalue{#1\s!parent}{#3}} +\installcorenamespace{regularframedlevel} + +\unexpanded\def\installregularframed#1% + {\defineframed[#1]} + +\unexpanded\def\presetlocalframed[#1]% + {\defineframed[#1]} -\presetlocalframed[\??ol] +% \presetlocalframed[\??framed] -\newcount\framednesting +\newcount\c_pack_framed_nesting + +\unexpanded\def\pack_framed_process_framed[#1]% + {\bgroup + \iffirstargument % faster + \setupcurrentframed[#1]% here ! + \fi + \pack_framed_process_indeed} \unexpanded\def\framed {\bgroup - \advance\framednesting\plusone - \expandafter\let\csname\??ol:\the\framednesting\s!parent\endcsname\??ol - \dodoubleempty\pack_framed_process[\??ol:\the\framednesting]} + \advance\c_pack_framed_nesting\plusone + \expandafter\let\csname\??framed>\the\c_pack_framed_nesting:\s!parent\endcsname\??framed + \edef\currentframed{>\the\c_pack_framed_nesting}% + \pack_framed_initialize + \dosingleempty\pack_framed_process_framed} \unexpanded\def\startframed {\dosingleempty\pack_framed_start_framed} \def\pack_framed_start_framed[#1]% {\bgroup - \advance\framednesting\plusone - \expandafter\let\csname\??ol:\the\framednesting\s!parent\endcsname\??ol + \advance\c_pack_framed_nesting\plusone + \expandafter\let\csname\??framed>\the\c_pack_framed_nesting:\s!parent\endcsname\??framed \iffirstargument\secondargumenttrue\fi % dirty trick - \pack_framed_process[\??ol:\the\framednesting][#1]% + \edef\currentframed{>\the\c_pack_framed_nesting}% + \pack_framed_initialize + \pack_framed_process_framed[#1]% can be inlined \bgroup} \let\stopframed\egroup -\unexpanded\def\setupframed - {\dodoubleempty\dosetupframed} - -\unexpanded\def\normalframedwithsettings +\unexpanded\def\normalframedwithsettings[#1]% {\bgroup - \advance\framednesting\plusone - \expandafter\let\csname\??ol:\the\framednesting\s!parent\endcsname\??ol - \pack_framed_process[\??ol:\the\framednesting]} - -% we can consider setting the parent of the regular framed to -% something else in the otr so that we isolate it there - -\def\dosetupframed[#1][#2]% - {\ifsecondargument - \getparameters[\??ol#1][#2]% - \else - \getparameters[\??ol][#1]% - \fi} + \advance\c_pack_framed_nesting\plusone + \expandafter\let\csname\??framed>\the\c_pack_framed_nesting:\s!parent\endcsname\??framed + \bgroup + \edef\currentframed{>\the\c_pack_framed_nesting}% + \pack_framed_initialize + \setupcurrentframed[#1]% + \pack_framed_process_indeed} %D \startbuffer %D \setupframed [framecolor=yellow] \framed{A} @@ -858,13 +830,11 @@ %D \macros %D {ifinframed} %D -%D The normal case first presets all parameters and next starts -%D looking for the user supplied ones. The first step is -%D omitted in the local case, because these are preset at -%D declaration time and keep their values unless explictly -%D changed. By presetting the variables everytime the normal -%D command is called, we can use this command nested, without -%D the unwanted side effect of inheritance. The boolean is +%D The normal case first presets all parameters and next starts looking for the user +%D supplied ones. The first step is omitted in the local case, because these are +%D preset at declaration time and keep their values unless explictly changed. By +%D presetting the variables everytime the normal command is called, we can use this +%D command nested, without the unwanted side effect of inheritance. The boolean is %D used to speed up the color stack. \newif\ifinframed @@ -874,7 +844,8 @@ \unexpanded\def\fastlocalframed[#1]#2[#3]#4% 3-4 {\bgroup - \pack_framed_initialize{#1}% + \edef\currentframed{#1}% + \pack_framed_initialize \setbox\b_framed_normal\hbox{#4}% \edef\p_framed_region{\framedparameter\c!region}% \ifx\p_framed_region\v!yes % maybe later named @@ -909,12 +880,13 @@ \box\b_framed_normal \egroup} -%D The next macro uses a box and takes its natural width and -%D height so these can better be correct. +%D The next macro uses a box and takes its natural width and height so these +%D can better be correct. -\def\localbackgroundframed#1#2#3% namespace component box +\unexpanded\def\localbackgroundframed#1#2#3% namespace component box {\bgroup - \pack_framed_initialize{#1}% + \edef\currentframed{#1}% + \pack_framed_initialize \setbox\b_framed_normal\box#3% \edef\p_framed_region{\framedparameter\c!region}% \ifx\p_framed_region\v!yes % maybe later named @@ -967,27 +939,30 @@ \unexpanded\def\localframed {\bgroup - \dodoubleempty\pack_framed_process} + \dodoubleempty\pack_framed_local} -\unexpanded\def\pack_framed_process[#1][#2]% assumes a \dodoubleempty (slows down), also should have leading \bgroup +\unexpanded\def\localframed[#1][#2]% {\bgroup - \pack_framed_initialize{#1}% + \edef\currentframed{#1}% + \pack_framed_initialize \ifsecondargument % faster - \getparameters[\currentframed][#2]% here ! + \setupcurrentframed[#2]% here ! \fi \pack_framed_process_indeed} \unexpanded\def\directlocalframed[#1]% no optional {\bgroup \bgroup - \pack_framed_initialize{#1}% + \edef\currentframed{#1}% + \pack_framed_initialize \pack_framed_process_indeed} \unexpanded\def\localframedwithsettings[#1][#2]% no checking (so no spaces between) {\bgroup \bgroup - \pack_framed_initialize{#1}% - \getparameters[\currentframed][#2]% here ! + \edef\currentframed{#1}% + \pack_framed_initialize + \setupcurrentframed[#2]% here ! \pack_framed_process_indeed} % done @@ -1316,11 +1291,10 @@ \def\pack_framed_do_top {\raggedtopcommand\framedparameter\c!top} \def\pack_framed_do_bottom{\framedparameter\c!bottom\raggedbottomcommand} -%D Carefull analysis of this macro will learn us that not all -%D branches in the last conditionals can be encountered, that -%D is, some assignments to \type{\next} will never occur. -%D Nevertheless we implement the whole scheme, if not for -%D future extensions. +%D Carefull analysis of this macro will learn us that not all branches in the last +%D conditionals can be encountered, that is, some assignments to \type{\next} will +%D never occur. Nevertheless we implement the whole scheme, if not for future +%D extensions. %D \macros %D {doassigncheckedframeoffset} @@ -1342,11 +1316,10 @@ %D \macros %D {ifreshapeframebox} %D -%D The last few lines tell what to do after the content of the -%D box is collected and passed to the next macro. In the case -%D of a fixed width and centered alignment, the content is -%D evaluated and used to determine the most natural width. The -%D rest of the code deals with backgrounds and frames. +%D The last few lines tell what to do after the content of the box is collected and +%D passed to the next macro. In the case of a fixed width and centered alignment, +%D the content is evaluated and used to determine the most natural width. The rest +%D of the code deals with backgrounds and frames. \newif\ifreshapeframebox \reshapeframeboxtrue @@ -1659,9 +1632,9 @@ \def\pack_framed_stop_orientation_even {\setbox\b_framed_normal\hbox{\dorotatebox\p_framed_orientation\hbox{\box\b_framed_normal}}} -%D The last conditional takes care of the special situation of -%D in||line \inframed[height=3cm]{framed} boxes. Such boxes have -%D to be \inframed{aligned} with the running text. +%D The last conditional takes care of the special situation of in||line \inframed +%D [height=3cm] {framed} boxes. Such boxes have to be \inframed {aligned} with the +%D running text. \unexpanded\def\inframed {\dosingleempty\pack_framed_inline} @@ -1674,15 +1647,14 @@ \def\pack_framed_inline[% {\framed[\c!location=\v!low,} -%D When we set \type{empty} to \type{yes}, we get -%D ourselves a frame and/or background, but no content, so -%D actually we have a sort of phantom framed box. +%D When we set \type{empty} to \type{yes}, we get ourselves a frame and/or background, +%D but no content, so actually we have a sort of phantom framed box. %D \macros %D {mframed, minframed} %D -%D When Tobias asked how to frame mathematical elements in -%D formulas, Taco's posted the next macro: +%D When Tobias asked how to frame mathematical elements in formulas, Taco's posted the +%D next macro: %D %D \starttyping %D \def\mframed#1% @@ -1694,9 +1666,8 @@ %D \fi} %D \stoptyping %D -%D Because \type {\ifinner} does not (always) reports what -%D one would expect, we move the test to the outer level. We -%D also want to pass arguments, +%D Because \type {\ifinner} does not (always) reports what one would expect, we move the +%D test to the outer level. We also want to pass arguments, %D %D \starttyping %D \def\mframed% @@ -1715,8 +1686,8 @@ %D \fi} %D \stoptyping %D -%D Still better is the next alternative, if only because it -%D takes care of setting the super- and subscripts styles +%D Still better is the next alternative, if only because it takes care of setting the super- +%D and subscripts styles \newcount\c_framed_mstyle @@ -1726,22 +1697,6 @@ \vphantom{(}% \Ustopmath} -% \unexpanded\def\mframed {\dosingleempty\pack_framed_math_display} -% \unexpanded\def\inmframed{\dosingleempty\pack_framed_math_inline } -% -% \def\pack_framed_math_inline[#1]#2% -% {\begingroup -% \c_framed_mstyle\mathstyle -% \inframed[#1]{\Ustartmath\triggermathstyle\c_framed_mstyle#2\Ustopmath}% -% \endgroup} -% -% \def\pack_framed_math_display[#1]#2% -% {\begingroup -% \c_framed_mstyle\mathstyle -% \let\normalstrut\pack_framed_math_strut -% \framed[#1]{\Ustartmath\triggermathstyle\c_framed_mstyle#2\Ustopmath}% -% \endgroup} - \installcorenamespace{mathframed} \installframedcommandhandler \??mathframed {mathframed} \??mathframed @@ -1767,8 +1722,7 @@ \definemathframed[mframed] \definemathframed[inmframed][\c!location=\v!low] -%D So instead of the rather versatile \type {\framed}, we ue -%D the \type {\mframed}. +%D So instead of the rather versatile \type {\framed}, we use \type {\mframed}: %D %D \startbuffer %D \startformula @@ -1789,11 +1743,9 @@ %D %D \typebuffer \getbuffer %D -%D As usual, one can specify in what way the text should be -%D framed. One should be aware of the fact that, inorder to -%D preserve the proper spacing, the \type {offset} is set to -%D \type {overlay} and \type {frameoffset} is used used -%D instead. +%D As usual, one can specify in what way the text should be framed. One should be +%D aware of the fact that, inorder to preserve the proper spacing, the \type +%D {offset} is set to \type {overlay} and \type {frameoffset} is used used instead. %D %D \startbuffer %D \startformula @@ -1803,13 +1755,11 @@ %D %D \typebuffer \getbuffer %D -%D For inline use, we also provide the \type {\inmframed} -%D alternative: we want $x \times \inmframed{y}$ in inline -%D math, right? +%D For inline use, we also provide the \type {\inmframed} alternative: we want $x +%D \times \inmframed{y}$ in inline math, right? -%D This previous framing macros needs a lot of alternatives for -%D putting rules around boxes, inserting offsets and aligning -%D text. Each step is handled by separate macros. +%D This previous framing macros needs a lot of alternatives for putting rules around +%D boxes, inserting offsets and aligning text. Each step is handled by separate macros. \newdimen\d_framed_applied_offset \newdimen\d_framed_loffset @@ -1849,8 +1799,8 @@ \hbox{\kern\d_framed_applied_offset\box\b_framed_normal\kern\d_framed_applied_offset}% \kern\d_framed_applied_offset}} -%D Let's hope that the next few examples show us enough of -%D what needs to be done by the auxiliary macros. +%D Let's hope that the next few examples show us enough of what needs to be +%D done by the auxiliary macros. %D %D \startbuffer %D \framed[height=1cm,offset=.5cm] {rule based learning} @@ -1904,25 +1854,21 @@ %D \hbox{\dontcomplain\getbuffer} %D \stoplinecorrection %D -%D So now we're ready for the complicated stuff. We distinguish -%D between borders with straight lines and those with round -%D corners. When using the first alternative it is possible to -%D turn off one or more lines. More fancy shapes are also -%D possible by specifying dedicated backgrounds. Turning lines -%D on and off is implemented as efficient as possible and as a -%D result is interface language dependant. This next -%D implementation evolved from simpler ones. It puts for -%D instance the rules on top of the content and provides -%D additional offset capabilities. The lot of calls to other -%D macros makes this mechanism not that easy to comprehend. - -%D We handle left, right or middle alignment as well as fixed -%D or free widths and heights. Each combination gets its own -%D macro. - -%D The following code handles one-liners: \type{align={line,flushright}}. -%D Beware, since we entered a group and either or not grab the next -%D bgroup token, we need to finish the group in the oneliner mode. +%D So now we're ready for the complicated stuff. We distinguish between borders with +%D straight lines and those with round corners. When using the first alternative it +%D is possible to turn off one or more lines. More fancy shapes are also possible by +%D specifying dedicated backgrounds. Turning lines on and off is implemented as +%D efficient as possible and as a result is interface language dependant. This next +%D implementation evolved from simpler ones. It puts for instance the rules on top +%D of the content and provides additional offset capabilities. The lot of calls to +%D other macros makes this mechanism not that easy to comprehend. +%D +%D We handle left, right or middle alignment as well as fixed or free widths and +%D heights. Each combination gets its own macro. +%D +%D The following code handles one-liners: \type {align={line,flushright}}. Beware, +%D since we entered a group and either or not grab the next bgroup token, we need to +%D finish the group in the oneliner mode. \ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi @@ -2102,11 +2048,10 @@ \localstrut \doformatonelinerbox} -%D On the next page we show some examples of how these macros -%D come into action. The examples show us how -%D \type {fit}, \type {broad} dimensions influence the -%D formatting. Watch the visualized struts. \footnote {Here we -%D used \type {\showstruts}.} +%D On the next page we show some examples of how these macros come into action. The +%D examples show us how \type {fit}, \type {broad} dimensions influence the +%D formatting. Watch the visualized struts. \footnote {Here we used \type +%D {\showstruts}.} %D %D \startpostponing %D \bgroup @@ -2161,9 +2106,8 @@ %D \macros %D {framednoflines, framedlastlength} %D -%D It is possible to let the frame macro calculate the width -%D of a centered box automatically (\type {fit}). When -%D doing so, we need to reshape the box: +%D It is possible to let the frame macro calculate the width of a centered box +%D automatically (\type {fit}). When doing so, we need to reshape the box: \newcount\framednoflines \newdimen\framedfirstheight @@ -2195,13 +2139,12 @@ % \startformula \startalign \NC \int_01 \NC B \NR \intertext{test} \NC \int_01 \NC D \NR \stopalign \stopformula % \stopTEXpage -%D The examples on the next page show how one can give the -%D frame as well as the background an additional offset and -%D even a bit more depth. The blue outline is the frame, the -%D red box is the background and the small black outline is the -%D visualization of the resulting box, that is, we applied -%D \type{\ruledhbox} to the result. - +%D The examples on the next page show how one can give the frame as well as the +%D background an additional offset and even a bit more depth. The blue outline is +%D the frame, the red box is the background and the small black outline is the +%D visualization of the resulting box, that is, we applied \type {\ruledhbox} to +%D the result. +%D %D \startpostponing %D \bgroup %D \unprotect @@ -2251,9 +2194,8 @@ %D \egroup %D \stoppostponing -%D We can draw lines from left to right and top to bottom by -%D using the normal \type{\hairline} command. Both directions -%D need a different treatment. +%D We can draw lines from left to right and top to bottom by using the normal \type +%D {\hairline} command. Both directions need a different treatment. %D %D \startbuffer %D \framed[width=4cm] {alfa\hairline beta\hairline gamma} @@ -2267,26 +2209,8 @@ %D \hbox{\getbuffer} %D \stoplinecorrection %D -%D These macros try to adapt their behaviour as good as -%D possible to the circumstances and act as natural as -%D possible. - -% \unexpanded\def\pack_framed_vboxed_hairline -% {\bgroup -% \dimen2=\ifconditional\c_framed_has_offset \localoffset \else \zeropoint \fi -% \dimen4=\dimexpr\dimen2+\d_framed_linewidth\relax -% \setbox0\vbox -% {\advance\hsize 2\dimen4 -% \vskip\dimen2 -% \hrule -% \!!height\d_framed_linewidth -% \!!depth\zeropoint -% \!!width\hsize -% \vskip\dimen2}% -% \endgraf\obeydepth\nointerlineskip -% \moveleft\dimen4\box0 -% \endgraf\nointerlineskip\localbegstrut % beware, we might kill it in a style using \vskip\lineheight -% \egroup} % so this must not be changed +%D These macros try to adapt their behaviour as good as possible to the circumstances +%D and act as natural as possible. \unexpanded\def\pack_framed_vboxed_hairline % nasty overlay mess .. needed for autowidth {\begingroup @@ -2312,32 +2236,29 @@ \localbegstrut \endgroup} -% todo: - \unexpanded\def\pack_framed_hboxed_hairline % use framed dimen {\bgroup - \dimen2=\ifconditional\c_framed_has_offset \localoffset \else \zeropoint \fi + \scratchoffset\ifconditional\c_framed_has_offset \localoffset \else \zeropoint \fi \ifconditional\c_framed_has_height - \dimen4\dimexpr\localheight/2+\strutdp-2\d_framed_linewidth\relax - \dimen6\dimexpr\localheight/2-\strutdp+2\d_framed_linewidth\relax + \dimen\scratchheight\dimexpr\localheight/\plustwo+\strutdp-\plustwo\d_framed_linewidth\relax + \dimen\scratchdepth \dimexpr\localheight/\plustwo-\strutdp+\plustwo\d_framed_linewidth\relax \else - \dimen4\dimexpr\strutht+\dimen2\relax - \dimen6\dimexpr\strutdp+\dimen2\relax + \dimen\scratchheight\dimexpr\strutht+\scratchoffset\relax + \dimen\scratchdepth \dimexpr\strutdp+\scratchoffset\relax \fi \unskip \setbox\scratchbox\hbox - {\hskip\dimen2 - \vrule\!!height\dimen4\!!depth\dimen6\!!width\d_framed_linewidth - \hskip\dimen2}% + {\hskip\scratchoffset + \vrule\!!height\dimen\scratchheight\!!depth\dimen\scratchdepth\!!width\d_framed_linewidth + \hskip\scratchoffset}% \ht\scratchbox\strutht \dp\scratchbox\strutdp \box\scratchbox \ignorespaces \egroup} -%D The argument of the frame command accepts \type{\\} as a -%D sort of newline signal. In horizontal boxes it expands to a -%D space. +%D The argument of the frame command accepts \type{\\} as a sort of newline signal. In +%D horizontal boxes it expands to a space. \unexpanded\def\pack_framed_vboxed_newline {\endgraf\ignorespaces} @@ -2345,10 +2266,9 @@ \unexpanded\def\pack_framed_hboxed_newline {\unskip\normalspace\ignorespaces} -%D We can set each rule on or off. The default setting is -%D inherited from \type{frame}. An earlier implementation -%D use a bit different approach, but the new one seems more -%D natural: +%D We can set each rule on or off. The default setting is inherited from +%D \type {frame}. An earlier implementation use a bit different approach, but the new +%D one seems more natural: %D %D \bgroup %D \setuptyping[margin=0pt] @@ -2388,10 +2308,9 @@ %D \macros %D {startframedtext, setupframedtexts, defineframedtext} %D -%D The general framing command we discussed previously, is not -%D entirely suited for what we call framed texts, as for -%D instance used in intermezzo's. The next examples show what -%D we have in mind. +%D The general framing command we discussed previously, is not entirely suited for +%D what we call framed texts, as for instance used in intermezzo's. The next +%D examples show what we have in mind. %D %D \startbuffer[framed-0] %D \setupframedtexts @@ -2453,8 +2372,8 @@ %D \bgroup \setuptyping[margin=0pt] \getbuffer[framed-3] \egroup %D \bgroup \setuptyping[margin=0pt] \getbuffer[framed-4] \egroup %D -%D Here we can see that we have a predefined framed text class -%D as well as the tools for defining our own. So we have: +%D Here we can see that we have a predefined framed text class as well as the +%D tools for defining our own. So we have: %D %D \showsetup{setupframedtexts} %D @@ -2477,7 +2396,7 @@ \let\setupframedtexts\setupframedtext \setupframedtext - [\c!width=0.75\hsize, + [\c!width=.75\hsize, \c!height=\v!fit, \c!align=\v!yes, %\c!top=, @@ -2550,7 +2469,6 @@ \hsize\localhsize % \insidefloattrue % ? better \normalexpanded{\switchtobodyfont[\framedtextparameter\c!bodyfont]}% -% \startcolor[\framedtextparameter\c!color]% \letframedtextparameter\c!strut\v!no \inheritedframedtextframed\bgroup \let\\=\endgraf @@ -2560,9 +2478,8 @@ \setupindenting[\framedtextparameter\c!indenting]% \useframedtextstyleandcolor\c!style\c!color} -%D The \type {none} option is handy for nested usage, as -%D in the presentation styles, where we don't want -%D interference. +%D The \type {none} option is handy for nested usage, as in the presentation +%D styles, where we don't want interference. \defineplacement[\??framedtext][\s!parent=\??framedtext\currentframedtext] @@ -2571,7 +2488,6 @@ \removelastskip \doif{\framedtextparameter\c!depthcorrection}\v!on\pack_framed_text_stop_depth_correction \stopboxedcontent -% \stopcolor \ifconditional\c_framed_text_location_none \egroup \box\b_framed_normal @@ -2640,8 +2556,8 @@ %D \egroup %D \stoptyping -%D The simple brace (or group) delimited case is typeset -%D slightly different and is not aligned. +%D The simple brace (or group) delimited case is typeset slightly different +%D and is not aligned. \unexpanded\def\pack_framed_text_direct#1% {\bgroup @@ -2668,7 +2584,8 @@ \egroup \egroup} -\defineframedtext[\v!framedtext] +\defineframedtext + [\v!framedtext] %D \macros %D {defineframed} @@ -2677,47 +2594,46 @@ %D %D \showsetup{defineframed} %D -%D As suggested by Wolfgang we can now use the new \MKIV\ inheritance -%D model instead of passing a combination of arguments. This also -%D also simplified the \type {\setupframed} command. There are -%D certainly more places where such improvements can be made. +%D As suggested by Wolfgang we can now use the new \MKIV\ inheritance model instead +%D of passing a combination of arguments. This also also simplified the \type +%D {\setupframed} command. There are certainly more places where such improvements +%D can be made. % actually, this can be another command handler .. todo -\unexpanded\def\defineframed - {\dotripleempty\pack_framed_define} +\appendtoks + \ifcsname\??regularframedlevel\currentframed\endcsname + % already defined, keeps settings + \else + \expandafter\newcount\csname\??regularframedlevel\currentframed\endcsname + \fi +\to \everypresetframed -\def\pack_framed_define[#1][#2][#3]% - {\ifcsname\??ol:#1\endcsname - % already defined, keeps settings - \else - \expandafter\newcount\csname\??ol:#1\endcsname % \the\everypresetframed - \fi - \ifsecondargument - \doifassignmentelse{#2} - {\getparameters[\??ol#1][\s!parent=\??ol,#2]}% - {\ifcsname#2\endcsname - \getparameters[\??ol#1][\s!parent=\??ol#2,#3]% - \else - \getparameters[\??ol#1][\s!parent=\??ol,#3]% - \fi}% - \else - \getparameters[\??ol#1][\s!parent=\??ol,#2]% - \fi - \setuvalue{#1}{\pack_framed_defined_process[#1]}}% % \the\everydefineframed +\appendtoks + \setuevalue\currentframed{\pack_framed_defined_process[\currentframed]}% +\to \everydefineframed \newcount\c_framed_crap \unexpanded\def\pack_framed_defined_process[#1]% official (not much checking, todo: parent) {\bgroup - \ifcsname\??ol:#1\endcsname - \expandafter\let\expandafter\c_framed_temp\csname\??ol:#1\endcsname + \ifcsname\??regularframedlevel#1\endcsname + \expandafter\let\expandafter\c_framed_temp\csname\??regularframedlevel#1\endcsname \else \let\c_framed_temp\c_framed_crap \fi \advance\c_framed_temp\plusone - \expandafter\def\csname\??ol#1:\the\c_framed_temp\s!parent\endcsname{\??ol#1}% \inheritlocalframed - \dodoubleempty\pack_framed_process[\??ol#1:\the\c_framed_temp]} + \expandafter\def\csname\??framed#1>\the\c_framed_temp:\s!parent\endcsname{\??framed#1}% \inheritlocalframed + \bgroup + \edef\currentframed{#1>\the\c_pack_framed_temp}% + \pack_framed_initialize + \dosingleempty\pack_framed_process} + +\def\pack_framed_defined_process_indeed[#1]% + {\ifsingleargument % faster + \setupcurrentframed[#1]% here ! + \fi + \pack_framed_process_indeed} \let\placeframed\pack_framed_defined_process % new per 2012/04/23 @@ -2729,8 +2645,8 @@ %D %D but the existing one is ok as well (less csname messy too). -%D New, for the moment private; let's see when GB finds out -%D about this one and its obscure usage. It's used in: +%D New, for the moment private; let's see when GB finds out about this one and its +%D obscure usage. It's used in: %D %D \startbuffer %D \defineframedtext @@ -2764,21 +2680,17 @@ %D %D \typebuffer -% to be redone +\installcorenamespace{framedcontent} -\def\framedcontentparameter #1{\csname\doframedcontentparameter{\??fc\currentframedcontent}#1\endcsname} -\def\doframedcontentparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\doframedcontentparentparameter\csname#1\s!parent\endcsname#2\fi} -\def\doframedcontentparentparameter#1#2{\ifx#1\relax\s!empty\else\doframedcontentparameter#1#2\fi} -\def\letframedcontentparameter #1{\expandafter\let\csname\??fc\currentframedcontent#1\endcsname} +\installframedcommandhandler \??framedcontent {framedcontent} \??framedcontent -\presetlocalframed[\??fc] - -\getparameters - [\??fc] +\setupframedcontent [\c!leftoffset=\zeropoint, - \c!rightoffset=\framedcontentparameter\c!leftoffset, + %\c!rightoffset=\framedcontentparameter\c!leftoffset, + \c!rightoffset=\scratchleftoffset, \c!topoffset=\zeropoint, - \c!bottomoffset=\framedcontentparameter\c!topoffset, + %\c!bottomoffset=\framedcontentparameter\c!topoffset, + \c!bottomoffset=\scratchtopoffset, \c!strut=\v!no, %\c!linecorrection=\v!no, %\c!left=, @@ -2786,19 +2698,6 @@ %\c!width=\v!fit, \c!offset=\v!overlay] -\unexpanded\def\defineframedcontent - {\dodoubleempty\dodefineframedcontent} - -\def\dodefineframedcontent[#1][#2]% - {\getparameters[\??fc#1][\s!parent=\??fc,#2]} - -\unexpanded\def\setupframedcontent - {\dodoubleempty\dosetupframedcontent} - -\def\dosetupframedcontent[#1][#2]% - {\def\docommand##1{\getparameters[\??fc##1][#2]}% - \processcommacommand[#1]\docommand} - \unexpanded\def\startframedcontent {\dosingleempty\pack_framed_start_content} @@ -2816,11 +2715,15 @@ {\setbox\b_framed_normal\hbox\bgroup \setlocalhsize \hsize\localhsize - \advance\hsize\dimexpr-\framedcontentparameter\c!leftoffset-\framedcontentparameter\c!rightoffset \relax - \advance\vsize\dimexpr-\framedcontentparameter\c!topoffset -\framedcontentparameter\c!bottomoffset\relax - \hskip\framedcontentparameter\c!leftoffset + \scratchleftoffset \framedcontentparameter\c!leftoffset \relax + \scratchrightoffset \framedcontentparameter\c!rightoffset \relax + \scratchtopoffset \framedcontentparameter\c!topoffset \relax + \scratchbottomoffset\framedcontentparameter\c!bottomoffset\relax + \advance\hsize\dimexpr-\scratchleftoffset-\scratchrightoffset \relax + \advance\vsize\dimexpr-\scratchtopoffset -\scratchbottomoffset\relax + \hskip\scratchleftoffset \vbox\bgroup - \vskip\framedcontentparameter\c!topoffset + \vskip\scratchtopoffset \vbox\bgroup \forgetall \blank[\v!disable]} @@ -2828,9 +2731,9 @@ \def\pack_framed_stop_content_indeed {\removelastskip \egroup - \vskip\framedcontentparameter\c!bottomoffset + \vskip\scratchbottomoffset \egroup - \hskip\framedcontentparameter\c!rightoffset + \hskip\scratchrightoffset \egroup \doif{\framedcontentparameter\c!width}\v!fit {\letframedcontentparameter\c!width\v!fixed}% no shapebox @@ -2842,7 +2745,7 @@ % plaats ? \ifdone\startlinecorrection\fi \framedcontentparameter\c!left % new - \localframed[\??fc\currentframedcontent]{\box\b_framed_normal}% hm + \inheritedframedcontentframed{\box\b_framed_normal}% hm \framedcontentparameter\c!right % new \ifdone\stoplinecorrection\fi \egroup} @@ -2852,54 +2755,4 @@ \setuplinewidth [\v!medium] -% We could omit the empty setings but that is some 10% slower due to -% extra testing in the chain. - -\setupframed - [\c!width=\v!fit, - \c!height=\v!broad, - %\c!lines=, - \c!offset=0.25ex, % \defaultframeoffset - \c!empty=\v!no, - \c!frame=\v!on, - %\c!topframe=, - %\c!bottomframe=, - %\c!leftframe=, - %\c!rightframe=, - \c!radius=.5\bodyfontsize, - \c!rulethickness=\linewidth, - \c!corner=\v!rectangular, - \c!depth=\zeropoint, - %\c!foregroundcolor=, - %\c!foregroundstyle=, - %\c!background=, - \c!backgroundscreen=\defaultbackgroundscreen, - %\c!backgroundcolor=, - \c!backgroundoffset=\zeropoint, - %\c!framecolor=, - \c!frameoffset=\zeropoint, - % somewhat messy - \c!backgroundcorner=\framedparameter\c!corner, - \c!backgroundradius=\framedparameter\c!radius, - \c!backgrounddepth=\framedparameter\c!depth, - \c!framecorner=\framedparameter\c!corner, - \c!frameradius=\framedparameter\c!radius, - \c!framedepth=\framedparameter\c!depth, - % - %\c!component=, - %\c!region=, - %\c!align=, - \c!bottom=\vss, - %\c!top=, - \c!autostrut=\v!yes, - \c!location=\v!normal, - %\c!orientation=, - \c!autowidth=\v!yes, - %\c!setups=, - \c!strut=\v!yes, - %\c!loffset=\zeropoint, - %\c!roffset=\zeropoint, - %\c!toffset=\zeropoint, - ]%\c!boffset=\zeropoint] - \protect \endinput diff --git a/tex/context/base/page-bck.mkiv b/tex/context/base/page-bck.mkiv index 4fbbba9f4..2320e4e0a 100644 --- a/tex/context/base/page-bck.mkiv +++ b/tex/context/base/page-bck.mkiv @@ -11,19 +11,16 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% todo: ma:r:c -% -% Currently the text cells are fakes and no (foreground) frames which -% makes sense as order might matter e.g. is text sticks in other -% cells. The page, text etc ares do support foreground order change. +% Currently the text cells are fakes and no (foreground) frames which makes sense +% as order might matter e.g. is text sticks in other cells. The page, text etc +% areas do support foreground order change. \writestatus{loading}{ConTeXt Page Macros / Backgrounds} \unprotect -%D For special purposes, users can question the \type -%D {*background} mode. This mode is only available when -%D typesetting the pagebody. +%D For special purposes, users can question the \type {*background} mode. This mode +%D is only available when typesetting the pagebody. %D %D \starttyping %D \startmode[*background] ... @@ -48,17 +45,17 @@ \setfalse\c_page_backgrounds_new_left \setfalse\c_page_backgrounds_some} -%D We keep calculations and checks to a minimum and also -%D try to minimize the amount of tracing due to expansion. +%D We keep calculations and checks to a minimum and also try to minimize +%D the amount of tracing due to expansion. \let\currentotrbackground\empty -\def\page_backgrounds_set_yes{\expandafter\let\csname\currentotrbackground\endcsname\relax } -\def\page_backgrounds_set_nop{\expandafter\let\csname\currentotrbackground\endcsname\undefined} +%D This is the only spot where we hav ea low level dependency on the way +%D parent chains are defined but we want the speed. \def\page_backgrounds_check_background - {\ifcsname\currentotrbackground\c!background\endcsname - \edef\page_background_temp{\csname\currentotrbackground\c!background\endcsname}% + {\ifcsname\??framed\currentotrbackground:\c!background\endcsname + \edef\page_background_temp{\csname\??framed\currentotrbackground:\c!background\endcsname}% \ifx\page_background_temp\empty \expandafter\expandafter\expandafter\page_backgrounds_check_frame \else @@ -69,8 +66,8 @@ \fi} \def\page_backgrounds_check_frame - {\ifcsname\currentotrbackground\c!frame\endcsname - \edef\page_background_temp{\csname\currentotrbackground\c!frame\endcsname}% + {\ifcsname\??framed\currentotrbackground:\c!frame\endcsname + \edef\page_background_temp{\csname\??framed\currentotrbackground:\c!frame\endcsname}% \ifx\page_background_temp\v!on \page_backgrounds_set_yes \else @@ -81,8 +78,8 @@ \fi} \def\page_backgrounds_check_leftframe - {\ifcsname\currentotrbackground\c!leftframe\endcsname - \edef\page_background_temp{\csname\currentotrbackground\c!leftframe\endcsname}% + {\ifcsname\??framed\currentotrbackground:\c!leftframe\endcsname + \edef\page_background_temp{\csname\??framed\currentotrbackground:\c!leftframe\endcsname}% \ifx\page_background_temp\v!on \page_backgrounds_set_yes \else @@ -93,8 +90,8 @@ \fi} \def\page_backgrounds_check_rightframe - {\ifcsname\currentotrbackground\c!rightframe\endcsname - \edef\page_background_temp{\csname\currentotrbackground\c!rightframe\endcsname}% + {\ifcsname\??framed\currentotrbackground:\c!rightframe\endcsname + \edef\page_background_temp{\csname\??framed\currentotrbackground:\c!rightframe\endcsname}% \ifx\page_background_temp\v!on \page_backgrounds_set_yes \else @@ -105,8 +102,8 @@ \fi} \def\page_backgrounds_check_topframe - {\ifcsname\currentotrbackground\c!topframe\endcsname - \edef\page_background_temp{\csname\currentotrbackground\c!topframe\endcsname}% + {\ifcsname\??framed\currentotrbackground:\c!topframe\endcsname + \edef\page_background_temp{\csname\??framed\currentotrbackground:\c!topframe\endcsname}% \ifx\page_background_temp\v!on \page_backgrounds_set_yes \else @@ -117,8 +114,8 @@ \fi} \def\page_backgrounds_check_bottomframe - {\ifcsname\currentotrbackground\c!bottomframe\endcsname - \edef\page_background_temp{\csname\currentotrbackground\c!bottomframe\endcsname}% + {\ifcsname\??framed\currentotrbackground:\c!bottomframe\endcsname + \edef\page_background_temp{\csname\??framed\currentotrbackground:\c!bottomframe\endcsname}% \ifx\page_background_temp\v!on \page_backgrounds_set_yes \else @@ -132,6 +129,10 @@ %D as fast as possible. \installcorenamespace{layoutbackgrounds} +\installcorenamespace{layoutbackgroundcheck} % we need another hash as \??layoutbackgrounds<...> gets defined + +\def\page_backgrounds_set_yes{\expandafter\let\csname\currentotrbackground\endcsname\relax } +\def\page_backgrounds_set_nop{\expandafter\let\csname\currentotrbackground\endcsname\undefined} \unexpanded\def\page_backgrounds_check#1% {\edef\currentotrbackground{\??layoutbackgrounds#1}% @@ -154,9 +155,8 @@ \expandafter\gobbleoneargument \fi} -%D The background mechanism falls back on the \type {\framed} -%D macro. This means that all normal frame and overlay -%D features can be used. +%D The background mechanism falls back on the \type {\framed} macro. This means +%D that all normal frame and overlay features can be used. \def\page_backgrounds_add_to_box#1% area {\ifcsname\??layoutbackgrounds#1\endcsname @@ -165,26 +165,29 @@ \expandafter\gobblefourarguments \fi#1} -% we don't need the dimensions here as this is a real framed but the question is: do we indeed -% need a real framed or can we use a fake (i.e. no foreground, only for hidden) +%D We don't need the dimensions here as this is a real framed but the question is: +%D do we indeed need a real framed or can we use a fake (i.e. no foreground, only +%D for hidden). \def\page_backgrounds_add_to_box_indeed#1#2#3#4% area box width height / always non zero - {\ifcsname\??layoutbackgrounds#1\c!setups\endcsname % to be done - \doprocesslocalsetups{\csname\??layoutbackgrounds#1\c!setups\endcsname}% should not produce funny spaces ! + {\edef\p_page_backgrounds_setups{\namedframedparameter{\??layoutbackgrounds#1}\c!setups}% + \ifx\p_page_backgrounds_setups\empty \else + \doprocesslocalsetups\p_page_backgrounds_setups % should not produce funny spaces ! \fi % #2 has the right dimensions already \setbox#2\hbox{\localbackgroundframed{\??layoutbackgrounds#1}#1#2}}% a real framed (including foreground) -%D There are quite some backgrounds. At the bottom layer, -%D there is the {\em paper} background. This one is only -%D used for special purposes, like annotations to documents. + +%D There are quite some backgrounds. At the bottom layer, there is the {\em +%D paper} background. This one is only used for special purposes, like +%D annotations to documents. \def\page_backgrounds_add_to_print#1% {\page_backgrounds_add_to_box\v!paper#1\printpaperwidth\printpaperheight} -%D The page backgrounds can be put behind the {\em left -%D page}, the {\em right page} or {\em each page}. As with -%D the paper background, these are calculated on each page. +%D The page backgrounds can be put behind the {\em left page}, the {\em +%D right page} or {\em each page}. As with the paper background, these are +%D calculated on each page. \def\page_backgrounds_add_to_paper#1% {\doifbothsidesoverruled @@ -193,18 +196,17 @@ {\page_backgrounds_add_to_box\v!leftpage #1\paperwidth\paperheight}% \page_backgrounds_add_to_box\v!page#1\paperwidth\paperheight} -%D Then there are the 25 areas that make up the layout: {\em -%D top, header, text, footer, bottom} times {\em left edge, -%D left margin, text, right margin, right edge}. These are -%D only recalculated when they change or when the \type -%D {status} is set to \type {repeat}. +%D Then there are the 25 areas that make up the layout: {\em top, header, text, +%D footer, bottom} times {\em left edge, left margin, text, right margin, right +%D edge}. These are only recalculated when they change or when the \type {status} +%D is set to \type {repeat}. \newbox\leftbackground % todo: rename \newbox\rightbackground % todo: rename -%D Finaly there is an aditional {\em text} background, again -%D useful for special purposes only. This one is calculated -%D each time. The hidden backgrounds are not meant for users! +%D Finaly there is an aditional {\em text} background, again useful for +%D special purposes only. This one is calculated each time. The hidden +%D backgrounds are not meant for users! \newconditional\c_page_backgrounds_hidden_enabled @@ -214,21 +216,19 @@ \fi \page_backgrounds_add_to_box\v!text#1\makeupwidth\textheight} -%D The next couple of macros implement the area backgrounds. -%D As said, these are cached in dedicated boxes. The offsets -%D and depth of the page are used for alignment purposes. +%D The next couple of macros implement the area backgrounds. As said, these +%D are cached in dedicated boxes. The offsets and depth of the page are used +%D for alignment purposes. -\newdimen\pageoffset % bleed -\newdimen\pagedepth +%newdimen\pageoffset % bleed +%newdimen\pagedepth % built-in -%D We need a bit more clever mechanism in order to handle -%D layers well. This means that we cannot calculate both -%D background at the same time since something may have -%D changed halfway a page. +%D We need a bit more clever mechanism in order to handle layers well. +%D This means that we cannot calculate both background at the same time +%D since something may have changed halfway a page. -%D Margin swapping has been simplified: see mkii code in case of -%D regression. Calculation is delayed till the page anyway so the -%D state is known. +%D Margin swapping has been simplified: see mkii code in case of regression. +%D Calculation is delayed till the page anyway so the state is known. \def\page_backgrounds_recalculate {\global\settrue\c_page_backgrounds_new} @@ -284,11 +284,10 @@ \newdimen\pagebackgroundhoffset % THESE WILL BECOME OBSOLETE \newdimen\pagebackgroundvoffset +\newdimen\pagebackgroundoffset % used elsewhere \newdimen\pagebackgrounddepth \newdimen\pagebackgroundcompensation -\newdimen\pagebackgroundoffset % used elsewhere - \def\page_backgrounds_set_offsets % used in menus (we can use ifcsname's here) {\ifconditional\c_page_backgrounds_some \ifconditional\c_page_backgrounds_new \page_backgrounds_set_offsets_indeed % indirect, less tracing @@ -310,7 +309,8 @@ \global\pagebackgroundcompensation\zeropoint} \def\page_backgrounds_set_offsets_yes - {\global\pagebackgroundcompensation\csname\??layoutbackgrounds\v!page\c!offset\endcsname\relax + {\global\pagebackgroundoffset \d_page_backgrounds_depth + \global\pagebackgroundcompensation\d_page_backgrounds_offset\relax \ifzeropt\pagebackgroundcompensation \page_backgrounds_set_offsets_nop \else @@ -329,7 +329,7 @@ \global\pagebackgrounddepth \zeropoint \else \global\pagebackgroundvoffset\pagebackgroundcompensation - \global\pagebackgrounddepth \csname\??layoutbackgrounds\v!page\c!depth\endcsname\relax + \global\pagebackgrounddepth \d_page_backgrounds_depth \fi\fi \fi} @@ -426,30 +426,31 @@ \def\page_backgrounds_set_box_cell#1#2#3#4% pos pos width height {\begingroup - \ifcsname\??layoutbackgrounds#1#2\c!setups\endcsname - \expandafter\doprocesslocalsetups\csname\??layoutbackgrounds#1#2\c!setups\endcsname % should not produce funny spaces ! + \edef\p_page_backgrounds_setups{\namedframedparameter{\??layoutbackgrounds#1#2}\c!setups}% + \ifx\p_page_backgrounds_setups\empty \else + \doprocesslocalsetups\p_page_backgrounds_setups % should not produce funny spaces ! \fi - \ifcsname\??layoutbackgrounds#1#2\c!command\endcsname + \edef\p_page_backgrounds_command{\namedframedparameter{\??layoutbackgrounds#1#2}\c!command}% + \ifx\p_page_backgrounds_command\empty \expandafter\page_backgrounds_set_box_cell_nop \else \expandafter\page_backgrounds_set_box_cell_yes - \fi#1#2#3#4% + \fi#3#4% \localbackgroundframed{\??layoutbackgrounds#1#2}{#1:#2}\scratchbox \endgroup} -\def\page_backgrounds_set_box_cell_nop#1#2#3#4% +\def\page_backgrounds_set_box_cell_nop#1#2% {\setbox\scratchbox\emptyvbox - \wd\scratchbox#3% - \ht\scratchbox#4} + \wd\scratchbox#1% + \ht\scratchbox#2} -\def\page_backgrounds_set_box_cell_yes#1#2#3#4% - {\setbox\scratchbox\vbox to #4{\vss\hbox to#3{\hss\csname\??layoutbackgrounds#1#2\c!command\endcsname\hss}\vss}% +\def\page_backgrounds_set_box_cell_yes#1#2% + {\setbox\scratchbox\vbox to #2{\vss\hbox to#1{\hss\p_page_backgrounds_command\hss}\vss}% \dp\scratchbox\zeropoint} -%D The background mechanism is quite demanding in terms or -%D resources. We used to delay these definitions till runtime -%D usage, but since today's \TEX's are large, we now do the -%D work on forehand. +%D The background mechanism is quite demanding in terms or resources. We used to +%D delay these definitions till runtime usage, but since today's \TEX's are large, +%D we now do the work on forehand. %D %D \starttyping %D \setupbackgrounds [settings] @@ -459,8 +460,8 @@ %D %D \showsetup{setupbackgrounds} %D -%D Because the number of arguments runs from one to three, -%D we need to check for it. +%D Because the number of arguments runs from one to three, we need to check +%D for it. \newtoks\everybackgroundssetup @@ -476,14 +477,17 @@ \tripleexpandafter\page_backgrounds_setup_basics \fi\fi\fi} +\newdimen\d_page_backgrounds_offset +\newdimen\d_page_backgrounds_depth + \appendtoks - \doifelsevalue{\??layoutbackgrounds\v!page\c!offset}\v!overlay - {\global\pageoffset\zeropoint} - {\global\pageoffset\csname\??layoutbackgrounds\v!page\c!offset\endcsname}% - \global\pagedepth\csname\??layoutbackgrounds\v!page\c!depth\endcsname - \global\pagebackgroundoffset\pageoffset - \global\pagebackgrounddepth\pagedepth - \edef\p_page_backgrounds_state{\csname\??layoutbackgrounds\c!state\endcsname}% + \edef\p_page_backgrounds_offset{\namedframedparameter{\??layoutbackgrounds\v!page}\c!offset}% + \edef\p_page_backgrounds_depth {\namedframedparameter{\??layoutbackgrounds\v!page}\c!depth }% + \edef\p_page_backgrounds_state {\namedframedparameter{\??layoutbackgrounds }\c!state }% + \global\d_page_backgrounds_offset\ifx\p_offset\empty\zeropoint\else\p_page_backgrounds_offset\fi + \global\d_page_backgrounds_depth \ifx\p_depth \empty\zeropoint\else\p_page_backgrounds_depth \fi + \global\pagebackgroundoffset\d_page_backgrounds_offset\relax + \global\pagebackgrounddepth \d_page_backgrounds_depth \relax \ifx\p_page_backgrounds_state\v!stop \global\setfalse\c_page_backgrounds_new \else @@ -514,60 +518,57 @@ {\page_backgrounds_setup_double[#1][\v_page_backgrounds_common_set][#2]}} \def\page_backgrounds_setup_basics[#1][#2][#3]% - {\getparameters[\??layoutbackgrounds][#1]% + {\setupframed[\??layoutbackgrounds][#1]% \the\everybackgroundssetup} \def\page_backgrounds_setup_and_check#1#2% tag settings {\edef\currentotrbackground{\??layoutbackgrounds#1}% - \getparameters[\currentotrbackground][#2]% + \setupframed[\currentotrbackground][#2]% \page_backgrounds_check_background} -%D Each areas (currently there are $1+3+25+1=30$ of them) -%D has its own low level framed object associated. - -% hm, we can delay them - -\unexpanded\def\installsomebackground#1#2{\inheritlocalframed[\??layoutbackgrounds#1#2][\??od]} - -\installsomebackground \v!paper \empty -\installsomebackground \v!page \empty -\installsomebackground \v!leftpage \empty -\installsomebackground \v!rightpage \empty - -%D The stand alone text area inherits from the page too. - -\installsomebackground \v!text \empty -\installsomebackground \v!hidden \empty - -%D We save some keying by defining the areas using a helper: +%D Each areas (currently there are $1+3+25+1=30$ of them) has its own low level +%D framed object associated. + +\definesimplifiedframed[\??layoutbackgrounds\v!paper] +\definesimplifiedframed[\??layoutbackgrounds\v!page] +\definesimplifiedframed[\??layoutbackgrounds\v!leftpage] +\definesimplifiedframed[\??layoutbackgrounds\v!rightpage] + +\definesimplifiedframed[\??layoutbackgrounds\v!text] +\definesimplifiedframed[\??layoutbackgrounds\v!hidden] + +\definesimplifiedframed[\??layoutbackgrounds\v!top\v!leftedge] +\definesimplifiedframed[\??layoutbackgrounds\v!top\v!leftmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!top\v!text] +\definesimplifiedframed[\??layoutbackgrounds\v!top\v!rightmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!top\v!rightedge] + +\definesimplifiedframed[\??layoutbackgrounds\v!header\v!leftedge] +\definesimplifiedframed[\??layoutbackgrounds\v!header\v!leftmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!header\v!text] +\definesimplifiedframed[\??layoutbackgrounds\v!header\v!rightmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!header\v!rightedge] + +\definesimplifiedframed[\??layoutbackgrounds\v!text\v!leftedge] +\definesimplifiedframed[\??layoutbackgrounds\v!text\v!leftmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!text\v!text] +\definesimplifiedframed[\??layoutbackgrounds\v!text\v!rightmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!text\v!rightedge] + +\definesimplifiedframed[\??layoutbackgrounds\v!footer\v!leftedge] +\definesimplifiedframed[\??layoutbackgrounds\v!footer\v!leftmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!footer\v!text] +\definesimplifiedframed[\??layoutbackgrounds\v!footer\v!rightmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!footer\v!rightedge] + +\definesimplifiedframed[\??layoutbackgrounds\v!bottom\v!leftedge] +\definesimplifiedframed[\??layoutbackgrounds\v!bottom\v!leftmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!bottom\v!text] +\definesimplifiedframed[\??layoutbackgrounds\v!bottom\v!rightmargin] +\definesimplifiedframed[\??layoutbackgrounds\v!bottom\v!rightedge] -\def\docommand#1% - {\installsomebackground#1\v!leftedge - \installsomebackground#1\v!leftmargin - \installsomebackground#1\v!text - \installsomebackground#1\v!rightmargin - \installsomebackground#1\v!rightedge} - -\docommand \v!top -\docommand \v!header -\docommand \v!text -\docommand \v!footer -\docommand \v!bottom - -%D We need some cleanup now. - -\let\docommand\relax - -%D We now set up the individual areas to use reasonable -%D defaults. - -\installsomebackground \v!paper \empty -\installsomebackground \v!page \empty -\installsomebackground \v!leftpage \empty -\installsomebackground \v!rightpage \empty - -\getparameters - [\??layoutbackgrounds\v!page] +\setupbackgrounds + [\v!page] [\c!offset=\zeropoint, % hm, so we need to force overlay elsewhere \c!depth=\zeropoint] @@ -576,9 +577,8 @@ \setupbackgrounds [\c!state=\c!start] -%D The hidden layer can be populated by extending the -%D following comma separated list. This only happens in core -%D modules. +%D The hidden layer can be populated by extending the following comma separated +%D list. This only happens in core modules. % todo page-2 .. page+2 achter pagina -> bleed % spread-2 .. spread+2 achter spread -> spread (repeat 2 times) @@ -594,11 +594,6 @@ \def\hiddenbackgroundlist {\v!text-2,\v!text-1,\v!foreground,\v!text+1,\v!text+2} -% \defineoverlay[\v!text-2][\positionoverlay{\v!text-2}] -% \defineoverlay[\v!text-1][\positionoverlay{\v!text-1}] -% \defineoverlay[\v!text+1][\positionoverlay{\v!text+1}] -% \defineoverlay[\v!text+2][\positionoverlay{\v!text+2}] - \defineoverlay[\v!text-2][\positionregionoverlay\textanchor{\v!text-2}] % no new anchor, we share text \defineoverlay[\v!text-1][\positionregionoverlay\textanchor{\v!text-1}] \defineoverlay[\v!text+1][\positionregionoverlay\textanchor{\v!text+1}] @@ -608,10 +603,16 @@ [\v!hidden] [\c!background=\hiddenbackgroundlist] -% The next series is used in local (for instance floating) -% backgrounds. +%D Because we haven't really set up backgrounds yet, we set the main efficiency +%D switch to false. -% \installsomebackground \v!local \empty % not really a background, invisible for users +\setfalse\c_page_backgrounds_some + +\protect \endinput + +% %D The next series is used in local (for instance floating) backgrounds. +% +% \installsimplifiedframed{\??layoutbackgrounds\v!local} % % \getparameters % [\??layoutbackgrounds\v!local] @@ -649,9 +650,3 @@ % \input tufte % \stopcolumnset -%D Because we haven't really set up backgrounds yet, we set -%D the main efficiency switch to false. - -\setfalse\c_page_backgrounds_some - -\protect \endinput diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index 2d0593884..2e661f3b7 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -319,7 +319,7 @@ \initializecolumns\nofcolumns \hangafter\zerocount \hangindent\zeropoint - \everypar\emptytoks + \reseteverypar \ifdim\pagetotal=\zeropoint \else \verticalstrut \vskip-\struttotal @@ -398,7 +398,7 @@ %D to interfere. \def\setmulticolumnsout - {\everypar\emptytoks + {\reseteverypar \dontcomplain \settopskip \setmaxdepth @@ -659,7 +659,7 @@ \dp\shapebox\dimen2 \box\shapebox}% \flushshapebox - \everypar\emptytoks + \reseteverypar \parskip\zeropoint % = \forgetall \verticalstrut \vskip-\struttotal @@ -1158,7 +1158,7 @@ \def\setglobalcolumnfloats {\setfalse\onlylocalcolumnfloats - \everypar\emptytoks + \reseteverypar \let\flushcolumnfloat\relax \let\flushcolumnfloats\noflushcolumnfloats} @@ -1472,20 +1472,23 @@ \c!height=\v!fit, \c!align=]} -\definecomplexorsimpleempty\startcolumns - % to be reconsidered ... (in any case they need to be unexpandable sinze 2011.12.30) \unexpanded\def\page_columns_align_option_yes {\stretchcolumnstrue \inheritcolumnsfalse}% todo: new key \unexpanded\def\page_columns_align_option_no {\stretchcolumnsfalse\inheritcolumnsfalse}% todo: new key \unexpanded\def\page_columns_align_option_text{\stretchcolumnsfalse\inheritcolumnstrue }% -\def\complexstartcolumns[#1]% %% \startcolumns +\unexpanded\def\startcolumns + {\dosingleempty\dostartcolumns} + +\def\dostartcolumns[#1]% %% \startcolumns {\bgroup \let\stopcolumns\egroup \ifinsidecolumns \else - \setupcolumns[#1]% + \iffirstargument + \setupcolumns[#1]% + \fi \ifnum\@@kln>1\relax \whitespace \begingroup @@ -1531,12 +1534,23 @@ \installcolumnbreakmethod \s!multicolumn \v!preference {\goodbreak} +% \installcolumnbreakmethod \s!multicolumn \v!yes +% {\par % todo: since +% {\testrulewidth\zeropoint\ruledvskip\textheight} % we misuse a +% \penalty-200 % side effect +% \vskip-\textheight +% }% bugged : \prevdepth-\thousandpoint} % signals top of column to \blank + \installcolumnbreakmethod \s!multicolumn \v!yes - {\par % todo: since - {\testrulewidth\zeropoint\ruledvskip\textheight} % we misuse a - \penalty-200 % side effect + {\par + \begingroup + \normaloffinterlineskip + \normalpenalty\plustenthousand + \vbox to \textheight{}% + \endgroup + \penalty-200 \vskip-\textheight - }% bugged : \prevdepth-\thousandpoint} % signals top of column to \blank + } % bugged : \prevdepth-\thousandpoint} % signals top of column to \blank %D New: only at start of columns; may change ! Rather interwoven and therefore %D to be integrated when the multi column modules are merged. diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv index 69d23b59e..b84857601 100644 --- a/tex/context/base/page-sid.mkiv +++ b/tex/context/base/page-sid.mkiv @@ -513,7 +513,7 @@ \def\page_sides_push_float_inline#1% {\begingroup - \everypar\emptytoks % needed ! + \reseteverypar % needed ! \parskip\zeropoint % needed ! \page_sides_set_skips \page_sides_insert_info @@ -597,8 +597,8 @@ {\par \whitespace \begingroup - \everypar\emptytoks \forgetall + \reseteverypar \verticalstrut \vskip-\struttotal \endgroup} diff --git a/tex/context/base/scrn-fld.mkvi b/tex/context/base/scrn-fld.mkvi index 872099099..3528e86fa 100644 --- a/tex/context/base/scrn-fld.mkvi +++ b/tex/context/base/scrn-fld.mkvi @@ -403,7 +403,7 @@ \setupfieldcontentframed [\c!align=\v!flushleft, \c!strut=\v!no, - \s!parent=\??ol] % needs checking + \s!parent=\??regularframed] % needs checking \setupfieldcontentframed % independent [\c!alternative=\v!normal, @@ -419,13 +419,13 @@ [\c!style=, \c!color=, \c!align=\v!flushleft, - \s!parent=\??ol] % needs checking + \s!parent=\??regularframed] % needs checking \setupfieldtotalframed [%\c!alternative={\v!label,\v!frame,\v!horizontal}, \c!strut=\v!no, \c!align=, - \s!parent=\??ol] % needs checking + \s!parent=\??regularframed] % needs checking % \setupcurrent diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index f3dd5eafe..8bc8ed354 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -217,8 +217,6 @@ \let\switchtointerlinespace\setuplocalinterlinespace -% \definecomplexorsimple\setupinterlinespace - %D Helpers \newskip \s_spac_lastskip diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 9108cfcaf..c48fef255 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex f2ba08cc9..4e1eb18a6 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 9f50a7745..d75b1aed2 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -463,8 +463,7 @@ return { { filename = "pack-rul", marktype = "mkiv", - status = "todo", - comment = "only namespace to be done", + status = "okay", }, { filename = "pack-mrl", diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index d9942bfc8..4f282e703 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -1,4 +1,5 @@ %D \module +%D \module %D [ file=strc-mat, %D version=2008.10.20, %D title=\CONTEXT\ Structure Macros, diff --git a/tex/context/base/strc-ren.mkiv b/tex/context/base/strc-ren.mkiv index b7b4224cd..f1fc71948 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -212,7 +212,7 @@ \xdef\localheaddepth {\the\strutdp}% \xdef\localheadlineheight{\the\lineheight}% % == \globallet\localheaddepth\strutdp - \everypar\emptytoks % needed indeed + \reseteverypar % needed indeed \noindent % ipv \whitespace elders, na \forgetall ! \bgroup \doifinsetelse{\headparameter\c!aligntitle}{\v!yes,\v!float}% new diff --git a/tex/context/base/supp-vis.mkiv b/tex/context/base/supp-vis.mkiv index 1b0253162..96fef9729 100644 --- a/tex/context/base/supp-vis.mkiv +++ b/tex/context/base/supp-vis.mkiv @@ -96,8 +96,7 @@ %D off with \type{\dontinterfere}. \unexpanded\def\dontinterfere % or maybe just forgetall - {\everypar \emptytoks - \let\par \endgraf + {\reseteverypar \parindent\zeropoint \parskip \zeropoint \leftskip \zeropoint diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index fb8d68d17..a5c4cf0ff 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -3736,7 +3736,20 @@ %D and how about: -\newevery \neverypar \NeveryPar +% \newtoks \neverypar +% \newtoks \neveryendpar +% +% \normalprotected\def\syst_helpers_forgotten_endpar +% {\the\neveryendpar\normalpar} +% +% \unexpanded\def\forgeteverypar +% {\everypar{\the\neverypar}% +% \let\endpar\syst_helpers_forgotten_endpar} +% +% \unexpanded\def\finishpar +% {\ifvmode\else\par\fi} + +\newtoks \neverypar \unexpanded\def\forgeteverypar {\everypar{\the\neverypar}} diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv index 4dcc134ea..0bda688fa 100644 --- a/tex/context/base/syst-ini.mkiv +++ b/tex/context/base/syst-ini.mkiv @@ -827,10 +827,20 @@ %D Now come a few macros that might be needed in successive loading. We redefine the %D \type {\par} primitive pretty soon so that we get the equivalents right. -\newtoks\everyendpar +% too tricky: \par is use more often than a par starts so we have too much change +% that we get assymetrical behaviour +% +% \newtoks\everyendpar +% +% \normalprotected\def\endpar{\the\everyendpar\normalpar} +% \normalprotected\def\par {\endpar} +% +% \normalprotected\def\reseteverypar +% {\everypar \emptytoks +% \everyendpar\emptytoks} -\normalprotected\def\endpar{\the\everyendpar\normalpar} -\normalprotected\def\par {\endpar} +\normalprotected\def\reseteverypar + {\everypar\emptytoks} \let\endgraf\par \let\endline\cr diff --git a/tex/context/base/trac-vis.mkiv b/tex/context/base/trac-vis.mkiv index 292f60d62..defe35a5f 100644 --- a/tex/context/base/trac-vis.mkiv +++ b/tex/context/base/trac-vis.mkiv @@ -92,8 +92,7 @@ %D We keep this one: \unexpanded\def\dontinterfere - {\everypar \emptytoks - \let\par \endgraf + {\reseteverypar \parindent\zeropoint \parskip \zeropoint \leftskip \zeropoint diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index f90596a98..79b749226 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/04/12 23:48:37 +-- merge date : 07/06/12 19:11:14 do -- begin closure to overcome local limits and interference |