\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{tugindia}
              [1994/07/13 v1.2u
 Standard LaTeX document class]
\newif\if@restonecol
\@twosidetrue\@twocolumnfalse\@mparswitchfalse
%
\def\jobtag{}
%
\newdimen\draftrule
\draftrule=0pt
\newdimen\trimrule
\trimrule=0.25pt
%
\DeclareOption{draft}{\setlength\overfullrule{5pt}\draftrule0.1pt}
\DeclareOption{final}{\setlength\overfullrule{0pt}}
\DeclareOption{onecolumn}{\@twocolumnfalse}
\DeclareOption{twocolumn}{\@twocolumntrue}
\DeclareOption{twoside}{\@twosidetrue}
%\DeclareOption{mathtime}{%
% \RequirePackage[T1]{fontenc}%
% \RequirePackage{times}\RequirePackage%
%  [nofontinfo,mtbold,T1]%
%  {mathtime}}%
\ExecuteOptions{twoside,onecolumn,final}
\ProcessOptions
%
%
\RequirePackage[fleqn]{amsmath}
\RequirePackage{amsmath}
\RequirePackage{array,amssymb,xspace,amsfonts,longtable}


\if@twocolumn
\else
\fi
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Boxes & Dimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Boxes & Dimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newdimen\trimheight
\newdimen\trimwidth
\newdimen\typeheight
\newdimen\typewidth
\newdimen\tempdimen        
\newdimen\tempaddimen
\newdimen\normaltextheight
\newdimen\tempmardimen
\newdimen\tablewidth
\newbox\tempbox
%
\RequirePackage{color}
\definecolor{nocolor}{gray}{1}
\definecolor{Grythrty}{gray}{.7}
\definecolor{Gryten}{gray}{.8}
\definecolor{Black}{gray}{0}
\def\nocolor{\color{nocolor}}
\def\Grythrty{\color{Grythrty}}
\def\Gryten{\color{Gryten}}
\def\Black{\color{Black}}
%
%
%\usepackage{woodfont}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Parameter Initializaton %%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setlength\trimheight{234mm}
\setlength\trimwidth{172mm}
\setlength\parindent{1em}
\setlength\topmargin{34pt}
\setlength\headheight{7pt}
\setlength\headsep   {23pt}
\setlength\topskip   {7\p@}
\setlength\footskip{30pt}
\setlength\maxdepth{4\p@}
\setlength\@maxdepth\maxdepth
\setlength\typewidth{400pt}
\setlength\textwidth{\typewidth}
\if@twocolumn
%\addtolength{\textwidth}{64pt}
\else
\addtolength{\textwidth}{-64pt}
\fi
\def \twocolumn {%
  \clearpage
  %\global\columnwidth\textwidth
  \global\columnwidth\textwidth
  \global\advance\columnwidth-\columnsep
  \global\divide\columnwidth\tw@
  \global\hsize\columnwidth
  \global\linewidth\columnwidth
  \global\@twocolumntrue
  \global\@firstcolumntrue
  \col@number \tw@
  \@ifnextchar [\@topnewpage\@floatplacement
}

\setlength\textheight{43\baselineskip}
%\advance\textheight\headheight
%\advance\textheight\headsep
\addtolength\textheight{\topskip}
\setlength\normaltextheight{\textheight}
\setlength\oddsidemargin   {4pc}
\setlength\marginparwidth {52pt}
\setlength\marginparsep{1pc}
\setlength\marginparpush{5\p@}

\setlength\evensidemargin  {\trimwidth}
\advance\evensidemargin-\textwidth
\advance\evensidemargin-\oddsidemargin
\if@twocolumn
\else
\addtolength{\oddsidemargin}{64pt}
\fi

\setlength\footnotesep{\z@}%6.65\p@}
\setlength{\skip\footins}{14\p@ \@plus 4\p@ }%\@minus 2\p@}
\setlength\floatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
\setlength\intextsep   {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\dblfloatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
\setlength\@fptop{0\p@ \@plus 1fil}
\setlength\@fpsep{8\p@ \@plus 2fil}
\setlength\@fpbot{0\p@ \@plus 1fil}
\setlength\@dblfptop{0\p@ \@plus 1fil}
\setlength\@dblfpsep{8\p@ \@plus 2fil}
\setlength\@dblfpbot{0\p@ \@plus 1fil}
\setlength\partopsep{\z@}%2\p@ \@plus1\p@ \@minus\p@}
\setlength\lineskip{\z@}
\setlength\normallineskip{\z@}
\renewcommand\baselinestretch{1}
\setlength\parskip{\z@}
\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Parameter Initializaton %%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Lists %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\def\@listI{\leftmargin\leftmargini
            \parsep \z@%4\p@ \@plus2\p@ \@minus\p@
            \topsep 6\p@ \@plus4\p@ %\@minus4\p@
            \itemsep 3\p@%4\p@ \@plus2\p@ \@minus\p@
}
\let\@listi\@listI
\@listi
\def\@listii {\leftmargin\leftmarginii
              \labelwidth\leftmarginii
              \advance\labelwidth-\labelsep
              \topsep   \z@% 4\p@ \@plus2\p@ \@minus\p@
              \parsep    \z@%2\p@ \@plus\p@  \@minus\p@
              \itemsep   \parsep}
\def\@listiii{\leftmargin\leftmarginiii
              \labelwidth\leftmarginiii
              \advance\labelwidth-\labelsep
              \topsep    2\p@ \@plus\p@\@minus\p@
              \parsep    \z@
              \partopsep \p@ \@plus\z@ \@minus\p@
              \itemsep   \topsep}
\def\@listiv {\leftmargin\leftmarginiv
              \labelwidth\leftmarginiv
              \advance\labelwidth-\labelsep}
\def\@listv  {\leftmargin\leftmarginv
              \labelwidth\leftmarginv
              \advance\labelwidth-\labelsep}
\def\@listvi {\leftmargin\leftmarginvi
              \labelwidth\leftmarginvi
              \advance\labelwidth-\labelsep}
