summaryrefslogtreecommitdiff
path: root/macros/latex209/contrib/misc/env.sty
blob: 4b14401cddad7b3c294c5460448f7d69a115f7b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
%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}}