summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/strc-ren.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-ren.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/strc-ren.mkiv95
1 files changed, 72 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-ren.mkiv b/Master/texmf-dist/tex/context/base/strc-ren.mkiv
index 8890ec8e6c7..3a60a34a380 100644
--- a/Master/texmf-dist/tex/context/base/strc-ren.mkiv
+++ b/Master/texmf-dist/tex/context/base/strc-ren.mkiv
@@ -27,20 +27,55 @@
\newevery \everyheadstart \relax
-\def\placeheadmargintexts
+\unexpanded\def\placeheadmargintexts
{\the\everyheadstart
\doif{\structureheadparameter\c!margintext}\v!yes\placemargincontent}
-\def\doplaceheadtextcomponent#1#2%
- {\begingroup
- \dosetstructureheadattributes\c!style\c!color
- \dosetstructureheadattributes\c!textstyle\c!textcolor
- \dontconvertfont
- \ifconditional\structureheadisdisplay % \ifdisplaysectionhead
- \setupinterlinespace
+\unexpanded\def\setupheadcomponentfont#1#2%
+ {\ifconditional\structureheadisdisplay
+ \edef\askedstructureheadinterlinespace{\structureheadparameter\c!interlinespace}%
+ \ifx\askedstructureheadinterlinespace\empty
+ % here the interline space is only set when style sets no space
+ \setfalse\fontattributeisset
+ \setfalse\interlinespaceisset
+ \dosetstructureheadattributes\c!style\c!color
+ \ifconditional\fontattributeisset \ifconditional\interlinespaceisset \else
+ \setupinterlinespace
+ \fi \fi
+ \setfalse\fontattributeisset \dosetstructureheadattributes#1#2%
+ \ifconditional\fontattributeisset \ifconditional\interlinespaceisset \else
+ \setupinterlinespace
+ \fi \fi
\else
+ % here the set interline space overloads any other set space in the style
+ \setfalse\fontattributeisset
+ \dosetstructureheadattributes\c!style\c!color
+ \ifconditional\fontattributeisset
+ \dosetupcheckedinterlinespace\askedstructureheadinterlinespace
+ \fi
+ \setfalse\fontattributeisset
+ \dosetstructureheadattributes#1#2%
+ \ifconditional\fontattributeisset
+ \dosetupcheckedinterlinespace\askedstructureheadinterlinespace
+ \fi
+ \fi
+ \else
+ \setfalse\fontattributeisset
+ \dosetstructureheadattributes\c!style\c!color
+ \ifconditional\fontattributeisset
+ \setupspacing
+ \fi
+ \setfalse\fontattributeisset
+ \dosetstructureheadattributes#1#2%
+ \ifconditional\fontattributeisset
\setupspacing
\fi
+ \fi
+ \dontconvertfont}
+
+\def\doplaceheadtextcomponent#1#2%
+ {\begingroup
+ \setupheadcomponentfont\c!textstyle\c!textcolor
% \ifcase\headtimingmode#1\fi % can introduce cr
\structureheadparameter\c!commandbefore
\placeheadmargintexts
@@ -68,8 +103,7 @@
\def\doplaceheadnumbercomponent#1#2%
{\begingroup
- \dosetstructureheadattributes\c!style\c!color
- \dosetstructureheadattributes\c!numberstyle\c!numbercolor
+ \setupheadcomponentfont\c!numberstyle\c!numbercolor
% \getvalue{\??ko\currentstructurehead\c!commandbefore}% strange, why here? moved 21/11/2005
\placeheadmargintexts
\ifconditional\structureheadisdisplay % \ifdisplaysectionhead
@@ -93,7 +127,6 @@
\def\doplacestructureheadtext#1#2#3% nodes, text, endstuff
{\beginheadplacement
-% \postponenotes
\doresettructureheadnumbercontent
\ifconditional\structureheadleaveempty
\setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute to \zeropoint {#1}%
@@ -109,7 +142,6 @@
\def\doplacestructureheadnumbertext#1#2#3#4% nodes number text nodes
{\beginheadplacement
-% \postponenotes
\doiftextelse{#2}\dosettructureheadnumbercontent\doresettructureheadnumbercontent
\ifconditional\structureheadleaveempty
\setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \structureheadattribute to \zeropoint{#1}%
@@ -122,13 +154,13 @@
\fi
\endheadplacement{#4}}
-\def\placestructureheadnumbertext
+\unexpanded\def\placestructureheadnumbertext
{\doplacestructureheadnumbertext\empty\getstructureheadnumber\getstructureheadtitle\getstructureheadsyncs}
-\def\placestructureheadtext
+\unexpanded\def\placestructureheadtext
{\doplacestructureheadtext\empty\getstructureheadtitle\getstructureheadsyncs}
-\def\placestructureheadnothing
+\unexpanded\def\placestructureheadempty
{\hbox \structureheadattribute {\getstructureheadsyncs}}
%D \starttyping
@@ -159,7 +191,6 @@
\def\beginheadplacement
{\bgroup
\setsystemmode\currentstructurehead
- \ifgridsnapping\iftracegridsnapping\showstruts\fi\fi
\xdef\localheadheight {\the\strutht}%
\xdef\localheaddepth {\the\strutdp}%
\xdef\localheadlineheight{\the\lineheight}%
@@ -241,10 +272,25 @@
\v!unknown=>\hangheadplacement\noflines\numexpr0\commalistelement-1\relax]%
% so far
\let\headlastlinewidth\!!zeropoint
- \snaptogrid[\structureheadparameter\c!grid]\hbox
- {\hskip\localheadskip
- \hskip\structureheadparameter\c!margin\relax
- \box\sectionheadbox}%
+ % kind of special, we want to snap heads also according to local specs local
+ \ifgridsnapping
+ \begingroup
+ \edef\currentstructureheadgridsnapping{\structureheadparameter\c!grid}%
+ \ifconditional\structureheadisdisplay
+ \ifx\currentstructureheadgridsnapping\empty\else
+ \dosetstructureheadattributes\c!style\c!color
+ \setupinterlinespace
+ \dosetstructureheadattributes\c!textstyle\c!textcolor
+ \setupinterlinespace
+ \fi
+ \fi
+ \snaptogrid[\currentstructureheadgridsnapping]\hbox
+ {\hskip\localheadskip\hskip\structureheadparameter\c!margin\box\sectionheadbox}%
+ \endgroup
+ \else
+ \hbox
+ {\hskip\localheadskip\hskip\structureheadparameter\c!margin\box\sectionheadbox}%
+ \fi
\flushnotes % new, not really needed
\endgraf
\ifvmode
@@ -297,13 +343,16 @@
\let\numberheadalternative\v!normal
-\def\defineheadplacement
+\unexpanded\def\defineheadplacement
{\dodoubleargument\dodefineheadplacement}
\def\dodefineheadplacement[#1][#2]% #3#4
{\setvalue{\??ns:#1}{#2}%
\setvalue{\??ns::#1}}
+\def\presetnumberheadalternative
+ {\doifelsevalue{\??ns:\numberheadalternative}\v!horizontal\setfalse\settrue\structureheadisdisplay}
+
% \def\normalplacehead
% {\executeifdefined
% {\??ns::\numberheadalternative}
@@ -390,7 +439,7 @@
\fi
#2}}
-\def\placeheadmargin#1#2%
+\unexpanded\def\placeheadmargin#1#2%
{\vbox
{\localheadsetup
\begstrut % use one \strut here!
@@ -425,7 +474,7 @@
{\begstrut#2}%
\egroup}
-\def\placeheadlohi#1#2#3%
+\unexpanded\def\placeheadlohi#1#2#3%
{\ifconditional\structureheadshownumber % \ifheadnumbercontent
\setbox0\hbox{#2}
\setbox2=#1{\localheadsetup\advance\hsize-\wd0\relax#3}%