summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-spa.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-spa.tex')
-rw-r--r--Master/texmf-dist/tex/context/base/core-spa.tex558
1 files changed, 435 insertions, 123 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-spa.tex b/Master/texmf-dist/tex/context/base/core-spa.tex
index cb3363f8c09..189d98396fb 100644
--- a/Master/texmf-dist/tex/context/base/core-spa.tex
+++ b/Master/texmf-dist/tex/context/base/core-spa.tex
@@ -13,7 +13,7 @@
\writestatus{loading}{Context Spacing Macros}
-% to be sorted out: dependencies, orderof initialization
+% to be sorted out: dependencies, order of initialization
\unprotect
@@ -35,6 +35,8 @@
\appendtoks \simplesetupspacing \to \everybodyfont % nieuw
\appendtoks \setdisplayskips \to \everybodyfont % nieuw
+\appendtoks \setrelativeinterlinespace \to \everybodyfont
+
\appendtoks \updateraggedskips \to \everyfontswitch % under test
\prependtoks \let\par\endgraf \to \everypagebody % see \fillinline
@@ -171,14 +173,43 @@
\setfontparameters % redundant, can be \setstrut, test first
\updateraggedskips} % yes indeed
+% \let\currentrelativeinterlinespace\empty
+%
+% \def\setuprelativeinterlinespace[#1]%
+% {\processallactionsinset
+% [#1]
+% [ \v!on=>\oninterlineskip,
+% \v!off=>\offinterlineskip,
+% \v!reset=>\let\currentrelativeinterlinespace\empty
+% \setfontparameters,% just \setstrut, test first
+% \s!unknown=>\assignvalue{#1}\currentrelativeinterlinespace{1.00}{1.25}{1.50}%
+% \spacing\currentrelativeinterlinespace]}
+
+% \setupinterlinespace[big] \switchtobodyfont[11pt] -> forgotten
+% \setupinterlinespace[auto,big] \switchtobodyfont[11pt] -> remembered
+
+\let\currentrelativeinterlinespace\empty
+
\def\setuprelativeinterlinespace[#1]%
- {\processallactionsinset % \regelwit = dummy !
+ {\processallactionsinset
[#1]
[ \v!on=>\oninterlineskip,
\v!off=>\offinterlineskip,
- \v!reset=>\setfontparameters,% just \setstrut, test first
- \s!unknown=>\assignvalue{#1}\regelwit{1.00}{1.25}{1.50}%
- \spacing\regelwit]}
+ \v!reset=>\let\currentrelativeinterlinespace\empty
+ \let\setrelativeinterlinespace\relax
+ \setfontparameters,
+ \v!auto=>\let\setrelativeinterlinespace\dosetrelativeinterlinespace,
+ \s!unknown=>\assignvalue\commalistelement\currentrelativeinterlinespace{1.00}{1.25}{1.50}%
+ \spacing\currentrelativeinterlinespace]}
+
+\def\dosetrelativeinterlinespace
+ {\ifx\currentrelativeinterlinespace\empty\else
+ \spacing\currentrelativeinterlinespace
+ \fi}
+
+\let\setrelativeinterlinespace\relax
+
+% \appendtoks \setrelativeinterlinespace \to \everybodyfont
\def\complexsetupinterlinespace[#1]% \commalistelement ipv #1
{\doifassignmentelse{#1}\setupspecifiedinterlinespace\setuprelativeinterlinespace[#1]}
@@ -468,9 +499,21 @@
\defineblankmethod [\v!joinedup] {\ifvmode\nointerlineskip\fi}
% happens often, so we speed this up:
+%
+% \defineblankmethod [2*\v!line] {\addblankskip+{2\openlineheight}{2\openlineheight}}
+% \defineblankmethod [2*\v!big] {\addblankskip+{2\bigskipamount }{2\openlineheight}}
+%
+% no, with 2\whatever we loose the stretch and shrink! Taco's alternative:
-\defineblankmethod [2*\v!line] {\addblankskip+{2\openlineheight}{2\openlineheight}}
-\defineblankmethod [2*\v!big] {\addblankskip+{2\bigskipamount }{2\openlineheight}}
+\defineblankmethod
+ [2*line]
+ {\addblankskip+\openlineheight\openlineheight
+ \addblankskip+\openlineheight\openlineheight}
+
+\defineblankmethod
+ [2*big]
+ {\addblankskip+\bigskipamount\openlineheight
+ \addblankskip+\bigskipamount\openlineheight}
% ETEX ! ! !
@@ -760,11 +803,14 @@
\def\noblankpsignal{1010101}
\def\inhibitgridblank % was doinhibitblank
- {\ifnum\lastpenalty<10000
- \kern-\noblanksignal % new
- \kern \noblanksignal
- \else
- \penalty\noblankpsignal
+ {\ifvmode\else\endgraf\fi
+ \ifvmode
+ \ifnum\lastpenalty<10000
+ \kern-\noblanksignal % new
+ \kern \noblanksignal
+ \else
+ \penalty\noblankpsignal
+ \fi
\fi}
\def\inhibittextblank % was inhibitblank
@@ -1206,29 +1252,58 @@
\definecomplexorsimple\setupindenting
+% \def\complexsetupindenting[#1]%
+% {\edef\currentindenting{#1}%
+% \indentfirstparagraphtrue
+% \parindent\ctxparindent
+% \chardef\indentingtoggle\zerocount
+% \processcommalist[#1]\docomplexsetupindenting
+% \ifindentfirstparagraph\else\noindentation\fi % added
+% \toggleindentation}
+
+\indentfirstparagraphtrue
+\parindent\ctxparindent
+\chardef\indentingtoggle\zerocount
+
+% \newtoks\savedeverypar \savedeverypar\everypar
+% \def\restoreeverypar{\everypar\savedeverypar}
+
+% we need a better everypar model: for each option a switch, which we
+% set to false with \forgetall and can enable when needed (context 4);
+% that way we can control the order of execution of options
+
+\def\checkeverypar % currently a hack
+ {\ifzeropt\parindent\else
+ \doifsometokselse\everypar\donothing{\appendtoks\checkindentation\to\everypar}%
+ \fi}
+
\def\complexsetupindenting[#1]%
{\edef\currentindenting{#1}%
- \indentfirstparagraphtrue
- \parindent\ctxparindent
- \chardef\indentingtoggle\zerocount
- \processcommalist[#1]\docomplexsetupindenting
- \ifindentfirstparagraph\else\noindentation\fi % added
- \toggleindentation}
-
-% \def\docomplexsetupindenting#1%
-% {\edef\!!stringa{#1}% catch #1=\somedimen
-% \convertcommand\!!stringa\to\!!stringa
-% \executeifdefined{\??in:\!!stringa}{\edef\currentindentation{#1}\simplesetupindenting}}
-
-\def\docomplexsetupindenting#1%
+ \doifsomething\currentindenting % handy when a parameter is passed
+ {% not here: \indentfirstparagraphtrue
+ % not here: \parindent\ctxparindent
+ % not here: \chardef\indentingtoggle\zerocount
+ % we use commacommand in order to catch #1 being a command (expanded parameter)
+ \processcommacommand[\currentindenting]\docomplexsetupindentingA % catch small, medium, etc
+ \processcommacommand[\currentindenting]\docomplexsetupindentingB % catch rest
+ \checkeverypar % only when non-empty #1
+ \ifindentfirstparagraph\else\noindentation\fi % added
+ \toggleindentation}}
+
+\def\docomplexsetupindentingA#1%
{\edef\!!stringa{#1}% catch #1=\somedimen
\convertcommand\!!stringa\to\!!stringa
- \executeifdefined{\??in:\!!stringa}
+ \doifundefined{\??in:\!!stringa}%
{\edef\currentindentation{#1}%
\let\normalindentation\currentindentation
\simplesetupindenting}}
-\def\simplesetupindenting % empty case
+\def\docomplexsetupindentingB#1%
+ {\edef\!!stringa{#1}% catch #1=\somedimen
+ \convertcommand\!!stringa\to\!!stringa
+ \executeifdefined{\??in:\!!stringa}\donothing}
+
+\def\simplesetupindenting % empty case, a it strange, needed this way?
{\assigndimension\currentindentation\ctxparindent{1em}{1.5em}{2em}}
\def\indenting % kind of obsolete
@@ -1248,7 +1323,8 @@
\defineindentingmethod [\v!yes] {\parindent\ctxparindent\relax} % no \indent !
\defineindentingmethod [\v!always] {\parindent\ctxparindent\relax} % no \indent !
-\defineindentingmethod [\v!never] {\parindent\zeropoint\relax} % no \indent !
+\defineindentingmethod [\v!never] {\parindent\zeropoint\relax % no \indent !
+ \chardef\indentingtoggle\zerocount}
\defineindentingmethod [\v!odd] {\chardef\indentingtoggle\plusone}
\defineindentingmethod [\v!even] {\chardef\indentingtoggle\plustwo}
@@ -1258,6 +1334,10 @@
\simplesetupindenting
\fi}
+\defineindentingmethod [\v!reset] {\indentfirstparagraphtrue
+ \parindent\zerocount
+ \chardef\indentingtoggle\zerocount}
+
\def\noindenting{\indenting[\v!no, \v!next ]}
\def\doindenting{\indenting[\v!yes,\v!first]}
@@ -1331,6 +1411,101 @@
\def\notoggleindentation
{\gdef\checkindentation{\global\indentationtrue\dotoggleindentation}}
+% we need to save the state if we want to adapt behaviour to empty lines
+%
+% \def\setlasthvmode
+% {\global\chardef\savedhvmode\ifhmode\plusone\else\ifvmode\plustwo\else\zerocount\fi\fi}
+%
+% \def\resetlasthvmode
+% {\global\chardef\savedhvmode\zerocount}
+%
+% \chardef\savedhvmode\zerocount
+
+% This is a user requested hack (using the auto-hook).
+
+\chardef\recheckindentationmode\zerocount
+
+\def\dontrechecknextindentation
+ {\global\chardef\recheckindentationmode\zerocount}
+
+\def\dorechecknextindentation
+ {\ifcase\recheckindentationmode
+ % nothing
+ \or
+ \dontrechecknextindentation
+ \expandafter\doautoindentation
+ \fi}
+
+\def\doautoindentation
+ {\doifnextcharelse\par\donothing\noindentation}
+
+\def\autoindentation
+ {\global\chardef\recheckindentationmode\plusone}
+
+%D An example of usage:
+%D
+%D \starttyping
+%D \setupindenting[small,yes]
+%D
+%D \setupitemize [indentnext=auto]
+%D \setuptyping [indentnext=auto]
+%D \setupformulas[indentnext=auto]
+%D
+%D \input tufte
+%D
+%D \startitemize
+%D \item itemize
+%D \stopitemize
+%D \input tufte
+%D
+%D \startitemize
+%D \item itemize
+%D \stopitemize
+%D
+%D \input tufte
+%D
+%D \startitemize
+%D \item itemize
+%D \stopitemize
+%D
+%D \page
+%D
+%D \input tufte
+%D
+%D \starttyping
+%D verbatim
+%D \stoptyping
+%D \input tufte
+%D
+%D \starttyping
+%D verbatim
+%D \stoptyping
+%D
+%D \input tufte
+%D
+%D \starttyping
+%D verbatim
+%D \stoptyping
+%D
+%D \page
+%D
+%D \input tufte
+%D
+%D \startformula
+%D a = b
+%D \stopformula
+%D \input tufte
+%D
+%D \startformula
+%D a = b
+%D \stopformula
+%D
+%D \input tufte
+%D
+%D \startformula
+%D a = b
+%D \stopformula
+
% \frenchspacing leidt soms tot afbreken tussen -, vandaar
% de variant \newfrenchspacing.
@@ -1431,7 +1606,7 @@
\def\godown[#1]%
{\relax
\ifhmode\endgraf\fi
- \ifvmode\nointerlineskip\vskip#1\relax}
+ \ifvmode\nointerlineskip\vskip#1\relax\fi}
%D A couple of plain macros:
@@ -1463,9 +1638,9 @@
\ifx\allowbreak\undefined
- \def\break {\penalty-\@M}
- \def\nobreak {\penalty \@M}
- \def\allowbreak{\penalty \z@}
+ \def\break {\penalty\ifhmode-\plustenthousand\else\ejectpenalty\fi}
+ \def\nobreak {\penalty \plustenthousand}
+ \def\allowbreak{\penalty \zeropoint}
\def\filbreak {\par\vfil\penalty-200\vfilneg}
\def\goodbreak {\par\penalty-500 }
@@ -1503,7 +1678,7 @@
\ifx\supereject\undefined
- \def\supereject{\par\penalty-\@MM}
+ \def\supereject{\par\penalty\superpenalty}
\fi
@@ -1796,8 +1971,8 @@
\stopbaselinecorrection}%
\vbox}
-\def\verticalstrut {\normalvbox{\hsize\zeropoint\strut}}
-\def\horizontalstrut{\normalhbox {\strut}}
+\def\verticalstrut {\normalvbox{\hsize\zeropoint\forgetall\strut}}
+\def\horizontalstrut{\normalhbox {\strut}}
% Hieronder volgen enkele instellingen en macro's ten behoeve
% van de interlinie en \strut. De waarden 2.8, 0.07, 0.72 en
@@ -2112,30 +2287,33 @@
% \edef\strutdepth{\the\strutdimen}%
% \dosetstrut}
+% interesting, strudepth is 4.05064pt vs 4.05066pt depending on grid
+% nasty rounding problem
+
\def\setstrut
{% height
\strutdimen\normallineheight
-\ifdim\minimumstrutheight>\zeropoint
- \strutdimen\minimumstrutheight
-\else
- \strutdimen\strutheightfactor\strutdimen
-\fi
+ \ifdim\minimumstrutheight>\zeropoint
+ \strutdimen\minimumstrutheight
+ \else
+ \strutdimen\strutheightfactor\strutdimen
+ \fi
\strutdimen\spacingfactor\strutdimen
\edef\strutheight{\the\strutdimen}%
% depth
\strutdimen\normallineheight
\ifgridsnapping
-\ifdim\minimumstrutdepth>\zeropoint
- \strutdimen\minimumstrutdepth
-\else
- \advance\strutdimen-\strutheight
-\fi
+ \ifdim\minimumstrutdepth>\zeropoint
+ \strutdimen\minimumstrutdepth
+ \else
+ \advance\strutdimen-\strutheight
+ \fi
\else
-\ifdim\minimumstrutdepth>\zeropoint
- \strutdimen\minimumstrutdepth
-\else
- \strutdimen\strutdepthfactor\strutdimen
-\fi
+ \ifdim\minimumstrutdepth>\zeropoint
+ \strutdimen\minimumstrutdepth
+ \else
+ \strutdimen\strutdepthfactor\strutdimen
+ \fi
\strutdimen\spacingfactor\strutdimen
\fi
\edef\strutdepth{\the\strutdimen}%
@@ -2159,6 +2337,20 @@
\def\setcapstrut% could be M, but Q has descender
{\setcharstrut{Q}}
+%D Handy for math (used in mathml):
+
+\def\charhtstrut
+ {\begingroup
+ \setcharstrut{GJY}%
+ \vrule\!!width\zeropoint\!!depth\zeropoint\!!height\strutht
+ \endgroup}
+
+\def\chardpstrut
+ {\begingroup
+ \setcharstrut{gjy}%
+ \vrule\!!width\zeropoint\!!depth\strutdp\!!height\zeropoint
+ \endgroup}
+
%D Centered looks nicer:
\def\dosetstrut
@@ -2226,7 +2418,7 @@
% \def\begstrut
% {\relax\ifcase\strutht\else
% \strut
-% \normalpenalty\@M % \!!tenthousand
+% \normalpenalty\plustenthousand
% \normalhskip\zeropoint
% \ignorespaces
% \fi}
@@ -2234,7 +2426,7 @@
% \def\endstrut
% {\relax\ifhmode\ifcase\strutht\else
% \removeunwantedspaces
-% \normalpenalty\@M % \!!tenthousand
+% \normalpenalty\plustenthousand
% \normalhskip\zeropoint
% \strut
% \fi\fi}
@@ -2248,15 +2440,15 @@
{\relax\ifcase\strutht\else
\ifconditional\sigstruts
\noindent\horizontalstrut
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip-\strutsignal
\normalhskip\strutsignal
\else
\strut
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip\zeropoint
\fi
- \ignorespaces
+ \expandafter \ignorespaces
\fi}
\def\endstrut
@@ -2265,13 +2457,13 @@
\ifdim\lastskip=\strutsignal
\unskip\unskip\unpenalty\setbox\scratchbox\lastbox
\else
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip\zeropoint
\strut
\fi
\else
\removeunwantedspaces
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip\zeropoint
\strut
\fi
@@ -2283,7 +2475,8 @@
{\setbox\strutbox\copy\nostrutbox
\let\strut\empty
\let\endstrut\empty
- \let\begstrut\empty}
+ \let\begstrut\empty
+ \let\crlfplaceholder\empty}
% unsave:
%
@@ -2420,7 +2613,7 @@
\def\keeplinestogether#1%
{\xdef\restoreinterlinepenalty{\global\resetpenalties\interlinepenalties}%
- \global\setpenalties\interlinepenalties{#1}\!!tenthousand}
+ \global\setpenalties\interlinepenalties{#1}\plustenthousand}
\endETEX
@@ -2430,17 +2623,21 @@
{\xdef\restoreinterlinepenalty
{\global\let\restoreinterlinepenalty\relax
\global\interlinepenalty=\the\interlinepenalty}% keep = here
- \global\interlinepenalty\!!tenthousand}
+ \global\interlinepenalty\plustenthousand}
\endTEX
\newif\ifgridsnapping % to be sure
-\def\defaultwidowpenalty {2000} % was: 1000
-\def\defaultclubpenalty {2000} % was: 800
+\def\defaultwidowpenalty {2000} % was: 1000
+\def\defaultclubpenalty {2000} % was: 800
+\def\defaultdisplaywidowpenalty {50}
+\def\defaultbrokenpenalty {100}
-\def\defaultgridwidowpenalty {0}
-\def\defaultgridclubpenalty {0}
+\def\defaultgridwidowpenalty {0}
+\def\defaultgridclubpenalty {0}
+\def\defaultgriddisplaywidowpenalty {0}
+\def\defaultgridbrokenpenalty {0}
% The original approach:
%
@@ -2466,29 +2663,35 @@
\adjdemerits \zerocount}
\def\setdefaultpenalties
- {\setups[\systemsetupsprefix\s!default]}
+ {\directsetup{\systemsetupsprefix\s!default}}
-\startsetups [\systemsetupsprefix\v!reset]
+\startsetups [\systemsetupsprefix\s!reset]
\resetpenalties\widowpenalties
\resetpenalties\clubpenalties
\resetpenalties\interlinepenalties
\stopsetups
+% we use \directsetup because it's faster and we know there is no csl
+
\startsetups [\systemsetupsprefix\s!default]
- \setups[\systemsetupsprefix\s!reset]
+ \directsetup{\systemsetupsprefix\s!reset}
- \widowpenalty\defaultwidowpenalty
- \clubpenalty \defaultclubpenalty
+ \widowpenalty \defaultwidowpenalty
+ \clubpenalty \defaultclubpenalty
+ \displaywidowpenalty\defaultdisplaywidowpenalty
+ \brokenpenalty \defaultbrokenpenalty
\stopsetups
\startsetups [\v!grid] [\systemsetupsprefix\s!default]
- \setups[\systemsetupsprefix\v!reset]
+ \directsetup{\systemsetupsprefix\s!reset}
- \widowpenalty\defaultgridwidowpenalty
- \clubpenalty \defaultgridclubpenalty
+ \widowpenalty \defaultgridwidowpenalty
+ \clubpenalty \defaultgridclubpenalty
+ \displaywidowpenalty\defaultgriddisplaywidowpenalty
+ \brokenpenalty \defaultgridbrokenpenalty
\stopsetups
@@ -2496,7 +2699,7 @@
\startsetups [\systemsetupsprefix\v!strict]
- \setups[\v!reset]
+ \directsetup{\systemsetupsprefix\s!reset}
\setpenalties\widowpenalties2\maxdimen
\setpenalties\clubpenalties 2\maxdimen
@@ -2639,8 +2842,21 @@
\def\dosetraggedcommand#1%
{\expanded{\dodosetraggedcommand{#1}}}
+% \def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that!
+% {\let\raggedcommand \relax
+% \let\raggedtopcommand \empty
+% \let\raggedbottomcommand\empty
+% \chardef\raggedoneliner\zerocount
+% \doifsomething{#1}
+% {\doifinsetelse\v!broad{#1}\!!doneatrue\!!doneafalse
+% \doifinsetelse\v!wide {#1}\!!donebtrue\!!donebfalse
+% \!!donectrue
+% \rawprocesscommalist[#1]\dododosetraggedcommand}}
+
+\newtoks\everyraggedcommand \def\raggedcommand{\the\everyraggedcommand}
+
\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that!
- {\let\raggedcommand \relax
+ {\everyraggedcommand \emptytoks
\let\raggedtopcommand \empty
\let\raggedbottomcommand\empty
\chardef\raggedoneliner\zerocount
@@ -2655,23 +2871,38 @@
\def\@@ragged@@command{@@raggedcommand}
+\setvalue{\@@ragged@@command\v!hanging }{\appendtoks\enableprotruding \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!nothanging }{\appendtoks\disableprotruding \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!hz }{\appendtoks\enableadjusting \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!nohz }{\appendtoks\disableadjusting \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!spacing }{\appendtoks\enablespacehandling
+ \enablekernhandling \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!nospacing }{\appendtoks\disablespacehandling
+ \disablekernhandling \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!hyphenated }{\appendtoks\dohyphens \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!nothyphenated}{\appendtoks\nohyphens \to\everyraggedcommand}
+
+\setvalue{\@@ragged@@command\v!tolerant }{\appendtoks\tolerance3000\relax \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!verytolerant}{\appendtoks\tolerance4500\relax \to\everyraggedcommand}
+\setvalue{\@@ragged@@command\v!stretch }{\appendtoks\emergencystretch\bodyfontsize\to\everyraggedcommand}
+
\setvalue{\@@ragged@@command\v!left}%
- {\if!!donea \def\raggedcommand{\veryraggedleft}%
- \else \def\raggedcommand{\raggedleft}%
+ {\if!!donea \appendtoks\veryraggedleft\to\everyraggedcommand
+ \else \appendtoks\raggedleft \to\everyraggedcommand
\fi
\!!donecfalse}
\setvalue{\@@ragged@@command\v!right}%
- {\if!!donea \def\raggedcommand{\veryraggedright}%
- \else \def\raggedcommand{\raggedright}%
+ {\if!!donea \appendtoks\veryraggedright\to\everyraggedcommand
+ \else \appendtoks\raggedright \to\everyraggedcommand
\fi
\!!donecfalse}
\setvalue{\@@ragged@@command\v!middle}%
{\if!!donec
- \if!!doneb \def\raggedcommand{\raggedwidecenter}%
- \else\if!!donea \def\raggedcommand{\veryraggedcenter}%
- \else \def\raggedcommand{\raggedcenter}%
+ \if!!doneb \appendtoks\raggedwidecenter\to\everyraggedcommand
+ \else\if!!donea \appendtoks\veryraggedcenter\to\everyraggedcommand
+ \else \appendtoks\raggedcenter \to\everyraggedcommand
\fi\fi
\!!donecfalse
\else
@@ -2694,13 +2925,13 @@
\let\raggedtopcommand\vfilll} % ugly laho (lohi)
\setvalue{\@@ragged@@command\v!no}%
- {\def\raggedcommand{\raggedright}}
+ {\appendtoks\raggedright\to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!yes}%
- {\let\raggedcommand\notragged}
+ {\appendtoks\notragged\to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!normal}%
- {\let\raggedcommand\notragged}
+ {\appendtoks\notragged\to\everyraggedcommand}
\setvalue{\@@ragged@@command\v!inner}% not yet perfect
{\signalrightpage % may interfere
@@ -2714,33 +2945,44 @@
{\getvalue{\@@ragged@@command\v!left}}
{\getvalue{\@@ragged@@command\v!right}}}
+% compare:
+%
+% \framed[width=4cm,align=no] {\hfil xxx}
+% \framed[width=4cm,align=disable]{\hfil xxx}
+
+\setvalue{\@@ragged@@command\v!disable}% for one liners
+ {\appendtoks\raggedright\parfillskip\zeropoint\to\everyraggedcommand}
+
\chardef\raggedoneliner\zerocount
\setvalue{\@@ragged@@command\v!line}%
{\chardef\raggedoneliner\plusone}
-\def\@@startraggedoneliner
- {\ifcase\raggedoneliner\else
- \dontleavehmode\hbox\bgroup
- \ifcase\raggedstatus\or\hss\or\hss\fi
- \ignorespaces
- \bgroup
- \aftergroup\removeunwantedspaces
- \fi}
+%D Unofficial, may disappear. Now handled directly in the
+%D core-rul module.
-\def\@@stopraggedoneliner
- {\ifcase\raggedoneliner\else
- \egroup
- \ifcase\raggedstatus\or\hss\or\or\hss\fi
- \egroup
- \ignorespaces
- \fi}
+% \def\@@startraggedoneliner
+% {\ifcase\raggedoneliner\else
+% \dontleavehmode\hbox to \hsize \bgroup % hsize added, else useless
+% \ifcase\raggedstatus\or\hss\or\hss\fi
+% \ignorespaces
+% \bgroup
+% \aftergroup\removeunwantedspaces
+% \fi}
-\def\@@handleoneliner
- {\ifcase\raggedoneliner\else
- \@@startraggedoneliner
- \aftergroup\@@stopraggedoneliner
- \fi}
+% \def\@@stopraggedoneliner
+% {\ifcase\raggedoneliner\else
+% \egroup
+% \ifcase\raggedstatus\or\or\hss\or\hss\fi
+% \egroup
+% \ignorespaces % ? ? ?
+% \fi}
+
+% \def\@@handleoneliner
+% {\ifcase\raggedoneliner\else
+% \@@startraggedoneliner
+% \aftergroup\@@stopraggedoneliner
+% \fi}
% Nodig i.v.m. inspringen eerste alineas
@@ -2922,12 +3164,26 @@
\endETEX
+\newconditional \parbasedattributes
+
+\def\finishparbasedattributes
+ {\ifconditional\parbasedattributes
+ \setfalse\parbasedattributes
+ \par
+ \fi}
+
+\def\dostopparbasedattributes
+ {\settrue\parbasedattributes
+ \dostopattributes}
+
\unexpanded\def\@@dostopattributes
{\stopcolor
+ \finishparbasedattributes
\endgroup}
\unexpanded\def\@@nostopattributes
- {\endgroup}
+ {\finishparbasedattributes
+ \endgroup}
\unexpanded\def\doattributes#1#2#3#4%
{\dostartattributes{#1}{#2}{#3}{#4}\dostopattributes}
@@ -2950,10 +3206,12 @@
%
% \unexpanded\def\@@dostopattributes%
% {\stopcolor
+% \finishparbasedattributes
% \endgroup}
%
% \unexpanded\def\@@nostopattributes%
-% {\endgroup}
+% {\finishparbasedattributes
+% \endgroup}
\unexpanded\def\dostartattributes#1#2#3%
{\begingroup % geen \bgroup, anders in mathmode lege \hbox
@@ -2974,10 +3232,12 @@
\unexpanded\def\@@dostopattributes
{\doglobalstopcolor
+ \finishparbasedattributes
\endgroup}
\unexpanded\def\@@nostopattributes
- {\endgroup}
+ {\finishparbasedattributes
+ \endgroup}
\endETEX
@@ -3127,13 +3387,13 @@
%
% \def\setraggedparagraphmode#1#2% combineren met \ifrightpage
% {\ifinpagebody
-% \ifdubbelzijdig
+% \ifdoublesided
% \ifodd\realpageno\relax#1\else#2\fi
% \else
% #2\relax
% \fi
% \else\ifinner
-% \ifdubbelzijdig
+% \ifdoublesided
% \gettwopassdata\s!paragraph
% \iftwopassdatafound
% \ifodd\twopassdata\relax#1\else#2\fi
@@ -3151,7 +3411,7 @@
% \def\doifrightpageelse % watch out: other default ! ! !
% {\ifinpagebody
% % optimalisation ?
-% \ifdubbelzijdig
+% \ifdoublesided
% \ifodd\realpageno\relax
% \twopassdatafoundtrue \else \twopassdatafoundfalse
% \fi
@@ -3159,7 +3419,7 @@
% \twopassdatafoundtrue
% \fi
% \else
-% \ifdubbelzijdig
+% \ifdoublesided
% \gettwopassdata\s!paragraph
% \iftwopassdatafound
% \ifodd\twopassdata\relax
@@ -3181,7 +3441,7 @@
% \fi}
%
% \def\signalrightpage
-% {\ifdubbelzijdig \ifinpagebody \else
+% {\ifdoublesided \ifinpagebody \else
% \doparagraphreference
% \fi \fi}
@@ -3193,7 +3453,7 @@
\chardef \frozenpagestate \zerocount
\def\dotrackpagestate#1#2%
- {\ifdubbelzijdig \ifinpagebody \else
+ {\ifdoublesided \ifinpagebody \else
\doforcedtrackpagestate{#1}{#2}%
\fi \fi}
@@ -3213,14 +3473,14 @@
\pagestatemismatchfalse
\let\realpagestateno\realfolio
\ifinpagebody
- \ifdubbelzijdig
+ \ifdoublesided
\ifodd\realpageno\relax
\twopassdatafoundtrue \else \twopassdatafoundfalse
\fi
\else
\twopassdatafoundtrue
\fi
- \else\ifdubbelzijdig
+ \else\ifdoublesided
\findtwopassdata{#1}{#2:}%
\iftwopassdatafound
\let\realpagestateno\twopassdata
@@ -3435,7 +3695,7 @@
% \hyphenpenalty = ( 2.5 * \hsize ) / \raggedness
% \tolerance >= 1500 % was 200
-% \raggedness = 2 .. 6\korpsgrootte
+% \raggedness = 2 .. 6\bodyfontsize
\chardef\raggedstatus=0 % normal left center right
@@ -3443,6 +3703,8 @@
\def\rightraggedness {2\bodyfontsize}
\def\middleraggedness {6\bodyfontsize}
+\def\middleraggedness {.5\hsize} % was: 6\bodyfontsize, fails on: \placefigure{x $x=x$ x}{}
+
%D More hyphenation control, will be combined with align
%D setup.
@@ -3452,8 +3714,8 @@
{\hyphenpenalty\the\hyphenpenalty
\exhyphenpenalty\the\exhyphenpenalty\relax}%
\fi
- \hyphenpenalty\@M
- \exhyphenpenalty\@M}
+ \hyphenpenalty\plustenthousand
+ \exhyphenpenalty\plustenthousand}
\let\dohyphens\relax
@@ -3663,13 +3925,17 @@
\setvalue{@@align@@\v!nothanging }{\disableprotruding}
\setvalue{@@align@@\v!hz }{\enableadjusting}
\setvalue{@@align@@\v!nohz }{\disableadjusting}
-\setvalue{@@align@@\v!spacing }{\enablespacehandling}
-\setvalue{@@align@@\v!nospacing }{\disablespacehandling}
+\setvalue{@@align@@\v!spacing }{\enablespacehandling \enablekernhandling}
+\setvalue{@@align@@\v!nospacing }{\disablespacehandling\disablekernhandling}
\setvalue{@@align@@\v!hyphenated }{\dohyphens}
\setvalue{@@align@@\v!nothyphenated}{\nohyphens}
\setvalue{@@align@@\v!new }{\@@asraggedfalse} % so new will give you consistency
\setvalue{@@align@@\v!reset }{\notragged\normalbottom}
+\setvalue{@@align@@\v!tolerant }{\tolerance3000 \relax}
+\setvalue{@@align@@\v!verytolerant}{\tolerance4500 \relax}
+\setvalue{@@align@@\v!stretch }{\emergencystretch\bodyfontsize}
+
\setvalue{@@ngila@@\v!broad }{\!!doneatrue}
\setvalue{@@ngila@@\v!wide }{\!!donebtrue}
@@ -3707,14 +3973,14 @@
% see later for the real definition, which in the simple case is:
\def\doalignline#1#2% \\ == newline
- {\bgroup
+ {\begingroup
\setlocalhsize % new
\def\\{\egroup\par\doalignline{#1}{#2}\bgroup}%
\dowithnextbox
- {\noindent
+ {\noindentation % was \ noindent
\hbox to \localhsize
{\ifcase\alignstrutmode\or\strut\fi
- #1\unhbox\nextbox#2}\egroup}
+ #1\unhbox\nextbox#2}\endgroup}
\hbox}
% directe commando's
@@ -4248,6 +4514,22 @@
\doglobal\appendtoks#2\to\everyfirstparagraphintro
\doglobal\appendtoks#2\to\everynextparagraphintro]}
+%D We can say:
+%D
+%D \starttyping
+%D \setupparagraphintro[first][\index{Knuth}]
+%D \stoptyping
+%D
+%D Maybe more convenient is:
+%D
+%D \starttyping
+%D \flushatparagraph{\index{Zapf}}
+%D \stoptyping
+
+\def\flushatparagraph#1%
+ {\global\chardef\everyparagraphintro\plusone
+ \global\appendtoks{#1}\to\everyfirstparagraphintro}
+
% \def\doinsertparagraphintro
% {\ifcase\everyparagraphintro\relax
% % no data
@@ -4383,9 +4665,39 @@
\def\fixedspaceamount#1%
{#1\fontdimen2\font}
+%D This is a dangerous feature because it makes the \TEX\ source
+%D less portable, i.e. any parser now needs to apply exactly the
+%D same algorithm when it wants to interpret the source. We
+%D strongly recommend not to mention this feature in manuals! It's
+%D provided for users who are hooked to such a mechanism.
+%D
+%D \starttyping
+%D \setupsorting[logo][next=\autoinsertnextspace] \logo[TEX]{\TeX}
+%D
+%D bla bla \TEX bla bla \TEX (bla) bla (\TEX)
+%D \stoptyping
+
+\def\autoinsertnextspace{\futurelet\nexttoken\doautoinsertnextspace}
+
+\def\doautoinsertnextspace % slightly extended version of a user supplied macro
+ {\ifx\nexttoken \bgroup\else \ifx\nexttoken\begingroup\else
+ \ifx\nexttoken \egroup\else \ifx\nexttoken \endgroup\else
+ \ifx\nexttoken \/\else \ifx\nexttoken /\else \ifx\nexttoken ~\else
+ \ifx\nexttoken \ \else \ifx\nexttoken \blankspace\else \ifx\nexttoken \space\else
+ \ifx\nexttoken .\else \ifx\nexttoken ,\else
+ \ifx\nexttoken !\else \ifx\nexttoken ?\else
+ \ifx\nexttoken :\else \ifx\nexttoken ;\else
+ \ifx\nexttoken '\else \ifx\nexttoken "\else
+ \ifx\nexttoken )\else \ifx\nexttoken -\else \ifx\nexttoken |\else
+ \ifx\nexttoken \%\else \ifx\nexttoken \&\else
+ \space
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+
\setupwhitespace
[\v!none]
+% still old-fachioned
+
\indenting
[\v!never]