\def\querline{\noindent\underline{\makebox[\textwidth]{}}}
\def\chaptername{Chapter}
\def\thechapter{\arabic{chapter}}
\def\@chapapp{\chaptername}

\def\myfooter{}



\if@twoside
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{\hfil\myfooter\hfil}\def\@evenfoot{\hfil\myfooter\hfil}%       No feet.
 \def\@evenhead{%
      \begin{minipage}{\textwidth}%
         {\rm\thepage\hspace*{\fill}\sl\leftmark}\\[-4.5mm]%
         {\underline{\makebox[\textwidth]{}}}%
      \end{minipage}}% Left Heading.
 \def\@oddhead{%
      \begin{minipage}{\textwidth}%
         {{\sl \rightmark}\hspace*{\fill}\rm\thepage}\\[-4.5mm]%
         {\underline{\makebox[\textwidth]{}}}%
      \end{minipage}}% Right Heading.
 \def\chaptermark##1{\markboth {{\ifnum \c@secnumdepth >\m@ne
      \@chapapp\ \thechapter. \ \fi ##1}}{}}%
 \def\sectionmark##1{\markright {{\ifnum \c@secnumdepth >\z@
   \thesection. \ \fi ##1}}}}
\else
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{\myfooter}\def\@evenfoot{\myfooter}%       No feet.
%\def\@oddfoot{}\def\@evenfoot{}%     No feet.
\def\@oddhead{{\sl \rightmark}\hfil \rm\thepage}% Heading.
\def\chaptermark##1{\markright {\uppercase{\ifnum \c@secnumdepth >\m@ne
  \@chapapp\ \thechapter. \ \fi ##1}}}}
\fi



\def\thebibliography#1{\chapter*{\@mkboth{}{}\bibname\@mkboth
  {{\bibname}}{{\bibname}}}\list
  {\@biblabel{\arabic{enumiv}}}{\settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \usecounter{enumiv}%
    \let\p@enumiv\@empty
    \def\theenumiv{\arabic{enumiv}}}%
    \def\newblock{\hskip .11em plus.33em minus.07em}%
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=\@m}




\def\@makechapterhead#1{%
  \vspace*{5.5em}%
  {\parindent \z@ \raggedright%
%%%%  old
%    \ifnum \c@secnumdepth >\m@ne%
%      \huge\bf \@chapapp{} \thechapter%
%      \par%
%      \vskip 20\p@ \fi%
%%%% new
    \ifnum \c@secnumdepth >\m@ne%
%      \Large\bf \@chapapp{} \thechapter%
      \Large\bf \SmallLogo\hspace{1ex}\@chapapp{} \thechapter%
      \par%
      \vskip 15\p@ \fi%
%%%%%%%%
    \Large \bf%
    #1\par%
%    \querline%
    \bigskip%
    \bigskip%
    \bigskip%
    \nobreak%
    \vspace*{0.25em}%
  }}

\def\@makeichapterhead#1{%
  \vspace*{5.5em}%
  {\parindent \z@ \raggedright%
%%%%  old
%    \ifnum \c@secnumdepth >\m@ne%
%      \huge\bf \@chapapp{} \thechapter%
%      \par%
%      \vskip 20\p@ \fi%
%%%% new
    \ifnum \c@secnumdepth >\m@ne%
%      \Large\bf \@chapapp{} \thechapter%
      \Large\bf \SmallLogo\hspace{1ex}\indexname{}%
      \par%
      \vskip 15\p@ \fi%
%%%%%%%%
%    \Large \bf%
%    #1\par%
%    \querline%
%    \bigskip%
    \bigskip%
    \bigskip%
    \nobreak%
    \vspace*{0.25em}%
  }}

\def\@makeschapterhead#1{%
%  \vspace*{-5mm}%
  {\parindent \z@ \raggedright%
    \Large \bf #1\par%
    \bigskip %
    \nobreak %
    \vspace*{0.25em}%
  }}


\def\chapter{\clearpage
   \thispagestyle{headings}%
   \global\@topnum\z@
   \@afterindentfalse
   \secdef\@chapter\@schapter}

