\newcommand{\attletterversiondate}{1995/07/26}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{attletter}
              [\attletterversiondate ATT letter]
%
% modeled after letter.cls 1994/12/18 with the following changes (by tla)
%
%	89-Jan-17	add \labelheight for height of mailing labels
%			  default is 1in rather than 2in
%	89-Jan-17	add \makehead to print at&t letterhead
%	89-Jan-17	\ragged bottom has been added to \letter
%	89-Jan-17	\opening has been modified to incorporate the
%			  makehead stuff
%	89-Jan-17	the textwidth and margins have been changed
%	89-Jan-17	the default page style has been changed to headings
%	89-Feb-08	added eaddress
%	89-Mar-29	added facesignature
%       90-Feb-25       preload tm.sty before so features defined there
%                         can be used
%       90-May-29       added FAX as optional letterhead item
%       91-Jan-09       made attletter able to use authors fixing
%                         made signature default to tm@authori
%                         bug with dual def of location macro
%       91-Jan-22       added macros for overriding str, city addr
%       91-Mar-25       made fromaddr same size regardless of body size
%       91-May-15       added a return addr label for each addr label
%                         when \makelabels is called
%
%       95-Jul-??       (HWT) converted to Latex2e
%       95-Oct-16       (Hobby) fixed textheight, compatibility mode
%                         margins, and date in multipage letters
% additions:
%
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{tm}}
\ProcessOptions
\LoadClass{tm}

\setlength\lineskip{1\p@}
\setlength\normallineskip{1\p@}
\renewcommand\baselinestretch{}
\setlength\parskip{0.7em}
\setlength\parindent{0\p@}
\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301
\setlength\headheight{12\p@}
\setlength\headsep   {45\p@}
\setlength\footskip{25\p@}
\if@compatibility
  \setlength\textwidth{6in}
  \setlength\textheight{7.5in} % was 8.7in
\else   % correct for inappropriate computation from tmsize*.clo
  \setlength\@tempdima{1.3in}
  \divide\@tempdima\baselineskip
  \@tempcnta=\@tempdima
  \addtolength\textheight{-\@tempcnta\baselineskip}
\fi
\if@compatibility
  \setlength{\oddsidemargin}{18pt} % was 53pt
  \setlength{\evensidemargin}{18pt} % was 53pt
  \setlength{\marginparwidth}{90pt}
\else
  \setlength{\@tempdima}{\paperwidth}
  \addtolength{\@tempdima}{-2in}
  \addtolength{\@tempdima}{-\textwidth}
  \setlength\oddsidemargin   {.5\@tempdima}
  \setlength\evensidemargin  {\oddsidemargin}
  \setlength\marginparwidth  {90\p@}
\fi
\setlength\marginparsep {11\p@}
\setlength\marginparpush{5\p@}
\setlength\topmargin{27pt}
\setlength\footnotesep{12\p@}
\setlength{\skip\footins}{10\p@ \@plus 2\p@ \@minus 4\p@}
\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@oddhead{\slshape\headtoname{} \ignorespaces\toname
                    \hfil \@date
                    \hfil \pagename{} \thepage}%
      \let\@evenhead\@oddhead}
\else
  \def\ps@headings{%
      \let\@oddfoot\@empty
      \def\@oddhead{\slshape\headtoname{} \ignorespaces\toname
                    \hfil \@date
                    \hfil \pagename{} \thepage}}
\fi
\def\ps@empty{%
      \let\@oddfoot\@empty\let\@oddhead\@empty
      \let\@evenfoot\@empty\let\@evenhead\@empty}
\def\ps@firstpage{%
     \let\@oddhead\@empty
     \def\@oddfoot{\raisebox{-45\p@}[\z@]{%
        \hbox to\textwidth{\hspace*{100\p@}%
          \ifcase \@ptsize\relax
             \normalsize
          \or
             \small
          \or
             \footnotesize
          \fi
        \fromlocation \hfill \telephonenum}}\hss}}
\def\ps@plain{%
      \let\@oddhead\@empty
      \def\@oddfoot{\rmfamily\hfil\thepage\hfil}%
      \def\@evenfoot{\rmfamily\hfil\thepage\hfil}}