\setlength\leftmargini  {2.2em}%1.5em
\setlength\leftmarginii  {2.2em}
\setlength\leftmarginiii {1.87em}
\setlength\leftmarginiv  {1.7em}
\setlength\leftmarginv  {1em}
\setlength\leftmarginvi {1em}
\setlength\leftmargin    {\leftmargini}
\setlength  \labelsep  {5pt} %%% 10pt modified -- cvr
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\renewcommand\theenumi{\arabic{enumi}}
\renewcommand\theenumii{\alph{enumii}}
\renewcommand\theenumiii{\roman{enumiii}}
\renewcommand\theenumiv{\Alph{enumiv}}
\newcommand\labelenumi{(\theenumi)}
\newcommand\labelenumii{(\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
%\newcommand\labelitemi{$\m@th\bullet$}
\newcommand\labelitemi{$\m@th\bulls$}
\newcommand\labelitemii{\normalfont\bfseries --}
\newcommand\labelitemiii{$\m@th\ast$}
\newcommand\labelitemiv{$\m@th\cdot$}
%
\def\bulls{{\Gryten\vrule height5pt width5pt}}
%\font\hr = dingbats at 6pt
%\def\bulls{\hbox{\hr \char'156}}
\def\itemize{%
  \ifnum \@itemdepth >\thr@@\@toodeep\else
    \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \expandafter
    \list
      \csname\@itemitem\endcsname
      {\def\makelabel##1{\hss\llap{##1}}}%
  \fi}
\let\enditemize =\endlist
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Lists %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{trick}{%%
  \par\addvspace{12pt plus2pt}%
  \trickfont\noindent\ignorespaces
  \leftskip1pc\rightskip\leftskip
}{%
  \par\addvspace{12pt plus2pt}%
}
%
\newenvironment{code}{%
  \par\addvspace{12pt plus2pt}%
  \hbox to \textwidth\bgroup
  \hfill\begin{tabular}{@{}l@{}}%
  \ignorespaces
}{%
  \end{tabular}\hfill\egroup
  \par\addvspace{12pt plus2pt}%
  \@endparenv}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Quote and Quotation  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{description}[1]
               {\list{}{\settowidth\labelwidth{\bf #1}\itemsep=3pt
                       \topsep=6pt
                       %\itemindent-\leftmargin
                       \ifdim\leftmargin>\labelwidth\relax\else
                       \setlength\leftmargin{\labelwidth}
                       \addtolength\leftmargin{\labelsep}\fi
                        \let\makelabel\descriptionlabel}}
               {\endlist}
\newcommand\descriptionlabel[1]{\hbox to \labelwidth{\color{red}
%                                \hspace{\labelsep}
                                \normalfont\bfseries #1\hss}}
\newenvironment{verse}
               {\let\\=\@centercr
                \list{}{\itemsep      \z@
                        \itemindent   -1.5em%
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em}%
                \item[]}
               {\endlist}
\newenvironment{quotation}
               {\list{}{\listparindent 1.5em%
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@} %\@plus\p@}%
                \item[]}
               {\endlist}
\newenvironment{quote}
               {\list{}{\leftmargin1pc\rightmargin\leftmargin}%
                \item[]}
               {\endlist}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Quote and Quotation  %%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%% Proof
\newenvironment{proof}{%
			\par\addvspace{13pt plus2pt}%
   \global\QEDlogofalse
   \@ifnextchar[{\@proof}{\@proof[Proof]}%
   }{%
			%\QEDlogo
   \hskip5.5pt Q.E.D.\par\addvspace{13pt plus2pt}}
%
\def\@proof[#1]{\noindent{\bfseries\boldmath#1}\hskip10pt\ignorespaces}
%
\newif\ifQEDlogo
\QEDlogofalse
\font\QEDlogofont=msam10 at 9pt
\def\QEDlogo{\ifQEDlogo
													\else
             			\ifvmode
		             			\vskip-\lastskip\hspace*{\fill}%
                \else
  		              \unskip\hskip5pt\ignorespaces
                \fi
    		          \hbox{\QEDlogofont\char'004}\par
                \global\QEDlogofalse
             \fi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand\contentsname{Contents}
\newcommand\listfigurename{List of Figures}
\newcommand\listtablename{List of Tables}
\newcommand\bibname{Bibliography}
\newcommand\indexname{Index}
\newcommand\figurename{Figure}
\renewcommand\tablename{Table}
\newcommand\partname{Part}
\newcommand\chaptername{Chapter}
\newcommand\appendixname{Appendix}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Sectioning commands  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\newenvironment{theindex}
               {\if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                \columnseprule \z@
                \columnsep 35\p@
                \twocolumn[\@makeschapterhead{\indexname}]%
                \@mkboth{\MakeUppercase\indexname}%
                        {\MakeUppercase\indexname}%
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \let\item\@idxitem}
               {\if@restonecol\onecolumn\else\clearpage\fi}
\newcommand\@idxitem{\par\hangindent 40\p@}
\newcommand\subitem{\@idxitem \hspace*{20\p@}}
\newcommand\subsubitem{\@idxitem \hspace*{30\p@}}
\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}



\newcommand\chaptermark[1]{}
\setcounter{secnumdepth}{3}
\newcounter {part}
\newcounter {chapter}
\newcounter {section}[chapter]
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]
\newcounter {subparagraph}[paragraph]
\newcounter {example}[chapter]
\renewcommand\thepart          {\Roman{part}}
\renewcommand\thechapter       {\arabic{chapter}}
\renewcommand\thesection       {\thechapter.\arabic{section}}
\renewcommand\thesubsection    {\thesection.\arabic{subsection}}
\renewcommand\thesubsubsection {\thesubsection .\arabic{subsubsection}}
\renewcommand\theparagraph     {\thesubsubsection.\arabic{paragraph}}
\renewcommand\thesubparagraph  {\theparagraph.\arabic{subparagraph}}
\renewcommand\theexample        {\thechapter.\arabic{example}}

\newcommand\@chapapp{\chaptername}
\newcommand\section{\@startsection {section}{1}{-64pt}%
                                   {-24pt \@plus -6pt \@minus -3pt}%
                                   {12pt}%
                                   {\sectionfont}}
\newcommand\subsection{\@startsection{subsection}{2}{-64pt}
                                     {-12pt \@plus -6pt \@minus -3pt}%
                                     {6pt}%
                                     {\subsectionfont}}
\newcommand\subsubsection{\@startsection{subsubsection}{3}{-64pt}
                                     {-12pt \@plus -1pt \@minus -.2pt}%
                                     {6pt}%
                                     {\subsubsectionfont}}
\newcommand\paragraph{\@startsection{paragraph}{4}{-64pt}%
                                    {-6pt \@plus2pt}%
                                    {0.001pt}%
                                    {\paragraphfont}}
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1pc}%
                                      {\reset@font\normalsize\bfseries}}
%
\def\@seccntformat#1{\csname the#1\endcsname}
\def\Twoheadsep{\vspace*{6pt}}
%
\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \let\@svsec\@empty\else
     \refstepcounter{#1}%
     \let\@@protect\protect
     \def\protect{\noexpand\protect\noexpand}%
     \edef\@svsec{\@seccntformat{#1}}%
     \let\protect\@@protect\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@
        \begingroup #6\relax
          \noindent\hskip #3\@hangfrom{\hbox to 52pt{\hfill{\Gryten%
          \ifnum #2 = 1 \vrule height12pt depth4pt width52pt%
          \else%\ifnum #2 > 1 
         \vrule height0pt depth0pt width52pt\fi
          }\llap{\@svsec\hskip2pt}}\hspace*{1pc}}%
                    {\interlinepenalty \@M \hangindent0pt#8\par}%
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{#6\hskip #3\relax  %% \relax added 2 May 90
                   \@svsec #8\csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                           \protect\numberline{\csname the#1\endcsname}%
                                     \fi
                       #7}}\fi
     \@xsect{#5}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Sectioning commands  %%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Chapter Title  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\long\def\chapter{\clearpage%\@chapteropentrue
                    \thispagestyle{plain}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\long\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}%
                      \@makechapterhead{#2}%
                      \@afterheading
                    }
\long\def\@makechapterhead#1{%
\vglue-5pt%
  {
  \parindent \z@ \raggedright \reset@font
    \ifnum \c@secnumdepth >\m@ne
       \fi
\hskip-65.3pt%
\hbox to \typewidth{%
\vbox to 48pt{\hbox to 52pt{%
  {\Gryten\vrule height21pt depth27pt width52pt}%
  \llap{\color{orange}\CNfont \thechapter\hskip3pt}}}%
  \hspace*{1pc}%
\begin{minipage}[b][48pt][t]{\textwidth}
  \vspace*{8pt}
  \color{orange}\CTfont #1
  \par\vfill\vspace*{-6pt}
  \noindent\color{red}%
  \rule{\textwidth}{2pt}
\end{minipage}
    }\vskip7.25pt
  }
}
\def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}%
                   \@afterheading
                 \fi}
\def\@makeschapterhead#1{%
\vglue-5pt%
  {\parindent \z@ \raggedright \reset@font
\hskip-65.3pt%
\hbox to \typewidth{
\vbox to 50pt{\hbox to 52pt{{\Gryten\vrule height21pt  depth27pt width52pt}\llap{}}}\hspace*{1pc}%
\vbox to 48pt{\vspace*{8pt}\vbox{\CTfont #1\par}\vfill\vspace*{-5pt}\noindent\vrule width\textwidth height1pt}
}
    \vskip10pt
  }}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Chapter Title  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Part Title  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Part Title  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Floats %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setcounter{topnumber}{3}
\renewcommand\topfraction{1}
\setcounter{bottomnumber}{2}
\renewcommand\bottomfraction{0.8}
\setcounter{totalnumber}{4}
\renewcommand\textfraction{0}
\renewcommand\floatpagefraction{0.8}
%
%
%\setcounter{topnumber}{2}
%\renewcommand\topfraction{.7}
%\setcounter{bottomnumber}{1}
%\renewcommand\bottomfraction{.3}
%\setcounter{totalnumber}{3}
%\renewcommand\textfraction{.1}
%\renewcommand\floatpagefraction{.9}
\setcounter{dbltopnumber}{2}
\renewcommand\dbltopfraction{.7}
\renewcommand\dblfloatpagefraction{.5}
%
\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{5\p@}
\setlength\belowcaptionskip{0\p@}

\def\FigName{figure}
%
\long\def\@makecaption#1#2{%
    \ifx\@captype\FigName
									\@figurecaption{#1}{#2}%
					\else
     				\@tablecaption{#1}{#2}%
     \fi}
%
\def\smallcaption#1{\refstepcounter{figure}{\figurecaptionfont\itshape% 
Figure\ \thefigure}\hspace*{.5em}{\figurecaptionfont #1}}
%
\newdimen\captionwidth
%
%
\long\def\@figurecaption#1#2{{%
%   \ifdim\figwidth<13pc 
     \captionwidth\hsize
%     \advance\captionwidth-\figwidth
%     \advance\captionwidth-22pt
%     \setbox\tempbox\vbox{\hsize\captionwidth
%     \figurecaptionfont{\itshape #1}%
%     \hspace*{.5em} #2\par}%
%     \vskip-\ht\tempbox
%     \setbox\tempbox\hbox{\figurecaptionfont{\itshape #1}\hspace*{.5em} #2\par}%
%     \ifdim\wd\tempbox<\captionwidth\vskip-6pt\fi
%     \hskip\figwidth\hskip22pt
     \par\vskip6pt
     \vbox{\hsize\captionwidth
     \figurecaptionfont{\itshape #1}%
     \hspace*{.5em} #2\par}%
%  \else
%     \vskip\abovecaptionskip
%  {\figurecaptionfont{\itshape #1}\hspace*{.5em} #2\par}%
%\fi
}}
%
\newenvironment{intextfigure}{%
 \par\addvspace{7pt}%
 \begin{figure}[h]
}{%
  \end{figure}%
  \par\addvspace{7pt}\@endparenv}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Figures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcounter{figure}[chapter]
\renewcommand\thefigure{\thechapter.\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename~\thefigure}
\newenvironment{figure}
               {\@float{figure}}
               {\end@float}
\newenvironment{figure*}
               {\@dblfloat{figure}}
               {\end@dblfloat}
%
\newdimen\figheight
\newdimen\figwidth
%
%\def\ArtDir{}%
\RequirePackage{graphicx}
%
%\newbox\figtempbox
%\def\ArtPiece#1{\includegraphics{#1}}%
%
%\def\figurebox#1#2{%
%    \@ifnextchar[{\@figurebox{#1}{#2}}{\@figurebox{#1}{#2}[]}}
%
%\def\@figurebox#1#2[#3]{%
%      \gdef\@thirdarg{#3}%
%      \ifx\@thirdarg\empty
%         \global\figheight=#1
%         \global\figwidth=#2
%      \else 
%         \setbox\figtempbox=\hbox{\includegraphics{\@thirdarg}}%
%         \global\figwidth=\wd\figtempbox
%         \setbox\figtempbox=\vbox{\includegraphics{\@thirdarg}}%
%         \global\figheight=\ht\figtempbox
%      \fi
%\hskip12pt\figbox
%}%
%
%\newif\ifintextfig
%\global\intextfigfalse
%\def\figbox{%
%    \ifx\@thirdarg\empty
%       \vbox{\hsize\figwidth%
%	      \hrule\hbox to\figwidth{\vrule\hfill\vbox to\figheight{\hsize\figwidth\vfill}\vrule}\hrule}%
%    \else
%       \vbox{\hsize\figwidth%
%	      \hbox to\figwidth{\vbox to\figheight{\hsize\figwidth\epsfbox{\ArtDir\@thirdarg}}}}%
%    \fi}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Tables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%\newcounter{table}[chapter]
\renewcommand\thetable{\thechapter.\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename~\thetable}
\newenvironment{table}
               {\@float{table}}
               {\end@float}
\newenvironment{table*}
               {\tablefont\@dblfloat{table}}
               {\end@dblfloat}
%
%\def\tline{%
%  \noalign{\ifnum0=`}\fi{\Grythrty\hrule \@height 2pt} \futurelet
%   \@tempa\@xhline}
%
%\def\hline{%
%  \noalign{\ifnum0=`}\fi{\Grythrty\hrule \@height \arrayrulewidth} \futurelet
%   \@tempa\@xhline}
%
%\def\toprule{\\[-6pt]\tline\\[-5pt]}
%\def\colrule{\\[-5pt]\hline\\[-5pt]}
%\def\botrule{\\[-7pt]\tline}
%
\def\TCH#1{\TCHfont #1}
%
\def\@tablecaption#1#2{\par
 \noindent{\tablenumfont #1}\hskip0.5em{\tablefont #2\par}}
%
\def\tbl#1#2{\def~{\hphantom{0}}\tabcolsep15pt %
         \hbox to \hsize{\vbox{\caption{#1}\addvspace{6pt}%
           {\hskip1pc\tablefont #2\par}\vskip3pt}\hfill}%
}
%
\newenvironment{Intexttable}{%
 \par\addvspace{16pt}%
 \leftskip2pt\rightskip1pt plus1fill\tablefont\ignorespaces
}{%
   \par\addvspace{20pt}\@endparenv}
%
\newenvironment{tabnote}{%
  \par%\addvspace{8pt}
  \leftskip1pc%\tempdimen
  \tempdimen\hsize
  \advance\tempdimen-\tablewidth
  \rightskip\tempdimen plus1fill
  \tabnotefont
}{%
  \par}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Floats %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Math %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\jot=1pt
\def\bstrut{\vrule width0pt depth5pt}
\def\tstrut{\vrule width0pt height9pt}
%

\RequirePackage{comment}

\newdimen\mathindent
\mathindent1pc
    \setlength\abovedisplayskip{\topsep}%
    \ifvmode
      \addtolength\abovedisplayskip{\partopsep}%
    \fi
    \setlength\belowdisplayskip{\abovedisplayskip}%
    \setlength\belowdisplayshortskip{\abovedisplayskip}%
    \setlength\abovedisplayshortskip{\abovedisplayskip}%

\renewcommand{\[}{\relax
                 \ifmmode\@badmath
                 \else
                   \begin{trivlist}%
                     \@beginparpenalty\predisplaypenalty
                     \@endparpenalty\postdisplaypenalty
                     \item[]\leavevmode
                     \hbox to\linewidth\bgroup $\m@th\displaystyle %$
                       \hskip\mathindent\bgroup
                 \fi}
%
\renewcommand{\]}{\relax
                 \ifmmode
                       \egroup $\hfil% $
                     \egroup
                   \end{trivlist}%
                 \else \@badmath
                 \fi}
%
\def\@eqnnum{{\reset@font\rmfamily\bfseries (\theequation)}}

\begin{comment}
%
\renewenvironment{equation}%
    {\@beginparpenalty\predisplaypenalty
     \@endparpenalty\postdisplaypenalty
     \refstepcounter{equation}%
     \trivlist \item[]\leavevmode
       \hbox to\linewidth\bgroup $\m@th% $
         \displaystyle
         \hskip\mathindent}%
        {$\hfil % $
         \displaywidth\linewidth\hbox{\@eqnnum}%
       \egroup
     \endtrivlist}
%
    \setlength\abovedisplayskip{\topsep}%
    \ifvmode
      \addtolength\abovedisplayskip{\partopsep}%
    \fi
    \setlength\belowdisplayskip{\abovedisplayskip}%
    \setlength\belowdisplayshortskip{\abovedisplayskip}%
    \setlength\abovedisplayshortskip{\abovedisplayskip}%
%\renewenvironment{eqnarray}{%
%    \stepcounter{equation}%
%    \def\@currentlabel{\p@equation\theequation}%
%    \global\@eqnswtrue\m@th
%    \global\@eqcnt\z@
%    \tabskip\mathindent
%    \let\\=\@eqncr
%    \setlength\abovedisplayskip{\topsep}%                 %
%    \ifvmode                                              %
%      \addtolength\abovedisplayskip{\partopsep}%             %
%    \fi                                                   %
%    \setlength\belowdisplayskip{\abovedisplayskip}%       %
%    \setlength\belowdisplayshortskip{\abovedisplayskip}%  %
%    \setlength\abovedisplayshortskip{\abovedisplayskip}%  %
%    $$\everycr{}\halign to\linewidth% $$
%    \bgroup
%      \hskip\@centering
%      $\displaystyle\tabskip\z@skip{##}$\@eqnsel&%
%      \global\@eqcnt\@ne \hskip \tw@\arraycolsep \hfil${##}$\hfil&%
%      \global\@eqcnt\tw@ \hskip \tw@\arraycolsep
%        $\displaystyle{##}$\hfil \tabskip\@centering&%
%      \global\@eqcnt\thr@@
%        \hbox to \z@\bgroup\hss##\egroup\tabskip\z@skip\cr}%
      {\@@eqncr
    \egroup
    \global\advance\c@equation\m@ne$$% $$
    \global\@ignoretrue
    }
%

\end{comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Math %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setlength\arraycolsep{2\p@}
\setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{1pt}
%\setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep}
\skip\@mpfootins = \skip\footins
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
\@addtoreset{equation}{chapter}
\renewcommand\theequation{\thechapter.\arabic{equation}}
\setlength\columnsep{10pt}
%\setlength\columnseprule{\z@}
\setlength\columnseprule{.25pt}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Footnote %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\renewcommand\footnoterule{%
  \kern-3\p@
  \hrule width 6pc
  \kern 3\p@}
\@addtoreset{footnote}{chapter}
\long\def\@makefntext#1{%
%    \parindent8pt%
	   \noindent
    \hbox to 1.8em{\hss\@makefootmark}#1}
%
\def\@makefootmark{$^{\@thefnmark}$\hspace*{4pt}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Footnote %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Page styles  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\if@twoside
\def\ps@plain{\let\@mkboth\@gobbletwo
     \let\@oddhead\@empty\def\@oddfoot{\reset@font\hfill\rhfont\thepage
     }\let\@evenhead\@empty\let\@evenfoot\@oddfoot}

\def\ps@empty{\let\@mkboth\@gobbletwo
     \let\@oddhead\@empty\let\@oddfoot\@empty
     \let\@evenhead\@empty\let\@evenfoot\@oddfoot}

\font\stubfont=msam10 at 11pt
\def\stub{\hbox{\stubfont\char'004}}
%
\def\ps@headings{%
      \def\@oddfoot{\@empty}%
      \let\@evenfoot\@empty%
      \def\@evenhead{\hskip-64pt\rhfont\thepage \hspace*{6pt}{\Grythrty\stub}\hspace*{6pt}\leftmark\hfill}%
      \def\@oddhead{%\ifodd\thepage%
       \hfill\rhfont{\rightmark}\hspace*{6pt}{\Grythrty\stub}\Black\hspace*{6pt}\thepage%
       %\else{\hskip-64pt\rhfont\thepage \hspace*{6pt}{\Grythrty\stub}\hspace*{6pt}\leftmark\hfill}\fi%
       }
      \let\@mkboth\markboth
      \def\chaptermark##1{%
        \markboth {##1}{}}%
      \def\sectionmark##1{%
        \markright {\thesection\quad ##1}}}
\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\thepage\hfil\slshape\leftmark}%
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\chaptermark\@gobble
    \let\sectionmark\@gobble
    }
\fi
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Page styles  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand{\Bib}[6]
{\par\addvspace{12pt}\hbox to 28pc{\noindent\hskip-5.35pc\vbox{\epsfysize=2cm\epsfbox{#4}}\hspace*{8pt}
 \vbox{\hskip-3pt\Bibheadfont #1\par \hskip-3pt(#2)\par \hskip-3pt{\mdseries\itshape #3}}\hfill}
 \par
 {
  \extahead{LIFE}{\noindent\Bibfont #5\par}
  \extahead{WORK}{\noindent\Bibfont #6\par\vskip6pt\hrule height0.5pt width28pc}
 }
}
%%% SYV
%
\newdimen\sepvalue
\global\sepvalue3pt
%
\def\@Enumerate[#1]{\ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}%\exenummax{#1}
      \list{\csname label\@enumctr\endcsname}{\leftmargin0pt\topsep\sepvalue
      \usecounter{\@enumctr}%\def\makelabel##1{\ENfont##1\hfill}}\fi
        \def\makelabel##1{\hbox to 2.4em{\ENfont##1\hfill}}}\fi
}
%
\def\endEnumerate{\endlist}%% 
%
\def\Enumerate{\@ifnextchar[{\@Enumerate}{\@Enumerate[1.]}}%% 
%%
\newif\iffirst
\global\firsttrue
\def\extahead#1{\par\addvspace{7pt}{\noindent\Bibheadfont #1\par}\addvspace{1pt}}
%%%%%%%%% Problems %%%%%%%
%
\def\problems{\@ifnextchar[{\@problems}{\@problems[\thechapter.]}}
%
\def\@problems[#1]{\par\addvspace{24pt}%
\gdef\@optionalarg{#1}
\setbox\tempbox=\vbox\bgroup%
\begin{Enumerate}%
 \setlength\topsep{8pt plus 4pt minus 1pt}
 \setlength\partopsep{1pt plus 1pt minus 1pt}
\renewcommand\theenumi{\ENfont\thechapter.\arabic{enumi}}%
\renewcommand\labelenumi{\theenumi}%
\sepvalue0pt% 8
\itemsep6pt%
\parindent1em
\labelsep1.1em
\setbox\tempbox=\hbox{\thechapter.\@optionalarg}%
\tempdimen\wd\tempbox\advance\tempdimen\labelsep%
\itemindent\tempdimen%
}
%
\def\endproblems{%
\end{Enumerate}%
\vskip-\lastskip
\egroup%
\tempdimen\pagegoal
\advance\tempdimen-\pagetotal
\advance\tempdimen-31pt
\gdef\exercisename{{\EXNfont\Black Problems}}
\gdef\exercisecolor{\Gryten}
\newdimen\firstskip
\firstskip-1.7pt
\ifdim\tempdimen < \ht\tempbox
\loop
\setbox1=\vsplit\tempbox to \tempdimen
\iffirst
\hbox{\hskip-64pt{\vbox to \tempdimen{\vskip\firstskip\hbox to
  52pt{\exercisecolor%
  \vrule height11.5pt depth4.5pt width52pt%
  \llap{\EXNfont \exercisename\hskip2pt}}\vfill}%
   \vbox to \tempdimen{\vskip\firstskip\hbox to 12pt{\hfill\Gryten\vrule
   height\tempdimen width4pt\hfill}}}%
  {\box1}}\else\fi
\ifdim\pagegoal < \ht\tempbox \gdef\exercisename{}
  \gdef\exercisecolor{\nocolor}\firstskip0pt\tempdimen\pagegoal\repeat
  \hbox{\hskip-64pt{\hbox to 52pt{\hfill}%
  \hbox to 12pt{\hfill\Gryten\vrule height\ht\tempbox width4pt\hfill}}%
  {\box\tempbox}}
\else
  \hbox{\hskip-64pt{\vbox to \ht\tempbox{\vskip3pt\hbox to 52pt{\Gryten%
  \vrule height11.5pt depth4.5pt width52pt%
  \llap{\EXNfont\Black Problems\hskip2pt}}\vfill}%
  \hbox to 12pt{\hfill\Gryten\vrule height\ht\tempbox width4pt\hfill}}%
  {\box\tempbox}}
\fi
%}
}


%%%%%%%%% Exercises %%%%%%
\def\exercises{\@ifnextchar[{\@exercises}{\@exercises[\thechapter.]}}
%
\def\@exercises[#1]{\par\addvspace{24pt}%
\gdef\@optionalarg{#1}
%\addtolength\mathindent{-7pt}%
\renewcommand\theenumi{\thechapter.\arabic{enumi}}%
\renewcommand\labelenumi{\ENfont\theenumi}%
%\labelsep1em
\setbox\tempbox=\vbox\bgroup%
\begin{Enumerate}%
\sepvalue8pt
\itemsep12pt%
\parindent1em
\setbox\tempbox=\hbox{\thechapter.\@optionalarg}%
\tempdimen\wd\tempbox%\advance\tempdimen\labelsep%
\itemindent\tempdimen%
}
%
\def\endexercises{%
\end{Enumerate}%
\vskip-\lastskip
\egroup%
\tempdimen\pagegoal
\advance\tempdimen-\pagetotal
\advance\tempdimen-31pt
\gdef\exercisename{{\EXNfont\Black Exercises}}
\gdef\exercisecolor{\Gryten}
\newdimen\firstskip
\firstskip-1.7pt
\ifdim\tempdimen < \ht\tempbox
\loop
\setbox1=\vsplit\tempbox to \tempdimen
\iffirst
\hbox{\hskip-64pt{\vbox to \tempdimen{\vskip\firstskip\hbox to 52pt{\exercisecolor%
  \vrule height11.5pt depth4.5pt width52pt%
  \llap{\EXNfont \exercisename\hskip2pt}}\vfill}%
\vbox to \tempdimen{\vskip\firstskip\hbox to 12pt{\hfill\Gryten\vrule height\tempdimen
width4pt\hfill}}}%
  {\box1}}\else\fi
\ifdim\pagegoal < \ht\tempbox \gdef\exercisename{}\gdef\exercisecolor{\nocolor}\firstskip0pt\tempdimen\pagegoal\repeat
\hbox{\hskip-64pt{\hbox to 52pt{\hfill}%
\hbox to 12pt{\hfill\Gryten\vrule height\ht\tempbox width4pt\hfill}}%
{\box\tempbox}}
\else
\hbox{\hskip-64pt{\vbox to \ht\tempbox{\vskip3pt\hbox to 52pt{\Gryten%
  \vrule height11.5pt depth4.5pt width52pt%
  \llap{\EXNfont Exercises\hskip2pt}}\vfill}%
\hbox to 12pt{\hfill\Gryten\vrule height\ht\tempbox width4pt\hfill}}%
{\box\tempbox}}
\fi
%}
}
%
\newenvironment{note}{\par\addvspace{12pt}%
\vbox{\hskip-6.15pc\hbox to 52pt{\hfill\Gryten\vrule height10pt depth6pt width52pt%
\llap{\notefont Note\hskip2pt}}}\vskip-16.1pt%
\ignorespaces\noindent
}{%
 \par\addvspace{12pt}}
%
\def\Note{\@ifnextchar[{\@Note}{\@Note[\thechapter]}}
%
\def\@Note[#1]{\par\addvspace{24pt}
\gdef\@optionalarg{#1}
\addtolength\mathindent{-7pt}%
\renewcommand\theenumi{\thechapter.\arabic{enumi}.}%
\renewcommand\labelenumi{\ENfont\theenumi}%
%\labelsep1em
\setbox\tempbox=\vbox\bgroup%
\begin{Enumerate}%
\sepvalue8pt
\itemsep12pt%
\setbox\tempbox=\hbox{\theenumi}%\@optionalarg
\tempdimen\wd\tempbox%\advance\tempdimen\labelsep%
\itemindent\tempdimen%
}

\def\endNote{%
\end{Enumerate}%
\vskip-\lastskip
\egroup%
\tempdimen\pagegoal
\advance\tempdimen-\pagetotal
\advance\tempdimen-31pt
\gdef\exercisename{{\notefont Note}}
\gdef\exercisecolor{\Gryten}
\newdimen\firstskip
\firstskip3pt
\ifdim\tempdimen < \ht\tempbox
\loop
\setbox1=\vsplit\tempbox to \tempdimen
\hbox{\hskip-64pt{\vbox to \tempdimen{\vskip\firstskip\hbox to 52pt{\exercisecolor%
  \vrule height11.5pt depth4.5pt width52pt%
  \llap{\EXNfont \Black\exercisename\hskip2pt}}\vfill}%
\hbox to 12pt{\hfill\Gryten\vrule height\tempdimen width0pt\hfill}}%
{\box1}}
\ifdim\pagegoal < \ht\tempbox \gdef\exercisename{}\gdef\exercisecolor{\nocolor}\firstskip0pt\tempdimen\pagegoal\repeat
\hbox{\hskip-64pt{\hbox to 52pt{\hfill}%
\hbox to 12pt{\hfill\Gryten\vrule height\ht\tempbox width0pt\hfill}}%
{\box\tempbox}}
\else
\hbox{\hskip-64pt{\vbox to \ht\tempbox{\vskip3pt\hbox to 52pt{\Gryten%
  \vrule height11.5pt depth4.5pt width52pt%
  \llap{\EXNfont \Black Exercises\hskip2pt}}\vfill}%
\hbox to 12pt{\hfill\Gryten\vrule height\ht\tempbox width0pt\hfill}}%
{\box\tempbox}}
\fi
\par\addvspace{6pt}}

%%%%%%%%%%%%%%%%%%%%%%%%%% problem %%%%%%%%%%

%
%%%
\newif\ifexample
\global\exampletrue
\newif\ifbignum
\global\bignumfalse
\def\bigbegin{\bignumtrue}
\def\bigend{\bignumfalse}
%
\def\exampleskip#1{\gdef\@exampleskip{#1}}
\exampleskip{0pt}
\def\example{\@ifnextchar[{\@example}{\global\exampletrue\@example[]}}
%
\def\@example[#1]{%
\gdef\@optionalarg{#1}%
\refstepcounter{example}%
\par\addvspace{5.9pt}%
\addvspace{\@exampleskip}
\vbox to -3pt{\@hangfrom{\hskip-64pt\hbox to 52pt{\hfill\Gryten%
  \vrule height10.3pt depth5pt width\ifbignum58pt\else52pt\fi%
  \llap{\hbox to 52pt{\hfill\EXNfont\Black Example\hskip2pt \theexample\hfill}}\hss}\hspace*{1pc}\hss}}%
\if\@optionalarg\@empty%
\else%
\noindent{\EXHfont #1}%
\par\addvspace{4pt}\leftskip0pt%
\fi\noindent\vphantom{$n^2$}}
\def\endexample{%
\par\addvspace{4pt}\hbox{\hskip-64pt\Gryten\vrule width\typewidth height2pt}
\par\addvspace{18pt plus6pt minus 6pt}
\global\examplefalse}
%
\newenvironment{observation}{%
\par\addvspace{12pt plus2pt}
\noindent{\obsfont Observation}\hspace*{8pt}\normalfont\itshape
}{%
\par\addvspace{12pt plus2pt}}
%
\newenvironment{observations}{%
\par\addvspace{12pt plus2pt}
\noindent{\obsfont Observations}\hspace*{8pt}\normalfont\itshape
}{%
\par\addvspace{12pt plus2pt}}
%
\newenvironment{definition}{%
\par\addvspace{12pt plus2pt}
\noindent{\obsfont Definition}\hspace*{8pt}\normalfont
}{%
\par\addvspace{12pt plus2pt}}
%
\newenvironment{summary}{%
\section*{\hbox to 52pt{\hfill\epsfysize=1cm \epsfbox{\ArtDir summary.eps}}\hspace*{2pt}\vbox to .95cm{Summary\vfill}}\vspace*{-19pt}}{%
\par\addvspace{12pt plus 2pt minus 2pt}}
%
\newcounter {experiment}[chapter]
\renewcommand\theexperiment{\thechapter.\arabic{experiment}}
\newif\ifODDpage
\ODDpagefalse
\def\oddpage{\ODDpagetrue}
\newdimen\firstdim
%
\def\continued{\parfillskip0pt plus1fill\vbox{\vspace*{3pt}\hbox to \hsize{%
\fontsize{9}{9}\selectfont\hfill\it Continued \hskip6pt}\vspace*{6pt}}\noindent\ignorespaces\par}
%\def\nextpagecontinued{\ \par\addvspace{-10pt}\hbox to \hsize{%
%\fontsize{9}{9}\selectfont\it\hskip6pt Continued\hfill}\par\noindent\ignorespaces}
%
\def\nextpagecontinued{\hbox to \hsize{%
\fontsize{9}{9}\selectfont\it\hskip6pt Continued\hfill}\vspace*{2pt}}
%
\newenvironment{derive}{\leftskip6pt\rightskip\leftskip\advance\mathindent5pt%
   \par\addvspace{10pt plus2pt}%
   \refstepcounter{experiment}%
\setbox\tempbox=\vbox\bgroup%   
\par\addvspace{6pt}%
\noindent\Derive {\it Experiment \theexperiment}%
\par\addvspace{1pt}\noindent\ignorespaces
}{%
\par\addvspace{4pt}\egroup
\tempdimen\pagegoal
\advance\tempdimen-\pagetotal
\ifdim\ht\tempbox > \tempdimen
\advance\tempdimen-18pt
\ifodd\c@page
\advance\tempdimen-\baselineskip
\advance\tempdimen-7pt
\setbox1=\vsplit\tempbox to \tempdimen
\firstdim\ht\tempbox
\setbox2=\vbox{\hbox{\box1}\hbox{\continued}}
\advance\tempdimen\baselineskip
\advance\tempdimen7pt
%\ifODDpage 
   \vbox to \tempdimen{\hrule width\hsize height.5pt
   \hbox to \textwidth{\vrule height\tempdimen width.5pt\hfill\box2\hss\vrule height\tempdimen width.5pt}
   \hrule width\hsize height.5pt}%
\advance\tempdimen20pt
\advance\firstdim\baselineskip
\advance\firstdim2pt
\setbox2=\vbox{\nextpagecontinued\hbox{\box\tempbox}}
\vbox to \firstdim{\hrule width\hsize height.5pt\hbox to \textwidth{\vrule height\firstdim width.5pt\hfill\box2\hss\vrule height\firstdim width.5pt}\hrule width\textwidth height.5pt}
\else
 \setbox1=\vsplit\tempbox to \tempdimen
\firstdim\ht\tempbox
%  \advance\firstdim-20pt
  \vbox to \tempdimen{\hrule width\hsize height.5pt
   \hbox to \textwidth{\vrule height\tempdimen width.5pt\hfill\box1\hss\vrule height\tempdimen width.5pt}}
   \vbox to \firstdim{\hbox to \textwidth{\vrule height\firstdim width.5pt\hfill\box\tempbox\hss\vrule height\firstdim width.5pt}\hrule width\textwidth height.5pt}
 \fi
\else
  \tempdimen\ht\tempbox
  \vbox to \tempdimen{\hrule width\hsize height.5pt
  \hbox to \textwidth{\vrule height\tempdimen width.5pt\hfill\box\tempbox\hss\hfill\vrule height\tempdimen width.5pt}\hrule width\hsize height.5pt}
\fi
\par\addvspace{8pt plus2pt}
}
%
%
\newcommand{\Derive}{$\cal DERIVE$ }
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  TheoremLike Env %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{theorem}[1]{%
\addvspace{22pt plus6pt minus6pt}
\setbox\tempbox=\vbox\bgroup\par\addvspace{6pt}{\hsize27pc\noindent\subsectionfont\Black #1\par}\addvspace{1pt}\noindent\hsize27pc\linewidth27pc\ignorespaces
}{%
\par\addvspace{6pt}\egroup
\noindent\Gryten\vrule height\ht\tempbox width\textwidth
\vskip-\ht\tempbox\hbox to \textwidth{\hfill\box\tempbox\hfill}
\addvspace{22pt plus6pt minus6pt}
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End TheoremLike Env %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Reference Section   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newif\if@openbib\@openbibfalse

\newdimen\bibindent
\bibindent=1.5em
\newenvironment{thebibliography}[1]
     {\chapter*{\bibname
        \@mkboth{\uppercase{\bibname}}{\uppercase{\bibname}}}%
      \list{\@biblabel{\arabic{enumiv}}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \if@openbib
              \advance\leftmargin\bibindent
              \itemindent -\bibindent
              \listparindent \itemindent
              \parsep \z@
            \fi
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\arabic{enumiv}}}%
      \if@openbib
        \renewcommand\newblock{\par}
      \else
        \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
      \fi
      \sloppy\clubpenalty4000\widowpenalty4000%
      \sfcode`\.=\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\newcommand\newblock{}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Reference Section   %%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Appendix   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \renewcommand\@chapapp{\appendixname}%
  \renewcommand\thechapter{\Alph{chapter}}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End Appendix   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Table of contents%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\@pnumwidth{1.55em}
\newcommand\@tocrmarg {2.55em}
\newcommand\@dotsep{4.5}
\setcounter{tocdepth}{1}

%
\newcommand\tableofcontents{%\@toctrue%
      \@restonecolfalse
      \section*{\contentsname}
    \@starttoc{toc}%
%    \if@restonecol\twocolumn\fi
\par\addvspace{19pt}\noindent}
%
\newcommand\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \begingroup
      \setlength\@tempdima{3em}%
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}
    \endgroup
  \fi}
%
\newcommand\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \setlength\@tempdima{1pc}%
  \begingroup
\def\numberline##1{\hskip-64pt\colorbox{Gryten}{\hbox to 50pt{\hfill ##1}}\hspace*{8pt}}
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode 
      \advance\leftskip\@tempdima\tocfont
      \hskip -\leftskip
       #1\nobreak\hfill \nobreak\hb@xt@\@pnumwidth{\hss #2}\par\addvspace{4pt}
      \penalty\@highpenalty
   \endgroup
  \fi}
%
\newcommand\l@section[2]{\let\tocfont\rmfamily%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \setlength\@tempdima{1pc}%
  \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode 
      \advance\leftskip\@tempdima%\tocfont
      \hskip -\leftskip\normalsize%\bfseries
%      {\mdseries #1}\hspace*{1em}{\mdseries #2}\par\addvspace{3pt}
       #1\nobreak\hfill \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \addvspace{3pt}\penalty\@highpenalty
   \endgroup
  \fi}
%
%
\def\numberline#1{\hskip-64pt\hbox to 52pt{\hfill\tocfont #1}\hspace*{1pc}}
%
%\newcommand\l@section      {\@dottedtocline{1}{1.3em}{2.3em}}
\newcommand\l@subsection   {\@dottedtocline{2}{3.8em}{3.2em}}
\newcommand\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\newcommand\l@paragraph    {\@dottedtocline{4}{10em}{5em}}
\newcommand\l@subparagraph {\@dottedtocline{5}{12em}{6em}}
\newcommand\listoffigures{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename
      \@mkboth{\uppercase{\listfigurename}}%
              {\uppercase{\listfigurename}}}%
    \@starttoc{lof}%
    \if@restonecol\twocolumn\fi
    }
\newcommand\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
%
\newcommand\listoftables{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listtablename
      \@mkboth{\uppercase{\listtablename}}{\uppercase{\listtablename}}}%
    \@starttoc{lot}%
    \if@restonecol\twocolumn\fi
    }
\let\l@table\l@figure
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End Output Routine  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\Qauthor#1{\marginpar{\fontsize{6}{8}\selectfont\bf\raggedright #1}}
\let\qtoa\Qauthor
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Initialization  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%
%%%
\pagestyle{headings}
\pagenumbering{arabic}      % Arabic page numbers
%\if@twocolumn
%\twocolumn
%\else
%\onecolumn
%\fi
\hyphenation{com-pu-ter}
\endinput
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End Initialization  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