\def\Ichapter{%\twocolumn[]%
   \thispagestyle{headings}%
   \global\@topnum\z@
   \@afterindentfalse
   \secdef\@chapter\@schapter}

%\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
%        \refstepcounter{chapter}%
%        \typeout{\@chapapp\space\thechapter.}%
%        \addcontentsline{toc}{chapter}{\protect
%        \numberline{\thechapter}#1}\else
%      \addcontentsline{toc}{chapter}{#1}\fi
%   \chaptermark{#1}%
%   \addtocontents{lof}%
%       {\protect\addvspace{10\p@}}% Adds between-chapter space
%   \addtocontents{lot}%
%       {\protect\addvspace{10\p@}}% to lists of figs & tables.
%   \if@twocolumn
%           \@topnewpage[\@makechapterhead{#2}]%
%     \else \@makechapterhead{#2}%
%           \@afterheading
%     \fi}

%\def\@schapter#1{\chaptermark{#1}\if@twocolumn \@topnewpage[\@makeschapterhead{#1}]%
%        \else \@makeschapterhead{#1}%
%              \@afterheading\fi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\def\section{\@startsection {section}{1}{\z@}{-4.0ex plus-1ex minus
    -.2ex}{3.3ex plus.2ex}{\reset@font\normalsize\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.75ex plus-1ex
    minus-.2ex}{2.5ex plus.2ex}{\reset@font\normalsize\sl}}
\def\subsubsection{\@startsection{subsubsection}{2}{\z@}{-3.75ex plus-1ex
    minus-.2ex}{2.5ex plus.2ex}{\reset@font\normalsize\sl}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\def\appendix{\par
  \setcounter{section}{0}%
  \def\@chapapp{\appendixname}%
  \def\thesection{\Alph{section}}
  \def\theequation{\Alph{section}.\arabic{equation}}
  \def\thefigure{\Alph{section}.\arabic{figure}}
  \def\thetable{\Alph{section}.\arabic{table}}
\@addtoreset{equation}{section}
\clearpage
%  \chapter*{\appendixname}
  \chapter*{\@mkboth{}{}\quad\@mkboth{\appendixname}{\rm\thepage\hspace*{\fill}%
          \sl\rightmark}}%
\vspace*{3.4em}%
  {\parindent \z@ \raggedright%
    \Large \bf%
%    \appendixname\par%
    \SmallLogo\hspace{1ex} \appendixname\par%
  \addcontentsline{toc}{chapter}{\appendixname}
    \bigskip%
    \nobreak%
    \vspace*{0.25em}%
  }%
}
        


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\def\listoffigures{\@restonecolfalse
  \if@twocolumn\@restonecoltrue\onecolumn\fi
  \chapter*{\@mkboth{}{}\listfigurename\@mkboth{{\listfigurename}}%
     {{\listfigurename}}}\@starttoc{lof}\if@restonecol
    \twocolumn\fi}


\def\listoftables{\@restonecolfalse
  \if@twocolumn\@restonecoltrue\onecolumn\fi
  \chapter*{\@mkboth{}{}\listtablename\@mkboth{\listtablename}{\listtablename}%
   }\@starttoc{lot}\if@restonecol
  \twocolumn\fi}




\def\tableofcontents{\@restonecolfalse
  \if@twocolumn\@restonecoltrue\onecolumn\fi
        \markright{}%
  \chapter*{\contentsname
        \@mkboth{{\contentsname}}{{\contentsname}}}%
  \@starttoc{toc}\if@restonecol\twocolumn\fi}


\renewenvironment{theindex}
               {\if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                \columnseprule \z@
                \columnsep 35\p@
         \twocolumn[\@makeichapterhead{\@mkboth{}{}\indexname }] %
%                    \thispagestyle{myheadings}
                \@mkboth{\indexname}%
                        {\indexname}

                \parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \let\item\@idxitem

}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newcounter{mysection}
%\setcounter{mysection}{1}
%\newcommand{\savesection}{\setcounter{mysection}{\value{section}}}
%\newcommand{\getsavedsection}{\setcounter{section}{\value{mysection}}}
%\@addtoreset{equation}{section}
\newcommand{\savesection}{}
\newcommand{\getsavedsection}{}


%\renewcommand{\thesection}{\arabic{section}}
%\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
