%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SQA paper class for LaTeX files (by Semoushin) v1. Apr-23-2005 %%
%%                                                                %%
%% The regular article class commands still exist and may be used.%%
%% 11pt, 12pt and twocolumn options are disabled.                 %%
%%                                                                %%
%% \maketitle make the first page automatically                   %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{sqa}[2005/04/23 SQA paper class]

\DeclareOption{11pt}{\OptionNotUsed}
\DeclareOption{12pt}{\OptionNotUsed}
\DeclareOption{twocolumn}{\OptionNotUsed}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ProcessOptions\relax

\LoadClass[10pt]{article}

\RequirePackage{calc}

%% Title
\renewcommand{\maketitle}{%
 \newpage
 \thispagestyle{plain}
 \begin{center}%
  {%3
   \fontsize{14}{16}\selectfont
   \bfseries
%%   \MakeUppercase{\@title}
   \@title
   \par
  }%3
  \vspace{18pt}%
  {%4
\fontsize{12}{14}\selectfont
   \bfseries\@author
   \par
  }%4
%%  \vspace{14pt}%
  {%5
\fontsize{10}{12}\selectfont
   \def\and{\\\vspace{14pt}}
   \normalfont\@address
   \par
  }%5
 \end{center}
 \vspace{18pt}%
 \fontsize{9}{11}\selectfont
 \noindent\textbf{Abstract:\space}{\@abstract}
 \par
 \vspace{12pt}%
 \fontsize{10}{12}\selectfont
 \noindent\textbf{Keywords:\space}\@keywords
 \par
 \vspace{12pt}%
 \noindent\textbf{Subject Classification:\space}\@subjectclass
 \par
 \vspace{10pt}%
  \fontsize{10}{12}\selectfont
  }% End of \@maketitle

\def\author{\@ifnextchar[{\@getshortauthor}{\@getauthor}}
\def\@getauthor#1{\gdef\@author{#1}\gdef\@shortauthor{#1}}
\def\@getshortauthor[#1]#2{\gdef\@shortauthor{#1}\gdef\@author{#2}}

\newcommand{\address}[1]{\gdef\@address{#1}}
\newcommand{\keywords}[1]{\gdef\@keywords{#1}}
\newcommand{\subjectclass}[1]{\gdef\@subjectclass{#1}}
\renewcommand{\abstract}[1]{\gdef\@abstract{#1}}

\def\sectionLevel{1}
\def\sectionIndent{0pt}
\def\sectionSpaceBefore{12pt}
\def\sectionSpaceAfter{6pt}
\def\sectionStyle{\normalsize\bfseries\MakeUppercase}

\renewcommand{\section}{%
\@startsection{section}{\sectionLevel}{\sectionIndent}{\sectionSpaceBefore}%
                {\sectionSpaceAfter}{\sectionStyle}}%


\def\sectionLevel{2}
\def\sectionIndent{0pt}
\def\sectionSpaceBefore{12pt}%was 12pt
\def\sectionSpaceAfter{12pt}%was 6pt
\def\sectionStyle{\large\bfseries}

\renewcommand{\subsection}{%
 \@startsection{subsection}{\sectionLevel}{\sectionIndent}{\sectionSpaceBefore}%
                {\sectionSpaceAfter}{\sectionStyle}}%


\renewcommand{\@makecaption}[2]{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{\normalsize\fontsize{10}{12}\selectfont #1: #2}%
  \ifdim \wd\@tempboxa >\hsize
    \normalsize\fontsize{10}{12}\selectfont #1: #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

\renewenvironment{thebibliography}[1]
  {\newpage
  \section*{\MakeUppercase\refname\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
   \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 `thebibliography' environment}}%
   \endlist}
\setlength{\oddsidemargin}{0mm}
\setlength{\textheight}{210mm}
\setlength{\textwidth}{149mm}
\setlength{\textfloatsep}{12pt}
\setlength{\abovedisplayskip}{6pt}
\setlength{\belowdisplayskip}{6pt}
\setlength{\parindent}{4ex}
\setlength{\abovecaptionskip}{6pt}
\setlength{\belowcaptionskip}{6pt}
\setlength{\itemsep}{0pt}

\newsavebox{\myfigbox}
\newcommand{\@makefigcaption}[2]{% #1 is Figure 1, #2 is caption text
  \vspace{10pt}\sbox{\myfigbox}{#1. #2}%
  \ifthenelse{\lengthtest{\wd\myfigbox > \linewidth}}%
  {\textit{\textbf{#1}}. #2\par}% Caption is more than one line
  {\begin{flushleft}\textit{\textbf{#1}}. #2\end{flushleft}}
}
\renewcommand{\figure}%
  {\let\@makecaption\@makefigcaption\@float{figure}}

\newsavebox{\mytablebox}
\newcommand{\@maketablecaption}[2]{% #1 is Table 1, #2 is caption text
  \vspace{10pt}\sbox{\mytablebox}{#1. #2}%
  \ifthenelse{\lengthtest{\wd\mytablebox > \linewidth}}%
  {\textrm{\textbf{#1}}. #2\par}% Caption is more than one line
  {\begin{flushleft}\textrm{\textbf{#1}}. #2\end{flushleft}}
}
\renewcommand{\table}%
  {\let\@makecaption\@maketablecaption\@float{table}}


\AtBeginDocument{%

%  \pagestyle{myheadings}
  \maketitle
  \let\maketitle\relax
}

\endinput
