Replace \begin{spacing} with \setstretch{} calls.
authorW. Trevor King <wking@drexel.edu>
Wed, 13 Jan 2010 17:36:34 +0000 (12:36 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 13 Jan 2010 17:36:34 +0000 (12:36 -0500)
setspace's spacing environment adds some extra skips to get
clean transitions.  We handle those transitions on our own.
\setstretch lets us change the spacing without bothering
with the extra skipping.

I've been struggling with \blanklines.  Current problems:
  * page top--chapter head space longer than one line.
  * chapter head--text space longer than chapter head--section head.
  * head--table space longer for LOT/LOF than TOC.

Makefile
drexel-thesis.dtx
drexel-thesis.ins

index 36c9a68b05b4f86dd508b8cf22bedbbfe83133d7..54499779bf1811e5688c1820b171532789d28c69 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ drexel-thesis.cls template.tex example.tex example-draft.tex \
 
 example.pdf : example.tex example-1.tex example-a.tex example-ref.bib \
                drexel-thesis.cls blabla.sty
 
 example.pdf : example.tex example-1.tex example-a.tex example-ref.bib \
                drexel-thesis.cls blabla.sty
+       #pdflatex -interaction=batchmode $<
        pdflatex $<
        bibtex example
        pdflatex $<
        pdflatex $<
        bibtex example
        pdflatex $<
index 1bf7dafead2f80158acbe9da1e6f9fcbc24c339b..b0502d2c7e7419aeceae975c252b3aef83ed1bd1 100644 (file)
 % \begin{macro}{\DUT@baselineskip}
 % Since we'll be messing with the spacing, save the single-spaced
 % baseline.
 % \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.}
 %    \begin{macrocode}
 %    \begin{macrocode}
