summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/kix/kix.sty
blob: 713354cfd41d8d0a94bd76cb245b99617bde7676 (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
% This is kix.sty
% By Sander R.M. Stoks <sanders (at) stoks (dot) nl>
% (c) 1998   17 SEP 1998
% License: LPPLv1 or later.
% Implements KIX codes as used by the Dutch PTT for bulk mail
% addressing. ("Royal Mail 4 State Code")
% "KIX" is a registered trade mark of PTT Post Holdings B.V.
%
% Usage: {\kix 1234AB123}.
% Note: Only caps please.
%
% Example:
%
%   Sander Stoks\\
%   Heyendaalseweg 127 E2-08\\
%   6525 AJ \textsc{Nijmegen}\\[2mm]
%   {\kix 6525AJ127XE2X08}
%
\newlength{\kixwidth}%
\newlength{\kixspace}%
\newlength{\kixsyncheight}%
\newlength{\kixheight}%
\newlength{\kixbase}%
\newlength{\kixlheight}%
\setlength{\kixwidth}{0.505mm plus 0.125mm minus 0.125mm}%
\setlength{\kixspace}{0.505mm plus 0.125mm minus 0.105mm}%
\setlength{\kixsyncheight}{1.27mm plus 0.25mm minus 0.25mm}%
\setlength{\kixheight}{3.15mm plus 0.53mm minus 0.53mm}%
\setlength{\kixbase}{\kixsyncheight}\addtolength{\kixbase}{-\kixheight}%
\setlength{\kixlheight}{\kixheight}%
\addtolength{\kixlheight}{\kixheight}%
\addtolength{\kixlheight}{-\kixsyncheight}%
\newcommand{\kixsync}{\rule{\kixwidth}{\kixsyncheight}\kern\kixwidth}%
\newcommand{\kixup}{\rule{\kixwidth}{\kixheight}\kern\kixwidth}%
\newcommand{\kixdown}{\rule[\kixbase]{\kixwidth}{\kixheight}\kern\kixwidth}%
\newcommand{\kixlong}{\rule[\kixbase]{\kixwidth}{\kixlheight}\kern\kixwidth}%
\begingroup
   \catcode`\1=\active
   \catcode`\2=\active
   \catcode`\3=\active
   \catcode`\4=\active
   \catcode`\5=\active
   \catcode`\6=\active
   \catcode`\7=\active
   \catcode`\8=\active
   \catcode`\9=\active
   \catcode`\0=\active
   \catcode`\A=\active
   \catcode`\B=\active
   \catcode`\C=\active
   \catcode`\D=\active
   \catcode`\E=\active
   \catcode`\F=\active
   \catcode`\G=\active
   \catcode`\H=\active
   \catcode`\I=\active
   \catcode`\J=\active
   \catcode`\K=\active
   \catcode`\L=\active
   \catcode`\M=\active
   \catcode`\N=\active
   \catcode`\O=\active
   \catcode`\P=\active
   \catcode`\Q=\active
   \catcode`\R=\active
   \catcode`\S=\active
   \catcode`\T=\active
   \catcode`\U=\active
   \catcode`\V=\active
   \catcode`\W=\active
   \catcode`\X=\active
   \catcode`\Y=\active
   \catcode`\Z=\active
   \gdef\kix{%
      \def\s{\kixsync}%
      \def\u{\kixup}%
      \def\d{\kixdown}%
      \def\l{\kixlong}%
      \catcode`\1=\active \def1{\s\d\u\l}%
      \catcode`\2=\active \def2{\s\d\l\u}%
      \catcode`\3=\active \def3{\d\s\u\l}%
      \catcode`\4=\active \def4{\d\s\l\u}%
      \catcode`\5=\active \def5{\d\d\u\u}%
      \catcode`\6=\active \def6{\s\u\d\l}%
      \catcode`\7=\active \def7{\s\l\s\l}%
      \catcode`\8=\active \def8{\s\l\d\u}%
      \catcode`\9=\active \def9{\d\u\s\l}%
      \catcode`\0=\active \def0{\s\s\l\l}%
      \catcode`\A=\active \defA{\d\u\d\u}%
      \catcode`\B=\active \defB{\d\l\s\u}%
      \catcode`\C=\active \defC{\s\u\l\d}%
      \catcode`\D=\active \defD{\s\l\u\d}%
      \catcode`\E=\active \defE{\s\l\l\s}%
      \catcode`\F=\active \defF{\d\u\u\d}%
      \catcode`\G=\active \defG{\d\u\l\s}%
      \catcode`\H=\active \defH{\d\l\u\s}%
      \catcode`\I=\active \defI{\u\s\d\l}%
      \catcode`\J=\active \defJ{\u\d\s\l}%
      \catcode`\K=\active \defK{\u\d\d\u}%
      \catcode`\L=\active \defL{\l\s\s\l}%
      \catcode`\M=\active \defM{\l\s\d\u}%
      \catcode`\N=\active \defN{\l\d\s\u}%
      \catcode`\O=\active \defO{\u\s\l\d}%
      \catcode`\P=\active \defP{\u\d\u\d}%
      \catcode`\Q=\active \defQ{\u\d\l\s}%
      \catcode`\R=\active \defR{\l\s\u\d}%
      \catcode`\S=\active \defS{\l\s\l\s}%
      \catcode`\T=\active \defT{\l\d\u\s}%
      \catcode`\U=\active \defU{\u\u\d\d}%
      \catcode`\V=\active \defV{\u\l\s\d}%
      \catcode`\W=\active \defW{\u\l\d\s}%
      \catcode`\X=\active \defX{\l\u\s\d}%
      \catcode`\Y=\active \defY{\l\u\d\s}%
      \catcode`\Z=\active \defZ{\l\l\s\s}%
}%
\endgroup