% \changes{v1.2}{22 Oct 95}{First release as lect.cls}
% \changes{v2.0a}{18 Sep 95}{Added documentation, with lect2.drv}
% \changes{v2.0b}{18 Sep 95}{Incorporated the driver directly into lect2.dtx}
% \changes{v2.0c}{20 Sep 95}{Improved the documentation}
% \changes{v2.0d}{21 Sep 95}{Improved the slides option behaviour}
% \changes{v2.0e}{1 Oct 95}{Fixed the equation counters using addto@hook, etc.}
% \changes{v2.0f}{26 Jan 96}{Added the booklet option.   Tried to fix headings\ldots}
% \CheckSum{751}
%
% \iffalse meta-comment
%
% File: lect2.dtx
% For VTC microprocessor lecture notes and slides.
% Options: All seminar and article options and also:
% slides, notes, mechEng
% Written by Nick Urbanik, 22-10-94
% An example of its use:
%
%\documentclass[slides,mechEng]{lect2}
%
%\lectureTitle{1}{This is the heading for my test of the lect2 class}
%
%\begin{document}
%
%\lectureHead
%
%\MakeLectureTitle
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Background information}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The text about the topic of the background information...
%
% End of example of use of lect.cls.
%
% $Header: /usr/local/share/texmf/tex/latex/nick/RCS/lect2.dtx,v 1.2 2002/01/14 05:22:25 nicku Exp nicku $
%
% $Log: lect2.dtx,v $
% Revision 1.2  2002/01/14 05:22:25  nicku
% Many changes made back in Jun  3  1997.
%
% Revision 1.8  1996/01/26 20:47:21  Nick
% Added a new option: booklet.
% Fixed the footer marks (section and subsection).
% This is a major revision.
%
% Revision 1.7  1996/01/26  13:01:59  Nick
% Minor changes to get the notes and slides environemnts working.
%
% Revision 1.6  1995/10/17 18:07:35  Nick
% Quite a big edit.
% Added some stuff that uses the version package to create environments
% for elecEng, mechEng and logic; also slides.
%
% Revision 1.5  1995/09/25 11:41:56  Nick
% Spelling errors fixed.
% Added slideplacement{float} for notes.
%
% Revision 1.3  1995/09/21 14:48:10  Nick
% This version has improved the behaviour with the slides option
% in typesetting the older notes.
%
% Revision 1.1  1995/09/19 11:08:13  Nick
% Initial revision
%
% Revision 1.1  1995/09/18 16:15:22  Nick
% Initial revision
%
% Revision 1.1  1995/09/13 20:50:42  Nick
% Initial revision
%
% Revision 1.11  1995/02/19 12:41:03  Nick
% Major revision
% Have fixed the footers and headers with twoside option.
% Have added large numbers of other features and fixes.
%
% Revision 1.10  1994/11/06  22:33:56  Nick
% Have reorganised headers and footers so they don't overlap when use
% 12pt option.
% Have increased the bottom margin for notes.
% Could this be the final version?
%
% Revision 1.9  1994/11/06  09:19:29  Nick
% Added 1 pt to headheight to stop the overfull \vbox messages when use
% the 12pt option for notes.
%
% Revision 1.8  1994/11/05  22:16:31  Nick
% The margins were all wonky with the previous version for notes.
% Used vmargin to fix this.
%
% Revision 1.7  1994/11/05  19:04:00  Nick
% Reduced space between the subject number and subject name.
%
% Revision 1.6  1994/11/05  18:53:00  Nick
% Increased left margin on slides to make room for punching holes.
%
% Revision 1.5  1994/10/29  21:29:20  Nick
% Have changed the amrgins with vmargin.sty.
% The slides now have much smaller margins.  This seems to be what
% I aim for when photocopying.
% The margins are now down to about 7\,mm.  This is close to the limit of
% waht the photocopiers will copy to the edge of the transparency.
%
% Revision 1.4  1994/10/23  22:01:59  Nick
% added varioref to the packages loaded, since it is indespensable.
% Fixed the definition of \eemph.
% deleted unnessary flotsam and jetsam.
% Also added array.  Should consider adding hhline.sty to the list of
% packages.
% Added the \overbar command for active low processor pin names.
%
% Revision 1.2  1994/10/22  16:42:44  Nick
% Have added the subject number to the heading.  Minor typos fixed.
%
% \fi
%
% \begin{abstract}
% There is a need for a system for typesetting lecture notes and slides,
% keeping the information all together, so that slides can be produced,
% and notes with or without the slides can be produced as student
% handouts.  This is that system.  It depends on the |seminar| package;
% this class merely customises it for Hong Kong Technical College and
% for the subjects Digital Systems and Microprocessors.
% \end{abstract}
%
% \tableofcontents
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{How to use this class}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The best way to see how to use this is by example.  See the file
% |56lec1.tex| for a complete example.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Options available}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% There are a number of options available; all those with the
% |seminar| package, plus:
%  |logic|, |slides|, |booklet|, |compSc| and |mechEng|.
%
% These two options are part of |seminar|, but have been extended:
% |notes|, |slidesonly|.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Some commands useful in writing lecture notes and slides}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Here are a list of commands useful when writing lecture notes.  For
% more details, read the descriptions with the code.
% Remember that this is based on \pkg{seminar}, which has plenty of
% documentation.  Please read that, especially about the |slide|
% environment.  We begin with commands that need to be used in
% each document.
% 
% \DescribeMacro{\LectureTitle}
% You need to use the \cmd{\LectureTitle} macro in the preamble, i.e.,
% before the |\begin{document}|.  This initialises the lecture number
% and lecture title.  |\LectureTitle| takes two arguments; the first is
% the lecture number, the second is the title of the lecture.  This
% command must be used in each document, otherwise there will be an
% error when each page or slide number is printed.
%
% \DescribeMacro{\MakeLectureTitle}
% To print the lecture title, use the |\MakeLectureTitle| command,
% usually without any argument.  It does take an optional argument
% if you want to write anything other than the word ``Lecture'' in the
% title.  See the code for the details.
%
% \DescribeMacro{\lectureHead}
% The |\lectureHead| command produces a heading at the beginning of the
% |notes| output, and also with the |slides| option.  For the
% |notes| option this includes:
% \begin{itemize}
% \item \DescribeMacro{\college}The name of the college, as defined
% by the command |\college|
%
% \item \DescribeMacro{\department}The name of the department---as defined
% by the (renewable) command |\department|.
%
% \item \DescribeMacro{\subjectNumber}\DescribeMacro{\subject}The
% subject number and the name of the subject, as defined by the
% commands |\subjectNumber| and |\subject|.
% \end{itemize}
%
% The |slides| option has less in the |\lectureHead|; it has only the
% subject number and subject name, held as before in |\subjectNumber|
% and |\subject|.
%
% For the |slidesonly| option there is no introductory heading; a slide
% could be made to contain the subject name if required.  Note that the
% name of the subject and its number do appear on the top of each slide.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Miscellaneous commands}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% These commands provide convenient abbreviations.
%
% `|\up|' \DescribeMacro{\up}prints `microprocessor'.
%
% `|\Up|' \DescribeMacro{\Up}prints `Microprocessor'.
%
% `|\ie|' \DescribeMacro{\ie}prints `i.e.,'
%
% `|\eg|' \DescribeMacro{\eg}prints `e.g.,'
%
% `|\hex|' \DescribeMacro{\hex}provides a subscript 16, in maths
% or text mode, like this: 3F$_{16}$.
%
% The |\overbar| \DescribeMacro{\overbar}command takes one argument,
% typesets it in a Roman font, then draws a bar over the top of
% it---useful to represent active low pins on microprocessors
% and logic devices.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Changes from \texttt{lect.cls}}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The name of this class is now |lect2.cls| since I needed to break
% compatibility with the original |lect.cls| to initialise the
% value of |\lectureNum| for the new |slidesonly| option.  The problem was
% that the |slidesonly| option disregards any commands that come after
% |\begin{document}| but that are outside of a |slide| environment.
% In fact the original idea was faulty: I created a |\LectureTitle| macro
% which is used in the preamble instead of after |\begin{document}|.
% I have maintained a high degree of compatibility with |lect.cls| by
% keeping the previous macro as |\lectureTitle| and creating the new
% macro as |\LectureTitle|.  The remaining compatibility problem is
% with the requirement to put the |\articlemag{3}| command into the
% preamble of the lecture note source file.  See section~\ref{sec:useMag3}
% on page~\pageref{sec:useMag3} for details.
%
%\StopEventually{}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{The implementation}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Producing the documentation}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Here is a short driver program that can be extracted with the \LaTeXe
% \textsf{docstrip} program.  It is not necessary to create a separate
% driver file from this, however; you can just run \emph{this}
% file, \file{lect2.dtx} through \LaTeXe.
%
%    \begin{macrocode}
%<*driver>
\ProvidesFile{lect2.drv}
\documentclass[a4paper,twoside]{ltxdoc}
\usepackage{a4,fancyhdr}
%    \end{macrocode}
% I have had problems with getting the correct |\filedate| and |\fileversion|
% from this file.  I keep getting them from the file \file{a4.sty}.
% I believe the next line is supposed to fix such a problem, but it
% leaves them undefined.
%    \begin{macrocode}
% \GetFileInfo{lect2.dtx}
%    \end{macrocode}
% This is definitely the wrong place to put |\fileversion|,
% |\fileversion| and |\docdate|, since it is hard
% to find them here, but at the moment it's the only place where I can get
% them to work!
%    \begin{macrocode}
\def\fileversion{2.0g}
\def\filedate{2 October 96}
\def\docdate{2 October 96}
%    \end{macrocode}
% These depend on the package |fancyhdr|.  If you don't have it, you
% may want to comment out these lines.  You may prefer to comment out the
% line |\thispagestyle{empty}| further down.
%    \begin{macrocode}
\pagestyle{fancy}
\lhead[\textbf{\upshape The file \texttt{lect2.dtx}, a class to write lecture
      notes with \LaTeXe}]{\textbf{\thepage}}
\rhead[\textbf{\thepage}]{\textbf{\upshape The file \texttt{lect2.dtx}, a class to write lecture
      notes with \LaTeXe}}
\cfoot{}
%    \end{macrocode}
%    \begin{macrocode}
\EnableCrossrefs   % Make a full index.
%\DisableCrossrefs % Make no index.
\CodelineIndex     % Index by line numbers rather than by page.
%\PageIndex        % index commands using page numbers.
\DoNotIndex{\textbf,\texttt,bfseries,\renewcommand,\providescommand}
\DoNotIndex{\filedate,\filename,\fileversion}
\DoNotIndex{\DoNotIndex,\arabic}
\DoNotIndex{\NeedsTeXFormat}
\RecordChanges     % Show change history.
%\OnlyDescription  % uncomment this to not format the code.
\title{The file \texttt{lect2.dtx}, a class to write lecture
      notes with \LaTeXe.\thanks{This file has version number \fileversion,
      dated \filedate.}\\[2pt]
      It contains the code for \texttt{lect2.cls}}
\author{Nick Urbanik}
\date{\filedate}
\begin{document}
\thispagestyle{empty}
\maketitle
\providecommand{\Lenv}[1]{\textsf{#1}}
\providecommand{\pkg}[1]{\texttt{#1}}
\providecommand{\file}[1]{\texttt{#1}}
\DocInput{lect2.dtx}
\PrintIndex
\PrintChanges
%    \end{macrocode}
% Now tell the people what they need to do next to get the index and
% change list:
%    \begin{macrocode}
\typeout{Next, to make the index and changes list for this documentation:}
\typeout{2. makeindx -s gind.ist lect2}
\typeout{3. makeindx -s gglo.ist -o lect2.gls lect2.glo}
\typeout{Finally, run this file through LaTeX once more.}
%    \end{macrocode}
%
%    \begin{macrocode}
\end{document}
%</driver>
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Identification part}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    \begin{macrocode}
%<*class>
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{lect2}%
      [1996/01/26 For VTC microprocessor lectures; with framed slides]
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Declaration of options}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The \texttt{slides} option}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This option simply produces a magnification of the notes, and was
% written before I decided to use separate notes and slides.
% \emph{\textbf{This option should not be used for new lecture notes.}}
% Use the |slidesonly| option instead, and use |slide| environments
% to make the slides.
%
% This option magnifies the material that appears in the output
% of the |notes| option, so the fonts are bigger, the margins
% are smaller, and everything is scaled up in size.  This means that
% the material will need nearly twice as many sheets to print
% as when using the |notes| option.
%
% Previously I used a magnification of $1.2^3 = \frac{216}{125} = 1.728$,
% but used the 10\,pt option.\label{sec:useMag3}
% Now we use a magnification of $1.2^2 = \frac{36}{25} = 1.44$ with the
% 12\,pt option, which gives a similar result, but does not make the
% diagrams suffer from the text magnifying more than the rest of
% the drawing.  The resulting text is slightly smaller.
% The default setup uses the 10pt option with the |\artclemag{2}| command.
% This gives results that are too small.  I'd prefer to just use the
% 12\,pt option with the |\articlemag{2}| command so that the default
% does something sensible, but for some reason the 12\,pt option gets loaded
% after the 10\,pt option loaded in the lecture file itself.  I guess
% I need to understand the order in which options are loaded into the
% base class to be able to achieve the sensible goal. Till then\ldots.
%
% To get the same result as with
% the previous lecture notes when they were printed in  the 94/95 year,
% edit the lecture notes \LaTeXe{} file and add the command
% |\slidesmag{3}| to the preamble of the lecture note file.
%
% To get the ``preferable'' result---if you don't mind the font being
% slightly narrower---use the 12\,pt option with |\documentclass|,
% like this:
% \begin{verbatim}
% \documentclass[slides,12pt]{lect2}
% \end{verbatim}
%
% The magnification caused major overcrowding in the headers and footers,
% so careful rearrangement has remedied that mostly.
% Also have reduced the text in the title for the first page.
%
%    \begin{macrocode}
\DeclareOption{slides}{%
   %\PassOptionsToClass{12pt}{article}
   \PassOptionsToClass{article}{seminar}
   \AtEndOfClass%
   {%
%    \end{macrocode}
% This is what I had before:
% \begin{verbatim}
%      \setmarginsrb{15mm}% leftmargin---was 7mm,%
%%                                   now 15mm to allow for holes.
%                   {4mm}%  topmargin
%                   {10mm}%  rightmargin % Was 7, but that's too mean...
%                   {12mm}% bottommargin --- was 8mm
%                   {5mm}%  headheight
%                   {12pt}% headsep
%                   {0pt}%  footheight---not defined in LaTeX 2e.
% \end{verbatim}
%%                  Strange: set |footskip| to 10.25\,mm, get too much
%%                  space between text and footer.  Set it to 10.24
%%                  and get way too little!  This looks like a bug\ldots
%%                  no, maybe moves a line to the next page\ldots
% \begin{verbatim}
%                   {10.25mm}% footsep
% \end{verbatim}
% But now I am switching over to using the \pkg{geometry} package.
% \pkg{gemoetry} is great, except that the \pkg{twosideshift} option is
% really a bit strange.  If you use it, it forces the \pkg{twoside} option.
% If you use \pkg{twoside}, then you get this \pkg{twosideshift} value to
% automatically move your page over mysteriously by 20 points.
%    \begin{macrocode}
     \geometry{a4paper, twoside=false, portrait, left=15mm, top=4mm,
       right=10mm, bottom=12mm, headheight=5mm, headsep=12pt,
       footskip=10.25mm}
%    \end{macrocode}
% Now set the magnification of the notes to $1.2^2$.  Note that this
% depends on using the |article| option.
%    \begin{macrocode}
      \articlemag{2}%
%    \end{macrocode}
%    \begin{macrocode}
      \addtolength{\headheight}{6.6pt}
      \renewcommand{\headwidth}{\textwidth}%
%    \end{macrocode}
%
% For |slides| that are basically magnifications of the handouts we use
% a rule at the top and bottom of each page, except for the first page.
% This is the same as for the |notes| option.
%    \begin{macrocode}
   \renewcommand{\footrulewidth}{0.4pt}
%    \end{macrocode}
%
% This is the format of the |\lhead| and |\rhead| commands,
% for reference.  See the documentation for the \pkg{fancyhdr}
% package.
% \begin{verbatim}
% \lhead[\fancyplain{plain LH-even}{normal LH-even}]
%       {\fancyplain{plain LH-odd }{normal LH-odd}}
% \rhead[\fancyplain{plain RH-even}{normal RH-even}]%
%       {\fancyplain{plain RH-odd }{normal RH-odd}}
% \end{verbatim}
%
%    \begin{macrocode}
      \lhead[%
               \fancyplain{}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\hspace{0.5em}
                  \subject%
               }%
            }%
%    \end{macrocode}
%    \begin{macrocode}
      \rhead[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\hspace{0.5em}
                  \subject%
               }%
            ]%
            {%
               \fancyplain{}%
               {\rmfamily\bfseries \thepage}%
            }%
%    \end{macrocode}
%    \begin{macrocode}
      \lfoot[\fancyplain{}{}]%
            {%
               \fancyplain{\tiny\revision}%
               {%
                  \footnotesize\bfseries\rightmark%
                  \mdseries\tiny\mbox{}\\%
                  \protect\revision%
               }%
            }
%    \end{macrocode}
%    \begin{macrocode}
      \rfoot[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries\leftmark%
                  \mdseries\tiny\mbox{}\\%
                  \protect\revision%
               }%
            ]%
            {\fancyplain{}{}}
%    \end{macrocode}
%
% \DescribeMacro{\lectureHead}
% \begin{macro}{\lectureHead}
% In the |slides| option, we redefine |\lectureHead| to contain
% less material.  Also, the first page has no page number, headers
% or footers.
%    \begin{macrocode}
      \renewcommand{\lectureHead}%
      {%
         \thispagestyle{plain}
         \begin{center}
         \bfseries\large
         \subjectNumber\hspace{0.6em}\subject
         \end{center}

         \vspace{4ex}
      }%
%    \end{macrocode}
% \end{macro}
%  The Boolean variable |makeSLIDES| is true when using the |slides|
% option, but not when using the |slidesonly| option!  This is
% confusing to me as well as to you.  This |slides| option remains
% only for a degree of backward compatibility with previous lecture
% notes.
%    \begin{macrocode}
   \setboolean{makeSLIDES}{true}
%    \end{macrocode}
% This is new.  Here we create an environment so that the user can
% write stuff like: |\begin{slides}| \ldots{} |\end{slide}| so that
% the contents of that environment (the `\ldots') is included only
% if this option is used.
%    \begin{macrocode}
   \excludeversion{notes}%
   \includeversion{slides}%
