3 %%% Typeset cards for keeper secrets.
5 %%% (c) 2012 Mark Wooding
8 %%%----- Licensing notice ---------------------------------------------------
10 %%% This file is part of the distorted.org.uk key management suite.
12 %%% distorted-keys is free software; you can redistribute it and/or modify
13 %%% it under the terms of the GNU General Public License as published by
14 %%% the Free Software Foundation; either version 2 of the License, or
15 %%% (at your option) any later version.
17 %%% distorted-keys is distributed in the hope that it will be useful,
18 %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
19 %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 %%% GNU General Public License for more details.
22 %%% You should have received a copy of the GNU General Public License
23 %%% along with distorted-keys; if not, write to the Free Software Foundation,
24 %%% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 \documentclass[a4paper, landscape,
12pt
]{article
}
27 \usepackage[utf8
]{inputenc}
28 \usepackage[T1]{fontenc}
29 %%\usepackage[palatino, helvetica, courier, maths = cmr]{mdwfonts}
32 %% Report errors with enough context that we can debug them.
33 \errorcontextlines=
999
35 %% Basic layout for the cards. We use the paragraph filling machinery, but
36 %% don't actually need most of the trimmings.
41 %% Page layout: try to use most of the page. The document class will already
42 %% have set up the paper size, but we do the rest here.
43 \hoffset=-
1in
\voffset=-
1in
45 \textwidth=
\paperwidth \advance\textwidth by -
2\oddsidemargin
47 \headheight=
0pt
\headsep=
0pt
48 \textheight=
\paperheight \advance\textheight by -
2\topmargin
49 \AtBeginDocument{\special{papersize=
\the\paperwidth,
\the\paperheight}}
51 %% Parameters for the cards and guide rules.
52 \newdimen\cardwd \cardwd=
82mm
53 \newdimen\cardht \cardht=
49mm
54 \newdimen\guidelen \guidelen=
10mm
55 \newdimen\rulewd \rulewd=
0.6pt
57 %% Typesetting the secret as text. The macro \snarf TOKEN T0 T1 ... T7
58 %% gathers T0 T1 ... T7 into a single argument and passes them to TOKEN, as
59 %% long as T0 is not \relax. We use this to process the secret text in a
60 %% continuation-passing style.
62 \ifx#2\relax\let\next\empty%
63 \else\def\next{\snarfdo#1#2}%
67 \def\snarfdo#1#2#3#4#5#6#7#8#9{#1{#2#3#4#5#6#7#8#9}}
69 %% Print the left and right halves of the line, with a separator. Use boxes
70 %% for the lines so that TeX will work out the width of the enclosing vbox
71 %% for us. The basic usage is \line TEXT \relax ... \relax, with eight
72 %% \relax tokens: this is enough to complete both \snarf calls.
73 \def\line{\snarf\lineleft}
74 \def\lineleft#1{\hbox\bgroup#1 \snarf\lineright}
75 \def\lineright#1{#1\egroup\line}
77 %% Typeset a card containing a secret. Usage is \card{INDEX}{SECRET}.
80 %% Make sure we're setting a paragraph.
83 %% Initial material: a stretchy space on the left.
86 %% An alignment for the guide markers surrounding the actual card.
90 \vrule width
\guidelen height
\rulewd depth
0pt
%
91 \vrule width
\rulewd depth
0pt height
\guidelen%
99 \vrule width
\rulewd depth
0pt height
\guidelen%
100 \vrule width
\guidelen height
\rulewd depth
0pt
%
109 %% We actually do more or less sensible typesetting. TeX will set the
110 %% box width from the hsize, and we should leave a small margin all
112 \parfillskip=
0pt plus
1fil
%
113 \leftskip=
1em
\rightskip=
1em
%
117 \hrule height
0pt
\prevdepth =
0pt
%
119 {\large\bfseries\textsf{\keeper} secret
#1/
\total}%
121 %% The QR-code and the text of the secret.
124 \vcenter{\hbox{\includegraphics[scale =
2.4]{#1.eps
}}}%
128 \relax\relax\relax\relax\relax\relax\relax\relax%
140 %% Bottom left guides.
141 \vrule width
\guidelen depth
\rulewd height
0pt
%
142 \vrule width
\rulewd depth
\guidelen height
0pt
%
144 %% Bottom centre gap.
147 %% Bottom right guides.
148 \vrule width
\rulewd depth
\guidelen height
0pt
%
149 \vrule width
\guidelen depth
\rulewd height
0pt
%
152 %% Leave a small vertical space at the bottom to separate lines of cards.
156 %% End material: a stretchy space to match the one at the start, and then
158 \nobreak\hfil\hbox{}%
162 %%%----- That's all, folks --------------------------------------------------