%% @latexfile{
%%     filename="ltugboat.sty",
%%     version="1.14",
%%     date="8-Mar-1992",
%%     filetype="LaTeX macros for TUGboat",
%%     copyright="Copyright (C) TeX Users Group.
%%            Copying of this file is authorized only if either:
%%            (1) you make absolutely no changes to your copy, OR
%%            (2) if you do make changes, you first rename it to some
%%                other name.",
%%     author="TeX Users Group",
%%     address="TeX Users Group",
%%            P. O. Box 9506,
%%            Providence, RI 02940,
%%            USA",
%%     telephone="401-751-7760",
%%     email="Internet: TUGboat@Math.AMS.com",
%%     codetable="ISO/ASCII",
%%     checksumtype="line count",
%%     checksum="600",
%%     keywords="tex users group, tugboat, latex",
%%     abstract="This file contains the LaTeX-based macros
%%            for preparation of TUGboat, the Communications
%%            of the TeX Users Group."
%%     }
%% *********************************************************
%%
%%  Use of this file also requires the following files:
%%      ARTICLE.STY
%%      ART10.STY
%%      TUGBOAT.CMN (version 1.08+)
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\thistubstyle{latex}
\def\fileversion{v1.14}
\def\filedate{8 March 92}

% Change history at bottom of file
%               *****   LTUGBOAT.STY    *****
%
%
%       Incorporates ideas and elements from these TUGboat authors:
%               Adrian Clark
%               Frank Mittelbach
%               Rainer Sch\"opf

%  Stop here if this file has been read already

\ifx\tugstyloaded@\thistubstyle \tugstyinit
 \endinput\else\let\tugstyloaded@\thistubstyle\fi