%    \end{macrocode}
% Now tell the user how to get the slides to come out at the right
% magnification.  To get things exactly as they used to be, use
% the |\slidesmag{3}| command.  To get things looking a little better
% (and more easily maintainable) than before, use the |12pt| option.
%    \begin{macrocode}
   \typeout{^^JMaking SLIDES}
   \typeout{To get readable slides, either use the 12pt option 
            or insert the command}
   \typeout{\protect\slidesmag{3} into the preamble 
            of the lecture notes file.^^J}
   }%
}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Notes to be handed out to students: the \texttt{notes}
% option}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Lecture notes to be handed out to students.
% Here we use a magnification of 0, put more into the
% headers and footers, and more in the lecture heading.
%
%    \begin{macrocode}
\DeclareOption{notes}{%
   \PassOptionsToClass{twoside,dvips,article,12pt}{seminar}
   \AtEndOfClass%
   {%
%    \end{macrocode}
% Now here I've changed |rightmargin| from 30\,mm to 15\,mm, because
% the notes will be distributed to the students at $1/\sqrt{2}$ times the
% full size, with two pages to one A4 sheet, turned to landscape mode.
%
% Nick, 9-5-97: No it won't!  Use to print to A4, and to make PDF
% files.
%
% The border in the middle is not used, and I have not used margin notes
% in my lectures till now (when I do, I may need to increase |rightmargin|).
% This is what the documentation for the \pkg{vmargin} package has to say:
% \begin{quote}
% Two sided printing is supported, meaning that if on odd pages the left
% margin is, say, 30\,mm and the right margin is 20\,mm, it will be vice
% versa on even pages. This gives equal margins on the outer and the
% inner edge of the paper, as expected e.g. for a book.
% \end{quote}
%    \begin{macrocode}
%      \setmarginsrb{30mm}%  leftmargin
%                   {20mm}%  topmargin
%                   {15mm}%  rightmargin
%                   {20mm}%  bottommargin
%                   {5mm}%  headheight
%                   {8mm}% headsep
%                   {0pt}%  footheight---not defined in LaTeX 2e.
%    \end{macrocode}
% Better to use geometry: it supports dvips better.
%    \begin{macrocode}
\geometry{a4paper, left=26mm, top=20mm, right=26mm, bottom=18mm,
  headheight=5mm, headsep=8mm, footskip=13mm, twosideshift=0pt}
%    \end{macrocode}
% The previous value of 10.25\,mm for |footskip| caused the footnotes
% to overlap the rule above the footers drawn by the \pkg{fancyhdr}
% package.  Increase this to get rid of that overlap.  Possibly due to the
% increase in |\baselinestetch| in the |\lfoot| command just below.
%    \begin{macrocode}
%                   {13mm}% footskip
%    \end{macrocode}
% \begin{macro}{\headwidth}
%    \begin{macrocode}
      \renewcommand{\headwidth}{\textwidth}%
      \newlength{\markWidth}
      \setlength{\markWidth}{\textwidth}
      \addtolength{\markWidth}{-3.5em}
%    \end{macrocode}
% \end{macro}
%     Enough room for 2 lines in head:
%    \begin{macrocode}
      \addtolength{\headheight}{1.92ex}
%    \end{macrocode}
% Want the slides to float in the notes option, since otherwise there
% are large amounts of blank space at the foot of some pages.
%    \begin{macrocode}
\slideplacement{float}
%    \end{macrocode}
%
% This is the format of the |\lhead| and |\rhead| commands,
% for reference.
% \begin{verbatim}
% \lhead[\fancyplain{plain LH-even}{normal LH-even}]
%       {\fancyplain{plain LH-odd }{normal LH-odd}}
% \rhead[\fancyplain{plain RH-even}{normal RH-even}]%
%       {\fancyplain{plain RH-odd }{normal RH-odd}}
% \end{verbatim}
%    \begin{macrocode}
      \lhead[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \college%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\\
                  \subject%
               }%
            }%
%    \end{macrocode}
%    \begin{macrocode}
      \rhead[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber\\
                  \subject%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \college%
               }%
            }%