\newcommand*{\name}[1]{\def\fromname{#1}}
\newcommand*{\signature}[1]{\def\fromsig{#1}}
\newcommand*{\address}[1]{\def\fromaddress{#1}}
\renewcommand*{\location}[1]{\def\fromlocation{#1}}
\newcommand*{\telephone}[1]{\def\telephonenum{#1}}
\name{}
\signature{}
\address{}
\location{}
\telephone{}
\newcommand*{\makelabels}{%
  \AtBeginDocument{%
     \let\@startlabels\startlabels
     \let\@mlabel\mlabel
     \if@filesw
       \immediate\write\@mainaux{\string\@startlabels}\fi}%
  \AtEndDocument{%
     \if@filesw\immediate\write\@mainaux{\string\clearpage}\fi}}
\@onlypreamble\makelabels
\newenvironment{letter}[1]
  {\newpage
    \if@twoside \ifodd\c@page
                \else\thispagestyle{empty} \hbox{}\newpage\fi
    \fi
    \c@page\@ne
    \interlinepenalty=200 % smaller than the TeXbook value
    \@processto{\leavevmode\ignorespaces #1}}
  {\stopletter\@@par\pagebreak\@@par
    \if@filesw
      \begingroup
        \let\\=\relax
        \let\protect\@unexpandable@protect
        \immediate\write\@auxout{%
          \string\@mlabel{\tm@returnaddr}{\toname\\\toaddress}}%
      \endgroup
    \fi}
\long\def\@processto#1{\@xproc #1\\@@@\ifx\toaddress\@empty
    \else \@yproc #1@@@\fi}
\long\def\@xproc #1\\#2@@@{\def\toname{#1}\def\toaddress{#2}}
\long\def\@yproc #1\\#2@@@{\def\toaddress{#2}}
\newcommand*{\stopbreaks}{\interlinepenalty \@M
   \def\par{\@@par\nobreak}\let\\=\@nobreakcr
   \let\vspace\@nobreakvspace}
\def\@nobreakvspace{\@ifstar{\@nobreakvspacex}{\@nobreakvspacex}}

\def\@nobreakvspacex#1{\ifvmode\nobreak\vskip #1\relax\else
               \@bsphack\vadjust{\nobreak\vskip #1}\@esphack\fi}

\def\@nobreakcr{\vadjust{\penalty\@M}\@ifstar{\@xnewline}{\@xnewline}}
\newcommand*{\startbreaks}{\let\\=\@normalcr
   \interlinepenalty 200\def\par{\@@par\penalty 200\relax}}

\newdimen\longindentation
\longindentation=.5\textwidth
\newdimen\indentedwidth
\indentedwidth=\textwidth
\advance\indentedwidth -\longindentation
% opening modified for attletter to add \makehead
\newcommand*{\opening}[1]{\ifx\@empty\fromaddress
  \thispagestyle{firstpage}%
    {\makehead\vtop{\hsize2.5in\noindent{\sf\tm@companyname}}\hfill
     \raggedleft\@date\par}%
  \else  % home address
    \thispagestyle{empty}%
    \makehead\hbox{\vtop{\hsize2.5in\noindent{\sffamily\tm@companyname}}
        \vtop{\hsize3.5in\vspace*{-16\p@}%
            {\coversheetsize\small\raggedleft\begin{tabular}{l}\ignorespaces
              \fromaddress \\*[2\parskip]%
              \@date \end{tabular}\par}}}%
  \fi
  \vspace{2\parskip}%
  {\raggedright \toname \\ \toaddress \par}%
  \vspace{2\parskip}%
  #1\par\nobreak}
\newcommand{\closing}[1]{\par\nobreak\vspace{\parskip}%
  \stopbreaks
  \noindent
  \ifx\@empty\fromaddress\else
  \hspace*{\longindentation}\fi
  \parbox{\indentedwidth}{\raggedright
       \ignorespaces #1\\[6\medskipamount]%
       \ifx\@empty\fromsig
           \fromname
       \else \fromsig \fi\strut}%
   \par}
\medskipamount=\parskip
\newcommand*{\cc}[1]{%
  \par\noindent
  \parbox[t]{\textwidth}{%
    \@hangfrom{\reset@font\rm \ccname: }%
    \ignorespaces #1\strut}\par}
\newcommand*{\encl}[1]{%
  \par\noindent
  \parbox[t]{\textwidth}{%
    \@hangfrom{\reset@font\rm \enclname: }%
    \ignorespaces #1\strut}\par}
\newcommand*{\ps}{\par\startbreaks}
\newcommand*{\stopletter}{}
\newcommand*{\returnaddress}{}
\newcount\labelcount
\newcommand*{\startlabels}{\labelcount\z@
  \pagestyle{empty}%
  \let\@texttop\relax
  \topmargin -50\p@
  \headsep \z@
  \oddsidemargin -35\p@
  \evensidemargin -35\p@
  \textheight 10in
  \@colht\textheight  \@colroom\textheight \vsize\textheight
  \textwidth 550\p@
  \columnsep 25\p@
  \ifcase \@ptsize\relax
    \normalsize
  \or
    \small
  \or
    \footnotesize
  \fi
  \baselineskip \z@
  \lineskip \z@
  \boxmaxdepth \z@
  \parindent \z@
  \twocolumn\relax}
\let\@startlabels=\relax
% mlabel changed for attletter to use \labelheight
\newcommand*{\mlabel}[2]{%
  \setbox0\vbox{\parbox[b]{3.6in}{\strut\ignorespaces #2}}%
  \setbox1\vbox{\parbox[b]{3.6in}{\strut\ignorespaces #1}}%
  \hbox{
      \vbox to \labelheight{\vss \box0 \vss}%
      \vbox to \labelheight{\vss \box1 \vss}%
    }%
  }
\let\@mlabel=\@gobbletwo
\setlength\partopsep{0\p@}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
\def\@listI{\setlength\leftmargin{\leftmargini}
            \setlength\parsep {0\p@}%
            \setlength\topsep {.4em}%
            \setlength\itemsep{.4em}}
\let\@listi\@listI
\@listi
\def\@listii {\setlength  \leftmargin{\leftmarginii}%
              \setlength  \labelwidth{\leftmarginii}%
              \addtolength\labelwidth{-\labelsep}}
\def\@listiii{\setlength  \leftmargin{\leftmarginiii}%
              \setlength  \labelwidth{\leftmarginiii}%
              \addtolength\labelwidth{-\labelsep}%
              \setlength  \topsep    {.2em}%
              \setlength  \itemsep   {\topsep}}
\def\@listiv {\setlength  \leftmargin{\leftmarginiv}%
              \setlength  \labelwidth{\leftmarginiv}%
              \addtolength\labelwidth{-\labelsep}}
\def\@listv  {\setlength  \leftmargin{\leftmarginv}%
              \setlength  \labelwidth{\leftmarginv}%
              \addtolength\labelwidth{-\labelsep}}
\def\@listvi {\setlength  \leftmargin{\leftmarginvi}%
              \setlength  \labelwidth{\leftmarginvi}%
              \addtolength\labelwidth{-\labelsep}}
\renewcommand\footnoterule{%
  \kern-\p@
  \hrule \@width .4\columnwidth
  \kern .6\p@}
\long\def\@makefntext#1{%
    \noindent
    \hangindent 5\p@
    \hbox to5\p@{\hss\@makefnmark}#1}
\newcommand*{\ccname}{cc}
\newcommand*{\enclname}{encl}
\newcommand*{\pagename}{Page}
\newcommand*{\headtoname}{To}

\setlength\columnsep{10\p@}
\setlength\columnseprule{0\p@}

%% attletter extensions to letter
\newdimen\labelheight\labelheight=1in
\newcommand*{\facesignature}[2]{
    \@ifundefined{initbitmap}{\input bitmap.sty}{}
    \ifx\fromname\@empty\def\fromname{#1}\fi
    \def\fromsig{%
        {\parindent=\z@\vskip6\p@
         \xdef\tm@facefile{#2}%
         \vskip-51pt\hskip-3in
         \parbox[b]{3in}{\vbox{}\hskip2in\input \tm@facefile\hfill}%
         \parbox[b]{3in}{#1}}}}
\renewcommand*{\eaddress}[1]{\def\tm@eaddress{#1}}
\newcommand*{\fax}[1]{\def\tm@fax{#1}}
\newcommand*{\phone}[1]{\def\tm@phonei{#1}}
\newcommand*{\room}[1]{\def\tm@officei{#1}}
\newcommand*{\streetaddr}[1]{\def\tm@streetaddr{#1}}
% \cityaddr, \companyname, \capcompanyname defined in tm
\renewcommand*{\returnaddress}[1]{\def\tm@returnaddr{#1}}
% see end for default phone, fax, streetaddr, cityaddr, address, returnaddress
\renewcommand{\makehead}{
   % now make the header
   \newpage{\parskip=\z@\ \vskip-70\p@
   \font\attlogofont=att36
     \hfill\parbox{36pt}{\attlogofont L}
     \parbox{86pt}{{\attlogofont AT\&T}}
   \vskip16pt
   \hrule
   \vskip6pt
   }}

\pagestyle{headings}

\pagenumbering{arabic}
\raggedbottom
\def\@texttop{\ifnum\c@page=1\vskip \z@ plus.00006fil\relax\fi}
\onecolumn
%
% edit these for the location where this file is installed
%
\eaddress{}
\fax{}
\room{\relax}
\companyname{AT\&T Bell Laboratories}
\capcompanyname{AT\&T BELL LABORATORIES}
\phone{908 582-3000} % information number for the location
	% this number may be replaced with a personal number by calling
	% \phone in the preamble of the document
\fax{908 582-5857} % fax # for 1127
%\fax{908 582-2379} % fax # for 1121 (third floor)
\streetaddr{600 Mountain Avenue}
\cityaddr{Murray Hill, NJ\quad 07974-0636}
\address{%
    \if\relax\tm@officei\relax\else\tm@officei\\ \fi
    \tm@streetaddr\\
    \tm@cityaddr\\
    \tm@phonei\ifx\@empty\tm@fax{}\else\\  FAX: \tm@fax\fi
    \ifx\@empty\tm@eaddress{}\else\\ \tm@eaddress\fi}
\returnaddress{\if\relax\tm@officei\relax\else\tm@officei\\ \fi
    \tm@streetaddr\\ \tm@cityaddr}
\signature{\tm@authori}