\typeout{Document Style `ltugboat' \fileversion \space\space <\filedate>}

% **********************************************************************
%
%  Load macros required by this style

\input article.sty

%  Macros common to ltugboat.sty and tugboat.sty

\input tugboat.cmn


% ***********************************************************************
%
%  Fonts

\font\sevbf=cmbx7
\font \svtnsfb=cmssbx10 scaled \magstep3        % for section titles;

\font \twlsfb=cmssbx10 scaled \magstep1         % definition of \LaTeX
\newfam\sectitlefam                             % requires a family
\textfont\sectitlefam=\svtnsfb
\scriptfont\sectitlefam=\twlsfb

\font\egtsl=cmsl8
\font\tenuit=cmu10                              % for Editor's Note



%  redo definition of 10pt from latex (lfonts), to install \sevbf as
%  \*scriptfont of \bffam and \egtsl in \slfam
\toks0=\expandafter{\xpt\scriptfont\bffam\sevbf \scriptscriptfont\bffam\sevbf
          \scriptfont\slfam\egtsl \scriptscriptfont\slfam\egtsl}
\xdef\xpt{\the\toks0}




% ***********************************************************************
%
%  normal TUGboat dimensions, glue values, penalties

\@twosidetrue           % for odd/even asymmetry in running heads
\twocolumn              % two columns
\sloppy                 % make those columns justify
%\flushbottom           % but ensure they line up
\columnsep 1.5pc        % space between columns
\columnwidth 18.75pc    % width of each column
\parindent \normalparindent     % paragraph indent
\parskip 0pt            % no inter-paragraph space
\leftmargini 2em        % unchanged
\leftmarginv .5em       % unchanged
\leftmarginvi .5em      % unchanged
\oddsidemargin 0pt      % was 42pt
\evensidemargin 0pt     % was 84pt
\topmargin -2.5pc       % was 0pt
\headheight 12pt        % height of running head, unchanged
\headsep 20pt           % distance between header and text
\marginparwidth 48pt    % don't use marginal notes
\marginparsep 10pt      %  in TUGboat
\textheight 54pc        % height of text on page
\textwidth 39pc         % total width of a page


\partopsep=\z@
\topsep=3pt plus1pt minus1pt
\parsep=3pt plus 1pt minus 1pt
\itemsep=\parsep


\def\@normalsize{\@setsize\normalsize{12pt}\xpt\@xpt
\abovedisplayskip=3pt plus 3pt minus 1pt \belowdisplayskip=\abovedisplayskip
\abovedisplayshortskip=\z@ plus3pt \belowdisplayshortskip=1pt plus3pt minus1pt}

\def\small{\@setsize\small{11pt}\ixpt\@ixpt
\abovedisplayskip=2.5pt plus2.5pt minus1pt\belowdisplayskip=\abovedisplayskip
\abovedisplayshortskip=\z@ plus2pt \belowdisplayshortskip=1pt plus2pt minus1pt}

\def\footnotesize{\@setsize\footnotesize{12pt}\xpt\@xpt
\abovedisplayskip=3pt plus 3pt minus 1pt \belowdisplayskip=\abovedisplayskip
\abovedisplayshortskip=\z@ plus3pt \belowdisplayshortskip=1pt plus3pt minus1pt}


% ***********************************************************************
%
%  Lists

\def\@listi{\leftmargin\leftmargini\parsep=1pt plus 1pt minus 1pt
  \itemsep=\parsep
  \listparindent=1em
  }

\def\@listii{\leftmargin\leftmarginii
  \labelwidth=\leftmarginii \advance\labelwidth-\labelsep
  \topsep=2pt plus 1pt minus 1pt
  \parsep=1pt plus 1pt minus 1pt
  \itemsep=\parsep
  \listparindent=1em
  }

\def\@listiii{\leftmargin=\leftmarginiii
  \labelwidth=\leftmarginiii \advance\labelwidth-\labelsep
  \topsep=1pt plus 1pt minus 1pt
  \parsep=\z@
  \itemsep=\topsep
  \listparindent=1em
  }






% ***********************************************************************
%
%  Titles, authors, addresses, signatures

\def\sectitlefont{\fam\sectitlefam\svtnsfb\baselineskip\stbaselineskip}
\setbox\T@stBox=\hbox{\sectitlefont O}
\newdimen\stfontheight          \stfontheight=\ht\T@stBox
\def \sectitle#1{\SecTitletrue \def\s@ctitle{#1}}

\newcount\authornumber
\authornumber=0

\def\author#1{%
  \global\advance\authornumber\@ne
  \expandafter\def\csname theauthor\number\authornumber\endcsname
      {\ignorespaces#1\unskip}%
  \expandafter\let\csname theaddress\number\authornumber\endcsname\relax
  \expandafter\let\csname thenetaddress\number\authornumber\endcsname\relax
  }

\def\address#1{%
  \expandafter\def\csname theaddress\number\authornumber\endcsname
      {\ignorespaces#1\unskip}}

\def\network#1{\def\@network{#1: }}
\def\netaddress{%
  \begingroup
  \let\@network\relax
  \@ifnextchar[{\@netaddress}{\@netaddress[]}%
  }

{\makeactive\@
 \gdef\netaddrat{\makeactive\@\def@{\char"40\discretionary{}{}{}}}
 \makeactive\%
 \gdef\netaddrpercent{\makeactive\%\def%{\char"25\discretionary{}{}{}}}
}

\def\@netaddress[#1]{#1\@sanitize\makespace\ \makeactive\@\makeactive\%%
  \@@netaddress}

\def\@@netaddress#1{%
  \toks@{#1}%
  \ifx\@network\relax \def\@@network{}%
  \else \def\@@network{\@network}\fi
  \expandafter\xdef\csname thenetaddress\number\authornumber\endcsname
    {{\noexpand\rm\@@network}%
     {\noexpand\netaddrat\noexpand\netaddrpercent\noexpand\net
      \ignorespaces\the\toks@\unskip}}%
  \endgroup
  }

\def\net{\tt}

%  Overrides to default author and signature formats

\def\authorlist#1{\def\@author{#1}}
\def\@author{\@defaultauthorlist}


\def\maketitle{\par
 \ifdim\PreTitleDrop > 0pt
   \loop
   \ifdim \PreTitleDrop > \textheight
     \vbox{}\vfil\eject
     \advance\PreTitleDrop by -\textheight
   \repeat
   \vbox to \PreTitleDrop{}
   \global\PreTitleDrop=0pt
 \fi
 \begingroup
 \setcounter{footnote}{0}
 \def\thefootnote{\fnsymbol{footnote}}
% \def\@makefnmark{\hbox to 0pt{$^{\@thefnmark}$\hss}}
 \@maketitle
 \@thanks
 \endgroup
 \setcounter{footnote}{0}
% \let\maketitle\relax
% \let\@maketitle\relax
 \gdef\@thanks{}%\gdef\@author{}\gdef\@title{}%
%\let\thanks\relax
 }

\newif\ifWideSecTitle
\def\@maketitle{\ifSecTitle \global\SecTitlefalse
		\T@stDimen=\hsize
		\ifWideSecTitle \hsize=\textwidth \global\WideSecTitlefalse \fi
                \@sectitle{\s@ctitle}%
		\hsize=\T@stDimen
        \else \vskip\AboveTitleSkip
                \kern\topskip
                \hrule height\z@ depth\z@ width 10pt
                \kern-\topskip
                \kern-\strulethickness
                \hrule height\strulethickness depth\z@
                \kern\medskipamount
                \nobreak
        \fi
        {\nohyphens \interlinepenalty\@M
        \setbox0=
          \hbox{\let\thanks\@gobble
                \let\\=\quad
                \let\and=\quad
                \ignorespaces\@author}%
        {\noindent\bf\raggedright\ignorespaces\@title\endgraf}%
        \ifdim \wd0 < 5pt               % omit if author is null
        \else \nobreak \vskip 4pt       % 4pt + \BelowTitleSkip = \baselineskip
                {\leftskip=\normalparindent
                 \raggedright
                 \def\and{\unskip\\}%
                 \noindent\@author\endgraf}%
        \fi \nobreak \vskip\BelowTitleSkip }}

\def\abstract{
\section*{Abstract}
}
\def\endabstract{}


%  Redefine style of section headings to look more like TUGboat.
%  Start with definitions from art10.sty .  (Only \section correct so far.)
%
%  \vskip 8pt \vskip\parskip before; \vskip 4pt after
%  Negative beforeskip suppresses following parindent.

\def\section{\@startsection {section}{1}{\z@}{-8pt}{4pt}%
        {\normalsize\bf\raggedright}}

\def\subsection{\@startsection{subsection}{2}{\z@}{-8pt}{4pt}%
        {\normalsize\bf\raggedright}}

\def\subsubsection
        {\@startsection{subsubsection}{3}{\z@}{-8pt}{4pt}{\normalsize\bf}}

\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}

\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus
 .2ex}{-1em}{\normalsize\bf}}

%       Modify \appendix from art10.sty, to add ``Appendix''
%       1 May 89 Mittelach comments that we need to put ``Appendix''
%         somewhere other than \thesection if \tableofcontents is used.
%\def\appendix{\par
% \setcounter{section}{0}
% \setcounter{subsection}{0}
% \def\thesection{Appendix \Alph{section}}}


\def\l@part#1#2{\addpenalty{\@secpenalty}
 \addvspace{2.25em plus 1pt} \begingroup
 \@tempdima 3em \parindent \z@ \rightskip \z@ \parfillskip \z@
 {\large \bf \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
 \nobreak \endgroup}
\def\l@section#1#2{\addpenalty{\@secpenalty} \addvspace{1.0em plus 1pt}
\@tempdima 1.5em \begingroup
 \parindent \z@ \rightskip \z@  % article style makes \rightskip > 0 
 \parfillskip \z@
 \bf \leavevmode \advance\leftskip\@tempdima \hskip -\leftskip #1\nobreak\hfil
\nobreak\hbox to\@pnumwidth{\hss #2}\par
 \endgroup}


\def \EdNote{{\tenuit Editor's note:\enspace }}


% ***********************************************************************
%
%  Footnotes

\long\def\@makefntext#1{\parindent 1em\noindent\hbox to 2em{}%
  \llap{\@makefnmark}\null$\mskip5mu$#1}
%  \llap{$^{\@thefnmark}\,$}#1}


% ***********************************************************************
%
%  Figures

\def\fnum@figure{{\bf Figure \thefigure}}




% ***********************************************************************
%
%  Quotes

\def\quote{\list{}{\rightmargin.5\leftmargin}\item[]}

%       From Dominik Wujastyk's font article.  First paragraph of a quotation
%       will not be indented, and right margin is decreased for narrow columns.
\renewcommand{\quotation}{\list{}{\listparindent 1.5em
        \rightmargin.5\leftmargin\parsep 0pt plus 1pt}\item[]}


% ***********************************************************************
%
%  Bibliography

% Changes made only to accomodate local file naming conventions

\def\bibliography#1{%
  \if@filesw\immediate\write\@auxout{\string\bibdata{\@tubfilename{#1}}}\fi
  \@input{\jobname.bbl}}

\def\bibliographystyle#1{\if@filesw\immediate\write\@auxout
    {\string\bibstyle{\@tubfilename{#1}}}\fi}

% Replace \sloppy by something not quite as sloppy

\def\thebibliography#1{\section*{References\@mkboth
  {REFERENCES}{REFERENCES}}\list
  {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \usecounter{enumi}}
    \def\newblock{\hskip .11em plus .33em minus .07em}
%    \sloppy
    \tolerance 8000 \hfuzz .5\p@ \vfuzz .5\p@
    \clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax}

%\def\sloppy{\tolerance 10000 \hfuzz .5\p@ \vfuzz .5\p@}

% ***********************************************************************
%
%  Signature

%  Moved to TUGboat.com



% ***********************************************************************
%
%  \document, \enddocument

% changed \input to \@@input; either use the new functionality or be real
\def\enddocument{\@checkend{document}\clearpage\begingroup  
\if@filesw \immediate\closeout\@mainaux 
\def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
\def\bibcite{\@testdef b}\@tempswafalse \makeatletter\@@input \jobname.aux
\if@tempswa \@warning{Label(s) may have changed.  Rerun to get
cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}



% ***********************************************************************
%
%  Running heads, output routine

\def \rtitlex{\def\tubfont{\normalsize\rm}\TUB, \volx }

\def\PrelimDraftfooter{%
  \dlap{\kern\textheight\kern3pc
        \rlap{\hbox to \pagewd{\midrtitle\hfil\midrtitle}}
  }}

% registration marks; these are temporarily inserted in the running head
\def\MakeRegistrationMarks{}
\def\UseTrimMarks{%
  \def\MakeRegistrationMarks{%
    \ulap{\rlap{%
       \vbox{\dlap{\vbox to\trimlgt{\vfil\botregister}}%
             \topregister\vskip \headmargin \vskip 10pt}}}}%
  }

\def\@oddhead{\MakeRegistrationMarks\PrelimDraftfooter
  \normalsize\csname normalshape\endcsname\rm
  \rtitlex\qquad\midrtitle \hfil \thepage}
\def\@evenhead{\MakeRegistrationMarks\PrelimDraftfooter
  \normalsize\csname normalshape\endcsname\rm
  \thepage\hfil\midrtitle\qquad\rtitlex}
\def\@oddfoot{}
\def\@evenfoot{}

\def\ps@headings{}
\pagestyle{headings}

% Modified to alter \brokenpenalty across columns
\def\@outputdblcol{\if@firstcolumn \global\@firstcolumnfalse
    \global\setbox\@leftcolumn\box\@outputbox
    \global\brokenpenalty10000
  \else \global\@firstcolumntrue
    \global\brokenpenalty100
    \setbox\@outputbox\vbox{\hbox to\textwidth{\hbox to\columnwidth
      {\box\@leftcolumn \hss}\hfil \vrule width\columnseprule\hfil
       \hbox to\columnwidth{\box\@outputbox \hss}}}\@combinedblfloats
       \@outputpage \begingroup \@dblfloatplacement \@startdblcolumn
       \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}\endgroup
    \fi}




% ***********************************************************************
%
%  Macros for Mittelbach's self-documenting style

\def\SelfDocumenting{%
  \setlength\textwidth{31pc}
  \onecolumn
  \parindent 0pt
  \parskip 2pt plus 1pt minus 1pt
  \oddsidemargin 8pc
  \evensidemargin 8pc
  \marginparwidth 8pc
  \toks@\expandafter{\@oddhead}%
  \xdef\@oddhead{\hss\hbox to \pagewd{\the\toks@}}%
  \toks@\expandafter{\@evenhead}%
  \xdef\@evenhead{\hss\hbox to \pagewd{\the\toks@}}%
  \def\ps@titlepage{}%
}



% ***********************************************************************
%
%  MISCELLANEOUS defs for compatibility with tugboat.sty

\newif\ifFirstPar       \FirstParfalse

\newdimen\pagewd        \pagewd=39pc
\newdimen\trimwd        \trimwd=\pagewd
\newdimen\trimlgt       \trimlgt=11in
\newdimen\headmargin    \headmargin=3.5pc
\def\smc{\sc}
\def\ninepoint{\small}



%*************************************************************************
%
%       Start-up

\setcounter{page}{1001}
\PrelimDrafttrue

\def\tugstyinit{%
  \everypar{\@nodocument}%
  \authornumber\z@
  \let\@signature\@defaultsignature
  }

\endinput



% **********************************************************************
%
%   Change history
%

 8 Mar 92       v1.14
added \input article.sty to make this an independent style
added standard headers, prepared for archive installation

20 Nov 91       v1.13
modified \@outputdblcol to reset \brokenpenalty to different values in first
  and second column
added initialization macro (\tugstyinit) for multiple articles

 7 Aug 91	v1.12
modified \thebibliography to make it not quite so sloppy and avoid cases
  where all stretch is put into one line

10 Jun 91	v1.11
added \ifWideSecTitle and modified \@maketitle to (partially) support it

13 Feb 91       v1.10
added \egtsl and incorporated it into \*scriptfont of \slfam for \xpt
to improve appearance of LaTeX and other logos

12 Dec 90       v1.09
modified \@oddhead and \@evenhead to reset `shape' for new font selection
  scheme

25 Oct 90       v1.08
modified \enddocument to use \@@input instead of \input; allows
  other uses of \input

18 Oct 90       v1.07
set authors \raggedright
set \marginparwidth in \SelfDocumenting
removed stretch in space between footnotemark and footnotetext
commented out definition of \@makefnmark in \maketitle
changed \bibliography and \bibstyle to accomodate local file names (see
  also tugboat.sty for definition of \@tubfilename)

13 Oct 90       v1.06
added \listparindent=1em to definitions of \@list... in order to
   distinguish paragraphs

 1 Sep 90       v1.05
made space a <space> in definition of \@netaddress; the obviates error
   messages concerning \begin{document}

 2 Mar 90       v1.04
added \nobreak to \@maketitle to prevent pagebreaks after leading rule

25 Feb 90       v1.03
added definition of \thistubstyle

12 Feb 90       v1.02
modified definition of \@makefntext; now uses \@makefnmark (as one
   might expect)

 6 Feb 90       v1.01
removed "\font\manual=manfnt"; tugboat.com already sets \font\manual=logo10
adjusted definition of \netaddress to remove mis-timed \@sanitize-ation

29 Nov 89       v1.00
changed \titlefont to \sectitlefont
added setting of \baselineskip to defintion of \sectitlefont
changed \TUBparindent to \normalparindent (already in tugboat.com)
removed additions of amcsc* fonts
new definitions of \ragged... in tugboat.com include \nohyphens
moved most of section title material to tugboat.com
moved writing mechanism and multiple document handling to local .drv file
redefined \author to be consistent with tugboat.sty
added \address, \netaddress
moved \signature stuff to tugboat.com
made titles raggedright


20 Oct 89       v0.53
Zeroed \@signature for multiple documents

19 Oct 89       v0.52
Moved \rtitlex to tugboat.com

18 Oct 89       v0.51
Disallowed hyphenations in \section and \subsection



