10.3 ⁑The leaflet Class
The leaflet class manual [64] is accessed using
If you just do
you'll get the documented code instead.
The manual is formatted as a z-fold leaflet which illustrates the layout but makes on-screen reading difficult as the reverse sheet is upside-down.
The leaflet class loads the article class, but some
changes are made to the defaults. For example, \part
is not
available and the other sectioning commands aren't numbered. You can
use the letterpaper
or a4paper
class options to
set the paper size, but other paper sizes may need to have the
margins adjusted, which can be done using:
Marginal notes and two-column typesetting are disabled and by default there are no page headers or footers. Paragraph indentation is set to zero and paragraphs are separated by vertical space.
Class options (in addition to the options provided by article) are:
tumble
- Print the back sheet upside-down
(default).
notumble
- Don't print the back sheet
upside-down.
bothsides
- Create both the front and back
sheet (default).
frontside
- Only create the front sheet.
backside
- Only create the back sheet.
foldmark
- Print a fold mark (default).
nofoldmark
- Don't print a fold mark.
combine
- Combine three pages to a sheet
(default). An error is issued if too much text is generated to fit
onto the front and back sheets. (The surplus text is ignored.)
nocombine
- Don't combine multiple pages onto a
single sheet.
twopart
- Creates a four-page leaflet
(first part) and a two-page detachable form (second part).
notwopart
- Not a two-part leaflet
(default).
You may find that ragged-right justification produces better results given the narrow page sizes (where a page is one-third of a sheet). The leaflet class provides the following commands:
This command may only be used in the preamble and indicates that a cut line should be drawn to the left of the page given by ⟨page number⟩. The starred version just draws a dotted line. The unstarred version draws a dotted line with a pair of scissors.
Again this command may only be used in the preamble. This indicates
that ⟨picture code⟩ should be added to the page given by
⟨page number⟩. With the starred version, the ⟨page number⟩
refers to the sheet number (1 for the front and 2 for the back
sheet). The background is placed inside a picture
environment, so the ⟨picture code⟩ may include any of the
commands described in §10.1 The picture
Environment. Remember that
the co-ordinates are in terms of \unitlength
. If you want to
provide a specific length that's independent of \unitlength
,
the leaflet class provides:
which may be used to specify a length.
The font declaration used for the sectioning commands is given by
This may be redefined as required. The default value is
\bfseries
. The font declaration used for the item label in the
description
environment is given by
This may be redefined as required. The default value is
\bfseries
.
This example uses the starred version of \AddToBackground
to
place text across the first sheet and uses the unstarred version to
place an oval on the first page. The origin is the lower left hand
corner of the sheet/page. Rather than working out the
co-ordinates in terms of \unitlength
, I've used \LenToUnit
with multiples of \paperwidth
and \paperheight
.
I've also changed the fonts used by the sectioning commands and the
description
item labels. Since the default Computer Modern
fonts don't support bold smallcaps, I've used the Alegreya
package [105] to switch to the Alegreya font, which does have bold
smallcaps. (For other fonts, have a look at the Font
Catalogue [49].) The wasysym package [42]
provides the \Square
command used for the tick boxes ☐.
Leaflets and flyers tend to be less structured than normal documents, so I've used some commands that typically shouldn't be used (or, at least, used only sparingly on the final copy) in article, report or book-like documents. These include
which forces a page break, without attempting to vertically justify the page,
which inserts a vertical space,
which inserts a vertical space that will expand to fit the available
height. The paragraph justification can be made through an
environment, such as center
or flushright
, which
additionally inserts a vertical space above and below the
environment, or the justification can be made through a declaration,
such as \raggedright
(recall Volume 1).
\documentclass[a4paper,12pt,notumble]{leaflet} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{Alegreya} \usepackage{wasysym} \usepackage{xcolor} \usepackage{graphicx} \renewcommand*{\sectfont}{\scshape} \renewcommand*{\descfont}{\bfseries\scshape} \AddToBackground*{1}{% \put (0,0) {\rotatebox{33}{\resizebox{30cm}{!}{\color{lightgray}CLASSIFIED}}}% } \AddToBackground{1}{% \put (\LenToUnit{0.5\paperwidth},\LenToUnit{0.5\paperheight}) {\oval(\LenToUnit{0.95\paperwidth},\LenToUnit{0.95\paperheight})}% } \CutLine{6} \begin{document} \begin{center}\bfseries\Huge Culinary Experimental Research \vfill \normalsize \begin{tabular}{c} Secret Lab of Experimental Stuff\\ University of Somewhere \end{tabular} \vfill \begin{tabular}{c} Department of Stripy Confectioners\\ College of Somewhere Else \end{tabular} \vfill \includegraphics[height=3cm]{dummy-logo} \end{center} \newpage \raggedright \section{Secret Lab of Experimental Stuff} The Secret Lab of Experimental Stuff is a top-secret laboratory whose existence is highly classified so don't tell anyone about it or we'll get really cross with you. The University of Somewhere denies all knowledge of the Secret Lab of Experimental Stuff, except on Open Days where members of the public may visit the facility and ask questions as long as they consent to a memory wipe when they leave. The memory wipe is harmless (well, we haven't really tested it properly, but no one's complained so far) and your memory of the visit will be replaced by a pleasant recollection of spending the day feeding the ducks in the nearby pond. \begin{flushright} \includegraphics{mallard} \end{flushright} \section{Department of Stripy Confectioners} % lots of text omitted \newpage \section{Query Form} If you'd like to know more about the exciting collaboration between the Secret Lab of Experimental Stuff and the Department of Stripy Confectioners please fill in your details below and post this slip to: \bigskip \begin{tabular}{@{}l} Miss Ingperson\\ Secret Lab of Experimental Stuff\\ University of Somewhere\\ Some City\\ AB3 4YZ \end{tabular} \bigskip \Square\␣I would like to receive quarterly newsletters. \Square\␣I agree to having my memory wiped. \Square\␣Yes, I'd really like to feed the ducks. \bigskip \begin{tabular}{@{}lp{4cm}} Name: & \dotfill \\ Address: & \dotfill\\ & \dotfill \\ & \dotfill \\ & \dotfill \\ Postcode: & \dotfill\\ Country: & \dotfill\\ Telephone: & \dotfill\\ Mobile: & \dotfill\\ Email: & \dotfill \end{tabular} \newpage \section{Research Team} \begin{description} \item[Administrator] Mr Big Head \item[Assistant Administrator] Dr Bor Ing \item[Project Co-ordinator] Mabel Canary \item[Senior Scientists] Dickie Duck, Polly Parrot \item[Research Assistants] Zöe Zebra, José Arara, Fred Canary \end{description} \section{Acknowledgements} The Culinary Experimental Research team would like to thank the following: \begin{description} \item[University of Somewhere] For something or other \item[College of Somewhere Else] For providing bread crumbs \item[The Ministry of Top Secret Stuff] For supporting the project somehow. \end{description} \end{document}
(You can download or view this document, and the sample image files dummy-logo.png, mallard.png and goose.png.)
The resulting document is shown in
Figure 10.3
(first sheet) and Figure 10.4 (second sheet).
The small marker line to the right of the first section heading on
the second sheet is the folding mark.
Try this example first without and then with the
twopart
class option.
Although the \AddToBackground
hook adds code to the
picture
environment, if you prefer to use more advanced
image drawing code, such as tikz [102] or
pstricks [117], you can do so.
The preamble code from Example 51 can be modified to use the tikz package. The new preamble is as follows:
\documentclass[a4paper,12pt,notumble]{leaflet} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{Alegreya} \usepackage{wasysym} \usepackage[x11names]{xcolor} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{calc} \renewcommand*{\sectfont}{\scshape} \renewcommand*{\descfont}{\bfseries\scshape} \AddToBackground{1}{% \put (0,0) {\begin{tikzpicture} \path[fill=Thistle1,draw=Thistle4,double=Orchid1,line width=2pt] (0,0) rectangle ($(\paperwidth, \paperheight)-(4pt,4pt)$); \end{tikzpicture} }} \CutLine{6}
The remainder of the document is as before. This uses the
calc
tikz library, which enables co-ordinate
calculations using the $ syntax. For example
($(\paperwidth, \paperheight)-(4pt,4pt)$)
indicates the co-ordinate obtained by subtracting the point
(4 pt,4 pt) from the point
(\paperwidth
,\paperheight
).
The calc library must first be loaded using:
The above example code also loads the xcolor package with the
x11names
option to enable the use of the X11
colour names, such as Thistle1. For further details about
the syntax of the \path
command, see the pgf/tikz
user manual [102]. The first sheet is now as shown in
Figure 10.5.
For other possible fancy frames or decorations, have a look at the decoration topic. There is also a non-CTAN tikz-based package called pgfornament available from http://altermundus.com/pages/tkz/ornament however this will require a manual installation since it's not included in the TeX distributions (recall Volume 1).
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).