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.

233 lines
5.7KB

  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. % FIXME: should probably specify options not supported like Mittelbach's aipproc.cls
  8. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
  9. \ProcessOptions
  10. \LoadClass[11pt]{article}%
  11. %%
  12. % Set page layout geometry
  13. \if@tufteh@afourpaper
  14. \RequirePackage[a4paper,includemp,width=170mm,marginparsep=10mm,marginparwidth=50mm]{geometry}
  15. \else
  16. \RequirePackage[letterpaper,includemp,width=6.5in,marginparsep=0.375in,marginparwidth=2in]{geometry}
  17. \fi
  18. %%
  19. % Separation marginpars by a line's worth of space.
  20. \setlength\marginparpush{\baselineskip}
  21. %%
  22. % Font for margin items
  23. \newcommand{\@tufteh@marginfont}{\normalfont\scriptsize\sffamily}
  24. %%
  25. % Modify \raggedright from latex.ltx to allow hyphenation per Donald Arseneau
  26. \def\@tufteh@raggedright{%
  27. \let\\\@centercr\@rightskip\z@ plus 0.08\hsize
  28. \rightskip\@rightskip
  29. \leftskip\z@skip}
  30. %%
  31. % Turn off section numbering
  32. \setcounter{secnumdepth}{-1}
  33. %%
  34. % Tighten up space between displays (e.g., a figure or table) and make symmetric
  35. \setlength\abovedisplayskip{6pt plus 2pt minus 4pt}
  36. \setlength\belowdisplayskip{6pt plus 2pt minus 4pt}
  37. %%
  38. % To implement full-width display environments
  39. \RequirePackage{chngpage}
  40. % Compute length used for full-width displays
  41. \newlength{\@tufteh@overhang}
  42. \setlength{\@tufteh@overhang}{\marginparwidth}
  43. \addtolength{\@tufteh@overhang}{\marginparsep}
  44. %%
  45. % Alter \maketitle from article.cls
  46. \renewcommand\maketitle{\par
  47. \global\let\and\relax
  48. \begingroup
  49. \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
  50. \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
  51. \long\def\@makefntext##1{\parindent 1em\noindent
  52. \hb@xt@1.8em{%
  53. \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
  54. \newpage
  55. \global\@topnum\z@
  56. \@maketitle
  57. \@thanks
  58. \endgroup
  59. \global\let\thanks\relax
  60. \global\let\maketitle\relax
  61. \global\let\@maketitle\relax
  62. \global\let\@thanks\@empty
  63. \global\let\@author\@empty
  64. \global\let\@date\@empty
  65. \global\let\@title\@empty
  66. \global\let\title\relax
  67. \global\let\author\relax
  68. \global\let\date\relax
  69. }
  70. \def\@maketitle{%
  71. \newpage
  72. \let\footnote\sidenote
  73. {\noindent\large\bfseries \@title\par}%
  74. \vskip 3pt%
  75. {\small \@date\par}%
  76. \vskip 3pt%
  77. {\small \@author\par}
  78. }
  79. %%
  80. % Abstract
  81. \renewenvironment{abstract}%
  82. {\begin{quotation}
  83. \begin{sffamily}
  84. \begin{small}}%
  85. { \end{small}
  86. \end{sffamily}
  87. \end{quotation}}
  88. %%
  89. % Require paralist package for tighter lists
  90. \RequirePackage{paralist}
  91. % Add rightmargin to compactenum
  92. \def\@compactenum@{%
  93. \expandafter\list\csname label\@enumctr\endcsname{%
  94. \usecounter{\@enumctr}%
  95. \rightmargin=2em% added this
  96. \parsep\plparsep
  97. \itemsep\plitemsep
  98. \topsep\pltopsep
  99. \partopsep\plpartopsep
  100. \def\makelabel##1{\hss\llap{##1}}}}
  101. %%
  102. % An environment for paragraph-style section
  103. \providecommand\newthought[1]{\vspace{1.8\baselineskip plus 3pt minus 2pt}%
  104. {\noindent\scshape #1}}
  105. %%
  106. % Transform existing \footnotes into \sidenotes
  107. % Sidenote: ``Where God meant footnotes to go.'' ---Tufte
  108. \RequirePackage[side,multiple,marginal]{footmisc}
  109. \setlength{\footnotemargin}{0.8em}
  110. \newcommand{\footnotelayout}{\@tufteh@marginfont\@tufteh@raggedright}
  111. \let\sidenote\footnote
  112. % Set the footnote mark (adjacent to the footnote) in the same typeface as the footenote itself.
  113. \def\@makefnmark{\hbox{\@textsuperscript{\@tufteh@marginfont\tiny\@thefnmark}}}
  114. % TODO: Automatically determine the \footnotemargin value based on the width of the footnote mark.
  115. %%
  116. % Sidenote without the footnote mark
  117. \providecommand\marginnote[1]%
  118. {\marginpar{\@tufteh@marginfont\raggedright #1}}
  119. %%
  120. % Citations should go in the margin as well
  121. \RequirePackage{natbib}
  122. \RequirePackage{bibentry} % allows bibitems to be typeset outside thebibliography environment
  123. \nobibliography* % pre-loads the bibliography keys
  124. \renewcommand{\cite}[1]{\sidenote{\bibentry{#1}.}}
  125. \providecommand{\doi}[1]{\textsc{doi:} #1} % pre-defining this so it may be used before the \bibliography command it issued
  126. % TODO: Rewrite \cite so that you can specify multiple bib keys
  127. % at once. For example, \cite{Author01,Author02}
  128. % TODO: Combine sequences of citations so that 2,3,4,6 becomes 2-4,6
  129. % but be careful of hypperref interaction
  130. %%
  131. % Margin figure
  132. \newcommand{\marginfigure}[2]%
  133. [-1.2ex]%
  134. {\marginpar{\@tufteh@marginfont
  135. \def\@captype{figure}
  136. \vspace*{#1}
  137. \@tufteh@raggedright #2}}
  138. % FIXME: if anyone can make this an environment instead -- patch welcome!
  139. %%
  140. % Margin table
  141. \newcommand{\margintable}[2]%
  142. [-1.2ex]%
  143. {\marginpar{\@tufteh@marginfont
  144. \def\@captype{table}
  145. \vspace*{#1}
  146. \@tufteh@raggedright #2}}
  147. % FIXME: if anyone can make this an environment instead -- patch welcome!
  148. %%
  149. % Full-width figure
  150. \renewenvironment{figure*}[1]%
  151. [htbp]%
  152. {\@float{figure}[#1]%
  153. \begin{adjustwidth}{}{-\@tufteh@overhang}%
  154. \begin{minipage}{\linewidth}}%
  155. {\end{minipage}%
  156. \end{adjustwidth}%
  157. \end@float}
  158. %%
  159. % Full-width table
  160. \renewenvironment{table*}[1]
  161. [htbp]%
  162. {\@float{table}[#1]%
  163. \begin{adjustwidth}{}{-\@tufteh@overhang}%
  164. \begin{minipage}{\linewidth}}%
  165. {\end{minipage}%
  166. \end{adjustwidth}%
  167. \end@float}
  168. %%
  169. % Full-page-width area
  170. \newenvironment{fullwidth}
  171. {\begin{adjustwidth}{}{-\@tufteh@overhang}}%
  172. {\end{adjustwidth}}
  173. %%
  174. % Set raggedright and paragraph indentation for document
  175. \AtBeginDocument{\@tufteh@raggedright\setlength\parindent{1em}}
  176. \endinput