%    \end{macrocode}
%    \begin{macrocode}
      \lfoot[%
               \fancyplain{}%
               {%
                  \parbox[t]{\markWidth}%
                  {%
                     \raggedright%
                     \renewcommand{\baselinestretch}{1.2}%
                     \footnotesize\bfseries\leftmark%
                     \mdseries\tiny\mbox{}\\%
                     \protect\revision%
                  }%
               }%
            ]%
            {%
               \fancyplain{\tiny\revision}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            }
%    \end{macrocode}
%    \begin{macrocode}
      \rfoot[%
               \fancyplain{}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \parbox[t]{\markWidth}%
                  {%
                     \raggedleft%
%    \end{macrocode}
%   We get insufficient line spacing in footers otherwise without the next
% line.  For some reason, the bottom of the first line would touch the top
% of the second in the footer.  However, this seems to have caused the
% page to extend into the footer area, so have increased |footskip|
% when using the |notes| option.
%    \begin{macrocode}
                     \renewcommand{\baselinestretch}{1.2}
                     \footnotesize\bfseries\rightmark%
                     \mdseries\tiny\mbox{}\\%
                     \protect\revision%
                  }%
               }%
            }
%    \end{macrocode}
% The next few sections of code were in a conditional section, with
% the guard |\ifarticle|, but I moved them here as it is more appropriate
% to keep the stuff dependent on the notes option in one place.
%
% For lecture notes (handouts) we use a rule at the top and bottom
% of each page, except for the first page.
%    \begin{macrocode}
   \renewcommand{\footrulewidth}{0.4pt}
%    \end{macrocode}
%
% \DescribeMacro{\slidestyle}
%  I prefer the slide labels on the bottom of each slide when
% printing notes with the slides included in the student handouts.
% Without this, the label appears on the left.
%
%    \begin{macrocode}
   \slidestyle{bottom}
%    \end{macrocode}
%
% \DescribeMacro{\slidelabel}
% Here I'm making the label under each slide look like:
%
% Slide L1\,S-2
%
% for the slide number~2 in lecture~1.  See the definition of
% |\theslide| below.
% \begin{macro}{\slidelabel}
%    \begin{macrocode}
   \renewcommand{\slidelabel}{Slide \theslide}
%    \end{macrocode}
% \end{macro}
%
% This was all an attempt to get the slidewidth set as a parameter of
% the paper width, in the |article| options.  None of them worked, I
% think because the value of |\textwidth| had already been changed
% (scaled down) when this code was executed.
% \begin{verbatim}
%   \setlength{\slideheight}{\textwidth}
%   \setlength{\slidewidth}{\textwidth} % Weird!  Makes it half width!
%   \setlength{\slidewidth}{\linewidth} % Even narrower!
%   \setlength{\slidewidth}{\columnwidth} % Same as \linewidth.
%   \setlength{\slidewidth}{\paperwidth} % Makes it a bit narrower.
%   \setlength{\slidewidth}{\headwidth}
% \end{verbatim}
% \DescribeMacro{\slidesmag}
% The magnification here was found through trial and error to make the
% slides appear with the notes in the handouts to be about as wide
% as the text.  When the argument to |\slidesmag| is increased from 3,
% the slides appear \emph{smaller}.  This may or may not be desirable,
% but I like it at magnification three.
%
%    \begin{macrocode}
   \slidesmag{3}
