% Modify behavior of standard LaTeX macros for book class
% =======================================================
% Modify Title display

\renewcommand\maketitle{\begingroup
\renewcommand{\baselinestretch}{1}
\begin{center}
\sffamily\bfseries\LARGE\@title{\\[2ex]}\Large\@author
\end{center}
\endgroup
\normalsize}
% =======================================================
% Modify Table of Contents
% Do NOT make headers uppercase.

\renewcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{%
           %\MakeUppercase
           \contentsname}{%\MakeUppercase
           \contentsname}}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    }
% =======================================================
% Modify how chapter titles appear in TOC.
% Remove space between chapters.

\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
%    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
% =======================================================
% Modfy Index
% Put Index into TOC and make Index text \footnotesize
% Do NOT make headers uppercase.
% Reduce indentation of index items.

\renewenvironment{theindex}
               {\if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                \twocolumn[\@makeschapterhead{\indexname}]%
                \@mkboth{%\MakeUppercase
                \indexname}%
                        {%\MakeUppercase
                        \indexname}%
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \columnseprule \z@
                \columnsep 35\p@
                \let\item\@idxitem
       \addcontentsline{toc}{chapter}{\protect\numberline{ }{Index}}
       \footnotesize
               }
               {\if@restonecol\onecolumn\else\clearpage\fi}

\renewcommand\@idxitem{\par\hangindent 30\p@}
\renewcommand\subitem{\@idxitem \hspace*{10\p@}}
\renewcommand\subsubitem{\@idxitem \hspace*{20\p@}}
% =======================================================
% Make Bibliography appear in TOC.
% Do NOT make headers uppercase.
% NO space between entries.
% Use \footnotesize

\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname}%
      \@mkboth{%\MakeUppercase
      \bibname}{%\MakeUppercase
      \bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}
  \topsep=1ex\itemsep=\z@\parsep=\z@\footnotesize
            }%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m
  \addcontentsline{toc}{chapter}{\protect\numberline{ }{\bibname}}}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
% =======================================================
% Modify "plain" pagestyle to print page # in bold sf
% in footer

\def\ps@plain{\let\@mkboth\@gobbletwo
\let\@oddhead\@empty
\let\@evenhead\@empty
\def\@oddfoot{\bfseries\sffamily\hfil\thepage\hfil}
\let\@evenfoot=\@oddfoot}
% =======================================================
% Modify "headings" pagestyle to use bold sf and 
% to print \footertext in \footnotesize
% Don't make headers uppercase, and don't print "Chapter"
% Do NOT print period after chapter or section number in headers
% and change space between number and title.

\def\footertext{\today}

\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{\hfil\footnotesize\footertext\hfil}\let\@evenfoot=\@oddfoot
\def\@evenhead{\bfseries\sffamily \thepage\hfil \leftmark\hfil}
\def\@oddhead{\hbox{}\hfil\bfseries\sffamily \rightmark \hfil \thepage}

\def\chaptermark##1{%
      \markboth {%\MakeUppercase
      {%
        \ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
            % \@chapapp\space
            \thechapter \ \ %. \ %
          \fi
        \fi
        ##1}}{}}%
    \def\sectionmark##1{%
      \markright {%\MakeUppercase
      {%
        \ifnum \c@secnumdepth >\z@
          \thesection \ \ %. \ %
        \fi
        ##1}}}
}
\pagestyle{headings}
% =======================================================
% Make \chapter NOT \cleardoublepage and DO indent
% first paragraph.

\renewcommand\chapter{%\if@openright\cleardoublepage\else\clearpage\fi
                    \clearpage
                    \thispagestyle{plain}%
                    \global\@topnum\z@
                   % \@afterindentfalse
                    \secdef\@chapter\@schapter}
% =======================================================
% Modify display of chapter/appendix headings.

\renewcommand{\chaptername}{CHAPTER}
\renewcommand{\appendixname}{APPENDIX}
   
\def\@makechapterhead#1{\begingroup
\LARGE\bfseries\sffamily\relax\centering\interlinepenalty \@M
\vspace*{-.325\baselineskip}
\hrule height.2ex\vskip.25ex\hrule height.075ex\vskip1ex
        {\large\bfseries\sffamily  \@chapapp\ \thechapter} \\ #1
\\[1ex]
\hrule height.075ex \vskip.25ex \hrule height.2ex \vskip1ex\par
\endgroup}

\def\@makeschapterhead#1{\begingroup
\LARGE\bfseries\sffamily\relax\centering\interlinepenalty \@M
\vspace*{-.325\baselineskip}
\hrule height.2ex\vskip.25ex\hrule height.075ex\vskip1ex
         #1
\\[1ex]
\hrule height.075ex \vskip.25ex \hrule height.2ex \vskip1ex\par
\endgroup}
% =======================================================