%% 
%% This is file `lect2.sty', generated 
%% on <1995/9/18> with the docstrip utility (2.2i).
%% 
%% The original source files were:
%% 
%% lect2.dtx  (with options: `package')
%% Package to create lecture notes and slides. 




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{lect2}[1995/9/16 For VTC microprocessor lectures; with framed slides]



\DeclareOption{slides}{%
   \AtEndOfClass%
   {%
      \setmarginsrb{15mm}% leftmargin---was 7mm, now 15mm to allow for holes.
                   {4mm}%  topmargin
                   {7mm}%  rightmargin
                   {12mm}% bottommargin --- was 8mm
                   {5mm}%  headheight
                   {12pt}% headsep
                   {0pt}%  footheight---not defined in LaTeX 2e.
                   % Strange: set footskip to 10.25mm, get too much space
                   % between text and footer.  Set it to 10.24 and get way
                   % to little!  This looks like a bug ... no, maybe moves
                   % a line to the next page ...
                   {10.25mm}% footsep
      \articlemag{3}%
      \addtolength{\headheight}{6.6pt}
      \renewcommand{\headwidth}{\textwidth}%
      \lhead[%
               \fancyplain{}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\hspace{0.5em}
                  \subject%
               }%
            }%
      \rhead[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\hspace{0.5em}
                  \subject%
               }%
            ]%
            {%
               \fancyplain{}%
               {\rmfamily\bfseries \thepage}%
            }%
      \lfoot[\fancyplain{}{}]%
            {%
               \fancyplain{\tiny\revision}%
               {%
                  \footnotesize\bfseries\rightmark\mdseries\tiny\mbox{}\\%
                  \protect\revision%
               }%
            }
      \rfoot[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries\leftmark\mdseries\tiny\mbox{}\\%
                  \protect\revision%
               }%
            ]%
            {\fancyplain{}{}}
      \renewcommand{\lectureHead}%
      {%
         \thispagestyle{plain}
         \begin{center}
         \bfseries\large
         \subjectNumber\hspace{0.6em}\subject
         \end{center}
         \vspace{4ex}
      }%
   \setboolean{makeSLIDES}{true} % true for SLIDES
   \typeout{^^JMaking SLIDES^^J}
   }%
}


\DeclareOption{notes}{%
   \PassOptionsToClass{twoside,article,12pt}{seminar}
   \AtEndOfClass%
   {%
      \RequirePackage{slidesec}% Read slidesc.sty for how to make contents.
      \renewcommand{\makeslideheading}{\heading}% Must have slideded.sty!!
      \setmarginsrb{30mm}%  leftmargin
                   {20mm}%  topmargin
                   {30mm}%  rightmargin
                   {20mm}%  bottommargin
                   {5mm}%  headheight
                   {8mm}% headsep
                   {0pt}%  footheight---not defined in LaTeX 2e.
                   % Strange: set footskip to 10.25mm, get too much space
                   % between text and footer.  Set it to 10.24 and get way
                   % to little!  This looks like a bug ... no, maybe moves
                   % a line to the next page ...
                   {10.25mm}% footskip
      \renewcommand{\headwidth}{\textwidth}%
      \newlength{\markWidth}
      \setlength{\markWidth}{\textwidth}
      \addtolength{\markWidth}{-3.5em}
      \addtolength{\headheight}{1.92ex}% Enough room for 2 lines in head.
      \lhead[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \college%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\\
                  \subject%
               }%
            }%
      \rhead[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\\
                  \subject%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \college%
               }%
            }%
      \lfoot[%
               \fancyplain{}%
               {%
                  \parbox[t]{\markWidth}%
                  {%
                     \raggedright%
                     \renewcommand{\baselinestretch}{1.2}%
                     \footnotesize\bfseries\leftmark\mdseries\tiny\mbox{}\\%
                     \protect\revision%
                  }%
               }%
            ]%
            {%
               \fancyplain{\tiny\revision}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            }
      \rfoot[%
               \fancyplain{}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \parbox[t]{\markWidth}%
                  {%
                     \raggedleft%
                     \renewcommand{\baselinestretch}{1.2}% Otherwise overlap.
                     \footnotesize\bfseries\rightmark\mdseries\tiny\mbox{}\\%
                     \protect\revision%
                  }%
               }%
            }
      \setboolean{makeSLIDES}{false}% false for NOTES
      \typeout{^^JMaking NOTES^^J}
   }%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareOption{slidesonly}{%
   \PassOptionsToClass{slidesonly,12pt}{seminar}
   \AtEndOfClass%
   {%
      \typeout{^^JMaking FRAMED SLIDES^^J}
      \renewcommand{\college}{HKTC(TY)}
      % \setmarginsrb{10mm}%  leftmargin
      %              {15mm}%  topmargin
      %              {10mm}%  rightmargin
      %              {10mm}%  bottommargin
      %              {5mm}%  headheight
      %              {12pt}% headsep
      %              {0pt}%  footheight---not defined in LaTeX 2e.
      %              % Strange: set footskip to 10.25mm, get too much space
      %              % between text and footer.  Set it to 10.24 and get way
      %              % to little!  This looks like a bug ... no, maybe moves
      %              % a line to the next page ...
      %              {10.25mm}% footskip
      \renewcommand{\headwidth}{\textwidth}%
      \newlength{\markWidth}
      \setlength{\markWidth}{\textwidth}
      \addtolength{\markWidth}{-3.5em}
      \renewcommand{\slideleftmargin}{9.5mm}
      \renewcommand{\sliderightmargin}{9.5mm}
      \renewcommand{\slidetopmargin}{17mm}
      \renewcommand{\slidebottommargin}{14mm}
      \setlength{\slideheight}%
                      {\paperwidth-50mm}
      \setlength{\slidewidth}%
                      {\paperheight-\slideleftmargin-2\sliderightmargin}
      \lhead{%
               \fancyplain{}%
               {%
                  \scriptsize\bfseries \college \ \subjectNumber \
                  \subject%
               }%
            }%
      \rhead{%
               \fancyplain{}%
               {%
                  \scriptsize\bfseries \theslide%
               }%
            }%
      \lfoot{%
               \fancyplain{\tiny\revision}%
               {%
                  \mdseries\tiny\protect\revision%
               }%
            }
      \rfoot{}
      \setboolean{makeSLIDES}{false}% false for NOTES
   }%
}

