%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% phd-report.cls based on -> thesis.cls                             %%
%% Latex thesis class file for Preparation of Master and Doctoral    %%
%% in the University of Gaziantep. Conform to the  Graduate School   %%
%% of natural and Applied Sciences rules.                            %%
%% See http://wwwacs.gantep.edu.tr/guides/programming/latex/         %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% version 2.1.1 03/06/2004 - website URL change (only)                %%
%% version 2.1.0 01/07/2003 - Major revision by Andrew Beddall and     %%
%%                            Okan Ozer to conform better with the     %%
%%                            graduate school and modernise the style. %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Initial Modifications by Andrew Beddall for Gaziantep             %%
%% version 2.0.3 06/05/2003 - MASTER and PHD  -> M. Sc and Ph. D     %%
%%                            Small changes on the approval page     %%
%% version 2.0.2 14/01/2002 - changed approval page to conform with..%%
%% version 2.0.1 06/07/2001 - /copyrightpageplease bug fix           %%
%% version 2.0.0 29/06/2001 - convert original Colorado format to    %%
%%                            Gaziantep format (many changes!).      %%
%%                                                                   %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Originally developed by the University of Colorado:
%%
%%      Version 1.00 written by John P. Weiss, 1997
%%
%%  version 1.08, Steven V Penton, September 1999 -- added
%%      \readerFive; moved list of tables in front of figures
%%  version 1.07, BF, January 1999 -- fixed \LoFisShort etc.
%%  version 1.06, BF, November 1998 -- fixed level 4 headers;
%%      SubSubSections, inline4 & nonum4.  Eliminated
%%      unwanted space before chapter/section numbers.
%%  version 1.05, BF, August 1998 -- Footnotes and floats
%%      (captions) now singlespaced, fixing an omission
%%      in v1.04.  Fixed value of \belowcaptionskip,
%%      for table captions.
%%  version 1.04, BF, July 1998, Adjusted doublespacing
%%      (no longer uses setspace.sty) and margin values.
%%  version 1.03, May 1998, Bruce Fast -- Added optional
%%      \readerThree{}, \readerFour{}; LoF/LoT debugging;
%%      doublespaced abstract
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{thesis}[06/07/2001 version 2.0.1]

