From: kwong@mary.cs.fredonia.edu (Harris Kwong)
Newsgroups: comp.text.tex
Subject: Re: .sty for syllabus?
Date: 19 Nov 92 13:37:31 GMT
Organization: Math / CS, State Univ. of N. Y. College at Fredonia
X-Newsreader: Tin 1.1 PL3

depken@rigel.econ.uga.edu (Craig Depken) writes:
: 
: Question says it all. I am looking for a LaTeX .sty file for a decent
: syllabus format. Would rather mooch off of someone else than to develop
: my own.
: 
: Ftp-able files are fine.
: 
: Thanks in advance,
: 
: 	craig depken
: 	depken@rigel.econ.uga.edu

I use the following syllabus.sty, which is actually a modification of
res.sty (by Michael DeCorte).

Harris Kwong

Dept. of Math. & Comp. Sci.
SUNY College at Fredonia
Fredonia,  NY   14063
Email: kwong@mary.cs.fredonia.edu

----- file starts here -----

% syllabus.sty
% Syllabus document style by Y.H. Harris Kwong (August 4, 1991).
% Based on res.sty (Released 25 Feb 1989) by Michael DeCorte

% Usage: \begin{syllabus} ... \end{syllabus}
%
% The options are:
%   11pt        use 11 point fonts instead of 10 point fonts
%   12pt        use 12 point fonts instead of 10 point fonts

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   \newsectionwidth{dimen}
%       defines the amount of space the labels extend into the 
%       left margin.  DO NOT TRY to change any of the dimensions
%       yourself.  You will probably confuse the style file.
%
%   \title{text} 
%       defines title to be printed on top of page.
%
%   \begin{resume} ... \end{resume}
%       all of the resume should go inside of this environment.
%
%   \section{text}
%       prints 'text' in the left hand margin.
%
%   \begin{ncolumn}{n} ... \end{ncolumn}
%       creates a tabular environment with n equally spaced columns, 
%       separate columns by & and end them with \\ \\.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Glue
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% sectionskip     the amount of horizontal before a section
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Dimensions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% sectionwidth    the amount that the section titles go in the
%                 left margin
%
% resumewidth     the width of the total resume from the left
%                 margin to the right.  Don't use textwidth
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% sectionfont     the font used to print section titles
%                 use \renewcommand to change it
%
% titlefont       the font used to print the title
%                 use \renewcommand to change it
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use this to set the sectionwidth.  It adjust the width of the
% text as well as the hoffset You probably shouldn't touch any of 
% the size paramaters unless you really understand all of this 
% but it is not hard.  Either way, it can only be executed once 

\def\sectionfont{\bf}
\newdimen\sectionwidth
\newskip\sectionskip
\newdimen\resumewidth

\resumewidth=6.5in
\sectionskip=3.5ex plus 1ex minus -.2ex % values stolen from LaTeX

\def\newsectionwidth#1{%
   \sectionwidth=#1
   \textwidth=\resumewidth
   \advance\textwidth-\sectionwidth
   \hsize=\textwidth
   \hoffset=\sectionwidth
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Put section titles in the leaft margin.  Multiline section 
% titles are permited and will be broken by TeX to fit into a box 
% \sectionwidth wide.  It is advised that \\ be used to break the 
% lines by hand as \TeX{} will probably not do what you want.  

