summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ticket/doc/manual.tex
blob: 6c0450bea90d6127d5d266abb5322101c08e8da2 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
\documentclass[aspectratio=1610,hyperref={pdfpagelabels=false}]{beamer}

\usetheme{Bergen}

%\nobuttons
%% user definitions

\def\code#1{\texttt{#1}}
\newcommand{\ticket}{{\code{ticket.sty}}}
\newcommand{\bs}{{\mtt\\}}

\hypersetup{pdfauthor={Thomas Emmel}}
\hypersetup{pdftitle={ticket manual}}
\hypersetup{pdfsubject={ticket.sty}}

\IfFileExists{cmtt.sty}{\usepackage{cmtt}}{}

\usepackage{verbatim}
\usepackage{amssymb}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\sffamily

\title{\begin{minipage}[t]{0.98\textwidth}\begin{center}
      {\mdseries \ticket{} v0.4d October 11, 2016}\\[1ex]
      Making labels, business cards, pins and flash-cards with \LaTeX\\[1ex]
      A short introduction
    \end{center}\end{minipage}}

\author{\scalebox{1}[1.1]{Thomas Emmel} \href{mailto:thomas@family-emmel.de}%
  {thomas@family-emmel.de}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
  \maketitle
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{A short introduction}

\begin{block}{\ticket{}}
  provides a simple interface to produce 
\end{block}
  business cards, labels for your files, stickers, pins and
  other stuff for your office, conferences etc.\\[2ex]
  All you need is a definition of your \lq{}ticket\rq{} included in
  a ticket definition file (\code{.tdf}),\\
%  $\rightarrowtail$ see \hyperlink{tdf}{ticket definition file}\\
  and the two commands \code{\bs{}ticketdefault} and \code{\bs{}ticket}.\\
%  $\rightarrowtail$ see \hyperlink{ticket}{how to fill your ticket}\\[2ex]
  See these examples to get an idea what you can get:\\
  \begin{exampleblock}{\href{ex_file.pdf}{\code{ex\_file}}}back labels for your files...\end{exampleblock}
  \begin{exampleblock}{\href{ex_pin.pdf}{\code{ex\_pin}}}pins for a conference...\end{exampleblock}
  \begin{exampleblock}{\href{ex_vcard.pdf}{\code{ex\_vcard}}} business-cards...\end{exampleblock}
  \begin{exampleblock}{\href{ex_marks.pdf}{\code{ex\_marks}}} different markers used...\end{exampleblock}
  \begin{exampleblock}{\href{ex_flashcard.pdf}{\code{ex\_flashcard}}} flash-cards, try it...\end{exampleblock}
  \begin{exampleblock}{\href{ex_flashcard_dup.pdf}{\code{ex\_flashcard\_dup}}}in duplex mode\end{exampleblock}
  \begin{exampleblock}{\href{ex_flashcard_rm.pdf}{\code{ex\_flashcard\_rm}}}in rows\end{exampleblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
  \frametitle{How to use it}

  Just add this line to the header of your latex-file:

  \code{\bs{}usepackage[{\itshape tdf-file,other options}]\{ticket\}}

  Use the letter or article documentclass and 
  set up the paper-size that you need.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
  \frametitle{The ticket definition file}\hypertarget{tdf}{}
A sample ticket definition (\code{lz1680.tdf}) for a \lq{}LEITZ\rq{}-product is:\\
\begin{quote}
  \begin{minipage}[t]{0.5\textwidth}
    {\scriptsize
\begin{verbatim}
%%
%% ticket for "Leitz 1680" 
%% pre-cutted label for wide files
%%
\unitlength=1mm
%% tested for an HP5SiMX, adjust it for your printer
\hoffset=-16.2mm
\voffset=-6.6mm
\ticketNumbers{1}{4}
\ticketSize{189}{56.5}     % in unitlength
\ticketDistance{0}{9.8}    % in unitlength
\end{verbatim}
      }
    \end{minipage}
\end{quote}
The meaning of \code{\bs{}unitlength} is obvious, \code{\bs{}hoffset} and 
\code{\bs{}voffset} are used to adjust the printed output.
\code{\bs{}ticketNumbers\{n$_x$\}\{n$_y$\}} are the number of the tickets
on the sheet in horizontal and vertical direction.
\code{\bs{}ticketSize\{width\}\{height\}} is the size of one ticket and
\code{\bs{}ticketDistance\{dist$_x$\}\{dist$_y$\}} are spaces
between the tickets.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
  \frametitle{Missing the ticket definition file}
If you like to test a new ticket definition or you like to create only a single output without reusing those definitions anymore, \ticket{} assumes default values which can be
redefined in your file.\\
Simply call \ticket{} without any ticket definition:

\code{\bs{}usepackage[{\itshape other options}]\{ticket\}}

and add your definitions directly to the head of the file after loading ticket.sty.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
  \frametitle{How to fill your ticket}\hypertarget{ticket}{}%
  \ticket{} enables a picture-environment for all tickets. 
  You can put things 
  into this picture with \code{\color{red}\bs{}ticketdefault} and \code{\color{red}\bs{}ticket}.
  Both commands offer one argument.\\
  \begin{exampleblock}{\code{\bs{}ticketdefault}}
  is used to put a default and unique background to your  ticket, that will be -- of course -- not changed for all tickets unless
  you change it with:\\
%  \begin{quote}
    \begin{minipage}[t]{.5\textwidth}
      {\scriptsize
\begin{verbatim}
\renewcommand{\ticketdefault}{%
    \put(100, 5){\includegraphics[width=35mm]{logo}}%
    \put(100,50){\begin{rotate}{180}\Huge ...\end{rotate}}%
    }
\end{verbatim}
        \normalsize
        }
    \end{minipage}
%  \end{quote}
  \end{exampleblock}
  \begin{exampleblock}{\code{\bs{}ticket}}
  is used to provide the content which will be changed
  for the individual tickets. The simplest way to do that is to define a new 
  command like this:\\
%  \begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\newcommand{\myticket}[3]{\ticket{%
    \put(  0, 5){#1}%
    \put( 20,20){{\bfseries\large#2}\\#3}%
    }}
\end{verbatim}
        }
    \end{minipage}
%  \end{quote}
\end{exampleblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\cross{%
  \begin{picture}(0,0)%
    \put(-2,0){\line(1,0){4}}\put(0,-2){\line(0,1){4}}%
    \end{picture}}%
\begin{frame}
  \frametitle{Additional Options}
Most of the options other than the tdf-file are used to create marks
or decorations around the ticket:\\
\begin{alertblock}{crossmark%
\begin{picture}(23,0)(-5,0)\color{red}
  \put(0,0){\cross}%
  \put(0,8){\cross}%
  \put(17,0){\cross}%
  \put(17,8){\cross}%
\end{picture}}
Add a cross at all four corners of the ticket
\end{alertblock}
\begin{alertblock}{circlemark%
\begin{picture}(23,0)(-5,0)\color{red}
  \put(0,0){\circle{2}}%
  \put(0,8){\circle{2}}%
  \put(17,0){\circle{2}}%
  \put(17,8){\circle{2}}%
\end{picture}%
}
Add a circle at all four corners
\end{alertblock}
\begin{alertblock}{emptycrossmark%
\begin{picture}(23,0)(-5,0)\color{red}
  \put(-1,0){\line(-1,0){2}}
  \put(0,-1){\line(0,-1){2}}
  \put(-1,8){\line(-1,0){2}}
  \put(0,11){\line(0,1){2}}
  \put(18,0){\line(1,0){2}}
  \put(17,-1){\line(0,-1){2}}
  \put(18,8){\line(1,0){2}}
  \put(17,11){\line(0,1){2}}
\end{picture}%
}
A crossmark where the part of the cross inside the ticket is not visible
\end{alertblock}
\begin{alertblock}{cutmark%
\begin{picture}(23,0)(-5,0)\color{red}
  \put(0,-1){\line(0,-1){2}}
  \put(0,11){\line(0,1){2}}
  \put(18,0){\line(1,0){2}}
  \put(17,-1){\line(0,-1){2}}
  \put(18,8){\line(1,0){2}}
  \put(17,11){\line(0,1){2}}
\end{picture}%
}
Just add cutmarks at the outer region of the page
\end{alertblock}
\begin{alertblock}{boxed%
\begin{picture}(23,0)(-5,0)\color{red}
  \put(0,0){\line(0,1){8}}
  \put(0,0){\line(1,0){17}}
  \put(17,8){\line(-1,0){17}}
  \put(17,8){\line(0,-1){8}}
\end{picture}%
}
Add a frame around each ticket
\end{alertblock}
\begin{alertblock}{rowmode}
This option creates the tickets in rows instead of columns,
which might be useful in some cases.
\end{alertblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
  \frametitle{Special commands}
\begin{exampleblock}{reset tickets}
  You can add additional page-breaks with \code{\bs{}newpage\bs{}ticketreset}. This clears the ticket-buffers and sets the corresponding values to initial values.
This can be used if you create a handful of tickets multiple times.
\end{exampleblock}

\begin{exampleblock}{\code{\bs{}backside}}
is useful for flash-cards, see the use-cases below.
\end{exampleblock}

\begin{exampleblock}{skip tickets}
Once you printed a series of tickets you mostly end up with some empty stickers on your sheet. In this case use \code{\bs{}ticketskip\{5\}} to skip 5 tickets (New feature)
\end{exampleblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
  \frametitle{Organising and reading input}
  In general it is a good idea to create a file that contains all definitions and the whole latex-setup and a second file that contains only the data that you like to print which can be referenced by \code{\bs{}input}. 

For example, if you reference a huge database of names of people which are used for the pins of a conference, you can easily write a script (perl, python...) that extracts the data to a file that is itself latex-formated with a \code{\bs{}myticket\{  \}\{  \}\{  \}} on each line.

Sometimes -- of course -- you only have to print only a small amount of data and all data can easily be written to a single file. 

Sometimes a small generator-function can help to create numbers on tickets:

\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\newcounter{numcards}
...
\begin{document}
...
\whiledo{\thenumcards<25}{\stepcounter{numcards}\acard{\thenumcards}}%
\end{verbatim}
        }
    \end{minipage}
\end{quote}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
  \frametitle{Use-cases}
  Some examples were referenced at the beginning of this manual. I will finish this short introduction with an overview of special examples and their implementations...
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
\begin{block}{Files and pins}
This is a simple example for your files. 
\end{block}
The same applies to pins. Start with a \code{\bs{}ticketdefault}, with this background:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\renewcommand{\ticketdefault}{%
  \put(155,5){\begin{sideways}%
      \includegraphics[width=35mm]{logo}\end{sideways}}%
  \put(150,50){\begin{rotate}{180}\Huge C O M P U T E R\end{rotate}}%
}
\end{verbatim}
        }
    \end{minipage}
\end{quote}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
\vspace*{10mm}
Now, create the content of the \code{\bs{}ticket} which differs:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\newcommand{\filelabel}[3]{\ticket{%
    \put(33,48){\begin{sideways}\bfseries\Large#1\end{sideways}}%
    \put(43,5){\begin{sideways}%
        \begin{minipage}[t]{50mm}%
          {\bfseries\large#2}\\[2ex]\large#3%
        \end{minipage}%
      \end{sideways}}%
}}
\end{verbatim}
        }
    \end{minipage}
\end{quote}

And fill the tickets:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\begin{document}
...
\filelabel{1}{\LaTeX{} - styles}{Standard styles\\Own styles\\%
  \hspace*{5mm}\bfseries ...\\\hspace*{5mm}\bfseries ticket}%
...
\end{verbatim}
        }
    \end{minipage}
\end{quote}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]\vspace*{-4mm}
\begin{block}{Business-cards}
In this example, the \code{\bs{}ticketdefault} is empty, since we need a front and and background that differs:
\end{block}
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\renewcommand{\ticketdefault}{}%

\newcommand{\vcardfront}[5]{\ticket{%
    \put( 63, 5){\includegraphics[width=40mm,angle=90,origin=bl]{logo}}
    \put( 63.2, 2){\color{uni}your logo}
    \put( 5, 13){\color{uni}\line(1,0){56}}
    \put( 7, 10){\small your company}
    \put( 7,6.5){\small street 1}\put( 7,  3){\small xxxxx city and state}
    \put( 7, 24){\small phone:}\put( 7, 20){\small fax:}
    \put(6,40){\bfseries\LARGE #1}
    \put(7,36){#2}\put(15,24){\small #3}
    \put(15,20){\small #4}\put( 7,16){\small #5}
 }}

\newcommand{\vcardback}[1]{\ticket{%
    \put( 7, 26){\small private:}
    \put( 5, 23){\color{uni}\line(1,0){56}}
    \put( 7,19){\small%
        \begin{minipage}[t]{50mm}{#1}\hss\end{minipage}}%
}}
\end{verbatim}
        }
    \end{minipage}
\end{quote}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]\vspace*{10mm}
And fill the tickets:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
% a counter, which makes life easier...
\newcounter{numcards}

\begin{document}
...
% ten cards for the front
\whiledo{\thenumcards<10}{%
  \stepcounter{numcards}%
  \vcardfront{Mr. X}{Degree/Profession}
                    {+YY/XXXX/ZZZ ZZ ZZ}{+YY/XXXX/ZZZ ZZ ZZ}
                    {yourmail@your-provider.xxx}}
\setcounter{numcards}{0}
% and ten for the backside
\whiledo{\thenumcards<10}{%
  \stepcounter{numcards}%
  \vcardback{phone: ---/HH HH HHH\\fax: ---/HH HH HHH\\%
             homestreet 7\\everywhere}}
...
\end{verbatim}
        }
    \end{minipage}
\end{quote}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]\vspace*{-4mm}
\begin{block}{Flashcards}
In this case we work with two different \code{\bs{}ticket}-definitions since we have a file
with two different commands. However, this can be changed according to your taste:
\end{block}
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
% now what do you like to put in your ticket
\newcommand{\card}[2]{\ticket{%
    \put(32.5,15){\makebox[0mm]{\centering{\huge{\textbf{#1}}}}}
 }}
\newcommand{\raiz}[3]{\ticket{%
    \put(2,31){{$\sqrt{\enspace}$}}
    \put(32.5,15){\makebox[0mm]{{\huge{\textit{{ #1 }}}}}}
}}
\end{verbatim}
        }
    \end{minipage}
\end{quote}

All data is in a file:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
...
\begin{document}
\input{words}
\end{verbatim}
        }
    \end{minipage}
\end{quote}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]\vspace*{10mm}
Now change the command for the backside:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\renewcommand{\card}[2]{\ticket{%
    \put(3,30){\parbox{58mm}{\large{\textbf{ #1:}}}}%
    \put(4,23){\parbox[t]{58mm} {\small {\blt #2}}}%
 }}
\renewcommand{\raiz}[3]{\ticket{%
    \put(3,30){\parbox{58mm}{\textbf{#1:} #2}}%
    \put(3,13){\parbox{58mm}{#3}}%
 }}
\end{verbatim}
        }
    \end{minipage}
\end{quote}

Use the special command \code{\bs{}backside}, do some further adjustment for your printer and reread the file:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
\backside%
\oddsidemargin=8pt
\input{words}
...
\end{verbatim}
        }
    \end{minipage}
\end{quote}

If you want to print this on a duplex-printer rearrange the pages with this command for example:
\begin{quote}
    \begin{minipage}[t]{0.5\textwidth}
      {\scriptsize
\begin{verbatim}
psselect -p1,3,2,4 ex_flashcard.ps ex_flashcard_dup.ps ...
\end{verbatim}
        }
    \end{minipage}
\end{quote}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
  \frametitle{Acknowledgements...}
  \begin{block}{Many thanks}
  to those who used ticket.sty for many years and helped
  to find some small bugs and those who provided ticket-definition-files (tdf)
  and suggestions for new features.
  \end{block}
  
  Many special thanks to Santiago Mejia who created an initial version
  of the flash-card use-case.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% LocalWords:  Emmel tdf ticketdefault pdf vcard usepackage documentclass lz
% LocalWords:  LEITZ unitlength hoffset voffset ticketNumbers ticketSize dist
% LocalWords:  ticketDistance renewcommand crossmark circlemark emptycrossmark
% LocalWords:  cutmark newpage ticketreset perl myticket todo Mejia