Debian Codegraph @

texmf-dist/doc/latex/flowfram/samples/sample.tex

raw
1 % This file is public domain.
2
3 % arara: pdflatex
4 % arara: pdflatex
5 \documentclass[a4paper,twoside]{book}
6
7 \usepackage{times}
8 \usepackage{courier}
9 \usepackage{helvet}
10 \usepackage[margin=1in,top=1in,bottom=1in]{geometry}
11 \usepackage[hidelinks,
12 plainpages=false,
13 pdfpagelabels=true]{hyperref}
14 \usepackage{fancybox}
15 \usepackage{color}
16 \usepackage{ifthen}
17 \usepackage[pages=absolute,draft]{flowfram}
18
19 \newcommand{\sty}[1]{\textsf{#1}}
20 \newcommand{\env}[1]{\textsf{#1}}
21 \newcommand{\cmdname}[1]{\texttt{\symbol{92}#1}}
22 \newcommand{\meta}[1]{\textnormal{\textless\textit{#1}\textgreater}}
23
24 % set up some background frames to liven up the title page
25 \newlength{\leftwidth}
26 \newlength{\rightwidth}
27
28 \computeleftedgeodd{\leftwidth}
29 \setlength{\leftwidth}{-\leftwidth}
30 \addtolength{\leftwidth}{0.4\textwidth}
31 \setlength{\rightwidth}{\paperwidth}
32 \addtolength{\rightwidth}{-\leftwidth}
33 \vtwotone[1]{\leftwidth}{magenta}{backleft}{\rightwidth}{[cmyk]{0,0.48,0,0}}{backright}
34
35 % This is for the back cover.
36 \vtwotone[none]{\rightwidth}{[cmyk]{0,0.48,0,0}}{lastbackright}{\leftwidth}{magenta}{lastbackleft}
37
38 \vtwotonetop[odd]{1cm}{\leftwidth}{magenta}{oddtopleft}{\rightwidth}{[cmyk]{0,0.48,0,0}}{oddtopright}
39 \vtwotonetop[even]{1cm}{\rightwidth}{[cmyk]{0,0.48,0,0}}{eventopleft}{\leftwidth}{magenta}{eventopright}
40
41 % Set the margin width
42 \setlength{\marginparwidth}{2cm}
43
44 % now set up main document frames. Each page has a dynamic
45 % frame for the chapter heading, and a flow frame for the
46 % text.
47 \newflowframe{0.6\textwidth}{\textheight}{0pt}{0pt}[main]
48 \newdynamicframe{0.38\textwidth}{\textheight}{0.62\textwidth}{0pt}[chaphead]
49
50 % swap them round on even pages
51 \setflowframe*{main}{evenx=0.4\textwidth}
52 \setdynamicframe*{chaphead}{evenx=0pt,clear}
53
54 % set the margins to appear on the spine side of the page
55 \setflowframe*{main}{margin=inner}
56
57 % put chapter headings in dynamic frame with IDL chaphead
58 \ChapterInDynamic*{chaphead}
59
60 % change the text colour for just the chapter heading without
61 % affecting the minitoc:
62 \AddToHook{flowfram/chaphead/box/before}{\color{blue}}
63
64 % This document uses book.cls so flowfram applies patches to make
65 % the chapter style more flexible. These commands won't be available
66 % if another class or package has made modifications.
67 \renewcommand{\ffchapterdefaultfont}{\normalfont\Large\bfseries}
68 \renewcommand{\ffchapternamenumfont}[1]{#1}
69 \renewcommand{\ffchaptertitlefont}[1]{#1}
70 \renewcommand{\ffchapterpostnamenum}{.\ }
71 \renewcommand{\ffchapternamenum}[2]{#2}
72
73 % append chapter minitocs to same dynamic frame.
74 \appenddfminitoc*{chaphead}
75
76 % Make thumb tabs (specify each tab to be 2in high)
77
78 \makethumbtabs{2in}
79 \enableminitoc
80
81 % Thumbtabs are grey by default which looks a bit boring,
82 % so change the colours
83 \setthumbtab{1}{backcolor=[rgb]{0.7,0.5,1}}
84 \setthumbtab{2}{backcolor=[rgb]{0.6,0.4,1}}
85 \setthumbtab{3}{backcolor=[rgb]{0.5,0.3,1}}
86 \setthumbtab{4}{backcolor=[rgb]{0.4,0.2,1}}
87
88 % change the text style on the thumbtabs
89 %\newcommand{\thumbtabstyle}[1]{\textbf{\sffamily\large #1}}
90 \newcommand{\thumbtabstyle}[1]{\textsc{\sffamily #1}}
91 \setthumbtab{all}{style=thumbtabstyle,textcolor=white}
92
93 % set default page style
94
95 \pagestyle{plain}
96
97 % Put headers and footers in dynamic frames
98 \makedfheaderfooter
99
100 \newlength{\xoffset}
101 \computerightedgeodd{\xoffset}
102 \addtolength{\xoffset}{-2cm}
103 \newlength{\yoffset}
104 \computebottomedge{\yoffset}
105
106 \newcommand{\footstyle}[1]{\bfseries\LARGE #1}
107
108 % pages is initially set to none, as I don't want the footer to
109 % appear on the title page.
110
111 \setdynamicframe*{footer}
112 {oddx=\xoffset,y=\yoffset,width=2cm,height=2cm,
113 backcolor=blue,textcolor=white,style=footstyle,
114 pages=none}
115
116 % now work out the x offset for the even pages
117
118 \computeleftedgeeven{\xoffset}
119 \setdynamicframe*{footer}{evenx=\xoffset}
120
121 \flowframsetup{
122 toc-thumbtabs=aligned
123 %toc-thumbtabs=unaligned
124 %toc-thumbtabs=false
125 }
126
127 % Individual thumbtab titles may be overridden:
128 \SetThumbTabTitle{4}{Misc}
129
130 \begin{document}
131 \ffswapoddeven*{main}% swap odd and even position of frame for the title page
132 \dfswapoddeven*{chaphead}
133 \title{Creating Flow Frames for Posters or Magazines}
134 \author{Nicola L. C. Talbot\\[1cm]\url{http://www.dickimaw-books.com/}}
135 \date{}
136 \pagenumbering{alph}
137 \maketitle
138
139 % make table of contents appear on a right hand page
140 \cleardoublepage
141
142 \frontmatter
143 \tableofcontents
144 % make the footers appear from this point on
145 \setdynamicframe*{footer}{pages=all}
146
147 \clearpage
148 \dfswapoddeven*{chaphead}
149 \ffswapoddeven*{main}% swap back again
150
151 \mainmatter
152 \enablethumbtabs
153 \chapter[][Intro]{Introduction}
154 \pagenumbering{arabic}
155
156 The \sty{flowfram} package is designed to enable you to create
157 frames in a document such that the
158 contents of the \env{document} environment flow from one
159 frame to the next in the order that they were defined.
160 This is useful for creating posters\marginpar{A marginal note}
161 or magazines or any other form of document that does not
162 conform to the standard one or two column layout.
163
164 This document has \themaxflow\ flow
165 \ifthenelse{\value{maxflow}=1}{frame}{frames}, \themaxstatic\ static
166 \ifthenelse{\value{maxstatic}=1}{frame}{frames} and
167 \themaxdynamic\ dynamic \ifthenelse{\value{maxdynamic}=1}{frame}{frames}.
168
169 \chapter[][New Frames]{Setting up Frames}
170
171 The \sty{flowfram} package provides three types of frame:
172 {flow frames}, {static
173 frames} and {dynamic frames}.
174
175 \section{Flow Frames}
176
177 The flow frame is the principle type of frame.
178 The text of the \env{document} environment will flow from
179 one frame to the next in order of definition. Each
180 flow frame has an associated width, height,
181 position on the page, and optionally a border\footnote{A
182 footnote!}.
183
184 \section{Static Frames}
185
186 A static frame is a rectangular area in which text neither
187 flows into, nor flows out of. The contents must be set
188 explicitly, and once set, the contents of the static frame will
189 remain the same on each page until it is explicitly
190 changed. Thus, a static frame can be used, for example, to make
191 a company logo appear in the same place on every page.
192
193 \section{Dynamic Frames}
194
195 A dynamic frame is similar to a static frame, but its contents
196 are re-typeset on each page. (A static frame stores its
197 contents in a savebox, whereas a dynamic frame stores its
198 contents in a macro).
199
200 \chapter{Frame Attributes}
201 \label{sec:modattr}
202
203 Once you have defined the {flow frames}, {static frames} and
204 {dynamic frames}, their attributes can be changed.
205 The three types of frame mostly have the
206 same set of attributes, but some are specific to a certain type.
207 The available attributes are as follows
208 (\textsuperscript{\textbf{F}} indicates the key is
209 only available for {flow frames},
210 \textsuperscript{\textbf{S}} indicates the key is only available
211 for {static frames}
212 and \textsuperscript{\textbf{D}} indicates the key
213 is only available for {dynamic frames}):
214
215 \begin{description}
216 \item[width=\meta{length}] The width of the frame.
217
218 \item[height=\meta{length}] The height of the frame.
219
220 \item[x=\meta{length}] The x-coordinate of the frame.
221
222 \item[y=\meta{length}] The y-coordinate of the frame.
223
224 \item[border=\meta{style}] The style of the border around the
225 frame, this can take the values: \texttt{none} (no border),
226 \texttt{plain} (plain border) or the name of a \LaTeX\
227 frame making command without the preceding backslash.
228 The value \texttt{fbox} is equivalent to \texttt{plain}.
229
230 \item[offset=\meta{offset}] The border offset, if it is a
231 user-defined border. This is the distance from the outer
232 edge of the left hand border to the left edge of the
233 bounding box of the text inside the border. The \sty{flowfram}
234 package is able to compute the border for
235 known frame making commands.
236 If you define your own frame making command, you may need to
237 specify the offset explicitly, or the frames
238 may end up shifted to the right or left.
239
240 \item[bordercolor=\meta{colour}] The colour of the border
241 if you are using a standard frame making command.
242 The colour can either be specified as, e.g.\ \texttt{green},
243 or including the colour model, e.g. \verb/[rgb]{0,1,0}/.
244
245 \item[textcolor=\meta{colour}] The text colour for that
246 frame. Again, the colour can either be specified as,
247 e.g.\ \texttt{green}, or including the colour model,
248 e.g. \verb/[rgb]{0,1,0}/.
249
250 \item[pages=\meta{page list}] The {list of
251 pages} for which the frame
252 should appear. This can either have the values: \texttt{all},
253 \texttt{even}, \texttt{odd} or \texttt{none} (the latter
254 removes the frame from that point on---useful if you
255 have multiple pages with the same number), or it can be a
256 comma-separated list of single pages, or
257 {page ranges}.
258
259 \item[margin=\meta{side}\textsuperscript{F}] The side of
260 the flow frame that its corresponding margin should go on. This
261 can take the values \texttt{left} or \texttt{right}.
262
263 \item[clear=\meta{boolean}\textsuperscript{S}] If this value
264 is set, the static frame will be cleared at the start of the
265 next page.
266
267 \item[style=\meta{cmd}\textsuperscript{D}] This should be
268 the name of a command \emph{without} the preceding backslash,
269 to be applied to the contents of the specified dynamic frame.
270 The command may either be a declaration, for example \verb/style=large/
271 which will set the contents of all the dynamic frames in a
272 large font, or it can be a command that takes a single argument,
273 for example \verb/style=textbf/
274 which will make the text for all the dynamic frames come out in
275 bold. To unset a style, do \verb/style=none/.
276
277 \end{description}
278
279 \chapter{Miscellaneous}
280
281 \section{Page Layout}
282
283 The \sty{flowfram} package has the package option \texttt{draft}
284 which will draw the {bounding boxes} for
285 each frame defined. At the bottom right of each
286 bounding box (except for the bounding box denoting the
287 typeblock), a marker will be shown to indictate the type
288 of frame, its IDN and its IDL.
289
290 You can see the layout for the current page (irrespective of
291 whether or not the \texttt{draft} option has been set) using
292 the command:\newline
293 \cmdname{flowframeshowlayout}
294
295 The headers and footers will appear as usual (but will not
296 be shown in draft mode), according to the format given by
297 \cmdname{pagestyle}.
298
299 \section{Frame Stacking Order}
300
301 The material on each page is placed in the following order:
302 \begin{enumerate}
303 \item Each static frame defined for that page in ascending
304 order of IDN.
305
306 \item Each flow frame defined for that page in ascending
307 order of IDN.
308
309 \item Each dynamic frame defined for that page in ascending
310 order of IDN.
311
312 \item {Bounding boxes} if the \texttt{draft}
313 package option has been used.
314 \end{enumerate}
315
316 This ordering can be used to determine if you want something
317 to overlay or underlay everything else on the page.
318
319 \section{Prematurely Ending a Flow Frame}
320
321 You can force text to move immediately to the next defined
322 flow frame using one of the standard \LaTeX\ page breaking commands
323 which work in an analogous way to the way they
324 work in standard two column mode.
325
326 The command \cmdname{framebreak} is provided for situations
327 where a paragraph spans two flow frames
328 of different widths, as \TeX's output routine does not
329 adjust to the new value of \cmdname{hsize} until the last
330 paragraph of the previous frame has ended. As a
331 result, the end of the paragraph at the beginning of the new
332 flow frame retains the width of the previous flow frame.
333
334 If you want to start a new page, rather than simply move to the
335 next frame, use the command\newline
336 \cmdname{finishthispage}.
337
338 \section{Floats}
339
340 Since floats (such as figures and tables) can only go in
341 {flow frames}, this package provides
342 the additional environments:
343 \env{staticfigure} and
344 \env{statictable} which can be used in static frames
345 and dynamic frames. Unlike their \env{figure} and
346 \env{table} counterparts, they are fixed in place, and
347 so do not take an optional placement specifier. The
348 \cmdname{caption} and \cmdname{label} commands can
349 be used within \env{staticfigure} and \env{statictable} as
350 usual.
351
352 The standard \env{figure} and \env{table} commands will
353 behave as usual in the flow frames, but their starred versions,
354 \env{figure*} and \env{table*} behave no differently
355 from \env{figure} and \env{table}.
356
357 \section{Global Values}
358
359 The following macros can be changed using \cmdname{renewcommand}:
360
361 \begin{itemize}
362 \item \cmdname{setffdraftcolor}
363
364 This sets the colour of the bounding box
365 when it is displayed in draft mode.
366
367 \item
368 \cmdname{setffdrafttypeblockcolor}
369
370 This sets the colour of
371 the bounding box of the typeblock when it is displayed
372 in draft mode.
373
374 \item \cmdname{fflabelfont}
375
376 This sets the font size for the bounding box markers in
377 draft mode.
378
379 \end{itemize}
380
381 The following are lengths, which can be changed using
382 \cmdname{setlength}:
383 \marginpar{Another marginal note}
384
385 \begin{itemize}
386 \item \cmdname{fflabelsep}
387
388 This is the distance from the right hand side of the
389 bounding box at which to place the bounding box marker.
390
391 \item \cmdname{flowframesep}
392
393 This is the gap between the text of the frame and
394 its border, for the standard border types.
395
396 \item \cmdname{flowframerule}
397
398 This is the width of the frame's border, if using
399 a border given by a frame making command that uses \cmdname{fboxsep}
400 to set its border width.
401 \end{itemize}
402
403
404 %\flowframsetup{unnumbered-thumbtabs}
405 \chapter*{Contact Details}
406 %\addcontentsline{toc}{chapter}{\protect\numberline{}Contact}
407 \disablethumbtabs
408
409 Dr Nicola Talbot\\
410 Dickimaw Books\\
411 \url{https://www.dickimaw-books.com/contact}
412
413 \finishthispage\mbox{}% empty back cover
414 \setdynamiccontents*{chaphead}{}
415 \setdynamicframe*{header,footer}{pages=none}
416 \setstaticframe*{lastbackleft,lastbackright}{pages=even}
417 \end{document}