summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/flowfram/samples/sample.tex
blob: 1bf6ccf6293214852fd36e1f5d973f39382103a8 (plain)
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
 % This file is public domain.

\documentclass[a4paper,twoside]{book}

\usepackage{times}
\usepackage{courier}
\usepackage{helvet}
\usepackage[margin=1in,top=1in,bottom=1in]{geometry}
\usepackage[colorlinks,
            linkcolor=black,
            urlcolor=black,
            plainpages=false,
            pdfpagelabels=true]{hyperref}
\usepackage{fancybox}
\usepackage{color}
\usepackage{flowfram}

\newcommand{\sty}[1]{\textsf{#1}}
\newcommand{\env}[1]{\textsf{#1}}
\newcommand{\cmdname}[1]{\texttt{\symbol{92}#1}}
\newcommand{\meta}[1]{\textnormal{\textless\textit{#1}\textgreater}}

\newlength{\leftwidth}
\newlength{\rightwidth}

\computeleftedgeodd{\leftwidth}
\setlength{\leftwidth}{-\leftwidth}
\addtolength{\leftwidth}{0.4\textwidth}
\setlength{\rightwidth}{\paperwidth}
\addtolength{\rightwidth}{-\leftwidth}
\vtwotone[1]{\leftwidth}{magenta}{backleft}{\rightwidth}{[cmyk]{0,0.48,0,0}}{backright}

\vtwotone[none]{\rightwidth}{[cmyk]{0,0.48,0,0}}{lastbackright}{\leftwidth}{magenta}{lastbackleft}

\vtwotonetop[odd]{1cm}{\leftwidth}{magenta}{oddtopleft}{\rightwidth}{[cmyk]{0,0.48,0,0}}{oddtopright}
\vtwotonetop[even]{1cm}{\rightwidth}{[cmyk]{0,0.48,0,0}}{eventopleft}{\leftwidth}{magenta}{eventopright}

\setlength{\marginparwidth}{2cm}

\newflowframe{0.6\textwidth}{\textheight}{0pt}{0pt}[main]
\newdynamicframe{0.38\textwidth}{\textheight}{0.62\textwidth}{0pt}[chaphead]

\setflowframe*{main}{evenx=0.4\textwidth}
\setdynamicframe*{chaphead}{evenx=0pt}

\setflowframe*{main}{margin=inner}

\dfchaphead*{chaphead}

\appenddfminitoc*{chaphead}


\renewcommand{\DFchapterstyle}[1]{%
\raggedright\sffamily\bfseries\Huge\color{blue}#1\par
}

\renewcommand{\DFschapterstyle}[1]{\raggedright\sffamily\bfseries\Huge\color{blue} #1\par
}


\makethumbtabs{2in}
\enableminitoc

\setthumbtab{1}{backcolor=[rgb]{0.15,0.15,1}}
\setthumbtab{2}{backcolor=[rgb]{0.2,0.2,1}}
\setthumbtab{3}{backcolor=[rgb]{0.25,0.25,1}}
\setthumbtab{4}{backcolor=[rgb]{0.3,0.3,1}}

\newcommand{\thumbtabstyle}[1]{\textsc{\sffamily #1}}
\setthumbtab{all}{style=thumbtabstyle,textcolor=white}


\pagestyle{plain}

\makedfheaderfooter

\newlength{\xoffset}
\computerightedgeodd{\xoffset}
\addtolength{\xoffset}{-2cm}
\newlength{\yoffset}
\computebottomedge{\yoffset}

\newcommand{\footstyle}[1]{\bfseries\LARGE #1}


\setdynamicframe*{footer}{oddx=\xoffset,y=\yoffset,width=2cm,height=2cm,
backcolor=blue,textcolor=white,style=footstyle,pages=none}


\computeleftedgeeven{\xoffset}
\setdynamicframe*{footer}{evenx=\xoffset}

\begin{document}
\ffswapoddeven*{main}% swap odd and even position of frame for the title page
\dfswapoddeven*{chaphead}
\title{Creating Flow Frames for Posters or Magazines}
\author{Nicola L. C. Talbot\\[1cm]\url{http://www.dickimaw-books.com/}}
\date{}
\pagenumbering{alph}
\maketitle

\cleardoublepage
\setstaticframe*{backleft}{pages=none}
\setstaticframe*{backright}{pages=none}

\frontmatter
\tocandthumbtabindex
\setdynamicframe*{footer}{pages=all}

\clearpage
\dfswapoddeven*{chaphead}
\ffswapoddeven*{main}% swap back again

\mainmatter
\chapter{Introduction}
\enablethumbtabs
\pagenumbering{arabic}

The \sty{flowfram} package is designed to enable you to create
frames in a document such that the
contents of the \env{document} environment flow from one
frame to the next in the order that they were defined.
This is useful for creating posters\marginpar{A marginal note}
or magazines or any other form of document that does not
conform to the standard one or two column layout.

This document has \themaxflow\ flow
\ifthenelse{\value{maxflow}=1}{frame}{frames}, \themaxstatic\ static
\ifthenelse{\value{maxstatic}=1}{frame}{frames} and
\themaxdynamic\ dynamic \ifthenelse{\value{maxdynamic}=1}{frame}{frames}.

\chapter{Setting up Frames}

The \sty{flowfram} package provides three types of frame:
{flow frames}, {static
frames} and {dynamic frames}.

\section{Flow Frames}

The flow frame is the principle type of frame.
The text of the \env{document} environment will flow from
one frame to the next in order of definition. Each
flow frame has an associated width, height,
position on the page, and optionally a border\footnote{A
footnote!}.

\section{Static Frames}

A static frame is a rectangular area in which text neither
flows into, nor flows out of.  The contents must be set
explicitly, and once set, the contents of the static frame will
remain the same on each page until it is explicitly
changed.  Thus, a static frame can be used, for example, to make
a company logo appear in the same place on every page.

\section{Dynamic Frames}

A dynamic frame is similar to a static frame, but its contents
are re-typeset on each page. (A static frame stores its
contents in a savebox, whereas a dynamic frame stores its
contents in a macro).

\chapter{Frame Attributes}
\label{sec:modattr}

Once you have defined the {flow frames}, {static frames} and
{dynamic frames}, their attributes can be changed.
The three types of frame mostly have the
same set of attributes, but some are specific to a certain type.
The available attributes are as follows
(\textsuperscript{\textbf{F}} indicates the key is
only available for {flow frames},
\textsuperscript{\textbf{S}} indicates the key is only available
for {static frames}
and \textsuperscript{\textbf{D}} indicates the key
is only available for {dynamic frames}):

\begin{description}
\item[width=\meta{length}]  The width of the frame.

\item[height=\meta{length}] The height of the frame.

\item[x=\meta{length}] The x-coordinate of the frame.

\item[y=\meta{length}] The y-coordinate of the frame.

\item[border=\meta{style}] The style of the border around the
frame, this can take the values: \texttt{none} (no border),
\texttt{plain} (plain border) or the name of a \LaTeX\
frame making command without the preceding backslash.
The value \texttt{fbox} is equivalent to \texttt{plain}.

\item[offset=\meta{offset}] The border offset, if it is a
user-defined border.  This is the distance from the outer
edge of the left hand border to the left edge of the
bounding box of the text inside the border.  The \sty{flowfram}
package is able to compute the border for
known frame making commands.
If you define your own frame making command, you may need to
specify the offset explicitly, or the frames
may end up shifted to the right or left.

\item[bordercolor=\meta{colour}] The colour of the border
if you are using a standard frame making command.
The colour can either be specified as, e.g.\ \texttt{green},
or including the colour model, e.g. \verb/[rgb]{0,1,0}/.

\item[textcolor=\meta{colour}] The text colour for that
frame. Again, the colour can either be specified as,
e.g.\ \texttt{green}, or including the colour model,
e.g. \verb/[rgb]{0,1,0}/.

\item[pages=\meta{page list}] The {list of
pages} for which the frame
should appear. This can either have the values: \texttt{all},
\texttt{even}, \texttt{odd} or \texttt{none} (the latter
removes the frame from that point on---useful if you
have multiple pages with the same number), or it can be a
comma-separated list of single pages, or
{page ranges}.

\item[margin=\meta{side}\textsuperscript{F}] The side of
the flow frame that its corresponding margin should go on. This
can take the values \texttt{left} or \texttt{right}.

\item[clear=\meta{boolean}\textsuperscript{S}] If this value
is set, the static frame will be cleared at the start of the
next page.

\item[style=\meta{cmd}\textsuperscript{D}] This should be
the name of a command \emph{without} the preceding backslash,
to be applied to the contents of the specified dynamic frame.
The command may either be a declaration, for example \verb/style=large/
which will set the contents of all the dynamic frames in a
large font, or it can be a command that takes a single argument,
for example \verb/style=textbf/
which will make the text for all the dynamic frames come out in
bold.  To unset a style, do \verb/style=none/.

\end{description}

\chapter{Miscellaneous}

\section{Page Layout}

The \sty{flowfram} package has the package option \texttt{draft}
which will draw the {bounding boxes} for
each frame defined.  At the bottom right of each
bounding box (except for the bounding box denoting the
typeblock), a marker will be shown to indictate the type
of frame, its IDN and its IDL.

You can see the layout for the current page (irrespective of
whether or not the \texttt{draft} option has been set) using
the command:\newline
\cmdname{flowframeshowlayout}

The headers and footers will appear as usual (but will not
be shown in draft mode), according to the format given by
\cmdname{pagestyle}.

\section{Frame Stacking Order}

The material on each page is placed in the following order:
\begin{enumerate}
\item Each static frame defined for that page in ascending
order of IDN.

\item Each flow frame defined for that page in ascending
order of IDN.

\item Each dynamic frame defined for that page in ascending
order of IDN.

\item {Bounding boxes} if the \texttt{draft}
package option has been used.
\end{enumerate}

This ordering can be used to determine if you want something
to overlay or underlay everything else on the page.

\section{Prematurely Ending a Flow Frame}

You can force text to move immediately to the next defined
flow frame using one of the standard \LaTeX\ page breaking commands
which  work in an analogous way to the way they
work in standard two column mode.

The command \cmdname{framebreak} is provided for situations
where a paragraph spans two flow frames
of different widths, as \TeX's output routine does not
adjust to the new value of \cmdname{hsize} until the last
paragraph of the previous frame has ended. As a
result, the end of the paragraph at the beginning of the new
flow frame retains the width of the previous flow frame.

If you want to start a new page, rather than simply move to the
next frame, use the command\newline
\cmdname{finishthispage}.

\section{Floats}

Since floats (such as figures and tables) can only go in
{flow frames}, this package provides
the additional environments:
\env{staticfigure} and
\env{statictable} which can be used in static frames
and dynamic frames. Unlike their \env{figure} and
\env{table} counterparts, they are fixed in place, and
so do not take an optional placement specifier. The
\cmdname{caption} and \cmdname{label} commands can
be used within \env{staticfigure} and \env{statictable} as
usual.

The standard \env{figure} and \env{table} commands will
behave as usual in the flow frames, but their starred versions,
\env{figure*} and \env{table*} behave no differently
from \env{figure} and \env{table}.

\section{Global Values}

The following macros can be changed using \cmdname{renewcommand}:

\begin{itemize}
\item \cmdname{setffdraftcolor}

This sets the colour of the bounding box
when it is displayed in draft mode.

\item
\cmdname{setffdrafttypeblockcolor}

This sets the colour of
the bounding box of the typeblock when it is displayed
in draft mode.

\item \cmdname{fflabelfont}

This sets the font size for the bounding box markers in
draft mode.

\end{itemize}

The following are lengths, which can be changed using
\cmdname{setlength}:
\marginpar{Another marginal note}

\begin{itemize}
\item \cmdname{fflabelsep}

This is the distance from the right hand side of the
bounding box at which to place the bounding box marker.

\item \cmdname{flowframesep}

This is the gap between the text of the frame and
its border, for the standard border types.

\item \cmdname{flowframerule}

This is the width of the frame's border, if using
a border given by a frame making command that uses \cmdname{fboxsep}
to set its border width.
\end{itemize}

\chapter*{Contact Details}
\disablethumbtabs

Dr Nicola Talbot\\
School of Computing Sciences\\
University of East Anglia\\
Norwich. Norfolk. NR4 7TJ. UK\\
\url{http://theoval.cmp.uea.ac.uk/~nlct/}

\finishthispage\mbox{}
\setdynamiccontents*{chaphead}{}
\setdynamicframe*{footer}{pages=none}
\setstaticframe*{lastbackleft,lastbackright}{pages=even}
\end{document}