%%
%% smpg.sty: Supports font sizes 10pt, 11pt and 12pt
%%
%% Santiago M. Pericas-G.
%%   Boston University
%%  santiago@cs.bu.edu
%%
%% (Based on latex8.sty by Paolo Ienne)
%%

%%
%% Use charter as default family
%%
\usepackage{charter}

%%
%% Required packages
%%
\usepackage{ifthen}

%%
%% Heading fonts (sans)
%%
\ifthenelse{\@ptsize = 0}  % 10pt
{\font\headingfont  = phvb at 10pt
 \font\headingfive  = phvb at 10pt
 \font\headingfour  = phvb at 10pt
 \font\headingthree = phvb at 11pt
 \font\headingtwo   = phvb at 12pt
 \font\headingone   = phvb at 16pt

 \def\section{\@startsection {section}{1}{\z@}
   {24pt plus 2pt minus 2pt}{12pt plus 1pt minus 1pt} {\headingtwo}} 
 \def\subsection{\@startsection {subsection}{2}{\z@}
   {20pt plus 2pt minus 2pt}{10pt plus 1pt minus 1pt} {\headingthree}}
 \def\subsubsection{\@startsection {subsubsection}{3}{\z@}
   {14pt plus 2pt minus 2pt}{8pt plus 1pt minus 1pt} {\headingfour}}
 \def\subsubsubsection{\@startsection {subsubsubsection}{4}{\z@}
   {8pt plus 2pt minus 2pt}{6pt plus 1pt minus 1pt} {\headingfive}}}
{}

\ifthenelse{\@ptsize = 1}  % 11pt
{\font\headingfont  = phvb at 11pt
 \font\headingfive  = phvb at 11pt
 \font\headingfour  = phvb at 11pt
 \font\headingthree = phvb at 12pt
 \font\headingtwo   = phvb at 13pt
 \font\headingone   = phvb at 18pt

 \def\section{\@startsection {section}{1}{\z@}
   {26pt plus 2pt minus 2pt}{14pt plus 1pt minus 1pt} {\headingtwo}} 
 \def\subsection{\@startsection {subsection}{2}{\z@}
   {22pt plus 2pt minus 2pt}{12pt plus 1pt minus 1pt} {\headingthree}}
 \def\subsubsection{\@startsection {subsubsection}{3}{\z@}
   {16pt plus 2pt minus 2pt}{10pt plus 1pt minus 1pt} {\headingfour}}
 \def\subsubsubsection{\@startsection {subsubsubsection}{4}{\z@}
   {10pt plus 2pt minus 2pt}{8pt plus 1pt minus 1pt} {\headingfive}}}
{}

\ifthenelse{\@ptsize = 2}  % 12pt
{\font\headingfont  = phvb at 12pt
 \font\headingfive  = phvb at 12pt
 \font\headingfour  = phvb at 12pt
 \font\headingthree = phvb at 13pt
 \font\headingtwo   = phvb at 14pt
 \font\headingone   = phvb at 18pt

 \def\section{\@startsection {section}{1}{\z@}
   {28pt plus 2pt minus 2pt}{16pt plus 1pt minus 1pt} {\headingtwo}} 
 \def\subsection{\@startsection {subsection}{2}{\z@}
   {24pt plus 2pt minus 2pt}{14pt plus 1pt minus 1pt} {\headingthree}}
 \def\subsubsection{\@startsection {subsubsection}{3}{\z@}
   {18pt plus 2pt minus 2pt}{12pt plus 1pt minus 1pt} {\headingfour}}
 \def\subsubsubsection{\@startsection {subsubsubsection}{4}{\z@}
   {12pt plus 2pt minus 2pt}{10pt plus 1pt minus 1pt} {\headingfive}}}
{}

%%
%% Dimensions, gaps, ... (based on latex8.sty)
%% 
\setlength{\textheight}{8.875in}
\setlength{\textwidth}{6.875in}
\setlength{\columnsep}{0.3125in}
\setlength{\topmargin}{0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.304in}
\setlength{\evensidemargin}{-.304in}

%%
%% Main title
%%
\def\@maketitle
   {
   \newpage
   \null
   \vskip .375in 
   \begin{center}
      {\headingone \@title \par} 
      % additional two empty lines at the end of the title 
      \vspace*{24pt} 
      {
      \large 
      \lineskip .5em
      \begin{tabular}[t]{c}
         \@author 
      \end{tabular}
      \par
      } 
      % additional small space at the end of the author name 
      \vskip .5em 
      {
       \large 
      \begin{tabular}[t]{c}
         \@affiliation 
      \end{tabular}
      \par 
      \ifx \@empty \@email
      \else
         \begin{tabular}{r@{~}l}
            E-mail: & {\tt \@email}
         \end{tabular}
         \par
      \fi
      }
      % additional empty line at the end of the title block 
      \vspace*{12pt} 
   \end{center}
   } 

%%
%% Abstract
%%
\def\abstract
   {%
   \centerline{\headingtwo Abstract}%
   \vspace*{12pt}%
   \it%
   }

\def\endabstract
   {
   % additional empty line at the end of the abstract 
   \vspace*{12pt} 
   }

%%
%% Miscellaneous
%%
\def\affiliation#1{\gdef\@affiliation{#1}} \gdef\@affiliation{}
\def\email#1{\gdef\@email{#1}}
\gdef\@email{}
\newlength{\@ctmp}
\newlength{\@figindent}
\setlength{\@figindent}{1pc}

%%
%% Captions
%%
\long\def\@makecaption#1#2{
   \vskip 6pt
   \setbox\@tempboxa\hbox{\headingfont\noindent #1.~#2} 
   \setlength{\@ctmp}{\hsize}
   \addtolength{\@ctmp}{-\@figindent}\addtolength{\@ctmp}{-\@figindent} 
   % IF longer than one indented paragraph line
   \ifdim \wd\@tempboxa >\@ctmp
      % THEN set as an indented paragraph
      \begin{list}{}{\leftmargin\@figindent \rightmargin\leftmargin} 
         \item[]\headingfont #1.~#2\par
      \end{list}
   \else
      % ELSE center
      \hbox to\hsize{\hfil\box\@tempboxa\hfil} 
   \fi}

%%
%% Add the period after section numbers 
%%
\newcommand{\Section}[1]{\section{\hskip -1em.~#1}} 
\newcommand{\SubSection}[1]{\subsection{\hskip -1em.~#1}}

