diff --git a/sample-book.pdf b/sample-book.pdf new file mode 100644 index 0000000..b155daf Binary files /dev/null and b/sample-book.pdf differ diff --git a/sample-book.tex b/sample-book.tex new file mode 100644 index 0000000..fd8cf37 --- /dev/null +++ b/sample-book.tex @@ -0,0 +1,342 @@ +\documentclass{tufte-book} + +%% +% Book metadata +\title{A Tufte-Style Book\thanks{Thanks to Edward R.~Tufte for his inspiration.}} +\author[The Tufte-LaTeX Developers]{The Tufte-\LaTeX\ Developers} +\publisher{Publisher of This Book} + +%% +% If they're installed, use Bergamo and Chantilly from www.fontsite.com. +% They're clones of Bembo and Gill Sans, respectively. +\IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo +\IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans + +%\usepackage{microtype} + +%% +% Just some sample text +\usepackage{lipsum} + +%% +% For nicely typeset tabular material +\usepackage{booktabs} + +%% +% For graphics / images +\usepackage{graphicx} + +%% +% Prints argument within hanging parentheses (i.e., parentheses that take +% up no horizontal space). Useful in tabular environments. +\newcommand{\hangp}[1]{\makebox[0pt][r]{(}#1\makebox[0pt][l]{)}} + +%% +% Prints an asterisk that takes up no horizontal space. +% Useful in tabular environments. +\newcommand{\hangstar}{\makebox[0pt][l]{*}} + +%% +% Prints a trailing space in a smart way. +\usepackage{xspace} + +%% +% Some shortcuts for Tufte's book titles. The lowercase commands will +% produce the initials of the book title in italics. The all-caps commands +% will print out the full title of the book in italics. +\newcommand{\vdqi}{\textit{VDQI}\xspace} +\newcommand{\ei}{\textit{EI}\xspace} +\newcommand{\ve}{\textit{VE}\xspace} +\newcommand{\be}{\textit{BE}\xspace} +\newcommand{\VDQI}{\textit{The Visual Display of Quantitative Information}\xspace} +\newcommand{\EI}{\textit{Envisioning Information}\xspace} +\newcommand{\VE}{\textit{Visual Explanations}\xspace} +\newcommand{\BE}{\textit{Beautiful Evidence}\xspace} + +% Prints the month name (e.g., January) and the year (e.g., 2008) +\newcommand{\monthyear}{% + \ifcase\month\or January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or + December\fi\space\number\year +} + + +% Prints an epigraph and speaker in sans serif, all-caps type. +\newcommand{\openepigraph}[2]{% + %\sffamily\fontsize{14}{16}\selectfont + \begin{fullwidth} + \sffamily\large + \begin{doublespace} + \noindent\allcaps{#1}\\% epigraph + \noindent\allcaps{#2}% author + \end{doublespace} + \end{fullwidth} +} + +% Inserts a blank page +\newcommand{\blankpage}{% + \newpage~\\\thispagestyle{empty}\newpage +} + + +\begin{document} + +% Front matter +\frontmatter + +% r.1 blank page +\blankpage + +% v.2 epigraphs +\newpage\thispagestyle{empty} +\openepigraph{% +The public is more familiar with bad design than good design. +It is, in effect, conditioned to prefer bad design, +because that is what it lives with. +The new becomes threatening, the old reassuring. +}{Paul Rand%, {\itshape Design, Form, and Chaos} +} +\vfill +\openepigraph{% +A designer knows that he has achieved perfection +not when there is nothing left to add, +but when there is nothing left to take away. +}{Antoine de St-Expurey} +\vfill +\openepigraph{% +\ldots the designer of a new system must not only be the implementor and the first +large-scale user; the designer should also write the first user manual\ldots +If I had not participated fully in all these activities, +literally hundreds of improvements would never have been made, +because I would never have thought of them or perceived +why they were important. +}{Donald E. Knuth} + + +% r.3 full title page +\maketitle + + +% v.4 copyright page +\newpage +\begin{fullwidth} +~\vfill +\thispagestyle{empty} +\setlength{\parindent}{0pt} +\setlength{\parskip}{\baselineskip} +Copyright \copyright\ \the\year\ \thanklessauthor + +\par\smallcaps{Published by \thanklesspublisher} + +\par\smallcaps{tufte-latex.googlecode.com} + +\par Licensed under the Apache License, Version 2.0 (the ``License''); you may not +use this file except in compliance with the License. You may obtain a copy +of the License at \url{http://www.apache.org/licenses/LICENSE-2.0}. Unless +required by applicable law or agreed to in writing, software distributed +under the License is distributed on an \smallcaps{``AS IS'' BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND}, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. + +\par\textit{First printing, \monthyear} +\end{fullwidth} + +% r.5 contents +\tableofcontents + +% r.7 dedication +\cleardoublepage +~\vfill +\begin{doublespace} +\noindent\fontsize{18}{22}\selectfont\itshape +\nohyphenation +Dedicated to those who appreciate \LaTeX{} +and the work of \mbox{Edward R.~Tufte} +and \mbox{Donald E.~Knuth}. +\end{doublespace} +\vfill +\vfill + + +% r.9 introduction +\cleardoublepage +\chapter*{Introduction} + +This sample book discusses the design of Edward Tufte's +%books\cite{Tufte2001}\cite{Tufte1990}\cite{Tufte1997}\cite{Tufte2006} +books\cite{Tufte2001,Tufte1990,Tufte1997,Tufte2006} +and the use of the \texttt{tufte-book} document class. + +\lipsum[1-20] + +%% +% Start the main matter (normal chapters) +\mainmatter + + +\chapter{The Design of Tufte's Books} +\label{ch:tufte-design} + + +\newthought{The pages} of a book are usually divided into three major +sections: the front matter (also called preliminary matter or prelim), the +main matter (the core text of the book), and the back matter (or end +matter). + +\newthought{The front matter} of a book refers to all of the material that +comes before the main text. The following table from shows a list of +material that appears in the front matter of \VDQI, \EI, \VE, and \BE +along with its page number. Page numbers that appear in parentheses refer +to folios that do not have a printed page number (but they are still +counted in the page number sequence). + +\bigskip +\begin{minipage}{\textwidth} +\begin{center} +\begin{tabular}{lcccc} +\toprule + & \multicolumn{4}{c}{Books} \\ +\cmidrule(l){2-5} +Page content & \vdqi & \ei & \ve & \be \\ +\midrule +Blank half title page & \hangp{1} & \hangp{1} & \hangp{1} & \hangp{1} \\ +Frontispiece\footnotemark{} + & \hangp{2} & \hangp{2} & \hangp{2} & \hangp{2} \\ +Full title page & \hangp{3} & \hangp{3} & \hangp{3} & \hangp{3} \\ +Copyright page & \hangp{4} & \hangp{4} & \hangp{4} & \hangp{4} \\ +Contents & \hangp{5} & \hangp{5} & \hangp{5} & \hangp{5} \\ +%Blank & -- & \hangp{6} & \hangp{6} & \hangp{6} \\ +Dedication & \hangp{6} & \hangp{7} & \hangp{7} & 7 \\ +%Blank & -- & \hangp{8} & -- & \hangp{8} \\ +Epigraph & -- & -- & \hangp{8} & -- \\ +Introduction & \hangp{7} & \hangp{9} & \hangp{9} & 9 \\ +\bottomrule +\end{tabular} +\end{center} +\end{minipage} +\vspace{-7\baselineskip}\footnotetext{The contents of this page vary from book to book. In + \vdqi this page is blank; in \ei and \ve this page holds a frontispiece; + and in \be this page contains three epigraphs.} +\vspace{7\baselineskip} + +\bigskip +The design of the front matter in Tufte's books varies slightly from the +traditional design of front matter. First, the pages in front matter are +traditionally numbered with lowercase roman numerals (e.g., i, ii, iii, +iv,~\ldots). Second, the front matter page numbering sequence is usually +separate from the main matter page numbering. That is, the page numbers +restart at 1 when the main matter begins. In contrast, Tufte has +enumerated his pages with arabic numerals that share the same page counting +sequence as the main matter. + +There are also some variations in design across Tufte's four books. The +page opposite the full title page (labeled ``frontispiece'' in the above +table) has different content in each of the books. In \VDQI, this page is +blank; in \EI and \VE, this page holds a frontispiece; and in \BE, this +page contains three epigraphs. + +The dedication appears on page~6 in \vdqi (opposite the introduction), and +is placed on its own spread in the other books. In \ve, an epigraph shares +the spread with the opening page of the introduction. + +None of the page numbers (folios) of the front matter are expressed except in +\be, where the folios start to appear on the dedication page. + +\newthought{The full title page} of each of the books varies slightly in +design. In all the books, the author's name appears at the top of the +page, the title it set just above the center line, and the publisher is +printed along the bottom margin. Some of the differences are outlined in +the following table. + +\bigskip +\begin{center} +\footnotesize +\begin{tabular}{lllll} +\toprule +Feature & \vdqi & \ei & \ve & \be \\ +\midrule +Author & & & & \\ +\quad Typeface & serif & serif & serif & sans serif \\ +\quad Style & italics & italics & italics & upright, caps \\ +\quad Size & 24 pt & 20 pt & 20 pt & 20 pt \\ +\addlinespace +Title & & & & \\ +\quad Typeface & serif & serif & serif & sans serif \\ +\quad Style & upright & italics & upright & upright, caps \\ +\quad Size & 36 pt & 48 pt & 48 pt & 36 pt \\ +\addlinespace +Subtitle & & & & \\ +\quad Typeface & -- & -- & serif & -- \\ +\quad Style & -- & -- & upright & -- \\ +\quad Size & -- & -- & 20 pt & -- \\ +\addlinespace +Edition & & & & \\ +\quad Typeface & sans serif & -- & -- & -- \\ +\quad Style & upright, caps & -- & -- & -- \\ +\quad Size & 14 pt & -- & -- & -- \\ +\addlinespace +Publisher & & & & \\ +\quad Typeface & serif & serif & serif & sans serif \\ +\quad Style & italics & italics & italics & upright, caps \\ +\quad Size & 14 pt & 14 pt & 14 pt & 14 pt \\ +\bottomrule +\end{tabular} +\end{center} + +%\begin{figure*}[p] +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/vdqi-title.pdf}} +%\hfill +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/ei-title.pdf}} +%\\\vspace{\baselineskip} +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/ve-title.pdf}} +%\hfill +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/be-title.pdf}} +%\end{figure*} + +\newthought{The tables of contents} in Tufte's books give us our first +glimpse of the structure of the main matter. \VDQI is split into two +parts, each containing some number of chapters. His other three books only +contain chapters---they're not broken into parts. + +%\begin{figure*}[p] +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/vdqi-contents.pdf}} +%\hfill +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/ei-contents.pdf}} +%\\\vspace{\baselineskip} +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/ve-contents.pdf}} +%\hfill +%\fbox{\includegraphics[width=0.45\textwidth]{graphics/be-contents.pdf}} +%\end{figure*} + +\lipsum[21-50] + +\chapter{On the Use of the \texttt{tufte-book} Document Class} +\label{ch:tufte-book} +The \texttt{tufte-book} document class is modeled primarily on \BE, since +it's the most recent of Tufte's books and the design is (presumably) more +refined. + +This choice of book design has a few important implications: +\begin{inparaenum} +\item there are no parts---the highest heading level is the chapter; +\item the use of a sans serif font for many design elements (especially the +title page and epigraphs); and +\item \emph{something else---yyy}. +\end{inparaenum} + +\lipsum[1-25] + + +%% +% The back matter contains appendices, indices, glossaries, etc. + +\backmatter + + + +\bibliography{sample-handout} +\bibliographystyle{plainnat} + +\end{document} + diff --git a/sample-handout.bib b/sample-handout.bib index 81715a5..95e715e 100644 --- a/sample-handout.bib +++ b/sample-handout.bib @@ -6,7 +6,7 @@ month = {May}, edition = {First}, place = {Cheshire, Connecticut}, - isbn = {0961392177} + isbn = {0-9613921-7-7} } @BOOK{Tufte2001, @@ -15,7 +15,7 @@ publisher = {Graphics Press}, year = {2001}, address = {Cheshire, Connecticut}, - isbn = {0961392142} + isbn = {0-9613921-4-2} } @BOOK{Tufte1990, @@ -24,7 +24,7 @@ publisher = {Graphics Press}, year = {1990}, address = {Cheshire, Connecticut}, - isbn = {0961392118} + isbn = {0-9613921-1-8} } @BOOK{Tufte1997, diff --git a/sample-handout.pdf b/sample-handout.pdf index c1d44e0..9d961ec 100644 Binary files a/sample-handout.pdf and b/sample-handout.pdf differ diff --git a/sample-handout.tex b/sample-handout.tex index 7c65ba4..cc7516e 100644 --- a/sample-handout.tex +++ b/sample-handout.tex @@ -1,4 +1,4 @@ -\documentclass{tufte-handout} +\documentclass[nofonts]{tufte-handout} \usepackage{amsmath} @@ -9,12 +9,26 @@ \usepackage{mcaption} % FIXME move to .cls file -%\title{An Example of the Usage of the Tufte-Handout Style\thanks{Inspired by Edward~R. Tufte!}} -\title{An Example of the Usage of the Tufte-Handout Style} -\author{The Tufte-\LaTeX\ Developers} -%\date{22 February 2008} % if the \date{} command is left out, the current date will be used +\title{An Example of the Usage of the Tufte-Handout Style\thanks{Inspired by Edward~R. Tufte!}} +\author[The Tufte-LaTeX Developers]{The Tufte-\LaTeX\ Developers} +\date{22 February 2008} % if the \date{} command is left out, the current date will be used -\usepackage{helvet} +%% +% If we have Bergamo and Chantilly fonts (from www.fontsite.com) installed, +% use them. Bergamo is a clone of Bembo and Chantilly is similar to Gill Sans. +\makeatletter +\ifthenelse{\NOT\boolean{@tufte@xetex}} + {% + \IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo clone + \IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans clone + }{% We're using XeTeX -- load fontspec, etc. + \usepackage{fontspec} + \usepackage{xltxtra} + \setromanfont{Bergamo}% Bembo clone + \setsansfont{Chantilly}% Gill Sans clone + \setmonofont{Bitstream Vera Sans Mono}% + } +\makeatother % The following package makes prettier tables. We're all about the bling! \usepackage{booktabs} @@ -28,19 +42,18 @@ \usepackage{fancyvrb} \fvset{fontsize=\normalsize} +% Small sections of multiple columns \usepackage{multicol} -%\usepackage[savepos]{zref} - +% Provides paragraphs of dummy text \usepackage{lipsum} -\usepackage{url} -\urldef{\asyurl}\url{http://asymptote.sf.net/} - \begin{document} \maketitle % this prints the handout title, author, and date + + \begin{abstract} \noindent This document describes the Tufte handout \LaTeX\ document style. It also provides examples and comments on the style's use. @@ -112,7 +125,7 @@ example.) If you do not want to print a bibliography at the end of your document, use the \Verb|\nobibliography| command in its place. To enter multiple citations at one -location,\cite{Tufte2006}\cite{Tufte1990} you will need to use multiple +location,\cite{Tufte2006,Tufte1990} you will need to use multiple \Verb|\cite| commands: \Verb|\cite{Tufte2006}| \Verb|\cite{Tufte1990}|. Each \Verb|\cite| command will generate its own sidenote and its own sidenote number. @@ -132,7 +145,7 @@ use the \Verb|marginfigure| or \Verb|margintable| environments as follows \includegraphics[width=\marginparwidth]{helix} \caption{This is a margin figure. The helix is defined by $x = \cos(2\pi z)$, $y = \sin(2\pi z)$, and $z = [0, 2.7]$. The figure was - drawn using Asymptote (\asyurl).} + drawn using Asymptote (\url{http://asymptote.sf.net/}).} \label{fig:marginfig} \end{marginfigure} \begin{Verbatim} diff --git a/tufte-book.cls b/tufte-book.cls new file mode 100644 index 0000000..d929fa4 --- /dev/null +++ b/tufte-book.cls @@ -0,0 +1,83 @@ +\NeedsTeXFormat{LaTeX2e}[1994/06/01] + +\ProvidesClass{tufte-book}[2008/11/16 v3.0.0 Tufte-book class] + + +\PassOptionsToPackage{book}{tufte-common} +\DeclareOption*{% pass options to tufte-common package and the article class + \PassOptionsToPackage{\CurrentOption}{tufte-common} + \PassOptionsToClass{\CurrentOption}{book} + \PackageInfo{tufte-book}{Passing \CurrentOption\space to `book' class} +} +\ProcessOptions + +\LoadClass{book} + +\RequirePackage{tufte-common} + + +%% +% Set up any book-specific stuff now + +%% +% The front matter in Tufte's /Beautiful Evidence/ contains everything up +% to the opening page of Chapter 1. The running heads, when they appear, +% contain only the (arabic) page number in the outside corner. +%\newif\if@mainmatter \@mainmattertrue +\renewcommand\frontmatter{% + \cleardoublepage + \@mainmatterfalse + \pagenumbering{arabic} + %\pagestyle{plain} + \fancyhf{} + \if@tufte@twoside + \fancyhead[LE,RO]{\thepage} + \else + \fancyhead[RE,RO]{\thepage} + \fi +} + + +%% +% The main matter in Tufte's /Beautiful Evidence/ doesn't restart the page +% numbering---it continues where it left off in the front matter. +\renewcommand\mainmatter{% + \cleardoublepage + \@mainmattertrue + + % TODO The book should have the book title on the left and the chapter + % title on the right. + \fancyhf{} + \if@tufte@twoside + \renewcommand{\chaptermark}[1]{\markboth{##1}{}} + \fancyhead[LE]{\thepage\quad\smallcaps{\thetitle}}% book title + \fancyhead[RO]{\smallcaps{\leftmark}\quad\thepage}% chapter title + \else + \fancyhead[RE,RO]{\smallcaps{\thetitle}\quad\thepage}% book title + \fi +} + + +%% +% The back matter contains appendices, indices, glossaries, endnotes, +% biliographies, list of contributors, illustration credits, etc. +\renewcommand\backmatter{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \@mainmatterfalse +} + + +%% +% If there is a `tufte-book-local.sty' file, load it. + +\IfFileExists{tufte-book-local.tex} + {\input{tufte-book-local.tex}} + {} + +%% +% End of file +\endinput diff --git a/tufte-common.sty b/tufte-common.sty new file mode 100644 index 0000000..f85e30a --- /dev/null +++ b/tufte-common.sty @@ -0,0 +1,810 @@ +\NeedsTeXFormat{LaTeX2e}[1994/06/01] + +\ProvidesPackage{tufte-common}[2008/11/16 v3.0.0 Common code for the Tufte-LaTeX styles] + +%% +% We use the `xifthen' package to handle our package option switches +\RequirePackage{xifthen} + + +%% +% `debug' option -- provides more information in the .log file for use in +% troubleshooting problems +\newboolean{@tufte@debug} +\DeclareOption{debug}{\setboolean{@tufte@debug}{true}} + +%% +% `nofonts' option -- doesn't load any fonts +% `fonts' option -- tries to load fonts +\newboolean{@tufte@loadfonts}\setboolean{@tufte@loadfonts}{true} +\DeclareOption{fonts}{\setboolean{@tufte@loadfonts}{true}} +\DeclareOption{nofonts}{\setboolean{@tufte@loadfonts}{false}} + +%% +% `nols' option -- doesn't configure letterspacing +% `ls' option -- configures letterspacing +\newboolean{@tufte@letterspace}\setboolean{@tufte@letterspace}{true} +\DeclareOption{ls}{\setboolean{@tufte@letterspace}{true}} +\DeclareOption{nols}{\setboolean{@tufte@letterspace}{false}} + +%% +% `book' and `handout' options +\newcommand{\@tufte@class}{article}% the base LaTeX class (defaults to the article/handout style) +\newcommand{\@tufte@pkgname}{tufte-handout}% the name of the package (defaults to tufte-handout) +\DeclareOption{book}{% + \renewcommand{\@tufte@class}{book} + \renewcommand{\@tufte@pkgname}{tufte-book} + \setboolean{@tufte@titlepage}{true} +} +\DeclareOption{handout}{% + \renewcommand{\@tufte@class}{article} + \renewcommand{\@tufte@pkgname}{tufte-handout} + \setboolean{@tufte@titlepage}{false} +} +\DeclareOption{article}{% `article' is just an alias for `handout' + \renewcommand{\@tufte@class}{article} + \renewcommand{\@tufte@pkgname}{tufte-handout} + \setboolean{@tufte@titlepage}{false} +} + +%% +% `titlepage' option -- creates a full title page with \maketitle + +\newboolean{@tufte@titlepage} +\DeclareOption{titlepage}{\setboolean{@tufte@titlepage}{true}} +\DeclareOption{notitlepage}{\setboolean{@tufte@titlepage}{false}} + +%% +% `a4paper' option + +\newboolean{@tufte@afourpaper} +\DeclareOption{a4paper}{\setboolean{@tufte@afourpaper}{true}} + +%% +% `sfsidenotes' option -- typesets sidenotes in sans serif typeface + +\newboolean{@tufte@sfsidenotes} +\DeclareOption{sfsidenotes}{\setboolean{@tufte@sfsidenotes}{true}} + +%% +% `symmetric' option -- puts marginpar space to the outside edge of the page +% Note: this option forces the twoside option + +\newboolean{@tufte@symmetric} +\DeclareOption{symmetric}{ + \setboolean{@tufte@symmetric}{true} + \PassOptionsToClass{twoside}{\@tufte@class} +} + +%% +% `justified' option -- uses fully justified text (flush left and flush +% right) instead of ragged right. + +\newboolean{@tufte@justified} +\DeclareOption{justified}{\setboolean{@tufte@justified}{true}} + + +% FIXME: should probably specify options not supported like Mittelbach's aipproc.cls + +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\@tufte@class}} +\ProcessOptions + +%\LoadClass{\@tufte@class} + +%% +% Detect whether we're in two-side mode or not. (Used to set up running +% heads later.) + +\newboolean{@tufte@twoside} +\ifthenelse{\boolean{@twoside}} + {\setboolean{@tufte@twoside}{true}} + {\setboolean{@tufte@twoside}{false}} + +%% +% Detect if we're using pdfLaTeX + +\newboolean{@tufte@pdf} +\IfFileExists{ifpdf.sty}{% + \RequirePackage{ifpdf} + \ifthenelse{\boolean{pdf}} + {\setboolean{@tufte@pdf}{true}} + {\setboolean{@tufte@pdf}{false}} +}{% assume we're not using pdfTex? + \setboolean{@tufte@pdf}{false} +} + +%% +% Detect if we're using XeLaTeX + +\newboolean{@tufte@xetex} +\IfFileExists{ifxetex.sty}{% + \RequirePackage{ifxetex} + \ifthenelse{\boolean{xetex}} + {\setboolean{@tufte@xetex}{true}} + {\setboolean{@tufte@xetex}{false}} +}{% not using xelatex + \setboolean{@tufte@xetex}{false} +} + +%% +% Load the `hyperref' package. We will set more options later. +% TODO Set nice defaults for hyperref options +\ifthenelse{\boolean{@tufte@xetex}} + {\RequirePackage[xetex]{hyperref}} + {\RequirePackage{hyperref}} + +\hypersetup{% + pdfborder = {0 0 0} +} + +%% +% Set page layout geometry + +\RequirePackage[letterpaper,includemp,width=6.5in,marginparsep=0.375in,marginparwidth=2in]{geometry} + +\ifthenelse{\boolean{@tufte@afourpaper}} + {\geometry{a4paper,includemp,width=170mm,marginparsep=10mm,marginparwidth=50mm}} + {} + +\ifthenelse{\boolean{@tufte@symmetric}} + {} + {\geometry{asymmetric}} + + +%% +% Separation marginpars by a line's worth of space. + +\setlength\marginparpush{\baselineskip} + +%% +% Font for margin items + +\ifthenelse{\boolean{@tufte@sfsidenotes}} + {\newcommand{\@tufte@marginfont}{\normalfont\scriptsize\sffamily}} + {\newcommand{\@tufte@marginfont}{\normalfont\scriptsize}} + +%% +% \RaggedRight allows hyphenation + +\RequirePackage{ragged2e} +\setlength{\RaggedRightRightskip}{\z@ plus 0.08\hsize} + +%% +% Set the justification baesed on the `justified' class option + +\newcommand{\@tufte@justification}{% + \ifthenelse{\boolean{@tufte@justified}} + {\justifying} + {\RaggedRight} +} + +%% +% Turn off section numbering + +\setcounter{secnumdepth}{-1} + +%% +% Tighten up space between displays (e.g., a figure or table) and make symmetric + +\setlength\abovedisplayskip{6pt plus 2pt minus 4pt} +\setlength\belowdisplayskip{6pt plus 2pt minus 4pt} + +%% +% To implement full-width display environments + +\RequirePackage[strict]{chngpage} +% TODO this package may be obsolete -- see the changepage package for a replacement + + + +% Compute length used for full-width displays + +\newlength{\@tufte@overhang} +\setlength{\@tufte@overhang}{\marginparwidth} +\addtolength{\@tufte@overhang}{\marginparsep} + +%% +% Modified \title, \author, and \date commands. These store the +% (footnote-less) values in \thetitle, \theauthor, and \thedate, respectively. + +\newcommand{\thetitle}{}% plain-text-only title +\newcommand{\theauthor}{}% plain-text-only author +\newcommand{\thepublisher}{}% plain-text-only publisher + +\newcommand{\thanklesstitle}{}% full title text minus \thanks{} +\newcommand{\thanklessauthor}{}% full author text minus \thanks{} +\newcommand{\thanklesspublisher}{}% full publisher minus \thanks{} + +\newcommand{\@publisher}{}% full publisher with \thanks{} +\newcommand{\thedate}{\today} + +% TODO Fix it so that \thanks is not spaced out (with `soul') and can be +% used in \maketitle when the `sfsidenotes' option is provided. +\renewcommand{\thanks}[1]{\NoCaseChange{\footnote{#1}}} + +\renewcommand{\title}[2][]{% + \gdef\@title{#2}% + \begingroup% + % TODO store contents of \thanks command + \renewcommand{\thanks}[1]{}% swallow \thanks contents + \protected@xdef\thanklesstitle{#2}% + \endgroup% + \ifthenelse{\isempty{#1}}% + {\renewcommand{\thetitle}{\thanklesstitle}}% use thankless title + {\renewcommand{\thetitle}{#1}}% use provided plain-text title + \hypersetup{pdftitle={\thetitle}}% set the PDF metadata title +} + +\renewcommand*{\author}[2][]{% + \gdef\@author{#2}% + \begingroup% + % TODO store contents of \thanks command + \renewcommand{\thanks}[1]{}% swallow \thanks contents + \protected@xdef\thanklessauthor{#2}% + \endgroup% + \ifthenelse{\isempty{#1}} + {\renewcommand{\theauthor}{\thanklessauthor}}% use thankless author + {\renewcommand{\theauthor}{#1}}% use provided plain-text author + \hypersetup{pdfauthor={\theauthor}}% set the PDF metadata author +} + +\renewcommand*{\date}[1]{% + \gdef\@date{#1}% + \begingroup% + % TODO store contents of \thanks command + \renewcommand{\thanks}[1]{}% swallow \thanks contents + \protected@xdef\thedate{#1}% + \endgroup% +} + +%% +% Provides a \publisher command to set the publisher + +\newcommand{\publisher}[2][]{% + \gdef\@publisher{#2}% + \begingroup% + \renewcommand{\thanks}[1]{}% swallow \thanks contents + \protected@xdef\thanklesspublisher{#2}% + \endgroup% + \ifthenelse{\isempty{#1}} + {\renewcommand{\thepublisher}{\thanklesspublisher}}% use thankless publisher + {\renewcommand{\thepublisher}{#1}}% use provided plain-text publisher +} + +% TODO: Test \hypersetup{pdfauthor,pdftitle} with DVI and XeTeX + +%% +% Require paralist package for tighter lists + +\RequirePackage{paralist} + +% Add rightmargin to compactenum + +\def\@compactenum@{% + \expandafter\list\csname label\@enumctr\endcsname{% + \usecounter{\@enumctr}% + \rightmargin=2em% added this + \parsep\plparsep + \itemsep\plitemsep + \topsep\pltopsep + \partopsep\plpartopsep + \def\makelabel##1{\hss\llap{##1}}}} + +%% +% Improved letterspacing of small caps and all-caps text. +% +% First, try to use the `microtype' package, if it's available. +% Failing that, try to use the `soul' package, if it's available. +% Failing that, well, I give up. + +\RequirePackage{textcase} % provides \MakeTextUppercase and \MakeTextLowercase +\def\allcapsspacing{\relax} +\def\smallcapsspacing{\relax} +\newcommand{\allcaps}[1]{\MakeTextUppercase{\allcapsspacing{#1}}} +\newcommand{\smallcaps}[1]{\MakeTextLowercase{\textsc{#1}}} + +\newcommand{\@tufte@loadsoul}{% + \IfFileExists{soul.sty}{% + \RequirePackage{soul} + \sodef\allcapsspacing{\upshape}{0.15em}{0.65em}{0.6em} + \sodef\smallcapsspacing{\scshape}{0.075em}{0.5em}{0.6em} + }{ + \PackageWarningNoLine{\@tufte@pkgname}{Couldn't locate `soul' package.} + }% soul not installed... giving up. +} + +% If we're using pdfLaTeX v1.40+, use the letterspace package. +% If we're using pdfLaTex < v1.40, use the soul package. +% If we're using XeLaTeX, use XeLaTeX letterspacing options. +% Otherwise fall back on the soul package. + +\ifthenelse{\boolean{@tufte@pdf}} + {\PackageInfo{\@tufte@pkgname}{ifpdf = true}} + {\PackageInfo{\@tufte@pkgname}{ifpdf = false}} + +\ifthenelse{\boolean{@tufte@xetex}} + {\PackageInfo{\@tufte@pkgname}{ifxetex = true}} + {\PackageInfo{\@tufte@pkgname}{ifxetex = false}} + +% Check pdfLaTeX version +\def\@tufte@pdftexversion{0} +\ifx\normalpdftexversion\@undefined \else + \let\pdftexversion \normalpdftexversion + \let\pdftexrevision\normalpdftexrevision + \let\pdfoutput \normalpdfoutput +\fi +\ifx\pdftexversion\@undefined \else + \ifx\pdftexversion\relax \else + \def\@tufte@pdftexversion{6} + \ifnum\pdftexversion < 140 + \def\@tufte@pdftexversion{5} + \fi + \fi +\fi + +\ifthenelse{\boolean{@tufte@letterspace}} + {% + \ifnum\@tufte@pdftexversion<6 + % pdfLaTeX version is too old or not using pdfLaTeX + \ifthenelse{\boolean{@tufte@xetex}} + {% TODO use xetex letterspacing + \PackageInfo{\@tufte@pkgname}{XeTeX detected. Reverting to `soul' package for letterspacing.} + \@tufte@loadsoul} + {% use `soul' package for letterspacing + \PackageInfo{\tufte@pkgname}{Old version of pdfTeX detected. Reverting to `soul' package for letterspacing.} + \@tufte@loadsoul} + \else + \IfFileExists{letterspace.sty}{% + \PackageInfo{\@tufte@pkgname}{Modern version of pdfTeX detected. Using `letterspace' package.} + \RequirePackage{letterspace} + % Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+ + \renewcommand{\allcapsspacing}[1]{\textls[200]{##1}} + \renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}} + \renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}} + \renewcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{##1}}} + }{% microtype failed, check for soul + \PackageInfo{\@tufte@pkgname}{Modern version of pdfTeX detected, but `letterspace' package not installed. Reverting to `soul' package for letterspacing.} + \@tufte@loadsoul + } + \fi} + {} + + +\DeclareTextFontCommand{\textsmallcaps}{\scshape} +\renewcommand{\textsc}[1]{\textsmallcaps{\smallcapsspacing{#1}}} + + +%% +% An environment for paragraph-style section + +\providecommand\newthought[1]{\vspace{1.8\baselineskip plus 3pt minus 2pt}% + {\noindent\textsc{#1}}} + +%% +% Used for doublespacing, and other linespacing +% Note that setspace must be loaded before footmisc or it'll break sidenotes +\usepackage{setspace} + + +%% +% Transform existing \footnotes into \sidenotes +% Sidenote: ``Where God meant footnotes to go.'' ---Tufte + +\RequirePackage[side,multiple,stable]{footmisc} +\providecommand*{\footnotelayout}{\@tufte@marginfont\@tufte@justification} +\renewcommand{\footnotelayout}{\@tufte@marginfont\@tufte@justification} + +% Override footmisc's definition to set the sidenote marks (numbers) inside the +% sidenote's text block. +\long\def\@makefntext#1{\@textsuperscript{\@tufte@marginfont\tiny\@thefnmark}\,\footnotelayout#1} + +% Set the in-text footnote mark in the same typeface as the body text itself. +\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\scriptsize\@thefnmark}}} + +\let\sidenote\footnote + +%% +% Sidenote without the footnote mark + +\providecommand\marginnote[1]% + {\marginpar{\@tufte@marginfont\@tufte@justification #1}} + +%% +% Citations should go in the margin as well + +\RequirePackage{natbib} +\RequirePackage{bibentry} % allows bibitems to be typeset outside thebibliography environment +\nobibliography* % pre-loads the bibliography keys +\providecommand{\doi}[1]{\textsc{doi:} #1} % pre-defining this so it may be used before the \bibliography command it issued +\renewcommand{\cite}[1]{% + \@for\@temp@bibkey:=#1\do{% + \sidenote{\bibentry{\@temp@bibkey}.}% + } +} + +% TODO: Combine sequences of citations so that 2,3,4,6 becomes 2--4,6 +% but be careful of hyperref interaction + +%% +% The placeins package provides the \FloatBarrier command. This forces +% LaTeX to place all of the floats before proceeding. We'll use this to +% keep the float (figure and table) numbers in sequence. +\RequirePackage{placeins} + +%% +% Margin figure environment + +\newsavebox{\@tufte@marginfigbox} +\newenvironment{marginfigure}[1] + [-1.2ex] + {\FloatBarrier% process all floats before this point so the figure numbers stay in order. + \begin{lrbox}{\@tufte@marginfigbox} + \begin{minipage}{\marginparwidth} + \@tufte@marginfont + \def\@captype{figure} + \vspace*{#1} + \@tufte@justification + } + {\end{minipage}% + \end{lrbox}% + \marginpar{\usebox{\@tufte@marginfigbox}}} + + +%% +% Margin table environment +\newsavebox{\@tufte@margintablebox} +\newenvironment{margintable}[1] + [-1.2ex] + {\FloatBarrier% process all floats before this point so the figure numbers stay in order. + \begin{lrbox}{\@tufte@margintablebox} + \begin{minipage}{\marginparwidth} + \@tufte@marginfont + \def\@captype{table} + \vspace*{#1} + \@tufte@justification + } + {\end{minipage}% + \end{lrbox}% + \marginpar{\usebox{\@tufte@margintablebox}}} + + +%% +% Full-width figure + +\renewenvironment{figure*}[1]% + [htbp]% + {\@float{figure}[#1]% + \ifthenelse{\boolean{@tufte@symmetric}} + {\begin{adjustwidth}[]{}{-\@tufte@overhang}} + {\begin{adjustwidth}{}{-\@tufte@overhang}} + \begin{minipage}{\linewidth}}% + {\end{minipage}% + \end{adjustwidth}% + \end@float} + +%% +% Full-width table + +\renewenvironment{table*}[1] + [htbp]% + {\@float{table}[#1]% + \ifthenelse{\boolean{@tufte@symmetric}} + {\begin{adjustwidth}[]{}{-\@tufte@overhang}} + {\begin{adjustwidth}{}{-\@tufte@overhang}} + \begin{minipage}{\linewidth}}% + {\end{minipage}% + \end{adjustwidth}% + \end@float} + +%% +% Full-page-width area + +\newenvironment{fullwidth} + {\ifthenelse{\boolean{@tufte@symmetric}} + {\begin{adjustwidth}[]{}{-\@tufte@overhang}} + {\begin{adjustwidth}{}{-\@tufte@overhang}} + } + {\end{adjustwidth}} + +%% +% Format the captions in a style similar to the sidenotes + +\RequirePackage[format=default,font={rm,scriptsize},justification=raggedright,singlelinecheck=false]{caption} + +% if the `sfsidenotes' option is specified, set the captions in sf, too. +\ifthenelse{\boolean{@tufte@sfsidenotes}} + {\captionsetup{font={sf,scriptsize}}} + {\captionsetup{font={rm,scriptsize}}} + +% if the `justified' option is specified, set the captions in flush left +% and flush right +\ifthenelse{\boolean{@tufte@justified}} + {\captionsetup{justification=justified}} + {\captionsetup{justification=raggedright}} + +%% +% If the Palatino typeface (and its math symbol set) are installed, load +% them unless the `nofonts' class option was provided, or if we're +% compiling with XeLaTeX. + +\ifthenelse{\boolean{@tufte@loadfonts}\AND\NOT\boolean{@tufte@xetex}}{% + \IfFileExists{palatino.sty}{% + \RequirePackage{palatino} + \IfFileExists{mathpazo.sty}{\RequirePackage[osf,sc]{mathpazo}}{} + }{} % if the Palatino typefaces aren't found, do nothing. +}{} + + +%% +% If the Bera Mono typeface is available, use it unless the `nofonts' class +% option was provided, or if we're compiling with XeLaTeX. + +\ifthenelse{\boolean{@tufte@loadfonts}\AND\NOT\boolean{@tufte@xetex}}{% + \IfFileExists{beramono.sty}{% + \RequirePackage[T1]{fontenc} + \RequirePackage[scaled=0.85]{beramono} + }{} +}{} + + +%% +% Sets up the running heads and folios. + +\RequirePackage{fancyhdr} + +% Set the default page style to 'fancy' +\pagestyle{fancy} + +% Set the header/footer width to be the body text block plus the margin +% note area. +\ifthenelse{\boolean{@tufte@symmetric}} + {\fancyhfoffset[LE,RO]{\@tufte@overhang}} + {\fancyhfoffset[RE,RO]{\@tufte@overhang}} + +% The running heads/feet don't have rules +\renewcommand{\headrulewidth}{0pt} +\renewcommand{\footrulewidth}{0pt} + +% The 'fancy' page style is the default style for all pages. +\fancyhf{} % clear header and footer fields +\ifthenelse{\boolean{@tufte@twoside}} + {\fancyhead[LE]{\thepage\quad\smallcaps{\theauthor}}% + \fancyhead[RO]{\smallcaps{\thetitle}\quad\thepage}} + {\fancyhead[RE,RO]{\smallcaps{\thetitle}\quad\thepage}} + + +% The `plain' page style is used on chapter opening pages. +% In Tufte's /Beautiful Evidence/ he never puts page numbers at the +% bottom of pages -- the folios are unexpressed. +\fancypagestyle{plain}{ + \fancyhf{} % clear header and footer fields + % Uncomment the following five lines of code if you want the opening page + % of the chapter to express the folio in the lower outside corner. + %\ifthenelse{\boolean{@tufte@twoside}} + % {\fancyfoot[LE,RO]{\thepage}} + % {\fancyfoot[RE,RO]{\thepage}} +} + +% The `empty' page style suppresses all headers and footers. +% It's used on title pages and `intentionally blank' pages. +\fancypagestyle{empty}{ + \fancyhf{} % clear header and footer fields +} + + + + +%% +% Set raggedright and paragraph indentation for document + +\AtBeginDocument{\@tufte@justification\setlength\parindent{1em}} + + +%% +% Prints the list of class options and their states. + +\newcommand{\typeoutbool}[2]{% + \ifthenelse{\boolean{#2}} + {\typeout{#1: true}} + {\typeout{#1: false}} +} + +\newcommand{\PrintTufteSettings}{% + \typeout{-------------------- Tufte-LaTeX settings ----------} + \typeoutbool{a4paper}{@tufte@afourpaper} + \typeoutbool{load fonts}{@tufte@loadfonts} + \typeoutbool{fully-justified}{@tufte@justified} + \typeoutbool{letterspacing}{@tufte@letterspace} + \typeoutbool{sans-serif sidenotes}{@tufte@sfsidenotes} + \typeoutbool{symmetric margins}{@tufte@symmetric} + \typeoutbool{titlepage}{@tufte@titlepage} + \typeout{----------------------------------------------------} +} + + + +%% +% Color +\RequirePackage{xcolor} + +%% +% Produces a full title page + +\newcommand{\maketitlepage}[0]{% + \cleardoublepage + { + \sffamily + \begin{fullwidth} + \par\noindent\fontsize{18}{18}\selectfont\textcolor{darkgray}{\allcaps{\thanklessauthor}} + \end{fullwidth} + + \vspace{11.5pc} + \begin{fullwidth} + \par\noindent\fontsize{36}{36}\selectfont\textcolor{darkgray}{\allcaps{\thanklesstitle}} + \end{fullwidth} + + \vfill + \begin{fullwidth} + \par\noindent\fontsize{14}{14}\selectfont\allcaps{\thanklesspublisher} + \end{fullwidth} + } + \thispagestyle{empty} + \clearpage +} + +%% +% Title block + +\renewcommand{\maketitle}{% + \newpage + \global\@topnum\z@% prevent floats from being placed at the top of the page + \setlength{\parindent}{0pt} + \setlength{\parskip}{4pt} + \ifthenelse{\boolean{@tufte@sfsidenotes}} + {\begingroup + % FIXME fails with \thanks + \sffamily + \par{\Large\allcaps{\@title}} + \par{\large\allcaps{\@author}} + \par{\large\allcaps{\@date}} + \endgroup} + {\begingroup + \par{\Large\textit{\@title}} + \par{\large\textit{\@author}} + \par{\large\textit{\@date}} + \endgroup} + \thispagestyle{plain}% suppress the running head +} + + +%% +% Title page (if the `titlepage' option was passed to the tufte-handout +% class.) + +\ifthenelse{\boolean{@tufte@titlepage}} + {\renewcommand{\maketitle}{\maketitlepage}} + {} + +%% +% When \cleardoublepage is called, produce a blank (empty) page -- i.e., +% without headers and footers +\def\cleardoublepage{\clearpage\if@twoside\ifodd\c@page\else + \hbox{} + %\vspace*{\fill} + %\begin{center} + % This page intentionally contains only this sentence. + %\end{center} + %\vspace{\fill} + \thispagestyle{empty} + \newpage + \if@twocolumn\hbox{}\newpage\fi\fi\fi} + +%% +% Make Tuftian-style section headings and TOC formatting + +\RequirePackage{titlesec,titletoc} + +% TODO: I'd prefer to use the 'titlesec' package for this formatting, but +% I'll do it old-style for now. --Kevin + +\renewcommand\section{\@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\large\it}} +\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\normalsize\it}} + +% Subsubsection and following section headings shouldn't be used. +% See Bringhurst's _The Elements of Typography_, section 4.2.2. +\renewcommand\subsubsection{% + \PackageError{\@tufte@pkgname}{\noexpand\subsubsection is undefined by this class.% + \MessageBreak See Robert Bringhurst's _The Elements of + \MessageBreak Typographic Style_, section 4.2.2. + \MessageBreak \noexpand\subsubsection was used} + {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as + \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many + \MessageBreak related threads on Ask E.T. at http://www.edwardtufte.com/.} +} + +\renewcommand\paragraph{% + \PackageError{\@tufte@pkgname}{\noexpand\paragraph is undefined by this class.% + \MessageBreak See Robert Bringhurst's _The Elements of + \MessageBreak Typographic Style_, section 4.2.2. + \MessageBreak \noexpand\paragraph was used} + {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as + \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many + \MessageBreak related threads on Ask E.T. at http://www.edwardtufte.com/.} +} + +\renewcommand\subparagraph{% + \PackageError{\@tufte@pkgname}{\noexpand\subparagraph is undefined by this class.% + \MessageBreak See Robert Bringhurst's _The Elements of + \MessageBreak Typographic Style_, section 4.2.2. + \MessageBreak \noexpand\subparagraph was used} + {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as + \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many + \MessageBreak related threads on Ask E.T. at http://www.edwardtufte.com/.} +} + + +% Formatting for main TOC (printed in front matter) +% {section} [left] {above} {before w/label} {before w/o label} {filler + page} [after] +\titlecontents{chapter}% + [0em] % distance from left margin + {\begin{fullwidth}\fontsize{13pt}{18pt}\selectfont} % above (global formatting of entry) + {\contentslabel{2em}\rm\itshape} % before w/label (label = ``Chapter 1'') + {\rm\itshape} % before w/o label + {\rm\qquad\thecontentspage} % filler + page (leaders and page num) + [\vspace{1.5\baselineskip}\end{fullwidth}] % after + +%\titlecontents{chapter}% +% [0em]% distance from left margin +% {\fontsize{12pt}{18pt}\selectfont}% above (global formatting of entry) +% {\textit}% before w/ label (label = ``Chapter 1'') +% {\textit}% before w/o label +% {\qquad\thecontentspage}% filler and page (leaders and page num) +% [\vspace{1.5\baselineskip}]% after + +\titleformat{\chapter}% + [display]% shape + {\relax\begin{fullwidth}}% format applied to label+text + {\itshape\fontsize{22}{24}\selectfont\thechapter}% label + {0pt}% horizontal separation between label and title body + {\fontsize{22}{24}\rm\itshape}% before the title body + [\end{fullwidth}]% after the title body + + + + +%% +% A handy command to disable hyphenation for short bits of text. +% Borrowed from Peter Wilson's `hyphenat' package. + +\newlanguage\langwohyphens% define a language without hyphenation rules +\newcommand{\nohyphens}[1]{{\language\langwohyphens #1}}% used for short bits of text +\newcommand{\nohyphenation}{\language\langwohyphens}% can be used inside environments for longer text + + +%% +% If debugging is enabled, print the Tufte-LaTeX options and the list of +% files. + +\ifthenelse{\boolean{@tufte@debug}} + {\PrintTufteSettings\listfiles} + {} + + +%% +% If there is a `tufte-common-local.sty' file, load it up. + +\IfFileExists{tufte-common-local.sty} + {\RequirePackage{tufte-common-local.sty}} + {} + + +%% +% End of file +\endinput + diff --git a/tufte-handout.cls b/tufte-handout.cls index 8075ec3..5178807 100644 --- a/tufte-handout.cls +++ b/tufte-handout.cls @@ -1,552 +1,48 @@ \NeedsTeXFormat{LaTeX2e}[1994/06/01] -\ProvidesClass{tufte-handout}[2008/11/16 v2.0.1 Tufte-handout class] +\ProvidesClass{tufte-handout}[2008/11/16 v3.0.0 Tufte-handout class] -%% -% a4paper option - -\newif\if@tufteh@afourpaper \@tufteh@afourpaperfalse -\DeclareOption{a4paper}{\@tufteh@afourpapertrue} - -%% -% sfsidenotes option -- typesets sidenotes in sans serif typeface - -\newif\if@tufteh@sfsidenotes \@tufteh@sfsidenotesfalse -\DeclareOption{sfsidenotes}{\@tufteh@sfsidenotestrue} -%% -% symmetric option -- puts marginpar space to the outside edge of the page -% Note: this forces twoside - -\newif\if@tufteh@symmetric\@tufteh@symmetricfalse -\DeclareOption{symmetric}{ - \@tufteh@symmetrictrue - \PassOptionsToClass{twoside}{article} +\PassOptionsToPackage{handout}{tufte-common} +\DeclareOption*{% pass options to tufte-common package and the article class + \PassOptionsToPackage{\CurrentOption}{tufte-common} + \PassOptionsToClass{\CurrentOption}{article} + \PackageInfo{tufte-handout}{Passing \CurrentOption\space to `article' class} } - -%% -% justified option -- uses fully justified text (flush left and flush -% right) instead of ragged right. - -\newif\if@tufteh@justified\@tufteh@justifiedfalse -\DeclareOption{justified}{\@tufteh@justifiedtrue} - - -% FIXME: should probably specify options not supported like Mittelbach's aipproc.cls - -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions \LoadClass{article} -%% -% Detect whether we're in two-side mode or not. (Used to set up running -% heads later.) - -\newif\if@tufteh@twoside\let\if@tufteh@twoside\if@twoside - -%% -% Set page layout geometry - -\RequirePackage[letterpaper,includemp,width=6.5in,marginparsep=0.375in,marginparwidth=2in]{geometry} - -\if@tufteh@afourpaper - \geometry{a4paper,includemp,width=170mm,marginparsep=10mm,marginparwidth=50mm} -\fi - -\if@tufteh@symmetric -\else - \geometry{asymmetric} -\fi - - -%% -% Separation marginpars by a line's worth of space. - -\setlength\marginparpush{\baselineskip} - -%% -% Font for margin items - -\if@tufteh@sfsidenotes - \newcommand{\@tufteh@marginfont}{\normalfont\scriptsize\sffamily} -\else - \newcommand{\@tufteh@marginfont}{\normalfont\scriptsize} -\fi - -%% -% \RaggedRight allows hyphenation - -\RequirePackage{ragged2e} -\setlength{\RaggedRightRightskip}{\z@ plus 0.08\hsize} - -%% -% Set the justification baesed on the `justified' class option - -\newcommand{\@tufteh@justification}{% - \if@tufteh@justified - \justifying - \else - \RaggedRight - \fi -} - -%% -% Turn off section numbering - -\setcounter{secnumdepth}{-1} - -%% -% Tighten up space between displays (e.g., a figure or table) and make symmetric - -\setlength\abovedisplayskip{6pt plus 2pt minus 4pt} -\setlength\belowdisplayskip{6pt plus 2pt minus 4pt} - -%% -% To implement full-width display environments - -\RequirePackage[strict]{chngpage} - -%% -% Detect if we're using pdfLaTeX -\IfFileExists{ifpdf.sty}{% - \RequirePackage{ifpdf} -}{% assume we're not using pdfTex? - \newif\ifpdf\pdffalse -} - -%% -% Detect if we're using XeLaTeX -\IfFileExists{ifxetex.sty}{% - \RequirePackage{ifxetex} -}{% not using xelatex - \newif\ifxetex\xetexfalse -} - +\RequirePackage{tufte-common} -% Compute length used for full-width displays - -\newlength{\@tufteh@overhang} -\setlength{\@tufteh@overhang}{\marginparwidth} -\addtolength{\@tufteh@overhang}{\marginparsep} %% -% Alter \maketitle from article.cls - -\renewcommand\maketitle{\par - \global\let\and\relax - \global\let\thanks\footnote - \begingroup - \newpage - \global\@topnum\z@ - \@maketitle - \endgroup - \global\let\thanks\relax - \global\let\maketitle\relax - \global\let\@maketitle\relax - \global\let\@thanks\@empty - %\global\let\@author\@empty - %\global\let\@date\@empty - %\global\let\@title\@empty - \global\let\title\relax - \global\let\author\relax - \global\let\date\relax -} -\def\@maketitle{% - \newpage - \noindent\sffamily\large{\allcaps{\@title}}\\ - \vskip0.5\baselineskip - \noindent\normalsize{\allcaps{\@author}}\\ - \vskip0.3\baselineskip - \noindent{\allcaps{\@date}} - \thispagestyle{plain} -} +% Set up any handout-specific stuff now %% % Abstract -\renewenvironment{abstract}% - {\begin{quotation} - \begin{sffamily} - \begin{small}}% - { \end{small} - \end{sffamily} - \end{quotation}} - -%% -% Require paralist package for tighter lists - -\RequirePackage{paralist} - -% Add rightmargin to compactenum - -\def\@compactenum@{% - \expandafter\list\csname label\@enumctr\endcsname{% - \usecounter{\@enumctr}% - \rightmargin=2em% added this - \parsep\plparsep - \itemsep\plitemsep - \topsep\pltopsep - \partopsep\plpartopsep - \def\makelabel##1{\hss\llap{##1}}}} - -%% -% Improved letterspacing of small caps and all-caps text. -% -% First, try to use the `microtype' package, if it's available. -% Failing that, try to use the `soul' package, if it's available. -% Failing that, well, I give up. - -\RequirePackage{textcase} % provides \MakeTextUppercase and \MakeTextLowercase -\def\allcapsspacing{\relax} -\def\smallcapsspacing{\relax} -\newcommand{\allcaps}[1]{\MakeTextUppercase{\allcapsspacing{#1}}} -\newcommand{\smallcaps}[1]{\MakeTextLowercase{\textsc{#1}}} - -\newcommand{\@tufteh@loadsoul}{% - \IfFileExists{soul.sty}{% - \RequirePackage{soul} - \sodef\allcapsspacing{\upshape}{0.15em}{0.65em}{0.6em} - \sodef\smallcapsspacing{\scshape}{0.075em}{0.5em}{0.6em} - }{ - \PackageWarningNoLine{tufte-handout}{Couldn't locate `soul' package.} - }% soul not installed... giving up. +% TODO The abstract should be printed on its own page of the `titlepage' +% option was specified. +\renewenvironment{abstract}{% + \begin{quotation} + \if@tufte@sfsidenotes\begin{sffamily}\fi + \begin{small} +}{% + \end{small} + \if@tufte@sfsidenotes\end{sffamily}\fi + \end{quotation} } -% If we're using pdfLaTeX v1.40+, use the letterspace package. -% If we're using pdfLaTex < v1.40, use the soul package. -% If we're using XeLaTeX, use XeLaTeX letterspacing options. -% Otherwise fall back on the soul package. - -\ifpdf\PackageInfo{tufte-handout}{ifpdf = true} -\else\PackageInfo{tufte-handout}{ifpdf = false} -\fi - -\ifxetex\PackageInfo{tufte-handout}{ifxetex = true} -\else\PackageInfo{tufte-handout}{ifxetex = false} -\fi - - - -% Check pdfLaTeX version -\def\@tufteh@pdftexversion{0} -\ifx\normalpdftexversion\@undefined \else - \let\pdftexversion \normalpdftexversion - \let\pdftexrevision\normalpdftexrevision - \let\pdfoutput \normalpdfoutput -\fi -\ifx\pdftexversion\@undefined \else - \ifx\pdftexversion\relax \else - \def\@tufteh@pdftexversion{6} - \ifnum\pdftexversion < 140 - \def\@tufteh@pdftexversion{5} - \fi - \fi -\fi - -\ifnum\@tufteh@pdftexversion<6 - % pdfLaTeX version is too old or not using pdfLaTeX - \ifxetex - % TODO use xetex letterspacing - \PackageInfo{tufte-handout}{XeTeX detected. Reverting to `soul' package for letterspacing.} - \@tufteh@loadsoul - \else - \PackageInfo{tufte-handout}{Old version of pdfTeX detected. Reverting to `soul' package for letterspacing.} - \@tufteh@loadsoul - \fi -\else - \IfFileExists{letterspace.sty}{% - \PackageInfo{tufte-handout}{Modern version of pdfTeX detected. Using `letterspace' package.} - \RequirePackage{letterspace} - % Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+ - \renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}} - \renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}} - \renewcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{##1}}} - }{% microtype failed, check for soul - \PackageInfo{tufte-handout}{Modern version of pdfTeX detected, but `letterspace' package not installed. Reverting to `soul' package for letterspacing.} - \@tufteh@loadsoul - } -\fi - - -\DeclareTextFontCommand{\textsmallcaps}{\scshape} -\renewcommand{\textsc}[1]{\textsmallcaps{\smallcapsspacing{#1}}} - %% -% An environment for paragraph-style section +% If there is a `tufte-handout-local.sty' file, load it. -\providecommand\newthought[1]{\vspace{1.8\baselineskip plus 3pt minus 2pt}% - {\noindent\textsc{#1}}} - -%% -% Transform existing \footnotes into \sidenotes -% Sidenote: ``Where God meant footnotes to go.'' ---Tufte - -\RequirePackage[side,multiple]{footmisc} -\providecommand*{\footnotelayout}{\@tufteh@marginfont\@tufteh@justification} -\renewcommand{\footnotelayout}{\@tufteh@marginfont\@tufteh@justification} - -% Override footmisc's definition to set the sidenote marks (numbers) inside the -% sidenote's text block. -\long\def\@makefntext#1{\@textsuperscript{\@tufteh@marginfont\tiny\@thefnmark}\,\footnotelayout#1} - -% Set the in-text footnote mark in the same typeface as the body text itself. -\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\scriptsize\@thefnmark}}} - -\let\sidenote\footnote - -%% -% Sidenote without the footnote mark - -\providecommand\marginnote[1]% - {\marginpar{\@tufteh@marginfont\@tufteh@justification #1}} - -%% -% Citations should go in the margin as well - -\RequirePackage{natbib} -\RequirePackage{bibentry} % allows bibitems to be typeset outside thebibliography environment -\nobibliography* % pre-loads the bibliography keys -\renewcommand{\cite}[1]{\sidenote{\bibentry{#1}.}} -\providecommand{\doi}[1]{\textsc{doi:} #1} % pre-defining this so it may be used before the \bibliography command it issued - -% TODO: Rewrite \cite so that you can specify multiple bib keys -% at once. For example, \cite{Author01,Author02} -% TODO: Combine sequences of citations so that 2,3,4,6 becomes 2-4,6 -% but be careful of hyperref interaction - -%% -% Make Tuftian-style section headings - -% TODO: I'd prefer to use the 'titlesec' package for this formatting, but -% I'll do it old-style for now. --Kevin - -\renewcommand\section{\@startsection {section}{1}{\z@}% - {-3.5ex \@plus -1ex \@minus -.2ex}% - {2.3ex \@plus.2ex}% - {\normalfont\large\it}} -\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% - {-3.25ex\@plus -1ex \@minus -.2ex}% - {1.5ex \@plus .2ex}% - {\normalfont\normalsize\it}} - -% Subsubsection and following section headings shouldn't be used. -% See Bringhurst's _The Elements of Typography_, section 4.2.2. -\renewcommand\subsubsection{% - \PackageError{tufte-handout}{\noexpand\subsubsection is undefined by this class.% - \MessageBreak See Robert Bringhurst's _The Elements of - \MessageBreak Typographic Style_, section 4.2.2. - \MessageBreak \noexpand\subsubsection was used} - {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as - \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many - \MessageBreak related threads on Ask E.T. at http://www.edwardtufte.com/.} -} - -\renewcommand\paragraph{% - \PackageError{tufte-handout}{\noexpand\paragraph is undefined by this class.% - \MessageBreak See Robert Bringhurst's _The Elements of - \MessageBreak Typographic Style_, section 4.2.2. - \MessageBreak \noexpand\paragraph was used} - {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as - \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many - \MessageBreak related threads on Ask E.T. at http://www.edwardtufte.com/.} -} - -\renewcommand\subparagraph{% - \PackageError{tufte-handout}{\noexpand\subparagraph is undefined by this class.% - \MessageBreak See Robert Bringhurst's _The Elements of - \MessageBreak Typographic Style_, section 4.2.2. - \MessageBreak \noexpand\subparagraph was used} - {From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as - \MessageBreak many levels of headings as you need, no more and no fewer. Also see the many - \MessageBreak related threads on Ask E.T. at http://www.edwardtufte.com/.} -} - - -%% -% The placeins package provides the \FloatBarrier command. This forces -% LaTeX to place all of the floats before proceeding. We'll use this to -% keep the float (figure and table) numbers in sequence. -\RequirePackage{placeins} - -%% -% Margin figure environment - -\newsavebox{\@tufteh@marginfigbox} -\newenvironment{marginfigure}[1] - [-1.2ex] - {\FloatBarrier% process all floats before this point so the figure numbers stay in order. - \begin{lrbox}{\@tufteh@marginfigbox} - \begin{minipage}{\marginparwidth} - \@tufteh@marginfont - \def\@captype{figure} - \vspace*{#1} - \@tufteh@justification - } - {\end{minipage}% - \end{lrbox}% - \marginpar{\usebox{\@tufteh@marginfigbox}}} - - -%% -% Margin table environment -\newsavebox{\@tufteh@margintablebox} -\newenvironment{margintable}[1] - [-1.2ex] - {\FloatBarrier% process all floats before this point so the figure numbers stay in order. - \begin{lrbox}{\@tufteh@margintablebox} - \begin{minipage}{\marginparwidth} - \@tufteh@marginfont - \def\@captype{table} - \vspace*{#1} - \@tufteh@justification - } - {\end{minipage}% - \end{lrbox}% - \marginpar{\usebox{\@tufteh@margintablebox}}} +\IfFileExists{tufte-handout-local.tex} + {\input{tufte-handout-local.tex}} + {} %% -% Full-width figure - -\renewenvironment{figure*}[1]% - [htbp]% - {\@float{figure}[#1]% - \if@tufteh@symmetric - \begin{adjustwidth}[]{}{-\@tufteh@overhang}% - \else - \begin{adjustwidth}{}{-\@tufteh@overhang}% - \fi - \begin{minipage}{\linewidth}}% - {\end{minipage}% - \end{adjustwidth}% - \end@float} - -%% -% Full-width table - -\renewenvironment{table*}[1] - [htbp]% - {\@float{table}[#1]% - \if@tufteh@symmetric - \begin{adjustwidth}[]{}{-\@tufteh@overhang}% - \else - \begin{adjustwidth}{}{-\@tufteh@overhang}% - \fi - \begin{minipage}{\linewidth}}% - {\end{minipage}% - \end{adjustwidth}% - \end@float} - -%% -% Full-page-width area - -\newenvironment{fullwidth} - {\if@tufteh@symmetric - \begin{adjustwidth}[]{}{-\@tufteh@overhang}% - \else - \begin{adjustwidth}{}{-\@tufteh@overhang}% - \fi - } - {\end{adjustwidth}} - -%% -% Format the captions in a style similar to the sidenotes - -\RequirePackage[format=default,font={rm,scriptsize},justification=raggedright,singlelinecheck=false]{caption} - -% if the `sfsidenotes' option is specified, set the captions in sf, too. -\if@tufteh@sfsidenotes - \captionsetup{font={sf,scriptsize}} -\else - \captionsetup{font={rm,scriptsize}} -\fi - -% if the `justified' option is specified, set the captions in flush left -% and flush right -\if@tufteh@justified - \captionsetup{justification=justified} -\else - \captionsetup{justification=raggedright} -\fi - -%% -% If the Palatino typeface (and its math symbol set) are installed, load them. - -\IfFileExists{palatino.sty}{% - \RequirePackage{palatino} - \IfFileExists{mathpazo.sty}{\RequirePackage[osf,sc]{mathpazo}}{} -}{} % if the Palatino typefaces aren't found, do nothing. - - -%% -% If the Bera Mono typeface is available, use it. - -\IfFileExists{beramono.sty}{% - \RequirePackage[T1]{fontenc} - \RequirePackage[scaled=0.85]{beramono} -}{} - - -%% -% Sets up the running heads and folios. - -\RequirePackage{fancyhdr} - -% Set the header/footer width to be the body text block plus the margin -% note area. -\if@tufteh@symmetric - \fancyhfoffset[LE,RO]{\@tufteh@overhang} -\else - \fancyhfoffset[RE,RO]{\@tufteh@overhang} -\fi - -% The 'fancy' page style is the default style for all pages. -\fancyhf{} % clear header and footer fields -\if@tufteh@twoside - \fancyhead[LE]{\thepage\quad\smallcaps{\@author}} - \fancyhead[RO]{\smallcaps{\@title}\quad\thepage} -\else - \fancyhead[RE,RO]{\smallcaps{\@title}\quad\thepage} -\fi -\renewcommand{\headrulewidth}{0pt} -\renewcommand{\footrulewidth}{0pt} - -% The 'plain' page style is used on chapter opening pages. -\fancypagestyle{plain}{ - \fancyhf{} % clear header and footer fields - \if@tufteh@twoside - \fancyfoot[LE,RO]{\thepage} - \else - \fancyfoot[RE,RO]{\thepage} - \fi -} - -% The 'empty' page style suppresses all headers and footers. -% It's used on title pages and `intentionally blank' pages. -\fancypagestyle{empty}{ - \fancyhf{} % clear header and footer fields -} - -% Set the default page style to 'fancy' -\pagestyle{fancy} - - -%% -% Set raggedright and paragraph indentation for document - -\AtBeginDocument{\@tufteh@justification\setlength\parindent{1em}} - - -%% -% Prints the list of class options and their states. -\newcommand{\printclassoptions}{% - \texttt{symmetric}---\if@tufteh@symmetric true\else false\fi\\ - \texttt{a4paper}---\if@tufteh@afourpaper true\else false\fi\\ - \texttt{twoside}---\if@tufteh@twoside true\else false\fi\\ - \texttt{sfsidenotes}---\if@tufteh@sfsidenotes true\else false\fi\\ - \texttt{justified}---\if@tufteh@justified true\else false\fi -} - +% End of file \endinput