# Editing a Custom Class File to Eliminate Blank Pages, Fix TOC

I am using a modified BYU Thesis Template for my thesis.

This template has two undesired features that I would like to eliminate:

1. The template creates blank pages in various places. Examples are after the first (title) page and after the abstract and so on. The template also creates blank pages after some chapters. I believe this is to ensure, when printed on double-sided paper, that a new chapter doesn't start on the back of a page. In short, I want to remove all blank pages.
• So you want a twoside behaviour without the blank pages? The template is written using oneside; that's why I'm asking. – Werner May 8 '13 at 1:56
• @Werner i'm not sure I understand the difference... I'm fine with the template the way it is (one sided, based on your comments), but just want to eliminate the empty pages if possible. – zpesk May 8 '13 at 2:27

\documentclass[..,honors,etd,openany,..]{BYUPhys}
\let\oldToC\tableofcontents
\renewcommand{\tableofcontents}{{% Remove ToC entries
\let\oldmakepreliminarypages\makepreliminarypages
\renewcommand{\makepreliminarypages}{{% Remove ToC entries
%...
\begin{document}
%...
\makepreliminarypages
\renewcommand{\clearemptydoublepage}{\clearpage}
%...
\end{document}


Here's an abbreviated discussion on what's happening:

1. There are a number of things you need to do in order to address blank pages:

• Use the etd option (apparently a submission type that is specific to BYU) for the document class to remove blank pages within the "preliminary pages" part of the thesis:

\documentclass[..,etd,...]{BYUPhys}
%...

• Insert \renewcommand{\clearemptydoublepage}{\clearpage} immediately after \makepreliminarypages to remove blank pages around the ToC:

 \begin{document}
%...
\makepreliminarypages
\renewcommand{\clearemptydoublepage}{\clearpage}
%...

• Use the openany option for the document class to remove per-chapter blank pages:

\documentclass[..,openany,..]{BYUPhys}
%...


\let\oldToC\tableofcontents
\renewcommand{\tableofcontents}{{% Remove ToC entries
\let\oldmakepreliminarypages\makepreliminarypages
\renewcommand{\makepreliminarypages}{{% Remove ToC entries


This redefines the contents-related macro \addcontentsline temporarily to do nothing (gobble its 3 mandatory arguments). Note the grouping (double braces) inside the redefinition of both commands. By default there is no inclusion of the Title, Abstract or Acknowledgements in the ToC, but under the honors class option, they are.

Here's a detailed discussion on what's happening:

1. Removing blank pages:

• The etd document class option defines an appropriate "clear page" macro:

\DeclareOption{etd}{
\renewcommand{\clearemptydoublepage}{\clearpage}

• \makepreliminarypages redefined the \clearemptydoublepage above to re-insert blank pages:

\newcommand{\makepreliminarypages}{
\singlespace
\changepage{0.5in}{}{}{}{}{}{-0.2in}{-0.3in}{}
\BYUtitlepage
\abstractpage
\acknowledgmentspage
\renewcommand{\clearemptydoublepage}{\cle@remptydoublep@ge}% <-------- !
\changepage{-0.5in}{}{}{}{}{}{0.2in}{0.3in}{}
\doublespace
}


By inserting the above suggested \renewcommand, we override this redefinition to maintain the status quo of not inserting more blank pages.

• Since BYUPhys.cls loads the default book document class and doesn't redefine \chapter, we can look there to make any changes.

book.cls defines \chapter as

\newcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}


which inserts \cleardoublepage under the openright document class option. So, for a regular \clearpage, we use the openany option.

2. \tableofcontents inserts something in the ToC by default:

\let\TEMPtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{
\clearemptydoublepage
\singlespace
\providecommand\phantomsection{} \phantomsection
\TEMPtableofcontents
\clearemptydoublepage
\doublespace
}


\makepreliminarypages, which sets the preliminary pages before the ToC (Title, Abstract and Acknowledgements), includes a similar usage of \addcontentsline:

\DeclareOption{honors}{
\renewcommand{\makepreliminarypages}{
\changepage{0.5in}{-0.5in}{}{0.5in}{}{}{-0.2in}{-0.3in}{}
\providecommand\phantomsection{} \phantomsection
\addcontentsline{toc}{chapter}{Title and signature page}% <-------- !
\honorstitlepage
\providecommand\phantomsection{} \phantomsection
\honorsabstractpage
\honorsacknowledgmentspage% <-------- ! (hidden, but in there...)
\renewcommand{\clearemptydoublepage}{\cle@remptydoublep@ge}
\changepage{-0.5in}{}{}{}{}{}{0.2in}{0.3in}{}
\doublespace
}
}


By redefining \addcontentsline to momentarily do nothing, the marked lines above do nothing.

• thanks for the help, still getting the following problems: (1) there is a blank page after the TOC, (2) the TOC still has Title, Abstract, Acknowledgments. I am using the honors option if this make a difference. – zpesk May 8 '13 at 2:54
• I was able to remove the remaining unwanted items from the TOC by commenting out the unwanted lines in the cls file such as \addcontentsline{toc}{chapter}{Acknowledgments} – zpesk May 8 '13 at 3:05
• @zpesk: Of course it makes a difference. I've updated my answer to accommodate for this behaviour, specifically for the honors class option. Moreover, I've corrected the problem with bookmarks that occur from using honors. – Werner May 8 '13 at 5:38
• thanks and sorry for not including that option upfront... The only remaining problem is that there is still a blank page after the Table of Contents. – zpesk May 8 '13 at 13:07