Debian Codegraph @

texmf-dist/doc/latex/xtufte/sample-handout.tex

raw
1 %! HV lualatex
2 %! HV xindex
3 %! HV biber
4 %! HV lualatex
5 %! HV lualatex
6
7
8 \begin{filecontents}[overwrite,noheader]{tufte-common-local-before-hyperref.tex}
9 \usepackage{amsmath}
10 \usepackage{graphicx} % allow embedded images
11 \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
12 \graphicspath{{graphics/}} % set of paths to search for images
13 \usepackage{booktabs} % book-quality tables
14 \usepackage{units} % non-stacked fractions and better unit spacing
15 \usepackage{multicol} % multiple column layout facilities
16 \usepackage{lipsum} % filler text
17 \usepackage{fancyvrb} % extended verbatim environments
18 \fvset{fontsize=\normalsize}% default font size for fancy-verbatim environments
19 \usepackage{minted-code}
20 \end{filecontents}
21
22 \documentclass[debug=false,origFonts]{xtufte-handout}
23
24 \addbibresource{sample-handout.bib}
25 \addbibresource[location=remote]{https://mirror.ctan.org/biblio/ctan-bibdata/ctan.bib}
26
27 \title{An Example of the Usage of the Tufte-Handout Style\thanks{Inspired by Edward~R. Tufte!}}
28 \author[The Tufte-LaTeX Developers]{The Tufte-\LaTeX\ Developers
29 and Herbert Voß\thanks{[email protected]}}
30
31 %\date{28 March 2010} % without \date command, current date is supplied
32
33 %\geometry{showframe} % display margins for debugging page layout
34
35
36 % Standardize command font styles and environments
37 \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}%
38 \index{#1@/textbackslash#1}}% command name -- adds backslash automatically
39 \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument
40 \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument
41 \newcommand{\docenv}[1]{\textsf{#1}\index{#1@textsf{#1} (environment)}}% environment name
42 \newcommand{\docpkg}[1]{\texttt{#1}}% package name
43 \newcommand{\doccls}[1]{\texttt{#1}}% document class name
44 \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name
45 \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment
46 \newcommand\xPack[1]{\texttt{#1}\index{#1 (package)}}
47
48 \begin{document}
49
50 \maketitle% this prints the handout title, author, and date
51
52 \begin{abstract}
53 \noindent
54 This document describes the Tufte handout \LaTeX\ document style.
55 It also provides examples and comments on the style's use.
56 Only a brief overview is presented here;
57 for a complete reference, see the sample book.
58 \end{abstract}
59
60 %\printclassoptions
61
62 The Tufte-\LaTeX\ document classes define a style similar to the
63 style Edward Tufte uses in his books and handouts. Tufte's style is known
64 for its extensive use of sidenotes, tight integration of graphics with
65 text, and well-set typography. This document aims to be at once a
66 demonstration of the features of the Tufte-\LaTeX\ document classes
67 and a style guide to their use.
68
69 \section{Page Layout}\label{sec:page-layout}
70 \subsection{Headings}\label{sec:headings}
71 This style provides \textsc{a}- and \textsc{b}-heads (that is,
72 \Verb|\section| and \Verb|\subsection|), demonstrated above.
73
74 The Tufte-\LaTeX\ classes will emit an error if you try to use
75 \linebreak\Verb|\subsubsection| and smaller headings.
76
77 % let's start a new thought -- a new section
78 \newthought{In his later books},\cite{Tufte2006} Tufte
79 starts each section with a bit of vertical space, a non-indented paragraph,
80 and sets the first few words of the sentence in \textsc{small caps}. To
81 accomplish this using this style, use the \Verb|\newthought| command:
82 \begin{docspec}
83 \doccmd{newthought\{In his later books\}, Tufte starts\ldots}
84 \end{docspec}
85
86 \subsection{Sidenotes}\label{sec:sidenotes}
87 One of the most prominent and distinctive features of this style is the
88 extensive use of sidenotes. There is a wide margin to provide ample room
89 for sidenotes and small figures. Any \Verb|\footnote|s will automatically
90 be converted to sidenotes.\footnote{This is a sidenote that was entered
91 using the \texttt{\textbackslash footnote} command.} If you'd like to place ancillary
92 information in the margin without the sidenote mark (the superscript
93 number), you can use the \Verb|\marginnote| command.\marginnote{This is a
94 margin note. Notice that there isn't a number preceding the note, and
95 there is no number in the main text where this note was written.}
96
97 The specification of the \Verb|\sidenote| command is:
98 \begin{docspec}
99 \doccmd{sidenote[\docopt{number}][\docopt{offset}]\{\docarg{Sidenote text.}\}}
100 \end{docspec}
101
102 Both the \docopt{number} and \docopt{offset} arguments are optional. If you
103 provide a \docopt{number} argument, then that number will be used as the
104 sidenote number. It will change of the number of the current sidenote only and
105 will not affect the numbering sequence of subsequent sidenotes.
106
107 Sometimes a sidenote may run over the top of other text or graphics in the
108 margin space. If this happens, you can adjust the vertical position of the
109 sidenote by providing a dimension in the \docopt{offset} argument. Some
110 examples of valid dimensions are:
111 \begin{docspec}
112 \ttfamily 1.0in \qquad 2.54cm \qquad 254mm \qquad 6\Verb|\baselineskip|
113 \end{docspec}
114 If the dimension is positive it will push the sidenote down the page; if the
115 dimension is negative, it will move the sidenote up the page.
116
117 While both the \docopt{number} and \docopt{offset} arguments are optional, they
118 must be provided in order. To adjust the vertical position of the sidenote
119 while leaving the sidenote number alone, use the following syntax:
120 \begin{docspec}
121 \doccmd{sidenote[][\docopt{offset}]\{\docarg{Sidenote text.}\}}
122 \end{docspec}
123 The empty brackets tell the \Verb|\sidenote| command to use the default
124 sidenote number.
125
126 If you \emph{only} want to change the sidenote number, however, you may
127 completely omit the \docopt{offset} argument:
128 \begin{docspec}
129 \doccmd{sidenote[\docopt{number}]\{\docarg{Sidenote text.}\}}
130 \end{docspec}
131
132 The \Verb|\marginnote| command has a similar \docarg{offset} argument:
133 \begin{docspec}
134 \doccmd{marginnote[\docopt{offset}]\{\docarg{Margin note text.}\}}
135 \end{docspec}
136
137 \subsection{References}
138 References are placed alongside their citations as sidenotes,
139 as well. This can be accomplished using the normal \Verb|\cite|
140 command.\sidenote{The first paragraph of this document includes a citation.}
141
142 The complete list of references may also be printed automatically by using
143 the \Verb|\printbibliography| command. (See the end of this document for an
144 example.) If you do not want to print a bibliography at the end of your
145 document, use the \Verb|\nobibliography| command in its place.
146
147 To enter multiple citations at one location,\cite{Tufte2006,Tufte1990} you can
148 provide a list of keys separated by commas and the same optional vertical
149 offset argument: \Verb|\cite{Tufte2006,Tufte1990}|.
150 \begin{docspec}
151 \doccmd{cite[\docopt{offset}]\{\docarg{bibkey1,bibkey2,\ldots}\}}
152 \end{docspec}
153
154 See package \xPack{biblatex} for more citation commands.
155
156 \section{Figures and Tables}\label{sec:figures-and-tables}
157 Images and graphics play an integral role in Tufte's work.
158 In addition to the standard \docenv{figure} and \docenv{tabular} environments,
159 this style provides special figure and table environments for full-width
160 floats.
161
162 Full page--width figures and tables may be placed in \docenv{figure*} or
163 \docenv{table*} environments. To place figures or tables in the margin,
164 use the \docenv{marginfigure} or \docenv{margintable} environments as follows
165 (see figure~\ref{fig:marginfig}):
166
167 \begin{codeblock}[title=A figure in the margin.]
168 \begin{marginfigure}%
169 \includegraphics[width=\linewidth]{helix}
170 \caption{This is a margin figure. The helix is defined by
171 $x = \cos(2\pi z)$, $y = \sin(2\pi z)$, and $z = [0, 2.7]$. The figure was
172 drawn using Asymptote (\url{http://asymptote.sf.net/}).}
173 \label{fig:marginfig}
174 \end{marginfigure}
175 \end{codeblock}
176
177
178 \begin{marginfigure}%
179 \includegraphics[width=\linewidth]{helix}
180 \caption{This is a margin figure. The helix is defined by
181 $x = \cos(2\pi z)$, $y = \sin(2\pi z)$, and $z = [0, 2.7]$. The figure was
182 drawn using Asymptote (\url{http://asymptote.sf.net/}).}
183 \label{fig:marginfig}
184 \end{marginfigure}
185
186 The \docenv{marginfigure} and \docenv{margintable} environments accept an optional parameter \docopt{offset} that adjusts the vertical position of the figure or table. See the ``\nameref{sec:sidenotes}'' section above for examples. The specifications are:
187
188 \begin{codeblock}[title=The syntax of \docenv{marginfigure}.,colback=red!50!yellow!15!white,]
189 \begin{marginfigure}[<offset>]
190 ...
191 \end{marginfigure}
192 ...
193 \begin{margintable}[<offset>]
194 ...
195 \end{margintable}
196 \end{codeblock}
197
198 Figure~\ref{fig:fullfig} is an example of the \Verb|figure*|
199 environment and figure~\ref{fig:textfig} is an example of the normal
200 \Verb|figure| environment.
201
202 \begin{figure*}[!htb]
203 \includegraphics[width=\linewidth]{sine.pdf}%
204 \caption{This graph shows $y = \sin x$ from about $x = [-10, 10]$.
205 \emph{Notice that this figure takes up the full page width.}\label{fig:fullfig}}
206 \end{figure*}
207
208 \begin{figure}
209 \includegraphics{hilbertcurves.pdf}
210 % \checkparity This is an \pageparity\ page.%
211 \caption{Hilbert curves of various degrees $n$.
212 \emph{Notice that this figure only takes up the main textblock width.}\label{fig:textfig}}
213 \setfloatalignment{b}
214 \end{figure}
215
216
217 \begin{codeblock}[title=The syntax of \docenv{marginfigure}.,colback=blue!20]
218 \begin{figure*}[!htb]
219 \includegraphics[width=\linewidth]{sine.pdf}%
220 \caption{This graph shows $y = \sin x$ from about $x = [-10, 10]$.
221 \emph{Notice that this figure takes up the full page width.}}
222 \label{fig:fullfig}%
223 \end{figure*}
224
225 \begin{figure}
226 \includegraphics{hilbertcurves.pdf}
227 % \checkparity This is an \pageparity\ page.%
228 \caption{Hilbert curves of various degrees $n$.
229 \emph{Notice that this figure only takes up the main textblock width.}}
230 \setfloatalignment{b}
231 \label{fig:textfig}
232 \end{figure}
233 \end{codeblock}
234
235
236
237 Table~\ref{tab:normaltab} shows table created with the \docpkg{booktabs}
238 package. Notice the lack of vertical rules---they serve only to clutter
239 the table's data.
240
241 \begin{table}[ht]
242 \centering
243 \fontfamily{ppl}\selectfont
244 \begin{tabular}{ll}
245 \toprule
246 Margin & Length \\
247 \midrule
248 Paper width & \unit[8\nicefrac{1}{2}]{inches} \\
249 Paper height & \unit[11]{inches} \\
250 Textblock width & \unit[6\nicefrac{1}{2}]{inches} \\
251 Textblock/sidenote gutter & \unit[\nicefrac{3}{8}]{inches} \\
252 Sidenote width & \unit[2]{inches} \\
253 \bottomrule
254 \end{tabular}
255 \caption{Here are the dimensions of the various margins used in the Tufte-handout class.}
256 \label{tab:normaltab}
257 %\zsavepos{pos:normaltab}
258 \end{table}
259
260 \section{Full-width text blocks}
261
262 In addition to the new float types, there is a \docenv{fullwidth}
263 environment that stretches across the main text block and the sidenotes
264 area.
265
266 \begin{Verbatim}
267 \begin{fullwidth}
268 Lorem ipsum dolor sit amet...
269 \end{fullwidth}
270 \end{Verbatim}
271
272 \begin{fullwidth}
273 \small\itshape\lipsum[1]
274 \end{fullwidth}
275
276 \section{Typography}\label{sec:typography}
277
278 \subsection{Typefaces}\label{sec:typefaces}
279 If the Palatino, \textsf{Helvetica}, and \texttt{Bera Mono} typefaces are installed, this style
280 will use them automatically. Otherwise, we'll fall back on the Computer Modern
281 typefaces.
282
283 \subsection{Letterspacing}\label{sec:letterspacing}
284 This document class includes two new commands and some improvements on
285 existing commands for letterspacing.
286
287 When setting strings of \allcaps{ALL CAPS} or \smallcaps{small caps}, the
288 letter\-spacing---that is, the spacing between the letters---should be
289 increased slightly.\cite{Bringhurst2005} The \Verb|\allcaps| command has proper letterspacing for
290 strings of \allcaps{FULL CAPITAL LETTERS}, and the \Verb|\smallcaps| command
291 has letterspacing for \smallcaps{small capital letters}. These commands
292 will also automatically convert the case of the text to upper- or
293 lowercase, respectively.
294
295 The \Verb|\textsc| command has also been redefined to include
296 letterspacing. The case of the \Verb|\textsc| argument is left as is,
297 however. This allows one to use both uppercase and lowercase letters:
298 \textsc{The Initial Letters Of The Words In This Sentence Are Capitalized.}
299 And now spaced with \Verb|\textls[60]|:
300 \textls[60]{The Initial Letters Of The Words In This Sentence Are Capitalized.}
301
302
303
304 \section{Installation}\label{sec:installation}
305 To install the Tufte-\LaTeX\ classes, simply drop the
306 following files into the same directory as your \texttt{.tex}
307 file:
308 \begin{quote}
309 \ttfamily
310 tufte-book.cls\\
311 tufte-common.def\\
312 tufte-handout.cls\\
313 tufte.bst
314 \end{quote}
315
316 % TODO add instructions for installing it globally
317
318
319
320 \section{More Documentation}\label{sec:more-doc}
321 For more documentation on the Tufte-\LaTeX{} document classes (including commands not
322 mentioned in this handout), please see the sample book.
323
324 \section{hyperref}\label{sec:hyperref}
325 The optional argument \textsf{nohyperref} allows to deactivate package
326 \xPack{hyperref}.~\parencite{ctan-hyperref} In a lot of cases the package
327 \xPack{hyperref} should be loaded as last package. You can define external files
328
329 \begin{verbatim}
330 tufte-common-local-before-hyperref.tex
331 tufte-common-local-after-hyperref.tex
332 \end{verbatim}
333
334 The contents of these optional files will be loaded before or after \xPack{hyperref}.
335 You can use the environment \docenv{filecontents} to write code into these files on-the-fly.
336 For example for this document:
337
338 \begin{codeblock}[title=Code, der vor hyperref geladen werden soll.]
339 \begin{filecontents}[overwrite,noheader]{tufte-common-local-before-hyperref.tex}
340 \usepackage{amsmath}
341 \usepackage{graphicx} % allow embedded images
342 \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
343 \graphicspath{{graphics/}} % set of paths to search for images
344 \usepackage{booktabs} % book-quality tables
345 \usepackage{units} % non-stacked fractions and better unit spacing
346 \usepackage{multicol} % multiple column layout facilities
347 \usepackage{lipsum} % filler text
348 \usepackage{fancyvrb} % extended verbatim environments
349 \fvset{fontsize=\normalsize}% default font size for fancy-verbatim environments
350 \usepackage{minted-code}
351 \end{filecontents}
352 ...
353 \documentclass[...]{tufte-handout}
354 ...
355 \end{codeblock}
356
357 \section{Support}\label{sec:support}
358
359 The website for the default Tufte-\LaTeX\ packages is located at
360 \url{http://code.google.com/p/tufte-latex/}. On this website, you'll find
361 links to the \smallcaps{svn} repository, mailing lists, bug tracker, and documentation.
362
363 Questions or problems to the \XeLaTeX/\LuaLaTeX-version write to
364 \url{mailto:[email protected]}.
365
366
367 \printbibliography
368
369 \printindex
370
371
372 \end{document}