diff options
Diffstat (limited to 'tex/context/base/core-spa.tex')
-rw-r--r-- | tex/context/base/core-spa.tex | 103 |
1 files changed, 90 insertions, 13 deletions
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index d98480248..159624c0d 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -17,6 +17,12 @@ \unprotect +% interfacing mkii/mkiv + +\ifx\mksetupgridsnapping \undefined \let\mksetupgridsnapping \relax \fi +\ifx\mkenablegridsnapping \undefined \let\mkenablegridsnapping \relax \fi +\ifx\mkdisablegridsnapping\undefined \let\mkdisablegridsnapping\relax \fi + % some will move to core-var \newif \ifgridsnapping @@ -1415,6 +1421,16 @@ \def\notoggleindentation {\gdef\checkindentation{\global\indentationtrue\dotoggleindentation}} + +\appendtoks + \pushmacro\checkindentation + \pushmacro\ifindentation +\to \everypushsomestate + +\appendtoks + \popmacro\ifindentation + \popmacro\checkindentation +\to \everypopsomestate % we need to save the state if we want to adapt behaviour to empty lines % @@ -2165,13 +2181,14 @@ \endgroup \fi \normalbaselineskip\openlineheight -\ifgridsnapping\else - \!!plus \baselinegluefactor\openlineheight - \!!minus\baselinegluefactor\openlineheight -\fi + \ifgridsnapping\else + \!!plus \baselinegluefactor\openlineheight + \!!minus\baselinegluefactor\openlineheight + \fi \normallineskip\minimumlinedistance\relax % \onepoint\relax \normallineskiplimit\zeropoint\relax - \normalbaselines} + \normalbaselines + \mksetupgridsnapping} \def\setspacingfactor#1\to#2\by#3\\% {\strutdimen#2\points @@ -2747,7 +2764,10 @@ [ \v!left=>\global\advance\ctxleftskip \@@slleft, \v!middle=>\global\advance\ctxmidskip \@@slmiddle, \v!right=>\global\advance\ctxrightskip \@@slright, - \v!none=>, + \v!reset=>\global\ctxleftskip \zeropoint + \global\ctxmidskip \zeropoint + \global\ctxrightskip\zeropoint, + \v!none=>, \s!unknown=>\global\advance\ctxmidskip \commalistelement]} % \def\donarrower[#1]% hm, can be dorepeat directly @@ -2956,6 +2976,11 @@ {\getvalue{\@@ragged@@command\v!left}} {\getvalue{\@@ragged@@command\v!right}}} +\setvalue{\@@ragged@@command\v!lesshyphenation}% + {\appendtoks\lesshyphens\to\everyraggedcommand} +\setvalue{\@@ragged@@command\v!morehyphenation}% + {\appendtoks\morehyphens\to\everyraggedcommand} + % compare: % % \framed[width=4cm,align=no] {\hfil xxx} @@ -3882,6 +3907,26 @@ \installalign \v!verytolerant {\tolerance4500 \relax} \installalign \v!stretch {\emergencystretch\bodyfontsize} +\installalign \v!grid {\mkenablegridsnapping } % only mkiv +\installalign \v!nogrid {\mkdisablegridsnapping} % only mkiv + +\newcount\hyphenminoffset + +\ifx\sethyphenationvariables\undefined \let\sethyphenationvariables\relax \fi + +\def\lesshyphens + {\advance\hyphenminoffset\plusone + \sethyphenationvariables} + +\def\morehyphens + {\ifcase\hyphenminoffset \else + \advance\hyphenminoffset\minusone + \fi + \sethyphenationvariables} + +\installalign \v!lesshyphenation {\lesshyphens} +\installalign \v!morehyphenation {\morehyphens} + \def\dodosetupalign#1{\csname @@align@@#1\endcsname} \def\dodosetupngila#1{\csname @@ngila@@#1\endcsname} @@ -3918,14 +3963,29 @@ \newtoks \everyleftofalignedline \newtoks \everyrightofalignedline +% \def\doalignline#1#2% \\ == newline +% {\begingroup +% \setlocalhsize % new +% \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}% +% \dowithnextbox +% {\noindentation % was \noindent +% \dontleavehmode % added in marrakesch at TUG 2006 +% \hbox to \localhsize +% {\ifcase\alignstrutmode\or\strut\fi +% \the\everyleftofalignedline +% #1\unhbox\nextbox#2\relax +% \the\everyrightofalignedline}% +% \endgroup} +% \hbox} + \def\doalignline#1#2% \\ == newline - {\begingroup + {\noindentation % was \noindent + \dontleavehmode % added in marrakesch at TUG 2006\begingroup + \begingroup \setlocalhsize % new \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}% \dowithnextbox - {\noindentation % was \ noindent - \dontleavehmode % added in marrakesch at TUG 2006 - \hbox to \localhsize + {\hbox to \localhsize {\ifcase\alignstrutmode\or\strut\fi \the\everyleftofalignedline #1\unhbox\nextbox#2\relax @@ -3974,11 +4034,13 @@ % more extensive: \def\doxalignline#1#2#3#4#5#6% - {\bgroup + {\noindentation % was \noindent + \dontleavehmode % added in marrakesch at TUG 2006\begingroup + \begingroup \setlocalhsize \def\\{\egroup\par\doxalignline#1#2#3#4#5#6\bgroup}% inefficient \dowithnextbox - {\noindent + {%\noindent moved up \hbox to \localhsize {#1\hskip\ifdone#2\else#3\fi#4% \hbox to \localhsize @@ -3987,7 +4049,7 @@ \ifdone#5\unhbox\nextbox#6\else#6\unhbox\nextbox#5\fi \the\everyrightofalignedline}% \hss}% - \egroup} + \endgroup} \hbox} \def\doxcheckline @@ -4064,6 +4126,7 @@ \hbox} {\doifelse{#1}\v!right{\kern-\rightskip}{\doifsomething{#1}{\kern-#1}}% \parfillskip\zeropoint + %\finalhyphendemerits\zerocount % yes or no \par}} \def\wordright @@ -4079,6 +4142,16 @@ % % \wordright[\rightskip]{whatever} +% \simplealignedbox{2cm}{right}{x} + +\setvalue{\s!simple\c!align\v!right }#1#2{\hbox to #1{#2\hss}} +\setvalue{\s!simple\c!align\v!left }#1#2{\hbox to #1{\hss#2}} +\setvalue{\s!simple\c!align\v!flushright }#1#2{\hbox to #1{\hss#2}} +\setvalue{\s!simple\c!align\v!flushleft }#1#2{\hbox to #1{#2\hss}} +\setvalue{\s!simple\c!align\v!middle }#1#2{\hbox to #1{\hss#2\hss}} + +\def\simplealignedbox#1{\executeifdefined{\s!simple\c!align#1}{\getvalue{\s!simple\c!align\v!right}}} + %D \macros %D {pushindentation,popindentation} %D @@ -4641,6 +4714,10 @@ \space \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +% plugins + +\loadmarkfile{core-spa} + \setupwhitespace [\v!none] |