Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

1037 lines
41KB

  1. \documentclass{tufte-book}
  2. \hypersetup{colorlinks}% uncomment this line if you prefer colored hyperlinks (e.g., for onscreen viewing)
  3. %%
  4. % Book metadata
  5. \title{A Tufte-Style Book\thanks{Thanks to Edward R.~Tufte for his inspiration.}}
  6. \author[The Tufte-LaTeX Developers]{The Tufte-LaTeX\ Developers}
  7. \publisher{Publisher of This Book}
  8. %%
  9. % If they're installed, use Bergamo and Chantilly from www.fontsite.com.
  10. % They're clones of Bembo and Gill Sans, respectively.
  11. %\IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo
  12. %\IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans
  13. %\usepackage{microtype}
  14. %%
  15. % Just some sample text
  16. \usepackage{lipsum}
  17. %%
  18. % For nicely typeset tabular material
  19. \usepackage{booktabs}
  20. %%
  21. % For graphics / images
  22. \usepackage{graphicx}
  23. \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
  24. \graphicspath{{graphics/}}
  25. % The fancyvrb package lets us customize the formatting of verbatim
  26. % environments. We use a slightly smaller font.
  27. \usepackage{fancyvrb}
  28. \fvset{fontsize=\normalsize}
  29. %%
  30. % Prints argument within hanging parentheses (i.e., parentheses that take
  31. % up no horizontal space). Useful in tabular environments.
  32. \newcommand{\hangp}[1]{\makebox[0pt][r]{(}#1\makebox[0pt][l]{)}}
  33. %%
  34. % Prints an asterisk that takes up no horizontal space.
  35. % Useful in tabular environments.
  36. \newcommand{\hangstar}{\makebox[0pt][l]{*}}
  37. %%
  38. % Prints a trailing space in a smart way.
  39. \usepackage{xspace}
  40. %%
  41. % Some shortcuts for Tufte's book titles. The lowercase commands will
  42. % produce the initials of the book title in italics. The all-caps commands
  43. % will print out the full title of the book in italics.
  44. \newcommand{\vdqi}{\textit{VDQI}\xspace}
  45. \newcommand{\ei}{\textit{EI}\xspace}
  46. \newcommand{\ve}{\textit{VE}\xspace}
  47. \newcommand{\be}{\textit{BE}\xspace}
  48. \newcommand{\VDQI}{\textit{The Visual Display of Quantitative Information}\xspace}
  49. \newcommand{\EI}{\textit{Envisioning Information}\xspace}
  50. \newcommand{\VE}{\textit{Visual Explanations}\xspace}
  51. \newcommand{\BE}{\textit{Beautiful Evidence}\xspace}
  52. \newcommand{\TL}{Tufte-\LaTeX\xspace}
  53. % Prints the month name (e.g., January) and the year (e.g., 2008)
  54. \newcommand{\monthyear}{%
  55. \ifcase\month\or January\or February\or March\or April\or May\or June\or
  56. July\or August\or September\or October\or November\or
  57. December\fi\space\number\year
  58. }
  59. % Prints an epigraph and speaker in sans serif, all-caps type.
  60. \newcommand{\openepigraph}[2]{%
  61. %\sffamily\fontsize{14}{16}\selectfont
  62. \begin{fullwidth}
  63. \sffamily\large
  64. \begin{doublespace}
  65. \noindent\allcaps{#1}\\% epigraph
  66. \noindent\allcaps{#2}% author
  67. \end{doublespace}
  68. \end{fullwidth}
  69. }
  70. % Inserts a blank page
  71. \newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}
  72. \usepackage{units}
  73. % Typesets the font size, leading, and measure in the form of 10/12x26 pc.
  74. \newcommand{\measure}[3]{#1/#2$\times$\unit[#3]{pc}}
  75. % Macros for typesetting the documentation
  76. \newcommand{\hlred}[1]{\textcolor{Maroon}{#1}}% prints in red
  77. \newcommand{\hangleft}[1]{\makebox[0pt][r]{#1}}
  78. \newcommand{\hairsp}{\hspace{1pt}}% hair space
  79. \newcommand{\hquad}{\hskip0.5em\relax}% half quad space
  80. \newcommand{\TODO}{\textcolor{red}{\bf TODO!}\xspace}
  81. \newcommand{\ie}{\textit{i.\hairsp{}e.}\xspace}
  82. \newcommand{\eg}{\textit{e.\hairsp{}g.}\xspace}
  83. \newcommand{\na}{\quad--}% used in tables for N/A cells
  84. \providecommand{\XeLaTeX}{X\lower.5ex\hbox{\kern-0.15em\reflectbox{E}}\kern-0.1em\LaTeX}
  85. \newcommand{\tXeLaTeX}{\XeLaTeX\index{XeLaTeX@\protect\XeLaTeX}}
  86. % \index{\texttt{\textbackslash xyz}@\hangleft{\texttt{\textbackslash}}\texttt{xyz}}
  87. \newcommand{\tuftebs}{\symbol{'134}}% a backslash in tt type in OT1/T1
  88. \newcommand{\doccmdnoindex}[2][]{\texttt{\tuftebs#2}}% command name -- adds backslash automatically (and doesn't add cmd to the index)
  89. \newcommand{\doccmd}[2][]{%
  90. \texttt{\tuftebs#2}%
  91. \ifthenelse{\isempty{#1}}%
  92. {% add the command to the index
  93. \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2}}% command name
  94. }%
  95. {% add the command the and package to the index
  96. \index{#2 command@\protect\hangleft{\texttt{\tuftebs}}\texttt{#2} (\texttt{#1} package)}% command name
  97. \index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}% package name
  98. }
  99. }% command name -- adds backslash automatically
  100. \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument
  101. \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument
  102. \newenvironment{docspec}{\begin{quotation}\ttfamily\parskip0pt\parindent0pt\ignorespaces}{\end{quotation}}% command specification environment
  103. \newcommand{\docenv}[1]{\texttt{#1}\index{#1 environment@\texttt{#1} environment}\index{environments!#1@\texttt{#1}}}% environment name
  104. \newcommand{\docpkg}[1]{\texttt{#1}\index{#1 package@\texttt{#1} package}\index{packages!#1@\texttt{#1}}}% package name
  105. \newcommand{\doccls}[1]{\texttt{#1}}% document class name
  106. \newcommand{\docclsopt}[1]{\texttt{#1}\index{#1 class option@\texttt{#1} class option}\index{class options!#1@\texttt{#1}}}% document class option name
  107. \newcommand{\docmsg}[2]{\bigskip\begin{fullwidth}\noindent\ttfamily#1\end{fullwidth}\medskip\par\noindent#2}
  108. \newcommand{\docfilehook}[2]{\texttt{#1}\index{file hooks!#2}\index{#1@\texttt{#1}}}
  109. \newcommand{\doccounter}[1]{\texttt{#1}\index{#1 counter@\texttt{#1} counter}}
  110. % Generates the index
  111. \usepackage{makeidx}
  112. \makeindex
  113. \begin{document}
  114. % Front matter
  115. \frontmatter
  116. % r.1 blank page
  117. \blankpage
  118. % v.2 epigraphs
  119. \newpage\thispagestyle{empty}
  120. \openepigraph{%
  121. The public is more familiar with bad design than good design.
  122. It is, in effect, conditioned to prefer bad design,
  123. because that is what it lives with.
  124. The new becomes threatening, the old reassuring.
  125. }{Paul Rand%, {\itshape Design, Form, and Chaos}
  126. }
  127. \vfill
  128. \openepigraph{%
  129. A designer knows that he has achieved perfection
  130. not when there is nothing left to add,
  131. but when there is nothing left to take away.
  132. }{Antoine de Saint-Exup\'{e}ry}
  133. \vfill
  134. \openepigraph{%
  135. \ldots the designer of a new system must not only be the implementor and the first
  136. large-scale user; the designer should also write the first user manual\ldots
  137. If I had not participated fully in all these activities,
  138. literally hundreds of improvements would never have been made,
  139. because I would never have thought of them or perceived
  140. why they were important.
  141. }{Donald E. Knuth}
  142. % r.3 full title page
  143. \maketitle
  144. % v.4 copyright page
  145. \newpage
  146. \begin{fullwidth}
  147. ~\vfill
  148. \thispagestyle{empty}
  149. \setlength{\parindent}{0pt}
  150. \setlength{\parskip}{\baselineskip}
  151. Copyright \copyright\ \the\year\ \thanklessauthor
  152. \par\smallcaps{Published by \thanklesspublisher}
  153. \par\smallcaps{tufte-latex.googlecode.com}
  154. \par Licensed under the Apache License, Version 2.0 (the ``License''); you may not
  155. use this file except in compliance with the License. You may obtain a copy
  156. of the License at \url{http://www.apache.org/licenses/LICENSE-2.0}. Unless
  157. required by applicable law or agreed to in writing, software distributed
  158. under the License is distributed on an \smallcaps{``AS IS'' BASIS, WITHOUT
  159. WARRANTIES OR CONDITIONS OF ANY KIND}, either express or implied. See the
  160. License for the specific language governing permissions and limitations
  161. under the License.\index{license}
  162. \par\textit{First printing, \monthyear}
  163. \end{fullwidth}
  164. % r.5 contents
  165. \tableofcontents
  166. \listoffigures
  167. \listoftables
  168. % r.7 dedication
  169. \cleardoublepage
  170. ~\vfill
  171. \begin{doublespace}
  172. \noindent\fontsize{18}{22}\selectfont\itshape
  173. \nohyphenation
  174. Dedicated to those who appreciate \LaTeX{}
  175. and the work of \mbox{Edward R.~Tufte}
  176. and \mbox{Donald E.~Knuth}.
  177. \end{doublespace}
  178. \vfill
  179. \vfill
  180. % r.9 introduction
  181. \cleardoublepage
  182. \chapter*{Introduction}
  183. This sample book discusses the design of Edward Tufte's
  184. books\cite{Tufte2001,Tufte1990,Tufte1997,Tufte2006}
  185. and the use of the \doccls{tufte-book} and \doccls{tufte-handout} document classes.
  186. %%
  187. % Start the main matter (normal chapters)
  188. \mainmatter
  189. \chapter{The Design of Tufte's Books}
  190. \label{ch:tufte-design}
  191. \newthought{The pages} of a book are usually divided into three major
  192. sections: the front matter (also called preliminary matter or prelim), the
  193. main matter (the core text of the book), and the back matter (or end
  194. matter).
  195. \newthought{The front matter} of a book refers to all of the material that
  196. comes before the main text. The following table from shows a list of
  197. material that appears in the front matter of \VDQI, \EI, \VE, and \BE
  198. along with its page number. Page numbers that appear in parentheses refer
  199. to folios that do not have a printed page number (but they are still
  200. counted in the page number sequence).
  201. \bigskip
  202. \begin{minipage}{\textwidth}
  203. \begin{center}
  204. \begin{tabular}{lcccc}
  205. \toprule
  206. & \multicolumn{4}{c}{Books} \\
  207. \cmidrule(l){2-5}
  208. Page content & \vdqi & \ei & \ve & \be \\
  209. \midrule
  210. Blank half title page & \hangp{1} & \hangp{1} & \hangp{1} & \hangp{1} \\
  211. Frontispiece\footnotemark{}
  212. & \hangp{2} & \hangp{2} & \hangp{2} & \hangp{2} \\
  213. Full title page & \hangp{3} & \hangp{3} & \hangp{3} & \hangp{3} \\
  214. Copyright page & \hangp{4} & \hangp{4} & \hangp{4} & \hangp{4} \\
  215. Contents & \hangp{5} & \hangp{5} & \hangp{5} & \hangp{5} \\
  216. %Blank & -- & \hangp{6} & \hangp{6} & \hangp{6} \\
  217. Dedication & \hangp{6} & \hangp{7} & \hangp{7} & 7 \\
  218. %Blank & -- & \hangp{8} & -- & \hangp{8} \\
  219. Epigraph & -- & -- & \hangp{8} & -- \\
  220. Introduction & \hangp{7} & \hangp{9} & \hangp{9} & 9 \\
  221. \bottomrule
  222. \end{tabular}
  223. \end{center}
  224. \end{minipage}
  225. \vspace{-7\baselineskip}\footnotetext{The contents of this page vary from book to book. In
  226. \vdqi this page is blank; in \ei and \ve this page holds a frontispiece;
  227. and in \be this page contains three epigraphs.}
  228. \vspace{7\baselineskip}
  229. \bigskip
  230. The design of the front matter in Tufte's books varies slightly from the
  231. traditional design of front matter. First, the pages in front matter are
  232. traditionally numbered with lowercase roman numerals (\eg, i, ii, iii,
  233. iv,~\ldots). Second, the front matter page numbering sequence is usually
  234. separate from the main matter page numbering. That is, the page numbers
  235. restart at 1 when the main matter begins. In contrast, Tufte has
  236. enumerated his pages with arabic numerals that share the same page counting
  237. sequence as the main matter.
  238. There are also some variations in design across Tufte's four books. The
  239. page opposite the full title page (labeled ``frontispiece'' in the above
  240. table) has different content in each of the books. In \VDQI, this page is
  241. blank; in \EI and \VE, this page holds a frontispiece; and in \BE, this
  242. page contains three epigraphs.
  243. The dedication appears on page~6 in \vdqi (opposite the introduction), and
  244. is placed on its own spread in the other books. In \ve, an epigraph shares
  245. the spread with the opening page of the introduction.
  246. None of the page numbers (folios) of the front matter are expressed except in
  247. \be, where the folios start to appear on the dedication page.
  248. \newthought{The full title page} of each of the books varies slightly in
  249. design. In all the books, the author's name appears at the top of the
  250. page, the title it set just above the center line, and the publisher is
  251. printed along the bottom margin. Some of the differences are outlined in
  252. the following table.
  253. \bigskip
  254. \begin{center}
  255. \footnotesize
  256. \begin{tabular}{lllll}
  257. \toprule
  258. Feature & \vdqi & \ei & \ve & \be \\
  259. \midrule
  260. Author & & & & \\
  261. \quad Typeface & serif & serif & serif & sans serif \\
  262. \quad Style & italics & italics & italics & upright, caps \\
  263. \quad Size & 24 pt & 20 pt & 20 pt & 20 pt \\
  264. \addlinespace
  265. Title & & & & \\
  266. \quad Typeface & serif & serif & serif & sans serif \\
  267. \quad Style & upright & italics & upright & upright, caps \\
  268. \quad Size & 36 pt & 48 pt & 48 pt & 36 pt \\
  269. \addlinespace
  270. Subtitle & & & & \\
  271. \quad Typeface & \na & \na & serif & \na \\
  272. \quad Style & \na & \na & upright & \na \\
  273. \quad Size & \na & \na & 20 pt & \na \\
  274. \addlinespace
  275. Edition & & & & \\
  276. \quad Typeface & sans serif & \na & \na & \na \\
  277. \quad Style & upright, caps & \na & \na & \na \\
  278. \quad Size & 14 pt & \na & \na & \na \\
  279. \addlinespace
  280. Publisher & & & & \\
  281. \quad Typeface & serif & serif & serif & sans serif \\
  282. \quad Style & italics & italics & italics & upright, caps \\
  283. \quad Size & 14 pt & 14 pt & 14 pt & 14 pt \\
  284. \bottomrule
  285. \end{tabular}
  286. \end{center}
  287. \begin{figure*}[p]
  288. \fbox{\includegraphics[width=0.45\linewidth]{graphics/vdqi-title.pdf}}
  289. \hfill
  290. \fbox{\includegraphics[width=0.45\linewidth]{graphics/ei-title.pdf}}
  291. \\\vspace{\baselineskip}
  292. \fbox{\includegraphics[width=0.45\linewidth]{graphics/ve-title.pdf}}
  293. \hfill
  294. \fbox{\includegraphics[width=0.45\linewidth]{graphics/be-title.pdf}}
  295. \end{figure*}
  296. \newthought{The tables of contents} in Tufte's books give us our first
  297. glimpse of the structure of the main matter. \VDQI is split into two
  298. parts, each containing some number of chapters. His other three books only
  299. contain chapters---they're not broken into parts.
  300. \begin{figure*}[p]\index{table of contents}
  301. \fbox{\includegraphics[width=0.45\linewidth]{graphics/vdqi-contents.pdf}}
  302. \hfill
  303. \fbox{\includegraphics[width=0.45\linewidth]{graphics/ei-contents.pdf}}
  304. \\\vspace{\baselineskip}
  305. \fbox{\includegraphics[width=0.45\linewidth]{graphics/ve-contents.pdf}}
  306. \hfill
  307. \fbox{\includegraphics[width=0.45\linewidth]{graphics/be-contents.pdf}}
  308. \end{figure*}
  309. \section{Typefaces}\label{sec:typefaces1}\index{typefaces}
  310. \index{fonts|see{typefaces}}
  311. Tufte's books primarily use two typefaces: Bembo and Gill Sans. Bembo is used
  312. for the headings and body text, while Gill Sans is used for the title page and
  313. opening epigraphs in \BE.
  314. Since neither Bembo nor Gill Sans are available in default \LaTeX{}
  315. installations, the \TL document classes default to using Palatino and
  316. Helvetica, respectively. In addition, the Bera Mono typeface is used for
  317. \texttt{monospaced} type.
  318. The following font sizes are defined by the \TL classes:
  319. \begin{table}[h]\index{typefaces!sizes}
  320. \footnotesize%
  321. \begin{center}
  322. \begin{tabular}{lccl}
  323. \toprule
  324. \LaTeX{} size & Font size & Leading & Used for \\
  325. \midrule
  326. \verb+\tiny+ & 5 & 6 & sidenote numbers \\
  327. \verb+\scriptsize+ & 7 & 8 & \na \\
  328. \verb+\footnotesize+ & 8 & 10 & sidenotes, captions \\
  329. \verb+\small+ & 9 & 12 & quote, quotation, and verse environments \\
  330. \verb+\normalsize+ & 10 & 14 & body text \\
  331. \verb+\large+ & 11 & 15 & \textsc{b}-heads \\
  332. \verb+\Large+ & 12 & 16 & \textsc{a}-heads, \textsc{toc} entries, author, date \\
  333. \verb+\LARGE+ & 14 & 18 & handout title \\
  334. \verb+\huge+ & 20 & 30 & chapter heads \\
  335. \verb+\Huge+ & 24 & 36 & part titles \\
  336. \bottomrule
  337. \end{tabular}
  338. \end{center}
  339. \caption{A list of \LaTeX{} font sizes as defined by the \TL document classes.}
  340. \label{tab:font-sizes}
  341. \end{table}
  342. \section{Headings}\label{sec:headings1}\index{headings}
  343. Tufte's books include the following heading levels: parts,
  344. chapters,\sidenote{Parts and chapters are defined for the \texttt{tufte-book}
  345. class only.} sections, subsections, and paragraphs. Not defined by default
  346. are: sub-subsections and subparagraphs.
  347. \begin{table}[h]
  348. \begin{center}
  349. \footnotesize%
  350. \begin{tabular}{lcr}
  351. \toprule
  352. Heading & Style & Size \\
  353. \midrule
  354. Part & roman & \measure{24}{36}{40} \\
  355. Chapter & italic & \measure{20}{30}{40} \\
  356. Section & italic & \measure{12}{16}{26} \\
  357. Subsection & italic & \measure{11}{15}{26} \\
  358. Paragraph & italic & 10/14 \\
  359. \bottomrule
  360. \end{tabular}
  361. \end{center}
  362. \caption{Heading styles used in \BE.}
  363. \label{tab:heading-styles}
  364. \end{table}
  365. \paragraph{Paragraph} Paragraph headings (as shown here) are introduced by
  366. italicized text and separated from the main paragraph by a bit of space.
  367. \section{Environments}
  368. The following characteristics define the various environments:
  369. \begin{table}[h]
  370. \begin{center}
  371. \footnotesize%
  372. \begin{tabular}{lcl}
  373. \toprule
  374. Environment & Font size & Notes \\
  375. \midrule
  376. Body text & \measure{10}{14}{26} & \\
  377. Block quote & \measure{9}{12}{24} & Block indent (left and right) by \unit[1]{pc} \\
  378. Sidenotes & \measure{8}{10}{12} & Sidenote number is set inline, followed by word space \\
  379. Captions & \measure{8}{10}{12} & \\
  380. \bottomrule
  381. \end{tabular}
  382. \end{center}
  383. \caption{Environment styles used in \BE.}
  384. \label{tab:environment-styles}
  385. \end{table}
  386. \chapter[On the Use of the tufte-book Document Class]{On the Use of the \texttt{tufte-book} Document Class}
  387. \label{ch:tufte-book}
  388. The \TL document classes define a style similar to the
  389. style Edward Tufte uses in his books and handouts. Tufte's style is known
  390. for its extensive use of sidenotes, tight integration of graphics with
  391. text, and well-set typography. This document aims to be at once a
  392. demonstration of the features of the \TL document classes
  393. and a style guide to their use.
  394. \section{Page Layout}\label{sec:page-layout}
  395. \subsection{Headings}\label{sec:headings}\index{headings}
  396. This style provides \textsc{a}- and \textsc{b}-heads (that is,
  397. \Verb|\section| and \Verb|\subsection|), demonstrated above.
  398. If you need more than two levels of section headings, you'll have to define
  399. them yourself at the moment; there are no pre-defined styles for anything below
  400. a \Verb|\subsection|. As Bringhurst points out in \textit{The Elements of
  401. Typographic Style},\cite{Bringhurst2005} you should ``use as many levels of
  402. headings as you need: no more, and no fewer.''
  403. The \TL classes will emit an error if you try to use
  404. \linebreak\Verb|\subsubsection| and smaller headings.
  405. % let's start a new thought -- a new section
  406. \newthought{In his later books},\cite{Tufte2006} Tufte
  407. starts each section with a bit of vertical space, a non-indented paragraph,
  408. and sets the first few words of the sentence in \textsc{small caps}. To
  409. accomplish this using this style, use the \hlred{\doccmd{newthought}} command:
  410. \begin{docspec}
  411. \doccmd{newthought}\{In his later books\}, Tufte starts\ldots
  412. \end{docspec}
  413. \section{Sidenotes}\label{sec:sidenotes}
  414. One of the most prominent and distinctive features of this style is the
  415. extensive use of sidenotes. There is a wide margin to provide ample room
  416. for sidenotes and small figures. Any \doccmd{footnote}s will automatically
  417. be converted to sidenotes.\footnote{This is a sidenote that was entered
  418. using the \texttt{\textbackslash footnote} command.} If you'd like to place ancillary
  419. information in the margin without the sidenote mark (the superscript
  420. number), you can use the \hlred{\doccmd{marginnote}} command.\marginnote{This is a
  421. margin note. Notice that there isn't a number preceding the note, and
  422. there is no number in the main text where this note was written.}
  423. The specification of the \hlred{\doccmd{sidenote}} command is:
  424. \begin{docspec}
  425. \doccmd{sidenote}[\docopt{number}][\docopt{offset}]\{\docarg{Sidenote text.}\}
  426. \end{docspec}
  427. Both the \docopt{number} and \docopt{offset} arguments are optional. If you
  428. provide a \docopt{number} argument, then that number will be used as the
  429. sidenote number. It will change of the number of the current sidenote only and
  430. will not affect the numbering sequence of subsequent sidenotes.
  431. Sometimes a sidenote may run over the top of other text or graphics in the
  432. margin space. If this happens, you can adjust the vertical position of the
  433. sidenote by providing a dimension in the \docopt{offset} argument. Some
  434. examples of valid dimensions are:
  435. \begin{docspec}
  436. \ttfamily 1.0in \qquad 2.54cm \qquad 254mm \qquad 6\Verb|\baselineskip|
  437. \end{docspec}
  438. If the dimension is positive it will push the sidenote down the page; if the
  439. dimension is negative, it will move the sidenote up the page.
  440. While both the \docopt{number} and \docopt{offset} arguments are optional, they
  441. must be provided in order. To adjust the vertical position of the sidenote
  442. while leaving the sidenote number alone, use the following syntax:
  443. \begin{docspec}
  444. \doccmd{sidenote}[][\docopt{offset}]\{\docarg{Sidenote text.}\}
  445. \end{docspec}
  446. The empty brackets tell the \Verb|\sidenote| command to use the default
  447. sidenote number.
  448. If you \emph{only} want to change the sidenote number, however, you may
  449. completely omit the \docopt{offset} argument:
  450. \begin{docspec}
  451. \doccmd{sidenote}[\docopt{number}]\{\docarg{Sidenote text.}\}
  452. \end{docspec}
  453. The \doccmd{marginnote} command has a similar \docarg{offset} argument:
  454. \begin{docspec}
  455. \doccmd{marginnote}[\docopt{offset}]\{\docarg{Margin note text.}\}
  456. \end{docspec}
  457. \section{References}
  458. References are placed alongside their citations as sidenotes,
  459. as well. This can be accomplished using the normal \hlred{\doccmd{cite}}
  460. command.\sidenote{The first paragraph of this document includes a citation.}
  461. The complete list of references may also be printed automatically by using
  462. the \hlred{\doccmd{bibliography}} command. (See the end of this document for an
  463. example.) If you do not want to print a bibliography at the end of your
  464. document, use the \hlred{\doccmd{nobibliography}} command in its place.
  465. To enter multiple citations at one location,\cite[-3\baselineskip]{Tufte2006,Tufte1990} you can
  466. provide a list of keys separated by commas and the same optional vertical
  467. offset argument: \Verb|\cite{Tufte2006,Tufte1990}|.
  468. \begin{docspec}
  469. \doccmd{cite}[\docopt{offset}]\{\docarg{bibkey1,bibkey2,\ldots}\}
  470. \end{docspec}
  471. \section{Figures and Tables}\label{sec:figures-and-tables}
  472. Images and graphics play an integral role in Tufte's work.
  473. In addition to the standard \hlred{\docenv{figure}} and \hlred{\docenv{tabular}} environments,
  474. this style provides special figure and table environments for full-width
  475. floats.
  476. Full page--width figures and tables may be placed in \hlred{\docenv{figure*}} or
  477. \hlred{\docenv{table*}} environments. To place figures or tables in the margin,
  478. use the \hlred{\docenv{marginfigure}} or \hlred{\docenv{margintable}} environments as follows
  479. (see figure~\ref{fig:marginfig}):
  480. \begin{marginfigure}%
  481. \includegraphics[width=\linewidth]{helix}
  482. \caption{This is a margin figure. The helix is defined by
  483. $x = \cos(2\pi z)$, $y = \sin(2\pi z)$, and $z = [0, 2.7]$. The figure was
  484. drawn using Asymptote (\url{http://asymptote.sf.net/}).}
  485. \label{fig:marginfig}
  486. \end{marginfigure}
  487. \begin{docspec}
  488. \textbackslash begin\{marginfigure\}\\
  489. \qquad\textbackslash includegraphics\{helix\}\\
  490. \qquad\textbackslash caption\{This is a margin figure.\}\\
  491. \qquad\textbackslash label\{fig:marginfig\}\\
  492. \textbackslash end\{marginfigure\}\\
  493. \end{docspec}
  494. 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:
  495. \begin{docspec}
  496. \textbackslash{begin\{marginfigure\}[\docopt{offset}]}\\
  497. \qquad\ldots\\
  498. \textbackslash{end\{marginfigure\}}\\
  499. \mbox{}\\
  500. \textbackslash{begin\{margintable\}[\docopt{offset}]}\\
  501. \qquad\ldots\\
  502. \textbackslash{end\{margintable\}}\\
  503. \end{docspec}
  504. Figure~\ref{fig:fullfig} is an example of the \docenv{figure*}
  505. environment and figure~\ref{fig:textfig} is an example of the normal
  506. \docenv{figure} environment.
  507. \begin{figure*}[h]
  508. \includegraphics[width=\linewidth]{sine.pdf}%
  509. \caption{This graph shows $y = \sin x$ from about $x = [-10, 10]$.
  510. \emph{Notice that this figure takes up the full page width.}}%
  511. \label{fig:fullfig}%
  512. \end{figure*}
  513. \begin{figure}
  514. \includegraphics{hilbertcurves.pdf}
  515. % \checkparity This is an \pageparity\ page.%
  516. \caption[Hilbert curves of various degrees $n$.][6pt]{Hilbert curves of various degrees $n$. \emph{Notice that this figure only takes up the main textblock width.}}
  517. \label{fig:textfig}
  518. %\zsavepos{pos:textfig}
  519. \end{figure}
  520. As with sidenotes and marginnotes, a caption may sometimes require vertical
  521. adjustment. The \hlred{\doccmd{caption}} command now takes a second optional
  522. argument that enables you to do this by providing a dimension \docopt{offset}.
  523. You may specify the caption in any one of the following forms:
  524. \begin{docspec}
  525. \doccmd{caption}\{\docarg{long caption}\}\\
  526. \doccmd{caption}[\docarg{short caption}]\{\docarg{long caption}\}\\
  527. \doccmd{caption}[][\docopt{offset}]\{\docarg{long caption}\}\\
  528. \doccmd{caption}[\docarg{short caption}][\docopt{offset}]%
  529. \{\docarg{long caption}\}
  530. \end{docspec}
  531. A positive \docopt{offset} will push the caption down the page. The short
  532. caption, if provided, is what appears in the list of figures/tables, otherwise
  533. the ``long'' caption appears there. Note that although the arguments
  534. \docopt{short caption} and \docopt{offset} are both optional, they must be
  535. provided in order. Thus, to specify an \docopt{offset} without specifying a
  536. \docopt{short caption}, you must include the first set of empty brackets
  537. \Verb|[]|, which tell \doccmd{caption} to use the default ``long'' caption. As
  538. an example, the caption to figure~\ref{fig:textfig} above was given in the form
  539. \begin{docspec}
  540. \doccmd{caption}[Hilbert curves...][6pt]\{Hilbert curves...\}
  541. \end{docspec}
  542. Table~\ref{tab:normaltab} shows table created with the \docpkg{booktabs}
  543. package. Notice the lack of vertical rules---they serve only to clutter
  544. the table's data.
  545. \begin{table}[ht]
  546. \centering
  547. \fontfamily{ppl}\selectfont
  548. \begin{tabular}{ll}
  549. \toprule
  550. Margin & Length \\
  551. \midrule
  552. Paper width & \unit[8\nicefrac{1}{2}]{inches} \\
  553. Paper height & \unit[11]{inches} \\
  554. Textblock width & \unit[6\nicefrac{1}{2}]{inches} \\
  555. Textblock/sidenote gutter & \unit[\nicefrac{3}{8}]{inches} \\
  556. Sidenote width & \unit[2]{inches} \\
  557. \bottomrule
  558. \end{tabular}
  559. \caption{Here are the dimensions of the various margins used in the Tufte-handout class.}
  560. \label{tab:normaltab}
  561. %\zsavepos{pos:normaltab}
  562. \end{table}
  563. \section{Full-width text blocks}
  564. In addition to the new float types, there is a \hlred{\docenv{fullwidth}}
  565. environment that stretches across the main text block and the sidenotes
  566. area.
  567. \begin{Verbatim}
  568. \begin{fullwidth}
  569. Lorem ipsum dolor sit amet...
  570. \end{fullwidth}
  571. \end{Verbatim}
  572. \begin{fullwidth}
  573. \small\itshape\lipsum[1]
  574. \end{fullwidth}
  575. \section{Typography}\label{sec:typography}
  576. \subsection{Typefaces}\label{sec:typefaces}\index{typefaces}
  577. If the Palatino, \textsf{Helvetica}, and \texttt{Bera Mono} typefaces are installed, this style
  578. will use them automatically. Otherwise, we'll fall back on the Computer Modern
  579. typefaces.
  580. \subsection{Letterspacing}\label{sec:letterspacing}
  581. This document class includes two new commands and some improvements on
  582. existing commands for letterspacing.
  583. When setting strings of \allcaps{ALL CAPS} or \smallcaps{small caps}, the
  584. letter\-spacing---that is, the spacing between the letters---should be
  585. increased slightly.\cite{Bringhurst2005} The \hlred{\doccmd{allcaps}} command has proper letterspacing for
  586. strings of \allcaps{FULL CAPITAL LETTERS}, and the \hlred{\doccmd{smallcaps}} command
  587. has letterspacing for \smallcaps{small capital letters}. These commands
  588. will also automatically convert the case of the text to upper- or
  589. lowercase, respectively.
  590. The \hlred{\doccmd{textsc}} command has also been redefined to include
  591. letterspacing. The case of the \doccmd{textsc} argument is left as is,
  592. however. This allows one to use both uppercase and lowercase letters:
  593. \textsc{The Initial Letters Of The Words In This Sentence Are Capitalized.}
  594. \section{Document Class Options}\label{sec:options}
  595. \index{class options|(}
  596. The \doccls{tufte-book} class is based on the \LaTeX\ \doccls{book}
  597. document class. Therefore, you can pass any of the typical book
  598. options. There are a few options that are specific to the
  599. \doccls{tufte-book} document class, however.
  600. The \hlred{\docclsopt{a4paper}} option will set the paper size to \smallcaps{A4} instead of
  601. the default \smallcaps{US} letter size.
  602. The \hlred{\docclsopt{sfsidenotes}} option will set the sidenotes and title block in a
  603. \textsf{sans serif} typeface instead of the default roman.
  604. The \hlred{\docclsopt{twoside}} option will modify the running heads so that the page
  605. number is printed on the outside edge (as opposed to always printing the page
  606. number on the right-side edge in \hlred{\docclsopt{oneside}} mode).
  607. The \hlred{\docclsopt{symmetric}} option typesets the sidenotes on the outside edge of
  608. the page. This is how books are traditionally printed, but is contrary to
  609. Tufte's book design which sets the sidenotes on the right side of the page.
  610. This option implicitly sets the \docclsopt{twoside} option.
  611. The \hlred{\docclsopt{justified}} option sets all the text fully justified (flush left
  612. and right). The default is to set the text ragged right.
  613. The body text of Tufte's books are set ragged right. This prevents
  614. needless hyphenation and makes it easier to read the text in the slightly
  615. narrower column.
  616. The \hlred{\docclsopt{bidi}} option loads the \docpkg{bidi} package which is used with
  617. \tXeLaTeX\ to typeset bi-directional text. Since the \docpkg{bidi}
  618. package needs to be loaded before the sidenotes and cite commands are defined,
  619. it can't be loaded in the document preamble.
  620. The \hlred{\docclsopt{debug}} option causes the \TL classes to output debug
  621. information to the log file which is useful in troubleshooting bugs. It will
  622. also cause the graphics to be replaced by outlines.
  623. The \hlred{\docclsopt{nofonts}} option prevents the \TL classes from
  624. automatically loading the Palatino and Helvetica typefaces. You should use
  625. this option if you wish to load your own fonts. If you're using \tXeLaTeX, this
  626. option is implied (\ie, the Palatino and Helvetica fonts aren't loaded if you
  627. use \tXeLaTeX).
  628. The \hlred{\docclsopt{nols}} option inhibits the letterspacing code. The \TL\
  629. classes try to load the appropriate letterspacing package (either pdf\TeX's
  630. \docpkg{letterspace} package or the \docpkg{soul} package). If you're using
  631. \tXeLaTeX\ with \docpkg{fontenc}, however, you should configure your own
  632. letterspacing.
  633. The \hlred{\docclsopt{notitlepage}} option causes \verb|\maketitle| to generate a title
  634. block instead of a title page. The \doccls{book} class defaults to a title
  635. page and the \doccls{handout} class defaults to the title block. There is an
  636. analogous \hlred{\docclsopt{titlepage}} option that forces \verb|\maketitle| to
  637. generate a full title page instead of the title block.
  638. The \hlred{\docclsopt{notoc}} option suppresses \TL's custom table of contents
  639. (\textsc{toc}) design. The current \textsc{toc} design only shows unnumbered
  640. chapter titles; it doesn't show sections or subsections. The \docclsopt{notoc}
  641. option will revert to \LaTeX's \textsc{toc} design.
  642. The \hlred{\docclsopt{nohyper}} option prevents the \docpkg{hyperref} package from
  643. being loaded. The default is to load the \docpkg{hyperref} package and use the
  644. \doccmd{title} and \doccmd{author} contents as metadata for the generated
  645. \textsc{pdf}.
  646. \index{class options|)}
  647. \chapter[Customizing Tufte-LaTeX]{Customizing \TL}
  648. \label{ch:customizing}
  649. The \TL document classes are designed to closely emulate Tufte's book
  650. design by default. However, each document is different and you may encounter
  651. situations where the default settings are insufficient. This chapter explores
  652. many of the ways you can adjust the \TL document classes to better fit
  653. your needs.
  654. \section{File Hooks}
  655. \label{sec:filehooks}
  656. \index{file hooks|(}
  657. If you create many documents using the \TL classes, it's easier to
  658. store your customizations in a separate file instead of copying them into the
  659. preamble of each document. The \TL classes provide three file hooks:
  660. \docfilehook{tufte-common-local.tex}{common}, \docfilehook{tufte-book-local.tex}{book}, and
  661. \docfilehook{tufte-handout-local.tex}{handout}.\sloppy
  662. \begin{description}
  663. \item[\docfilehook{tufte-common-local.tex}{common}]
  664. If this file exists, it will be loaded by all of the \TL document
  665. classes just prior to any document-class-specific code. If your
  666. customizations or code should be included in both the book and handout
  667. classes, use this file hook.
  668. \item[\docfilehook{tufte-book-local.tex}{book}]
  669. If this file exists, it will be loaded after all of the common and
  670. book-specific code has been read. If your customizations apply only to the
  671. book class, use this file hook.
  672. \item[\docfilehook{tufte-common-handout.tex}{handout}]
  673. If this file exists, it will be loaded after all of the common and
  674. handout-specific code has been read. If your customizations apply only to
  675. the handout class, use this file hook.
  676. \end{description}
  677. \index{file hooks|)}
  678. \section{Numbered Section Headings}
  679. \label{sec:numbered-sections}
  680. \index{headings!numbered}
  681. While Tufte dispenses with numbered headings in his books, if you require them,
  682. they can be anabled by changing the value of the \doccounter{secnumdepth}
  683. counter. From the table below, select the heading level at which numbering
  684. should stop and set the \doccounter{secnumdepth} counter to that value. For
  685. example, if you want parts and chapters numbered, but don't want numbering for
  686. sections or subsections, use the command:
  687. \begin{docspec}
  688. \doccmd{setcounter}\{secnumdepth\}\{0\}
  689. \end{docspec}
  690. The default \doccounter{secnumdepth} for the \TL document classes is $-1$.
  691. \begin{table}
  692. \footnotesize
  693. \begin{center}
  694. \begin{tabular}{lr}
  695. \toprule
  696. Heading level & Value \\
  697. \midrule
  698. Part (in \doccls{tufte-book}) & $-1$ \\
  699. Part (in \doccls{tufte-handout}) & $0$ \\
  700. Chapter (only in \doccls{tufte-book}) & $0$ \\
  701. Section & $1$ \\
  702. Subsection & $2$ \\
  703. Subsubsection & $3$ \\
  704. Paragraph & $4$ \\
  705. Subparagraph & $5$ \\
  706. \bottomrule
  707. \end{tabular}
  708. \end{center}
  709. \caption{Heading levels used with the \texttt{secnumdepth} counter.}
  710. \end{table}
  711. \section{Changing the Paper Size}
  712. \label{sec:paper-size}
  713. The \TL classes currently only provide three paper sizes: \textsc{a4},
  714. \textsc{b5}, and \textsc{us} letter. To specify a different paper size (and/or
  715. margins), use the \doccmd[geometry]{geometrysetup} command in the preamble of your
  716. document (or one of the file hooks). The full documentation of the
  717. \doccmd{geometrysetup} command may be found in the \docpkg{geometry} package
  718. documentation.\cite{pkg-geometry}
  719. \section{Customizing Marginal Material}
  720. \label{sec:marginal-material}
  721. Marginal material includes sidenotes, citations, margin notes, and captions.
  722. Normally, the justification of the marginal material follows the justification
  723. of the body text. If you specify the \docclsopt{justified} document class
  724. option, all of the margin material will be fully justified as well. If you
  725. don't specify the \docclsopt{justified} option, then the marginal material will
  726. be set ragged right.
  727. You can set the justification of the marginal material separately from the body
  728. text using the following document class options: \docclsopt{sidenote},
  729. \docclsopt{marginnote}, \docclsopt{caption}, \docclsopt{citation}, and
  730. \docclsopt{marginals}. Each option refers to its obviously corresponding
  731. marginal material type. The \docclsopt{marginals} option simultaneously sets
  732. the justification on all four marginal material types.
  733. Each of the document class options takes one of five justification types:
  734. \begin{description}
  735. \item[\docclsopt{justified}] Fully justifies the text (sets it flush left and
  736. right).
  737. \item[\docclsopt{raggedleft}] Sets the text ragged left, regardless of which
  738. page it falls on.
  739. \item[\docclsopt{raggedright}] Sets the text ragged right, regardless of
  740. which page it falls on.
  741. \item[\doccls{raggedouter}] Sets the text ragged left if it falls on the
  742. left-hand (verso) page of the spread and otherwise sets it ragged right.
  743. This is useful in conjunction with the \docclsopt{symmetric} document class
  744. option.
  745. \item[\docclsopt{auto}] If the \docclsopt{justified} document class option
  746. was specified, then set the text fully justified; otherwise the text is set
  747. ragged right. This is the default justification option if one is not
  748. explicitly specified.
  749. \end{description}
  750. \noindent For example,
  751. \begin{docspec}
  752. \doccmdnoindex{documentclass}[symmetric,justified,marginals=raggedouter]\{tufte-book\}
  753. \end{docspec}
  754. will set the body text of the document to be fully justified and all of the
  755. margin material (sidenotes, margin notes, captions, and citations) to be flush
  756. against the body text with ragged outer edges.
  757. \chapter{Compatibility Issues}
  758. \label{ch:compatibility}
  759. When switching an existing document from one document class to a \TL document class, a few changes to the document may have to be made.
  760. \section{Converting from \doccls{article} to \doccls{tufte-handout}}
  761. The following \doccls{article} class options are unsupported: \docclsopt{10pt}, \docclsopt{11pt}, \docclsopt{12pt}, \docclsopt{a5paper}, \docclsopt{b5paper}, \docclsopt{executivepaper}, \docclsopt{legalpaper}, \docclsopt{landscape}, \docclsopt{onecolumn}, and \doccls{twocolumn}.
  762. The following headings are not supported: \doccmd{subsubsection} and \doccmd{subparagraph}.
  763. \section{Converting from \doccls{book} to \doccls{tufte-book}}
  764. The following \doccls{report} class options are unsupported: \docclsopt{10pt}, \docclsopt{11pt}, \docclsopt{12pt}, \docclsopt{a5paper}, \docclsopt{b5paper}, \docclsopt{executivepaper}, \docclsopt{legalpaper}, \docclsopt{landscape}, \docclsopt{onecolumn}, and \doccls{twocolumn}.
  765. The following headings are not supported: \doccmd{subsubsection} and \doccmd{subparagraph}.
  766. \chapter{Troubleshooting and Support}
  767. \label{ch:troubleshooting}
  768. \section{\TL Website}\label{sec:website}
  769. The website for the \TL packages is located at
  770. \url{http://code.google.com/p/tufte-latex/}. On our website, you'll find
  771. links to our \smallcaps{svn} repository, mailing lists, bug tracker, and documentation.
  772. \section{\TL Mailing Lists}\label{sec:mailing-lists}
  773. There are two mailing lists for the \TL project:
  774. \paragraph{Discussion list}
  775. The \texttt{tufte-latex} discussion list is for asking questions, getting
  776. assistance with problems, and help with troubleshooting. Release announcements
  777. are also posted to this list. You can subscribe to the \texttt{tufte-latex}
  778. discussion list at \url{http://groups.google.com/group/tufte-latex}.
  779. \paragraph{Commits list}
  780. The \texttt{tufte-latex-commits} list is a read-only mailing list. A message
  781. is sent to the list any time the \TL code has been updated. If you'd like to
  782. keep up with the latest code developments, you may subscribe to this list. You
  783. can subscribe to the \texttt{tufte-latex-commits} mailing list at
  784. \url{http://groups.google.com/group/tufte-latex-commits}.
  785. \section{Getting Help}\label{sec:getting-help}
  786. If you've encountered a problem with one of the \TL document classes, have a
  787. question, or would like to report a bug, please send an email to our
  788. mailing list or visit our website.
  789. To help us troubleshoot the problem more quickly, please try to compile your
  790. document using the \docclsopt{debug} class option and send the generated
  791. \texttt{.log} file to the mailing list with a brief description of the problem.
  792. \section{Errors, Warnings, and Informational Messages}\label{sec:tl-messages}
  793. The following is a list of all of the errors, warnings, and other messages generated by the \TL classes and a brief description of their meanings.
  794. \docmsg{Error: \doccmd{subparagraph} is undefined by this class.}{%
  795. The \doccmd{subparagraph} command is not defined in the \TL document classes.
  796. If you'd like to use the \doccmd{subparagraph} command, you'll need to redefine
  797. it yourself. See the ``Headings'' section on page~\pageref{sec:headings} for a
  798. description of the heading styles availaboe in the \TL document classes.}
  799. \docmsg{Error: \doccmd{subsubsection} is undefined by this class.}{%
  800. The \doccmd{subsubsection} command is not defined in the \TL document classes.
  801. If you'd like to use the \doccmd{subsubsection} command, you'll need to
  802. redefine it yourself. See the ``Headings'' section on
  803. page~\pageref{sec:headings} for a description of the heading styles availaboe
  804. in the \TL document classes.}
  805. \docmsg{Warning: Option `\docopt{class option}' is not supported -{}- ignoring option.}{%
  806. This warning appears when you've tried to use \docopt{class option} with a \TL
  807. document class, but \docopt{class option} isn't supported by the \TL document
  808. class. In this situation, \docopt{class option} is ignored.}
  809. \section{Package Dependencies}\label{sec:dependencies}
  810. The following is a list of packages that the \TL document
  811. classes rely upon. Packages marked with an asterisk are optional.
  812. \begin{multicols}{2}
  813. \begin{itemize}
  814. \item xifthen
  815. \item ifpdf*
  816. \item ifxetex*
  817. \item hyperref
  818. \item geometry
  819. \item ragged2e
  820. \item chngpage \emph{or} changepage
  821. \item paralist
  822. \item textcase
  823. \item soul*
  824. \item letterspace*
  825. \item setspace
  826. \item natbib \emph{and} bibentry
  827. \item optparams
  828. \item placeins
  829. \item mathpazo*
  830. \item helvet*
  831. \item fontenc
  832. \item beramono*
  833. \item fancyhdr
  834. \item xcolor
  835. \item textcomp
  836. \item titlesec
  837. \item titletoc
  838. \end{itemize}
  839. \end{multicols}
  840. %%
  841. % The back matter contains appendices, bibliographies, indices, glossaries, etc.
  842. \backmatter
  843. \bibliography{sample-handout}
  844. \bibliographystyle{plainnat}
  845. \printindex
  846. \end{document}