diff --git a/sample-book.pdf b/sample-book.pdf index 0d4b527..92d74d8 100644 Binary files a/sample-book.pdf and b/sample-book.pdf differ diff --git a/sample-book.tex b/sample-book.tex index 7871c72..525099d 100644 --- a/sample-book.tex +++ b/sample-book.tex @@ -53,6 +53,8 @@ \newcommand{\VE}{\textit{Visual Explanations}\xspace} \newcommand{\BE}{\textit{Beautiful Evidence}\xspace} +\newcommand{\TL}{Tufte-\LaTeX\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 @@ -74,10 +76,12 @@ } % Inserts a blank page -\newcommand{\blankpage}{% - \newpage~\\\thispagestyle{empty}\newpage -} +\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage} + +\usepackage{units} +% Typesets the font size, leading, and measure in the form of 10/12x26 pc. +\newcommand{\measure}[3]{#1/#2$\times$\unit[#3]{pc}} \begin{document} @@ -164,11 +168,9 @@ and \mbox{Donald E.~Knuth}. \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. +and the use of the \texttt{tufte-book} and \texttt{sample-handout} document classes. -\lipsum[1-20] %% % Start the main matter (normal chapters) @@ -284,32 +286,118 @@ Publisher & & & & \\ \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*} +\begin{figure*}[p] +\fbox{\includegraphics[width=0.45\linewidth]{graphics/vdqi-title.pdf}} +\hfill +\fbox{\includegraphics[width=0.45\linewidth]{graphics/ei-title.pdf}} +\\\vspace{\baselineskip} +\fbox{\includegraphics[width=0.45\linewidth]{graphics/ve-title.pdf}} +\hfill +\fbox{\includegraphics[width=0.45\linewidth]{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*} +\begin{figure*}[p] +\fbox{\includegraphics[width=0.45\linewidth]{graphics/vdqi-contents.pdf}} +\hfill +\fbox{\includegraphics[width=0.45\linewidth]{graphics/ei-contents.pdf}} +\\\vspace{\baselineskip} +\fbox{\includegraphics[width=0.45\linewidth]{graphics/ve-contents.pdf}} +\hfill +\fbox{\includegraphics[width=0.45\linewidth]{graphics/be-contents.pdf}} +\end{figure*} + + +\section{Typefaces} + +Tufte's books primarily use two typefaces: Bembo and Gill Sans. Bembo is used +for the headings and body text, while Gill Sans is used for the title page and +opening epigraphs in \BE. + +Since neither Bembo nor Gill Sans are available in default \LaTeX{} +installations, the \TL document classes default to using Palatino and +Helvetica, respectively. In addition, the Bera Mono typeface is used for +\texttt{monospaced} type. + +The following font sizes are defined by the \TL classes: + +\begin{table}[h] + \footnotesize% + \begin{center} + \begin{tabular}{lccl} + \toprule + \LaTeX{} size & Font size & Leading & Used for \\ + \midrule + \verb+\tiny+ & 5 & 6 & sidenote numbers \\ + \verb+\scriptsize+ & 7 & 8 & --- \\ + \verb+\footnotesize+ & 8 & 10 & sidenotes, captions \\ + \verb+\small+ & 9 & 12 & quote, quotation, and verse environments \\ + \verb+\normalsize+ & 10 & 14 & body text \\ + \verb+\large+ & 11 & 15 & \textsc{b}-heads \\ + \verb+\Large+ & 12 & 16 & \textsc{a}-heads, \textsc{toc} entries, author, date \\ + \verb+\LARGE+ & 14 & 18 & handout title \\ + \verb+\huge+ & 20 & 30 & chapter heads \\ + \verb+\Huge+ & 24 & 36 & part titles \\ + \bottomrule + \end{tabular} + \end{center} + \caption{A list of \LaTeX{} font sizes as defined by the \TL document classes.} + \label{tab:font-sizes} +\end{table} + +\section{Headings} + +Tufte's books include the following heading levels: parts, +chapters,\sidenote{Parts and chapters are defined for the \texttt{tufte\-book} +class only.} sections, subsections, and paragraphs. Not defined by default +are: sub-subsections and subparagraphs. + +\begin{table}[h] + \begin{center} + \footnotesize% + \begin{tabular}{lcr} + \toprule + Heading & Style & Size \\ + \midrule + Part & roman & \measure{24}{36}{40} \\ + Chapter & italic & \measure{20}{30}{40} \\ + Section & italic & \measure{12}{16}{26} \\ + Subsection & italic & \measure{11}{15}{26} \\ + Paragraph & italic & 10/14 \\ + \bottomrule + \end{tabular} + \end{center} + \caption{Heading styles used in \BE.} + \label{tab:heading-styles} +\end{table} + +\section{Environments} + +The following characteristics define the various environments: + + +\begin{table}[h] + \begin{center} + \footnotesize% + \begin{tabular}{lcl} + \toprule + Environment & Font size & Notes \\ + \midrule + Body text & \measure{10}{14}{26} & \\ + Block quote & \measure{9}{12}{24} & Block indent (left and right) by \unit[1]{pc} \\ + Sidenotes & \measure{8}{10}{12} & Sidenote number is set inline, followed by word space \\ + Captions & \measure{8}{10}{12} & \\ + \bottomrule + \end{tabular} + \end{center} + \caption{Environment styles used in \BE.} + \label{tab:environment-styles} +\end{table} -\lipsum[21-50] \chapter{On the Use of the \texttt{tufte-book} Document Class} \label{ch:tufte-book} @@ -325,7 +413,7 @@ title page and epigraphs); and \item \emph{something else---yyy}. \end{inparaenum} -\lipsum[1-25] +%\lipsum[1-25] %% diff --git a/sample-handout.pdf b/sample-handout.pdf index 0b07591..6c3c483 100644 Binary files a/sample-handout.pdf and b/sample-handout.pdf differ diff --git a/sample-handout.tex b/sample-handout.tex index 36433da..a0d48fa 100644 --- a/sample-handout.tex +++ b/sample-handout.tex @@ -284,10 +284,10 @@ however. This allows one to use both uppercase and lowercase letters: \section{Customization}\label{sec:customization} \subsection{Document class options}\label{sec:options} -The \doccls{tufte\-handout} class is based on the \LaTeX\ \doccls{article} +The \doccls{tufte-handout} class is based on the \LaTeX\ \doccls{article} document class. Therefore, you can pass any of the typical article options. There are a few options that are specific to the -\doccls{tufte\-handout} document class, however. +\doccls{tufte-handout} document class, however. The \docclsopt{a4paper} option will set the paper size to \smallcaps{A4} instead of the default \smallcaps{US} letter size. @@ -373,7 +373,6 @@ The website for the Tufte-\LaTeX\ packages is located at \url{http://code.google.com/p/tufte-latex/}. On our website, you'll find links to our \smallcaps{svn} repository, mailing lists, bug tracker, and documentation. - \bibliography{sample-handout} \bibliographystyle{plainnat} diff --git a/tufte-common.sty b/tufte-common.sty index fd0cab8..78c8abc 100644 --- a/tufte-common.sty +++ b/tufte-common.sty @@ -193,11 +193,11 @@ } \renewcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt} \renewcommand\tiny{\@setfontsize\tiny\@vpt\@vipt} -\renewcommand\large{\@setfontsize\large\@xiipt{14}} -\renewcommand\Large{\@setfontsize\Large\@xivpt{18}} -\renewcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} -\renewcommand\huge{\@setfontsize\huge\@xxpt{25}} -\renewcommand\Huge{\@setfontsize\Huge\@xxvpt{30}} +\renewcommand\large{\@setfontsize\large\@xipt{15}} +\renewcommand\Large{\@setfontsize\Large\@xiipt{16}} +\renewcommand\LARGE{\@setfontsize\LARGE\@xivpt{18}} +\renewcommand\huge{\@setfontsize\huge\@xxpt{30}} +\renewcommand\Huge{\@setfontsize\Huge\@xxivpt{36}} \setlength\leftmargini {1pc} \setlength\leftmarginii {1pc} @@ -218,7 +218,7 @@ % Paragraph indentation and separation for normal text \newcommand{\@tufte@reset@par}{% - \setlength{\RaggedRightParindent}{1.0pc} + \setlength{\RaggedRightParindent}{1.0pc}% \setlength{\parindent}{1pc}% \setlength{\parskip}{0pt}% } @@ -529,6 +529,37 @@ \ifthenelse{\boolean{@tufte@loadbidi}}{\RequirePackage{bidi}}{} +%% +% A function that removes leading and trailling spaces from the supplied macro. +% Based on code written by Michael Downes (See ``Around the Bend'', #15.) +% Executing \@tufte@trim@spaces\xyzzy will result in the contents of \xyzzy +% being trimmed of leading and trailing white space. + +\def\@tufte@trim@spaces#1{% + % Use grouping to emulate a multi-token afterassignment queue + \begingroup% + % Put `\toks 0 {' into the afterassignment queue + \aftergroup\toks\aftergroup0\aftergroup{% + % Apply \trimb to the replacement text of #1, adding a leading + % \noexpand to prevent brace stripping and to serve another purpose + % later. + \expandafter\@tufte@trim@b\expandafter\noexpand#1Q Q}% + % Transfer the trimmed text back into #1. + \edef#1{\the\toks0}% +} + +% \trimb removes a trailing space if present, then calls \@tufte@trim@c to +% clean up any leftover bizarre Qs, and trim a leading space. In +% order for \trimc to work properly we need to put back a Q first. +\def\@tufte@trim@b#1 Q{\@tufte@trim@c#1Q} + +% Execute \vfuzz assignment to remove leading space; the \noexpand +% will now prevent unwanted expansion of a macro or other expandable +% token at the beginning of the trimmed text. The \endgroup will feed +% in the \aftergroup tokens after the \vfuzz assignment is completed. +\def\@tufte@trim@c#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1} + + %% % Citations should go in the margin as sidenotes @@ -542,7 +573,7 @@ \BR@c@bibitem{#2}% } \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 +\providecommand{\doi}[1]{\textsc{doi:} #1}% pre-defining this so it may be used before the \bibliography command it issued %% % Normal \cite behavior @@ -557,8 +588,10 @@ \@for\@temp@bibkeyx:=#2\do{% \ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}% {\ifthenelse{\equal{\value{@tufte@num@bibkeys}}{0}}{}{and\ }% + \@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey \bibentry{\@temp@bibkeyx}}% - {\bibentry{\@temp@bibkeyx};\ }% + {\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey + \bibentry{\@temp@bibkeyx};\ }% \stepcounter{@tufte@num@bibkeys}% }% }% @@ -591,8 +624,10 @@ \@for\@temp@bibkeyx:=\@tufte@citations\do{% \ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}% {\ifthenelse{\equal{\value{@tufte@num@bibkeys}}{0}}{}{and\ }% + \@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey \bibentry{\@temp@bibkeyx}}% - {\bibentry{\@temp@bibkeyx};\ }% + {\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey + \bibentry{\@temp@bibkeyx};\ }% \stepcounter{@tufte@num@bibkeys}% }% \@tufte@reset@par% use parindent and parskip settings for body text @@ -644,11 +679,11 @@ } \newcommand{\@tufte@check@multiple@sidenotes}{% - \ifdim\lastkern=\multiplefootnotemarker\relax + \ifdim\lastkern=\multiplefootnotemarker\relax% \edef\@x@sf{\the\spacefactor}% - \unkern + \unkern% \textsuperscript{\multfootsep}% - \spacefactor\@x@sf\relax + \spacefactor\@x@sf\relax% \fi } @@ -683,12 +718,12 @@ \gdef\@tufte@citations{}% clear out any old citations \ifthenelse{\NOT\isempty{#2}}{\renewcommand{\@tufte@sidenote@vertical@offset}{#2}}{}% \ifthenelse{\isempty{#1}}{% -% % no footnote number + % no specific footnote number provided \stepcounter\@mpfn% \protected@xdef\@thefnmark{\thempfn}% \@footnotemark\@footnotetext[\@tufte@sidenote@vertical@offset]{#3}% }{% -% % footnote number + % specific footnote number provided \begingroup% \csname c@\@mpfn\endcsname #1\relax% \unrestored@protected@xdef\@thefnmark{\thempfn}% @@ -1125,19 +1160,17 @@ {\begingroup % FIXME fails with \thanks \sffamily - \par{\Large\allcaps{\@title}} - \ifthenelse{\equal{\@author}{}}{}{\par{\large\allcaps{\@author}}} - \ifthenelse{\equal{\@date}{}}{}{\par{\large\allcaps{\@date}}} + \par{\LARGE\allcaps{\@title}} + \ifthenelse{\equal{\@author}{}}{}{\par{\Large\allcaps{\@author}}} + \ifthenelse{\equal{\@date}{}}{}{\par{\Large\allcaps{\@date}}} \endgroup} {\begingroup - \par{\Large\textit{\@title}} - \ifthenelse{\equal{\@author}{}}{}{\par{\large\textit{\@author}}} - \ifthenelse{\equal{\@date}{}}{}{\par{\large\textit{\@date}}} + \par{\LARGE\textit{\@title}} + \ifthenelse{\equal{\@author}{}}{}{\par{\Large\textit{\@author}}} + \ifthenelse{\equal{\@date}{}}{}{\par{\Large\textit{\@date}}} \endgroup} \par \endgroup - \setlength{\parindent}{1pc} - \setlength{\parskip}{0pt} \thispagestyle{plain}% suppress the running head } @@ -1169,18 +1202,34 @@ \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}} - +\titleformat{\chapter}% + [display]% shape + {\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\begin{fullwidth}}{}}% format applied to label+text + {\itshape\huge\thechapter}% label + {0pt}% horizontal separation between label and title body + {\huge\rm\itshape}% before the title body + [\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body + +\titleformat{\section}% + [hang]% shape + {\normalfont\Large\itshape}% format applied to label+text + {\thesection}% label + {1em}% horizontal separation between label and title body + {}% before the title body + []% after the title body + +\titleformat{\subsection}% + [hang]% shape + {\normalfont\large\itshape}% format applied to label+text + {\thesubsection}% label + {1em}% horizontal separation between label and title body + {}% before the title body + []% after the title body + +\titlespacing*{\chapter}{0pt}{50pt}{40pt} +\titlespacing*{\section}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex} +\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus.2ex} + % Subsubsection and following section headings shouldn't be used. % See Bringhurst's _The Elements of Typography_, section 4.2.2. \renewcommand\subsubsection{% @@ -1235,15 +1284,6 @@ % {\qquad\thecontentspage}% filler and page (leaders and page num) % [\vspace{1.5\baselineskip}]% after -\titleformat{\chapter}% - [display]% shape - {\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\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 - [\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body - - %%