-\let\DUT@baselineskip\baselineskip
+\newlength\DUT@baselineskip
+\setlength\DUT@baselineskip\baselineskip
 %    \end{macrocode}
 % \end{macro}
 %
 %    \end{macrocode}
 % \end{macro}
 %
 % requires \pkg{calc} for the multiplication.
 %    \begin{macrocode}
 \newcommand{\set@lines@length}[2]{%
 % requires \pkg{calc} for the multiplication.
 %    \begin{macrocode}
 \newcommand{\set@lines@length}[2]{%
-  \setlength{#1}{\DUT@baselineskip * {#2}}
-}
+  \setlength{#1}{\DUT@baselineskip * {#2}}}
 %    \end{macrocode}
 % \end{macro}
 %
 %    \end{macrocode}
 % \end{macro}
 %
 % Here we deviate from \file{ltsect.dtx} to ensure single spacing for
 % the section title.
 %    \begin{macrocode}
 % Here we deviate from \file{ltsect.dtx} to ensure single spacing for
 % the section title.
 %    \begin{macrocode}
-    \begin{spacing}{\@ssp}
+      \setstretch{\@ssp}%
       #6{%
         \@hangfrom{\hskip #3\relax\@svsec}%
           \interlinepenalty \@M #8\@@par}%
       #6{%
         \@hangfrom{\hskip #3\relax\@svsec}%
           \interlinepenalty \@M #8\@@par}%
-    \end{spacing}
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
     \endgroup
     \csname #1mark\endcsname{#7}%
     \addcontentsline{toc}{#1}{%
 % Here we deviate from \file{ltsect.dtx} to ensure single spacing for
 % the section title.
 %    \begin{macrocode}
 % Here we deviate from \file{ltsect.dtx} to ensure single spacing for
 % the section title.
 %    \begin{macrocode}
-    \begin{spacing}{\@ssp}
+      \setstretch{\@ssp}%
       #4{%
         \@hangfrom{\hskip #1}%
           \interlinepenalty \@M #5\@@par}%
     \endgroup
       #4{%
         \@hangfrom{\hskip #1}%
           \interlinepenalty \@M #5\@@par}%
     \endgroup
-    \end{spacing}
   \else
     \def\@svsechd{#4{\hskip #1\relax #5}}%
   \fi
   \else
     \def\@svsechd{#4{\hskip #1\relax #5}}%
   \fi
 %
 % \begin{command}
 %   `\cs{blanklines}\marg{N}'
 %
 % \begin{command}
 %   `\cs{blanklines}\marg{N}'
+%   `\cs{blanklines*}\marg{N}'
 % \end{command}
 % \begin{macro}{\blanklines}
 % \end{command}
 % \begin{macro}{\blanklines}
-% Insert \meta{N} blank lines.
+% Insert \meta{N} blank lines.  The starred forms use |\vspace|, which
+% inserts space even at the start and end of pages.  The |p| forms
+% add a trailing |\par|.  \emph{I'm still trying to get this part working
+% cleanly\ldots}
 %    \begin{macrocode}
 \newlength\DUT@blanklines@length
 %    \begin{macrocode}
 \newlength\DUT@blanklines@length
-\newcommand{\blanklines}[1]{%
-  \begin{spacing}{1}
-    \set@lines@length{\DUT@blanklines@length}{#1}%
-    \vspace{\DUT@blanklines@length}
-  \end{spacing}
+\newcommand{\@blanklines@setup}[1]{%
+  \set@lines@length{\DUT@blanklines@length}{#1}%
+  %\typeout{BLANKLINES -- #1}%
+  %\showthe\DUT@blanklines@length
 }
 }
+\newcommand{\blanklines}{\@ifstar\@sblanklines\@blanklines}
+\newcommand{\@blanklines}[1]{%
+  \@blanklines@setup{#1}%
+  \vspace{\DUT@blanklines@length}}
+\newcommand{\@sblanklines}[1]{%
+  \@blanklines@setup{#1}%
+  \vspace*{\DUT@blanklines@length}}
+\newcommand{\blanklinesp}{\@ifstar\@sblanklines\@blanklines}
+\newcommand{\@blanklinesp}[1]{%
+  \@blanklines@setup{#1}%
+  \vspace{\DUT@blanklines@length}\par}
+\newcommand{\@sblanklinesp}[1]{%
+  \@blanklines@setup{#1}%
+  \vspace*{\DUT@blanklines@length}\par}
 %    \end{macrocode}
 % \end{macro}
 %
 %    \end{macrocode}
 % \end{macro}
 %
 % Here is the title text itself.
 %    \begin{macrocode}
     \begin{center}%
 % Here is the title text itself.
 %    \begin{macrocode}
     \begin{center}%
-    \begin{spacing}{\@tsp}
-      {\bfseries \@title \par}%
-    \end{spacing}
-    \begin{spacing}{\@dsp}
+      {\setstretch{\@tsp} \bfseries \@title \par}%
+%    \end{macrocode}
+% We want two blank lines (triple spacing) between the title and the
+% remaining material, so add three but don't end the paragraph.
+%    \begin{macrocode}
+      \blanklines{3}%
+      \setstretch{\@dsp}%
       A Thesis\\
       Submitted to the Faculty\\
       of\\
       Drexel University\\
       by\\
       A Thesis\\
       Submitted to the Faculty\\
       of\\
       Drexel University\\
       by\\
-      \@author \\
+      \@author\\
       in partial fulfillment of the\\
       requirements for the degree\\
       of\\
       \@degree\\
       \def@month\ \def@year
       in partial fulfillment of the\\
       requirements for the degree\\
       of\\
       \@degree\\
       \def@month\ \def@year
-    \end{spacing}
     \end{center}\par
 %    \end{macrocode}
 % Some more stretchy space for the bottom if we're not in draft mode.
     \end{center}\par
 %    \end{macrocode}
 % Some more stretchy space for the bottom if we're not in draft mode.
     \copyright~Copyright \def@year\\
     \@author.  \@copyrighttext
   \end{center}
     \copyright~Copyright \def@year\\
     \@author.  \@copyrighttext
   \end{center}
-  \if@final \vspace*{\fill} \else \blanklines{2} \fi
+  \if@final \vspace*{\fill} \else \blanklinesp{2} \fi
 %    \end{macrocode}
 % Turn off page numbering for this page.
 %    \begin{macrocode}
 %    \end{macrocode}
 % Turn off page numbering for this page.
 %    \begin{macrocode}
 % (\file{classes.dtx}, L2540).
 %    \begin{macrocode}
 \def\@makechapterhead#1{%
 % (\file{classes.dtx}, L2540).
 %    \begin{macrocode}
 \def\@makechapterhead#1{%
-  \blanklines{2}%
+  \blanklines*{1}%
   {\parindent \z@ \raggedright \normalfont
 %    \end{macrocode}
 % Ensure single spacing.
 %    \begin{macrocode}
   {\parindent \z@ \raggedright \normalfont
 %    \end{macrocode}
 % Ensure single spacing.
 %    \begin{macrocode}
-    \begin{spacing}{\@ssp}
+    \setstretch{\@ssp}%
 %    \end{macrocode}
 % Prevent a pagebreak from occuring in the middle of or after the title.
 %    \begin{macrocode}
 %    \end{macrocode}
 % Prevent a pagebreak from occuring in the middle of or after the title.
 %    \begin{macrocode}
     \else
       \center \large \bfseries #1\par\nobreak
     \fi
     \else
       \center \large \bfseries #1\par\nobreak
     \fi
-    \end{spacing}
 %    \end{macrocode}
 %    \end{macrocode}
-% Put a little space before the chapter body.
+% Put a little space before the chapter body.  We use four blank lines
+% to comply with the Manual 3.13 p12
+% \begin{quote}
+%   Begin the list of sources four spaces below the heading.
+% \end{quote}
 %    \begin{macrocode}
 %    \begin{macrocode}
-    \blanklines{2}
+    \blanklines{4}
   }
 }
 %    \end{macrocode}
   }
 }
 %    \end{macrocode}
 % (\file{classes.dtx}, L2595).
 %    \begin{macrocode}
 \def\@makeschapterhead#1{%
 % (\file{classes.dtx}, L2595).
 %    \begin{macrocode}
 \def\@makeschapterhead#1{%
-  \blanklines{2}%
-  {\parindent \z@ \raggedright
-    \normalfont
+  \blanklines*{1}%
+  {\parindent \z@ \raggedright \normalfont
+    \setstretch{\@ssp}%
     \interlinepenalty\@M
     \interlinepenalty\@M
-    \begin{spacing}{\@ssp}
     \center \large \bfseries  #1\par\nobreak
     \center \large \bfseries  #1\par\nobreak
-    \end{spacing}
-    \blanklines{2}
+    \typeout{makeschapterhead}
+    \blanklines{4}%
+    \typeout{end makeschapterhead}
   }
 }
 %    \end{macrocode}
   }
 }
 %    \end{macrocode}
     \pdfbookmark[0]{\dedicationsname}{\dedicationsname}
   \fi
   \chapter*{\dedicationsname}
     \pdfbookmark[0]{\dedicationsname}{\dedicationsname}
   \fi
   \chapter*{\dedicationsname}
-  \begin{spacing}{\@dsp}
+  \setstretch{\@dsp}%
 }{%
 }{%
-  \end{spacing}
+  \setstretch{\@ssp}%
 }
 %    \end{macrocode}
 % \end{environment}
 }
 %    \end{macrocode}
 % \end{environment}
     \pdfbookmark[0]{\acknowledgmentsname}{\acknowledgmentsname}
   \fi
   \chapter*{\acknowledgmentsname}
     \pdfbookmark[0]{\acknowledgmentsname}{\acknowledgmentsname}
   \fi
   \chapter*{\acknowledgmentsname}
-  \begin{spacing}{\@dsp}
+  \setstretch{\@dsp}%
 }{%
 }{%
-  \end{spacing}
+  \setstretch{\@ssp}%
 }
 %    \end{macrocode}
 % \end{environment}
 }
 %    \end{macrocode}
 % \end{environment}
 % \begin{environment}{abstract}
 %    \begin{macrocode}
 \newenvironment{abstract}{%
 % \begin{environment}{abstract}
 %    \begin{macrocode}
 \newenvironment{abstract}{%
-  \listed@schapter{\abstractname}
+  \listed@schapter{\abstractname}%
 %    \end{macrocode}
 %    \end{macrocode}
-% From the Manual 3.9 p10 ``The following heading must be centered at
-% the top of the page'':
-% \begin{center}
-%   Abstract \\
-%   Full Title of Dissertation or Thesis \\
-%   Author's Name as it appears on the Dissertation or Thesis
-% \end{center}
-% In the example on p20, they list the advisor's name after the
-% author, but that is not specified in the text on p10.
-%
-% On p20, ``These pages are numbered using lowercase Roman numerals.
-% Note that the heading is single spaced, but the abstract is double
-% spaced.''
+% Suck up some blank space to position the rest of the header right
+% under the chapter title.
+%    \begin{macrocode}
+  \blanklines{-4}%
+%    \end{macrocode}
+% From the Manual 3.9 p10
+% \begin{quote}
+%   \begin{itemize}
+%     \item The following heading must be centered at the top of the page
+%       \begin{center}
+%         Abstract \\
+%         Full Title of Dissertation or Thesis \\
+%         Author's Name as it appears on the Dissertation or Thesis
+%       \end{center}
+%       In the example on p20, they list the advisor's name after the
+%       author, but that is not specified in the text on p10.
+%     \item The text begins four lines below this heading.
+%   \end{itemize}
+% \end{quote}
+% On p20
+% \begin{quote}
+%   \begin{itemize}
+%     \item These pages are numbered using lowercase Roman numerals.
+%     \item Note that the heading is single spaced, but the abstract
+%       is double spaced.
+%   \end{itemize}
+% \end{quote}
 %    \begin{macrocode}
 %    \begin{macrocode}
-  \blanklines{-3}
-  \begin{spacing}{\@ssp}
     \begin{center}
     \begin{center}
+      \setstretch{\@ssp}%
       \@title\\
       \@author\\
       \@advisor\\
     \end{center}
       \@title\\
       \@author\\
       \@advisor\\
     \end{center}
-  \end{spacing}
-  \blanklines{2}
-  \begin{spacing}{\@dsp}
+  \blanklines{4}%
+  \setstretch{\@dsp}%
   \@nobreaktrue
   \@afterindentfalse
   \@afterheading
 }{%
   \@nobreaktrue
   \@afterindentfalse
   \@afterheading
 }{%
-  \end{spacing}
+  \setstretch{\@ssp}%
 }
 %    \end{macrocode}
 % \end{environment}
 }
 %    \end{macrocode}
 % \end{environment}
 %    \begin{macrocode}
 \newenvironment{thesis}{%
   \mainmatter
 %    \begin{macrocode}
 \newenvironment{thesis}{%
   \mainmatter
-  \begin{spacing}{\@dsp}
+  \setstretch{\@dsp}%
 }{%
 }{%
-  \end{spacing}
+  \setstretch{\@ssp}%
   \DUT@clearpage
   \ifpdf
     \phantomsection
   \DUT@clearpage
   \ifpdf
     \phantomsection
 %    \begin{macrocode}
 \newenvironment{vita}{%
   \listed@schapter{\vitaname}
 %    \begin{macrocode}
 \newenvironment{vita}{%
   \listed@schapter{\vitaname}
-  \blanklines{1}
-  \begin{spacing}{\@dsp}
+  \setstretch{\@dsp}%
 }{%
 }{%
-  \end{spacing}
+  \setstretch{\@ssp}%
 }
 %    \end{macrocode}
 % \end{environment}
 }
 %    \end{macrocode}
 % \end{environment}
 %    \begin{macrocode}
 \renewenvironment{titlepage}{\thispagestyle{empty}%
                              \setcounter{page}\z@}%
 %    \begin{macrocode}
 \renewenvironment{titlepage}{\thispagestyle{empty}%
                              \setcounter{page}\z@}%
-                            {\if@final \newpage \else \blanklines{2} \fi}
+                            {\if@final \newpage \else \blanklinesp{2} \par \fi}
 %    \end{macrocode}
 % \end{environment}
 %
 %    \end{macrocode}
 % \end{environment}
 %
 % We also turn on double spacing by default, since we're no longer
 % wrapped in the |thesis| environment.
 %    \begin{macrocode}
 % We also turn on double spacing by default, since we're no longer
 % wrapped in the |thesis| environment.
 %    \begin{macrocode}
-  \setstretch{\@dsp}
+  \setstretch{\@dsp}%
 }
 %    \end{macrocode}
 % \end{macro}
 }
 %    \end{macrocode}
 % \end{macro}
index 3e9457fc3fa20ded704312fff7259f751d439131..367f1906969305c73bc5afc077f96857ef986f2c 100644 (file)
@@ -38,6 +38,7 @@ and version 1.3 or later is part of all distributions of LaTeX version
 
 \endpreamble
 
 
 \endpreamble
 
+\askforoverwritefalse
 \generate{\file{drexel-thesis.cls}{\from{drexel-thesis.dtx}{class}}
           \file{template.tex}{\from{drexel-thesis.dtx}{template}}
           \file{example.tex}{\from{drexel-thesis.dtx}{example}}
 \generate{\file{drexel-thesis.cls}{\from{drexel-thesis.dtx}{class}}
           \file{template.tex}{\from{drexel-thesis.dtx}{template}}
           \file{example.tex}{\from{drexel-thesis.dtx}{example}}