\def\boxed@sectiontitle#1{%
  \ifx\\\@tabcr    % is this in a tabular? (this *should* work but is a cludge)
    \@stopfield    % the is the first part of a \kill
   \else
     \@@par        % This will end the previous paragraph if needed and
                   % go into vertical mode.  If this was already in
                   % vertical mode then the \par does nothing.
  \fi
  \begingroup
  \everypar={}%
  \def\par{\@@par}%
  \let\\=\@normalcr
  \addpenalty{\@secpenalty} % this would be a good place for a page break
                            % \@secpenalty is what LaTeX uses before its
                            % section's.  It happens to be -300
  \addvspace{\sectionskip}  % put in a bit of glue
  % The following hbox will be contributed to the page list without going
  % into horizontal mode.  Therefore, any \parindent's, \parshape's, \leftskip
  % will be ignored but \hoffset's are not.  The result is that the box will
  % only by \hoffset. This is what I want
  \hbox to 0pt{%
    \hss         % this is an llap.  In other words, this glue
                 % will shrink by the width of the stuff in the vbox
                 % (\sectionwidth) into the left margin and then
                 % insert the contents of the vbox.
    \vtop to 0pt{% make a 0pt height paragraph, with the baseline at the
                 % lined up with the baseline of the first box in the list
      \leftskip=0pt
      \hsize=\sectionwidth
      \textwidth=\sectionwidth
      \raggedright     % you don't want this filled out to the right margin
      \sectionfont
      #1\vss           % Go into horizontal mode; do the paragraph;
                       % go into vertical mode; add some negative glue 
                       % to give a box of 0pt height and depth
    }%
  }%
  \addpenalty{-\@secpenalty} % this would be a bad place for a page break
  \vskip-\baselineskip % when the next box is processed, baselineskip glue
                       % glue will be added (the box has no depth because of
                       % the \vss; therefore, we don't have to worry about
                       % \lineskiplimit).  This -\baselineskip glue
                       % is to undo this.  \nointerlineskip doesn't
                       % work because the baseline of this line would be lined
                       % up with the top of the top of the next box.  We
                       % want the baselines lined up.
                       %
                       % It may have been possible to do this by forcing the
                       % baseline of this box to be the top of the box but
                       % then the interline skip between this box and the
                       % previous box would be off as the baselines of the
                       % this box (the one that being made above) and the
                       % previous line would be separated by \baselineskip
                       % (probably, it may be separted by the depth of the
                       % previous box + \lineskip) but as the baseline of
                       % this box has been moved to the top, the box's would
                       % separted by to much glue.  The exact amount being
                       % the height of this box.
  \endgroup
  \ifx\\\@tabcr   % is this in a tabular? (this *should* work but is a cludge)
    % this is the second part of the \kill; it starts the next tabbing line
    % Because this routine will never get into paragraph mode when used in
    % tabbing the \parskip that is discussed below will never be inserted.
    % Therefore it should not be negated as done below.
    \@startline
    \ignorespaces
  \else
    \vskip-\parskip    % The next thing to be contributed will be a paragraph.
                       % Right before being contributed though a \vskip\parskip
                       % will be inserted.  This is to negate it.
                       %
                       % I do consider this to be a bit of a cludge but
                       % I can not find a way to write \unskipfutureskip
                       % or a way to make TeX think that nothing has
                       % been contributed to the page list.
  \fi
}

\newsectionwidth{1.3in}
\let\@@section\boxed@sectiontitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFAULTS: (some of them)

\typeout{Document Style `syllabus' <4 Aug 1991>.}
\nofiles
\input article.sty

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Print the opening title

\def\titlefont{\large\bf}
\def\title#1{\def\@title{#1}}
\def\@title{}

\def\@printcentername{\begingroup
   \leavevmode\hbox to \textwidth{\hfil{\titlefont\@title}\hfil}\par
\endgroup}

\def\opening{\def\@opening{}
  \begingroup
  \leftskip=-\hoffset        % I use leftskip to move things to the left as 
  \advance\textwidth\hoffset % changing hoffset doesn't work. But this
  \hsize=\textwidth          % doesn't really work as hboxes are rules
                             % are unaffeted
  \let\par=\@@par
  \parindent=0pt
  \parskip=0pt
  \@printcentername
  \endgroup
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% All of the syllabus goes in the syllabus environment

\newenvironment{syllabus}{\begingroup
    \@ifundefined{@opening}{\opening}{}
}{\endgroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% gives you a tabular environment with n equally spaced columns
% \begin{ncolumn}{#} ... \end{ncolumn}
%
% The p option of LaTeX is broken in all but the newest verion
% of latex.tex, this is how to fix it

\def\@endpbox{\par\egroup\hfil}
\let\@@endpbox=\@endpbox

\newdimen\@columnwidth    % the width of each column equal to
\def\ncolumn#1{%
  % \@columnwidth = \textwidth / #1
  \@columnwidth=\textwidth \divide\@columnwidth by #1
  \begin{tabular*}{\textwidth}[t]%
        {*{#1}{@{}p{\@columnwidth}@{\extracolsep{\fill}}}}
}
\def\endncolumn{\end{tabular*}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DEFAULTS: (the rest of them)

\@secpenalty = -500
\topmargin 0pt
\headheight 0pt
\headsep 0pt
\textheight 9in
\textwidth 5.4in
\parindent 0pt
\topmargin 0in
\oddsidemargin -0.15in
\evensidemargin -0.15in
\marginparwidth 0pt
\parindent 0pt
\parskip \baselineskip
\setcounter{secnumdepth}{0}
\def\@listI{\leftmargin\leftmargini
\topsep 0pt 
\parskip 0pt
\partopsep 2pt plus 2pt
\parsep 2pt plus 2pt
\itemsep \parsep}
\pagestyle{empty}
\let\section\@@section

% End of syllabus.sty