You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
6.8KB

  1. \NeedsTeXFormat{LaTeX2e}[1994/06/01]
  2. \ProvidesClass{tufte-handout}[2008/02/11 v1.2.3 Tufte-handout class]
  3. %%
  4. % a4paper option
  5. \newif\if@tufteh@afourpaper \@tufteh@afourpaperfalse
  6. \DeclareOption{a4paper}{\@tufteh@afourpapertrue}
  7. %%
  8. % sfsidenotes option -- typesets sidenotes in sans serif typeface
  9. \newif\if@tufteh@sfsidenotes \@tufteh@sfsidenotesfalse
  10. \DeclareOption{sfsidenotes}{\@tufteh@sfsidenotestrue}
  11. % FIXME: should probably specify options not supported like Mittelbach's aipproc.cls
  12. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
  13. \ProcessOptions
  14. \LoadClass{article}%
  15. %%
  16. % Set page layout geometry
  17. \if@tufteh@afourpaper
  18. \RequirePackage[a4paper,includemp,width=170mm,marginparsep=10mm,marginparwidth=50mm]{geometry}
  19. \else
  20. \RequirePackage[letterpaper,includemp,width=6.5in,marginparsep=0.375in,marginparwidth=2in]{geometry}
  21. \fi
  22. %%
  23. % Separation marginpars by a line's worth of space.
  24. \setlength\marginparpush{\baselineskip}
  25. %%
  26. % Font for margin items
  27. \if@tufteh@sfsidenotes
  28. \newcommand{\@tufteh@marginfont}{\normalfont\scriptsize\sffamily}
  29. \else
  30. \newcommand{\@tufteh@marginfont}{\normalfont\scriptsize}
  31. \fi
  32. %%
  33. % Modify \raggedright from latex.ltx to allow hyphenation per Donald Arseneau
  34. \def\@tufteh@raggedright{%
  35. \let\\\@centercr\@rightskip\z@ plus 0.08\hsize
  36. \rightskip\@rightskip
  37. \leftskip\z@skip}
  38. %%
  39. % Turn off section numbering
  40. \setcounter{secnumdepth}{-1}
  41. %%
  42. % Tighten up space between displays (e.g., a figure or table) and make symmetric
  43. \setlength\abovedisplayskip{6pt plus 2pt minus 4pt}
  44. \setlength\belowdisplayskip{6pt plus 2pt minus 4pt}
  45. %%
  46. % To implement full-width display environments
  47. \RequirePackage{chngpage}
  48. % Compute length used for full-width displays
  49. \newlength{\@tufteh@overhang}
  50. \setlength{\@tufteh@overhang}{\marginparwidth}
  51. \addtolength{\@tufteh@overhang}{\marginparsep}
  52. %%
  53. % Alter \maketitle from article.cls
  54. \renewcommand\maketitle{\par
  55. \global\let\and\relax
  56. \global\let\thanks\footnote
  57. \begingroup
  58. \newpage
  59. \global\@topnum\z@
  60. \@maketitle
  61. \endgroup
  62. \global\let\thanks\relax
  63. \global\let\maketitle\relax
  64. \global\let\@maketitle\relax
  65. \global\let\@thanks\@empty
  66. \global\let\@author\@empty
  67. \global\let\@date\@empty
  68. \global\let\@title\@empty
  69. \global\let\title\relax
  70. \global\let\author\relax
  71. \global\let\date\relax
  72. }
  73. \def\@maketitle{%
  74. \newpage
  75. \noindent\sffamily\large{\@title}\\
  76. \vskip0.5\baselineskip
  77. \noindent\normalsize{\@author}\\
  78. \vskip0.3\baselineskip
  79. \noindent{\@date}
  80. \thispagestyle{empty}
  81. }
  82. %%
  83. % Abstract
  84. \renewenvironment{abstract}%
  85. {\begin{quotation}
  86. \begin{sffamily}
  87. \begin{small}}%
  88. { \end{small}
  89. \end{sffamily}
  90. \end{quotation}}
  91. %%
  92. % Require paralist package for tighter lists
  93. \RequirePackage{paralist}
  94. % Add rightmargin to compactenum
  95. \def\@compactenum@{%
  96. \expandafter\list\csname label\@enumctr\endcsname{%
  97. \usecounter{\@enumctr}%
  98. \rightmargin=2em% added this
  99. \parsep\plparsep
  100. \itemsep\plitemsep
  101. \topsep\pltopsep
  102. \partopsep\plpartopsep
  103. \def\makelabel##1{\hss\llap{##1}}}}
  104. %%
  105. % An environment for paragraph-style section
  106. \providecommand\newthought[1]{\vspace{1.8\baselineskip plus 3pt minus 2pt}%
  107. {\noindent\scshape #1}}
  108. %%
  109. % Transform existing \footnotes into \sidenotes
  110. % Sidenote: ``Where God meant footnotes to go.'' ---Tufte
  111. \RequirePackage[side,multiple]{footmisc}
  112. \newcommand{\footnotelayout}{\@tufteh@marginfont\@tufteh@raggedright}
  113. % Override footmisc's definition to set the sidenote marks (numbers) inside the
  114. % sidenote's text block.
  115. \long\def\@makefntext#1{\@textsuperscript{\@tufteh@marginfont\tiny\@thefnmark}\,\footnotelayout#1}
  116. % Set the in-text footnote mark in the same typeface as the body text itself.
  117. \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\scriptsize\@thefnmark}}}
  118. \let\sidenote\footnote
  119. %%
  120. % Sidenote without the footnote mark
  121. \providecommand\marginnote[1]%
  122. {\marginpar{\@tufteh@marginfont\raggedright #1}}
  123. %%
  124. % Citations should go in the margin as well
  125. \RequirePackage{natbib}
  126. \RequirePackage{bibentry} % allows bibitems to be typeset outside thebibliography environment
  127. \nobibliography* % pre-loads the bibliography keys
  128. \renewcommand{\cite}[1]{\sidenote{\bibentry{#1}.}}
  129. \providecommand{\doi}[1]{\textsc{doi:} #1} % pre-defining this so it may be used before the \bibliography command it issued
  130. % TODO: Rewrite \cite so that you can specify multiple bib keys
  131. % at once. For example, \cite{Author01,Author02}
  132. % TODO: Combine sequences of citations so that 2,3,4,6 becomes 2-4,6
  133. % but be careful of hypperref interaction
  134. %%
  135. % The placeins package provides the \FloatBarrier command. This forces
  136. % LaTeX to place all of the floats before proceeding. We'll use this to
  137. % keep the float (figure and table) numbers in sequence.
  138. \RequirePackage{placeins}
  139. %%
  140. % Margin figure
  141. \newcommand{\marginfigure}[2]%
  142. [-1.2ex]%
  143. {\FloatBarrier% process all floats before this point so the figure numbers stay in order.
  144. \marginpar{\@tufteh@marginfont
  145. \def\@captype{figure}
  146. \vspace*{#1}
  147. \@tufteh@raggedright #2}}
  148. % FIXME: if anyone can make this an environment instead -- patch welcome!
  149. %%
  150. % Margin table
  151. \newcommand{\margintable}[2]%
  152. [-1.2ex]%
  153. {\FloatBarrier% process all floats before this point so the table numbers stay in order.
  154. \marginpar{\@tufteh@marginfont
  155. \def\@captype{table}
  156. \vspace*{#1}
  157. \@tufteh@raggedright #2}}
  158. % FIXME: if anyone can make this an environment instead -- patch welcome!
  159. %%
  160. % Full-width figure
  161. \renewenvironment{figure*}[1]%
  162. [htbp]%
  163. {\@float{figure}[#1]%
  164. \begin{adjustwidth}{}{-\@tufteh@overhang}%
  165. \begin{minipage}{\linewidth}}%
  166. {\end{minipage}%
  167. \end{adjustwidth}%
  168. \end@float}
  169. %%
  170. % Full-width table
  171. \renewenvironment{table*}[1]
  172. [htbp]%
  173. {\@float{table}[#1]%
  174. \begin{adjustwidth}{}{-\@tufteh@overhang}%
  175. \begin{minipage}{\linewidth}}%
  176. {\end{minipage}%
  177. \end{adjustwidth}%
  178. \end@float}
  179. %%
  180. % Full-page-width area
  181. \newenvironment{fullwidth}
  182. {\begin{adjustwidth}{}{-\@tufteh@overhang}}%
  183. {\end{adjustwidth}}
  184. %%
  185. % Format the captions in a style similar to the sidenotes
  186. % if 'sfsidenotes' option is specified, set the captions in sf, too.
  187. \if@tufteh@sfsidenotes
  188. \RequirePackage[format=default,font={sf,scriptsize},justification=raggedright,singlelinecheck=false]{caption}
  189. \else
  190. \RequirePackage[format=default,font={rm,scriptsize},justification=raggedright,singlelinecheck=false]{caption}
  191. \fi
  192. %%
  193. % If the Palatino typeface (and its math symbol set) are installed, load them.
  194. \IfFileExists{palatino.sty}{%
  195. \RequirePackage{palatino}
  196. \IfFileExists{mathpazo.sty}{\RequirePackage[osf,sc]{mathpazo}}{}
  197. }{} % if the Palatino typefaces aren't found, do nothing.
  198. %%
  199. % Set raggedright and paragraph indentation for document
  200. \AtBeginDocument{\@tufteh@raggedright\setlength\parindent{1em}}
  201. \endinput