1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
%%
%% Package fullwidth
%%
%% Currently the package has a beta-Status
%%
%% Copyright (c) 2011 Marco Daniel
%%
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%% Allgemeine Angaben
\def\fwdversion{v0.1}
\def\fwdpackagename{fullwidth}
\def\fwddate{2011/11/18\space}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fullwidth}[\fwddate \fwdversion: \fwdpackagename]
%%Benoetigte Pakete
\RequirePackage{kvoptions,etoolbox}
\RequirePackage{zref-abspage}
\SetupKeyvalOptions{family=fwd,prefix=fwd@}
%%Schleifenmakro zur Optioneneingabe
\DeclareListParser*{\fwd@dolist}{,}
%Laengenoptionen
\def\fwd@do@lengthoption#1{%
\fwd@lengthoption@doubledo#1\@nil%
}
\def\fwd@lengthoption@doubledo#1==#2\@nil{%
\csdef{fwd@#1}{}
\expandafter\newlength\csname fwd@#1@length\endcsname%
\expandafter\deflength\csname fwd@#1@length\endcsname{#2\relax}%
\fdw@define@key@length{#1}%
}
\newrobustcmd*{\fdw@define@key@length}[1]{%
\define@key{fwd}{#1}{%
\expandafter\deflength\csname fwd@#1@length\endcsname{##1\relax}%
}%
}
\fwd@dolist{\fwd@do@lengthoption}{%
{width==\linewidth},%
{skipabove==\topskip},%
{skipbelow==\topskip},%
{leftmargin==\z@},%
{rightmargin==\z@},%
{innertopmargin==0.4\baselineskip},%
{innerbottommargin==0.4\baselineskip},%
{splittopskip==\topsep},%
{splitbottomskip==\z@},%
{outermargin==\z@},%
{innermargin==\z@},%
{footenotedistance==\medskipamount},
}
%Nutzung des Paketes needspace
\define@key{fwd}{needspace}[\z@]{%
\begingroup%
\setlength{\dimen@}{#1}%
\vskip\z@\@plus\dimen@%
\penalty -100\vskip\z@\@plus -\dimen@%
\vskip\dimen@%
\penalty 9999%
\vskip -\dimen@%
\vskip\z@skip % hide the previous |\vskip| from |\addvspace|
\endgroup%
}
\DeclareBoolOption[true]{twosidemode}
\DeclareBoolOption{nobreak}
\DeclareBoolOption{footnoteinside}
\ProcessKeyvalOptions*\relax
\newrobustcmd{\fullwidthsetup}{\setkeys{fwd}}
%%Anpassung lrbox
\let\fwd@lrbox\lrbox
\patchcmd\fwd@lrbox\hbox\vbox{}{}
\patchcmd\fwd@lrbox\color@setgroup{%
\color@setgroup%
\hsize=\fwd@width@length%
\columnwidth=\hsize%
\textwidth=\hsize%
\linewidth=\hsize%
}{}{}
\def\endfwd@lrbox{\unskip\color@endgroup}
%Anpassung trivlist
\let\fwd@trivlist\trivlist
\let\endfwd@trivlist\endtrivlist
\patchcmd\endfwd@trivlist\@endparenv\fwd@endparenv{}{}
\def\fwd@endparenv{%
\addpenalty\@endparpenalty\addvspace\fwd@skipbelow@length\@endpetrue}
\newrobustcmd*\fwd@footnoterule{%
\kern0\p@%
\hrule \@width 1in \kern 2.6\p@}
\newrobustcmd*\fwd@footnoteoutput{%
\ifvoid\@mpfootins\else
\nobreak%
\vskip\fwd@footenotedistance@length%
\normalcolor%
\fwd@footnoterule
\unvbox\@mpfootins
\fi%
}
\newrobustcmd*\fwd@footnoteinput{%
\def\@mpfn{mpfootnote}%
\def\thempfn{\thempfootnote}%
\c@mpfootnote\z@%
\let\@footnotetext\@mpfootnotetext%
}
\let\fwd@reserved@a\@empty
\newrobustcmd*\fwd@detect@output{%
\iffwd@nobreak%Option nobreak=true?
\def\fwd@reserved@a{\fwd@standalone}%
\else
\def\fwd@reserved@a{\fwd@putframe}%
\ifnum\@floatpenalty<0\relax%Detecting float
\if@twocolumn%
\ifx\@captype\@undefined
\def\fwd@reserved@a{\fwd@putframe}%
\else
\PackageWarning{fullwidth}{fullwidth inside float ^^J
fullwidth uses option nobreak}%
\def\fwd@reserved@a{\fwd@standalone}%
\fi
\else
\PackageWarning{fullwidth inside float ^^J
fullwidth uses option nobreak}%
\def\fwd@reserved@a{\fwd@standalone}%
\fi%
\fi%
\if@minipage%
\PackageWarning{fullwidth inside minipage ^^J
fullwidth uses option nobreak}%
\def\fwd@reserved@a{\fwd@standalone}%
\fi%
\ifinner%
\PackageWarning{fullwidth inside a box ^^J
fullwidth uses option nobreak }%
\def\fwd@reserved@a{\fwd@standalone}%
\fi%
\fi%
%\fwd@standalone%
\fwd@reserved@a%
}
\def\fullwidth{\@ifnextchar[\fullwidth@i\fullwidth@ii}%
\def\fullwidth@ii{\fullwidth@i[]}%
\def\fullwidth@i[#1]{% default-Umgebung
\begingroup
\fullwidthsetup{#1}%%
\fwd@twoside@checklength%
\let\width\z@%
\let\height\z@%
\setlength{\topsep}{\fwd@skipabove@length}%
\begingroup%
\let\partopsep\z@%
\expandafter\endgroup%
\begin{fwd@trivlist}\item\relax%
\hsize=\fwd@width@length\relax%
\fwd@footnoteinput%
\begin{fwd@lrbox}{\@tempboxa}%
}
\def\endfullwidth{%
\iffwd@footnoteinside%
\def\fwd@reserveda{%
\fwd@footnoteoutput%
\end{fwd@lrbox}%
\fwd@detect@output}%
\else%
\def\fwd@reserveda{%
\end{fwd@lrbox}
\fwd@detect@output%
\fwd@footnoteoutput%
}%
\fi%
\fwd@reserveda%
\end{fwd@trivlist}%
\hrule \@height\z@ \@width\hsize
\endgroup%\@endparenv%
}
%%==================================================%%
%%================== Twoside-Modus =================%%
%%==================================================%%
\newrobustcmd*\fwd@twoside@checklength{%
\if@twoside
\setlength\fwd@rightmargin@length{\fwd@outermargin@length}%
\setlength\fwd@leftmargin@length{\fwd@innermargin@length}%
% \booltrue{fwd@twosidemode}%
\else
\boolfalse{fwd@twosidemode}%
\fi%
}
\newcounter{fwd@zref@counter}%keine doppelten laebes
\zref@newprop*{fwd@pagevalue}[0]{\number\value{page}}
\zref@addprop{\ZREF@mainlist}{fwd@pagevalue}
\newrobustcmd*\fwd@zref@label{%
\stepcounter{fwd@zref@counter}
\zref@label{fwd@pagelabel-\number\value{fwd@zref@counter}}%
}
\newrobustcmd*\if@fwd@pageodd{%
\zref@refused{fwd@pagelabel-\the\value{fwd@zref@counter}}%
\ifodd\zref@extract{fwd@pagelabel-\the\value{fwd@zref@counter}}{fwd@pagevalue}%
\edef\fwd@reserveda{\fwd@pageisodd}%
\else
\edef\fwd@reserveda{\fwd@pageiseven}%
\fi
\fwd@reserveda%
}
\newrobustcmd*\fwd@pageisodd{%
\setlength\fwd@rightmargin@length{\fwd@outermargin@length}%
\setlength\fwd@leftmargin@length{\fwd@innermargin@length}%
}
\newrobustcmd*\fwd@pageiseven{%
\setlength\fwd@leftmargin@length{\fwd@outermargin@length}%
\setlength\fwd@rightmargin@length{\fwd@innermargin@length}%
}
\newrobustcmd*\fwd@@setzref{\fwd@zref@label\if@fwd@pageodd}
%%==================================================%%
%%================= Platz auf Seite ================%%
%%==================================================%%
\newlength\fwd@freevspace@length
\newrobustcmd*\fwd@freepagevspace{%
\penalty\@M \vskip 2\baselineskip \vskip\height
\penalty9999 \vskip -2\baselineskip \vskip-\height
\penalty9999
\ifdimequal{\pagegoal}{\maxdimen}%
{\fwd@freevspace@length\vsize}%
{\fwd@freevspace@length=\pagegoal\relax%
\advance\fwd@freevspace@length by -\pagetotal\relax%
}%
}
\newrobustcmd*\fwd@standalone{\relax%
\ifvoid\@tempboxa\relax
\PackageWarning{fullwidth}{The environment is empty\MessageBreak}%
\let\fwd@reserved@a\relax%
\else
\def\fwd@reserved@a{\fwd@putbox@tempboxa}%
\fi
\fwd@reserved@a%
}
\def\fwd@putframe{\relax%
\ifvoid\@tempboxa\relax
\PackageWarning{fullwidth}{The environment is empty\MessageBreak}%
\let\fwd@reserved@a\relax%
\else
\fwd@freepagevspace%
\ifdimless{\fwd@freevspace@length}{2\baselineskip}
{\PackageInfo{fullwidth}{Not enough space on this page}%die Seite hat nur noch minimal Platz
\vfill\eject%
\def\fwd@reserved@a{\fwd@putframe}%
}{%
\ifdimless{\ht\@tempboxa+\dp\@tempboxa}{\fwd@freevspace@length}%
{%passt auf Seite%
\begingroup
\ifbool{fwd@twosidemode}{\fwd@@setzref}{}%
\fwd@putbox@tempboxa%%
\endgroup
\let\fwd@reserved@a\relax}%
{\def\fwd@reserved@a{\fwd@putframe@i}}%passt nicht auf Seite
}%
\fi
\fwd@reserved@a%
}
\def\fwd@putframe@i{%Box muss gesplittet werden -- Ausgabe der ersten Teilbox
%Berechnung der Splittgroesse Abstand oben
\fwd@freepagevspace%
\dimen@=\the\fwd@freevspace@length%
\dimen@i=\fwd@innertopmargin@length%
\advance\dimen@i by 2\baselineskip%
\ifdim\dimen@<\dimen@i\relax
\hrule \@height\z@ \@width\hsize%
\vfill\eject%
\def\fwd@reserved@a{\fwd@putframe}%
\else%
\ifdimless{\ht\@tempboxa+\dp\@tempboxa}{\dimen@}%
{\PackageWarning{fullwidth}{You got a bad break\MessageBreak
you have to change it manually\MessageBreak
by changing the text, the space\MessageBreak
or something else}%
\advance\dimen@ by -1.8\baselineskip\relax%
}{}%
\advance\dimen@ by -1pt\relax%Box darf nicht zu Groß werden.
\splitmaxdepth\z@ \splittopskip\fwd@splittopskip@length%
\setbox\tw@\vsplit\@tempboxa to \dimen@
\setbox\tw@\vbox{\unvbox\tw@}%needed?
\ifdimgreater{\ht\tw@+\dp\tw@}{\dimen@}{%Falsch gesplittet
\PackageInfo{fullwidth}{Box was splittet wrong\MessageBreak}%
\dimen@i=\dimen@
\advance\dimen@ by -\ht\tw@
\advance\dimen@ by -\dp\tw@
\advance\dimen@i by 0.5\dimen@
\splittopskip\z@%
\setbox\@tempboxa\vbox{\unvbox\tw@%
\hrule \@height\dp\strutbox \@width\z@%benoetigt um Tiefe zu haben
\unvbox\@tempboxa}
\splittopskip\fwd@splittopskip@length%
\setbox\tw@\vsplit\@tempboxa to \dimen@i
\setbox\tw@\vbox{\unvbox\tw@}%
}{}%
\setbox\@tempboxa\vbox{\unvbox\@tempboxa}%PRUEFEN!!!!
\ifvoid\@tempboxa
\PackageWarning{fullwidth}{You got a bad break\MessageBreak
because the splittet box is empty\MessageBreak
You have to change the page settings\MessageBreak
like enlargethispage or something else}%
\setbox\@tempboxa\vbox{\box\tw@\box\@tempboxa}%
\def\fwd@reserved@a{\fwd@putframe}%
\fi
\ifvoid\tw@%%pruefe, ob erste Box leer ist
\hrule \@height\z@ \@width\hsize
\vfill\eject%
\def\fwd@reserved@a{\fwd@putframe}%
\else
\ifdimequal{\ht\tw@}{0pt}%
{\hrule \@height\z@ \@width\hsize%
\vfill\eject%
\setbox\@tempboxa\vbox{\unvbox\tw@\unvbox\@tempboxa}
\def\fwd@reserved@a{\fwd@putframe}%
}%
{%
\begingroup
\ifbool{fwd@twosidemode}{\fwd@@setzref}{}%
\fwd@putbox@tw@%Groesse des Splittens passt
\endgroup
\hrule \@height\z@ \@width\hsize
\vfill\eject%
\def\fwd@reserved@a{\fwd@putframe@ii}%
}%
\fi%
\fi%
\fwd@reserved@a%
}
\def\fwd@putframe@ii{%Ausgabe der mittleren Box(en) wenn vorhanden
\setlength{\fwd@freevspace@length}{\vsize}%
\setlength{\dimen@}{\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax}%
\ifdimgreater{\dimen@}{\fwd@freevspace@length}%
{%
\advance\fwd@freevspace@length by -\fwd@splitbottomskip@length
\splitmaxdepth\z@ \splittopskip\fwd@splittopskip@length%
\setbox\tw@\vsplit\@tempboxa to \fwd@freevspace@length%
\setbox\tw@\vbox{\unvbox\tw@}%PRUEFEN!!!
\setbox\@tempboxa\vbox{\unvbox\@tempboxa}%PRUEFEN!!!!
\ifvoid\@tempboxa\relax%
\fwd@PackageWarning{You got a bad break\MessageBreak
because the split box is empty\MessageBreak
You have to change the settings}%
\fi%
\begingroup
\ifbool{fwd@twosidemode}{\fwd@@setzref}{}%
\fwd@putbox@tw@%
\endgroup
\hrule \@height\z@ \@width\hsize
\vfill\eject
\def\fwd@reserved@a{\fwd@putframe@ii}%
}%Hier die Ausgabe der mittleren Box
{\ifvoid\@tempboxa
\fwd@PackageWarning{You got a bad break\MessageBreak
because the last split box is empty\MessageBreak
You have to change the settings}%
\fi%
\begingroup
\ifbool{fwd@twosidemode}{\fwd@@setzref}{}%
\fwd@putbox@tempboxa%
\endgroup
\let\fwd@reserved@a\relax%
}%Hier kommt die Ausgabe der letzten Box
\fwd@reserved@a%
}
\newrobustcmd\fwd@leftline[1]{\leftline{\hspace*{\fwd@leftmargin@length}#1}}%Keine Modifikation
\newrobustcmd\fwd@putbox@tempboxa{\fwd@leftline{\box\@tempboxa}}
\newrobustcmd\fwd@putbox@tw@{\fwd@leftline{\box\tw@}}
\endinput
|