%D \module %D [ file=spac-ali, %D version=2009.10.16, % 1997.03.31, was core-spa.tex %D title=\CONTEXT\ Spacing Macros, %D subtitle=Alignments, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \writestatus{loading}{ConTeXt Spacing Macros / Alignments} \unprotect \registerctxluafile{spac-ali}{1.001} \definesystemattribute[realign] [public] % might be combined with the next one \definesystemattribute[alignstate][public] % will make a single attributes for several states \unexpanded\def\resetrealignsignal{\attribute\realignattribute\attributeunsetvalue} \unexpanded\def\signalinnerrealign{\ctxcommand{setrealign(2)}} \unexpanded\def\signalouterrealign{\ctxcommand{setrealign(1)}} \appendtoks \resetrealignsignal \to \everyforgetall % We will not use bodydir and pagedir so we disable them. That way we get % normal hyperlink support. \let\@@bodydir\normalbodydir \let\@@pagedir\normalpagedir \unexpanded\def\bodydir{\afterassignment\do@@bodydir\@@bodydir} \let\normalbodydir\bodydir \unexpanded\def\pagedir{\afterassignment\do@@pagedir\@@pagedir} \let\normalpagedir\pagedir \def\do@@bodydir{\@@bodydir TLT\relax} \def\do@@pagedir{\@@pagedir TLT\relax} % This will become a more advanced layout controller soon: \newconditional\layoutlefttoright \settrue\layoutlefttoright \newconditional\displaylefttoright \settrue\displaylefttoright \newconditional\inlinelefttoright \settrue\inlinelefttoright \unexpanded\def\lefttoright {\ifvmode \settrue\displaylefttoright \settrue\inlinelefttoright \textdir TLT\relax \pardir TLT\relax \else \settrue\inlinelefttoright \textdir TLT\relax \fi} \unexpanded\def\righttoleft {\ifvmode \setfalse\displaylefttoright \setfalse\inlinelefttoright \textdir TRT\relax \pardir TRT\relax \else \textdir TRT\relax \setfalse\inlinelefttoright \fi} \def\currentdirectionparameters {\ifconditional\inlinelefttoright \else idir="r2l", \fi \ifconditional\displaylefttoright \else ddir="r2l", \fi} \unexpanded\def\synchronizelayoutdirection {\ifconditional\layoutlefttoright \settrue\inlinelefttoright \textdir TLT\relax \pardir TLT\relax \else \setfalse\inlinelefttoright \textdir TRT\relax \pardir TRT\relax \fi} \unexpanded\def\synchronizedisplaydirection {\ifconditional\displaylefttoright \settrue\inlinelefttoright \textdir TLT\relax \pardir TLT\relax \else \setfalse\inlinelefttoright \textdir TRT\relax \pardir TRT\relax \fi} \unexpanded\def\synchronizeinlinedirection {\ifconditional\inlinelefttoright \textdir TLT\relax \else \textdir TRT\relax \fi} \unexpanded\def\showdirections {\dontleavehmode \begingroup\infofont\textdir TLT[\space layout:\ifconditional \layoutlefttoright l2r\else r2l\fi\space display:\ifconditional\displaylefttoright l2r\else r2l\fi\space inline:\ifconditional \inlinelefttoright l2r\else r2l\fi\space ]\endgroup} \def\dodefinehbox[#1][#2]% {\setvalue{hbox#1}##1{\hbox to #2{\begstrut##1\endstrut\hss}}} \unexpanded\def\definehbox {\dodoubleargument\dodefinehbox} % To be redone: \unexpanded\def\ibox#1#2#3% {\vbox\bgroup \forgetall \let\\=\endgraf \ifdoublesided\signalinnerrealign\fi \doifrightpageelse\raggedright\raggedleft \let\next} \unexpanded\def\obox#1#2#3% {\vbox\bgroup \forgetall \let\\=\endgraf \ifdoublesided\signalouterrealign\fi \doifrightpageelse\raggedleft\raggedright \let\next} \def\@@ragged@@command{@@ragged@@c} \def\@@ragged@@hbox {@@ragged@@h} \def\@@ragged@@vbox {@@ragged@@v} \def\dosetraggedvbox#1% can be more keys {\let\raggedbox\vbox \processcommacommand[#1]\dodosetraggedvbox} \def\dosetraggedhbox#1% can be more keys {\let\raggedbox\hbox \processcommacommand[#1]\dodosetraggedhbox} \def\dodosetraggedvbox#1% {\ifcsname\@@ragged@@vbox#1\endcsname \csname\@@ragged@@vbox#1\endcsname \quitcommalist \fi} \def\dodosetraggedhbox#1% {\ifcsname\@@ragged@@hbox#1\endcsname \csname\@@ragged@@hbox#1\endcsname \quitcommalist \fi} \setvalue{\@@ragged@@vbox\v!left }{\let\raggedbox\lbox} \setvalue{\@@ragged@@vbox\v!right }{\let\raggedbox\rbox} \setvalue{\@@ragged@@vbox\v!middle }{\let\raggedbox\cbox} \setvalue{\@@ragged@@vbox\v!inner }{\let\raggedbox\ibox} \setvalue{\@@ragged@@vbox\v!outer }{\let\raggedbox\obox} \setvalue{\@@ragged@@vbox\v!flushleft }{\let\raggedbox\rbox} \setvalue{\@@ragged@@vbox\v!flushright}{\let\raggedbox\lbox} \setvalue{\@@ragged@@vbox\v!center }{\let\raggedbox\cbox} \setvalue{\@@ragged@@vbox\v!no }{\def\raggedbox{\vbox\bgroup\raggedright\let\next=}]} \setvalue{\@@ragged@@hbox\v!left }{\def\raggedbox{\doalignedline\v!left }} \setvalue{\@@ragged@@hbox\v!right }{\def\raggedbox{\doalignedline\v!right }} \setvalue{\@@ragged@@hbox\v!middle }{\def\raggedbox{\doalignedline\v!middle}} \setvalue{\@@ragged@@hbox\v!inner }{\def\raggedbox{\doalignedline\v!inner }} \setvalue{\@@ragged@@hbox\v!outer }{\def\raggedbox{\doalignedline\v!outer }} \setvalue{\@@ragged@@hbox\v!flushleft }{\def\raggedbox{\doalignedline\v!right }} \setvalue{\@@ragged@@hbox\v!flushright}{\def\raggedbox{\doalignedline\v!left }} \setvalue{\@@ragged@@hbox\v!center }{\def\raggedbox{\doalignedline\v!middle}} \newtoks\everyraggedcommand \def\raggedcommand{\the\everyraggedcommand} % slow, we can do this in lua ... some day \let\raggedbox\relax % pretty slow (will be sped up) \newconstant\ragged_command_h_align_state \newconstant\ragged_command_v_align_state \newconstant\ragged_command_broad_state \ifdefined\raggedonelinerstate \else \newconditional\raggedonelinerstate \fi % public % \unexpanded\def\dosetraggedcommand#1% beware: #1=empty is ignored, keep that! assumes \forgetall % {\edef\askedraggedalign{#1}% % \ifx\askedraggedalign\empty % \nonosetraggedcommand % \else % \dodosetraggedcommand % \fi} % % \def\nonosetraggedcommand % {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty % \let\raggedtopcommand\empty % \let\raggedbottomcommand\empty % \let\raggedbox\relax % \setfalse\raggedonelinerstate} % % \def\dodosetraggedcommand % beware: #1=empty is ignored, keep that! % {\everyraggedcommand{\resetrealignsignal}% \emptytoks maybe only when #1 <> empty % \let\raggedtopcommand\empty % \let\raggedbottomcommand\empty % \let\raggedbox\relax % \setfalse\raggedonelinerstate % \ifcsname\@@ragged@@command\askedraggedalign\endcsname % fast for one keyword and special table case % \!!doneafalse % \!!donebfalse % \!!donectrue % \csname\@@ragged@@command\askedraggedalign\endcsname % \else % \doifinsetelse\v!broad\askedraggedalign\!!doneatrue\!!doneafalse % \doifinsetelse\v!wide \askedraggedalign\!!donebtrue\!!donebfalse % \!!donectrue % \rawprocesscommacommand[\askedraggedalign]\dododosetraggedcommand % \fi} % happens a lot: {\flushleft,broad,high} \veryraggedright\let\raggedbottomcommand\vfilll \unexpanded\def\dosetraggedcommand#1% beware: #1=empty is ignored, keep that! assumes \forgetall {\edef\askedraggedalign{#1}% \ifx\askedraggedalign\empty \nonosetraggedcommand \else \dodosetraggedcommand \fi} \def\dodosetraggedcommand {\let\raggedtopcommand\empty \let\raggedbottomcommand\empty \let\raggedbox\relax \setfalse\raggedonelinerstate \everyraggedcommand\emptytoks \ragged_command_broad_state \zerocount \ragged_command_h_align_state\zerocount \ragged_command_v_align_state\zerocount \ifcsname\@@ragged@@command\askedraggedalign\endcsname \csname\@@ragged@@command\askedraggedalign\endcsname \else \rawprocesscommacommand[\askedraggedalign]\dododosetraggedcommand \fi \normalexpanded{\everyraggedcommand\expandafter{\expandafter\resetrealignsignal\the\everyraggedcommand\ragged_command_flush_align}}} \def\nonosetraggedcommand {\let\raggedtopcommand\empty \let\raggedbottomcommand\empty \let\raggedbox\relax \setfalse\raggedonelinerstate \everyraggedcommand{\resetrealignsignal}} \def\dododosetraggedcommand#1% {\csname\@@ragged@@command#1\endcsname} \unexpanded\def\ragged_command_tolerant {\tolerance3000\relax} \unexpanded\def\ragged_command_very_tolerant{\tolerance4500\relax} \unexpanded\def\ragged_command_stretch {\emergencystretch\bodyfontsize} \def\ragged_command_flush_align {\ifcase\ragged_command_h_align_state % 0 \notragged \or % 1 center \ifcase\ragged_command_broad_state \raggedcenter \or \veryraggedcenter \or \raggedwidecenter \fi \or % 2 flush left \ifcase\ragged_command_broad_state \raggedright \else \veryraggedright \fi \or % 3 flush right \ifcase\ragged_command_broad_state \raggedleft \else \veryraggedleft \fi \or % 4 inner \ifdoublesided \signalinnerrealign \fi \rightorleftpageaction\raggedright\raggedleft \or % 5 outer \ifdoublesided \signalouterrealign \fi \rightorleftpageaction\raggedleft\raggedright \or % 6 oneliner \ifcase\ragged_command_broad_state \raggedright \else \veryraggedright \fi \parfillskip\zeropoint \or % 7 centered last line \centeredlastline \fi} \setvalue{\@@ragged@@command\v!broad }{\ragged_command_broad_state\plusone} % was donea \setvalue{\@@ragged@@command\v!wide }{\ragged_command_broad_state\plustwo} % was doneb \setvalue{\@@ragged@@command\v!hanging }{\everyraggedcommand\expandafter{\the\everyraggedcommand\enableprotruding}} \setvalue{\@@ragged@@command\v!nothanging }{\everyraggedcommand\expandafter{\the\everyraggedcommand\disableprotruding}} \setvalue{\@@ragged@@command\v!hz }{\everyraggedcommand\expandafter{\the\everyraggedcommand\enableadjusting}} \setvalue{\@@ragged@@command\v!nohz }{\everyraggedcommand\expandafter{\the\everyraggedcommand\disableadjusting}} %setvalue{\@@ragged@@command\v!spacing }{\everyraggedcommand\expandafter{\the\everyraggedcommand\enablespacehandling\enablekernhandling}} %setvalue{\@@ragged@@command\v!nospacing }{\everyraggedcommand\expandafter{\the\everyraggedcommand\disablespacehandling\disablekernhandling}} \setvalue{\@@ragged@@command\v!hyphenated }{\everyraggedcommand\expandafter{\the\everyraggedcommand\dohyphens}} \setvalue{\@@ragged@@command\v!nothyphenated }{\everyraggedcommand\expandafter{\the\everyraggedcommand\nohyphens}} \setvalue{\@@ragged@@command\v!tolerant }{\everyraggedcommand\expandafter{\the\everyraggedcommand\ragged_command_tolerant}} \setvalue{\@@ragged@@command\v!verytolerant }{\everyraggedcommand\expandafter{\the\everyraggedcommand\ragged_command_very_tolerant}} \setvalue{\@@ragged@@command\v!stretch }{\everyraggedcommand\expandafter{\the\everyraggedcommand\ragged_command_stretch}} \setvalue{\@@ragged@@command\v!flushright }{\ragged_command_h_align_state\plusthree} \setvalue{\@@ragged@@command\v!flushleft }{\ragged_command_h_align_state\plustwo} \setvalue{\@@ragged@@command\v!middle }{\ragged_command_h_align_state\plusone} \setvalue{\@@ragged@@command\v!no }{\ragged_command_h_align_state\plustwo} \setvalue{\@@ragged@@command\v!yes }{\ragged_command_h_align_state\zerocount} \setvalue{\@@ragged@@command\v!normal }{\ragged_command_h_align_state\zerocount} \setvalue{\@@ragged@@command\v!inner }{\ragged_command_h_align_state\plusfour} \setvalue{\@@ragged@@command\v!outer }{\ragged_command_h_align_state\plusfive} \setvalue{\@@ragged@@command\v!right }{\ragged_command_h_align_state\plustwo} \setvalue{\@@ragged@@command\v!left }{\ragged_command_h_align_state\plusthree} \setvalue{\@@ragged@@command\v!center }{\ragged_command_h_align_state\plusone} \setvalue{\@@ragged@@command\v!disable }{\ragged_command_h_align_state\plussix} \setvalue{\@@ragged@@command\v!last }{\ragged_command_h_align_state\plusseven} \setvalue{\@@ragged@@command\v!line }{\settrue\raggedonelinerstate} \setvalue{\@@ragged@@command\v!high }{\let\raggedbottomcommand\vfilll} % and since we lack a \setvalue{\@@ragged@@command\v!low }{\let\raggedtopcommand \vfilll} % proper keyword, but \setvalue{\@@ragged@@command\v!lohi }{\let\raggedbottomcommand\vfilll\let\raggedtopcommand\vfilll} % we do support the ugly laho (lohi) \setvalue{\@@ragged@@command\v!lesshyphenation}{\everyraggedcommand\expandafter{\the\everyraggedcommand\lesshyphens}} \setvalue{\@@ragged@@command\v!morehyphenation}{\everyraggedcommand\expandafter{\the\everyraggedcommand\morehyphens}} \setvalue{\@@ragged@@command\v!lefttoright }{\everyraggedcommand\expandafter{\the\everyraggedcommand\lefttoright}} \setvalue{\@@ragged@@command\v!righttoleft }{\everyraggedcommand\expandafter{\the\everyraggedcommand\righttoleft}} \setvalue{\@@ragged@@command l2r}{\everyraggedcommand\expandafter{\the\everyraggedcommand\lefttoright}} \setvalue{\@@ragged@@command r2l}{\everyraggedcommand\expandafter{\the\everyraggedcommand\righttoleft}} \setvalue{\@@ragged@@command\v!table }{\let\raggedbottomcommand\vfilll \ragged_command_broad_state\plusone \ragged_command_h_align_state\plustwo} % compare: % % \framed[width=4cm,align=no] {\hfil xxx} % \framed[width=4cm,align=disable]{\hfil xxx} % More alignments: % \hyphenpenalty = ( 2.5 * \hsize ) / \raggedness % \tolerance >= 1500 % was 200 % \raggedness = 2 .. 6\bodyfontsize \newconstant\raggedstatus % normal left center right % \unexpanded\def\setalignstateattribute % unexpanded ! % {\attribute\alignstateattribute\ifcase\raggedstatus\attributeunsetvalue\else\raggedstatus\fi} \def\leftraggedness {2\bodyfontsize} \def\rightraggedness {2\bodyfontsize} \def\middleraggedness {6\bodyfontsize} \def\middleraggedness {.5\hsize} % was: 6\bodyfontsize, fails on: \placefigure{x $x=x$ x}{} % oeps, hsize can be 0pt in which case we get a strange division \def\middleraggedness {\ifdim\hsize=\zeropoint6\bodyfontsize\else.5\hsize\fi} % was: 6\bodyfontsize, fails on: \placefigure{x $x=x$ x}{} %D More hyphenation control, will be combined with align %D setup. \unexpanded\def\nohyphens % % % % % not clever, we still hyphenate but supress application {\ifx\dohyphens\relax \edef\dohyphens {\hyphenpenalty\the\hyphenpenalty \exhyphenpenalty\the\exhyphenpenalty\relax}% \fi \hyphenpenalty\plustenthousand \exhyphenpenalty\plustenthousand} \let\dohyphens\relax %D To prevent unwanted side effects, we also have to check %D for hyphens here: \newskip\@@raggedskipa \newskip\@@raggedskipb \unexpanded\def\setraggedness#1% {\ifnum\tolerance<1500\relax % small values have \tolerance1500\relax % unwanted side effects \fi \ifx\dohyphens\relax % this code will be reconsidered / kind of fuzzy (and old) \@@raggedskipa 2.5\hsize \@@raggedskipb #1\relax \divide\@@raggedskipa \@@raggedskipb \hyphenpenalty\@@raggedskipa \fi} \let\updateraggedskips\relax \unexpanded\def\setraggedskips#1#2#3#4#5#6#7% never change this name (todo: inline this one .. less tracingall) {\unexpanded\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% \updateraggedskips} \def\dosetraggedskips#1#2#3#4#5#6#7% {\raggedstatus#1\relax \attribute\alignstateattribute\ifcase\raggedstatus\attributeunsetvalue\else\raggedstatus\fi \leftskip 1\leftskip \!!plus#2\relax % zie: Tex By Topic 8.1.3 \rightskip 1\rightskip\!!plus#3\relax % zie: Tex By Topic 8.1.3 \spaceskip #4\relax \xspaceskip #5\relax \parfillskip\zeropoint\!!plus#6\relax \parindent #7\relax} \appendtoks \attribute\alignstateattribute\attributeunsetvalue \to \everyforgetall % \def\notragged% % {\setraggedskips{0}{0em}{0em}{0em}{0em}{1fil}{\parindent}} % older (context) names: \let\spaceamount \interwordspace \let\emspaceamount\emwidth % tracing: \def\doshowpardata#1% {\ifx#1\relax\else \hbox{\string#1: \the#1}\endgraf \expandafter\doshowpardata \fi} \unexpanded\def\showpardata {\edef\thepardata {\hbox{font: \fontname\font}\endgraf \doshowpardata \interwordspace \interwordstretch \interwordshrink \emwidth \exheight \extraspace \hsize \vsize \leftskip \rightskip \spaceskip \xspaceskip \parindent \parfillskip \hyphenpenalty \exhyphenpenalty \displaywidowpenalty \widowpenalty \clubpenalty \brokenpenalty \doublehyphendemerits \finalhyphendemerits \adjdemerits \relax}% \begingroup \dontshowcomposition \inleftmargin{\vsmash {\infofont \framed[\c!align=\v!right]{\thepardata}}}% \endgroup} \unexpanded\def\startshowpardata {\begingroup \showcomposition \showstruts\tracepositionstrue \tracingparagraphs\maxdimen \appendtoksonce\showpardata\let\showpardata\relax\to\everypar} \unexpanded\def\stopshowpardata {\endgraf \endgroup} % defaults \def\raggedfillamount {1fil} \def\raggednegativefillamount{-1fil} \def\raggeddoublefillamount {2fil} \def\raggedhalffillamount {.5fil} \def\raggedspaceamount {\interwordspace} % {.3333em} \def\raggedxspaceamount {.5em} \unexpanded\def\notragged {\raggedstatus\zerocount \leftskip 1\leftskip \rightskip 1\rightskip \spaceskip \zeropoint \xspaceskip \zeropoint \parfillskip\zeropoint\!!plus\raggedfillamount\relax \let\updateraggedskips\relax} % new \let\forgetragged\notragged \unexpanded\def\raggedleft {\setraggedness\leftraggedness \setraggedskips1\leftraggedness\zeropoint\raggedspaceamount \raggedxspaceamount\zeropoint\zeropoint} \unexpanded\def\raggedcenter {\setraggedness\middleraggedness \setraggedskips2\middleraggedness\middleraggedness\raggedspaceamount \raggedxspaceamount\zeropoint\zeropoint} \unexpanded\def\centeredlastline {\setraggedskips \zerocount \raggedfillamount \raggednegativefillamount \zeropoint \zeropoint \raggeddoublefillamount \zeropoint} %D We used to have: %D %D \starttyping %D \def\raggedright %D {\setraggedness\rightraggedness %D \setraggedskips{3}{0em}{\rightraggedness}{.3333em}{.5em}{0em}{\parindent}} %D \stoptyping %D %D However, the next alternative, suggested by Taco, is better. \unexpanded\def\raggedright {\setraggedness\rightraggedness \setraggedskips3\zeropoint\rightraggedness\raggedspaceamount \raggedxspaceamount\raggedfillamount\parindent} \unexpanded\def\veryraggedleft {\setraggedskips1\raggedfillamount\zeropoint\raggedspaceamount \raggedxspaceamount\zeropoint\zeropoint} %D When we want the last line to have a natural width: %D %D \starttyping %D \def\veryraggedleft% %D {\setraggedskips{1}{1fil}{0em}{.3333em}{.5em}{0em}{-1fil}} %D \stoptyping %D %D but this one is not accepted by the macros. \unexpanded\def\veryraggedcenter {\setraggedskips2\raggedfillamount\raggedfillamount\raggedspaceamount \raggedxspaceamount\zeropoint\zeropoint} \unexpanded\def\veryraggedright {\setraggedskips3\zeropoint\raggedfillamount\raggedspaceamount \raggedxspaceamount\zeropoint\parindent} \unexpanded\def\ttraggedright {\tttf \setraggedskips3\zeropoint\rightraggedness \zeropoint\zeropoint\zeropoint\parindent} % \ctxparindent %D A bonus one: \unexpanded\def\raggedwidecenter {\setraggedness\middleraggedness \setraggedskips2\raggedhalffillamount\raggedhalffillamount \raggedspaceamount\raggedxspaceamount\zeropoint\zeropoint} \newif\if@@asragged \@@asraggedtrue % old method % todo % % \setuplayout[grid=yes,lines=44] \showgrid % \starttext % test \vfill test \endgraf \strut \endgraf \vskip-\lineheight \removedepth \pagina test % \stoptext % \setupalign[reset,new,right,old] \def\@@align@@rl{\if!!donea\veryraggedleft \else\raggedleft \fi} \def\@@align@@rr{\if!!donea\veryraggedright \else\raggedright \fi} \def\@@align@@rc{\if!!donea\veryraggedcenter\else\raggedcenter\fi} \setvalue{@@ngila@@\v!broad }{\!!doneatrue} \setvalue{@@ngila@@\v!wide }{\!!donebtrue} \unexpanded\def\setraggedparagraphmode {\doifrightpageelse {\ifdoublesided\signalinnerrealign\expandafter\firstoftwoarguments \fi} {\ifdoublesided\signalouterrealign\expandafter\secondoftwoarguments\fi}} \unexpanded\def\installalign#1#2{\setvalue{@@align@@#1}{#2}} % can be used for overloads \installalign \v!new {\@@asraggedfalse} \installalign \v!old {\@@asraggedtrue} \installalign \empty {} \installalign \v!line {\baselinebottom} \installalign \v!bottom {\raggedbottom} \installalign \v!height {\normalbottom} \installalign \v!width {\notragged} \installalign \v!normal {\notragged} \installalign \v!yes {\notragged} \installalign \v!no {\raggedright} \installalign \v!inner {\if@@asragged \setraggedparagraphmode\@@align@@rl\@@align@@rr \else \setraggedparagraphmode\@@align@@rr\@@align@@rl \fi} \installalign \v!outer {\if@@asragged \setraggedparagraphmode\@@align@@rr\@@align@@rl \else \setraggedparagraphmode\@@align@@rl\@@align@@rr \fi} \installalign \v!left {\if@@asragged\@@align@@rl\else\@@align@@rr\fi} \installalign \v!right {\if@@asragged\@@align@@rr\else\@@align@@rl\fi} \installalign \v!middle {\if!!doneb\raggedwidecenter\else\@@align@@rc\fi} \installalign \v!flushleft {\if!!donea\veryraggedright \else\raggedright\fi} \installalign \v!flushright {\if!!donea\veryraggedleft \else\raggedleft \fi} \installalign \v!flushouter {\setraggedparagraphmode\raggedleft\raggedright} \installalign \v!flushinner {\setraggedparagraphmode\raggedright\raggedleft} \installalign \v!center {\if!!doneb\raggedwidecenter\else\@@align@@rc\fi} \installalign \v!hanging {\enableprotruding} \installalign \v!nothanging {\disableprotruding} \installalign \v!hz {\enableadjusting} \installalign \v!nohz {\disableadjusting} \installalign \v!spacing {\enablespacehandling \enablekernhandling} \installalign \v!nospacing {\disablespacehandling\disablekernhandling} \installalign \v!hyphenated {\dohyphens} \installalign \v!nothyphenated {\nohyphens} \installalign \v!new {\@@asraggedfalse} % so new will give you consistency \installalign \v!reset {\notragged\normalbottom} \installalign \v!tolerant {\tolerance3000\relax} \installalign \v!verytolerant {\tolerance4500\relax} \installalign \v!stretch {\emergencystretch\bodyfontsize} \installalign \v!righttoleft {\lefttoright} \installalign \v!lefttoright {\righttoleft} \installalign {l2r} {\lefttoright} \installalign {r2l} {\righttoleft} \installalign \v!last {\centeredlastline} \newcount\hyphenminoffset \ifx\sethyphenationvariables\undefined \let\sethyphenationvariables\relax \fi \unexpanded\def\lesshyphens {\advance\hyphenminoffset\plusone \sethyphenationvariables} \unexpanded\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} \unexpanded\def\setupalign {\dosingleargument\dosetupalign} \def\dosetupalign[#1]% can be made faster by checking for defined #1 {\!!doneafalse \!!donebfalse \raggedstatus\zerocount \resetrealignsignal \processcommacommand[#1]\dodosetupngila \processcommacommand[#1]\dodosetupalign} % \setupalign[flushleft] \input ward \par % lijnlinks % \setupalign[right] \input ward \par % \setupalign[flushright] \input ward \par % lijnrechts % \setupalign[left] \input ward \par % \setupalign[middle] \input ward \par % centreer % \setupalign[center] \input ward \par \unexpanded\def\startalignment {\bgroup \setupalign} \unexpanded\def\stopalignment {\par \egroup} \setnewconstant\alignstrutmode\plusone % see later for the real definition, which in the simple case is: \newtoks \everyleftofalignedline \newtoks \everyrightofalignedline \unexpanded\def\shiftalignedline#1#2#3#4% left, right, inner, outer {\rightorleftpageaction {\everyleftofalignedline {\hskip\dimexpr#1+#3\relax}% \everyrightofalignedline{\hskip\dimexpr#2+#4\relax}} {\everyleftofalignedline {\hskip\dimexpr#1+#4\relax}% \everyrightofalignedline{\hskip\dimexpr#2+#3\relax}}} \def\doalignline#1#2% \\ == newline {\noindentation % was \noindent \dontleavehmode % added in marrakesch at TUG 2006\begingroup \begingroup \setlocalhsize % new \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}% \dowithnextbox {\hbox to \localhsize {\ifcase\alignstrutmode\or\strut\fi \the\everyleftofalignedline #1\unhbox\nextbox#2\relax \the\everyrightofalignedline}% \endgroup} \hbox} % plain commands \ifdefined\line \else \def\line {\hbox to\hsize} \fi \ifdefined\leftline \else \def\leftline #1{\line{#1\hss}} \fi \ifdefined\rightline \else \def\rightline #1{\line{\hss#1}} \fi \ifdefined\centerline \else \def\centerline#1{\line{\hss#1\hss}} \fi % directe commando's \unexpanded\def\leftaligned {\doalignline \relax \hss } \unexpanded\def\midaligned {\doalignline \hss \hss } \unexpanded\def\rightaligned{\doalignline \hss \relax} \unexpanded\def\maxaligned {\doalignline \relax \relax} \let\centeraligned\midaligned % \def\regelbegrensd#1{\limitatetext{#1}{\hsize}{\unknown}} % to be translated % indirecte commando's \letvalue{\s!do\v!line\v!left }\leftaligned \letvalue{\s!do\v!line\v!right }\rightaligned \letvalue{\s!do\v!line\v!middle }\midaligned \letvalue{\s!do\v!line\v!flushleft }\rightaligned \letvalue{\s!do\v!line\v!flushright}\leftaligned \letvalue{\s!do\v!line\v!center }\midaligned \letvalue{\s!do\v!line\v!max }\maxaligned \def\doalignedline#1{\resetrealignsignal\csname\s!do\v!line#1\endcsname} %D Experimental (will be redone when floats are redone as it's real messy %D now). It can also be made faster (if needed). \def\doxalignline#1#2#3#4#5#6% {\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 moved up \hbox to \localhsize {#1\hskip\ifdone#2\else#3\fi#4% \hbox to \localhsize {\the\everyleftofalignedline \ifcase\alignstrutmode\or\strut\fi \ifdone#5\unhbox\nextbox#6\else#6\unhbox\nextbox#5\fi \the\everyrightofalignedline}% \hss}% \endgroup} \hbox} \def\doxcheckline % used for floats so multipass anyway {\signalrightpage\doifrightpageelse\donetrue\donefalse} \setvalue{\s!do\v!line\v!inner }{\doxalignline\doxcheckline++\zeropoint \relax\hss } \setvalue{\s!do\v!line\v!outer }{\doxalignline\doxcheckline++\zeropoint \hss \relax} \setvalue{\s!do\v!line\v!innermargin}{\doxalignline\doxcheckline-+\innermargintotal\relax\hss } \setvalue{\s!do\v!line\v!outermargin}{\doxalignline\doxcheckline+-\outermargintotal\hss \relax} \setvalue{\s!do\v!line\v!inneredge }{\doxalignline\doxcheckline-+\inneredgetotal \relax\hss } \setvalue{\s!do\v!line\v!outeredge }{\doxalignline\doxcheckline+-\outeredgetotal \hss \relax} \setvalue{\s!do\v!line\v!backspace }{\doxalignline\doxcheckline-+\backspace \relax\hss } \setvalue{\s!do\v!line\v!cutspace }{\doxalignline\doxcheckline+-\cutspace \hss \relax} \setvalue{\s!do\v!line\v!leftmargin }{\doxalignline\donefalse --\leftmargintotal \hss \relax} \setvalue{\s!do\v!line\v!rightmargin}{\doxalignline\donefalse ++\rightmargintotal\relax\hss } \setvalue{\s!do\v!line\v!leftedge }{\doxalignline\donefalse --\leftedgetotal \hss \relax} \setvalue{\s!do\v!line\v!rightedge }{\doxalignline\donefalse ++\rightedgetotal \relax\hss } % ! ! ! beware, redefining \doalignline gives the wrong results ! ! ! % % \def\doalignline{\doxalignline\donefalse++\zeropoint} %D Better: \def\doalignedline#1{\csname\s!do\v!line#1\endcsname} \def\alignedline#1#2% setting default {\csname\s!do\v!line\ifcsname\s!do\v!line#1\endcsname#1\else#2\fi\endcsname} % beware: \wordright{whatever\kern-\rightskip} should work! % so, no funny boxing here \def\dowordright[#1]% {% don't change \groupedcommand {\removeunwantedspaces \hfill \allowbreak % changed back from \hskip\zeropoint \strut \hfill \quad % decent spacing \hbox} {\doifelse{#1}\v!right{\kern-\rightskip}{\doifsomething{#1}{\kern-#1}}% \parfillskip\zeropoint \finalhyphendemerits\zerocount % yes or no (see hyhenation/specialcases-001.tex) \par}} \unexpanded\def\wordright {\dosingleempty\dowordright} % \dorecurse{5}{something } \wordright{--someone} \endgraf % \dorecurse{6}{something } \wordright{--someone} \endgraf % \dorecurse{7}{something } \wordright{--someone} \endgraf % % \dorecurse{5}{something } \wordright{--someone else entirely} \endgraf % \dorecurse{6}{something } \wordright{--someone else entirely} \endgraf % \dorecurse{7}{something } \wordright{--someone else entirely} \endgraf % % \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}} % \unexpanded\def\simplealignedbox#1% % {\csname\s!simple\c!align\ifcsname\s!simple\c!align#1\endcsname#1\else\v!right\fi\endcsname} \setvalue{\s!simple:\c!align:\v!right }#1{{#1\hss}} \setvalue{\s!simple:\c!align:\v!left }#1{{\hss#1}} \setvalue{\s!simple:\c!align:\v!flushright }#1{{\hss#1}} \setvalue{\s!simple:\c!align:\v!flushleft }#1{{#1\hss}} \setvalue{\s!simple:\c!align:\v!middle }#1{{\hss#1\hss}} \unexpanded\def\simplealignedbox#1#2% {\hbox to #1\csname\s!simple:\c!align:\ifcsname\s!simple:\c!align:#2\endcsname#2\else\v!right\fi\endcsname} % \setvalue{spac_align_set_ss_\v!right }#1#2{\let#1\relax\let#2\hss } % \setvalue{spac_align_set_ss_\v!left }#1#2{\let#1\hss \let#2\relax} % \setvalue{spac_align_set_ss_\v!flushright}#1#2{\let#1\hss \let#2\relax} % \setvalue{spac_align_set_ss_\v!flushleft }#1#2{\let#1\relax\let#2\hss } % \setvalue{spac_align_set_ss_\v!middle }#1#2{\let#1\hss \let#2\hss } % \setvalue{spac_align_set_ss_\v!low }#1#2{\let#1\vss \let#2\relax} % \setvalue{spac_align_set_ss_\v!high }#1#2{\let#1\relax\let#2\vss } % \setvalue{spac_align_set_ss_\v!lohi }#1#2{\let#1\vss \let#2\vss } % \setvalue{spac_align_set_ss_\s!unknown }#1#2{\let#1\relax\let#2\relax} % \unexpanded\def\spac_align_set_ss#1% % {\csname spac_align_set_ss_\ifcsname spac_align_set_ss_#1\endcsname#1\else\s!unknown\fi\endcsname} \protect \endinput