diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:56 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:56 +0100 |
commit | 5e5b7116e78d1cb847434ef29a9fed154e49adf9 (patch) | |
tree | 4fe640ecbf5137c5c68d7730ae03b91c2169bd9a /tex/context/base/page-txt.mkvi | |
parent | 551356b39d8dfbf10ed6542aa3281cb08cd36197 (diff) | |
download | context-5e5b7116e78d1cb847434ef29a9fed154e49adf9.tar.gz |
beta 2012.01.02 17:18
Diffstat (limited to 'tex/context/base/page-txt.mkvi')
-rw-r--r-- | tex/context/base/page-txt.mkvi | 412 |
1 files changed, 208 insertions, 204 deletions
diff --git a/tex/context/base/page-txt.mkvi b/tex/context/base/page-txt.mkvi index 4d33e6c20..8d2d9c1d3 100644 --- a/tex/context/base/page-txt.mkvi +++ b/tex/context/base/page-txt.mkvi @@ -79,9 +79,9 @@ \definelayoutelement[\v!bottom:\v!edge] [\v!bottom][\c!lefttext=,\c!middletext=,\c!righttext=] \unexpanded\def\setuplayouttext - {\dotripleempty\setup_layout_text} + {\dotripleempty\page_layouts_setup_text} -\def\setup_layout_text[#vertical][#horizontal][#settings]% +\def\page_layouts_setup_text[#vertical][#horizontal][#settings]% {\ifthirdargument \setuplayoutelement[#vertical:#horizontal][#settings]% \else @@ -90,38 +90,38 @@ \appendtoks \ifx\currentlayoutelement\empty\else - \synchronize_current_layout_element\currentlayoutelement % brr, can be vertical:horizontal + \page_layouts_synchronize_element\currentlayoutelement % brr, can be vertical:horizontal \fi \to \everysetuplayoutelement -\def\reset_layout_element_status#vertical% - {\expandafter\gdef\csname\??layouttextsreset#vertical\endcsname{\set_layout_element_status_normal#vertical}} +\def\page_layouts_reset_element_status#vertical% + {\expandafter\gdef\csname\??layouttextsreset#vertical\endcsname{\page_layouts_set_element_status_normal#vertical}} -\def\set_layout_element_status_normal#vertical% +\def\page_layouts_set_element_status_normal#vertical% {\global\expandafter\let\csname\namedlayoutelementhash#vertical\c!state\endcsname\v!normal \global\expandafter\let\csname\??layouttextsreset#vertical\endcsname\relax - \synchronize_current_layout_element{#vertical}} + \page_layouts_synchronize_element{#vertical}} -\def\synchronize_current_layout_element#vertical% +\def\page_layouts_synchronize_element#vertical% {\xdef\previoustextstate{\csname\??layouttextssynchronize#vertical\endcsname}% can be a let \edef\currenttextstate {\namedlayoutelementparameter{#vertical}\c!state}% %\writestatus{>>}{[#vertical:\currenttextstate/\previoustextstate]}% \ifx\currenttextstate\previoustextstate \else - \synchronize_current_layout_element_indeed{#vertical}% + \page_layouts_synchronize_element_indeed{#vertical}% \fi} -\def\synchronize_current_layout_element_indeed#vertical% +\def\page_layouts_synchronize_element_indeed#vertical% {\ifx\currenttextstate \v!high \calculatevsizes\recalculatebackgrounds \else \ifx\previoustextstate\v!high \calculatevsizes\recalculatebackgrounds \else \ifx\currenttextstate \v!none \calculatevsizes\recalculatebackgrounds \else \ifx\previoustextstate\v!none \calculatevsizes\recalculatebackgrounds \fi\fi\fi\fi \letgvalue{\??layouttextssynchronize#vertical}\currenttextstate} -\unexpanded\def\setuptop {\dotripleempty\setup_layout_text[\v!top ]} -\unexpanded\def\setupheader{\dotripleempty\setup_layout_text[\v!header]} -\unexpanded\def\setuptext {\dotripleempty\setup_layout_text[\v!text ]} -\unexpanded\def\setupfooter{\dotripleempty\setup_layout_text[\v!footer]} -\unexpanded\def\setupbottom{\dotripleempty\setup_layout_text[\v!bottom]} +\unexpanded\def\setuptop {\dotripleempty\page_layouts_setup_text[\v!top ]} +\unexpanded\def\setupheader{\dotripleempty\page_layouts_setup_text[\v!header]} +\unexpanded\def\setuptext {\dotripleempty\page_layouts_setup_text[\v!text ]} +\unexpanded\def\setupfooter{\dotripleempty\page_layouts_setup_text[\v!footer]} +\unexpanded\def\setupbottom{\dotripleempty\page_layouts_setup_text[\v!bottom]} %D We inherit some settings: @@ -166,36 +166,36 @@ %D \showsetup{setupfootertexts} %D \showsetup{setupbottomtexts} -\unexpanded\def\setuptoptexts {\dosixtupleempty\setup_texts[\v!top ]} -\unexpanded\def\setupheadertexts{\dosixtupleempty\setup_texts[\v!header ]} -\unexpanded\def\setuptexttexts {\dosixtupleempty\setup_texts[\v!text ]} -\unexpanded\def\setupfootertexts{\dosixtupleempty\setup_texts[\v!footer ]} -\unexpanded\def\setupbottomtexts{\dosixtupleempty\setup_texts[\v!bottom ]} +\unexpanded\def\setuptoptexts {\dosixtupleempty\page_layouts_setup_texts[\v!top ]} +\unexpanded\def\setupheadertexts{\dosixtupleempty\page_layouts_setup_texts[\v!header ]} +\unexpanded\def\setuptexttexts {\dosixtupleempty\page_layouts_setup_texts[\v!text ]} +\unexpanded\def\setupfootertexts{\dosixtupleempty\page_layouts_setup_texts[\v!footer ]} +\unexpanded\def\setupbottomtexts{\dosixtupleempty\page_layouts_setup_texts[\v!bottom ]} % todo: \setuplayoutelementtext % An alternative approach is to have more variables but that does not % make the code less complex (probably more). -\def\setup_texts[#vertical][#horizontal][#a][#b][#c][#d]% +\def\page_layouts_setup_texts[#vertical][#horizontal][#a][#b][#c][#d]% {\ifsixthargument \edef\currentlayoutelement{#vertical:#horizontal}% \setlayoutelementparameter\c!lefttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!leftstyle \c!leftcolor \c!leftwidth {#a}% \c!rightstyle\c!rightcolor\c!rightwidth{#d}}% \setlayoutelementparameter\c!righttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!rightstyle\c!rightcolor\c!rightwidth{#b}% \c!leftstyle \c!leftcolor \c!leftwidth {#c}}% \else\iffifthargument \edef\currentlayoutelement{#vertical:\v!text}% \setlayoutelementparameter\c!lefttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!leftstyle \c!leftcolor \c!leftwidth {#horizontal}% \c!rightstyle\c!rightcolor\c!rightwidth{#c}}% \setlayoutelementparameter\c!righttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!rightstyle\c!rightcolor\c!rightwidth{#a}% \c!leftstyle \c!leftcolor \c!leftwidth {#b}}% \else\iffourthargument @@ -203,13 +203,13 @@ \doifelsenothing{\detokenize{#a}} {\resetlayoutelementparameter\c!lefttext} {\setlayoutelementparameter\c!lefttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!leftstyle\c!leftcolor\c!leftwidth{#a}% \c!leftstyle\c!leftcolor\c!leftwidth{#a}}}% \doifelsenothing{\detokenize{#b}} {\resetlayoutelementparameter\c!righttext} {\setlayoutelementparameter\c!righttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!rightstyle\c!rightcolor\c!rightwidth{#b}% \c!rightstyle\c!rightcolor\c!rightwidth{#b}}}% \else\ifthirdargument @@ -217,13 +217,13 @@ \doifelsenothing{\detokenize{#horizontal}} {\resetlayoutelementparameter\c!lefttext} {\setlayoutelementparameter\c!lefttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!leftstyle\c!leftcolor\c!leftwidth{#horizontal}% \c!leftstyle\c!leftcolor\c!leftwidth{#horizontal}}}% \doifelsenothing{\detokenize{#a}} {\resetlayoutelementparameter\c!righttext} {\setlayoutelementparameter\c!righttext - {\process_layout_element_double + {\page_layouts_process_element_double \c!rightstyle\c!rightcolor\c!rightwidth{#a}% \c!rightstyle\c!rightcolor\c!rightwidth{#a}}}% \else\ifsecondargument @@ -233,7 +233,7 @@ \doifelsenothing{\detokenize{#horizontal}} {\resetlayoutelementparameter\c!middletext} {\setlayoutelementparameter\c!middletext - {\process_layout_element_single\c!style\c!color\c!width{#horizontal}}}% + {\page_layouts_process_element_single\c!style\c!color\c!width{#horizontal}}}% \else \edef\currentlayoutelement{#vertical:\v!text}% \resetlayoutelementparameter\c!lefttext @@ -252,96 +252,100 @@ %D Left and right texts are swapped on odd and even pages, but %D only when double sided typesetting is enabled. -\unexpanded\def\process_layout_element_double +\unexpanded\def\page_layouts_process_element_double {\doifoddpageelse - \process_layout_element_double_odd - \process_layout_element_double_even} + \page_layouts_process_element_double_odd + \page_layouts_process_element_double_even} -\def\process_layout_element_double_odd #lstyle#lcolor#lwidth#lcontent#rstyle#rcolor#rwidth#rcontent% - {\process_layout_element_single#lstyle#lcolor#lwidth{#lcontent}} +\def\page_layouts_process_element_double_odd #lstyle#lcolor#lwidth#lcontent#rstyle#rcolor#rwidth#rcontent% + {\page_layouts_process_element_single#lstyle#lcolor#lwidth{#lcontent}} -\def\process_layout_element_double_even#lstyle#color#lwidth#lcontent#rstyle#rcolor#rwidth#rcontent% - {\process_layout_element_single#rstyle#rcolor#rwidth{#rcontent}} +\def\page_layouts_process_element_double_even#lstyle#color#lwidth#lcontent#rstyle#rcolor#rwidth#rcontent% + {\page_layouts_process_element_single#rstyle#rcolor#rwidth{#rcontent}} %D The next macro will be cleaned up and made less messy and %D dependent. -\unexpanded\def\process_layout_element_single#style#color#width#content% - {\edef\layout_element_content{\detokenize{#content}}% - \ifx\layout_element_content\empty +\let\m_page_layouts_element_content\empty + +\unexpanded\def\page_layouts_process_element_single#style#color#width#content% + {\edef\m_page_layouts_element_content{\detokenize{#content}}% + \ifx\m_page_layouts_element_content\empty % should not happen too often \else - \process_layout_element_single_indeed#style#color#width{#content}% + \page_layouts_process_element_single_indeed#style#color#width{#content}% \fi} \setvalue{\??layouttextstrut\v!yes}{\setstrut\strut} % maybe more variants -\def\process_layout_element_single_indeed#style#color#width#content% +\def\page_layouts_process_element_single_indeed#style#color#width#content% {\begingroup \uselayoutelementstyleandcolor#style#color% \csname\??layouttextstrut\layoutelementparameter\c!strut\endcsname - \ifcsname\??layouttextspecial\layout_element_content\endcsname - \csname\??layouttextspecial\layout_element_content\endcsname + \ifcsname\??layouttextspecial\m_page_layouts_element_content\endcsname + \csname\??layouttextspecial\m_page_layouts_element_content\endcsname \else \edef\currentlayoutelementwidth{\layoutelementparameter#width}% \ifx\currentlayoutelementwidth\empty - \expandafter\process_layout_element_single_normal + \expandafter\page_layouts_process_element_single_normal \else - \expandafter\process_layout_element_single_limited + \expandafter\page_layouts_process_element_single_limited \fi{#content}% \fi \endgroup} % {}{}{} prevents lookahead issues ... this will go away -\def\process_layout_element_single_normal#content% - {\doifelsemarking\layout_element_content - {\getmarking[\layout_element_content][\v!first]} +\def\page_layouts_process_element_single_normal#content% + {\doifelsemarking\m_page_layouts_element_content + {\getmarking[\m_page_layouts_element_content][\v!first]} {\ignorecrlf#content{}{}{}}} -\def\process_layout_element_single_limited#content% +\def\page_layouts_process_element_single_limited#content% {\doifelsemarking\ascii - {\limitatetext{\getmarking[\layout_element_content][\v!first]}\currentlayoutelementwidth\unknown} + {\limitatetext{\getmarking[\m_page_layouts_element_content][\v!first]}\currentlayoutelementwidth\unknown} {\ignorecrlf\limitatetext{#content{}{}{}}\currentlayoutelementwidth\unknown}} -\setvalue{\??layouttextspecial\v!pagenumber}{\place_layout_page_number} +\setvalue{\??layouttextspecial\v!pagenumber}{\page_layouts_place_page_number} \setvalue{\??layouttextspecial\v!date }{\currentdate} %D When specified, the texts are automatically limited in %D length. -\def\limitate_layout_element_text#width% - {\edef\currentlayoutelementwidth{\layoutelementparameter#width}% - \ifx\currentlayoutelementwidth\empty - \expandafter\firstofoneargument - \else - \expandafter\limitate_layout_element_text_indeed - \fi} - -\def\limitate_layout_element_text_indeed#content% - {\limitatetext{#content}\currentlayoutelementwidth\unknown} +% % where used ? +% +% \def\page_layouts_limitate_element_text#width% +% {\edef\currentlayoutelementwidth{\layoutelementparameter#width}% +% \ifx\currentlayoutelementwidth\empty +% \expandafter\firstofoneargument +% \else +% \expandafter\page_layouts_limitate_element_text_indeed +% \fi} +% +% \def\page_layouts_limitate_element_text_indeed#content% +% {\limitatetext{#content}\currentlayoutelementwidth\unknown} %D The placement of text is hooked into the token lists %D associated to the area at hand. -\appendtoks \place_layout_text_line\v!top \topheight \to \toptextcontent -\appendtoks \place_layout_text_line\v!header\headerheight \to \headertextcontent -\appendtoks \place_layout_text_line\v!text \textheight \to \texttextcontent -\appendtoks \place_layout_text_line\v!footer\footerheight \to \footertextcontent -\appendtoks \place_layout_text_line\v!bottom\bottomheight \to \bottomtextcontent +\appendtoks \page_layouts_place_text_line\v!top \topheight \to \toptextcontent +\appendtoks \page_layouts_place_text_line\v!header\headerheight \to \headertextcontent +\appendtoks \page_layouts_place_text_line\v!text \textheight \to \texttextcontent +\appendtoks \page_layouts_place_text_line\v!footer\footerheight \to \footertextcontent +\appendtoks \page_layouts_place_text_line\v!bottom\bottomheight \to \bottomtextcontent %D Texts can be disabled, moved up and ignored, depending in %D the \type {status} variable. This is handled by the next %D couple of macros. -\newcount\layout_element_state_n +\newcount\c_page_layouts_element_state_n -\def\set_layout_element_status#vertical% - {\layout_element_state_n=0\namedlayoutelementparameter#vertical\c!n\relax - \ifcase\layout_element_state_n +\def\page_layouts_set_element_status#vertical% + {\c_page_layouts_element_state_n=0\namedlayoutelementparameter#vertical\c!n\relax + \ifcase\c_page_layouts_element_state_n \edef\textlinestatus{\namedlayoutelementparameter#vertical\c!state}% \else - \setxvalue{\namedlayoutelementhash#vertical\c!n}{\the\numexpr\layout_element_state_n+\minusone}% + \setxvalue{\namedlayoutelementhash#vertical\c!n}{\the\numexpr\c_page_layouts_element_state_n+\minusone}% \let\textlinestatus\v!stop \fi} @@ -350,8 +354,8 @@ \doifinset\v!footer\floatspecification{\setxvalue{\namedlayoutelementhash\v!footer\c!n}{1}}% \to \everybeforeflushedpagefloat -\unexpanded\def\place_layout_text_line#vertical% - {\set_layout_element_status#vertical% +\unexpanded\def\page_layouts_place_text_line#vertical% + {\page_layouts_set_element_status#vertical% \csname\??layouttextsline\ifcsname\??layouttextsline\textlinestatus\endcsname\textlinestatus\else\s!unknown\fi\endcsname#vertical} \unexpanded\def\doifelselayouttextline#vertical% shown or not @@ -376,39 +380,39 @@ \newconditional\resyncaftertextline -\setvalue{\??layouttextsline\v!normal}{\place_layout_text_line_indeed} -\setvalue{\??layouttextsline\empty }{\place_layout_text_line_indeed} +\setvalue{\??layouttextsline\v!normal}{\page_layouts_place_text_line_indeed} +\setvalue{\??layouttextsline\empty }{\page_layouts_place_text_line_indeed} \letvalue{\??layouttextsline\v!none}\gobbletwoarguments \letvalue{\??layouttextsline\v!stop}\gobbletwoarguments \setvalue{\??layouttextsline\v!high}#vertical#height% {\global\settrue\resyncaftertextline - \reset_layout_element_status#vertical} + \page_layouts_reset_element_status#vertical} \setvalue{\??layouttextsline\v!empty}#vertical#height% - {\reset_layout_element_status#vertical} + {\page_layouts_reset_element_status#vertical} \setvalue{\??layouttextsline\v!start}#vertical#height% - {\reset_layout_element_status#vertical% - \place_layout_text_line_indeed#vertical#height} + {\page_layouts_reset_element_status#vertical% + \page_layouts_place_text_line_indeed#vertical#height} \setvalue{\??layouttextsline\v!nomarking}#vertical#height% {\bgroup - \reset_layout_element_status#vertical% + \page_layouts_reset_element_status#vertical% \settrue\inhibitgetmarking - \place_layout_text_line_indeed#vertical#height% + \page_layouts_place_text_line_indeed#vertical#height% \egroup} \setvalue{\??layouttextsline\s!unknown}#vertical#height% {\global\settrue\resyncaftertextline \begingroup % new - \reset_layout_element_status#vertical% + \page_layouts_reset_element_status#vertical% \csname\namedlayoutelementhash#vertical\textlinestatus\endcsname \csname\namedlayoutelementhash#vertical\v!text \textlinestatus\endcsname \csname\namedlayoutelementhash#vertical\v!margin\textlinestatus\endcsname \csname\namedlayoutelementhash#vertical\v!edge \textlinestatus\endcsname - \place_layout_text_line_indeed#vertical#height% + \page_layouts_place_text_line_indeed#vertical#height% \endgroup} %D The following macro has to be called after a page @@ -422,37 +426,37 @@ \csname\??layouttextsreset\v!bottom\endcsname \ifconditional\resyncaftertextline \calculateglobalvsizes - \recalculatebackgrounds + \page_backgrounds_recalculate \global\setfalse\resyncaftertextline \fi} % \settext[header][text][middle][xxx][yyy] \def\settextcontent - {\doquintupleempty\set_text_content} + {\doquintupleempty\page_layouts_set_text_content} -\def\set_text_content[#vertical][#horizontal][#one][#two][#three]% header text middle text/text +\def\page_layouts_set_text_content[#vertical][#horizontal][#one][#two][#three]% header text middle text/text {\iffifthargument \setvalue{\namedlayoutelementhash{#vertical:#horizontal}\executeifdefined{\??layouttextcontent\c!text:#one}\c!middletext}% - {\process_layout_element_double + {\page_layouts_process_element_double \c!leftstyle \c!leftcolor \c!leftwidth {#two}% \c!rightstyle\c!rightcolor\c!rightwidth{#three}}% \else\iffourthargument \setvalue{\namedlayoutelementhash{#vertical:#horizontal}\executeifdefined{\??layouttextcontent\c!text:#one}\c!middletext}% - {\process_layout_element_double + {\page_layouts_process_element_double \c!leftstyle \c!leftcolor \c!leftwidth {#two}% \c!rightstyle\c!rightcolor\c!rightwidth{#two}}% \else\ifthirdargument \setvalue{\namedlayoutelementhash{#vertical:#horizontal}\c!middletext}% - {\process_layout_element_double + {\page_layouts_process_element_double \c!leftstyle \c!leftcolor \c!leftwidth {#one}% \c!rightstyle\c!rightcolor\c!rightwidth{#one}}% \fi\fi\fi} \def\resettextcontent - {\dotripleempty\reset_text_content} + {\dotripleempty\page_layouts_reset_text_content} -\def\reset_text_content[#vertical][#horizontal][#tag]% header text middle +\def\page_layouts_reset_text_content[#vertical][#horizontal][#tag]% header text middle {\edef\currentlayoutelement{#vertical:#horizontal}% \ifthirdargument \letvalueempty{\layoutelementhash\executeifdefined{\??layouttextcontent\c!text:#tag}\c!middletext}% @@ -472,15 +476,15 @@ \def\ignoredlinebreak{\unskip\space\ignorespaces} -\def\place_layout_text_line_indeed#vertical#height% +\def\page_layouts_place_text_line_indeed#vertical#height% {\let\currentlayouttextline#vertical% \ifdim#height>\zeropoint\relax % prevents pagenumbers when zero height - \place_layout_text_line_left_or_right{#height}% + \page_layouts_place_text_line_left_or_right{#height}% \fi} -\def\place_layout_text_line_left_or_right#height% +\def\page_layouts_place_text_line_left_or_right#height% {\goleftonpage - \setbox\layout_element_box\vbox to #height + \setbox\b_page_layouts_element\vbox to #height {\vsize#height\relax %\hsize\zeropoint % hack so that e.g. after=\hairline gives predictable results \hsize\totaltextwidth @@ -489,99 +493,99 @@ \let\crlf\ignoredlinebreak \namedlayoutelementparameter\currentlayouttextline\c!before \doifbothsidesoverruled - \place_layout_text_line_right - \place_layout_text_line_right - \place_layout_text_line_left + \page_layouts_place_text_line_right + \page_layouts_place_text_line_right + \page_layouts_place_text_line_left \namedlayoutelementparameter\currentlayouttextline\c!after \kern\zeropoint}% keep the \dp, beware of \vtops, never change this! - \dp\layout_element_box\zeropoint - \box\layout_element_box + \dp\b_page_layouts_element\zeropoint + \box\b_page_layouts_element \vskip-#height\relax} -\let\extra_at_margin_left \plusone -\let\extra_at_margin_right\plustwo +\let\page_layouts_extra_at_margin_left \plusone +\let\page_layouts_extra_at_margin_right\plustwo -\let\place_layout_extra_text_left \relax % historic -\let\place_layout_extra_text_right\relax % historic +\let\page_layouts_place_extra_text_left \relax % historic +\let\page_layouts_place_extra_text_right\relax % historic -\def\place_layout_text_line_right +\def\page_layouts_place_text_line_right {\hbox {\ifdim\leftedgewidth>\zeropoint - \place_left_edge_layout_element\c!lefttext + \page_layouts_left_edge_element\c!lefttext \fi \ifdim\leftmarginwidth>\zeropoint - \place_left_margin_layout_element\c!lefttext\extra_at_margin_left + \page_layouts_left_margin_element\c!lefttext\page_layouts_extra_at_margin_left \fi \ifdim\makeupwidth>\zeropoint - \place_text_body_layout_element\c!lefttext\c!middletext\c!righttext\extra_at_margin_left + \page_layouts_text_body_element\c!lefttext\c!middletext\c!righttext\page_layouts_extra_at_margin_left \fi \ifdim\rightmarginwidth>\zeropoint - \place_right_margin_layout_element\c!righttext\extra_at_margin_left + \page_layouts_right_margin_element\c!righttext\page_layouts_extra_at_margin_left \fi \ifdim\rightedgewidth>\zeropoint - \place_right_edge_layout_element\c!lefttext + \page_layouts_right_edge_element\c!lefttext \fi}} -\def\place_layout_text_line_left +\def\page_layouts_place_text_line_left {\hbox {\ifdim\leftedgewidth>\zeropoint - \place_left_edge_layout_element\c!righttext + \page_layouts_left_edge_element\c!righttext \fi \ifdim\leftmarginwidth>\zeropoint - \place_left_margin_layout_element\c!righttext\extra_at_margin_right + \page_layouts_left_margin_element\c!righttext\page_layouts_extra_at_margin_right \fi \ifdim\makeupwidth>\zeropoint - \place_text_body_layout_element\c!righttext\c!middletext\c!lefttext\extra_at_margin_right + \page_layouts_text_body_element\c!righttext\c!middletext\c!lefttext\page_layouts_extra_at_margin_right \fi \ifdim\rightmarginwidth>\zeropoint - \place_right_margin_layout_element\c!lefttext\extra_at_margin_right + \page_layouts_right_margin_element\c!lefttext\page_layouts_extra_at_margin_right \fi \ifdim\rightedgewidth>\zeropoint - \place_right_edge_layout_element\c!righttext + \page_layouts_right_edge_element\c!righttext \fi}} -\def\place_left_edge_layout_element#parameter% +\def\page_layouts_left_edge_element#parameter% {\edef\currentlayoutelement{\currentlayouttextline:\v!edge}% - \place_layout_element_indeed\leftedgewidth + \page_layouts_place_element_indeed\leftedgewidth {\hss\layoutelementparameter#parameter}% \hskip\leftedgedistance} -\def\place_left_margin_layout_element#parameter#extrastate% +\def\page_layouts_left_margin_element#parameter#extrastate% {\edef\currentlayoutelement{\currentlayouttextline:\v!margin}% - \place_layout_element_indeed\leftmarginwidth + \page_layouts_place_element_indeed\leftmarginwidth {\hbox to \leftmarginwidth{\hss\layoutelementparameter#parameter}% - \ifnum#extrastate=\extra_at_margin_left + \ifnum#extrastate=\page_layouts_extra_at_margin_left \hskip-\leftmarginwidth \hbox to \leftmarginwidth{\hss\layoutelementparameter\c!margintext}% \fi}% \hskip\leftmargindistance} -\def\place_text_body_layout_element#left#middle#right#extrastate% +\def\page_layouts_text_body_element#left#middle#right#extrastate% {\edef\currentlayoutelement{\currentlayouttextline:\v!text}% - \place_layout_element_indeed\makeupwidth - {\hbox to \makeupwidth{\ifnum#extrastate=\extra_at_margin_left\place_layout_extra_text_left\fi\layoutelementparameter#left\hss}% + \page_layouts_place_element_indeed\makeupwidth + {\hbox to \makeupwidth{\ifnum#extrastate=\page_layouts_extra_at_margin_left\page_layouts_place_extra_text_left\fi\layoutelementparameter#left\hss}% \hskip-\makeupwidth \hbox to \makeupwidth{\hss\layoutelementparameter#middle\hss}% \hskip-\makeupwidth - \hbox to \makeupwidth{\hss\layoutelementparameter#right\ifnum#extrastate=\extra_at_margin_right\place_layout_extra_text_right\fi}}} + \hbox to \makeupwidth{\hss\layoutelementparameter#right\ifnum#extrastate=\page_layouts_extra_at_margin_right\page_layouts_place_extra_text_right\fi}}} -\def\place_right_margin_layout_element#parameter#extrastate% +\def\page_layouts_right_margin_element#parameter#extrastate% {\edef\currentlayoutelement{\currentlayouttextline:\v!margin}% \hskip\rightmargindistance - \place_layout_element_indeed\rightmarginwidth + \page_layouts_place_element_indeed\rightmarginwidth {\hbox to \rightmarginwidth{\layoutelementparameter#parameter\hss}% - \ifnum#extrastate=\extra_at_margin_right + \ifnum#extrastate=\page_layouts_extra_at_margin_right \hskip-\rightmarginwidth \hbox to \rightmarginwidth{\layoutelementparameter\c!margintext\hss}% \fi}} -\def\place_right_edge_layout_element#parameter% +\def\page_layouts_right_edge_element#parameter% {\edef\currentlayoutelement{\currentlayouttextline:\v!edge}% \hskip\rightedgedistance - \place_layout_element_indeed\rightedgewidth + \page_layouts_place_element_indeed\rightedgewidth {\layoutelementparameter#parameter\hss}} -\def\place_layout_element_indeed#width#content% +\def\page_layouts_place_element_indeed#width#content% {\vbox % to \vsize {\hsize#width\relax \layoutelementparameter\c!before @@ -633,24 +637,24 @@ %D \stoptyping \unexpanded\def\definetext - {\doseventupleempty\define_text} + {\doseventupleempty\page_layouts_define_text} -\def\define_text[#tag][#vertical][#horizontal][#a][#b][#c][#d]% +\def\page_layouts_define_text[#tag][#vertical][#horizontal][#a][#b][#c][#d]% {\ifseventhargument \setvalue{\namedlayoutelementhash{#vertical:#horizontal}#tag}% - {\dosixtupleempty\setup_texts[#vertical][#horizontal][#a][#b][#c][#d]}% + {\dosixtupleempty\page_layouts_setup_texts[#vertical][#horizontal][#a][#b][#c][#d]}% \else\ifsixthargument \setvalue{\namedlayoutelementhash{#vertical}#tag}% - {\dosixtupleempty\setup_texts[#vertical][#horizontal][#a][#b][#c]}% + {\dosixtupleempty\page_layouts_setup_texts[#vertical][#horizontal][#a][#b][#c]}% \else\iffifthargument \setvalue{\namedlayoutelementhash{#vertical:#horizontal}#tag}% - {\dosixtupleempty\setup_texts[#vertical][#horizontal][#a][#b]}% + {\dosixtupleempty\page_layouts_setup_texts[#vertical][#horizontal][#a][#b]}% \else\iffourthargument \setvalue{\namedlayoutelementhash{#vertical}#tag}% - {\dosixtupleempty\setup_texts[#vertical][#horizontal][#a]}% + {\dosixtupleempty\page_layouts_setup_texts[#vertical][#horizontal][#a]}% \else \setvalue{\namedlayoutelementhash{#vertical}#tag}% - {\dosixtupleempty\setup_texts[#vertical][#horizontal]}% + {\dosixtupleempty\page_layouts_setup_texts[#vertical][#horizontal]}% \fi\fi\fi\fi} %D A few more page breakers: @@ -683,74 +687,74 @@ % associated. This is a rather messy test but better than the MkII % way where we use states and keep settings. -\let\layout_page_number_location \relax -\let\layout_page_number_location_v\relax -\let\layout_page_number_location_h\relax -\let\layout_page_number_location_x\relax +\let\m_page_layouts_page_number_location_ \relax +\let\m_page_layouts_page_number_location__v\relax +\let\m_page_layouts_page_number_location__h\relax +\let\m_page_layouts_page_number_location__x\relax -\def\place_layout_page_number % also elsewhere .. beware, not \unexpanded else +\def\page_layouts_place_page_number % also elsewhere .. beware, not \unexpanded else {\placelocationpagenumber} % test below fails -\def\reset_layout_page_number_location - {\ifx\layout_page_number_location_v\relax\else - \edef\currentlayoutelement{\layout_page_number_location_v:\layout_page_number_location_h}% - \edef\previous_page_number_locator{\detokenizedlayoutelementparameter\layout_page_number_location_x}% - \doif{\meaning\previous_page_number_locator}{\meaning\place_layout_page_number} - {\resetlayoutelementparameter\layout_page_number_location_x}% +\def\page_layouts_reset_page_number_location + {\ifx\m_page_layouts_page_number_location__v\relax\else + \edef\currentlayoutelement{\m_page_layouts_page_number_location__v:\m_page_layouts_page_number_location__h}% + \edef\page_layouts_previous_page_number_locator{\detokenizedlayoutelementparameter\m_page_layouts_page_number_location__x}% + \doif{\meaning\page_layouts_previous_page_number_locator}{\meaning\page_layouts_place_page_number} + {\resetlayoutelementparameter\m_page_layouts_page_number_location__x}% \fi} -\def\set_layout_page_number_location - {\edef\currentlayoutelement{\layout_page_number_location_v:\layout_page_number_location_h}% - \letlayoutelementparameter\layout_page_number_location_x\place_layout_page_number - \ifx\layout_page_number_location_x\c!marginedgetext - \let\place_layout_extra_text_left \place_layout_page_number_left - \let\place_layout_extra_text_right\place_layout_page_number_right +\def\page_layouts_set_page_number_location + {\edef\currentlayoutelement{\m_page_layouts_page_number_location__v:\m_page_layouts_page_number_location__h}% + \letlayoutelementparameter\m_page_layouts_page_number_location__x\page_layouts_place_page_number + \ifx\m_page_layouts_page_number_location__x\c!marginedgetext + \let\page_layouts_place_extra_text_left \page_layouts_place_page_number_left + \let\page_layouts_place_extra_text_right\page_layouts_place_page_number_right \else - \let\place_layout_extra_text_left \relax - \let\place_layout_extra_text_right\relax + \let\page_layouts_place_extra_text_left \relax + \let\page_layouts_place_extra_text_right\relax \fi} -\def\identify_layout_page_number_location - {\let\layout_page_number_location_v\v!footer - \let\layout_page_number_location_h\v!text - \let\layout_page_number_location_x\c!middletext +\def\page_layouts_identify_page_number_location + {\let\m_page_layouts_page_number_location__v\v!footer + \let\m_page_layouts_page_number_location__h\v!text + \let\m_page_layouts_page_number_location__x\c!middletext \processallactionsinset[\@@nmlocation] - [ \v!header=>\let\layout_page_number_location_v\v!header, - \v!footer=>\let\layout_page_number_location_v\v!footer, - \v!middle=>\let\layout_page_number_location_h\v!text - \let\layout_page_number_location_x\c!middletext, - \v!left=>\let\layout_page_number_location_h\v!text - \let\layout_page_number_location_x\c!lefttext, - \v!right=>\let\layout_page_number_location_h\v!text - \let\layout_page_number_location_x\c!righttext, - \v!inleft=>\let\layout_page_number_location_h\v!margin - \let\layout_page_number_location_x\c!lefttext, - \v!inright=>\let\layout_page_number_location_h\v!margin - \let\layout_page_number_location_x\c!righttext, - \v!inmargin=>\let\layout_page_number_location_h\v!margin - \def\layout_page_number_location_x{\ifdoublesided\c!margintext\else\c!righttext\fi}, - \v!margin=>\let\layout_page_number_location_h\v!margin - \def\layout_page_number_location_x{\ifdoublesided\c!margintext\else\c!righttext\fi}, - \v!atmargin=>\let\layout_page_number_location_h\v!text - \let\layout_page_number_location_x\c!marginedgetext, - \v!marginedge=>\let\layout_page_number_location_h\v!text - \let\layout_page_number_location_x\c!marginedgetext]} + [ \v!header=>\let\m_page_layouts_page_number_location__v\v!header, + \v!footer=>\let\m_page_layouts_page_number_location__v\v!footer, + \v!middle=>\let\m_page_layouts_page_number_location__h\v!text + \let\m_page_layouts_page_number_location__x\c!middletext, + \v!left=>\let\m_page_layouts_page_number_location__h\v!text + \let\m_page_layouts_page_number_location__x\c!lefttext, + \v!right=>\let\m_page_layouts_page_number_location__h\v!text + \let\m_page_layouts_page_number_location__x\c!righttext, + \v!inleft=>\let\m_page_layouts_page_number_location__h\v!margin + \let\m_page_layouts_page_number_location__x\c!lefttext, + \v!inright=>\let\m_page_layouts_page_number_location__h\v!margin + \let\m_page_layouts_page_number_location__x\c!righttext, + \v!inmargin=>\let\m_page_layouts_page_number_location__h\v!margin + \def\m_page_layouts_page_number_location__x{\ifdoublesided\c!margintext\else\c!righttext\fi}, + \v!margin=>\let\m_page_layouts_page_number_location__h\v!margin + \def\m_page_layouts_page_number_location__x{\ifdoublesided\c!margintext\else\c!righttext\fi}, + \v!atmargin=>\let\m_page_layouts_page_number_location__h\v!text + \let\m_page_layouts_page_number_location__x\c!marginedgetext, + \v!marginedge=>\let\m_page_layouts_page_number_location__h\v!text + \let\m_page_layouts_page_number_location__x\c!marginedgetext]} \unexpanded\def\dosetpagenumberlocation - {\ifx\@@nmlocation\layout_page_number_location + {\ifx\@@nmlocation\m_page_layouts_page_number_location_ % unchanged \else - \let\layout_page_number_location\@@nmlocation - \reset_layout_page_number_location + \let\m_page_layouts_page_number_location_\@@nmlocation + \page_layouts_reset_page_number_location \ifx\@@nmlocation\empty % set otherwise \else - \identify_layout_page_number_location - \set_layout_page_number_location + \page_layouts_identify_page_number_location + \page_layouts_set_page_number_location \fi \fi} -\def\place_layout_page_number_left % historic +\def\page_layouts_place_page_number_left % historic {\begingroup \setbox\scratchbox\normalhbox{\ignorespaces\layoutelementparameter\c!marginedgetext\removeunwantedspaces}% \ifzeropt\wd\scratchbox\else @@ -760,7 +764,7 @@ \fi \endgroup} -\def\place_layout_page_number_right % historic +\def\page_layouts_place_page_number_right % historic {\begingroup \setbox\scratchbox\normalhbox{\ignorespaces\layoutelementparameter\c!marginedgetext\removeunwantedspaces}% \ifzeropt\wd\scratchbox\else @@ -776,15 +780,15 @@ % the next macros will be redone (less boxing) -\newbox\layout_element_box +\newbox\b_page_layouts_element -\def\page_insert_elements +\def\page_layouts_insert_elements {\ifcase\pageornamentstate - \place_layout_elements_indeed + \page_layouts_place_elements_indeed \fi} -\def\place_layout_elements_indeed - {\setbox\layout_element_box\vbox +\def\page_layouts_place_elements_indeed + {\setbox\b_page_layouts_element\vbox {\dontcomplain \calculatereducedvsizes \swapmargins @@ -794,7 +798,7 @@ \vskip\dimexpr\topheight+\topdistance\relax \the\headertextcontent \vskip\dimexpr\headerheight+\headerdistance\relax - \positions_place_anchors + \anch_positions_place_anchors \vskip-\textheight \the\texttextcontent \vskip\textheight @@ -805,11 +809,11 @@ \the\bottomtextcontent \vskip\bottomheight \vfilll}% - \smashbox\layout_element_box - \box\layout_element_box} + \smashbox\b_page_layouts_element + \box\b_page_layouts_element} \def\page_insert_body#1#2% - {\setbox\layout_element_box\vbox + {\setbox\b_page_layouts_element\vbox {\offinterlineskip \calculatereducedvsizes \calculatehsizes @@ -830,10 +834,10 @@ \fi \endgroup \mkprocesspagecontents{#2}% - \settextpagecontent\layout_element_box{#1}{#2}% - \page_backgrounds_add_to_text\layout_element_box - \page_grids_add_to_box\layout_element_box - \box\layout_element_box + \settextpagecontent\b_page_layouts_element{#1}{#2}% + \page_backgrounds_add_to_text\b_page_layouts_element + \page_grids_add_to_box\b_page_layouts_element + \box\b_page_layouts_element \begingroup \ifdim\rightmarginwidth>\zeropoint \kern\rightmargindistance @@ -847,8 +851,8 @@ \fi \endgroup \hss}}% - \smashbox\layout_element_box - \box\layout_element_box} + \smashbox\b_page_layouts_element + \box\b_page_layouts_element} %D The main text area has to be combined with some additional %D (tracing) information. |