\typeout{}
\typeout{+---------------------------------------------------------}
\typeout{| Thesis Class (thesis.cls) 2.1.0 01/07/2003              }
\typeout{| For the preparation of Master and Doctoral theses in the}
\typeout{| University of Gaziantep. Conforms to the Graduate School}
\typeout{| of Natural and Applied Sciences specifications.         }
\typeout{| See http://wwwacs.gantep.edu.tr/guides/programming/latex/ThesisClass/     }  
\typeout{+---------------------------------------------------------}
\typeout{}

% Certain options are not handled here but are passed on to report.cls
% by \PassOptionToClass.

\DeclareOption{fleqn}{ \PassOptionsToClass{fleqn}{report} }
\DeclareOption{leqno}{ \PassOptionsToClass{leqno}{report} }
\DeclareOption{openbib}{ \PassOptionsToClass{openbib}{report} }
\DeclareOption{draft}{ \PassOptionsToClass{draft}{report} }
\DeclareOption{final}{ \PassOptionsToClass{final}{report} }
\DeclareOption{openright}{ \PassOptionsToClass{openright}{report} }
\DeclareOption{openany}{ \PassOptionsToClass{openany}{report} }
\DeclareOption{10pt}{ \PassOptionsToClass{10pt}{report} }
\DeclareOption{11pt}{ \PassOptionsToClass{11pt}{report} }
\DeclareOption{12pt}{ \PassOptionsToClass{12pt}{report} }

% Invalid options - normally used in report.cls and others, but not here:

\DeclareOption{titlepage}{\ClassWarning{thesis}{Title page always generated. Option ignored.}}
\DeclareOption{notitlepage}{\ClassWarning{thesis}{Option 'notitlepage' not available for thesis.}}
\DeclareOption{twoside}{\ClassWarning{thesis}{Option 'twoside' not available for thesis.}}
\DeclareOption{twocolumn}{\ClassWarning{thesis}{Option 'twocolumn' not available for thesis.}}
\DeclareOption{landscape}{\ClassWarning{thesis}{Option 'landscape' not available for thesis.}}
\DeclareOption{legalpaper}{\ClassWarning{thesis}{Option 'legalpaper' not available for thesis.}}
\DeclareOption{a4paper}{\ClassWarning{thesis}{Option 'a4paper' not available for this class.}}
\DeclareOption{a5paper}{\ClassWarning{thesis}{Option 'a5paper' not available for this class.}}
\DeclareOption{executivepaper}{\ClassWarning{thesis}{Option 'executivepaper' not available.}}
\DeclareOption{b5paper}{\ClassWarning{thesis}{Option 'b5paper' not available for this class.}}
\DeclareOption{letterpaper}{\ClassWarning{thesis}{Option 'letterpaper' superfluous. Ignored.}}
\DeclareOption{onecolumn}{\ClassWarning{thesis}{Option 'onecolumn' superfluous.  Ignored.}}
\DeclareOption{oneside}{\ClassWarning{thesis}{Option 'oneside' superfluous.  Ignored.}}

% CUSTOM OPTIONS

% Options for no decimal numbering, or decimal number nested over 3 deep:
\newif\if@AllHeadings
\newif\if@NumberStdHeadings
\newif\if@PerChptrNumbering
\newif\if@emphisbold
\newif\if@boldhead
\newif\if@fixedHeadSz
\newif\if@headSizeTwelvePt
\newif\if@ChapterDefault
\newif\if@SectionDefault
\newif\if@SubSectionDefault
\newif\if@OtherHeadingDefault
\newif\if@centerChapter
\newif\if@centerSection
\newif\if@inlineSubSubSection
\newif\if@numberSubSubSection
\newif\if@chapterCaps
\@AllHeadingsfalse
\@NumberStdHeadingstrue
\@PerChptrNumberingtrue
\@emphisboldtrue
\@boldheadtrue
\@fixedHeadSzfalse
%\@centerChapterfalse
\@centerChaptertrue
\@centerSectionfalse
\@inlineSubSubSectionfalse
\@numberSubSubSectiontrue
\@chapterCapsfalse
%\@headSizeTwelvePttrue
\@headSizeTwelvePtfalse
\DeclareOption{consecutivenumbering}{ \@PerChptrNumberingfalse }
\DeclareOption{inlineh4}{ \@inlineSubSubSectiontrue }
\DeclareOption{nonumh4}{ \@numberSubSubSectionfalse }
\DeclareOption{centerh1}{ \@centerSectiontrue }
\DeclareOption{chapleft}{ \@centerSectiontrue }
\DeclareOption{chapup}{ \@chapterCapstrue }
\DeclareOption{emph2underline}{ \@emphisboldfalse }
\DeclareOption{plainhead}{ \@boldheadfalse }
\DeclareOption{fixedheadsize}{ \@fixedHeadSztrue }
\DeclareOption{varheadsize}{\@headSizeTwelvePtfalse}% Hidden option.  Don't use.
\DeclareOption{numberchapteronly}{
    \@PerChptrNumberingfalse\@NumberStdHeadingsfalse\@AllHeadingsfalse
    \@centerChaptertrue\@centerSectiontrue
    \@inlineSubSubSectiontrue\@numberSubSubSectionfalse }
\DeclareOption{allheadings}{
    \@PerChptrNumberingtrue\@NumberStdHeadingstrue\@AllHeadingstrue
    \@centerChaptertrue\@centerSectionfalse
    \@inlineSubSubSectionfalse\@numberSubSubSectiontrue}
\DeclareOption{typewriterstyle}{ \@emphisboldfalse
    \@PerChptrNumberingfalse\@NumberStdHeadingsfalse\@AllHeadingsfalse
    \@centerChaptertrue\@centerSectiontrue\@chapterCapstrue
    \@inlineSubSubSectiontrue\@numberSubSubSectionfalse
    \@boldheadfalse\@fixedHeadSztrue}
\DeclareOption{modernstyle}{ \@emphisboldtrue
    \@PerChptrNumberingtrue\@NumberStdHeadingstrue\@AllHeadingsfalse
    \@centerChaptertrue\@centerSectionfalse\@chapterCapsfalse
    \@inlineSubSubSectiontrue\@numberSubSubSectionfalse
    \@boldheadtrue\@fixedHeadSzfalse}
% "defaultstyle" and "gustyle" should be the same
\DeclareOption{defaultstyle}{ \@emphisboldtrue
    \@PerChptrNumberingtrue\@NumberStdHeadingstrue\@AllHeadingsfalse
    \@centerChapterfalse\@centerSectionfalse\@chapterCapsfalse
    \@inlineSubSubSectionfalse\@numberSubSubSectionfalse
    \@boldheadtrue\@fixedHeadSzfalse}
\DeclareOption{gustyle}{ \@emphisboldtrue
    \@PerChptrNumberingtrue\@NumberStdHeadingstrue\@AllHeadingsfalse
    \@centerChapterfalse\@centerSectionfalse\@chapterCapsfalse
    \@inlineSubSubSectionfalse\@numberSubSubSectionfalse
    \@boldheadtrue\@fixedHeadSzfalse}

% Now we load the report class with certain options by default.  It
% will process any other options specified.  Then, we process the
% options for this class file.  Lastly, we load in the font option
% file for the given font size.

\ProcessOptions
\LoadClass[letterpaper,oneside,onecolumn]{report}[1996/10/31]

% Other required LaTeX2e packages: if your computer doesn't already
% have these, you can copy them to your own directory (URL above):

\RequirePackage{indentfirst}        % indentfirst.sty, 1995/11/23
\RequirePackage{ifthen}         % ifthen.sty, 1996/08/02
\RequirePackage[ULforem,normalbf]{ulem} % ulem.sty, 1995/12/17


% SPECIAL INTERNAL COMMANDS.  Needed by later routines.

% Determine whether MSc or PhD and set the /degree parameter accordingly

    \newif\if@itsaPhD

    \newcommand*{\degree}[3]{
        \th@StoreIn{\th@fulldegree}{#1}
        \th@StoreIn{\th@degree}{#2}
        \th@StoreIn{\th@longdegree}{#3}
    }
    \newcommand*{\turkdegree}[2]{
        \th@StoreIn{\th@turkfulldegree}{#1}
        \th@StoreIn{\th@turkdegree}{#2}
    }

    \newcommand*{\MSc}{
        \@itsaPhDfalse
        \typeout{MSc form choosen.}
        \degree{M. Sc}{M. Sc}{Master of Science}
        \turkdegree{A Master's}{Y{\"u}ksek Lisans Tezi}
    }

    \newcommand*{\PhD}{
        \@itsaPhDtrue
        \typeout{PhD report chosen.}
            \degree{Ph. D}{Ph. D}{Doctor of Philosophy}
            \turkdegree{A Ph.D.}{Doktora Tezi}
    }

% allow for the Double space option "\doublespacingplease"

    \newif\if@itsdouble
    \@itsdoublefalse

    \newcommand*{\doublespacingplease}{
        \typeout{Double spacing chosen}
        \@itsdoubletrue
    }

% allow for a copyright page before the signature page
% it will be blank, but numbered.

    \newif\if@itscopyrighted
    \@itscopyrightedfalse

    \newcommand*{\copyrightpageplease}{
        \typeout{Copyright page requested.}
        \@itscopyrightedtrue
    }

% Create a command to be used for default arguments.
\newcommand*{\th@DefArg}{aWfdRvV11f66GL00K5}

% Now create a command to check for the default argument, and call the
% command [in the first arg] appropriately.  Used for section heading
% commands.

\newcommand{\th@ExecChkOptArg}[3]{
\ifthenelse{\equal{\th@DefArg}{#2}}{
    #1{#3}
    }{
    #1[#2]{#3}}
}

% Controls the heading styles.  You can change the size to suit your needs.

\if@fixedHeadSz
    \newcommand*{\th@ChSz}{\normalsize}
    \newcommand*{\th@ScSz}{\normalsize}
\else\if@headSizeTwelvePt
    \newcommand*{\th@ChSz}{\normalsize\fontsize{12}{12}\selectfont}
    \newcommand*{\th@ScSz}{\normalsize\fontsize{12}{12}\selectfont}
\else
    %\newcommand*{\th@ChSz}{\normalsize\LARGE}
    %\newcommand*{\th@ScSz}{\normalsize\Large}
    \newcommand*{\th@ChSz}{\LARGE}
    \newcommand*{\th@ScSz}{\Large}
\fi\fi

\if@boldhead
    \newcommand*{\th@HdFnt}{\normalfont\bfseries}
\else
    \newcommand*{\th@HdFnt}{\normalfont}
\fi

% The style commands proper.  Controlled by a flag.

\newif\if@thInHeading
\@thInHeadingfalse
\newcommand*{\th@ChapterStyle}{\if@thInHeading\th@HdFnt\th@ChSz\fi}
\newcommand*{\th@SectionStyle}{\if@thInHeading\th@HdFnt\th@ScSz\fi}
\newcommand*{\th@SubSectionStyle}{\if@thInHeading\large\th@HdFnt\fi}
\newcommand*{\th@OtherSecHeadStyles}{\if@thInHeading\normalsize\th@HdFnt\fi}

% Re-define the emphasis commands to use either BOLDFACE or UNDERLINING,
% depending on the startup flags.

\newcommand*{\EmphReset}{
    \if@emphisbold
        \let\em\bfseries
        \let\emph\textbf
    \else
        \ULforem
    \fi
}

% Makes the chapter heading label, putting it in the desired style.
% We need to define it here, since we need it before redefining the
% chapter commands.

\newcommand*{\th@DoChapCenter}{\if@centerChapter\centering\fi}
\newcommand*{\th@ChapHead}[1]{
    \protect\th@ChapterStyle
    \protect\th@DoChapCenter #1}


% DEFINE DOUBLE-SPACING (THE DEFAULT) AND OTHER SPACING
\def\setlinespacing{
        \if@itsdouble
        \doublespacing
        \else
        \oneandonehalfspacing
        \fi
}
\def\setspace@size{\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi}
\def\doublespacing{ \ifcase \@ptsize \relax
      \def \baselinestretch {2.004}%    10pt
  \or \def \baselinestretch {1.771}%    11pt
  \or \def \baselinestretch {1.660}%    12pt
  \fi \setspace@size}
\def\oneandonehalfspacing{ \ifcase \@ptsize \relax
      \def \baselinestretch {1.503}%    10pt
  \or \def \baselinestretch {1.328}%    11pt
  \or \def \baselinestretch {1.245}%    12pt
  \fi \setspace@size}
\def\singlespacing{\def \baselinestretch {1} \setspace@size \vskip \baselineskip}
\def\setstretch#1{\renewcommand{\baselinestretch}{#1}}
\def\@setsize#1#2#3#4{\@nomath#1
  \let\@currsize#1 \baselineskip #2
  \baselineskip \baselinestretch\baselineskip
  \parskip \baselinestretch\parskip
  \setbox\strutbox \hbox{ \vrule height.7\baselineskip depth.3\baselineskip
  width\z@} \skip\footins \baselinestretch\skip\footins
  \normalbaselineskip\baselineskip#3#4}
%%%%%%%%% floats & footnotes singlespaced %%%%%%%%%
\let\latex@xfloat=\@xfloat
\def\@xfloat #1[#2]{\latex@xfloat #1[#2]
\def\baselinestretch{1}\@normalsize \normalsize}
\long\def\@footnotetext#1{
  \insert\footins{
    \def\baselinestretch {1}
    \reset@font\footnotesize
    \interlinepenalty\interfootnotelinepenalty
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{
      \csname p@footnote\endcsname\@thefnmark}
    \color@begingroup \@makefntext{
        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}
    \color@endgroup}}
\long\def\@mpfootnotetext#1{
  \global\setbox\@mpfootins\vbox{
    \unvbox \@mpfootins
    \def\baselinestretch {1}
    \reset@font\footnotesize
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{
      \csname p@mpfootnote\endcsname\@thefnmark}
    \color@begingroup \@makefntext{
       \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}
   \color@endgroup}}
%%%%%%%% single / double spacing %%%%%%%%%
\def\singlespace{ \vskip \baselineskip \def\baselinestretch {1}
    \setspace@size \vskip -\baselineskip }
\def\endsinglespace{\par}
\def\spacing#1{ \par \begingroup \def\baselinestretch {#1} \setspace@size }
\def\endspacing{ \par \vskip \parskip \vskip \baselineskip
  \endgroup \vskip -\parskip \vskip -\baselineskip }
\def\doublespace{ \ifcase \@ptsize \relax
      \spacing{2.004}%  10pt
  \or \spacing{1.771}%  11pt
  \or \spacing{1.660}%  12pt
  \fi }
\let\enddoublespace=\endspacing
\def\oneandonehalfspace{ \ifcase \@ptsize \relax
      \spacing{1.503}%  10pt
  \or \spacing{1.328}%  11pt
  \or \spacing{1.245}%  12pt
  \fi }

% SET THE OVERALL DOCUMENT PROPERTIES, such as page numbering, margins...
% Initialize several global document properties, but do so *before*
% the beginning of the document to forces these changes.
\AtBeginDocument{
%        \setlength{\topmargin}{-0.30in}
        \setlength{\topmargin}{-2.8cm}
%        \setlength{\headheight}{0.20in}
        \setlength{\headheight}{0.51cm}
%        \setlength{\headsep}{0.0in}
        \setlength{\headsep}{0.0cm}
%        \setlength{\topskip}{0.40in}    % first line, down from page number
        \setlength{\topskip}{1.0cm}    % first line, down from page number
%        \setlength{\textheight}{9.10in} % 9"-(topmargin+headsep+headheight)
        \setlength{\textheight}{25.3cm}
%
        \setlength{\footskip}{0pt}
%        \setlength{\oddsidemargin}{0.75in} % 1.90 cm
%        \setlength{\evensidemargin}{0.75in} % 1.90cm
        \setlength{\oddsidemargin}{1.2cm}
        \setlength{\evensidemargin}{1.2cm}
        \setlength{\parindent}{30pt}    % somewhere between 0.3" and 0.5"
%        \setlength{\textwidth}{5.75in} % 14.6cm
        \setlength{\textwidth}{14.4cm}
%
    \setlength{\leftmargini}{3.5em}
    \setlength{\leftmarginii}{2.2em}
    \setlength{\leftmarginiii}{2.2em}
    \setlength{\leftmarginiv}{2.2em}
    \setlength{\leftmarginv}{2.2em}
    \setlength{\leftmarginvi}{2.2em}
    \setlength{\leftmargin}{\leftmargini}
    \setlength{\labelsep}{.5em}
    \setlength{\labelwidth}{ 1.5em}
    \pagenumbering{arabic}
    \pagestyle{myheadings}
    \markright{}
    \onecolumn
    \raggedbottom
    \normalsize
    \normalfont
    \EmphReset  % bold or underlined?
    \setlinespacing % footnotes and floats still singlespaced
    \setcounter{tocdepth}{4}
    \setcounter{secnumdepth}{\value{th@SecNum}}
% Redefine the bibliography command here, just in case someone
% uses a custom *.sty file that redefines bibliography command
    \let\th@OldBib\thebibliography
    \let\endth@OldBib\endthebibliography
    \renewenvironment*{thebibliography}[1]{
        \begin{th@OldBib}{#1}
        \ULforem%  set \em to underline
        \begin{singlespace}
        \addcontentsline{toc}{part}{\bibnameToC}
    }{
        \end{singlespace}
        \EmphReset% set \em back to the user-specified default.
        \end{th@OldBib}
    }

%%%%%%%%%%%%%%%%THIS IS FOR THE PUBLICATIONS%%%%%%%%%%%%%%%%%%%%%%%%
%Definition starts here%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \let\th@publicationsOldBib\publications
    \let\endth@publicationsOldBib\endpublications
    \renewenvironment*{publications}[1]{
        \begin{th@publicationsOldBib}{#1}
        \ULforem%  set \em to underline
        \begin{singlespace}
        \addcontentsline{toc}{part}{\publicationsbibnameToC}
    }{
        \end{singlespace}
        \EmphReset% set \em back to the user-specified default.
        \end{th@publicationsOldBib}
    }
%Definition ends here%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%THIS IS FOR THE CURRICULUM VITAE%%%%%%%%%%%%%%%%%%%%
%Definition starts here%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \let\th@curriculumvitaeOldBib\curriculumvitae
    \let\endth@curriculumvitaeOldBib\endcurriculumvitae
    \renewenvironment*{curriculumvitae}[1]{
        \begin{th@curriculumvitaeOldBib}{#1}
        \ULforem%  set \em to underline
        \begin{singlespace}
        \addcontentsline{toc}{part}{\curriculumvitaebibnameToC}
    }{
        \end{singlespace}
        \EmphReset% set \em back to the user-specified default.
        \end{th@curriculumvitaeOldBib}
    }
%Definition ends here%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}

% ADDITIONAL STUFF

\setcounter{tocdepth}{4}
\newcommand*{\@normalsize}{\normalsize}
\setlinespacing

%  Figures and Tables
\setcounter{topnumber}{1}
\renewcommand*{\topfraction}{.4}
\setcounter{totalnumber}{2}
\renewcommand*{\textfraction}{.5}
\renewcommand*{\floatpagefraction}{.3}
\setcounter{dbltopnumber}{1}
\renewcommand*{\dbltopfraction}{.4}
\renewcommand*{\dblfloatpagefraction}{.3}
\setlength{\abovecaptionskip}{10pt}
\setlength{\belowcaptionskip}{10pt}

% Re-define some formatting commands to produce lists, labels,
% and numberings that are more to the Grad School's liking.

% Set up some titles on the table of contents page.
\renewcommand*{\figurename}{Figure}
\renewcommand*{\tablename}{Table}
\newcommand*{\figurenameToC}{\normalsize\th@HdFnt\figurename\normalfont}
\newcommand*{\tablenameToC}{\normalsize\th@HdFnt\tablename\normalfont}
\newcommand*{\publicationsbibname}{\th@ChapHead{Publications}}
\newcommand*{\curriculumvitaebibname}{\th@ChapHead{Curriculum Vitae}}

\if@chapterCaps
    \renewcommand*{\contentsname}{\th@ChapHead{TABLE OF CONTENTS}}
    \renewcommand*{\listfigurename}{\th@ChapHead{LIST OF FIGURES}}
    \renewcommand*{\listtablename}{\th@ChapHead{LIST OF TABLES}}
    \renewcommand*{\appendixname}{\th@ChapHead{APPENDIX}}{\relax}
    \renewcommand*{\bibname}{\th@ChapHead{LIST OF REFERENCES}}
    \renewcommand*{\chaptername}{\th@ChapHead{CHAPTER}}
    \newcommand*{\chapternameToC}{\normalsize\th@HdFnt CHAPTER\normalfont}
    \newcommand*{\bibnameToC}{\normalsize\th@HdFnt REFERENCES\normalfont}
    \newcommand*{\appendixnameToC}{\normalsize\th@HdFnt APPENDIX\normalfont}{\relax}
    \newcommand*{\publicationsbibnameToC}{\normalsize\th@HdFnt PUBLICATIONS\normalfont}
    \newcommand*{\curriculumvitaebibnameToC}{\normalsize\th@HdFnt CURRICULUM VITAE\normalfont}
\else
    \renewcommand*{\contentsname}{\th@ChapHead{Table of Contents}}
    \renewcommand*{\listfigurename}{\th@ChapHead{List of Figures}}
    \renewcommand*{\listtablename}{\th@ChapHead{List of Tables}}
    \renewcommand*{\appendixname}{\th@ChapHead{Appendix}}{\relax}
    \renewcommand*{\bibname}{\th@ChapHead{List of References}}
    \renewcommand*{\chaptername}{\th@ChapHead{Chapter}}
    \newcommand*{\chapternameToC}{\normalsize\th@HdFnt Chapter\normalfont}
    \newcommand*{\bibnameToC}{\normalsize\th@HdFnt References\normalfont}
    \newcommand*{\appendixnameToC}{\normalsize\th@HdFnt Appendix\normalfont}{\relax}
    \newcommand*{\publicationsbibnameToC}{\normalsize\th@HdFnt Publications\normalfont}
    \newcommand*{\curriculumvitaebibnameToC}{\normalsize\th@HdFnt Curriculum Vitae\normalfont}
\fi

% Adds the appropriate label to the ToC/LoF/LoT

\addtocontents{lof}{\protect\contentsline {part}
    {\protect\figurenameToC}{\protect\relax}}
\addtocontents{lot}{\protect\contentsline {part}
    {\protect\tablenameToC}{\protect\relax}}
\addtocontents{toc}{\protect\contentsline {part}
    {\protect\chapternameToC}{\protect\relax}}

% NUMBERING STYLES, DEFAULT VALUES

% Using macros of the form \th@Def* avoids conflicts with
% LaTeX internals which use \theDef* forms...

\newcounter{th@SecNum}
\setcounter{th@SecNum}{4}
\if@NumberStdHeadings
    \@centerSectionfalse% Force this.
    \newcommand*{\th@DefTheChapter}{\arabic{chapter}}
    \newcommand*{\th@DefTheSection}{\th@DefTheChapter.\arabic{section}}
    \newcommand*{\th@DefTheSubsection}{\th@DefTheSection.\arabic{subsection}}
\else
    \@AllHeadingsfalse% Just to be safe...
    \newcommand*{\th@DefTheChapter}{\Roman{chapter}}
    \newcommand*{\th@DefTheSection}{\relax}
    \newcommand*{\th@DefTheSubsection}{\relax}
\fi

\if@AllHeadings
    \@inlineSubSubSectionfalse% Force this...
    \@numberSubSubSectiontrue% ...and this.
    \newcommand*{\th@DefTheSubsubsection}{\th@DefTheSubsection.\arabic{subsubsection}}
    \newcommand*{\th@DefTheParagraph}{\th@DefTheSubsubsection.\arabic{paragraph}}
    \newcommand*{\th@DefTheSubparagraph}{\th@DefTheParagraph.\arabic{subparagraph}}
\else
    \newcommand*{\th@DefTheParagraph}{\relax}
    \newcommand*{\th@DefTheSubparagraph}{\relax}
    \if@numberSubSubSection
        \newcommand*{\th@DefTheSubsubsection}
            {\th@DefTheSubsection.\arabic{subsubsection}}
    \else
        \newcommand*{\th@DefTheSubsubsection}{\relax}
    \fi
\fi
\renewcommand*{\thechapter}{\th@DefTheChapter}
\renewcommand*{\thesection}{\th@DefTheSection}
\renewcommand*{\thesubsection}{\th@DefTheSubsection}
\renewcommand*{\thesubsubsection}{\th@DefTheSubsubsection}
\renewcommand*{\theparagraph}{\th@DefTheParagraph}
\renewcommand*{\thesubparagraph}{\th@DefTheSubparagraph}

% Figure, Table, and Equation numbering.
\if@PerChptrNumbering\else
    \newcounter{th@SaveFigure}
    \newcounter{th@SaveTable}
    \newcounter{th@SaveEquation}
    \renewcommand*{\thefigure}{\arabic{figure}}
    \renewcommand*{\thetable}{\arabic{table}}
    \renewcommand*{\theequation}{\arabic{equation}}
\fi

% Enumerated List labels
\renewcommand*{\theenumi}{\arabic{enumi}}
\renewcommand*{\theenumii}{\alph{enumii}}
\renewcommand*{\theenumiii}{\roman{enumiii}}
\renewcommand*{\theenumiv}{\alph{enumiv}}
\renewcommand*{\labelenumi}{(\theenumi)}
\renewcommand*{\labelenumii}{(\theenumii)}
\renewcommand*{\labelenumiii}{(\theenumiii)}
\renewcommand*{\labelenumiv}{(\theenumiii.\theenumiv)}

% Itemized list labels.
\renewcommand*{\labelitemi}{\textbullet}
\renewcommand*{\labelitemii}{\textasteriskcentered}
\renewcommand*{\labelitemiii}{\normalfont \bfseries \textendash}
\renewcommand*{\labelitemiv}{\textperiodcentered}

% Margins for lists
\setlength{\leftmargini}{3.5em}
\setlength{\leftmarginiii}{2.2em}
\setlength{\leftmarginiv}{2.2em}
\setlength{\leftmarginv}{2.2em}
\setlength{\leftmarginvi}{2.2em}
\setlength{\leftmargin}{\leftmargini}
\setlength{\labelwidth}{1.5em}

% Redefine certain commands and environments from report.cls.
% This is where things get messy.  We rename each command we modify,
% then redefine the command using the old version as subset.

% VERSE, QUOTATION, and QUOTE must be single-spaced.
% These rename the internal commands for the \begin{...} and
% \end{...} environment commands.
\let\th@OldVerse\verse
\let\th@OldQuotation\quotation
\let\th@OldQuote\quote
\let\endth@OldVerse\endverse
\let\endth@OldQuotation\endquotation
\let\endth@OldQuote\endquote
%
%%%%%%%%THIS IS A "NEWENVIRONMENT" FOR THE PUBLICATINS PAGE%%%%%%%%%%%%
%Definition starts here.............
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{publications}[1]
     {\chapter*{\publicationsbibname}%
      \@mkboth{\MakeUppercase\publicationsbibname}{\MakeUppercase\publicationsbibname}%
      \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}}%
      \sloppy   
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty 'Publications' environment}}%
      \endlist}
%Definition ends here.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%THIS IS A "NEWENVIRONMENT" FOR THE CURRICULUM VITAE%%%%%%%%%%%%
%Definition starts here.............
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{curriculumvitae}[1]
     {\chapter*{\curriculumvitaebibname}%
      \@mkboth{\MakeUppercase\curriculumvitaebibname}{\MakeUppercase\curriculumvitaebibname}%
      \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}}%
      \sloppy   
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
      %{\def\@noitemerr{\@latex@warning{Check the Curriculum Vitae environment}}%
      %\endlist}
%Definition ends here.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Note - the ``\begin{singlespace}'' and ``\end{singlespace}''
% are defined in setspace.sty.

\renewenvironment*{verse}{\begin{th@OldVerse}\begin{singlespace}}
    {\end{singlespace}\end{th@OldVerse}}

\renewenvironment*{quotation}{\begin{th@OldQuotation} \begin{singlespace}}
    {\end{singlespace}\end{th@OldQuotation}}

\renewenvironment*{quote}{\begin{th@OldQuote} \begin{singlespace}}
    {\end{singlespace} \end{th@OldQuote}}

% Theorems and Axioms:  They must NOT be italicized.  To do this
% robustly, I've needed to use some in-depth TeXnology.  Check out a
% good LaTeX book for info on the \@namedef and \@nameuse commands.

\let\th@OldNewtheorem\newtheorem
% Check for the calling format: \newtheorem{}[]{}
\def\newtheorem#1{ \@ifnextchar[{\th@nuthrmOM{#1}}{\th@newtheoremTwo{#1}}%]
}
% Calling format: \newtheorem{}{}[]; checks for the optional arg at the end.
\def\th@newtheoremTwo#1#2{
    \@ifnextchar[{\th@nuthrmO{#1}{#2}}{\th@nuthrm{#1}{#2}}%]
}
% Standard call.  No optional args.
\def\th@nuthrm#1#2{
    \th@OldNewtheorem{th@#1}{#2}
    \th@correctTheorem{end#1}{#1}{endth@#1}{th@#1}
}
% Optional arg at end.
\def\th@nuthrmO#1#2[#3]{
    \th@OldNewtheorem{th@#1}{#2}[#3]
    \th@correctTheorem{end#1}{#1}{endth@#1}{th@#1}
    }
% Optional arg in the middle.
\def\th@nuthrmOM#1[#2]#3{
    \th@OldNewtheorem{th@#1}[th@#2]{#3}
    \th@correctTheorem{end#1}{#1}{endth@#1}{th@#1}
    }
\def\th@execThrmOpt#1[#2]{
    \@nameuse{#1}[#2] \normalsize\normalfont
}
\newcommand*{\th@correctTheorem}[4]{
    \@namedef{#1}{\@nameuse{#3}}
    \@namedef{#2}{\@ifnextchar[{\th@execThrmOpt{#4}}{ %%}
            \@nameuse{#4} \normalsize\normalfont}
    }
}

% APPENDIX command
\newcounter{th@SectionSave}
\let\th@OldAppCmd\appendix
\renewcommand{\appendix}{
    \setcounter{th@SectionSave}{\value{section}}
    \th@OldAppCmd
    \if@NumberStdHeadings\else
    \setcounter{section}{\value{th@SectionSave}}
    \fi
    \addtocontents{toc}{\protect\contentsline {part}
        {\protect\appendixnameToC}{\protect\relax}}
    \renewcommand*{\th@DefTheChapter}{\Alph{chapter}}
    }

% BIBLIOGRAPHY: Used to be redefined here.  Moved to permit use
% of different bibliography .sty and .bst files.  It's now in
% the '\AtBeginDocument' command.

% SECTION HEADINGS.
% including several new options

% New if-s
\newif\if@AlwaysFalse
\@AlwaysFalsefalse
\newif\if@CenterHeading
\@CenterHeadingfalse
\newif\if@UseStarCmd
\@UseStarCmdfalse
% GENERAL AND SETUP COMMANDS.

% Makes a heading.
% The optional argument (#1) is a centering flag. The heading gets
% centered if it's present and set to true.
% The second arg is the style command.
% The third arg is the heading proper.
\newcommand*{\th@MakeHeading}[2]{
    \protect #1
    \if@CenterHeading\begin{center}\typeout{centered}\fi
    #2
    \if@CenterHeading\end{center}\fi
    }

% Makes a heading.
% The entire thing is something of a mess.  We want all ToC entries to
% be in normal text.  We also want references in normal text.  But, we
% want the heading numbers to appear in the correct size and font.  To
% get this to happen is a chore.

% The args are, in order:
%    The command to execute (#1),
%    The heading style command (#2),
%    The optional arg passed to the heading command proper (#3).
%    E.g. if you execute a \section[foo]{bigfoo}, #3=="foo".
%    The heading text itself (#4).
%    The name of the current command (#5). E.g. "chapter".
%    The internal command that generates the number label (#6).

% There are also two important flags used by this command.  The first
% is \@UseStarCmd.  Set this to "true" if this is the starred version
% of the command.  The second flag is \@thInHeading.  This gets set
% 'true' inside the section heading commands and turned off at the end
% of the command.

\newcommand*{\th@Heading}[6]{
    \@thInHeadingtrue
    % Alter the '\the...' command.
    \@namedef{the#5}{\protect#2 #6}
    \if@UseStarCmd
        #1*{\th@MakeHeading{\protect#2}{#4}}
    \else
        \ifthenelse{\equal{\th@DefArg}{#3}}{
            #1[\normalsize\normalfont#4]{
                \th@MakeHeading{\protect#2}{#4}}
        }{
            #1[\normalsize\normalfont#3]{
                \th@MakeHeading{\protect#2}{#4}}
        }
    \fi
% Reset the '\the...' command, but don't enforce
% '\normalsize\normalfont' anywhere, as this messes up
% cross-references in footnotes.
    \@namedef{the#5}{#6}
    \@thInHeadingfalse
    \@CenterHeadingfalse
    \normalsize\normalfont
}

% CHAPTER HEADING

% The chapter command definitely needs some re-defining.  The primary
% purpose is to control numbering in figures, tables, and equations.

\let\th@OldChapter\chapter
% The \@ifstar{}{} is a LaTeX tool to check the character following
% the command and see if it's a '*'.
\renewcommand*{\chapter}{\@ifstar{\th@ChapterS}{\th@Chapter}}

% Special if-s; used internally for chapters.
\newif\if@THshortChapter
\@THshortChapterfalse

% We define a special command for stepping the chapter counter,
% zeroing the figure, table, and equation counters only if necessary.

\newcommand*{\th@PreChCmd}{
    \if@PerChptrNumbering
        \relax
    \else
        \setcounter{th@SaveTable}{\value{table}}
        \setcounter{th@SaveFigure}{\value{figure}}
        \setcounter{th@SaveEquation}{\value{equation}}
    \fi
}

\newcommand*{\th@PostChCmd}{
    \if@THshortChapter
        \typeout{Short Chapter (page numbered)}
        \@THshortChapterfalse
        \thispagestyle{myheadings}
    \else
        %\thispagestyle{empty}
        \thispagestyle{myheadings}
    \fi
    \if@PerChptrNumbering
        \relax
    \else
        \setcounter{table}{\value{th@SaveTable}}
        \setcounter{figure}{\value{th@SaveFigure}}
        \setcounter{equation}{\value{th@SaveEquation}}
    \fi
    \normalsize\normalfont
    \@UseStarCmdfalse
}
\if@chapterCaps
    \newcommand*{\th@Chapter}[2][\th@DefArg]{
        \th@PreChCmd
        \@UseStarCmdfalse
        \if@centerChapter\@CenterHeadingtrue\else\@CenterHeadingfalse\fi
        \th@Heading{\th@OldChapter}{\th@ChapterStyle}{#1}
            {\uppercase\expandafter{#2}}{chapter}{\th@DefTheChapter}
        \th@PostChCmd
    }
    \newcommand*{\th@ChapterS}[1]{
        \th@PreChCmd
        \@UseStarCmdtrue
        \if@centerChapter\@CenterHeadingtrue\else\@CenterHeadingfalse\fi
        \th@Heading{\th@OldChapter}{\th@ChapterStyle}{\th@DefArg}
            {\uppercase\expandafter{#1}}{chapter}{\th@DefTheChapter}
        \th@PostChCmd
    }
\else
    \newcommand*{\th@Chapter}[2][\th@DefArg]{
        \th@PreChCmd
        \@UseStarCmdfalse
        \if@centerChapter\@CenterHeadingtrue\else\@CenterHeadingfalse\fi
        \th@Heading{\th@OldChapter}{\th@ChapterStyle}{#1}
            {#2}{chapter}{\th@DefTheChapter}
        \th@PostChCmd
    }
    \newcommand*{\th@ChapterS}[1]{
        \th@PreChCmd
        \@UseStarCmdtrue
        \if@centerChapter\@CenterHeadingtrue\else\@CenterHeadingfalse\fi
        \th@Heading{\th@OldChapter}{\th@ChapterStyle}{\th@DefArg}
            {#1}{chapter}{\th@DefTheChapter}
        \th@PostChCmd
    }
\fi

% SECTION HEADING COMMANDS.  We need to use the starred version and
% add the numbering and toc-entry ourselves.  We need to do this for
% all of the subsequent heading commands.  If we don't we'll get
% weird-looking ToC entries and references.

\let\th@OldSection\section
\renewcommand*{\section}{\@ifstar{\th@SectionS}{\th@Section}}

\newcommand*{\th@Section}[2][\th@DefArg]{
    \@UseStarCmdfalse
    \if@centerSection\@CenterHeadingtrue\else\@CenterHeadingfalse\fi
    \th@Heading{\th@OldSection}{\th@SectionStyle}{#1}{#2}
        {section}{\th@DefTheSection}
    \normalsize\normalfont
}
\newcommand*{\th@SectionS}[1]{
    \@UseStarCmdtrue
    \if@centerSection\@CenterHeadingtrue\else\@CenterHeadingfalse\fi
    \th@Heading{\th@OldSection}{\th@SectionStyle}{\th@DefArg}
        {#1}{section}{\th@DefTheSection}
    \@UseStarCmdfalse
    \normalsize\normalfont
}

% SUBSECTION HEADING COMMANDS.

\let\th@OldSubSection\subsection
\renewcommand*{\subsection}{
    \@ifstar{\th@SubSectionS}{\th@SubSection}
}
\newcommand*{\th@SubSection}[2][\th@DefArg]{
    \@UseStarCmdfalse
    \@CenterHeadingfalse
    \th@Heading{\th@OldSubSection}{\th@SubSectionStyle}
        {#1}{#2}{subsection}{\th@DefTheSubsection}
    \normalsize\normalfont
}
\newcommand*{\th@SubSectionS}[1]{
    \@UseStarCmdtrue
    \@CenterHeadingfalse
    \th@Heading{\th@OldSubSection}{\th@SubSectionStyle}
        {\th@DefArg}{#1}{subsection}{\th@DefTheSubsection}
    \@UseStarCmdfalse
    \normalsize\normalfont
}

% SUBSUBSECTION HEADING COMMANDS.  No starred version permitted.
% No ToC entry.  We also need to check and see if we should number
% it or not and if we should inline it or not.

\let\th@OldSubSubSection\subsubsection
\newlength{\th@SubSubSecSpc}
\if@numberSubSubSection
    \renewcommand*{\thesubsubsection}{\th@DefTheSubsubsection}
    \newcommand*{\th@PreSubsubsecCmd}{\@UseStarCmdfalse}
    \setcounter{th@SecNum}{5}
    \setlength{\th@SubSubSecSpc}{0.5em}
\else
    \renewcommand*{\thesubsubsection}{\relax}
    \newcommand*{\th@PreSubsubsecCmd}{\@UseStarCmdtrue}
    \setlength{\th@SubSubSecSpc}{0em}
\fi

\newif\if@shutoffSSSect
\@shutoffSSSectfalse

\if@inlineSubSubSection
\renewcommand*{\subsubsection}[2][\th@DefArg]{
    \refstepcounter{subsubsection}
    \vspace{4\parsep}
    \underline{%
    \@thInHeadingtrue\th@OtherSecHeadStyles%
    \thesubsubsection\hspace{\th@SubSubSecSpc}#2}\hspace{2mm}
    \ignorespaces\normalsize\normalfont
    }
\else
\renewcommand*{\subsubsection}[2][\th@DefArg]{
    \th@PreSubsubsecCmd
    \@CenterHeadingfalse
    \th@Heading{\th@OldSubSubSection}{\th@OtherSecHeadStyles}
        {\th@DefArg}{#2}{subsubsection}{\th@DefTheSubsubsection}
    \@UseStarCmdfalse\normalsize\normalfont
    }
\fi

% We don't need to do much for paragraph and subparagraph.  We won't
% even define a *-version or permit entries in the ToC.
\if@AllHeadings
    \let\th@OldParagraph\paragraph
    \renewcommand*{\paragraph}[2][\th@DefArg]{
        \@UseStarCmdfalse
        \@CenterHeadingfalse
        \th@Heading{\th@OldParagraph}
            {\@thInHeadingtrue\th@OtherSecHeadStyles}
            {\th@DefArg}{\underline{#2}}{paragraph}
            {\hspace*{\parindent}\th@DefTheParagraph}
        \@UseStarCmdfalse
        \@namedef{theparagraph}{\th@DefTheParagraph
            \protect\normalsize\protect\normalfont}
        \normalsize\normalfont
    }
    \let\th@OldSubParagraph\subparagraph
    \renewcommand*{\subparagraph}[2][\th@DefArg]{
        \@UseStarCmdfalse
        \@CenterHeadingfalse
        \th@Heading{\th@OldSubParagraph}
            {\@thInHeadingtrue\th@OtherSecHeadStyles}
            {\th@DefArg}{\underline{#2}}{subparagraph}
            {\th@DefTheSubparagraph}
        \@UseStarCmdfalse
        \@namedef{thesubparagraph}{\th@DefTheSubparagraph
            \protect\normalsize\protect\normalfont}
        \normalsize\normalfont
    }
    \setcounter{th@SecNum}{6}
\else
    \renewcommand*{\paragraph}[2][\th@DefArg]{
        {\normalfont\normalsize\bfseries #2}\hspace*{0.89em}}
    \renewcommand*{\subparagraph}[2][\th@DefArg]{
        {\normalfont\normalsize\bfseries #2}\hspace*{0.89em}}
\fi


% NEW COMMANDS DEFINED FOR THIS CLASS

% Unavailable commands
\renewcommand*{\theindex}{\ClassWarning{thesis}
    {Indexing not available in this class.}}
\renewcommand*{\twocolumn}{\ClassWarning{thesis}
    {Twocolumn not available in this class.}}
\renewcommand*{\thepart}{\ClassWarning{thesis}
    {``thepart'' not available in this class.}}
\renewcommand*{\part}{\ClassWarning{thesis}
    {``thepart'' not available in this class.}}


% NEW COMMANDS.
% This forces a page number on the first page of a chapter, etc.
%% AJB, not used anymore
%%\newcommand*{\forcepageno}{\thispagestyle{myheadings}}
%%\newcommand*{\OnePageChapter}{\forcepageno}


% THESIS PROLOGUE PAGES.
% Stores the second arg in the command specified by the first arg.
\newcommand{\th@StoreIn}[2]{ \gdef#1{#2} }

% Default values of storage variables.  Emits an error message.
% This part of the class is long...
%\newcommand*{\th@degree}{
%    \ClassError{thesis}{*** You must specify the type of degree you are receiving. ***}
%    {Use the \protect\MSc or \protect\PhD command in preamble.}
%}
\newcommand*{\th@title}{
    \ClassError{thesis}{*** You must specify the title of your thesis! ***}
    {Use the \protect\title{} command in the preamble.}
}
\newcommand*{\th@reportnumber}{
    \ClassError{thesis}{*** You must specify the number of your report (1, 2, 3, ...)! ***}
    {Use the \protect\reportnumber{} command in the preamble.}
}
%\newcommand*{\th@turktitle}{
%    \ClassError{thesis}{*** You must specify the title of your thesis (in Turkish)! ***}
%    {Use the \protect\turktitle{} command in the preamble.}
%}
\newcommand*{\th@fwdname}{
        \ClassError{thesis}{*** You must specify the name of the author! ***}
        {Use the \protect\author{}{} command in the \MessageBreak
                preamble. The first arg is your first name and \MessageBreak
                middle initial.  The second arg is your last name.}
}
\newcommand*{\th@revname}{
        \ClassError{thesis}{*** You must specify your name! ***}
        {Use the \protect\author{}{} command in the \MessageBreak
                preamble. The first arg is your first name and \MessageBreak
                middle initial.  The second arg is your last name.}
}
\newcommand*{\th@branchname}{
    \ClassError{thesis}{*** You must specify the name of the branch of your thesis! ***}
    {Use the \protect\branch{}command in the preamble.}
}
%\newcommand*{\th@turkbranchname}{
%    \ClassError{thesis}{*** You must specify the name of the branch of your thesis (in Turkish) ***}
%    {Use the \protect\turkbranch{}command in the preamble.}
%}
\newcommand*{\th@supervisor}{
    \ClassError{thesis}{*** You must specify your research supervisor's title and name! ***}
    {Use the \protect\supervisor{} command in the preamble.}
}
%\newcommand*{\th@turksupervisor}{
%    \ClassError{thesis}{*** You must specify your research supervisor's title(turkish) and name! ***}
%    {Use the \protect\turksupervisor{} command in the preamble.}
%}
%\newcommand*{\th@gradschooldirector}{
%    \ClassError{thesis}{*** You must specify the title and name of the director of the graduate school! ***}
%    {Use the \protect\gradschooldirector{} command in the preamble.}
%}
%\newcommand*{\th@departmentchairperson}{
%    \ClassError{thesis}{*** You must specify the title and name of your department's chairperson! ***}
%    {Use the \protect\departmentchairperson{} command in the preamble.}
%}
%\newcommand*{\th@readerone}{
%    \ClassError{thesis}{
%        *** You must specify the names of the \MessageBreak
%        committee members who will be signing your \MessageBreak
%        thesis. At least three. ***}
%    {Use the \protect\readerone{} command in the preamble.}
%}
%\newcommand*{\th@readertwo}{
%    \ClassError{thesis}{
%        *** You must specify the names of the \MessageBreak
%        committee members who will be signing your \MessageBreak
%        thesis. At least three. ***}
%    {Use the \protect\readertwo{} command in the preamble.}
%}
%\newcommand*{\th@readerthree}{
%    \ClassError{thesis}{
%        *** You must specify the names of the \MessageBreak
%        committee members who will be signing your \MessageBreak
%        thesis. At least three. ***}
%    {Use the \protect\readerthree{} command in the preamble.}
%}
%\newcommand*{\th@readerfour}{none}
%\newcommand*{\th@readerfive}{none}
\newcommand{\th@monthandyear}{
    \ClassError{thesis}{*** You must specify the day, month and year of the report! ***}
    {Use the \protect\monthandyear{} command in the preamble.}
}
%\newcommand{\th@turkmonthandyear}{
%    \ClassError{thesis}{*** You must specify the month and year of the granted degree (in turkish)! ***}
%    {Use the \protect\turkmonthandyear{} command in the preamble.}
%}
%\newcommand{\th@keywords}{
%    \ClassError{thesis}{*** You must specify the keywords in your report! ***}
%    {Use the \protect\keywords{} command in the preamble.}
%}
%\newcommand{\th@turkkeywords}{
%    \ClassError{thesis}{*** You must specify the anahtar kelimeler in your thesis! ***}
%    {Use the \protect\turkkeywords{} command in the preamble.}
%}
%\newcommand{\th@numberofpages}{
%    \ClassError{thesis}{*** You must specify the number of pages in your thesis! ***}
%    {Use the \protect\numberofpages{} command in the \MessageBreak
%        preamble.  Break each line using the \protect\\ \MessageBreak
%        command.}
%}
\newcommand{\th@abstractStash}{
    \ClassError{thesis}{*** You must specify an abstract! ***}
    {Use the \protect\abstractpage[]{} command in the \MessageBreak
        preamble.  If your abstract runs over a page, \MessageBreak
        use the optional argument with the word 'long'.}
}
%\newcommand{\th@ozetStash}{
%    \ClassError{thesis}{*** You must specify an ozet (Turkish abstract)! ***}
%    {Use the \protect\ozetpage[]{} command in the \MessageBreak
%        preamble.  If your ozet runs over a page, \MessageBreak
%        use the optional argument with the word 'long'.}
%}
\newcommand*{\th@signature}[1]{
                \begin{flushright}
        \normalsize
        \vspace*{8mm}   % works well?
        \vrule width 80mm height 0.2mm\\
        #1 \end{flushright}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Exam Committee signature pages changed.
%A table with 3 clm is inserted.
%Name of members are on left side and their signatures are on right side of paper!
%03.06.03 by O. Özer
%See the line "Examining Committee Members"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\th@committeesignatures}[1]{\vspace{10mm}&#1&~&\line(1,0){95}\\}
\newcommand*{\th@dateline}{
    \vspace*{10mm}
    \begin{flushright}
        Date~{\vrule width 35mm height 0.1mm}
    \end{flushright}
}
\newcommand{\th@AbstractPageStyle}{\relax}
\newcommand{\th@OzetPageStyle}{\relax}
\newcommand{\th@dedicationStash}{\relax}
\newcommand{\th@dedicationTitleStash}{\relax}
\newcommand{\th@acknowledgementsStash}{\relax}
\newcommand{\th@nomenclatureStash}{\relax}
\newif\if@shortLoF
\newif\if@shortLoT
\newif\if@shortToC
\newif\if@makenoLoF
\newif\if@makenoLoT
\newif\if@makeDedication
\newif\if@makeAcknowledgements
\newif\if@makeNomenclature
\newif\if@makePrologue
\@shortLoFfalse
\@shortLoTfalse
\@shortToCfalse
\@makenoLoFfalse
\@makenoLoTfalse
\@makeDedicationfalse
\@makeAcknowledgementsfalse
\@makeNomenclaturefalse
\@makeProloguetrue

% The base commands that make all of the prologue pages.

\newcommand*{\th@Titlepage}{
    \thispagestyle{empty}
    \@thInHeadingfalse
    \null\vfill
    \begin{list}{}{\setlength{\leftmargin}{1.0cm}
        \setlength{\rightmargin}{1.0cm}\sloppy}
        \centering\item[]
        {\th@ChapterStyle
            \if@chapterCaps
                \uppercase\expandafter{\th@title}\\
            \else
                \Large \th@title\\
            \fi}
            {\Large
            \vfill
                \th@fulldegree\ thesis work, \th@reportnumber\ report.\\
            \th@fwdname\\
            \ \th@monthandyear \\
            \vfill
            \item Supervisor: \\ \th@supervisor
            \vfill
                Department of \th@branchname\\
                University of Gaziantep\\
            }
    \@thInHeadingfalse
    \end{list}

}
\newcommand*{\th@Copyrightpage}{
    \singlespacing
    \clearpage
    %\thispagestyle{empty}
        \noindent
        \vspace*{3cm}
        %
        % Here the Graduate Schoool of Natural and Applied Sciences
        % supplies a standard copyright form if requested by the
        % \copyright command
        %
        {\LARGE Copyright Page {\large to be inserted..}}\\ \\
        {\large You can replace this page with your copyright page.\\ \\
        A standard copyright form might be provided by the Graduate Schoool
        of Natural and Applied Sciences - it is not implemented in this
        latex {\tt thesis.cls}.\\ \\
        Remember that you {\it dont} usually need a copyright page
        (in {\tt thesis.tex} simply {\it comment out} the command
        {\tt $\backslash$copyrightpageplease}.) 
        }
}
\newcommand*{\th@Approvalpage}{
    \singlespacing
    \clearpage
    %\thispagestyle{empty}
        \noindent
        %
        % Graduate School of Natural and Applied Sciences
        %
        %>
        Approval of the Graduate School of Natural and Applied Sciences.\\ \\
    %%This thesis entitled:
        %%\begin{quote}
    %%\th@title\
        %%\end{quote}
    %%written by\ \th@fwdname\/,\
    %%has been approved by the Graduate School of Natural and Applied Sciences.
        %<
    \th@signature{\th@gradschooldirector\\ Director}
        I certify that this thesis satisfies all the requirements as a thesis for
        the degree of \th@longdegree.
    \th@signature{\th@departmentchairperson\\ Head of Department}
    \vspace*{15mm}
        This is to certify that we have read this thesis and that in our 
        opinion it is fully adequate, in scope and quality, as a thesis for 
        the degree of \th@longdegree.
    %
        % Major Supervisor
        %
    \th@signature{\th@supervisor\\ Major Supervisor}
        %
        % Exam Committee
        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Exam Committee signature pages changed.
%A table with 3 clm is inserted.
%Name of members are on left side and their signatures are on right side of paper!
%03.06.03 by O. Özer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \vspace*{3mm}
        Examining Committee Members:
\begin{table}[h]
\begin{tabular}{lllr}
    \th@committeesignatures{\th@readerone}      % REQUIRED.
    \th@committeesignatures{\th@readertwo}      % REQUIRED.
    \th@committeesignatures{\th@readerthree}    % REQUIRED.
    \ifthenelse{\equal{\th@readerfour}{none}}{\relax}
               {\th@committeesignatures{\th@readerfour}} % optional
    \ifthenelse{\equal{\th@readerfive}{none}}{\relax}
               {\th@committeesignatures{\th@readerfive}} % optional
    \vspace*{8mm}
\end{tabular}
\end{table}
}
\newcommand{\th@Abstractpage}{
    \clearpage
    \chapter*{\center Abstract}
    \th@AbstractPageStyle
    \begin{list}{}{\setlength{\leftmargin}{2em}
            \setlength{\itemindent}{-2em}
            \setlength{\topsep}{0pt}
            \setlength{\itemsep}{0pt}}
        \centering\item[]
        {\th@ChapterStyle
                        \if@chapterCaps
                                \uppercase\expandafter{\th@title}\\
                        \else
                                \Large \th@title\\
                        \fi}
    \vspace*{8\parsep}
        \item \th@revname\\
                \th@fulldegree\ thesis work, \th@reportnumber\ report.
        \item Supervisor: \th@supervisor
        \item \th@monthandyear\/%, \th@numberofpages\ pages\ 
    \end{list}
    \par
    \vspace*{4\parsep}
    \th@abstractStash   % the actual abstract
        \vfill
        \noindent
    %{\bf Key words:} \th@keywords\\
}
\newcommand{\th@Ozetpage}{
    \clearpage
    \chapter*{\center {\"O}z}
    \th@OzetPageStyle
    \begin{list}{}{\setlength{\leftmargin}{2em}
            \setlength{\itemindent}{-2em}
            \setlength{\topsep}{0pt}
            \setlength{\itemsep}{0pt}}
        \centering\item[]
        {\th@ChapterStyle
                        \if@chapterCaps
                                \uppercase\expandafter{\th@turktitle}\\
                        \else
                              \Large \th@turktitle\\
                        \fi}
    \vspace*{8\parsep}
        \item \th@revname\\
                \item \th@turkdegree\/, \th@turkbranchname\\
        \item Tez Y\"{o}neticisi: \th@turksupervisor
        \item \th@turkmonthandyear\/, \th@numberofpages\ sayfa\
    \end{list}
    \par
    \vspace*{4\parsep}
    \th@ozetStash   % the actual abstract
        \vfill
        \noindent
    {\bf Anahtar kelimeler:} \th@turkkeywords\\
}
\newcommand{\th@Dedicationpage}{
    \if@makeDedication
        \clearpage
        %\thispagestyle{empty}
        \thispagestyle{myheadings}
        \ifthenelse{\equal{\th@DefArg}{\th@dedicationTitleStash}
            }{\vfill}{\chapter*{\th@dedicationTitleStash}}
        \th@dedicationStash
        \ifthenelse{\equal{\th@DefArg}{\th@dedicationTitleStash}
            }{\vfill}{\relax}
    \fi
}
\newcommand{\th@Acknowledgementpage}{
    \if@makeAcknowledgements
        \clearpage
        \chapter*{\center Acknowledgements}
        {\setlinespacing
        \th@acknowledgementsStash}
    \fi
}
\newcommand{\th@Nomenclaturepage}{
    \if@makeNomenclature
        \clearpage
        \chapter*{List of Symbols}
        {\setlinespacing
        \th@nomenclatureStash}
    \fi
}

\newcommand{\th@ToCpage}{
    \@THshortChapterfalse
    \if@shortToC
        \@THshortChaptertrue
        \typeout{Making Short ToC...}
    \fi
    \@thInHeadingfalse
    {\singlespacing
    \tableofcontents}
}

\newcommand{\th@LoTpage}{
    \@THshortChapterfalse
    \if@makenoLoT
        \typeout{Skipping LoT...}
    \else
    \if@shortLoT
        \@THshortChaptertrue
        \typeout{Making Short LoT...}
    \fi
    {\singlespacing
    \listoftables}
    \fi
}

\newcommand{\th@LoFpage}{
    \@THshortChapterfalse
    \if@makenoLoF
        \typeout{Skipping LoF...}
    \else
    \if@shortLoF
        \@THshortChaptertrue
        \typeout{Making Short LoF...}
    \fi
    {\singlespacing
    \listoffigures}
    \fi
}



% This performs the actual generation of the prologue

\newcounter{th@storepage}
\newcommand{\th@MakeThesisPrologue}{
    \if@makePrologue
        \pagenumbering{roman}
        \typeout{Making Title Page}
        \th@Titlepage
                \if@itscopyrighted
            \typeout{Making Copyright Page}
            \th@Copyrightpage
                \fi
        %\typeout{Making Approval Page}
        %\th@Approvalpage
        \typeout{Making Abstract Page}
        \th@Abstractpage
        %\typeout{Making Ozet Page}
        %\th@Ozetpage
        %\typeout{Making Dedication Page}
        %\th@Dedicationpage
        %\typeout{Making Acknowledgement Page}
        %\th@Acknowledgementpage
        \setcounter{th@storepage}{\value{page}}
        \typeout{Making ToC Page}
        \th@ToCpage
        \typeout{Making LoT Page}
        \th@LoTpage
        \typeout{Making LoF Page}
        \th@LoFpage
        \typeout{Making Nomenclature Page}
        {\th@Nomenclaturepage}
    \fi
}


% Make the generator-command the very first command of the document.
\let\th@OldBeginDocument\document
\renewcommand*{\document}{
    \th@OldBeginDocument
    \th@MakeThesisPrologue
    \typeout{}
    \typeout{-------------------Beginning Body----------------------}
    \typeout{}
    \setlinespacing
    \clearpage
    \pagenumbering{arabic}
    \@THshortChapterfalse
}

% USER COMMANDS FOR CONTROLLING THE PROLOGUE.

\renewcommand*{\title}[1]{\th@StoreIn{\th@title}{#1}}
\newcommand*{\reportnumber}[1]{\th@StoreIn{\th@reportnumber}{#1}}
\newcommand*{\turktitle}[1]{\th@StoreIn{\th@turktitle}{#1}}
\newcommand*{\readerone}[1]{\th@StoreIn{\th@readerone}{#1}}
\newcommand*{\readertwo}[1]{\th@StoreIn{\th@readertwo}{#1}}
\newcommand*{\readerthree}[1]{\th@StoreIn{\th@readerthree}{#1}}
\newcommand*{\readerfour}[1]{\th@StoreIn{\th@readerfour}{#1}}
\newcommand*{\readerfive}[1]{\th@StoreIn{\th@readerfive}{#1}}
\newcommand{\monthandyear}[1]{\th@StoreIn{\th@monthandyear}{#1}}
\newcommand{\turkmonthandyear}[1]{\th@StoreIn{\th@turkmonthandyear}{#1}}
\newcommand{\numberofpages}[1]{\th@StoreIn{\th@numberofpages}{#1}}
\newcommand{\keywords}[1]{\th@StoreIn{\th@keywords}{#1}}
\newcommand{\turkkeywords}[1]{\th@StoreIn{\th@turkkeywords}{#1}}
\newcommand{\acknowledgements}[1]{
    \@makeAcknowledgementstrue
    \th@StoreIn{\th@acknowledgementsStash}{#1}
}
\newcommand{\nomenclature}[1]{
    \@makeNomenclaturetrue
    \th@StoreIn{\th@nomenclatureStash}{#1}
}
\newcommand{\dedication}[2][\th@DefArg]{
    \@makeDedicationtrue
    \th@StoreIn{\th@dedicationTitleStash}{#1}
    \th@StoreIn{\th@dedicationStash}{#2}
}
\renewcommand*{\author}[2]{
    \th@StoreIn{\th@fwdname}{#1 #2}
    \th@StoreIn{\th@revname}{#2, #1}
}
\newcommand*{\supervisor}[1]{
    \th@StoreIn{\th@supervisor}{#1}
}
\newcommand*{\turksupervisor}[1]{
    \th@StoreIn{\th@turksupervisor}{#1}
}
\newcommand*{\gradschooldirector}[1]{
    \th@StoreIn{\th@gradschooldirector}{#1}
}
\newcommand*{\departmentchairperson}[1]{
    \th@StoreIn{\th@departmentchairperson}{#1}
}
\newcommand*{\branch}[1]{
    \th@StoreIn{\th@branchname}{#1}
}
\newcommand*{\turkbranch}[1]{
    \th@StoreIn{\th@turkbranchname}{#1}
}
\renewcommand{\abstract}[2][long]{
    \ifthenelse{\equal{#1}{short}}{\relax}{
        \th@StoreIn{\th@AbstractPageStyle}{\thispagestyle{myheadings}}
    }
    \th@StoreIn{\th@abstractStash}{#2}
}
\newcommand{\ozet}[2][long]{
    \ifthenelse{\equal{#1}{short}}{\relax}{
        \th@StoreIn{\th@OzetPageStyle}{\thispagestyle{myheadings}}
    }
    \th@StoreIn{\th@ozetStash}{#2}
}
\newcommand*{\SuspendPrologue}{
    \@makeProloguefalse
    \typeout{No prologue pages printed.}
}
\newcommand*{\emptyLoF}{
    \@makenoLoFtrue
    \typeout{No LoF printed}
}
\newcommand*{\emptyLoT}{
    \@makenoLoTtrue
    \typeout{No LoT printed}
}
\newcommand*{\ToCisShort}{
    \@shortToCtrue
    \typeout{Putting page number on short ToC}
}
\newcommand*{\LoFisShort}{
    \@shortLoFtrue
    \typeout{Putting page number on short LoF}
}
\newcommand*{\LoTisShort}{
    \@shortLoTtrue
    \typeout{Putting page number on short LoT}
}


\endinput
%% End of file ``thesis.cls''
