diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-spr.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/page-spr.mkiv | 90 |
1 files changed, 59 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-spr.mkiv b/Master/texmf-dist/tex/context/base/page-spr.mkiv index f4768d4e95a..dc1e013d50d 100644 --- a/Master/texmf-dist/tex/context/base/page-spr.mkiv +++ b/Master/texmf-dist/tex/context/base/page-spr.mkiv @@ -17,10 +17,9 @@ \unprotect -\newbox\spreadbox -\newif \ifinspread - -\setnewconstant\showspreadmode\plusone +\newbox \b_page_spread_content +\newconditional\c_page_spread_busy +\newconditional\c_page_spread_once % when true only one flush (writes etc) % beware, ugly overload, to be redone @@ -35,52 +34,81 @@ \noindent % content can be < \hsize \page_otr_command_package_contents#2#3}}% \dp#1\zeropoint - \setbox#1\hbox to \makeupwidth - {\ifinspread - \ifvoid\spreadbox - \global\setbox\spreadbox\box#1% - \copy\spreadbox\hss % left page + \ifconditional\c_page_spread_busy + \normalsettextpagecontent_spread{#1}% + \else + \normalsettextpagecontent_normal{#1}% + \fi} + +\def\normalsettextpagecontent_normal#1% + {\setbox#1\hbox to \makeupwidth + {\hss\box#1\hss}} % never change the \hss's + +\def\normalsettextpagecontent_spread#1% + {\setbox#1\hbox to \makeupwidth + {\ifvoid\b_page_spread_content + \ifconditional\c_page_spread_once + \box#1% \else - % prevent duplicate writes in normal run - \ifarrangingpages \else \ifcase\showspreadmode - \global\setbox\spreadbox\emptyhbox - \wd\spreadbox\makeupwidth - \ht\spreadbox\textheight - \fi \fi - \hss\box\spreadbox % right page + \global\setbox\b_page_spread_content\box#1% + \copy\b_page_spread_content \fi + \hss % left page \else - \hss\box#1\hss % never change the \hss's + \hss % right page + \ifarrangingpages + % writes don't matter anyway + \else\ifconditional\c_page_spread_once + \global\setbox\b_page_spread_content\emptyhbox + \wd\b_page_spread_content\makeupwidth + \ht\b_page_spread_content\textheight + \else + % writes can interfere (todo: write stripper, but how about hyperlinks) + \fi \fi + \box\b_page_spread_content \fi}} -\def\doflushspread - {\ifinspread \ifvoid\spreadbox\else +\unexpanded\def\page_spread_flush + {\ifconditional\c_page_spread_busy \ifvoid\b_page_spread_content\else % this page will be discarded later \emptyhbox \page \fi \fi } \unexpanded\def\startspread - {\bgroup - \ifdoublesided - \page[\v!left]% - %\setsystemmode{spread}% - \inspreadtrue - \expanded{\setuplayout[\c!textwidth=\the\dimexpr2\textwidth+2\backspace\relax]}% - \unexpanded\def\startspread{\bgroup\let\stopspread\egroup}% - \let\stopspread\dostopspread + {\ifdoublesided + \ifconditional\c_page_spread_busy + \doubleexpandafter\page_spread_start_nop + \else + \doubleexpandafter\page_spread_start_yes + \fi \else - \let\stopspread\egroup + \expandafter\page_spread_start_nop \fi} \let\stopspread\relax -\def\dostopspread - {\kern\zeropoint\page - \inspreadfalse +\unexpanded\def\page_spread_start_yes + {\bgroup + \page[\v!left]% + %\setsystemmode{spread}% + \settrue\c_page_spread_busy + \expanded{\setuplayout[\c!textwidth=\the\dimexpr2\textwidth+2\backspace\relax]}% + \let\stopspread\page_spread_stop_yes} + +\unexpanded\def\page_spread_stop_yes + {\kern\zeropoint + \page \setuplayout[\c!textwidth=\textwidth] \page[\v!left] \egroup} +\unexpanded\def\page_spread_start_nop + {\bgroup + \let\stopspread\page_spread_stop_nop} + +\unexpanded\def\page_spread_stop_nop + {\egroup} + \protect \endinput % texexec --arr --pdf test |