%From: <DLV%CUNYVMS1.BITNET@uwavm.acs.washington.edu>

%\documentstyle[12pt,env]{article}
%\nofiles
%\begin{document}
%\sf
%
%\from{Dimitri Vulis} %fills the blank in the return address on our stationery
%
%\begin{envelope}
%Dimitri Vulis\\
%Department of Mathematics/Box 330\\
%City University of New York Graduate Center\\
%33 West 33 St.\\
%New York, NY 10036
%\ZipBar{10036-8099}
%\end{envelope}
%
%\begin{envelope}
%American Mathematical Society\\
%P. O. Box 6248\\
%Providence, RI 02940
%\ZipBar{02940-9943}
%\end{envelope}
%
%\begin{envelope}
%Acad.\ Stanislav P. Merkuriev, Rector\\
%Leningrad State University\\
%Universitetskaya Naberezhnaya, 7/9\\
%Leningrad 199034\\
%USSR
%\end{envelope}
%
%\end{document}
%
%Evidently, the envilope environment contains the address, and \ZipBar produces
%an optional bar code on the bottom right corner.
%
%Assuming that you are facing the LaserWriter, and the cables are toward the
%wall, feed the envelope into the slot on your right (opposite the paper
%cassette) face up, so that its bottom is flush with the edge of the slot
%closest to the wall. If this is consufing, just try all possible combinations.
%
%When you are printing multiple envelopes, there is an approx. 2 second time
%window to feed the next envelope; if you do it too early, or too late, it jams.
%Wait about 2 seconds before the previous envelope disappears. Here, practice
%only makes perfect.
%
%Manual feeding won't work if your paper cassette is empty, and it's normal for
%a blank sheet of paper to be dragged out together with the envelope.


\textwidth9.5in
\textheight6.675in
\pagestyle{empty}
\special{ps: landscape}

\def\@from{}
\def\from#1{\def\@from{#1}}

\newbox\ZipBarL
\newbox\ZipBarS                               %1/64"         1/32"
\setbox\ZipBarL\hbox{\vrule height.125in width.015625in\hskip.03125in}
\setbox\ZipBarS\hbox{\vrule height.05in  width.015625in\hskip.03125in}
%each black bar is about 4.6 dots wide on a 300dpi printer
\newcount\ZipBarm
\newcount\ZipBarn
\newif\ifzipcode
\chardef\ten=10

%Almost like using \ifcase... except `-' is ignored.
\def\ZipBar@@@#1#2{\expandafter\def\csname ZipBar@@#1\endcsname%
{#2\advance\ZipBarn#1\relax}}

\ZipBar@@@0{\copy\ZipBarL\copy\ZipBarL\copy\ZipBarS\copy\ZipBarS\copy\ZipBarS}
\ZipBar@@@1{\copy\ZipBarS\copy\ZipBarS\copy\ZipBarS\copy\ZipBarL\copy\ZipBarL}
\ZipBar@@@2{\copy\ZipBarS\copy\ZipBarS\copy\ZipBarL\copy\ZipBarS\copy\ZipBarL}
\ZipBar@@@3{\copy\ZipBarS\copy\ZipBarS\copy\ZipBarL\copy\ZipBarL\copy\ZipBarS}
\ZipBar@@@4{\copy\ZipBarS\copy\ZipBarL\copy\ZipBarS\copy\ZipBarS\copy\ZipBarL}
\ZipBar@@@5{\copy\ZipBarS\copy\ZipBarL\copy\ZipBarS\copy\ZipBarL\copy\ZipBarS}
\ZipBar@@@6{\copy\ZipBarS\copy\ZipBarL\copy\ZipBarL\copy\ZipBarS\copy\ZipBarS}
\ZipBar@@@7{\copy\ZipBarL\copy\ZipBarS\copy\ZipBarS\copy\ZipBarS\copy\ZipBarL}
\ZipBar@@@8{\copy\ZipBarL\copy\ZipBarS\copy\ZipBarS\copy\ZipBarL\copy\ZipBarS}
\ZipBar@@@9{\copy\ZipBarL\copy\ZipBarS\copy\ZipBarL\copy\ZipBarS\copy\ZipBarS}

\def\ZipBar@@#1{\csname ZipBar@@#1\endcsname}

\def\ZipBar@#1{%
 \ifx#1\null%
  \let\next\relax%
 \else%
  \ZipBar@@{#1}%
  \let\next\ZipBar@%
 \fi%
 \next}

\def\ZipBar#1{%
 \zipcodetrue%
 \par\vspace{.5in}%
 \hfill\hbox{%
 \copy\ZipBarL% start with a long bar
 \ZipBarn\z@%
 \ZipBar@#1\null%
 \ZipBarm\ZipBarn%
 \divide\ZipBarm\ten%
 \multiply\ZipBarm\ten%
 \advance\ZipBarm-\ZipBarn%
 \ifnum\ZipBarm<0%
  \advance\ZipBarm\ten%
 \fi%
 \ZipBar@@{\the\ZipBarm}% last digit, so that the sum is divisible by ten
 \copy\ZipBarL% end with a long bar
 }\hspace*{1.5in}\vspace*{.375in}}

\def\envelope{
\newpage \zipcodefalse
\special{ps::[asis] statusdict /manualfeed true put}
\raggedright
\vspace*{3.175in} %Fill in the blank on our stationary---change as needed
{\parindent.32in\@from\ \par}
\vfill
\parindent3.5in}
%A fancier way would be to put the street address in a box and to center it
\def\endenvelope{\par
\ifzipcode \else \vspace*{1in} \fi
\special{ps::[asis] statusdict /manualfeed false put}}
