%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
% SHSU STYLE
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%

% Set up the documentclass
\documentclass[letterpaper, oneside, onecolumn, 12pt, pdftex]{book} 

%%%%%%%%%%%%%%%
% NEW TIMES ROMAN
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% PAGE MARGINS
%
% INSTRUCTIONS: 
% The default page margins might not give the desired result 
% this depends on the type of machine that you use to compile and print
% If neither of the three choices below provide the correct margins the library demands
% CREATE A NEW geometry and set the values that work for you.
%
% These margins work on a Mac computer with MacTex and printed from a Mac computer
\usepackage[letterpaper, scale=1, nomarginpar, left=1.5truein, right=1truein, top=1truein, bottom=1truein, headheight=0.5truein, footskip=0.5truein]{geometry}
%
% DO NOT USE THE FOLLOWING MARGINS UNLESS YOU HAVE TRIPLE CHECKED THAT THE ABOVE DEFAULTS DO NOT WORK FOR YOU
%
% These margins worked on a Mac computer compiled with MacTex and the 
% printed from a Windows computer
%\usepackage[letterpaper, scale=1, nomarginpar, left=1.375truein, right=0.875truein, top=0.875truein, bottom=0.875truein, headheight=0.5truein, headsep=0.4166truein, footskip=0.5625truein]{geometry}
%
% These margins worked on a Windows computer compiling with MiKTeX
%\usepackage[letterpaper, scale=1, nomarginpar, left=1.5truein, right=0.98truein, top=1truein, bottom=0.88truein, headheight=0.5truein, headsep=0.3truein, footskip=0.333truein]{geometry}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% DOUBLE SPACING
% 
% INSTRUCTIONS: 
% The command \doublespacing may not work for you, 
% since Word double spacing is different than 
% LaTeX double spacing.
% If the library is not happy with the results of this command
% comment \doublespacing and uncomment \setstretch. 
% Then play with the number there until you get the double-spacing that is required
%The default value of 1.91666 has worked in the past
\usepackage{setspace}
%\doublespacing
\setstretch{1.91666}
% Extra vertical space inserted before a paragraph.
\setlength{\parskip}{0pt}
% Prevents LaTeX from adding vertical white space 
% in strange places on pages that it cannot fill properly.
\raggedbottom
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
%GENERAL STYLE
%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%
% These commands will help LaTeX 
% minimize the number of orphans and widows.
\doublehyphendemerits=10000       % No consecutive line hyphens.
\brokenpenalty=10000              % No broken words across columns/pages.
\widowpenalty=9999                % Almost no widows at bottom of page.
\clubpenalty=9999                 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999    % Almost never break footnotes.
%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%
% Alter some LaTeX defaults for better treatment of figures:
% See p.105 of "TeX Unbound" for suggested values.
% See pp. 199-200 of Lamport's "LaTeX" book for details.
\renewcommand{\topfraction}{0.9}	% max fraction of floats at top
\renewcommand{\bottomfraction}{0.8}	% max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}     % 2 may work better
\setcounter{dbltopnumber}{2}    % for 2-column pages
\renewcommand{\dbltopfraction}{0.9}	% fit big float above 2-col. text
\renewcommand{\textfraction}{0.1}	% allow minimal text w. figs .07 may work better
%   Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.7}	% require fuller float pages
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.7}	% require fuller float pages
% remember to use [htp] or [htpb] for placement
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% PACKAGES
%
% The usual AMS stuff
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm}
%
%provides extensions to amsmath
\usepackage{mathtools}
%
% This package modifies the captions. 
% Only needed if the library requests to modify the captions.
% In this case, copy/paste the following line and modify the default values
% to achieve the desired result. 
%\usepackage[format=hang,labelfont=bf,font=normal,justification=centerlast, margin=20pt]{caption,subfig}
%
% This package is required to include external figures in your document.
\usepackage{graphicx}
%
% enables you to do nice figures in LATEX.
\usepackage{tikz}
%tkz-graph loads tikz but it is not contained in the standard distribution.
% \usepackage{tkz-graph}
\usetikzlibrary{matrix,arrows,shapes}
%
% This package allows a line break of an underline sentence
\usepackage{soul}
%
% If an eps image is detected, epstopdf is automatically called to convert it to pdf format.
\usepackage{epstopdf}
%
% INSTRUCTIONS:
% If you need to use a package that is not included already,
% you must add it to the file packages.tex
\input{packages}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% This package changes the way footnotes are presented.
%\usepackage[perpage,para,symbol,bottom]{footmisc}
\usepackage[perpage,bottom,flushmargin]{footmisc}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% PAGE FORMATTING
% This package makes every page number to appear
% in the top right corner.
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} 
\rhead{\rm\thepage}
\renewcommand\headrulewidth{0pt}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% NUMBERING OF TABLES, FIGURES, AND EQUATIONS
\usepackage{chngcntr}
\counterwithout{table}{chapter}
\counterwithout{figure}{chapter}
\counterwithout{equation}{chapter}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% TABLE OF CONTENTS
% The header may appear a bit off the top margin.
% If that is the case, use the second definition and 
% adjust the vertical space accordingly.
\renewcommand{\contentsname}{TABLE OF CONTENTS}
%\renewcommand{\contentsname}{\protect\vspace{0.09375in}TABLE OF CONTENTS}
%
% Only Chapters and Sections are needed in TOC.
\setcounter{tocdepth}{1}
%
% The word "Page" must appear in TOC.
% The placing of the word "Page"  in the TOC may need to be fixed.
% If so, change ~\hfill for \hspace{5.65in} or whatever quantity works for you.
\addtocontents{toc}{~\hfill\textbf{Page}\par}
%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%
% This package modifies the table of contents
% The TOC is indented according to depth: Chapter, Section.
% However, I decided to use titletoc instead since it provides
% more capabilities. But this command is as easy as pie. 
% You just add the package and that is it.
%\usepackage{tocstyle}
%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%
% This package also modifies the table of contents
% The right margin can be controlled much more
% which is needed in order not to intrude into the 1in margin
% that is required by the library.
\usepackage{titletoc}
%
% The next line writes the dots all the way to the number 
%\contentsmargin{0pt}
%
% The next line shrinks the width of the TOC in case it is needed. 
%\renewcommand\contentspage{\thecontentspage}
%
% \dottedcontents  fills the page with dots up to the page number.
% However it makes the entries have bold font.
% So I created my own version of below.
%\dottedcontents{chapter}[2em]{}{2em}{1pc} % 2.3, 2.3, 5pt
%\dottedcontents{section}[3.8em]{}{2em}{1pc} %3.8, 2.3
%
% INSTRUCTIONS:
% Depending on the final margins of your document,
% some of the values below may need to change.
\titlecontents{chapter} % set formatting for \chapter 
[2.3em]                 % adjust left margin
{\normalfont}             % font formatting
{\contentslabel{1.3em}} % section label and offset
{\hspace*{-2.3em}} 
{\titlerule*[1pc]{.}\contentspage}
\titlecontents{section} % set formatting for \section 
[4.1em]                 % adjust left margin
{\normalfont}             % font formatting
{\contentslabel{1.8em}} % section label and offset
{\hspace*{-2.3em}}
{\titlerule*[1pc]{.}\contentspage}
%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% TABLE OF LISTS AND FIGURES
% INSTRUCTIONS:
% The headers may appear a bit off the top margin.
% If that is the case, use the second definitions and 
% adjust the vertical space accordingly.
\renewcommand\listtablename{LIST OF TABLES}
\renewcommand\listfigurename{LIST OF FIGURES}
%\renewcommand\listtablename{\protect\vspace{0.09375in}LIST OF TABLES}
%\renewcommand\listfigurename{\protect\vspace{0.09375in} LIST OF FIGURES}
\addtocontents{lot}{\textbf{TABLE}\hfill\textbf{Page}\par}
\addtocontents{lof}{\textbf{FIGURE}\hfill\textbf{Page}\par}
% These command prevents LaTeX from adding extra space 
% in the LOF and LOT between items on different chapters.
\newcommand*{\noaddvspace}{\renewcommand*{\addvspace}[1]{}}
\addtocontents{lot}{\protect\noaddvspace}
\addtocontents{lof}{\protect\noaddvspace}
%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%
% Shrink the horizontal spacing in LOT and LOF
% tocloft conflicts  with titletoc
% \usepackage{tocloft}
% \addtolength{\cftfignumwidth}{-1em}
% \addtolength{\cfttabnumwidth}{-1em}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% CHAPTER AND SECTION HEADINGS
% I would like to use the line below, but it creates some issues with
% my definitions below. So I am using a vanilla version of the package.
%\usepackage[noindentafter, rigidchapters, nobottomtitles*]{titlesec}
\usepackage[nobottomtitles*]{titlesec}
% \titleformat{ command }[ shape ]{ format }{ label }{ sep }{ before }[ after ]
\titleformat{\chapter}[display]
{\normalfont\normalsize\bfseries\filcenter}
{CHAPTER \thechapter}
{0ex}
{\titlerule[0pt]
\vspace{0ex}%
}
[\vspace{0ex}%
{\titlerule[0pt]}]
%
\titleformat{\section} % add \filcenter if centering required
  {\normalfont\normalsize\bfseries}{\thesection}{1em}{}
