-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpagelayout.tex
231 lines (212 loc) · 7.23 KB
/
pagelayout.tex
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
\chapter{Layout}
\section{Justification and alignment}
\LaTeX{} justifies text remarkably well.
Instead of arranging it one line at a time---like most word processors,
web browsers, and e-readers do---it considers every possible line break
in a paragraph, then picks the ones that give the best overall
spacing.\punckern\endnote{Donald E.~Knuth and Michael F.~Plass,
\textit{Breaking Paragraphs Into Lines} (Stanford, 1981)}
Combined with automatic hyphenation,
which permits line breaks in the middle of words,\punckern\endnote{%
Franklin Mark Liang,
\textit{Word Hy-phen-a-tion by Com-put-er} (Stanford, 1983),
\http{www.tug.org/docs/liang/}}
it can produce better paragraph layouts than almost any other software.
But sometimes we don't want justified text.
If you would like it to be flush left,
place it in a \texttt{flushleft} environment
or add \verb|\raggedright| to the current group.
To center it, place it in a
\texttt{center} environment or add \verb|\centering| to the current group.
And to flush it against the right margin,
use a \texttt{flushright} environment or \verb|\raggedleft|.
\begin{leftfigure}
\begin{lstlisting}
\begin{flushleft}
This text is flush left, with a ragged right edge.
Some prefer this layout since the space between words
is more consistent than it is in justified text.
\end{flushleft}
\begin{center}
This text is centered.
\end{center}
\begin{flushright}
And this text is flush right.
\end{flushright}
\end{lstlisting}
\end{leftfigure}
sets
\begin{flushleftfigure}
\begin{minipage}{0.99\textwidth}
\lm%
\begin{flushleft}
This text is flush left, with a ragged right edge.
Some prefer this layout since the space between words
is more consistent than it is in justified text.
\end{flushleft}
\begin{center}
This text is centered.
\end{center}
\begin{flushright}
And this text is flush right.
\end{flushright}
\end{minipage}
\end{flushleftfigure}
\section{Lists}
\LaTeX{} provides several environments for creating lists:
\texttt{itemize}, \texttt{enumerate}, and \texttt{description}.
In all three, each item starts with an \verb|\item| command.
To create bulleted lists, use the \texttt{itemize} environment.
With
\begin{leftfigure}
\begin{lstlisting}
\begin{itemize}
\item 5.56 millimeter
\item 9 millimeter
\item 7.62 millimeter
\end{itemize}
\end{lstlisting}
\end{leftfigure}
you get
\begin{leftfigure}
\lm%
\begin{itemize}[leftmargin=*]
\item 5.56 millimeter
\item 9 millimeter
\item 7.62 millimeter
\end{itemize}
\end{leftfigure}
\bigskip
\noindent \texttt{enumerate} numbers its lists:
\begin{leftfigure}
\begin{lstlisting}
\begin{enumerate}
\item Collect underpants
\item ?
\item Profit
\end{enumerate}
\end{lstlisting}
\end{leftfigure}
which gives
\begin{leftfigure}
\lm%
\begin{enumerate}[leftmargin=*]
\item Collect underpants
\item ?
\item Profit
\end{enumerate}
\end{leftfigure}
\bigskip
\noindent The \texttt{description} environment starts each item with some
emphasized label,
then indents subsequent lines for that item:
\begin{leftfigure}
\begin{lstlisting}
\begin{description}
\item[Alan Turing] was a British mathematician who
laid much of the groundwork for computer science.
He is perhaps most remembered for his model of
computation, the Turing machine.
\item[Edsger Dijkstra] was a Dutch computer scientist.
His work in many domains---such as concurrency and
graph theory---are still in wide use.
\item[Leslie Lamport] is an American computer scientist.
He defined the concept of sequential consistency,
which is used to safely communicate between tasks
running in parallel.
\end{description}
\end{lstlisting}
\end{leftfigure}
gives us
\begin{leftfigure}
\lm%
\begin{description}
\item[\lm Alan Turing] was a British mathematician who
laid much of the groundwork for computer science.
He is perhaps most remembered for his model of computation,
the Turing machine.
\item[\lm Edsger Dijkstra] was a Dutch computer scientist.
His work in many domains---such as concurrency and
graph theory---are still in wide use.
\item[\lm Leslie Lamport] is an American computer scientist.
He defined the concept of sequential consistency,
which is used to safely communicate between tasks
running in parallel.
\end{description}
\end{leftfigure}
\section{Columns}
We often split pages into several columns, especially when printing on
\textsc{a4} or \acronym{us}~\textsc{l}etter paper,
since it provides more comfortable line widths with standard
8--12\,pt text sizes.\punckern\footnote{You will find different advice depending
on where you look, but as a rule of thumb,
aim for 45 to 80 characters (including spaces) per line.
If a line is too long, readers have an uncomfortable time scanning for
the start of the next one.
If a line is too short, it doesn't have much inter-word spacing to adjust,
which can lead to odd gaps or excessive hyphenation.}
You can either add the \texttt{twocolumn} option to your document class,
which splits everything in two, or you can use the \texttt{multicols}
environment from the \texttt{multicol} package:
\begin{leftfigure}
\begin{lstlisting}
One nice feature of the \texttt{multicol} package
is that you can combine arbitrary layouts.
\begin{multicols}{2}
This example starts with one column,
then sets the following section as two.
The \texttt{multicols} environment splits the text
inside it so that each column is about the same height.
\end{multicols}
\end{lstlisting}
\end{leftfigure}
arranges
\begin{leftfigure}
\lm%
One nice feature of the {\lt multicol} package
is that you can combine arbitrary layouts.
\begin{multicols}{2}
This example starts with one column,
then sets the following section as two.
The \mbox{\lt multicols} environment splits the text
inside it so that each column is about the same height.
\end{multicols}
\end{leftfigure}
\section{Page breaks}
Some commands, like \verb|\chapter|, insert page breaks.
You can add your own with \verb|\clearpage|.
When using the \texttt{twoside} document class option for double-sided
printing, you can break to the front of the next page with
\verb|\cleardoublepage|.
\section{Footnotes}
Footnotes are useful for references,
or for remarks that readers might find helpful
but aren't crucial to the main text.
The \verb|\footnote| command places a marker at its location in the
body text, then sets its argument at the bottom of the current
page:
\begin{leftfigure}
\begin{lstlisting}
I love footnotes!\footnote{Perhaps a bit too much\dots}
\end{lstlisting}
\end{leftfigure}
proclaims
\begin{leftfigure}
\lm%
I love footnotes!\footnote{Perhaps a bit too much\dots}
\end{leftfigure}
\exercises{}
\begin{itemize}
\item Control paragraph spacing with KOMA~Script or the \texttt{parskip} package.
\item Set the page size and margins with the \texttt{geometry} package.
\item Customize list formatting with the \texttt{enumitem} package.
\item Create tables with the \texttt{tabular} environment.
\item Align text with tab stops using the \texttt{tabbing} environment.
\item Customize footnote symbols and layout with the \texttt{footmisc} package
and KOMA~Script.
\item Insert horizontal and vertical space with commands like
\verb|\vspace|, \verb|\hspace|, \verb|\vfill|, and \verb|\hfill|.
\item Learn what units \LaTeX{} provides to measure space. \\
(We've already mentioned a few here, like
\texttt{pt}, \texttt{bp}, and \texttt{in}.)
\end{itemize}