summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/badge/badges.tex
blob: 8c3bc25546361cb145d69fe284e6b6f7be3ea650 (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
%
% BEGIN PARAMETERS
%
%===========================================================
\hsize=16cm%\hoffset=-2.54cm
\vsize=24cm\voffset=-1.54cm

\def\height{4cm}		% heigth of a badge
\def\width{7.5cm}		% width of a badge
%===========================================================
%
% END PARAMETERS
%

\parskip=0pt
\baselineskip=0pt
\lineskip=0pt
\nopagenumbers

\font\RC=RC scaled 483				% take your own logo here
\font\tue=tue scaled 403			% take your own logo here
\font\namefont=cmssbx10 scaled\magstep2
\font\addressfont=cmss10 scaled\magstep1

\def\hidehrule#1#2{\kern-#1%
	\hrule height#1 depth #2 \kern-#2 }
\def\hidevrule#1#2{\kern-#1{\dimen0=#1
	\advance\dimen0 by#2\vrule width\dimen0}\kern-#2 }
\def\makeblankbox#1#2{\hbox{\lower\dp0\vbox{\hidehrule{#1}{#2}%
	\kern\ht0\hidehrule{#1}{#2}\kern-\ht0%
	\kern-#1 % overlap the rules at the corners
	\hbox to \wd0{\hidevrule{#1}{#2}%
		\raise\ht0\vbox to #1{}% set the vrule heigth
		\lower\dp0\vtop to #1{}% set the vrule depth
		\hfil\hidevrule{#2}{#1}}%
	\kern-#1\hidehrule{#2}{#1}
	}}}
	
\def\makelightbox{\makeblankbox{.2pt}{.2pt}}

\def\nullbox#1#2#3{\setbox0=\null
	\ht0=#1 \dp0=#2 \wd0=#3 \copy0\kern-\wd0\makelightbox}	

\newdimen\x \newdimen\y
\def\put(#1,#2,#3){\setbox0=\hbox{#3}%
	\x=#1\y=#2 \advance\y by\ht0	% put reference point of box at (x,y)
	\vbox to 0pt{\kern-\y
	\hbox{\kern\x\copy0\kern-\wd0\makelightbox}\vss}
	\nointerlineskip}


\newcount\cnt \cnt=0
\newdimen\X \newdimen\Y \X=0cm \Y=0cm

\def\badge#1#2{
   \advance\cnt by1
   \ifodd\cnt\X=0cm\advance\Y by-\height
      \ifnum\Y<-\vsize\eject\cnt=1\X=0cm\Y=-\height\fi
      \else\advance\X by\width
   \fi
   \put(\X,\Y,% don't leave this percent sign!
   	\vbox to \height{
		\kern.5cm
		{\namefont\hbox to\width{\hfill#1\hfill}}
		\vfil		% next line is site dependant !!!!!!
		\hbox to \width{\kern.5cm{\tue tue}\hfill{\RC RC}\kern.5cm}
		\vfil		% above line is site dependant !!!!!!
		{\addressfont\hbox to\width{\hfill#2\hfill}}
		\kern.5cm%
	})
}

\newread\addressfile
\newif\ifGoOn	\GoOntrue

\openin\addressfile=addresses
\ifeof\addressfile\message{Cannot open addresses}\end\fi

\read\addressfile to \text \let\name=\text
\loop
   \read\addressfile to \text \let\inst=\text
   \immediate\write16{Badge: \name \inst}
   \badge{\name}{\inst}
   \read\addressfile to \text \let\name=\text
   \ifeof\addressfile\GoOnfalse\fi
   \ifGoOn
\repeat

\closein\addressfile
\bye