\NeedsTeXFormat{LaTeX2e}
\def\filedate{2005/01/05}
\def\fileversion{0.99}
\ProvidesClass{hozeman}[\filedate\ Document Package for Technical Manuals]

\newif\if@docuver\@docuverfalse
\newif\if@latin\@latinfalse
\newif\if@symbol\@symbolfalse
\newif\if@pdfbookmark\@pdfbookmarkfalse
\newif\if@displayfilename\@displayfilenamefalse
\newif\if@vartwo\@vartwofalse
\newif\if@flfig\@flfigfalse
\newif\if@flchp\@flchpfalse

%page-tab when the paper is A4.
\newcounter{pagetabx}
\newcounter{pagetaby}
\newcounter{pagetabwidth}
\newcounter{pagetabheight}
\newcounter{pagetabysep}
\setcounter{pagetabx}{198}
\setcounter{pagetaby}{220}
\setcounter{pagetabwidth}{10}
\setcounter{pagetabheight}{10}
\setcounter{pagetabysep}{-15}
\newcommand\pagetabswitch{}

\DeclareOption{a3paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{a4paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{a5paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{a6paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{b3paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{b4paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{b5paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{b6paper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{letterpaper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{legalpaper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{executivepaper}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{ebook}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{landscape}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{9pt}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{10pt}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{11pt}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{12pt}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{14pt}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{17pt}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{twoside}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{oneside}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{onecolumn}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{twocolumn}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{openright}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{openleft}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{openany}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{final}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{draft}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{ms}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{showtrims}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{leqno}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{fleqn}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{openbib}{\PassOptionsToClass\CurrentOption{memoir}}
\DeclareOption{article}{\PassOptionsToClass\CurrentOption{memoir}}

\DeclareOption{figuresright}{\PassOptionsToPackage\CurrentOption{rotating}}
\DeclareOption{dvipdfm}{\PassOptionsToPackage\CurrentOption{graphicx}}
\DeclareOption{latin}{\@latintrue}
\DeclareOption{symbol}{\@symboltrue}
\DeclareOption{dispffn}{\@displayfilenametrue}
\DeclareOption{bookmark}{\@pdfbookmarktrue}
\DeclareOption{docuver}{\@docuvertrue}
\DeclareOption{pspagetab}{\renewcommand\pagetabswitch{\pagetab}}
\DeclareOption{pdfpagetab}{\renewcommand\pagetabswitch{\pagetab}\setcounter{pagetabx}{190}}
\DeclareOption{vartwo}{\@vartwotrue}
\DeclareOption{flfig}{\@flfigtrue}%default is centering
\DeclareOption{flchp}{\@flchptrue}%default is reggedright

\DeclareOption*{}
\ExecuteOptions{a4paper,figuresright}
\ProcessOptions

\LoadClass{memoir}
\RequirePackage{geometry}
\RequirePackage{calc}
\RequirePackage{ifthen}
\RequirePackage{graphicx}
\RequirePackage{here}
\RequirePackage{eso-pic}
\RequirePackage{rotating}
\RequirePackage{color}
\RequirePackage{hhline}
\RequirePackage{colortbl}
\RequirePackage{wasysym}
\RequirePackage{amssymb}
\RequirePackage{ifsym}
\RequirePackage{textcomp}
\RequirePackage{fancybox}
\RequirePackage{xr-hyper}
%\RequirePackage{tabularx}
%\RequirePackage{makeidx}

%section numbering
\setsecnumdepth{subsubsection}
\maxsecnumdepth{subsubsection}
\settocdepth{subsection}

% paper format

\newcommand{\@foliomarks}{%
 \renewcommand{\chaptermark}[1]{\pagetabswitch\markboth{##1}{}}
 \renewcommand{\sectionmark}[1]{\markright{\thesection~##1}} 
}

% folio %
\newcommand\hffont{}

\newcommand\standardmargin{
\geometry{%
left=.15\paperwidth,
right=.15\paperwidth,
top=.11\paperheight,
bottom=.11\paperheight,
textwidth=.7\paperwidth,
textheight=.78\paperheight,
footskip=.05\paperheight
}}

\newcommand\standardfolio{
\makepsmarks{ruled}{\@foliomarks}
\makeevenhead{ruled}{\hffont\bfseries\thepage}{}{\hffont\leftmark}
\makeoddhead{ruled}{\hffont\rightmark}{}{\hffont\bfseries\thepage}
\makeevenfoot{ruled}{}{}{\DocuInfo}
\makeoddfoot{ruled}{\docuversion}{}{}
\pagestyle{ruled}
}

\newcommand\vartwomargin{
\geometry{%
asymmetric,
bindingoffset=.05\paperwidth,
left=.25\paperwidth,
right=.1\paperwidth,
top=.11\paperheight,
bottom=.11\paperheight,
textwidth=.6\paperwidth,
textheight=.78\paperheight,
marginparwidth=.15\paperwidth,
marginparsep=1em,
footskip=.05\paperheight
}}

\newcommand\vartwofolio{
\copypagestyle{vartwo}{companion}
\setlength{\headwidth}{\textwidth}
\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{\marginparwidth}
\makerunningwidth{vartwo}{\headwidth}
\makeheadrule{vartwo}{\headwidth}{\normalrulethickness}
\makepsmarks{vartwo}{\@foliomarks}
\makeheadposition{vartwo}{flushright}{flushright}{flushright}{flushright}
\makeevenhead{vartwo}{\hffont\bfseries\thepage}{}{\hffont\leftmark}
\makeoddhead{vartwo}{\hffont\rightmark}{}{\hffont\bfseries\thepage}
\makeevenfoot{vartwo}{}{}{\DocuInfo}
\makeoddfoot{vartwo}{\docuversion}{}{}
\setsecindent{-\marginparwidth}
\setsubsecindent{-\marginparwidth}
\setsubsubsecindent{-\marginparwidth}
\pagestyle{vartwo}
}

\makeoddhead{plain}{}{}{\hffont\bfseries\thepage}
\makeoddfoot{plain}{}{}{}

\newcommand\docuversion{}
\if@docuver%
  \renewcommand\docuversion{\hffont\number\year--\number\month--\number\day}
\fi

\newlength\docuinfowidth
\newcommand\DocuInfo{}
\newcommand\docuinfo[1]{%
 \settowidth\docuinfowidth{~\hffont#1~}%
 \addtolength\docuinfowidth{7pt}%
 \renewcommand\DocuInfo{\rule{\docuinfowidth}{.4pt}\\[-1pt]\rule{4pt}{16pt}\raisebox{1ex}{~\hffont#1~}}
}


% table of contents and list of figure/table
%\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
%\newcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
%\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
%\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}

% caption %
\newcommand\capfont{\rmfamily\small\bfseries}
\captionnamefont{\capfont}
\captiontitlefont{\capfont}
\newfixedcaption{\figcaption}{figure}
\newfixedcaption{\tabcaption}{table}

\renewcommand{\fnum@figure}[1]{\figurename~\thefigure:~}
\renewcommand{\fnum@table}[1]{\tablename~\thetable:~}
\setlength\abovecaptionskip{.5ex plus .25ex minus .25ex}
\setlength\belowcaptionskip{.5ex plus .25ex minus .25ex}

% spaces
\setlength\parskip{.4\baselineskip}
\setlength{\parindent}{0em}
\setlength\partopsep{-.25\parskip}

\newlength\entitysep
%\setlength\entitysep{1.25ex plus .25ex minus .25ex}
\setlength\entitysep{\floatsep}

\newlength{\leftboxwidth}
\newlength{\rightboxwidth}
\newlength{\interwidth}
\setlength\interwidth{.5em}
\newlength\extrawidth
\setlength\extrawidth{3.5\interwidth}

\newcommand{\boxalign}{t}
\newcommand{\figalign}{\mbox{}\\[-.75\baselineskip]}
\newcommand{\figscale}{1}

% safety %
\newsavebox{\safetymark}
\newcommand{\alertlabelfont}{\normalsize\sffamily}
\newcommand{\alertfont}{\small}

\newcommand\alert[3][\@empty]{% 
 \ifx #1\@empty 
   \sbox{\safetymark}{\includegraphics{CautionMark}}
 \else 
   \sbox{\safetymark}{\includegraphics{#1}}
 \fi 
 \settowidth\leftboxwidth{\ifthenelse{\boolean{@latin}}{\alertlabelfont\MakeUppercase{#2}}{\alertlabelfont#2}}  
 \ifthenelse{\boolean{@symbol}}{\addtolength\leftboxwidth{1.2\wd\safetymark}}{} 
 \setlength{\rightboxwidth}{\linewidth-\leftboxwidth-\extrawidth}  
 \vspace{\entitysep}\par\noindent%
 \mbox{%
 \begin{minipage}[t]{\leftboxwidth}
   \ifthenelse{\boolean{@symbol}}{\raisebox{-1.2ex}{\usebox{\safetymark}}}{}%
   \alertlabelfont\ifthenelse{\boolean{@latin}}{\MakeUppercase{#2}}{#2}%
 \end{minipage}\hspace{\interwidth}
 \begin{minipage}[t]{\rightboxwidth}
  \vspace{-3.5ex}\hrulefill\par
  \alertfont #3 
  \par\vspace{-1.5ex}\hrulefill
 \end{minipage}%
 }
 \vspace{\entitysep}\par
}

%illustration
\newcommand{\placecapfig}[3][\@empty]{%
\begin{figure}[H]\if@flfig\else\centering\fi
\includegraphics[scale=\figscale]{#2}\ifthenelse{\boolean{@displayfilename}}{\dispfigfile{#2}}{}%
\caption{#3}\ifx #1\@empty \else \label{#1} \fi%  
\vspace{-.5\baselineskip}\end{figure}%
}

\newcommand{\placefig}[2][\@empty]{% 
\begin{figure}[H]\if@flfig\else\centering\fi
\includegraphics[scale=\figscale]{#2}\ifthenelse{\boolean{@displayfilename}}{\dispfigfile{#2}}{} %
\ifx #1@empty \else{\par#1}\fi%
\end{figure}
}

\newcommand{\placesidecapfig}[3][\@empty]{ % rotated figure with caption
\begin{sidewaysfigure}%
\includegraphics[scale=\figscale]{#2}\ifthenelse{\boolean{@displayfilename}}{\dispfigfile{#2}}{} %
\captionstyle{\raggedright} \caption{#3} \ifx #1\@empty \else \label{#1} \fi %
\end{sidewaysfigure}
}

\newcommand{\illustcapfig}[4][\@empty]{ % illustration with caption and label
\settowidth{\leftboxwidth}{\includegraphics[scale=\figscale]{#2}} 
\setlength{\rightboxwidth}{\linewidth-\leftboxwidth-\extrawidth} 
\vspace{\entitysep}\par\noindent%
 \mbox{%
 \begin{minipage}[\boxalign]{\leftboxwidth}
  \figalign
  \includegraphics[scale=\figscale]{#2}\ifthenelse{\boolean{@displayfilename}}{\dispfigfile{#2}}{}%   
  \captionstyle{\raggedright}%  
   \figcaption{#3}%
  \ifx #1\@empty\else \label{#1} \fi
 \end{minipage}\hspace{\interwidth}
 \begin{minipage}[\boxalign]{\rightboxwidth}%\small
  #4
 \end{minipage}
 }\vspace{\entitysep}\par
}
\newcommand{\rillustcapfig}[4][\@empty]{ % illustration with caption and label
\settowidth{\rightboxwidth}{\includegraphics[scale=\figscale]{#2}} 
\setlength{\leftboxwidth}{\linewidth-\leftboxwidth-\extrabox}
 \vspace{\entitysep}\par\noindent%
 \mbox{%
 \begin{minipage}[\boxalign]{\leftboxwidth}
  #4
 \end{minipage}\hspace{\interwidth}
 \begin{minipage}[\boxalign]{\rightboxwidth}
  \includegraphics[scale=\figscale]{#2}\ifthenelse{\boolean{@displayfilename}}{\dispfigfile{#2}}{}%
  \captionstyle{\raggedright}%
  \figcaption{#3} \ifx #1\@empty  \else \label{#1}  \fi
 \end{minipage}% 
 }\vspace{\entitysep}\par%
}
\newcommand{\illustfig}[2]{ % illustration without caption
\settowidth{\leftboxwidth}{\includegraphics[scale=\figscale]{#1}} 
\setlength{\rightboxwidth}{\linewidth-\leftboxwidth-\extrawidth} 
 \vspace{\entitysep}\par\noindent%
 \mbox{%
 \begin{minipage}[\boxalign]{\leftboxwidth}
  \figalign
  \includegraphics[scale=\figscale]{#1}\ifthenelse{\boolean{@displayfilename}}{\dispfigfile{#1}}{}%
 \end{minipage}\hspace{\interwidth}
 \begin{minipage}[\boxalign]{\rightboxwidth}%\small
  #2  
 \end{minipage}
 }\vspace{\entitysep}\par
}
\newcommand{\rillustfig}[2]{ % illustration without caption
\settowidth{\rightboxwidth}{\includegraphics[scale=\figscale]{#1}} 
\setlength{\leftboxwidth}{\linewidth-\leftboxwidth-\extrawidth}
 \vspace{\entitysep}\par\noindent%
 \mbox{
 \begin{minipage}[\boxalign]{\leftboxwidth}%\small
  #2  
 \end{minipage}\hspace{\interwidth}
 \begin{minipage}[\boxalign]{\rightboxwidth}    
  \includegraphics[scale=\figscale]{#1}\ifthenelse{\boolean{@displayfilename}}{\dispfigfile{#1}}{}%
 \end{minipage} 
 }
 \vspace{\entitysep}\par
}
\newcommand\linefig[2][\@empty]{ % figure in text line
\ifx #1\@empty \raisebox{-.5ex}{\includegraphics[scale=\figscale]{#2}}%
\else \raisebox{#1}{\includegraphics[scale=\figscale]{#2}}%
\fi\ifthenelse{\boolean{@displayfilename}}{\displfigfile{#2}}{}%
}

% table %
\newcommand{\tabfont}{\small\rmfamily}
\newcommand\specitem{\textbf{Item}}
\newcommand\specdescription{\textbf{Description}}

\newenvironment{spec} % for specification without caption
{\startgrayrow
 \begin{table}[H] \centering \tabfont
 \begin{tabular}{p{.3\linewidth}p{.55\linewidth}}\hhline{--} 
 \specitem & \specdescription \\\hhline{--} 
}{\hhline{--}\end{tabular}\end{table}} 


\newenvironment{capspec}[2][\@empty] % for specification with caption and label
{\begin{table}[H]
 \caption{#2} \ifx #1\@empty \else \label{#1}\fi% 
 \centering \tabfont\startgrayrow
 \begin{tabular}{p{.3\linewidth}p{.55\linewidth}}\hhline{--}
 \specitem & \specdescription \\\hhline{--} 
}{\hhline{--}\end{tabular}\end{table}}


\newenvironment{captable}[2][\@empty]
{\startgrayrow
 \begin{table}[H]
 \caption{#2} \ifx #1\@empty \else \label{#1}\fi 
 \centering \tabfont}
{\end{table}}

\newenvironment{nocaptable} % table without caption; it's just for uniforming every tabular
{\startgrayrow\begin{center}\tabfont}
{\end{center}}

% diplaying figure file name %
\newcommand{\dispfigfile}[1]{%
 \par{\scriptsize$#1$}%\phantomsection
 \addcontentsline{lff}{subsection}{\thesection~$\mathrm{#1}$}
}
\newcommand{\displfigfile}[1]{%
 {\scriptsize$#1$}%\phantomsection
 \addcontentsline{lff}{subsection}{\thesection~$\mathrm{#1}$}
}
\newcommand\lffname{List of Figure File}
\newcommand{\listoffigurefiles}{
\clearpage\chapter*{\lffname}\markboth{\lffname}{}
\@starttoc{lff}
}
% displaying queries %
\newcommand\queryfont{\slshape}
\newcommand{\query}[1][\@empty]{
 \fbox{?} %\phantomsection
 \ifx #1\@empty \addcontentsline{loq}{subsection}{\thesection~?}%
 \else {\queryfont #1} \addcontentsline{loq}{subsection}{\thesection~? #1}%
 \fi 
}
\newcommand\loqname{List of Query}
\newcommand{\listofqueries}{%
  \clearpage\chapter*{\loqname}\markboth{\loqname}{}
  \@starttoc{loq}
}



\definecolor{tabback}{gray}{0.07}
\newcommand\pagetabfont{\LARGE\sffamily\bfseries}
\newcommand\pagetab{%
 \ClearShipoutPicture
 \if@mainmatter
 \AddToShipoutPicture{%  
  \setlength{\unitlength}{1mm}%
  \ifthenelse{\isodd{\value{page}}}%
   {\put(\value{pagetabx}, \value{pagetaby})%
    {\colorbox{tabback}{\makebox(\value{pagetabwidth},\value{pagetabheight}){\textcolor{white}{\pagetabfont~\thechapter~}}}}    
    }{}         
 }%
 \addtocounter{pagetaby}{\value{pagetabysep}} 
 \fi
}

\newcommand\clearpagetab{
\if@mainmatter
\else
\ClearShipoutPicture
\fi
}


% index %
\newcommand*\IndexBf[1]{\textbf{\hyperpage{#1}}}
\newcommand\indef[1]{\index{#1|IndexBf}}
\newcommand\term[1]{\index{#1}#1}
\newcommand\termdef[1]{\index{#1|IndexBf}#1}
\newcommand\terms[2]{\term{#1} (\term{#2})}
\newcommand\termsdef[2]{\termdef{#1} (\termdef{#2})}
%ideograph
\newlength\buttonwidth
\newlength\tmpwidth
\newcommand\buttonfont{\sffamily\small}
\newcommand{\button}[2][\@empty]{%
 \setlength{\fboxsep}{2pt}%
 \ifx #1\@empty% 
  \ovalbox{\buttonfont #2}%
 \else%
  \settowidth\buttonwidth{\buttonfont #1}%
  \settowidth\tmpwidth{\buttonfont #2}%
  \ifdim\buttonwidth<\tmpwidth\setlength\buttonwidth{\tmpwidth} \fi%  
  \rule{0pt}{1.25\baselineskip}%
  \ovalbox{\parbox{\buttonwidth}{\renewcommand\baselinestretch{1}\centering\buttonfont#1\\#2}}%
  \vspace{.25\baselineskip}%
 \fi%
}

\newcommand{\buttoni}[2][\@empty]{%
 \setlength{\fboxsep}{2pt}%
 \ifx #1\@empty% 
  \ovalbox{\buttonfont #2}%
  \index{#2}%
 \else%
  \settowidth\buttonwidth{\buttonfont #1}%
  \settowidth\tmpwidth{\buttonfont #2}%
  \ifdim\buttonwidth<\tmpwidth\setlength\buttonwidth{\tmpwidth} \fi%  
  \rule{0pt}{1.25\baselineskip}%
  \ovalbox{\parbox{\buttonwidth}{\renewcommand\baselinestretch{1}\centering\buttonfont#1\\#2}}%
  \vspace{.25\baselineskip}%
  \index{#1 #2}%
 \fi%
}

\newcommand\ui[1]{{\buttonfont #1}}
\newcommand\uii[1]{{\buttonfont #1}\index{#1}}

\newcommand\digitfont{\bfseries\footnotesize}
\newcommand{\digit}[1]{\textifsym{\digitfont #1}}
\newcommand\inch{\textrm{\textacutedbl\ }} 

\newcommand{\cirnum}[1]{%
\ifthenelse{\equal{\f@size}{9}}{{\textcircled{\scriptsize #1}}}{{\textcircled{\footnotesize #1}}}%
}

\newcommand\deflabelfont{\bfseries} 
\newcommand\defmarker{}
\newcommand\defdelim{:}

\newenvironment{deflist}[1][\qquad]
{\begin{list}{}{%
 \firmlist%
 \renewcommand{\makelabel}[1]{\defmarker{\deflabelfont ##1}\defdelim\hfill}%
 \settowidth{\labelwidth}{\defmarker{\deflabelfont #1}\defdelim}%  
 \setlength{\leftmargin}{\labelwidth+\labelsep}
}}{\end{list}}

\newenvironment{indlist}[1][\qquad]
{\begin{list}{}{%
 \firmlist%
 \renewcommand{\makelabel}[1]{\defmarker{\deflabelfont ##1}\defdelim\hfill\index{##1}}%
 \settowidth{\labelwidth}{\defmarker{\deflabelfont #1}\defdelim}%   
 \setlength{\leftmargin}{\labelwidth+\labelsep}
}}{\end{list}}

\newcounter{defenum}
\renewcommand{\thedefenum}{\cirnum{\arabic{defenum}}}

\newenvironment{defenum}[1][\qquad]
{\begin{list}{defenum}{%
 \firmlist%
 \setcounter{defenum}{0} 
 \renewcommand{\makelabel}[1]{\stepcounter{defenum}\thedefenum~{\deflabelfont ##1}\defdelim\hfill}%
 \settowidth{\labelwidth}{\thedefenum~{\deflabelfont #1}\defdelim}%  
 \setlength{\leftmargin}{\labelwidth+\labelsep}
}}{\end{list}}

\newenvironment{indenum}[1][\qquad]
{\begin{list}{defenum}{%
 \firmlist%
 \setcounter{defenum}{0}  
 \renewcommand{\makelabel}[1]{\stepcounter{defenum}\thedefenum~{\deflabelfont ##1}\defdelim\hfill\index{##1}}%
 \settowidth{\labelwidth}{\thedefenum~{\deflabelfont #1}\defdelim}%   
 \setlength{\leftmargin}{\labelwidth+\labelsep}
}}{\end{list}}

\newcommand\defnum[1]{
 \setcounter{defenum}{#1}
 \addtocounter{defenum}{-1}
}




% color %
\definecolor{textgray}{gray}{0.4}
\definecolor{backgray}{gray}{0.93}
\newcommand\grayheadrow{\rowcolor{backgray}}
\newcounter{rowcnt}
\newcommand\startgrayrow{\setcounter{rowcnt}{1}}
\newcommand\startwhiterow{\setcounter{rowcnt}{0}}
\gdef\RowColor{backgray}
\def\grayrow{%
        \rowcolor{\RowColor}%   
        \ifodd\therowcnt
                \gdef\RowColor{backgray}%
        \else
                \gdef\RowColor{white}%
        \fi
        \stepcounter{rowcnt}%
}

% tabular %
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
\newcolumntype{Z}{>{\centering\arraybackslash}X}
\def\hlinewd#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
\reserved@a\@xhline}
\newcommand{\hthickline}{\hlinewd{.75pt}}

\@ifpackageloaded{memhangul}{}{
  \if@latin
   \if@pdfbookmark
    \RequirePackage[dvipdfm]{hyperref}    
   \else
    \RequirePackage[bookmarks=false]{hyperref}
   \fi
   \RequirePackage[onehalfspacing]{setspace}   
  \else
   \if@pdfbookmark
    \RequirePackage[dvipdfm,CJKbookmarks]{hyperref}
    \AtBeginDvi{\special{pdf:tounicode KSCms-UHC-UCS2}}    
   \else
    \RequirePackage[bookmarks=false]{hyperref}
   \fi
   \RequirePackage{memhfixc}
   \RequirePackage{memhangul}   
   %\RequirePackage{parenactive} 
   %\renewcommand\terms[2]{\term{#1}\sparen{\term{#2}}}     
  \fi
  
} 

%PDF
\newcommand\ebook[3][@empty]{
\if@pdfbookmark
\ifx #1\@empty 
 \hypersetup{bookmarksnumbered=false,
  pdftitle={#2},%
  pdfauthor={#3},%
  colorlinks=true,%
  linkcolor=blue}
\else
 \hypersetup{bookmarksnumbered=true,
  pdftitle={#2},%
  pdfauthor={#3},%
  colorlinks=true,%
  linkcolor=blue}
\fi
\fi
}

\newcommand\pbook[3][@empty]{
\if@pdfbookmark
\ifx #1\@empty 
 \hypersetup{bookmarksnumbered=false,%
  pdftitle={#2},%
  pdfauthor={#3}}
 \else
 \hypersetup{bookmarksnumbered=true,%
  pdftitle={#2},%
  pdfauthor={#3}}
 \fi
\fi
}

\newcommand\chpalign{\raggedleft}
\if@flchp\renewcommand\chpalign{\raggedright}\fi

\makechapterstyle{default}{%
  \renewcommand{\chapnamefont}{\chpalign\normalfont\huge\bfseries}
  \renewcommand{\chapnumfont}{\chpalign\normalfont\huge\bfseries}
  \renewcommand{\chaptitlefont}{\chpalign\normalfont\Huge\bfseries}
  \setlength{\beforechapskip}{50pt}
  \setlength{\midchapskip}{20pt}
  \setlength{\afterchapskip}{40pt}
}

%% for Appendix
\makechapterstyle{appendixdefault}{%
  \renewcommand{\prechapternum}{\chapnumfont\@chapapp}
  \renewcommand{\postchapternum}{}
  \renewcommand{\chapternamenum}{\enskip}
  \setlength{\beforechapskip}{50pt}
  \setlength{\midchapskip}{20pt}
  \setlength{\afterchapskip}{40pt}
}  

\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \newcounter{app@section}[chapter]%
  \setcounter{app@section}{0}%
  \newcounter{app@subsection}[app@section]%
  \setcounter{app@subsection}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\Alph{chapter}}%
	\gdef\thesection{\thechapter.\arabic{app@section}}%
  \set@appendix@chapsec
  \renewcommand\hchaptertitlehead{\appendixname\,\thechapter}%
   \xdef\Hy@chapapp{\Hy@appendixstring}%
   \HyOrg@appendix%
  \chapterstyle{appendixdefault}%
}

 \if@vartwo\vartwomargin
 \else\standardmargin
 \fi    

\AtBeginDocument{  
%\renewcommand\l@section{\@dottedtocline{1}{1.5em}{2em}}
%\renewcommand\l@subsection{\@dottedtocline{2}{3.5em}{3em}}
 \if@latin
 \else
  \renewcommand\specitem{\textbf{�׸�}}
  \renewcommand\specdescription{\textbf{����}}
  \renewcommand\contentsname{����}
  \renewcommand\listfigurename{�׸� ���}
  \renewcommand\listtablename{ǥ ���}
  \renewcommand\lffname{�׸� ���� ��� }
  \renewcommand\loqname{���� ��� }    
  \narrowerhangul
  %\SetHangulspace{1.5}{1.1}
  %\adjustquotespacing
  %\noadjustfloatfnspacing
 \fi  
 \if@vartwo\vartwofolio\else\standardfolio\fi
 \chapterstyle{default}    
 \raggedbottom
 \renewcommand\arraystretch{1.2} 
}
\endinput
