root/trunk/ttuthesis.cls @ 71

Revision 71, 28.2 KB (checked in by mwr, 2 years ago)

* Adding basic thesis content into thesis.tex and thesis-content folder.
* Modifying thesis-manual-content/bibliography.tex to use \jobname instead of literal filename.
* Moved thesis-manual.bib into thesis-manual-content folder.
* No longer forcing 10pt font size in ttuthesis.cls.
* Added copyrighted option to documentclass.
* Automating front matter page creation: acknowledgments, copyright, and dedication pages only included when requested.
* Replacing \renewcommands for committee membership with regular commands.
* Fixing VP signature block to better fit 11pt and 12pt font sizes.

Line 
1%%%
2%%% Students: if you're making modifications to this file, you'd
3%%% better know what you're doing. If everything is done right, you
4%%% should *only* be making changes to your own thesis.tex and other
5%%% contents of your thesis or dissertation. This file is most
6%%% definitely *not* where you make changes to the names of your
7%%% committee members or other things that are specific to your
8%%% particular thesis.
9%%%
10%%% See Mike Renfro (email: renfro, office: CH 314, phone: x3601) or
11%%% one of the LaTeX-conversant faculty if you run into problems with
12%%% this style as presented, or if the graduate school flags problems
13%%% with your formatting. If you're doing something wrong, we need to
14%%% figure out how to do it right. If this document class is wrong, it
15%%% needs to be fixed for *everyone*, not just you.
16%%%
17
18\NeedsTeXFormat{LaTeX2e}[1994/06/01]
19\ProvidesClass{ttuthesis}[2011/12/02 v0.01 Tennessee Tech Thesis/Dissertation Class]
20\newcount\copyrightpagepresent \copyrightpagepresent=0
21\DeclareOption{copyrighted}{\copyrightpagepresent=1}
22\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}
23\ProcessOptions\relax
24\LoadClass[oneside]{memoir}
25
26% The ted package for patching the chapter command and PDF title
27\RequirePackage{ted}
28
29% The ifthen package provides some clean if/then/else structures, and works
30% with PCTeX.
31\RequirePackage{ifthen}
32
33% The indent package indents all first lines of paragraphs, including
34% those that occur right after a section or chapter header.
35\RequirePackage{indentfirst}
36% rotating: for rotated tables or figures
37\RequirePackage{rotating}
38% For including code listings
39\RequirePackage{listings}
40
41% For checking if ToC, LoT, LoF, etc. span multiple pages
42\RequirePackage{refcount}
43
44% For automatic lists of symbols
45\RequirePackage[intoc]{nomencl} \makenomenclature
46
47%%%
48%%% Define paper size and margins for all pages
49%%%
50\setstocksize{11in}{8.5in}
51\settrims{0pt}{0pt}
52\settypeblocksize{9in}{6in}{*}
53\setlrmarginsandblock{1.5in}{1in}{*}
54\setulmarginsandblock{1in}{1in}{*}
55\addtolength{\uppermargin}{4\onelineskip}
56\addtolength{\textheight}{-6\onelineskip}
57\setheadfoot{3\baselineskip}{\footskip}
58\setheaderspaces{1in}{*}{*}
59
60%%% Define default text for elements that the student should fill out
61%%% themselves.
62
63%%% Note to students: if you're thinking of changing any of this in
64%%% the ttuthesis.cls file, please change it in your thesis.tex
65%%% instead. Something like:
66%%%
67%%% \abstract{%
68%%%   This is my first paragraph.
69%%%
70%%%   And this is my second one.}
71\newcommand{\doctype}[1]{\providecommand\ttu@doctype{}\renewcommand{\ttu@doctype}{#1}}
72\doctype{(Is this a thesis or a dissertation? Fix your thesis.tex.)}
73
74% Can't follow the same pattern with \abstract, since that's already defined
75% in memoir.cls
76\let\ttuabstract\abstract
77\let\endttuabstract\endabstract
78\renewcommand{\abstract}[1]{\providecommand\ttu@abstract{}\renewcommand{\ttu@abstract}{#1}}
79\abstract{%
80  If you can read this, you forgot to put an abstract in your thesis.tex file.
81}
82
83\newcommand{\degree}[1]{\providecommand\ttu@degree{}\renewcommand{\ttu@degree}{#1}}
84\degree{(What's your degree? Fix your thesis.tex.)}
85\newcommand{\department}[1]{\providecommand\ttu@department{}\renewcommand{\ttu@department}{#1}}
86\department{(What's your department? Fix your thesis.tex.)}
87\newcommand{\graduationmonth}[1]{\providecommand\ttu@month{}\renewcommand{\ttu@month}{#1}}
88\graduationmonth{(What month? Fix your thesis.tex.)}
89\newcommand{\graduationyear}[1]{\providecommand\ttu@year{}\renewcommand{\ttu@year}{#1}}
90\graduationyear{(What month? Fix your thesis.tex.)}
91\newcommand{\dedication}[1]{\providecommand\ttu@dedication{}\renewcommand{\ttu@dedication}{#1}}
92%\dedication{%
93%  If you can read this, you asked for a dedication page to be
94%  printed, but failed to include any dedication text in your
95%  thesis file. Fix your thesis.tex.
96%}
97\newcommand{\acknowledgments}[1]{\providecommand\ttu@acknowledgments{}\renewcommand{\ttu@acknowledgments}{#1}}
98%\acknowledgments{%
99%  If you can read this, you asked for an acknowledgments page to be
100%  printed, but failed to include any acknowledgments text in your
101%  thesis file. Fix your thesis.tex.
102%}
103
104%%%
105%%% Define style for abstract page.
106%%%
107\renewcommand{\abstractnamefont}{\normalfont\bfseries}
108\renewcommand{\abstracttextfont}{\normalfont}
109
110\makepagestyle{ttuabstract}
111
112\newcommand{\abstractpage}{%
113  \ifdraftdoc
114    \thispagestyle{empty}
115    \begin{center}
116      {\bfseries\MakeUppercase{\thetitle}}
117    \end{center}
118
119    \begin{center}
120      \theauthor
121    \end{center}
122
123    \begin{center}
124      Draft created \today{} at \printtime*
125    \end{center}
126
127    \begin{center}
128      \begin{ttuabstract}
129        \addtolength{\parskip}{\baselineskip}
130        \thispagestyle{ttuabstract}
131        \ttu@abstract
132        \addtolength{\parskip}{-\baselineskip}
133      \end{ttuabstract}
134    \end{center}
135  \else
136    \pagenumbering{alph}
137          \setcounter{page}{1}
138    \thispagestyle{empty}
139    \renewcommand{\baselinestretch}{1}
140    \begin{center}
141      {\bfseries\MakeUppercase{An Abstract of a \ttu@doctype}}
142     
143      \vspace*{\onelineskip}
144     
145      \begin{Spacing}{1}
146        {\bfseries\MakeUppercase{\thetitle}}
147      \end{Spacing}
148     
149      \vspace*{\onelineskip}
150     
151      {\bfseries\theauthor}
152     
153      \vspace*{\onelineskip}
154     
155      {\bfseries \ttu@degree{} in \ttu@department}
156    \end{center}
157    \renewcommand{\abstractname}{}
158    \vspace*{-\onelineskip}
159    \begin{ttuabstract}
160      \addtolength{\parskip}{\baselineskip}
161      \thispagestyle{ttuabstract}
162      \ttu@abstract
163      \addtolength{\parskip}{-\baselineskip}
164    \end{ttuabstract}
165    \renewcommand{\baselinestretch}{2}
166        \newpage
167  \fi
168  \frontmatter
169}
170
171%%%
172%%% Define style for title page.
173%%%
174
175\newcommand{\titlepage}{%
176  \ifdraftdoc
177  \begin{center}
178  (Draft copy: normal title page suppressed)
179  \end{center}
180  \else
181    \pagenumbering{roman}
182    \setcounter{page}{1}
183    \thispagestyle{empty}
184    \beforepartskip
185    \begin{center}
186      {\bfseries\MakeUppercase{\thetitle}}
187    \end{center}
188    \hfil \hbox{\vrule width 1.75in height 0.02in} \hfil
189    \begin{center}
190      A \ttu@doctype \\
191      Presented to \\
192      the Faculty of the Graduate School \\
193      Tennessee Technological University \\
194      by \\
195      \theauthor
196    \end{center}
197    \hfil \hbox{\vrule width 1.75in height 0.02in} \hfil
198    \begin{center}
199      In Partial Fulfillment \\
200      of the Requirements for the Degree \\
201      \MakeUppercase{\ttu@degree} \\
202      \ttu@department
203    \end{center}
204    \hfil \hbox{\vrule width 1.75in height 0.02in} \hfil
205    \begin{center}
206      \ttu@month{} \ttu@year
207    \end{center}
208    \afterpartskip
209        \newpage
210  \fi
211}
212
213%%%
214%%% Define style for copyright page, if any.
215%%%
216%\newcount\copyrightpagepresent \copyrightpagepresent=0
217\newcommand{\copyrightpage}{%
218  %\copyrightpagepresent=1
219  \ifdraftdoc
220    \begin{center}
221      (Draft copy: normal copyright page suppressed)
222    \end{center}
223  \else
224    \thispagestyle{plain}
225    \beforepartskip
226    \begin{center}
227      \begin{Spacing}{1}
228        Copyright \copyright{} \theauthor, \ttu@year \\
229        All rights reserved
230      \end{Spacing}
231    \end{center}
232    \afterpartskip
233    \newpage
234  \fi
235}
236
237%%%
238%%% Define style for committee approval page.
239%%%
240
241% Define default value for presence of cochair. This is set to the
242% proper value automatically later.
243\newcount\cochair \cochair=0
244\newcommand{\committeechair}[1]{\providecommand\ttu@committeechair{}\renewcommand{\ttu@committeechair}{#1}}
245\committeechair{Chair's Name\\(fix your thesis.tex)}
246\newcommand{\committeecochair}[1]{\providecommand\ttu@committeecochair{}\renewcommand{\ttu@committeecochair}{#1}}
247\committeecochair{Cochair's Name\\(fix your thesis.tex)}
248\newcommand{\committeemembers}[1]{\providecommand\ttu@committeemembers{}\renewcommand{\ttu@committeemembers}{#1}}
249\committeemembers{
250Member 1 Name\\(fix your thesis.tex),
251Member 2 Name\\(fix your thesis.tex),
252Member 3 Name\\(fix your thesis.tex)}
253
254\newcommand{\nameanddateline}[2]{%
255\begin{Spacing}{1}
256\par \noindent%
257\parbox{2.25in}{\hrulefill}\hspace{.75in}\parbox{1.25in}{\hrulefill} \\
258\vspace{-\onelineskip}
259\par \noindent %
260\parbox{2.25in}{#1\ifthenelse{\equal{#2}{}}{\relax}{, #2}}%
261\hspace{.75in}\makebox[1.25in][c]{\hfill{}Date\hfill{}} \\
262\vspace{\onelineskip}
263\end{Spacing}
264}
265
266\newcommand{\vpname}{Francis Otuonye}
267\newcommand{\vptitle}{Associate Vice President}
268\newcommand{\vpdept}{Research and Graduate Studies}
269\newcommand{\approvalpage}{%
270  \ifdraftdoc
271    \begin{center}
272      (Draft copy: normal approval page suppressed)
273    \end{center}
274  \else
275    \vspace*{-7\onelineskip}
276                \ifthenelse{\equal{\ttu@committeecochair}{Cochair's Name\\(fix your thesis.tex)}}{
277                  \newcommand{\chairtitle}{Chairperson}
278                        \cochair=0
279                }{
280      \newcommand{\chairtitle}{Cochairperson}
281                        \cochair=1
282                }
283    \thispagestyle{plain}
284    \begin{center}
285      {\bfseries\MakeUppercase{Certificate of Approval of \ttu@doctype}}
286
287      \vspace{\onelineskip}
288
289      {\bfseries{\MakeUppercase{\thetitle}}} \\
290      by \\
291      \theauthor
292    \end{center}
293
294    \vfill
295
296    \vspace*{-\onelineskip}
297    \noindent Graduate Advisory Committee:
298    \vspace*{\onelineskip}
299
300    \nameanddateline{\ttu@committeechair}{\chairtitle}
301    \ifcase\cochair
302      \relax % \cochair=0
303    \or
304      \nameanddateline{\ttu@committeecochair}{\chairtitle} % \cochair=1
305    \else
306      \relax
307    \fi
308    \@for\themember:=\ttu@committeemembers\do{\nameanddateline{\themember}{}}
309    \vfill
310    \newlength{\vpindent}
311    \setlength{\vpindent}{3.0in}
312    \begin{Spacing}{1}
313      \par\noindent\hspace{\vpindent}\parbox{2.25in}{Approved for the Faculty:}\\
314      \mbox{} %\\
315      \par\noindent\hspace{\vpindent}\parbox{2.25in}{\hrulefill}
316      \par\noindent\hspace{\vpindent}\parbox{2.25in}{\vpname \\ \vptitle \\ of \vpdept} \\ \par 
317      \mbox{} \par
318      \par\noindent\hspace{\vpindent}\parbox{2.25in}{\hrulefill}
319      \par\noindent\hspace{\vpindent}\parbox{2.25in}{Date}
320    \end{Spacing}
321    \vfill
322
323    \newpage
324  \fi
325}
326
327%%%
328%%% Define style for dedication page.
329%%%
330\newcommand{\dedicationpage}{%
331  \ifdraftdoc
332    \begin{center}
333      {\bfseries\MakeUppercase{Dedication}}
334    \end{center}
335    \ttu@dedication
336  \else
337    \thispagestyle{plain}
338    \beforepartskip
339    \begin{center}
340      {\bfseries\MakeUppercase{Dedication}}
341    \end{center}
342    \ttu@dedication
343    \afterpartskip
344        \newpage
345  \fi
346}
347
348%%%
349%%% Define style for acknowledgments page.
350%%%
351\newcommand{\acknowledgmentspage}{%
352  \ifdraftdoc
353  \begin{center}
354    {\bfseries\MakeUppercase{Acknowledgments}}
355  \end{center}
356
357    \ttu@acknowledgments
358  \else
359                \thispagestyle{plain}
360    \begin{center}
361      {\bfseries\MakeUppercase{Acknowledgments}}
362    \end{center}
363    \vspace*{\onelineskip}
364
365    \ttu@acknowledgments
366                \newpage
367  \fi
368}
369
370%%%
371%%% Define Table of Contents style
372%%%
373\maxsecnumdepth{subsubsection}
374\settocdepth{subsubsection}
375\copypagestyle{toc-initial}{plain}
376\makepagestyle{toc}
377\makeoddhead{toc}{\chaptername}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{%
378  \enlargethispage{-3\onelineskip}\normalfont\thepage\par%
379  \vspace{\onelineskip}Page}
380\makeevenhead{toc}{\chaptername}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{%
381  \enlargethispage{-3\onelineskip}\normalfont\thepage\par%
382  \vspace{\onelineskip}Page}
383\makeoddfoot{toc}{}{}{}
384\makeevenfoot{toc}{}{}{}
385\makepagestyle{toc-app}
386\makeoddhead{toc-app}{\appendixname}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{%
387  \normalfont\thepage\par%
388  \vspace{\onelineskip}Page}
389\makeevenhead{toc-app}{\appendixname}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{%
390  \normalfont\thepage\par%
391  \vspace{\onelineskip}Page}
392\makeoddfoot{toc-app}{}{}{}
393\makeevenfoot{toc-app}{}{}{}
394
395\renewcommand{\contentsname}{Table of Contents}
396\renewcommand{\printtoctitle}[1]{%
397  \centering \normalfont\bfseries\MakeUppercase{#1}}
398\renewcommand{\aftertoctitle}{%
399  \par\nobreak\vspace{\onelineskip}\vspace{\onelineskip}
400  \mbox{}\hfill{\normalfont Page}
401  \par\nobreak
402  % The listings package has a bad habit of running this command, causing the
403  % misc:beforetoc label to be defined twice. Fix given in
404  % http://stackoverflow.com/questions/495841/is-there-a-way-to-check-if-a-label-is-already-defined-in-latex
405  %
406  % If counter for misc:beforetoc is not defined, create it and set it to zero
407  \protect\@ifundefined{c@misc:beforetoc}{%
408    \newcounter{misc:beforetoc}%
409    \setcounter{misc:beforetoc}{0}}{}%
410  % If the misc:beforetoc counter is zero, add a beforetoc label to the ToC,
411  % and increment the counter. Otherwise, do nothing.
412  \ifthenelse{\value{misc:beforetoc} > 0}{}{%
413    \addtocontents{toc}{\protect\label{misc:beforetoc}}%
414    \addtocounter{misc:beforetoc}{1}%
415  }%
416  \addtocontents{toc}{\protect\pagestyle{toc}%
417    \protect\thispagestyle{toc-initial}}%
418}
419\maxtocdepth{subsubsection}
420\setlength{\cftbeforechapterskip}{2\baselineskip}
421
422\renewcommand{\addappheadtotoc}{%
423}
424\newcount\appendicesonfirstpageoftoc
425\renewcommand{\appendixpagename}{\MakeUppercase{\appendixtocname}}
426\addtodef{\appendix}{}{\appendixpage}
427% Ensuring \tableofcontents* automatically runs \checktocheaders
428% https://groups.google.com/group/comp.text.tex/msg/fa73a51a04884301?hl=en
429\let\oldmem@tableofcontents\mem@tableofcontents
430\renewcommand\mem@tableofcontents[1]{%
431\oldmem@tableofcontents{#1}%
432\checktocheaders
433}
434
435% Put ``Chapter'' ahead of Chapter 1 entry in TOC, and ``Appendix''
436% ahead of Appendix A entry in TOC. This is a horrible abuse of a
437% function that originally was just used to break up each chapter in
438% the List of Tables, Figures, etc. But it's the only function I can
439% find that is called for each chapter, before the chapter entry is
440% added to the TOC.
441\renewcommand{\insertchapterspace}{%
442  \ifanappendix%
443    \ifthenelse{\equal{\thechapter}{A}}{%
444      \addtocontents{toc}{\protect\label{misc:beforeapp}}%
445      \ifcase\appendicesonfirstpageoftoc%
446        %\typeout{appendicesonfirstpageoftoc = 0}%
447        % Appendix listings start on second-Nth page of ToC
448        \addtocontents{toc}{\protect\vskip\baselineskip\noindent\protect\mbox{\MakeUppercase{\appendixtocname}}\protect\hfill\par}%
449      \or%
450        %\typeout{appendicesonfirstpageoftoc = 1}%
451        % Appendix listings start on first page of ToC
452        \addtocontents{toc}{\protect\vskip\baselineskip\noindent\protect\mbox{\MakeUppercase{\appendixtocname}}\protect\hfill\par}%
453      \else%
454        \typeout{*** Error: appendicesonfirstpageoftoc must equal 0 or 1}
455      \fi%
456    }
457  \else % not an appendix, i.e., it's a regular chapter
458    \ifthenelse{\equal{\thechapter}{1}}{%
459        \addtocontents{toc}{\protect\vskip\baselineskip\noindent\protect\mbox{\chaptername}\protect\hfill\par}%
460    }{%
461    {}%
462    }
463  \fi%
464\addtocontents{toc}{\protect\vskip-\baselineskip}
465}
466
467% Normal, non-bolded fonts for chapters and page numbers.
468\renewcommand{\cftchapterfont}{\normalfont}
469\renewcommand{\cftchapterpagefont}{\normalfont}
470
471% Put a period after the chapter number.
472\renewcommand{\cftchapteraftersnum}{. }
473
474%
475% This is a hack to help ensure that all chapter titles are
476% put in all-caps in the ToC, and that all appendix titles are not put
477% in all-caps in the ToC. But at least I don't have a complete copy of
478% memoir's \chapter command anymore with one edit applied.
479%
480% http://tex.stackexchange.com/questions/13248/using-ted-or-another-package-instead-of-etoolbox-for-patching-commands-in-memo
481\Substitute*[{\gdef\@chapter[##1]##2}]{\@chapter[#1]{#2}}%
482{\addcontentsline{toc}{chapter}}%
483{\let\f@rtocold\f@rtoc%
484 \def\f@rtoc{\texorpdfstring{\uppercase\expandafter{\f@rtocold}}{\f@rtocold}}%
485 \addcontentsline{toc}{chapter}}
486
487% Dot leaders on chapter entries, identical to the other headings.
488\renewcommand{\cftchapterdotsep}{\cftsectiondotsep}
489\renewcommand{\cftchapterleader}{\normalfont\cftdotfill{\cftchapterdotsep}}
490
491% Disable numbering of divisions lower than chapters.
492\let\oldcftsf\cftsectionfont
493\let\oldcftspn\cftsectionafterpnum
494
495% Indent each level of heading by 0.25in (for 12pt, works out to 1.5em)
496\cftsetindents{chapter}{1.5em}{1.5em}
497\cftsetindents{section}{3.0em}{2.25em}
498\cftsetindents{subsection}{4.5em}{3.0em}
499\cftsetindents{subsubsection}{6.0em}{3.75em}
500
501%%%
502%%% Define List of Tables style
503%%%
504\renewcommand{\listtablename}{LIST OF TABLES}
505\copypagestyle{lot-initial}{plain}
506\makepagestyle{lot}
507\makeoddhead{lot}{\tablename}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\enlargethispage{-3\onelineskip}\normalfont\thepage\par\vspace{\onelineskip}Page}
508\makeevenhead{lot}{\tablename}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\enlargethispage{-3\onelineskip}\normalfont\thepage\par\vspace{\onelineskip}Page}
509\makeoddfoot{lot}{}{}{}
510\makeevenfoot{lot}{}{}{}
511\renewcommand{\lotheadstart}{\newpage \chapterheadstart}
512\renewcommand{\afterlottitle}{%
513  \let\numberline\oldnumberline
514  \par\nobreak\vspace{\onelineskip}\vspace{\onelineskip}
515  {\normalfont Table}\hfill{\normalfont Page}
516  \par\nobreak\vspace{\onelineskip}
517  \addtocontents{lot}{\protect\label{misc:beforelot}\protect\pagestyle{lot}\protect\thispagestyle{lot-initial}}
518}
519\cftsetindents{table}{0in}{2.4em}
520\addtodef{\listoftables}{}{\checklotheaders}
521
522%%%
523%%% Define List of Figures style
524%%%
525\renewcommand{\listfigurename}{LIST OF FIGURES}
526\copypagestyle{lof-initial}{plain}
527\makepagestyle{lof}
528\makeoddhead{lof}{\figurename}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\enlargethispage{-3\onelineskip}\normalfont\thepage\par\vspace{\onelineskip}Page}
529\makeevenhead{lof}{\figurename}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\enlargethispage{-3\onelineskip}\normalfont\thepage\par\vspace{\onelineskip}Page}
530\makeoddfoot{lof}{}{}{}
531\makeevenfoot{lof}{}{}{}
532\renewcommand{\lofheadstart}{\newpage \chapterheadstart}
533\renewcommand{\afterloftitle}{%
534  \par\nobreak\vspace{\onelineskip}\vspace{\onelineskip}
535  {\normalfont Figure}\hfill{\normalfont Page}
536  \par\nobreak\vspace{\onelineskip}
537  \addtocontents{lof}{\protect\label{misc:beforelof}\protect\pagestyle{lof}\protect\thispagestyle{lof-initial}}
538}
539\cftsetindents{figure}{0in}{2.4em}
540\addtodef{\listoffigures}{}{\checklofheaders}
541
542%%%
543%%% Define List of Symbols style
544%%%
545\copypagestyle{los-initial}{plain}
546\makepagestyle{los}
547\makeoddhead{los}{}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\thepage}
548\makeevenhead{los}{}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\thepage}
549\makeoddfoot{los}{}{}{}
550\makeevenfoot{los}{}{}{}
551\renewcommand{\nompreamble}{\protect\pagestyle{los}\protect\thispagestyle{los-initial}}
552
553%%%
554%%% Define List of Programs style
555\renewcommand{\lstlistlistingname}{LIST OF PROGRAMS}
556\renewcommand{\lstlistingname}{Program}
557\newlistof{listoflistings}{lol}{\lstlistlistingname}
558\newlistentry[chapter]{listing}{lol}{0}
559\copypagestyle{lol-initial}{plain}
560\makepagestyle{lol}
561\makeoddhead{lol}{\lstlistingname}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\enlargethispage{-3\onelineskip}\normalfont\thepage\par\vspace{\onelineskip}Page}
562\makeevenhead{lol}{\lstlistingname}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\enlargethispage{-3\onelineskip}\normalfont\thepage\par\vspace{\onelineskip}Page}
563\makeoddfoot{lol}{}{}{}
564\makeevenfoot{lol}{}{}{}
565\renewcommand{\lolheadstart}{\newpage \chapterheadstart}
566\renewcommand{\afterloltitle}{%
567  \par\nobreak\vspace{\onelineskip}\vspace{\onelineskip}
568  {\normalfont \lstlistingname}\hfill{\normalfont Page}
569  \par\nobreak\vspace{\onelineskip}
570  \addtocontents{lol}{\protect\label{misc:beforelol}\protect\pagestyle{lol}\protect\thispagestyle{lol-initial}}
571}
572\renewcommand*{\l@lstlisting}[2]{\@dottedtocline{0}{0em}{2.4em}{#1}{#2}}
573\let\lstlistoflistings\listoflistings
574\addtodef{\lstlistoflistings}{}{\checklolheaders}
575
576%%%
577%%% Final cleanup commands for the ToC, LoT, and LoF.
578%%%
579\newcommand{\toconmultiplepagesnoappendices}{%
580  \addtocontents{toc}{\protect\thispagestyle{toc}}
581}
582\newcommand{\toconmultiplepagesappendicesononepage}{%
583  \addtocontents{toc}{\protect\thispagestyle{toc}}
584}
585\newcommand{\appendixlistonmultiplepages}{%
586  \addtocontents{toc}{\protect\thispagestyle{toc-app}}
587}
588\newcommand{\tablelistonmultiplepages}{%
589  \addtocontents{lot}{\protect\thispagestyle{lot}}
590}
591\newcommand{\figurelistonmultiplepages}{%
592  \addtocontents{lof}{\protect\thispagestyle{lof}}
593}
594\newcommand{\nomenclatureonmultiplepages}{%
595  \renewcommand{\nompostamble}{\protect\thispagestyle{los}}
596}
597
598\newcounter{tocmultipage} \setcounter{tocmultipage}{0}
599\newcounter{appmultipage} \setcounter{appmultipage}{0}
600\newcommand{\checktocheaders}%
601{%
602  \ifonsamepage{misc:beforetoc}%
603  {%
604    \setcounter{tocmultipage}{0}%
605    \typeout{Single-ToC (says checktocheaders)}%
606  }%
607  {%
608    \setcounter{tocmultipage}{1}%
609    \ifonsamepage{misc:beforeapp}%
610    {%
611      \setcounter{appmultipage}{0}%
612      \typeout{Multi-ToC, Single-App (says checktocheaders)}%
613    }%
614    {%
615      \setcounter{appmultipage}{1}%
616      \typeout{Multi-ToC, Multi-App (says checktocheaders)}%
617    }%
618  }%
619}%
620
621\newcommand{\fixtocheaders}{
622  \ifthenelse{\equal{\value{tocmultipage}}{1}}%
623  {%
624    \ifthenelse{\equal{\value{appmultipage}}{1}}%
625    {%
626      \immediate
627                        \write\@auxout{\noexpand\@writefile{toc}{\noexpand\thispagestyle{toc-app}}}
628      \typeout{Multi-ToC, Multi-app (says fixtocheaders)}%
629    }%
630    {%
631      \immediate
632                        \write\@auxout{\noexpand\@writefile{toc}{\noexpand\thispagestyle{toc}}}
633      \typeout{Multi-ToC, Single-app (says fixtocheaders)}%
634    }%
635  }{%
636    \immediate
637                \write\@auxout{\noexpand\@writefile{toc}{\noexpand\thispagestyle{toc-initial}}}
638    \typeout{Single-ToC (says fixtocheaders)}%
639  }%
640}
641
642\newcounter{lofmultipage} \setcounter{lofmultipage}{0}
643\newcommand{\checklofheaders}{%
644  \ifonsamepage{misc:beforelof}{
645        }{%
646    \setcounter{lofmultipage}{1}%
647    \typeout{Multi-LoF (says checklofheaders)}%
648  }%
649}
650\newcommand{\fixlofheaders}{
651  \ifthenelse{\equal{\value{lofmultipage}}{1}}{
652        \immediate
653        \write\@auxout{\noexpand\@writefile{lof}{\noexpand\thispagestyle{lof}}}
654        }{
655        \immediate
656        \write\@auxout{\noexpand\@writefile{lof}{\noexpand\thispagestyle{lof-initial}}}
657        }
658}
659
660\newcounter{lotmultipage} \setcounter{lotmultipage}{0}
661\newcommand{\checklotheaders}{%
662  \ifonsamepage{misc:beforelot}{
663        }{%
664    \setcounter{lotmultipage}{1}%
665    \typeout{Multi-LoT (says checklotheaders)}%
666  }%
667}
668\newcommand{\fixlotheaders}{
669  \ifthenelse{\equal{\value{lotmultipage}}{1}}%
670  {\immediate
671        \write\@auxout{\noexpand\@writefile{lot}{\noexpand\thispagestyle{lot}}}
672        }{
673        \write\@auxout{\noexpand\@writefile{lot}{\noexpand\thispagestyle{lot-initial}}}
674        }
675}
676
677\newcounter{lolmultipage} \setcounter{lolmultipage}{0}
678\newcommand{\checklolheaders}{%
679  \ifonsamepage{misc:beforelol}{
680        }{%
681    \setcounter{lolmultipage}{1}%
682    \typeout{Multi-LoL (says checklolheaders)}%
683  }%
684}
685\newcommand{\fixlolheaders}{
686  \ifthenelse{\equal{\value{lolmultipage}}{1}}{
687        \immediate
688        \write\@auxout{\noexpand\@writefile{lol}{\noexpand\thispagestyle{lol}}}
689        }{
690        \immediate
691        \write\@auxout{\noexpand\@writefile{lol}{\noexpand\thispagestyle{lol-initial}}}
692        }
693}
694
695\newcounter{cPage}
696\newcommand\ifonsamepage[3]{%
697 \refstepcounter{cPage}\label{current\thecPage}%
698 \ifthenelse{\equal{\pageref{#1}}{\pageref{current\thecPage}}}%
699  {\protect{#2}}%
700  {\protect{#3}}%
701  %\typeout{pageref 1 = \pageref{#1}, pageref current = \pageref{current\thecPage}}%
702}
703
704% Ensure ToC headers are corrected
705\AtEndDocument{\fixtocheaders
706\fixlofheaders
707\fixlotheaders
708\fixlolheaders
709}
710
711%%%
712%%% Body text formatting
713%%%
714
715\addtodef{\mainmatter}{\pagestyle{thesis}}{}
716% Double-space text, set default indentation to 3.0em (0.5in for 12pt).
717\ifdraftdoc\else
718\renewcommand{\baselinestretch}{2}
719\fi
720\parindent=3.0em
721
722% Define headers and footers for each page
723\copypagestyle{thesis-initial}{plain}
724\copypagestyle{thesis}{myheadings}
725\makeoddhead{thesis}{}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\normalfont\thepage}
726\makeevenhead{thesis}{}{\ifdraftdoc Draft (\theauthor): \today{} at \printtime*\else\fi}{\normalfont\thepage}
727
728% Define styles for chapter headings
729\renewcommand{\chapnamefont}{\normalfont\bfseries}
730\renewcommand{\chapnumfont}{\normalfont\bfseries}
731\renewcommand{\chaptitlefont}{\normalfont\bfseries}
732\renewcommand{\parttitlefont}{\normalfont\bfseries} % For Appendix Page
733
734% Remove extra space at top of chapter heading
735\renewcommand{\chapterheadstart}{}
736% Print ``CHAPTER'' in all caps, centered
737\renewcommand{\printchaptername}{%
738  \centering \chapnamefont \MakeUppercase{\@chapapp}
739}
740\renewcommand{\printchapternum}{%
741  \centering \chapnumfont \thechapter\space
742}
743\setlength{\midchapskip}{0pt}
744\renewcommand{\printchaptertitle}[1]{%
745  \centering \chaptitlefont \MakeUppercase{#1}
746}
747\setlength{\afterchapskip}{2\baselineskip}
748
749% Define styles for section headings (centered head)
750\setsecheadstyle{\normalfont\bfseries\raggedright\centering}
751\setbeforesecskip{\baselineskip}
752
753% Define styles for subsection headings (freestanding sidehead)
754\setsubsecheadstyle{\bfseries\raggedright}
755\setbeforesubsecskip{\baselineskip}
756
757% Define styles for subsubsection headings (paragraph sidehead)
758\ifthenelse{\isundefined{\addperiod}}{
759  \newcommand{\addperiod}[1]{#1.} % old memoir needs this, new memoir doesn't.
760}{
761}
762\setsubsubsecheadstyle{\bfseries\raggedright\addperiod}
763\setbeforesubsubsecskip{0pt}
764\setsubsubsecindent{\parindent}
765\setaftersubsubsecskip{-0.5em}
766
767% No single lines of a paragraph at the end of a page
768\widowpenalty=9999
769\clubpenalty=9999
770
771%%%
772%%% Bibliography styling
773%%%
774\AtBeginDocument{\renewcommand\bibsection{%
775  \thispagestyle{plain}
776  \ifnobibintoc\else
777  \phantomsection
778  \addtocontents{toc}{\protect\vskip-\baselineskip}
779  \addcontentsline{toc}{chapter}{\texorpdfstring{\uppercase\expandafter{\bibname}}{\bibname}}
780  \fi
781  \beforepartskip
782  \begin{center}
783    \bfseries{\MakeUppercase{\bibname}}
784  \end{center}
785  \bibmark
786  \afterpartskip
787  \clearpage
788  \prebibhook
789}}
790\renewcommand\prebibhook{\begin{Spacing}{1}}
791\renewcommand\postbibhook{\end{Spacing}}
792
793%%%
794%%% Vita fixes. A Vita ends up acting like an appendix, but should
795%%% never be numbered. Easiest for now to just add a custom line to
796%%% the ToC for it.
797%%%
798\newcommand{\vita}[1]{\InputIfFileExists{#1}{\setupvita}{}}
799\newcommand\setupvita{%
800  \chapter*{Vita}
801  \addtocontents{toc}{\protect\vskip-\baselineskip}
802  \addcontentsline{toc}{chapter}%
803    {\texorpdfstring{\uppercase\expandafter{Vita}}{Vita}}
804}
805
806
807% For automatic subfigures and subtables
808\AtBeginDocument{
809  \newsubfloat{figure}
810  \newsubfloat{table}
811}
812
813\IfFileExists{\jobname-packages-loaded-before-hyperref.sty}{%
814  \RequirePackage{\jobname-packages-loaded-before-hyperref}
815}{}
816
817% For all sorts of hyperlinks in the PDF output.
818\RequirePackage[pdfcreator={pdfLaTeX with hyperref},
819  plainpages=false,
820  pdfpagelabels,
821        hypertexnames=true,
822  colorlinks=false]{hyperref}
823
824\IfFileExists{\jobname-packages-loaded-after-hyperref.sty}{%
825  \RequirePackage{\jobname-packages-loaded-after-hyperref}%
826}{}
827
828% Fixing the annoyance that references to floats anchor on
829% the captions, not the floats themselves.
830\RequirePackage[all]{hypcap}
831% Make sure sidewaystables and sidewaysfigures are treated properly,
832% too.
833\hypcapredef{sidewaystable}
834\hypcapredef{sidewaysfigure}
835
836% The memoir class has some conflicts with hyperref. The memhfixc
837% package fixes these conflicts. Do not remove this line.
838\RequirePackage{memhfixc}
839
840%\tracingpatches
841
842\AtBeginDocument{\let\thepdftitle\thetitle%
843  \Substitute*[\renewcommand\thepdftitle]{\thepdftitle}%
844  {\\}{ }%
845  \hypersetup{pdfauthor=\theauthor,pdftitle=\thepdftitle}%
846}
847
848\AtBeginDocument{
849\abstractpage
850\titlepage
851\ifthenelse{\copyrightpagepresent=1}{\copyrightpage}{}
852\approvalpage
853\@ifundefined{ttu@dedication}{}{\dedicationpage}
854\@ifundefined{ttu@acknowledgments}{}{\acknowledgmentspage}
855}
856%%%
857%%% All done. Let memoir finish its setup now.
858%%%
859
860\checkandfixthelayout
861
862\endinput
Note: See TracBrowser for help on using the browser.