% BETA version 0.2
%
% CANADIAN JOURNAL OF ELECTRICAL AND COMPUTER ENGINEERING
%
% STYLE FILE FOR PRODUCING PAPERS WITH LATEX
% 
% Prepared by Mark Bachmann, Bachmann Communications Inc.
% Created April 2000. Most recently revised in November 2007.
% Special thanks to Michael Adams of the University of Victoria for his 
% assistance in revising and debugging the original style file.
%
% Please send your questions and comments to markbach@golden.net

%===================================================================
% REQUIRED PACKAGES
\RequirePackage{times}% This package defines default typefaces and fonts.
\RequirePackage{graphicx}% This package provides the ability to insert image files. 
\RequirePackage{epstopdf}% This package allows both PDF and EPS images to be used.
\RequirePackage{picinpar}% This package handles the insertion of photos in the biopic environment.
\RequirePackage{sectsty}% This package is needed for the section-heading definitions.
\RequirePackage{color}% This package provides the gray background in tables.
\RequirePackage{fancyheadings}% This package handles running heads and footers.

%===================================================================
% TITLE/ABSTRACT/AUTHOR BLOCK AT START OF PAPER
\newcommand{\TITLE}[2]{\title{\begin{minipage}{36pc}\vspace*{1.9pc}\centering
\renewcommand{\baselinestretch}{.9}\huge\textsf{\huge#1\\[1.6pc]}\textsf{\huge#2\\ \vspace{.4pc}}\end{minipage}}}
\newcommand{\ABSTRACT}[1]{\date{\parbox{36pc}{\renewcommand{\baselinestretch}{1}
\scriptsize#1}}}
\newcommand{\AUTHOR}[1]{\author{\begin{minipage}{36pc}\renewcommand{\baselinestretch}{.9}
\normalsize\begin{center}\scalebox{1.1}{\textsf{#1}}\vspace{1pc}\end{center}\end{minipage}}}
\newcommand{\RULE}{\hspace*{-3.5pc}\rule[-.5pc]{43pc}{0.5pt}\\[-.7pc]}

%===================================================================
% FORMATTING FOR SECTION HEADS
% This code adds periods and some space after section, subsection, and subsubsection headings. It was taken, with minor modifications, from the PDF documentation for the sectsty package (v2.0.2) by Rowland McDonnell. 
%\makeatletter
%\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
%{\normalfont the#1\endcsname\quad}% default
%{\csname #1@cntformat\endcsname}% individual control
%}
%\def\section@cntformat{\thesection.\quad}
%\def\subsection@cntformat{\thesubsection.\quad}
%\def\subsubsection@cntformat{\thesubsubsection.\quad}
%\makeatother

% This definition sets the default text size.
\def\normalsize{\small}

% These redefinitions specify type styles for the various sectioning numbers.
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\thesection.\Alph{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}

% These settings specify type styles for various headings.
\sectionfont{\small\centering}
\subsectionfont{\small}
\subsubsectionfont{\small\itshape}

% These new commands are the only way I could come up with to adjust the spacing before and after subsections and subsubsections in the way I wanted. They require that the sectioning commands start with a capital S.
\newcommand{\Section}[1]{\section{#1}}
\newcommand{\Subsection}[1]{\vspace{-1.2pc}\subsection{#1\vspace{-1.7\baselineskip}}}
\newcommand{\Subsubsection}[1]{\vspace{-1.2pc}\subsubsection{#1\vspace{-1.7\baselineskip}}}
\newcommand{\Sectionnn}[1]{\section*{#1}}
\newcommand{\Subsectionnn}[1]{\vspace{-1.2pc}\subsection*{#1\vspace{-1.7\baselineskip}}}
\newcommand{\Subsubsectionnn}[1]{\vspace{-1.2pc}\subsubsection*{#1\vspace{-1.7\baselineskip}}}

%===================================================================
% FORMATTING FOR FIGURES AND TABLES
% This new command defines the appearance of tables.
\newcommand{\tableformat}{\fboxsep .2pc \definecolor{light}{gray}{.85}
\noindent\small \fcolorbox{black}{light}}

% This code defines the appearance of figure captions.
% Michael, this code is supposed to set the caption to scriptsize type and the "Figure X:" portion of the caption in boldface. It works in your CJECE2 style file, but here it seems to be ignored. Do you have any idea what the problem could be?
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{\scriptsize {\bfseries #1:} #2}%
  \ifdim \wd\@tempboxa >\hsize
    {\scriptsize {\bfseries #1:} #2}\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

%===================================================================
% FORMATTING FOR BIOGRAPHIES WITH AND WITHOUT PHOTOS
% This code requires the picinpar package.
\newenvironment{biopic}[1]{\begin{minipage}{21pc}\renewcommand{\baselinestretch}{1.05}\scriptsize\begin{window}[0,l,{\includegraphics[width=6pc,height=8pc]{#1}},{}]}{\end{window}\end{minipage}}

\newenvironment{bionopic}{\begin{minipage}{21pc}\renewcommand{\baselinestretch}{1.05}\scriptsize}{\end{minipage}}

%===================================================================
% COMMAND FOR LEFT- AND RIGHT-PAGE RUNNING HEADS
% This command should be placed somewhere on the second page of the paper.

\newcommand{\runningheads}[2]{\pagestyle{fancy}
\headrulewidth 0pt
\lhead[\thepage]{}\rhead[]{\thepage}\cfoot[]{}
\chead[#1]%
{#2} 
\lfoot{}
}

%===================================================================
% GENERAL FORMATTING
% The definitions below set the page parameters and various global settings.

% VERTICAL MEASURES; 11in height; 1.5pc top margin top; 1pc bottom 
%margin
\topmargin -4.5pc
\headsep 1pc
\textheight 59pc 
\footskip 2pc

% HORIZONTAL MEASURES; 8.25in width; 3.5pc inner margin; 3pc outer 
%margin
\oddsidemargin -2.5pc
\evensidemargin -1.5pc
\textwidth 43pc
\columnsep 1pc

% LEADING, sentence, paragraph, figure and table spacing
\renewcommand{\baselinestretch}{.9}
\addtolength{\parskip}{0.85pc}
\frenchspacing
\tabcolsep 1pt
%\extrarowheight 1pt
\setlength{\textfloatsep}{2pc}
\setlength{\dblfloatsep}{2pc}
\fboxsep 1pc




