From 92a15e15b276458e10aa05016bf472e8c6dd3eb0 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 12 Jan 2006 23:45:13 +0000
Subject: context

git-svn-id: svn://tug.org/texlive/trunk@608 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/context/base/page-spr.tex | 104 ++++++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 Master/texmf-dist/tex/context/base/page-spr.tex

(limited to 'Master/texmf-dist/tex/context/base/page-spr.tex')

diff --git a/Master/texmf-dist/tex/context/base/page-spr.tex b/Master/texmf-dist/tex/context/base/page-spr.tex
new file mode 100644
index 00000000000..c90e9cf0f8b
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/page-spr.tex
@@ -0,0 +1,104 @@
+%D \module
+%D   [       file=page-spr,
+%D        version=2002.11.11,
+%D          title=\CONTEXT\ Page Macros,
+%D       subtitle=Spreading,
+%D         author=Hans Hagen,
+%D           date=\currentdate,
+%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%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 Page Macros / Spreading}
+
+% This module is experimental and not yet official!
+
+\unprotect
+
+\newbox\spreadbox
+\newif \ifinspread
+
+\chardef\showspreadmode=1
+
+% beware, ugly overload, to be redone
+
+\def\normalsettextpagecontent#1#2#3% #2 and #3 will disappear
+  {\setbox#1\hbox
+     {\vbox to \textheight
+        {\offinterlineskip
+         \freezetextwidth
+         \hsize\textwidth   % local variant of \sethsize
+         \boxmaxdepth\maxdepth
+         \noindent             % content can be < \hsize
+         \dopagecontents#2#3}}%
+   \dp#1\zeropoint
+   \setbox#1\hbox to \makeupwidth
+     {\ifinspread
+        \ifvoid\spreadbox
+          \global\setbox\spreadbox\box#1%
+          \copy\spreadbox\hss % left page
+        \else
+          % prevent duplicate writes in normal run
+          \ifarrangingpages \else \ifcase\showspreadmode
+            \global\setbox\spreadbox\null
+            \wd\spreadbox\makeupwidth
+            \ht\spreadbox\textheight
+          \fi \fi
+          \hss\box\spreadbox % right page
+        \fi
+      \else
+        \hss\box#1\hss % never change the \hss's
+      \fi}}
+
+\def\doflushspread
+  {\ifinspread \ifvoid\spreadbox\else
+     % this page will be discarded later
+     \null \page
+   \fi \fi }
+
+\def\startspread
+  {\bgroup
+   \ifdubbelzijdig
+     \page[\v!left]%
+    %\setsystemmode{spread}%
+     \inspreadtrue
+     \scratchdimen2\textwidth
+     \advance\scratchdimen2\backspace
+     \expanded{\setuplayout[\c!textwidth=\the\scratchdimen]}%
+     \def\startspread{\bgroup\let\stopspread\egroup}%
+     \let\stopspread\dostopspread
+   \else
+     \let\stopspread\egroup
+   \fi}
+
+\let\stopspread\relax
+
+\def\dostopspread
+  {\kern\zeropoint\page
+   \inspreadfalse
+   \setuplayout[\c!textwidth=\textwidth]
+   \page[\v!left]
+   \egroup}
+
+\protect \endinput
+
+% texexec --arr --pdf test
+%
+% \setuplayout[width=middle]
+% \setuppapersize[A4][A3,landscape]
+% \setuppagenumbering[alternative=doublesided]
+% \setuparranging[2UP]
+%
+% \starttext
+%
+% \dorecurse{3}{\input tufte }
+%
+% \startspread
+%   \dorecurse{10}{\input tufte }
+% \stopspread
+%
+% \dorecurse{3}{\input tufte }
+%
+% \stoptext
-- 
cgit v1.2.3