\titleformat{\subsection} % add \filcenter if centering required
  {\normalfont\normalsize\bfseries}{\thesubsection}{1em}{} 
\titleformat{\subsubsection} % add \filcenter if centering required
  {\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\paragraph}[runin]
  {\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titleformat{\subparagraph}[runin]
  {\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
%
% SPACING OF CHAPTER AND SECTION HEADINGS
% INSTRUCTIONS:
% The CHAPTER HEADING may be a bit low or high depending on the margins.
% If that is the case, modify the {-30pt} for whatever works.
% -28pt has also worked.
%
% The lines below gives the correct spacing in most cases.
% But it has one small inconsistency when a \chapter command
% is immediately followed by a \section command.
% In that case a line \vspace{-12pt} must be place in between
% the two commands on each occurence inside your main text.
% \titlespacing{ command }{ left }{ beforesep }{ aftersep }[ right ]
\titlespacing{\chapter} {0pt}{-30pt}{12pt}
\titlespacing{\section} {0pt}{0pt}{0pt}
\titlespacing{\subsection} {0pt}{0pt}{0pt}
\titlespacing{\subsubsection} {0pt}{0pt}{0pt}
\titlespacing{\paragraph} {0pt}{0pt}{0pt}
\titlespacing{\subparagraph} {\parindent}{0pt}{0pt}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% BIBLIOGRAPHY
% INSTRUCTIONS:
% The header may appear a bit off the top margin.
% If that is the case, use the second definition and 
% adjust the vertical space accordingly.
%\renewcommand{\bibname}{REFERENCES}
 \renewcommand{\bibname}{\protect\vspace{12pt}REFERENCES}
%
%  Bibliography prepared with BibTeX using amsplain
%  or amsalpha using natbib.
\usepackage[square, numbers, comma, sort&compress]{natbib}
% The following line deletes extra space in between the entries in the
% bibliography to keep the doublespacing.
\setlength{\bibsep}{0pt}
%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% APPENDIX
% This package improves some of the formatting of the title of an appendix and 
% the inclusion of the appendix in the TOC.
\usepackage{appendix}
% INSTRUCTIONS:
% The header may appear a bit off the top margin.
% If that is the case, use the second definition and 
% adjust the vertical space accordingly.
\renewcommand\appendixname{APPENDIX}
%\renewcommand\appendixname{\protect\vspace{9pt}APPENDIX}
%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% I strongly recommend AGAINST adding the following spell.
% 
% This prepends the word APPENDIX in TOC
% for each appendix chapter.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\makeatletter
%\newcommand\appendix@chapter[1]{%
%  \refstepcounter{chapter}%
%  \orig@chapter*{APPENDIX \@Alph\c@chapter\ #1}%
%  \addcontentsline{toc}{chapter}{APPENDIX \@Alph\c@chapter\protect\quad #1}%
%}
%\let\orig@chapter\chapter
%\g@addto@macro\appendix{\let\chapter\appendix@chapter}
%\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%
% HYPERLINKS
\usepackage{url}
\usepackage[pdfpagemode=UseOutlines,bookmarks=true,bookmarksopen=true,
   bookmarksopenlevel=1,bookmarksnumbered=true,hypertexnames=false,
 %  colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red}, unicode,
   pdfstartview=FitV,breaklinks=true]{hyperref} 
%%%%%%%%%%%%%%

\endinput

%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
% END: SHSU STYLE
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
