1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Page Macros Spreading}
15
16
17
18\unprotect
19
20\newbox \b_page_spread_content
21\newconditional\c_page_spread_busy
22\newconditional\c_page_spread_once
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43\def\normalsettextpagecontent#1#2#3
44 {\setbox#1\hpack
45 {\setlayoutcomponentattribute{\v!page:\v!text}
46 \vpack \layoutcomponentboxattribute to \textheight
47 {\offinterlineskip
48 \freezetextwidth
49 \hsize\textwidth
50 \boxmaxdepth\maxdepth
51 \noindent
52 \page_otr_command_package_contents#2#3}}
53 \dp#1\zeropoint
54 \ifconditional\c_page_spread_busy
55 \normalsettextpagecontent_spread{#1}
56 \else
57 \normalsettextpagecontent_normal{#1}
58 \fi}
59
60
61
62
63
64\def\normalsettextpagecontent_normal#1
65 {\ifdim\wd#1=\makeupwidth\else
66 \setbox#1\hpack to \makeupwidth
67 {\hss\box#1\hss}
68 \fi}
69
70\def\normalsettextpagecontent_spread#1
71 {\setbox#1\hpack to \makeupwidth
72 {\ifvoid\b_page_spread_content
73 \ifconditional\c_page_spread_once
74 \box#1
75 \else
76 \global\setbox\b_page_spread_content\box#1
77 \copy\b_page_spread_content
78 \fi
79 \hss
80 \else
81 \hss
82 \ifarrangingpages
83
84 \else\ifconditional\c_page_spread_once
85 \global\setbox\b_page_spread_content\emptyhbox
86 \wd\b_page_spread_content\makeupwidth
87 \ht\b_page_spread_content\textheight
88 \else
89
90 \fi \fi
91 \box\b_page_spread_content
92 \fi}}
93
94\unexpanded\def\page_spread_flush
95 {\ifconditional\c_page_spread_busy \ifvoid\b_page_spread_content\else
96
97 \emptyhbox \page
98 \fi \fi }
99
100\unexpanded\def\startspread
101 {\ifdoublesided
102 \ifconditional\c_page_spread_busy
103 \doubleexpandafter\page_spread_start_nop
104 \else
105 \doubleexpandafter\page_spread_start_yes
106 \fi
107 \else
108 \expandafter\page_spread_start_nop
109 \fi}
110
111\let\stopspread\relax
112
113\unexpanded\def\page_spread_start_yes
114 {\bgroup
115 \page[\v!left]
116
117 \settrue\c_page_spread_busy
118 \expanded{\setuplayout[\c!textwidth=\the\dimexpr2\textwidth2\backspace\relax]}
119 \let\stopspread\page_spread_stop_yes}
120
121\unexpanded\def\page_spread_stop_yes
122 {\kern\zeropoint
123 \page
124 \setuplayout[\c!textwidth=\textwidth]
125 \page[\v!left]
126 \egroup}
127
128\unexpanded\def\page_spread_start_nop
129 {\bgroup
130 \let\stopspread\page_spread_stop_nop}
131
132\unexpanded\def\page_spread_stop_nop
133 {\egroup}
134
135\protect \endinput
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155 |