\iffalse
% This is windlet.doc.  Print it using doc.sty and an appropriate
% driver file.
% Copyright D.Love, SERC Daresbury Laboratory, 1990
% Distributable and usuable under conditions of the GNU copyleft, but
% please mark any changes and list them here.
\fi
\def\filedate{26/7/90}
\def\fileversion{1.1}
% \title{A {\sf letter} Sub-style for Use with Window
% Envelopes\footnote{File version \fileversion, dated \filedate.}}
% \author{David Love\\[1ex]{\it SERC Daresbury
% Laboratory, Warrington WA4 4AD, UK}\\[1ex]
% ({\tt d.love@daresbury.ac.uk})}
% \date{}
%
% \maketitle
%
% \begin{abstract}
% \noindent This is a sub-style for use with {\sf letter} that can be
% used with certain types of envelope with windows so that the address
% will show through the window.
% \end{abstract}
%
% \noindent
% It is convenient, rather than use a sticky address label for a one-
% or few-off letter, to use envelopes with transparent windows.  We
% then need to make sure that the {\sf letter} style is suitably
% altered so print the \verb+\toaddress+ in the correct place for this
% window.  Of course, the values of the positioning will depend on the
% stationery you use.  This version is intended for use with A4 paper
% i.e., using {\tt a4.sty},
% and $8.62''\times3.34''$ envelopes as used in my establishment, at
% least.  This will probably be
% suitable also for other European countries.  If not, the dimensions
% should be readily changeable for your stationery, according to the
% following diagrams.
% \par \medskip
% \setlength{\unitlength}{6mm}
% \begin{picture}(8.25,6.69)(0,5)
% \put(0,5){\line(0,1){6.69}} \put(0,11.69){\line(1,0){8.25}}
% \put(8.25,11.69){\line(0,-1){6.69}} 
% \put(.85,10.2){\vector(-1,0){.85}}\put(0,10.2){\vector(1,0){.85}}
% \put(.2,10.5){\tt\small $\backslash$lettersideskip}
% \put(.85,8.4){\framebox(3.35,1.5){\parbox{3\unitlength}{\raggedright
% \tt\small $\backslash$toaddress region}}}
% \put(4.0,9.9){\vector(0,1){1.79}}\put(4.0,11.69){\vector(0,-1){1.79}}
% \put(4.0,10.7){\tt\small ~$\backslash$lettertopskip}
% \put(.5,7.75){\vector(-1,0){.5}} \put(.5,7.75){~first fold}
% \put(4.0,7.75){\vector(0,1){.65}}\put(4.0,8.4){\vector(0,-1){.65}}
% \put(4.0,7.75){\tt\small ~$\backslash$letterfoldskip}
% \put(4.4,8.4){\vector(0,1){1.5}} \put(4.4,9.9){\vector(0,-1){1.5}}
% \put(4.4,9){~\tt\small $\backslash$letteraddressheight}
% \put(3,6){{\large letter}}
% \end{picture}
% \hfill
% \begin{picture}(8.6,4.35)(0,0)
% \put(0,0){\framebox(8.6,4.35){}}
% \put(.65,.85){\framebox(3.65,1.55){window}}
% \put(4.5,.85){\vector(0,1){1.55}} \put(4.5,2.4){\vector(0,-1){1.55}}
% \put(4.5,1.3){~$1.55''$}
% \put(.65,.9){\vector(-1,0){.65}}\put(0,.9){\vector(1,0){.65}}
% \put(.3,.2){$0.65''$}
% \put(.65,4.35){\vector(0,-1){1.9}}\put(.65,2.45){\vector(0,1){1.9}}
% \put(.65,3.2){~$1.9''$}
% \put(5,3.5){{\large envelope}}
% \end{picture}
% \par\medskip
% Here are the default values of the lengths,
% \DescribeMacro{\lettertopskip}\DescribeMacro{\lettersidepskip}%
% \DescribeMacro{\letteraddressheight}\DescribeMacro{\letterfoldskip}%
% appropriate for my stationery. 
%    \begin{macrocode}
\newlength{\lettertopskip} \setlength{\lettertopskip}{1.8in}
\newlength{\lettersideskip} \setlength{\lettersideskip}{0.8in}
\newlength{\letteraddressheight} 
\setlength{\letteraddressheight}{1.5in}
\newlength{\letterfoldskip} \setlength{\letterfoldskip}{0.65in}
%    \end{macrocode}
%
% We only need major surgery on \verb+\opening+,\DescribeMacro{\opening}
% which positions the
% addresses.  The difficulty is positioning boxes in the right
% absolute place on the paper.
%    \begin{macrocode}
\def\opening#1{
%    \end{macrocode}
% The {\sf firstpage} style is defined below.
%    \begin{macrocode}
  \thispagestyle{firstpage}