\DeclareOption{mechEng}{%
   \AtEndOfClass%
   {%
      \renewcommand{\subject}{Digital Electronics and Microprocessors}
      \renewcommand{\subjectNumber}{ME219}
      \setboolean{mechEng}{true}
   }%
}

\DeclareOption{logic}{%
   \AtEndOfClass%
   {%
      \renewcommand{\subjectNumber}{EE271}
      \renewcommand{\subject}{Digital Logic and Microprocessors}
   }%
}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}}


\ProcessOptions


\LoadClass[a4]{seminar}


\RequirePackage{%
   fancyhea,%
   calc,%
   xspace,%
   lgrind,%
   float,%
   varioref,%
   emlines2,%
   vmargin,%
   array,%
   nick,%
   ifthen,%
   verbatim,%
   rcs,%
   alltt}

\setpapersize{A4}
\shiftmargins

\renewcommand{\slidefonts}{\sffamily}

\newboolean{makeSLIDES}
\newboolean{mechEng}
\setboolean{mechEng}{false}

\providecommand{\college}{Hong Kong Technical College (Tsing Yi)}
\providecommand{\subject}{Digital Systems and Microprocessors}
\providecommand{\subjectNumber}{EE270}
\providecommand{\department}%
      {Department of Electrical and Communications Engineering}
\providecommand{\up}{microprocessor\xspace}
\providecommand{\Up}{Microprocessor\xspace}
\providecommand{\ie}{i.e.,\xspace}
\providecommand{\eg}{e.g.,\xspace}
\providecommand{\hex}{$_{16}$\xspace}

\providecommand{\overbar}[1]{\ensuremath{\overline{\mathrm{#1}}}}


\begin{comment}
\DeclareRobustCommand{\sectionmark}[1]%
     {\markright{\ifnum \c@secnumdepth >\m@ne
            \thesection\hskip 1em\relax \fi
            #1}}
\DeclareRobustCommand{\chaptermark}[1]%
     {\markboth{\thechapter\ #1}{\thechapter\ #1}}
\end{comment}

\pagestyle{fancyplain}

\renewcommand{\thepage}{L\lectureNum-\arabic{page}}

\newcommand{\LectureTitle}[2]%
{%
   \newcommand{\lectureNum}{{#1}}%
   \newcommand{\lecTitle}{{#2}}
}

\newcommand{\MakeLectureTitle}[1][Lecture]%
{%
   {\LARGE #1 \lectureNum: \lecTitle}%
}

\ifarticle
   \setlength{\footrulewidth}{0.4pt}
   \renewcommand{\thepage}{L\lectureNum-\arabic{page}}
   % Prefer the slide labels on the bottom:
   \slidestyle{bottom}
   \renewcommand{\slidelabel}{Slide L\lectureNum\,S-\arabic{slide}}
   \slidesmag{3}
\else
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   \setlength{\footrulewidth}{0pt}
   \setlength{\headrulewidth}{0pt}
   \renewcommand{\theslide}{L\lectureNum\,S-\arabic{slide}}
\fi

\cfoot{}

\newcommand{\lectureHead}{%
\thispagestyle{plain}
\begin{center}
\bfseries\large
\college

\department

\subjectNumber\hspace{1em}\subject

\end{center}

\vspace{4ex}
}

\floatstyle{ruled}
\newfloat{Figure}{htbp}{lop}

\setcounter{tocdepth}{5} % All headings go into table of contents.


\renewcommand\@pnumwidth{3.55em}
\renewcommand\@tocrmarg {4.55em}

\endinput
%% 
%% End of file `lect2.sty'.