%    \end{macrocode}
% The Boolean variable |makeSLIDES| is false for making notes using
% the |notes| option.  Note that it is \emph{also} false when making
% slides using the |slidesonly| option!  This is for historical
% reasons (and that I haven't done anything to change it).
%    \begin{macrocode}
      \setboolean{makeSLIDES}{false}
%    \end{macrocode}
% This is new.  Here we create an environment so that the user can
% write stuff like: |\begin{slides}| \ldots{} |\end{slide}| so that
% the contents of that environment (the `\ldots') is included only
% if the |slides| option is used, but \emph{not} if \emph{this}
% option is used.  Have now created a |notes| environment to do
% the same sort of thing for the |notes| option.
%    \begin{macrocode}
      \excludeversion{slides}%
      \includeversion{notes}%
      \typeout{^^JMaking NOTES^^J}
   }%
}
%    \end{macrocode}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Notes to be handed out to students: the \texttt{booklet}
% option}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Lecture notes to be handed out to students.
% Here we use a magnification of 0, put more into the
% headers and footers, and more in the lecture heading.
% The handouts are in 10pt, and are more like a booklet.
% However, the odd pages are on the LEFT, since they are not
% bound like a book.  This has some unfortunate effects with the
% varioref package, where it can talk about the opposite page while it
% is really on the next page.  I could probably solve that sometime
% later.
%
%    \begin{macrocode}
\DeclareOption{booklet}{%
  \PassOptionsToClass{twoside,10pt,article,a5paper}{seminar}
   \AtEndOfClass%
   {%
%    \end{macrocode}
% Now here I've changed the page setup to be similar to that for my
% assembly language primer, except that the left and right margins are
% exchanged, since here the odd-numbered pages are on the left, while
% in a book, the odd-numebred pages are on the right.
%
% This is what the documentation for the \pkg{vmargin} package has to say:
% \begin{quote}
% Two sided printing is supported, meaning that if on odd pages the left
% margin is, say, 30\,mm and the right margin is 20\,mm, it will be vice
% versa on even pages. This gives equal margins on the outer and the
% inner edge of the paper, as expected e.g. for a book.
% \end{quote}
%    \begin{macrocode}
      % Half A4 size:
%      \setpapersize{A5}%
%      \setmarginsrb{20mm}% left For a book, the inner.  For oddleft, outer.
%                   {9mm}% top
%                   {10mm}% right For a book, the outer.  For odd left, inner.
%                   {10.5mm}% bottom
%                   {12pt}% headheight---increase to stop fancyhead warn
%                   {4mm}%  headsep
%                   {0pt}%  footheight
%                   {8mm}% footskip
%    \end{macrocode}
% The previous value of 10.25\,mm for |footskip| caused the footnotes
% to overlap the rule above the footers drawn by the \pkg{fancyhdr}
% package.  Increase this to get rid of that overlap.  Possibly due to the
% increase in |\baselinestetch| in the |\lfoot| command just below.
%
% Later note: it seems that the 8mm footskip is not a problem with the new
% footers; still, will check after examining the output.
% \begin{verbatim}
%                  {13mm}% footskip
% \end{verbatim}
% It seems that the |geometry| package was written more carefully than
% the |vamargin| package, so see if that fixes things\ldots
% \begin{macro}{\geometry}
%    \begin{macrocode}
      \special{papersize=148.5mm,210mm}% Tell DVIPS this is a5.
      \geometry{reset, a5paper, portrait, twoside=true, left=20mm,
                     right=10mm, top=9mm, bottom=10.5mm, footskip=8mm,
                     headheight=12pt, headsep=4mm, includemp=false,
                     verbose=true, twosideshift=0pt}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\headwidth}
%    \begin{macrocode}
      \renewcommand{\headwidth}{\textwidth}%
      \newlength{\markWidth}
      \setlength{\markWidth}{\textwidth}
      \addtolength{\markWidth}{-3.5em}
%    \end{macrocode}
% \end{macro}
%%     Enough room for 2 lines in head:
%%    \begin{macrocode}
%%      \addtolength{\headheight}{1.92ex}
%%    \end{macrocode}
% Want the slides to float in the notes option, since otherwise there
% are large amounts of blank space at the foot of some pages.
%    \begin{macrocode}
\slideplacement{float}
%    \end{macrocode}
%
% This is the format of the |\lhead| and |\rhead| commands,
% for reference.
% \begin{verbatim}
% \lhead[\fancyplain{plain LH-even}{normal LH-even}]
%       {\fancyplain{plain LH-odd }{normal LH-odd}}
% \rhead[\fancyplain{plain RH-even}{normal RH-even}]%
%       {\fancyplain{plain RH-odd }{normal RH-odd}}
% \end{verbatim}
%    \begin{macrocode}
      \lhead[%
               \fancyplain{}%
               {%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \college%
               }%
            }%
%    \end{macrocode}
%    \begin{macrocode}
      \rhead[%
               \fancyplain{}%
               {%
                  \footnotesize\bfseries \subjectNumber \
                  \subject%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
               }%
            }%
%    \end{macrocode}
% We want the subsection number on the right hand page: that's an even
% number in this arrangement.
%    \begin{macrocode}
      \lfoot[%
               \fancyplain{}%
               {%
                  \parbox[t]{\markWidth}%
                  {%
                     \raggedright%
                     \renewcommand{\baselinestretch}{1.2}%
                     \footnotesize\bfseries\rightmark%
                     \mdseries\tiny\mbox{}\\%
                     \protect\revision%
                  }%
               }%
            ]%
            {%
               \fancyplain{\tiny\revision}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            }
%    \end{macrocode}
% We want the section number on the left hand page: that's an
% odd-numbered page in this arrangement.
%    \begin{macrocode}
      \rfoot[%
               \fancyplain{}%
               {%
                  \rmfamily\bfseries \thepage%
               }%
            ]%
            {%
               \fancyplain{}%
               {%
                  \parbox[t]{\markWidth}%
                  {%
                     \raggedleft%
%    \end{macrocode}
%   We get insufficient line spacing in footers otherwise without the next
% line.  For some reason, the bottom of the first line would touch the top
% of the second in the footer.  However, this seems to have caused the
% page to extend into the footer area, so have increased |footskip|
% when using the |notes| option.
%    \begin{macrocode}
                     \renewcommand{\baselinestretch}{1.2}
                     \footnotesize\bfseries\leftmark%
                     \mdseries\tiny\mbox{}\\%
                     \protect\revision%
                  }%
               }%
            }
%    \end{macrocode}
% The next few sections of code were in a conditional section, with
% the guard |\ifarticle|, but I moved them here as it is more appropriate
% to keep the stuff dependent on the notes option in one place.
%
% For lecture notes (handouts) we use a rule at the top and bottom
% of each page, except for the first page.
%    \begin{macrocode}
   \renewcommand{\footrulewidth}{0.4pt}
%    \end{macrocode}
%
% \DescribeMacro{\slidestyle}
%  I prefer the slide labels on the bottom of each slide when
% printing notes with the slides included in the student handouts.
% Without this, the label appears on the left.
%
%    \begin{macrocode}
   \slidestyle{bottom}
%    \end{macrocode}
%
% \DescribeMacro{\slidelabel}
% Here I'm making the label under each slide look like:
%
% Slide L1\,S-2
%
% for the slide number~2 in lecture~1.  See the definition of
% |\theslide| below.
% \begin{macro}{\slidelabel}
%    \begin{macrocode}
   \renewcommand{\slidelabel}{Slide \theslide}
%    \end{macrocode}
% \end{macro}
%
% This was all an attempt to get the slidewidth set as a parameter of
% the paper width, in the |article| options.  None of them worked, I
% think because the value of |\textwidth| had already been changed
% (scaled down) when this code was executed.
% \begin{verbatim}
%   \setlength{\slideheight}{\textwidth}
%   \setlength{\slidewidth}{\textwidth} % Weird!  Makes it half width!
%   \setlength{\slidewidth}{\linewidth} % Even narrower!
%   \setlength{\slidewidth}{\columnwidth} % Same as \linewidth.
%   \setlength{\slidewidth}{\paperwidth} % Makes it a bit narrower.
%   \setlength{\slidewidth}{\headwidth}
% \end{verbatim}
% \DescribeMacro{\slidesmag}
% The magnification here was found through trial and error to make the
% slides appear with the notes in the handouts to be about as wide
% as the text.  When the argument to |\slidesmag| is increased from 3,
% the slides appear \emph{smaller}.  This may or may not be desirable,
% but I like it at magnification three.
%
%    \begin{macrocode}
   \slidesmag{3}
%    \end{macrocode}
% The Boolean variable |makeSLIDES| is false for making notes using
% the |notes| option.  Note that it is \emph{also} false when making
% slides using the |slidesonly| option!  This is for historical
% reasons (and that I haven't done anything to change it).
%    \begin{macrocode}
      \setboolean{makeSLIDES}{false}
%    \end{macrocode}
% This is new.  Here we create an environment so that the user can
% write stuff like: |\begin{slides}| \ldots{} |\end{slide}| so that
% the contents of that environment (the `\ldots') is included only
% if the |slides| option is used, but \emph{not} if \emph{this}
% option is used.  Have now created a |notes| environment to do
% the same sort of thing for the |notes| option.
%    \begin{macrocode}
      \excludeversion{slides}%
      \includeversion{notes}%
      \typeout{^^JMaking BOOKLET-style notes^^J}
   }%
}
%    \end{macrocode}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The \texttt{slidesonly} option: making framed slides}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Making framed slides, as the seminar system originally intended.  This
% option will be used for making new slides; I will probably eventually
% remove the |slides| option, if I update all my previous lecture notes
% to use the proper slide format.
%
%    \begin{macrocode}
\DeclareOption{slidesonly}{%
   \PassOptionsToClass{slidesonly,12pt}{seminar}
   \AtEndOfClass%
   {%
      \typeout{^^JMaking FRAMED SLIDES^^J}
%    \end{macrocode}
%
% \DescribeMacro{\college}
% Make the |\college| text shorter for a slide so it fits across
% the top in the bigger font.
%
% \begin{macro}{\college}
%    \begin{macrocode}
      \renewcommand{\college}{HKTC(TY)}
%    \end{macrocode}
% \end{macro}
%
% It seems that |vmargin.sty| has no effect on the slides.
% \begin{verbatim}
%     \setmarginsrb{10mm}%  leftmargin
%                  {15mm}%  topmargin
%                  {10mm}%  rightmargin
%                  {10mm}%  bottommargin
%                  {5mm}%  headheight
%                  {12pt}% headsep
%                  {0pt}%  footheight---not defined in LaTeX 2e.
% \end{verbatim}
%                  Strange: set |footskip| to 10.25\,mm, get too much
%                  space between text and footer.  Set it to 10.24
%                  and get way too little!  This looks like a bug\ldots
%                  no, maybe moves a line to the next page\ldots
% \begin{verbatim}
%                  {10.25mm}% footskip
% \end{verbatim}
% This incantation is necessary for |fancyheadings| to work with
% |seminar|.  See \file{seminar.bug} for further information.
%
% \begin{macro}{\headwidth}
%    \begin{macrocode}
      \renewcommand{\headwidth}{\textwidth}%
%    \end{macrocode}
% \end{macro}
%
% The |\headheight| appears to have no effect when using the |slidesonly|
% option.
% \begin{verbatim}
%     \addtolength{\headheight}{1.92ex}% Enough room for 2 lines in head.
% \end{verbatim}
%
% \DescribeMacro{\slideleftmargin}
% \DescribeMacro{\sliderightmargin}
% \DescribeMacro{\slidetopmargin}
% \DescribeMacro{\slidebottommargin}
% \DescribeMacro{\slidewidth}
% \DescribeMacro{\slideheight}
% Weird behaviour when I change |\slideleftmargin| and |\sliderightmargin|
% from 9\,mm to 10\,mm: the slide decreases to 1/3 of the page.
% This whole part is a major mystery to me.  I wound up hard-wiring
% the dimensions in since I couldn't get it to work properly otherwise.
% I also rationalised that this is unlikely to change very often.
%
% Some things to bear in mind: the value of |\slideheight| and
% |\slidewidth| fix the size of the slide (eventually), though they seem
% to be very quirky and sensitive.  The margins are not fixed; the
% headers and footers cannot be closer than a ``sensible'' amount to
% the frame of the slide.  If the size of the slide is rather big on the
% page, the header and footer will be pushed out, apparently leaving the
% |\slidetopmargin| and |\slidebottommargin| having no effect.
%
% \begin{macro}{\slideleftmargin}
% \begin{macro}{\sliderightmargin}
% \begin{macro}{\slidetopmargin}
% \begin{macro}{\slidebottommargin}
%    \begin{macrocode}
      \renewcommand{\slideleftmargin}{9.5mm}
      \renewcommand{\sliderightmargin}{9.5mm}
      \renewcommand{\slidetopmargin}{17mm}
      \renewcommand{\slidebottommargin}{14mm}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% 
% \begin{macro}{\slideheight}
% \begin{macro}{\slidewidth}
%    \begin{macrocode}
      \setlength{\slideheight}%
%                      {\paperwidth-\slidetopmargin-\slidebottommargin*2}
                      {\paperwidth-50mm}
      \setlength{\slidewidth}%
                      {\paperheight-\slideleftmargin-2\sliderightmargin}
%                      {\paperheight-16mm-16mm}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The headings on the slides}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Here we just want ``single sided'' printing; there should
% be no difference between printing an odd-numbered or
% an even-numbered slide.
%
% The college name is printed on the left at the top, then the
% subject number, then the subject name.
%
% \DescribeMacro{\theslide}
% On the right side at the top is printed |\theslide|, as defined
% below.  This includes the lecture number as well as the slide
% number.
%
% When making slides with this |slidesonly| option, we have no rules
% (lines) at the top and bottom of the slide:
%
%    \begin{macrocode}
   \renewcommand{\footrulewidth}{0pt}
   \renewcommand{\headrulewidth}{0pt}
%    \end{macrocode}
%
% This is the format of the |\lhead| and |\rhead| commands,
% for reference.  These are from the \pkg{fancyhdr} package.
% \begin{verbatim}
% \lhead[\fancyplain{plain LH-even}{normal LH-even}]
%       {\fancyplain{plain LH-odd }{normal LH-odd}}
% \rhead[\fancyplain{plain RH-even}{normal RH-even}]%
%       {\fancyplain{plain RH-odd }{normal RH-odd}}
% \end{verbatim}
% Print the college name, subject number and subject at the top-left
% of the slide.
%    \begin{macrocode}
      \lhead{%
               \fancyplain{}%
               {%
                  \scriptsize\bfseries \college \ \subjectNumber \ 
                  \subject%
               }%
            }%
%    \end{macrocode}
% Now print the slide number at the top-right of the slide.  Note
% that the slide number also contains the lecture number.
%    \begin{macrocode}
      \rhead{%
               \fancyplain{}%
               {%
                  \scriptsize\bfseries \theslide%
               }%
            }%
%    \end{macrocode}
%
% At the bottom left corner the revision number is printed, in
% tiny letters.
%
%    \begin{macrocode}
      \lfoot{%
               \fancyplain{\tiny\revision}%
               {%
                  \mdseries\tiny\protect\revision%
               }%
            }
%    \end{macrocode}
% Put nothing in the bottom-right corner of the slide.
%    \begin{macrocode}
      \rfoot{}
%    \end{macrocode}
%
% This Boolean variable |makeSLIDES| is false when making slides using
% this |slidesonly| option!  This was because the purpose of
% |makeSLIDES| was to conditionally set lengths for pictures when
% using the |slides| option, and the |slidesonly| option was just
% a twinkle in my eye.  It remains as a rather confusing thing.
% I'll have to do something about this some time.  It remains for
% backward compatibility with previous lecture note files.
%    \begin{macrocode}
      \setboolean{makeSLIDES}{false}
%    \end{macrocode}
% This is new.  Here we create an environment so that the user can
% write stuff like: |\begin{slides}| \ldots{} |\end{slide}| so that
% the contents of that environment (the `\ldots') is included only
% if the |slides| option is used, but \emph{not} if \emph{this}
% option is used.
%    \begin{macrocode}
   \excludeversion{slides}%
   }%
}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The \texttt{mechEng} option: change subject name
%                and number, set a flag}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% For Mechanical Engineering lectures, we need W. K. Leung's special codes.
% The boolean flag |mechEng| is used to allow conditional inclusion
% and exclusion of various parts of the lecture notes, since the needs
% of Electrical Engineering and Mechanical Engineering students are
% different.  This conditional inclusion is done in the lecture notes
% file using the \pkg{version} package, as mentioned in \emph{The \LaTeX{}
% Companion}.
%
%
% \begin{macro}{\subjectNumber}
% \begin{macro}{\subject}
%    \begin{macrocode}
\DeclareOption{mechEng}{%
   \AtEndOfClass%
   {%
      \renewcommand{\subject}{Digital Electronics and Microprocessors}
      \renewcommand{\subjectNumber}{ME219}
      \setboolean{mechEng}{true}
      \setboolean{compSc}{false}
      \setboolean{logic}{false}
      \setboolean{elecEng}{false}
      \includeversion{mechEng}%
      \excludeversion{compSc}%
      \excludeversion{elecEng}%
      \excludeversion{logic}%
   }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \changes{v2.0g}{2 Oct 96}{Added the compSc option.}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The \texttt{compSc} option: change subject name
%                and number, set a flag}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% For Computer Science lectures, we again need the subject name and
% number.  The subject is currently taught by Michael Chan\@.
% The boolean flag |compSc| is used to allow conditional inclusion
% and exclusion of various parts of the lecture notes.
%
% \begin{macro}{\subjectNumber}
% \begin{macro}{\subject}
%    \begin{macrocode}
\DeclareOption{compSc}{%
   \AtEndOfClass%
   {%
      \renewcommand{\subject}{Introduction to Digital \mbox{Technology} and
        \mbox{Processors}}%
      \renewcommand{\subjectNumber}{CMFD\,113}%
      \setboolean{mechEng}{false}%
      \setboolean{logic}{false}%
      \setboolean{elecEng}{false}%
      \setboolean{compSc}{true}%
      \includeversion{compSc}%
      \excludeversion{mechEng}%
      \excludeversion{elecEng}%
      \excludeversion{logic}%
   }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The \texttt{logic} option: change subject name and number}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% For Digital Logic and Microprocessor lectures, need W. K. Leung's
% special codes.  I didn't create a flag to include or exclude parts of the
% lecture notes for the part-time classes; maybe this will be necesary,
% because their needs are clearly different too.
%
% \begin{macro}{\subjectNumber}
% \begin{macro}{\subject}
%    \begin{macrocode}
\DeclareOption{logic}{%
   \AtEndOfClass%
   {%
      \renewcommand{\subjectNumber}{EE271}
      \renewcommand{\subject}{Digital Logic and Microprocessors}
      \setboolean{mechEng}{false}
      \setboolean{logic}{true}
      \setboolean{elecEng}{false}
      \setboolean{compSc}{false}
      \excludeversion{compSc}%
      \excludeversion{mechEng}%
      \excludeversion{elecEng}%
      \includeversion{logic}%
   }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Pass all other options unchanged to \texttt{seminar.cls}}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Execution of options}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Special class file commands}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This used to be
% \begin{verbatim}
% \LoadClass[a4,article,notes]{seminar}
% \end{verbatim}
% but I finally worked out how to pass options to the |seminar| package
% after doing some processing of the option in this file.
% In fact I may not have worked it out completely; see the files
% \file{a4.dtx} and \file{ltxdoc.dtx} for some clues about this topic.
%
%    \begin{macrocode}
\LoadClass[a4]{seminar}
%    \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Package loading}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% What a lot of packages!  Perhaps I could find a way to create single
% files that contain all the source required, without having to separately
% edit those package sources (\file{.dtx} files).  This should be easily
% possible with \textsc{docstrip}.
%
%    \begin{macrocode}
\RequirePackage{%
   fancyhdr,%
   calc,%
   xspace,%
   lgrind,%
   float,%
   varioref,%
   emlines2,%
   %vmargin,%
   geometry,%
   array,%
   nick,%
   ifthen,%
   verbatim,%
   rcs,%
   slidesec,%
   fancybox,%
   version,%
   alltt}
%    \end{macrocode}
%
% We also want to use \textsf{dvips} to print the logo for the
% Department.
%
%    \begin{macrocode}
 \RequirePackage[dvips]{graphicx}
%    \end{macrocode}
%
% I like to print the handouts to the students using the |booklet|
% option in this class, which makes A5 pages in ten point fonts.
% These need to be combined two to an A4 sheet. The incantation
% that worked for me was:
% \begin{verbatim}
% dvidrv dvips32 56lec1
% psnup -2 -Pa5 -pa4 56lec1.ps | psselect -o > lpt2:
% \end{verbatim}
% to print the odd pages first, then I turned the paper over and
% printed the even pages with:
% \begin{verbatim}
% psnup -2 -Pa5 -pa4 56lec1.ps | psselect -e > lpt2:
% \end{verbatim}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Excerpt from documentation of \pkg{slidesec}---making
% the headings in the slides}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Each slide environment will usually have some heading.  For this we use
% the |\slideheading| command which also allows a list of slides to be
% produced.  Read the file \file{slidesec.sty} for more information.
% Here is an excerpt from that file, describing the |\slideheading|
% command.
%
% \DescribeMacro{\slideheading}
% |\slideheading[#1]{#2}|
% \begin{itemize}
%  \item Analogous to |\section|.
%  \item |[#1]| is optional; |\slideheading{#1}| is
% same as |\slideheading[#1]{#2}|.
%  \item Advances slidesection counter.
%  \item Sets |\theslideheading| to |#1|; can be used, e.g., in
%        headers and footers.
%  \item Adds |#1| to slide contents file.
%  \item If |#2| is non-empty, invokes |\makeslideheading{#2}| to make
%        a heading.  Default definition of |\makeslideheading| is
% \begin{verbatim}
%       \begin{center}\large\bf #2 \end{center}
% \end{verbatim}
%    but you can redefine this to suit your tastes.
% \end{itemize}
%
% \DescribeMacro{\slidesubheading}
% |\slidesubheading[#1]{#2}|
% \begin{itemize}
%  \item Analogous to |\subsection|.
%  \item Like |\slideheading|, but add ``|sub|'' to all the names.
% \end{itemize}
%
% |\slideheading| and |\slidesubheading| are meant to be used at most once in
% a slide, but this is not a binding restriction.
%
% \DescribeMacro{\makeslideheading}
% This is taken directly from the file \file{semsamp2.tex} which comes as
% part of the \pkg{seminar} package.  It requires the \pkg{fancybox}
% package to draw those shaded headings.  The argument appears in a framed
% box with a shadow below and to the right.
% \begin{macro}{\makeslideheading}
%    \begin{macrocode}
\DeclareRobustCommand{\makeslideheading}[1]%
{%
  \begin{center}
     \large\bfseries
     \shadowbox{#1}%
  \end{center}
  \vspace{1ex minus 1ex}%
}
%    \end{macrocode}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Commands to make things work}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{verbatim}
% \typeout{^^JNow processing commands^^J}
% \end{verbatim}
% These macros come from the \pkg{vmargin} package.
%    \begin{macrocode}
%\setpapersize{A4}
%\shiftmargins
%    \end{macrocode}
%
%
% \DescribeMacro{\slidefonts}
% To get sans serif fonts in the slides.  The |\slidefonts| command
% is defined in \file{seminar.cls} and is executed at the beginning
% of each |slide| environment.
% \begin{macro}{\slidefonts}
%    \begin{macrocode}
\renewcommand{\slidefonts}{\sffamily}
%    \end{macrocode}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The equation numbers in slides and notes}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \DescribeMacro{\everyslide}
% There is a problem when using equations in both slides and in notes:
% the counter gets incremented in both the slides and in the notes, even
% though the same equation may appear in each.  To solve this problem, I
% decided to use the |\everyslide| command from \pkg{seminar}.  The |\everyslide|
% command is executed at the beginning of each slide.   The idea is
% to remember the value of |equation| at the beginning of each slide, then
%  set the value of |equation| to that of a new counter called |slideEquation|.
% At the end of the slide the values of |equation| and |slideEquation| are restored.
%
% First, we create a new counter to remember the value of the |equation| counter at
% the beginning of a slide, and the |slideEquation| counter:
%    \begin{macrocode}
\newcounter{rememberEquation}
\newcounter{slideEquation}
%    \end{macrocode}
% Then at the beginning of each slide remember the value of |equation| and
% replace it with that of |slideEquation|:
% \begin{macro}{\everyslide}
%    \begin{macrocode}
\renewcommand{\everyslide}{\setcounter{rememberEquation}{\value{equation}}%
                           \setcounter{equation}{\value{slideEquation}}}
%    \end{macrocode}
% \end{macro}
% At the end of each slide, restore the values of |equation| and |slideEquation|.
% The |\addto@hook| and |\after@slide| commands were lifted out of \file{seminar.cls}.
% Note that |\addto@hook| gives funny error messages if the braces that are commented
% out here are used.  That's because it takes two arguments; it is defined in
% \file{seminar.cls}.
% \begin{macro}{\addto@hook}
%    \begin{macrocode}
\addto@hook%
%{%
   \after@slide%
   {%
      \setcounter{slideEquation}{\value{equation}}%
      \setcounter{equation}{\value{rememberEquation}}%
   }%
%}
%    \end{macrocode}
% \end{macro}
%
% The Boolean variable |makeSLIDES| is true when using the |slides|
% option, false for making notes, and also rather confusingly, is
% false when the |slidesonly| option is used.  The original purpose
% was to allow conditional definition of lengths used in diagrams
% for slides and for the notes, when I used to make slides by simply
% magnifying the fonts in the notes.
%
% \DescribeMacro{makeSLIDES}%
% Well, I \emph{still} use |makeSLIDES|.  Here's how to use it:
% \begin{itemize}
% \item This uses the |ifthen| package so read \emph{The \LaTeX{} Companion},
% pages 470--473 about that package.
% \item write statements like:\\
% |ifthenelse{\boolean{makeSLIDES}}{stuff for slides option}{stuff for notes}|
% \end{itemize}
%
%    \begin{macrocode}
\newboolean{makeSLIDES}
%    \end{macrocode}
%
% The |mechEng| Boolean variable is mentioned above.
%    \begin{macrocode}
\newboolean{elecEng}
\newboolean{mechEng}
\newboolean{compSc}
\newboolean{logic}
\setboolean{elecEng}{true}
\setboolean{mechEng}{false}
\setboolean{compSc}{false}
\setboolean{logic}{false}
%    \end{macrocode}
% Here we have three environments; the default is for electrical
% engineering, where anything in the environment |elecEng| is put into the
% output.  The option |mechEng| will include anything in |mechEng|
% environments and exclude anything in the other two environments.
% Similarly for the |logic| environment.  It all depends on the
% |version| package documented in \emph{The \LaTeX{} Companion}.
% This is a recent addition: 17-10-95, Nick.
%    \begin{macrocode}
      \excludeversion{compSc}%
      \excludeversion{mechEng}%
      \includeversion{elecEng}%
      \excludeversion{logic}%
%    \end{macrocode}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Miscellaneous commands}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is a hodge-podge of commands that are useful in the lecture
% notes.
%
% The default definition of |\college| is quite long, as used for
% notes and for the |slides| option.
%
% \begin{macro}{\college}
%    \begin{macrocode}
      \providecommand{\college}{Hong Kong Institute of Vocational
        Education (Tsing Yi)}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subject}
%    \begin{macrocode}
\providecommand{\subject}{Systems and Network Management}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subjectNumber}
%    \begin{macrocode}
\providecommand{\subjectNumber}{CMT3321}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\department}
%    \begin{macrocode}
\providecommand{\department}%
      {Department of Information and Communication Technology}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\up}
% \begin{macro}{\Up}
% \begin{macro}{\ie}
% \begin{macro}{\eg}
% \begin{macro}{\hex}
%    \begin{macrocode}
\providecommand{\up}{microprocessor\xspace}
\providecommand{\Up}{Microprocessor\xspace}
\providecommand{\ie}{i.e.,\xspace}
\providecommand{\eg}{e.g.,\xspace}
\providecommand{\hex}{$_{16}$\xspace}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% I moved definition of |\eemph| into nick.sty, since it is useful
% in so many other places.
%
%    \begin{macrocode}
% \providecommand{\eemph}[1]{\emph{\textbf{#1}}}
%    \end{macrocode}
%
% The |\overbar| command is useful for printing active low pin names.
% It prints the argument in roman font with a bar over the top.
%
% I also wrote a similar command in my \pkg{acro} package.
% The argument is written in small caps, and a bar is written over the
% top.  The \pkg{acro} acronym package defines a |\mathsc| font changing
% command to make that work.
%
% \begin{macro}{\overbar}
%    \begin{macrocode}
\providecommand{\overbar}[1]{\ensuremath{\overline{\mathrm{#1}}}}
%    \end{macrocode}
% \end{macro}
%
% All changes to |\textwidth| to happen before here (I can't remember
% whether this commandment comes from the documentation for
% \pkg{fancyheadings} or \pkg{seminar}.)
%
% \textbf{\large News flash!}  It seems that it is critical to put
% this before redefining the |\sectionmark| and |\subsectionmark|,
% otherwise the new definitions are ignored!
%    \begin{macrocode}
\pagestyle{fancyplain}
%    \end{macrocode}
% All the next section was written to do the headings and footings.  I
% can't claim to understand it; it was copied directly from
% |article.cls| or some such file.  Since it did not improve the
% footers (there were still many pages with an empty footer, even when
% a |\section| or |\subsection| appeared on the page), I commented it
% out.  One day I'll ask someone how it works.
%
% Later: see ``News flash'' just above.  That solves the problem.
% \begin{verbatim}
%\begin{comment}
%\renewcommand{\sectionmark}[1]%
%                   {\markboth{\thesection\ #1}{\thesection\ #1}}
%\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
%\DeclareRobustCommand{\sectionmark}[1]{\markright{\thesection\ #1}}
%\DeclareRobustCommand{\sectionmark}[1]%
%     {\markright{\ifnum \c@secnumdepth >\m@ne
%            \thesection\hskip 1em\relax \fi
%            #1}}
%\DeclareRobustCommand{\sectionmark}[1]%
%     {\markboth{\thesection\ #1}{\thesection\ #1}}
%\DeclareRobustCommand{\chaptermark}[1]%
%     {\markboth{\thechapter\ #1}{\thechapter\ #1}}
%\end{comment}
% \end{verbatim}
% Hey: this seems to work!  A simple adaptation from my assembly
% language primer page setup.  Note that it is \emph{essential} to put
% the |\pagestyle| first, otherwise these are ignored!
%    \begin{macrocode}
\renewcommand*{\sectionmark}[1]%
{\markboth{\thesection\ #1}{\thesection\ #1}}
\renewcommand*{\subsectionmark}[1]{\markright{\thesubsection\ #1}}
%    \end{macrocode}
%
% \DescribeMacro{\thepage}
% Each page has the form ``L3-4'' (if this is page~4 of lecture~3).
% \begin{macro}{\thepage}
%    \begin{macrocode}
\renewcommand{\thepage}{L\lectureNum-\arabic{page}}
%    \end{macrocode}
% \end{macro}
% \DescribeMacro{\theslide}
% Here |\theslide| is redefined from |\arabic{slide}| to
% provide something that relates to the page number format just
% above.   
% Here I'm making the ``slide number''---which appears at the top-right
% corner of each slide when using the |slidesonly| option---look
% something like:
%
% L1\,S-2
%
% for the slide number~2 in lecture~1.  See the definition of
% the |\slidelabel| redefined above in the code for the |notes| option,
% where |\theslide| is also used.
%
% \begin{macro}{\theslide}
%    \begin{macrocode}
   \renewcommand{\theslide}{\expandafter L\lectureNum\,S-\arabic{slide}}
%    \end{macrocode}
% \end{macro}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The \cmd{\LectureTitle} command}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \DescribeMacro{\LectureTitle}
% The |\LectureTitle| macro has changed since the \pkg{lect} class
% was written.  The macro used to print the title and, as a side effect,
% set the value of |\lectureNum|.  This did not work with the |slidesonly|
% option, because everything after |\begin{document}| that is outside of
% a |slide| environment is ignored.  This caused the value of
% |\lectureNum| to remain undefined, which caused an error every time
% a slide number was printed.  Yet the call to |\LectureTitle| \emph{had}
% to be after |\begin{document}| so that the title could be printed.
% I realised that it had been done badly to begin with; it should do
% either printing or defining, but not both.  The result is that I had to
% redefine it.  This resulted in incompatibility with previous lecture
% notes.  For that reason I changed the name of this class from
% \file{lect.cls} to \file{lect2.cls}, a rather un-nice thing to do.
% This new |\LectureTitle| should be used \emph{before} the
% |\begin{document}|, and produces no output.  It now also defines
% the macro |\lecTitle|.
% \DescribeMacro{\MakeLectureTitle}
% To actually print the lecture title, use
% the macro |\MakeLectureTitle|, which is defined below.  This system
% is now somewhat like the normal \LaTeX{} commands |\title| and
% |\maketitle|.
% 
%
% \begin{macro}{\LectureTitle}
%    \begin{macrocode}
\newcommand{\LectureTitle}[2]%
{%
   \newcommand{\lectureNum}{{#1}}%
   \newcommand{\lecTitle}{{#2}}
}
%    \end{macrocode}
% \end{macro}
%
% Notice that |\MakeLectureTitle| has an optional argument that can
% used to change the first word ``Lecture'' in the title to
% something else.  The default appearance of the title looks something
% like this, though in a much bigger font:
%
% Lecture 3: the title of the lecture
%
% \begin{macro}{\MakeLectureTitle}
%    \begin{macrocode}
\newcommand{\MakeLectureTitle}[1][Lecture]%
{%
   {\LARGE #1 \lectureNum: \lecTitle}%
}
%    \end{macrocode}
% \end{macro}
%
% \DescribeMacro{\lectureTitle}
% To keep compatibility with the older class |lect.cls|, I've
% kept this |\lectureTitle| command.  It should \emph{not} be used in
% new lecture notes!  It won't work with the |slidesonly| option.
% This command goes after the |\begin{document}| command.
%
% \begin{macro}{\lectureTitle}
%    \begin{macrocode}
\newcommand{\lectureTitle}[3][Lecture]%
{%
   \newcommand{\lectureNum}{#2}%
   \textbf{\Large #1 #2: #3}%
}
%    \end{macrocode}
% \end{macro}
%
% Previously I had some conditional code here, depending on
% ``|\ifarticle|''.  I since removed it, since it is more appropriate
% to put this code in the options themselves.
%
% This conditional code used to have one case for the |notes| 
% option, and another case for the |slidesonly| and |slides| options.
% The first case is if the |article| option has been given to the
% |seminar| class.  Most of this code has been moved to the |notes| option
% code where it belongs.
%
% \vspace{1ex}
%
% I can't remember why I didn't delete this; I must have thought it was
% precious.  The |\lfoot| command comes from the |fancyhdr|
% package.
% \begin{verbatim}
% \lfoot[\fancyplain{}{\rmfamily\bfseries \thepage}]%
%       {\fancyplain{}{\footnotesize\bfseries\rightmark}}
% \end{verbatim}
% Well, this makes sure that there is no item centered in the
% footer for each page.  |\cfoot| comes from the |fancyhdr|
% package.
%    \begin{macrocode}
\cfoot{}
%    \end{macrocode}
%
% Same remarks apply to |\rfoot| here as to |\lfoot| just above.
% \begin{verbatim}
% \rfoot[\fancyplain{}{\footnotesize\bfseries\leftmark}]%
%       {\fancyplain{}{\rmfamily\bfseries \thepage}}
% \end{verbatim}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{The heading for the front page of notes produced
% using the \texttt{notes} option}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \DescribeMacro{\lectureHead}
% \begin{macro}{\lectureHead}
%    \begin{macrocode}
%\newcommand{\lectureHead}{%
%\thispagestyle{plain}
%\begin{center}
%\bfseries\large
%\noindent\college

%\noindent\department

%\noindent\subjectNumber\hspace{1em}\subject
%\end{center}

%\vspace{4ex}
%}
%    \end{macrocode}
% \end{macro}

%    \begin{macrocode}
\newcommand{\lectureHead}{%
\newlength{\eelogoWidth}% <=========== For EPS
%\input{tylogoa}% <=========================== FOR bm2font
%\newcommand*{\eelogoWidth}{\tylogoaw}%  <==== FOR bm2font
% See p. 458 of the Companion:
%\newcommand*{\eelogo}{%
%  {%
%    \setlength{\fboxsep}{0pt}%
%    \fbox{\rule{\eelogoWidth}{0pt}\rule{0pt}{\eelogoWidth}}%
%  }%
%}
%
\newcommand*{\eelogo}{%
  {%
%    \fbox{\raisebox{15mm}[0pt][\eelogoWidth]{\settylogoa}}
%    \raisebox{15mm}[0pt][0pt]{\settylogoa}
%    \parbox[b]{\eelogoWidth}{\raisebox{10mm}[0pt]{\settylogoa}}% <=== FOR bm2font
%    \includegraphics[height=31.5mm]{eelogo3.eps}%
%    \includegraphics[height=22.3mm]{eelogo3}% height / \sqrt{2}
%    \includegraphics[height=22.3mm]{eelogo}% height / \sqrt{2}
     \includegraphics[height=22.3mm]{tylogo1}% height / \sqrt{2} <= EPS
  }%
}%
\settowidth{\eelogoWidth}{\eelogo}% <==== FOR EPS
\newlength{\sideWidth}%
\newlength{\logoSep}%
\setlength{\logoSep}{0em}%
\setlength{\sideWidth}{\textwidth}%
\addtolength{\sideWidth}{-\eelogoWidth}%
\addtolength{\sideWidth}{-\logoSep}%
\thispagestyle{plain}%
\noindent\eelogo\hspace{\logoSep}%
\begin{minipage}[b]{\sideWidth}%
  \centering%
  {%
    \large%
    \noindent%
    {\normalsize \college}% Was \Large.
  }\\[1ex]
  {\normalsize \department}\\[1.5ex]\mbox{}
  \subjectNumber\hspace{1em}\subject\par\vspace*{1.5ex}
\end{minipage}\\[2ex]
}%
%    \end{macrocode}
%%    \begin{macrocode}
%\newcommand{\lectureHead}{%
%\newlength{\eelogoWidth}%
%%\newcommand*{\eelogoWidth}{\tylogoaw}%
%% See p. 458 of the Companion:
%%\newcommand*{\eelogo}{%
%%  {%
%%    \setlength{\fboxsep}{0pt}%
%%    \fbox{\rule{\eelogoWidth}{0pt}\rule{0pt}{\eelogoWidth}}%
%%  }%
%%}
%%
%\newcommand*{\eelogo}{%
%  {%
%%    \fbox{\raisebox{15mm}[0pt][\eelogoWidth]{\settylogoa}}
%%    \raisebox{15mm}[0pt][0pt]{\settylogoa}
%%    \includegraphics[height=31.5mm]{eelogo3.eps}%
%    \includegraphics[height=22.3mm]{eelogo3.eps}% height / \sqrt{2}
%  }%
%}%
%\settowidth{\eelogoWidth}{\eelogo}%
%\newlength{\sideWidth}%
%\newlength{\logoSep}%
%\setlength{\logoSep}{0em}%
%\setlength{\sideWidth}{\textwidth}%
%\addtolength{\sideWidth}{-\eelogoWidth}%
%\addtolength{\sideWidth}{-\logoSep}%
%\thispagestyle{plain}%
%\noindent\eelogo\hspace{\logoSep}%
%\begin{minipage}[b]{\sideWidth}%
%  \centering%
%  {%
%    \large%
%    \noindent%
%    {\normalsize \college}% Was \Large.
%  }\\[1ex]
%  {\normalsize \department}\\[1.5ex]\mbox{}
%  \subjectNumber\hspace{1em}\subject\par\vspace*{1.5ex}
%\end{minipage}\\[2ex]
%}%
%%    \end{macrocode}
%
%
%
% This is my setup for the |float| package.
%
%    \begin{macrocode}
\floatstyle{ruled}
\newfloat{Figure}{htbp}{lop}
%    \end{macrocode}
%
%
% Enable the next line to number all |\subsubsection|s, |\paragraph|s
% and |\subparagraph|s.
%
%    \begin{macrocode}
%\setcounter{secnumdepth}{5}
%    \end{macrocode}
%
% All headings go into table of contents:
%
%    \begin{macrocode}
\setcounter{tocdepth}{5}
%    \end{macrocode}
%
% I commented all this stuff out because I still have not understood
% exactly how marks work in \LaTeXe yet.  I'd like to get a running
% footer containing the section titles on one side and the subsection
% titles on the other, but I often get the footer empty, even when a
% new section or subsection is defined.  I'll eventually get around
% to asking someone.
% \begin{verbatim}
% \newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
%                                      {-3.25ex\@plus -1ex \@minus -.2ex}%
%                                      {1.5ex \@plus .2ex}%
%                                      {\reset@font\normalsize\bfseries}}
% \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
%                                     {3.25ex \@plus1ex \@minus.2ex}%
%                                     %{-1em}%
%                                      {0.75ex \@plus .2ex}%
%                                     {\reset@font\normalsize\bfseries}}
% \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
%                                        {3.25ex \@plus1ex \@minus .2ex}%
%                                        %{-1em}%
%                                       {0.5ex \@plus .2ex}%
%                                       {\reset@font\normalsize\bfseries}}
% \end{verbatim}
%
% \begin{macro}{\@pnumwidth}
% \begin{macro}{\@tocrmarg}
% These two lines fix up the overwritten page number problem in the
% table of contents;  Nick, 6-12-94.
%    \begin{macrocode}
\renewcommand\@pnumwidth{3.55em}
\renewcommand\@tocrmarg {4.55em}
%</class>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
\endinput
%    \end{macrocode}
%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
% \Finale
