- LaTeX Cookbook
- Stefan Kottwitz
- 1257字
- 2021-07-09 21:24:58
Producing a leaflet
Flyers are a common way to promote an event or to inform about a product. In particular, a folded leaflet is very handy as a giveaway and to carry around, so let's see how to produce one.
How to do it...
The intended layout is very different compared to the already shown document types. Fortunately, there's a document class for it with the name leaflet
, which we will use now. Let's start filling it with some content. Let's take a look at the following steps:
- Start with the
leaflet
document class. Choose a base font size of 10 pt, and set the optionnotumble
, which keeps the back side printed in the same direction:\documentclass[10pt,notumble]{leaflet}
- Use an extended font encoding:
\usepackage[T1]{fontenc}
- If you want a nondefault font, load it, this time we chose the Linux Libertine font:
\usepackage{libertine}
- Switch to sans serif as the default font family:
\renewcommand{\familydefault}{\sfdefault}
- For better text justification, load the
microtype
package:\usepackage{microtype}
- Load the
graphicx
package to include a picture:\usepackage{graphicx}
- Switch off the page numbering:
\pagenumbering{gobble}
- Begin the document:
\begin{document}
- Set the title, author's name, and date. Then, print the title:
\title{\textbf{\TeX\ Live Install Party}} \author{\Large\textbf{Your \TeX\ team}} \date{\textbf{August 11, City Hall Cellar}} \maketitle
- Include a centered image. Here, we chose the CTAN lion:
\begin{center} \includegraphics[width=\linewidth]{ctanlion.pdf} \end{center}
- Add some text:
We'd like to welcome you to our famous yearly \TeX\ install party! Bring your laptop and have free cold soft drinks while we assist you in installing the latest \TeX\ version on your computer. We will provide
- A bulleted list can be a good idea for a catchy text. Use an
itemize
environment for it, each list item starting with\item
:\begin{itemize} \item a fast internet connection fow downloading, \item media such as DVDs and USB sticks with the latest \TeX\, \item \TeX\ books for bying with a discount, \item chat with \TeX\ experts. \end{itemize}
- End the page. Fill in more text on the next page of the leaflet, which will be printed on the back side of the paper, next to each other:
\clearpage Fill in text for page 2 (on the back side) \clearpage Fill in text for page 3 (on the back side) \clearpage Fill in text for page 4 (on the back side) \clearpage
- Now, pages 5 and 6 of the leaflet come to the front side of the paper. Use the
\section
command to insert a heading:\section{Schedule}
- You can add a timetable using a
tabular
environment. Using the@{}
option, we suppress spacing at the left and right:\begin{tabular}{@{}rl@{}} 6 pm & Welcome \\ 7:30 pm & Live install presentation \\ 8 pm & Book authors available for talks and signing \\ 9:30 pm & Bar closing \end{tabular}
- End the paragraph with an empty line, continue writing the text, and finally end the document:
From 6pm to 10pm: install support and free \TeX\ copies on DVD on our welcome desk. \section{Accomodation} Hotel, Meals, Travel information here \section{Sponsors} Information about our local \TeX\ user group and Open Source projects sponsor \clearpage \section{Contact} Names, Phone numbers, email addresses \end{document}
- Compile and take a look at the first page:
The back side still contains just some dummy text, which helps to identify the position where the text finally lands on the page.
How it works...
In the first line, we loaded the leaflet
package with a font size of 10 pt. The notumble
option suppresses the default behavior, that is, printing the back side upside down.
The next three lines contain our font settings. We used the Linux Libertine font and specified the T1
font encoding. You can read more about encodings in Chapter 2, Tuning the Text, specifically in the Improving justification and hyphenation recipe. Furthermore, we set the default font family to be sans serif. I prefer the clean look of sans serif on a flyer or a leaflet, which usually contains little text.
The remaining part of the preamble is as follows:
- We loaded the
microtype
package, which improves the justification capabilities with tiny font adjustments. This is especially useful in a situation with narrow columns, such as in this case. - We loaded the
graphicx
package, so we are able to include images such as a logo or a geographic map. - We hid the page numbers. The
\gobble
command is a TeX command that removes the following command or control sequence, so the page number will simply be absorbed.
Our document body shows usual sectioning commands and text. You can see that we added an explicit space after the TeX logo by inserting a backslash and a following space. That's because the space after a macro, such as the \TeX
command, just indicates the end of the macro. It doesn't produce a space in print because punctuation may follow the macro.
To have an image in our template, we used the CTAN lion drawn by Duane Bibby; simply replace it with your own image, for example, a geographic map or logo.
The remaining text is straightforward and shows some useful layout details, as follows:
- Centering using the
center
environment:\begin{center} ... \end{center}
- Arranging points in a bulleted list using an
itemize
environment - Setting up a
tabular
environment for text, which should be aligned in columns
In the \begin{tabular}{@{}rl@{}}
line, the characters rl
stand for two columns, where the first one is right aligned and the second one is left aligned. The expression @{code}
inserts a piece of code instead of the space before or after the column, so @{}
replaces it with nothing, that means, removes it. We got two columns without additional whitespaces on the left or right, saving our previous line space.
There's more...
The leaflet
class provides some options and commands for customization.
By default, a small folding mark is printed on the back side. If you would like to omit it, add the nofoldmark
option when loading the class:
\documentclass[10pt,notumble,nofoldmark]{leaflet}
You can draw a vertically dotted line with a scissors symbol using the \CutLine
command in the preamble with a page number as an argument. The line will go between this one and the preceding page, which is as follows:
\CutLine{3}
This will print a dotted line with two scissors symbols on the back side, between pages 2 and 3, where a folding mark will be placed by default. The starred command version \CutLine*
will not print the scissors.
Similar to standard classes, you can use page headers and footers. There are none by default here. Standard commands such as \setlength{\headheight}{…}
and \pagestyle
can be used. The leaflet
provides an additional command to declare the margins:
\setmargins{top}{bottom}{left}{right}
You can add an image to the background of a certain page:
\AddToBackground{pagenumber}{\includegraphics{filename}}
Use the starred version \AddToBackground*
to allow it to be printed in the background of the combined page.
Instead of the \includegraphics
command, you can use other positioning commands, including our drawing code. Here, the Absolute positioning of text recipe in Chapter 2, Tuning the Text, will be useful.
The font size of section headers is already a bit smaller than that of standard classes. If you would like to change the size, shape, or color of the headings, you can redefine the \sectfont
macro. For example, if we enable using color with the \usepackage{xcolor}
command, we can write the following line of code:
\renewcommand{\sectfont}{\large\sffamily\bfseries\color{blue}}
This will give a large sans serif font in bold and with blue color.
For further information regarding fonts, refer to Chapter 3, Adjusting Fonts.
- Flutter開發實戰詳解
- Building a Home Security System with Raspberry Pi
- Java應用開發與實踐
- jQuery EasyUI網站開發實戰
- Vue.js快跑:構建觸手可及的高性能Web應用
- Python高級機器學習
- Python機器學習實戰
- Learning DHTMLX Suite UI
- Android玩家必備
- 零基礎Java學習筆記
- IBM Cognos Business Intelligence 10.1 Dashboarding cookbook
- 網絡數據采集技術:Java網絡爬蟲實戰
- Microsoft HoloLens By Example
- Yii2 By Example
- 零基礎學SQL(升級版)