Fixed \if@final handling and bumped to v0.6
[drexel-thesis.git] / drexel-thesis.dtx
index 814727ba06c56790b14366be92bfffd18ae850f7..26679d4a349ce71792f0a52a5b854bc8b5c3e8d3 100644 (file)
@@ -1,8 +1,8 @@
-% \def\fileversion{0.3}
-% \def\filedate{2010/01/13}
+% \def\fileversion{0.6}
+% \def\filedate{2010/03/11}
 % \iffalse meta-comment
-%<class>\def\fileversion{0.3}
-%<class>\def\filedate{2010/01/13}
+%<class>\def\fileversion{0.6}
+%<class>\def\filedate{2010/03/11}
 %
 % Copyright (C) 2010  C.Y. Ip
 %                     Christopher D. Cera
 %   Based on the University of Toronto Thesis \LaTeXe\ Class.  Also
 %   greatly improved the documentation by incorperating bits of
 %   the base/*.dtx files.}
+% \changes{0.4}{2010/02/23}{W.~Trevor King repositioned hyperref
+%   inclusion for proper hyperref overriding.  The previous
+%   implementation couldn't handle $\backslash$label for
+%   $\backslash$paragraph and some other section levels.  The page
+%   number for the reference was correct, but the link went to the
+%   label's parent chapter.}
+% \changes{0.5}{2010/03/03}{W.~Trevor King use hypcap for better
+%   caption hyperlink anchor placement.}
+% \changes{0.6}{2010/03/11}{W.~Trevor King fixed
+%   $\backslash$if\@ final handling.  Previous versions used
+%   it more like a hypothetical $\backslash$if\@ finalspace.}
 %
 % \MakeShortVerb{\|}
 % \newcommand{\pkg}[1]{\textsf{#1}}
 % options set all of the types.  For example, \Lopt{boldtoc} is
 % equivalent to \Lopt{boldchapter,boldpart}.
 %
+% \DescribeOption{indenttoc}
+% The example table of contents in the Manual p17 does not indent
+% section entries, etc., so neither does \cls{drexel-thesis}.  If you
+% \emph{do} want pretty, indented TOCs, like the \LaTeX\ defaults pass
+% \Lopt{indenttoc} to \cls{drexel-thesis}.
+%
 % \DescribeOption{draftwatermark}
 % \Lopt{draftwatermark} adds ``DRAFT \meta{date}'' watermarks to each
 % page.  A useful way to remember that the version you're looking at
 % See the Manual 3.2 p9.
 %
 % \begin{command}
-%   `\cs{copyrighttextCC}'
+%   `\cs{copyrighttextCCBYSA}'
 % \end{command}
 % There are a number of predefined copyright messages for ease of use \\
 % \begin{tabular}{l l}
-%   |\copyrighttextCC| & Creative Commons copyright \\
+%   |\copyrighttextCCBYSA| &
+%     Creative Commons Attribution-ShareAlike License Version 3.0.\\
 % \end{tabular}
 %
 % \begin{command}
 % \href{http://www.ctan.org/tex-archive/macros/latex/required/graphics/}{\pkg{graphicx}}
 % to define the |\includegraphics| macro,
 % \href{http://www.ctan.org/tex-archive/macros/latex/required/caption/}{\pkg{caption}}
-% for pretty caption formatting, and
+% for pretty caption formatting,
 % \href{http://www.ctan.org/tex-archive/macros/latex/required/floatrow/}{\pkg{floatrow}}
-% for placing captions.
+% for placing captions, and
+% \href{http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}{\pkg{hypcap}}
+% for placing caption anchors.
 %
 % Simple float definitions will look like
 % \begin{example}
 \newif\if@boldchapter
 \newif\if@boldpart
 \newif\if@dottedpart
+\newif\if@indenttoc
 \newif\if@draftwatermark
 \newif\if@mydraftwatermark
 \newif\if@indentfirst
-\newif\if@final \@finalfalse
+\newif\if@final
 %    \end{macrocode}
 %
 % \begin{option}{subfig}
   \def\@ssp{1} % single space
   \def\@dsp{2} % double space
   \def\@tsp{3} % triple space
-  \@finaltrue
 }
 %    \end{macrocode}
 % \end{option}
 %  Don't force chapters onto right-hand pages.
 %    \begin{macrocode}
   \PassOptionsToClass{openany}{book}
-  \@finalfalse
 }
 %    \end{macrocode}
 % \end{option}
 %    \end{macrocode}
 % \end{option}
 %
+% \begin{option}{indenttoc}
+% Set \Lopt{indenttoc} flag
+%    \begin{macrocode}
+\DeclareOptionX{indenttoc}{\@indenttoctrue}
+%    \end{macrocode}
+% \end{option}
+%
 % \begin{option}{draftwatermark}
 % Set \Lopt{draftwatermark} flag
 %    \begin{macrocode}
 % \begin{option}{final}
 %    \begin{macrocode}
 \DeclareOptionX{final}{
+  \@finaltrue
   \setkeys{drexel-thesis.cls}{oneside}
   \setkeys{drexel-thesis.cls}{finalspace}
   \setkeys{drexel-thesis.cls}{dottedtoc}
 % \begin{option}{draft}
 %    \begin{macrocode}
 \DeclareOptionX{draft}{
+  \@finalfalse
   \setkeys{drexel-thesis.cls}{twoside}
   \setkeys{drexel-thesis.cls}{draftspace}
   \setkeys{drexel-thesis.cls}{dottedtoc}
 % \subsubsection{\pkg{subfig}}
 % \label{sec:subfig}
 %
-% Allow multi-partfigures with
+% Allow multi-part figures with
 % \href{http://www.ctan.org/tex-archive/macros/latex/contrib/subfig/}{\pkg{subfig}}.
 %    \begin{macrocode}
 \if@DUT@subfigopt
   \RequirePackage{subfig}
 \fi
-%    \begin{macrocode}
+%    \end{macrocode}
 %
 %
 % \subsubsection{\pkg{fancyhdr}}
+% \label{sec:fancyhdr}
 %
 % \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fancyhdr/}{\pkg{fancyhdr}}
 % for correct page numbering and fancy headers.
 %    \begin{macrocode}
 \pagestyle{fancy}
 \fancyhf{}
+%    \end{macrocode}
+% Turn off the header rule by setting its width to $0$.
+%    \begin{macrocode}
 \renewcommand{\headrulewidth}{0pt}
 %    \end{macrocode}
 % 0.4 pt is \pkg{fancyhdr}'s default |\headrulewidth|, so we'll
 }
 %    \end{macrocode}
 %
+% Note that the Chapter / Section footer is not required.  You can
+% remove the footer text and rule entirely with.
+% \begin{example}
+%   \renewcommand{\footrulewidth}{0pt}
+%   \fancyfoot[RE,LO]{}
+%   \fancyfoot[LE,RO]{}
+% \end{example}
+%
 %
 % \subsubsection{\pkg{ifpdf}}
 %
 %    \end{macrocode}
 % 
 % \subsubsection{\pkg{hyperref}}
+% \label{sec:hyperref}
 %
 % \href{http://www.ctan.org/tex-archive/macros/latex/contrib/hyperref/}{\pkg{hyperref}}
 % for hyperlinks.  Not strictly necessary, but I can't imagine a
-% thesis without it.
-%    \begin{macrocode}
-\RequirePackage[final]{hyperref}
-%    \end{macrocode}
-% Nobody likes the default colored boxes.  Color the text itself.
-%    \begin{macrocode}
-\hypersetup{colorlinks}
-%    \end{macrocode}
-% If we're writing a PDF, we set the |pdfauthor|, etc.\ arguments in
-% |\author|, etc.\ to avoid using |\AtBeginDocument| or some such.
+% thesis without it.  We actually include this later
+% (Section~\ref{sec:hyperref-inclusion}), because \pkg{hyperref}
+% sticks its fingers into \emph{everything} and we want it to use our
+% versions of some macros (e.g. |\@sect|) but not others
+% (e.g. |thebibliography|).
+%
+%
+% \subsubsection{\pkg{hypcap}}
+% \label{sec:hypcap}
+%
+% \href{http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}{\pkg{hypcap}}
+% for placing caption hyperlink anchors.  Must be included after
+% \pkg{hypercap}, so the actual inclusion is in
+% Section~\ref{sec:hypcap-inclusion}).
 %
 %
 % \subsection{\LaTeX\ overrides and extensions}
 % |\author| for use in |\maketitle|.  If not given |\maketitle| will
 % produce a warning message (\file{ltsect.dtx}, L129).
 %
-% We extend |\author| to set \pkg{hyperref}'s |pdfauthor|.
+% We extend |\author| to set \pkg{hyperref}'s |pdfauthor| if we're
+% writing a PDF to avoid using |\AtBeginDocument| or some such.
 % (\file{ltsect.dtx}, L129).
 %    \begin{macrocode}
 \let\DUT@author\author
 % \begin{macro}{\DUT@baselineskip}
 % Since we'll be messing with the spacing, save the single-spaced
 % baseline.
-%   \changes{0.3}{2010/01/13}{Use \\setlength to store the value at
-%     the default font.  The previous version used \\let, which made
-%     \\DUT\@baselineskip a synonym for \\baselineskip that changed
-%     with font size.}
+%   \changes{0.3}{2010/01/13}{Use $\backslash$setlength to store the
+%     value at the default font.  The previous version used
+%     $\backslash$let, which made $\backslash$DUT\@baselineskip a
+%     synonym for $\backslash$baselineskip that changed with font
+%     size.}
 %    \begin{macrocode}
 \newlength\DUT@baselineskip
 \setlength\DUT@baselineskip\baselineskip
 % \end{macro}
 %
 %
+% \subsection{\pkg{hyperref} inclusion}
+% \label{sec:hyperref-inclusion}
+%
+% This is the awkward \pkg{hyperref} inclusion.  See
+% Section~\ref{sec:hyperref} for an explanation of why we stash it
+% here.
+%    \begin{macrocode}
+\RequirePackage[final]{hyperref}
+%    \end{macrocode}
+% Nobody likes the default colored boxes.  Color the text itself.
+%    \begin{macrocode}
+\hypersetup{colorlinks}
+%    \end{macrocode}
+%
+% \subsubsection{\pkg{hypcap}}
+% \label{sec:hypcap-inclusion}
+%
+% \href{http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}{\pkg{hypcap}}
+% for placing caption hyperlink anchors.  Not strictly necessary, but
+% we're using \pkg{hyperref}, and the poor link targets are annoying.
+%    \begin{macrocode}
+\RequirePackage[all]{hypcap}
+%    \end{macrocode}
+% \Lopt{all} redefines the figure and table environments to
+% place the anchor at the start of the float.
+%
+%
 % \subsection{\cls{book} overrides and extensions}
 %
 % Here we change the behavior of a bunch of macros and environments from
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\copyrighttextCC}
-% The Creative Commons license.
+% \begin{macro}{\copyrighttextCCBYSA}
+% The Creative Commons Attribution-ShareAlike License.
+% \changes{0.4}{2010/02/23}{W.~Trevor King renamed from
+% $\backslash$copyrighttextCC, and made specific to Creative Commons
+% Attribution-ShareAlike Version 3.0.}
 %    \begin{macrocode}
-\newcommand\copyrighttextCC{
+\newcommand\copyrighttextCCBYSA{
   \begin{quote}
     This work is licensed under the terms of the Creative Commons
-    Attribution-ShareAlike license.  The license is available at \\
+    Attribution-ShareAlike license Version 3.0.  The license is
+    available at \\
     \url{http://creativecommons.org/licenses/by-sa/3.0/}.
   \end{quote}
 }
 % \end{macro}
 % \end{macro}
 %
+% The default indents above are all |0pt|.  If \Lopt{indenttoc} was
+% given, override this, restoring the \pkg{tocloft} defaults, see the
+% \href{http://www.ctan.org/tex-archive/macros/latex/contrib/tocloft/tocloft.pdf}{%
+%   \pkg{tocloft} manual, Table 1}.
+%    \begin{macrocode}
+\if@indenttoc
+  \cftsetindents{chapter}{0pt}{1.5em}
+  \cftsetindents{section}{1.5em}{2.3em}
+  \cftsetindents{subsection}{3.8em}{3.2em}
+  \cftsetindents{subsubsection}{7.0em}{4.1em}
+\fi
+%    \end{macrocode}
+%
 %
 % \subsubsection{List of figures}
 % \label{sec:implement-lof}
 % \end{macro}
 %
 % \subsubsection{Words}
+% \label{sec:words}
 %
 % Set the official names of the various sections encountered.  Some of
 % these are not defined in \file{classes.dtx} but are close analogs of
 \advisor{Collis Potter Huntington, R.R.D.}
 \advisor{Advisor 2, Ph.D.}
 \advisor{Advisor 3, Ph.D.}
-\copyrighttext{\copyrighttextCC}
+\copyrighttext{\copyrighttextCCBYSA}
 
 \usepackage[super,sort&compress]{natbib} % fancy citation extensions
 \bibliographystyle{unsrtnat}
 \usepackage{fancyvrb} % nicer verbatim handling
 \DefineShortVerb{\|}  % \verb+TEXT+  ->  |TEXT|
 
+%     \end{macrocode}
+% Use
+% \href{http://www.ctan.org/tex-archive/macros/latex/contrib/blindtext/}{\pkg{blindtext}}
+% for dummy text creation.  \pkg{blindtext} requires
+% \href{}{\pkg{babel}}.
+%     \begin{macrocode}
 \usepackage[english]{babel} % English blindtext
 \usepackage{blindtext} % macros for producing dummy output
+%     \end{macrocode}
+% \pkg{babel} messes with some of our words (Section \ref{sec:words}), so
+% we have to reset them.  See the
+% \href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords}{\TeX\ FAQ}
+% for details.
+%     \begin{macrocode}
+\addto\captionsenglish{%
+  \renewcommand\dedicationsname{Dedications}%
+  \renewcommand\acknowledgmentsname{Acknowledgments}%
+  \renewcommand\contentsname{Table of Contents}%
+  \renewcommand\listtablename{List of Tables}%
+  \renewcommand\listfigurename{List of Figures}%
+  \renewcommand\abstractname{Abstract}%
+  \renewcommand\bibname{Bibliography}%
+  \renewcommand\appendixname{Appendix}%
+  \renewcommand\vitaname{Vita}%
+}
 
 \begin{document}
 \begin{preamble}
@@ -3059,11 +3174,12 @@ Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla Bla}
 %     \end{example}
 %   \item Footer overlap if chapter/section names are particularly long.
 %     See \emph{Section in long-titled chapter} in \file{example.pdf}.
-%     Workaround: turn off either chapters or sections in the footer.
+%     Workaround: turn off sections in the footer:
 %     \begin{example}
 %       \fancyfoot[RE,LO]{\scshape\leftmark}
 %       \fancyfoot[LE,RO]{}
 %     \end{example}
+%     For more header or footer manipulation ideas, see Section \ref{sec:fancyhdr}.
 % \end{itemize}
 %
 %