%Here's my env.sty. It is a modified version of a file that I once got
%from pip.shsu.edu. It works well with standard envelopes (4 1/8" x
%9 1/2"), Laser Jet 4L, and dvilj2p in landscape mode (dvilj2p is part of
%dvi2xx). I have no idea whether it will work with any other printer
%and DVI driver.

%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}
%
%\end{document}
%
%Evidently, the envelope environment contains the address, and \ZipBar produces
%an optional bar code on the bottom right corner.
%

% P.S. from Victor Boyko (vb1890@cs.nyu.edu). This style has been
% modified to work with a LaserJet 4L and dvilj2p. I also added the
% macro \ZipAndBar which inserts a zip code and the address and also
% prints a bar. Example:
% ...
% New York, NY \ZipAndBar{10036-8099}
% \end{envelope}

\topmargin -3.3cm

\textwidth9.5in
\textheight4.125in
\pagestyle{empty}

\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\ZipAndBar#1{#1\ZipBar{#1}}

\def\envelope{
\newpage \zipcodefalse
\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\vspace{0.5cm}
\ifzipcode \else \vspace*{1in} \fi
}