%    \end{macrocode}
% To get to the bottom of the address area, we have to move down by
% \verb+\lettertopskip+ from the top of the paper.  However, we have
% to take into account the conventional $1''$ border,
% \verb+\topmargin+, \verb+\headheight+, \verb+\headsep+ and
% \verb+\baselineskip+ in doing so.
%    \begin{macrocode}
  \vspace*{\lettertopskip}
  \vspace*{-\topmargin} \vspace*{-\headheight} \vspace*{-\headsep}
  \vspace*{-1in} \vspace*{-\baselineskip}
%    \end{macrocode}
% Now that we're in the right place vertically, we're ready to typeset 
% the addressee details.
% To get to the left-hand side of the address area, we have to
% subtract the $1''$ and \verb+\oddsidemargin+ from
% \verb+lettersideskip+, which will probably mean the address sticks
% into the margin.  The addressee's and sender's addresses go in boxes
% at the left and right of the page, aligned at their top.  This is
% not the same as in the original, where the sender's address pushed
% the addressee'd down the page.  This all goes into an \verb+\hbox+
% positioned appropriately relative to the left margin.  Since the
% window is bigger than the address area, we don't need to add extra
% space around it.
%    \begin{macrocode}
  \hbox{% 
    \hspace*{\lettersideskip}\hspace*{-\oddsidemargin}\hspace*{-1in}%
%    \end{macrocode}
% The first thing we do, though, is to put a mark at the left to tell
% us where to fold the paper.  This may get lost, depending on how
% close to the edge of the paper the printer can go, so might need
% adjusting for your circumstances.  The size of the rule is rather
% arbitrary. 
%    \begin{macrocode}
    \vbox to 0pt{\vspace*{\letterfoldskip}\hbox to 0pt{%
      \hspace*{-\lettersideskip}%
      \hspace*{.2in}% to get to imageable area
      \rule{.2in}{.2pt}\hss}\vss
    }%
%    \end{macrocode}
% Unlike the original, we check for a possible
% empty argument to \verb+\begin{letter}+, which would cause an
% error (although there's not much point in using this sub-style if
% you don't have the address in there!).  We add \verb+\vfill+ to
% centre the address in the window vertically.  (It had better not be
% too long.)
%    \begin{macrocode}
    \ifx\@empty\toaddress
      \vbox to \letteraddressheight {\vfill \raggedright \toname \vfill}
    \else
      \vbox to \letteraddressheight 
        {\vfill \raggedright \toname \\ \toaddress \vfill}
    \fi
%    \end{macrocode}
% The sender's address is set the same way as in the original, but in
% a different place.
%    \begin{macrocode}
    \ifx\@empty\fromaddress
      \relax
    \else
      \vbox to \letteraddressheight {
        \vfill
        \begin{tabular}[b]{l}
          \ignorespaces\fromaddress
        \end{tabular} 
        \vfill
      }
    \fi 
  } % (hbox)
%    \end{macrocode}
% The date always comes out in the same place.
%    \begin{macrocode}
  \par \smallskip
  {\raggedleft \@date \par}
  \bigskip #1 \par \nobreak
} % (\def\opening)
%    \end{macrocode}
% The original value of \verb+\@texttop+\DescribeMacro{\@texttop}
% included \verb+fil+ to centre
% a short letter on the page; we don't want this.
%    \begin{macrocode}
\let\@texttop=\relax
%    \end{macrocode}
%
% The \verb+\pagestyle+\DescribeEnv{firstpage}
% for the first page may be chosen appropriately
% for your institution.  This is done by defining \verb+\ps@headings+
% appropriately.  {\tt letter.sty} does this to put the telephone
% number in the right place for the SRI letterhead, which isn't much
% use for most of us.  In the absence of a better idea, we'll make the
% style {\sf empty}.  If you want special action for this, you'll
% have to change this definition or include it in a later sub-style.
%    \begin{macrocode}
\let\ps@firstpage=\ps@empty
%    \end{macrocode}    
