Debian Codegraph @

texmf-dist/doc/latex/cdpbundl/cdp-ver-0-36.tex

raw
1 \begin{filecontents}{myarticletter.cls}
2 \NeedsTeXFormat{LaTeX2e}[1998/06/01] % LaTeX2e is required!
3 \ProvidesClass{myarticletter}
4 [2018/02/08 v0.03 (development)]
5 \LoadClassWithOptions{articoletteracdp}[2018/02/08]
6 \input{mylogo.def}
7 \endinput
8 \end{filecontents}
9
10
11
12 \begin{filecontents}{mylogo.def}
13 \ProvidesFile{mylogo.def}[2018/02/08 v0.03 (development)]
14
15 \RequirePackage[customletterhead]{cdpaddon}[2018/02/08]
16 \RequirePackage{color}
17
18 \DeclareFontFamily{T1}{my@calli}{}
19 \DeclareFontShape{T1}{my@calli}{m}{n}{<->s*[1.44]callig15}{}
20 \definecolor{my@lh@color}{rgb}{0,.4,.4}
21
22 \begin{customletterhead}{\textwidth}
23 \color{my@lh@color}
24 \fontsize{17}{21}\usefont{T1}{my@calli}{m}{n}
25 \leftline{%
26 \setlength{\unitlength}{1cm}%
27 \begin{picture}(0,0)
28 \put(-2,0){\framebox(1.8,1.2){%
29 \normalsize\ttfamily My Logo%
30 }}
31 \end{picture}%
32 My Company'\,s Letterhead\enspace
33 \hrulefill\hspace{-2cm}%
34 }
35 \end{customletterhead}
36
37 \settowidth{\longindentation}{%
38 \fontsize{17}{21}\usefont{T1}{my@calli}{m}{n}%
39 My Company'\,s Letterhead\enspace
40 }
41
42 \begin{customletterfoot}{\textwidth}
43 \color{my@lh@color}
44 \fontsize{5}{6}\usefont{T1}{pplx}{m}{n}
45 \raggedleft
46 \ruleacrossheadorfoot[-2cm]
47 My (almost unreadable) \textsc{small print},\\
48 aligned along the \textit{right} edge\\
49 of the main text.
50 \end{customletterfoot}
51
52 \renewcommand*{\foldingtagrule}{%
53 \color{my@lh@color}\CDPFactoryFoldingTagRule
54 }
55
56 \endinput
57 \end{filecontents}
58
59
60
61 \documentclass
62 [twoside,boldsubject,italicsignature,shortindent,signaturerule]
63 {myarticletter}[2018/02/08]
64 \usepackage[T1]{fontenc}
65 \usepackage[english]{cdpbabel}
66 \usepackage[bookmarksnumbered,hypertexnames=false]{hyperref}
67 \usepackage{lipsum}
68
69 \name{Gustavo Mezzetti}
70 \signature{Gustavo Mezzetti}
71 \address{
72 Gustavo \textsc{Mezzetti}\\
73 \protect\href
74 {mailto:[email protected]}
75 {\nolinkurl{[email protected]}}
76 }
77 \date{February~8, 2018}
78
79 \hypersetup{
80 pdftitle = {The C.D.P. Bundle version 0.36},
81 pdfauthor = {G. Mezzetti},
82 pdfsubject = {Instructions on how use the C.D.P. Bundle},
83 pdfcreationdate = {D:20180208120000},
84 pdfmoddate = {D:20180208120000}
85 }
86
87 \pagestyle{headings}
88 \setcounter{tocdepth}{2}
89
90 \newcommand*{\pdfbslash}{}
91 {\catcode`\|=0 |catcode`|\=12 |gdef|pdfbslash{\\}}
92
93 \DeclareRobustCommand*{\packlass}[1]{{\normalfont\sffamily #1}}
94 \DeclareRobustCommand*{\opz}[1]{{\normalfont\ttfamily #1}}
95 \DeclareRobustCommand*{\env}[1]{%
96 {\texorpdfstring{\normalfont\ttfamily}{}#1}%
97 }
98 \DeclareRobustCommand*{\sty}[1]{{\normalfont\ttfamily #1}}
99 \DeclareRobustCommand*{\filedir}[1]{{\normalfont\ttfamily #1}}
100 \DeclareRobustCommand*{\cntr}[1]{{\normalfont\ttfamily #1}}
101 \DeclareRobustCommand*{\command}[1]{%
102 {\texorpdfstring{\normalfont\ttfamily \char\escapechar}{\pdfbslash}#1}%
103 }
104 \newcommand*{\meta}[1]{\(\langle\textit{#1}\rangle\)}
105 \newcommand*{\strongemph}[1]{\textbf{#1}}
106 \newcommand*{\zerolistvertspaces}{%
107 \setlength{\parskip}{0pt}%
108 \setlength{\topsep}{\parskip}%
109 \setlength{\partopsep}{\parskip}%
110 }
111
112 \newcommand*{\lcdp}{\packlass{letteracdp}}
113 \newcommand*{\acdp}{\packlass{articoletteracdp}}
114 \newcommand*{\hyre}{\packlass{hyperref}}
115 \newcommand*{\cdpa}{\packlass{cdpaddon}}
116 \newcommand*{\adic}{\packlass{lettcdpadi}}
117 \newcommand*{\adip}{\packlass{adiseal}}
118 \newcommand*{\babel}{\packlass{babel}}
119 \newcommand*{\cdpbabel}{\packlass{cdpbabel}}
120 \newcommand*{\Bundle}{C.D.P. Bundle}
121 \newcommand*{\oclh}{\opz{customletterhead}}
122 \newcommand*{\eclh}{\env{customletterhead}}
123 \newcommand*{\eclf}{\env{customletterfoot}}
124
125 \makeatletter
126
127 \newcounter{listing}[letter]
128 \renewcommand*\thelisting{\@arabic\c@listing}
129 \@ifdefinable\fps@listing{\def\fps@listing{tbp}}
130 \@ifdefinable\ftype@listing{\def\ftype@listing{4}}
131 \@ifdefinable\ext@listing{\def\ext@listing{lol}}
132 \@ifdefinable\fnum@listing{\def\fnum@listing{\listingname~\thelisting}}
133 \newenvironment*{listing}
134 {\@float{listing}}
135 {\end@float}
136 \newenvironment*{listing*}
137 {\@dblfloat{listing}}
138 {\end@dblfloat}
139 \newcommand*\listoflistings{%
140 \section*{\listlistingname \sectionmark\listlistingname}%
141 \if@loX@in@toc@
142 \addcontentsline{toc}{section}{\protect\listlistingname}%
143 \fi
144 \@starttoc{lol}%
145 }
146 \@ifdefinable\l@listing{\let\l@listing\l@figure}
147 \newcommand*\listlistingname{List of listings}
148 \newcommand*\listingname{Listing}
149 \@ifdefinable\toclevel@listing{\def\toclevel@listing{\toclevel@figure}}
150 % Note that we use "\def" here, not "\let".
151
152 \newcommand*\cleantop{%
153 \dimen@ \baselineskip
154 \advance \dimen@ -\topskip
155 \prevdepth \dimen@
156 }
157 \newcommand*\cleanbot{%
158 \dimen@ \baselineskip
159 \advance \dimen@ -\topskip
160 \advance \dimen@ -\prevdepth
161 \vskip \dimen@
162 \prevdepth \z@
163 }
164 \newcommand*\cleanbotp{%
165 \vskip -\prevdepth
166 \prevdepth \z@
167 }
168
169 \makeatother
170
171 \hfuzz = 0pt
172 \vfuzz = 0pt
173
174
175
176
177
178
179 \begin{document}
180
181
182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 % %
184 % Letter no. 1 %
185 % %
186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187
188 \begin{letterhead}[Whom it may concern]{
189 To whom may be concerned\\
190 with writing letters with \LaTeX\\
191 (and want them to bear a letterhead
192 of \emph{their own} choice!)
193 }[
194 The \Bundle\ version 0.36.
195 ]
196
197 \opening{Dear friends:}
198
199 This letter describes the new ``bells and whistles'' that have been made
200 available in version~0.36 of the \Bundle. This version is just a provisional
201 patch applied on what essentially remains ``fossil'' code, in need of a thorough
202 redesign; nonetheless, it does provide some long-awaited features, most
203 prominently the ability to modify, with reasonable ease, the letterhead produced
204 by the \env{letterhead} environment.
205
206 The author wishes to thank Lorenzo Pantieri for having promoted, in his
207 excellent work
208 ``\href{http://www.lorenzopantieri.net/LaTeX_files/Complementi.pdf}
209 {\emph{Complementi all'Arte di scrivere con \LaTeX}}'' (``Additions to The art
210 of writing with \LaTeX''), the use of the \lcdp\ document class, which is the
211 main component of the \Bundle. This letter (indirectly) uses the \acdp\
212 document class.
213
214
215
216 \tableofcontents
217 \listoflistings
218
219
220
221 \setcounter{secnumdepth}{0}
222
223 \section{Introduction}
224
225 The \Bundle\ was essentially written between 1999 and 2000 (for an Italian
226 audience), and even at that time it contained code that was already deprecated;
227 even worse, its design was flawed since the beginning, because it had been
228 conceived for a specific and limited application (the letters of the C.D.P.,
229 exactly), and was adapted for more general use only as an afterthought.
230
231 A thorough redesign would therefore be needed; on the other hand, some users
232 have suggested, or asked for, improvements and additions, in particular for what
233 concerns the use of the bundle with other languages besides Italian (see
234 Section~\ref{S:Languages}), that can be implemented rather easily by means of
235 provisional patches. I~have already been deferring the introduction of these
236 comparatively harmless enhancements for five years, waiting for the right moment
237 to undertake the task of redesigning the bundle from scratch, but now I~have
238 resolved to simply patch up the existing version.
239
240 The version herein presented, therefore, is far from being optimal: no serious
241 attempt has been made to remove ``fossil'' code, nor to bring it up to date with
242 modern \LaTeX\ usage. I~have removed, however, the \adip\ package and the
243 \adic\ document class, of which, probably, nobody besides me even remembers the
244 purpose.
245
246 Though\marginpar{\hfill\strongemph{$*{*}*\;$WOW!!$\;*{*}*$}},
247 % Yes, I know, I should use \textasteriskcentered...
248 \strongemph{good news} are coming for all those users who asked for a means to
249 \strongemph{customize the letterhead} produced by the \Bundle: a reasonably
250 viable method for doing so has been provided at
251 last!~\facesmile\facesmile\facesmile\space The method requires the use of the
252 \cdpa\ package, passing in the new option \oclh. You can specify the contents
253 of your custom head and foot by means of two new environments, called \eclh\ and
254 \eclf, which are similar, to a certain extent, to the \env{minipage}
255 environment. This should give you the maximum freedom in designing the
256 letterhead (having recourse to \env{picture}s and images, if you wish to),
257 whilst adopting an interface you are surely well familiar with. See
258 Section~\ref{S:Letterhead} for more information.
259
260 Another nifty feature is the ability to draw a thin rule to guide your hand in
261 signing your letters: you ask for this behavior by passing the new
262 \opz{signaturerule} option to the \lcdp\ document class. See
263 Section~\ref{S:Options} for more information.
264
265 Finally, some minor corrections of an aesthetic nature have also been brought
266 in, which are concisely discussed in Section~\ref{S:Adjustments}.
267
268
269
270 \setcounter{secnumdepth}{2}
271
272 \section{My own letterhead, at last!}
273 \label{S:Letterhead}
274
275 One of the questions that users ask most frequenty about the \Bundle\ is perhaps
276 ``How the hell can I~put \emph{my own} letterhead in the place of that silly
277 greenish thing?''; so, let's start with this one!
278
279 %%%%
280 \begin{listing}[p]
281 \cleantop
282 \begin{verbatim}
283 \documentclass
284 [twoside,boldsubject,italicsignature,shortindent,signaturerule]
285 {letteracdp}[2018/02/08]
286 \usepackage[T1]{fontenc}
287 \usepackage[english]{cdpbabel}
288 \usepackage[customletterhead]{cdpaddon}[2018/02/08]
289 \usepackage{url,lipsum}
290
291 \address{
292 Gustavo \textsc{Mezzetti}\\
293 \protect\url{[email protected]}
294 }
295 \signature{Gustavo Mezzetti}
296 \date{February~8, 2018}
297 \place{Padova}
298
299
300
301 % Definition of your letterhead occurs here:
302
303 \begin{customletterhead}{\textwidth}
304 \centering \Huge
305 My Huge Centered Letterhead
306 \end{customletterhead}
307 \begin{customletterfoot}{\textwidth}
308 \raggedleft \tiny
309 \ruleacrossheadorfoot
310 My (almost unreadable) small print\\
311 flushed against the right margin.
312 \end{customletterfoot}
313
314
315
316 \begin{document}
317
318 \begin{foldedletterhead}[Whom it may concern]
319 {To whom it may concern}
320 [My own letterhead, at last!]
321
322 \makepresentation
323 \maketopdate\relax
324
325 \lipsum[1-2]
326
327 \makesignature
328
329 \end{foldedletterhead}
330
331 \end{document}
332 \end{verbatim}
333 \caption{How to customize the letterhead}
334 \label{lis:customletter}
335 \cleanbotp
336 \end{listing}
337 %%%%
338
339
340
341 \paragraph{For the impatient}
342 \label{P:LetterHeadImpatient}
343
344 Listing~\ref{lis:customletter} explains what you have to do, in order to define
345 a simple customized letterhead, by means of a practical example. It shows the
346 complete contents of the \LaTeX\ source file: by mimicking this code, you should
347 easily obtain what suits your needs. Let us skim briefly through it.
348
349 First of all, note that we load the \cdpa\ package, with the \oclh\ option (as
350 well as a few other useful packages that, of course, have nothing to do with
351 letterheads). Then come the usual declarations concerning the sender, the date,
352 etc.
353
354 Still in the preamble---as we will soon see, we could do this in other places
355 too, but also the preamble is absolutley OK\@---we start a \eclh\ environment.
356 This environment has the following synopsis:
357 %
358 \begin{flushleft}
359 \verb|\begin{customletterhead}{|\meta{wdth}\verb|}|\quad
360 \meta{text}\quad
361 \verb|\end{customletterhead}|
362 \end{flushleft}
363 %
364 As you can see, it resembles a \env{minipage} environment, except that you
365 cannot specify the vertical alignment of the material contained therein (because
366 you don't need to: the mini page you are producing has not to be aligned with
367 any nearby constructs); and indeed, it creates a ``mini page'' of width
368 \meta{wdth} containing the \meta{text} you specify. This \meta{text} should be
369 your letterhead: for example, the code shown here will produce a letterhead,
370 centered between the margins of the body of the main text, which reads ``My Huge
371 Centered Letterhead''---and actually looks like that!~\facesmile
372
373 Next, we do the same for the footer, using the \eclf\ environment, which is
374 syntactically identical to \eclh:
375 %
376 \begin{flushleft}
377 \verb|\begin{customletterfoot}{|\meta{wdth}\verb|}|\quad
378 \meta{text}\quad
379 \verb|\end{customletterfoot}|
380 \end{flushleft}
381 %
382 By examining the code, you can easily tell that, this time, the footer will be
383 aligned against the right margin (\verb|\raggedleft|) and set in \verb|\tiny|
384 type---which is what the text itself says, after all. But what does the
385 \verb|\ruleacrossheadorfoot| command do? Well, it simply draws a horizontal
386 rule, which\ldots\ yes, extends across the whole footer. You could use one of
387 the standard commands for producing rules, here (\LaTeX's \verb|\rule|, plain
388 \TeX's \verb|\hrule|), but this one has been specifically crafted for use inside
389 the two abovementioned environments; it consumes no vertical space, and does not
390 alter the distance (\verb|\baselinekip|) between the baselines of adjacent lines
391 of text. Moreover, it can take optional arguments to modify its appearance, as
392 we shall see \hyperref[P:FinePoints]{in a minute}.
393
394 You can try out this example by yourself (I~advise you to do so), but for your
395 convenience the output it typesets is reproduced in a separate letter that you
396 find enclosed with this one, just after it in this same file. If you have a
397 look at the result, you will be glad to note that the thin sign that the
398 \env{foldedletterhead} environment is supposed to draw along the right edge of
399 the sheet, to mark the exact point where it should be folded, is drawn also when
400 the original letterhead is replaced by yours. This is just fine (but see also
401 Paragraph~\ref{P:FinePoints}).
402
403
404
405 \paragraph{A deeper look}
406 \label{P:Deeper}
407
408 As you, certainly, have already guessed, the two environments introduced
409 \hyperref[P:LetterHeadImpatient]{above} simply save their contents into a box;
410 the \oclh\ option causes these two boxes to be used in place of the header and
411 the footer, respectively, that had been originally defined by the \lcdp\
412 document class. More precisely, when the \oclh\ option is in force, a copy of
413 those boxes is centered, with first-order infinite glue, in the header (resp.,
414 in the footer) line, pretending that they have zero height and depth, with the
415 bottom (resp., top) margin of the box defined by \eclh\ (resp., \eclf) aligned
416 along the baseline of the header (resp., of the footer) line of the page. Note
417 that the \cdpa\ package defines the \eclh\ and \eclf\ environments, and their
418 associated storage boxes, even if you do \emph{not} specify the \oclh\ option:
419 this option simply dictates whether or not those two boxes should be \emph{used}
420 for the letterhead. This is good, since it means that the presence or absence
421 of the \oclh\ option will not affect the \emph{syntax} of your document, but
422 only the appearance of the typeset output, which is how options should behave.
423
424
425
426 \paragraph{The letterhead is defined locally}
427 \label{P:Local}
428
429 As we indicated in Paragraph~\ref{P:LetterHeadImpatient}, the output produced by
430 listing~\ref{lis:customletter} is shown in a separate letter enclosed after this
431 one; you may be wondering how I~managed to produce two (or, actually, several)
432 letters with different letterheads in a single \LaTeX\ run (yes, it \emph{was} a
433 single run). Well, I~am the author of the package, and I~could have played some
434 nasty trick; but actually I~didn't need to, because the \eclh\ and \eclf\
435 environments save their contents in their associated storage boxes
436 \emph{locally}. This means that if they are postioned \emph{within} the
437 environment that produces a certain letter (say, \emph{e.g.},
438 \env{foldedletterhead}), the header and the footer will be changed \emph{only}
439 for that letter; for subsequent ones, the former header and footer will be
440 reinstated. Of course, the redefinitions must occur before the \verb|\opening|
441 command (or anything else that typesets text).
442
443 %%%%
444 \begin{listing}[tbp]
445 \cleantop
446 \begin{verbatim}
447 \begin{foldedletterhead}[Someone Else]{
448 To Someone Else\\
449 Some other place\\
450 Some other city
451 }[
452 Another letterhead.
453 ]
454
455 \begin{customletterhead}{\textwidth}
456 \raggedright \Huge
457 A different head
458 \end{customletterhead}
459 \begin{customletterfoot}{\textwidth}
460 \centering
461 \ruleacrossheadorfoot
462 A different foot
463 \end{customletterfoot}
464
465 \opening{Dear Someone,}
466
467 \lipsum[1-2]
468
469 \closing{Best regards.}
470
471 \end{foldedletterhead}
472 \end{verbatim}
473 \caption{How to customize the letterhead for a single letter}
474 \label{lis:customletterlocal}
475 \cleanbot
476 \end{listing}
477 %%%%
478
479 This point is further illustrated in listing~\ref{lis:customletterlocal}, which
480 shows how to customize the letterhead for just a single letter. This code has
481 been copied and then pasted toward the end of this file, to show, in a third,
482 independent letter, the output it produces. Actually, for this I~\emph{did}
483 have to play some tricks not included in the code of the listing, in order to
484 ``decolor'' the thin sign that marks the point where the sheet is to be folded,
485 and to reset the value of the \verb|\longindentation| parameter; but both these
486 changes can be made ``locally'' too. There is a slight complication deriving
487 from the fact that, in order for a change to \verb|\longindentation| to turn
488 effective in a given ``letter-making'' environment, the change must occur
489 \emph{outside} the ``letter-making'' environment itself: this forced me to
490 supply an additional level of grouping.
491
492
493
494 \paragraph{Your own classes for your own letterhead}
495 \label{P:Classes}
496
497 If you know \LaTeX\ well, there will probably be one last point that still
498 bothers you. We said, in Paragraph~\ref{P:LetterHeadImpatient}, that the \eclh\
499 and \eclf\ environments can very well be embedded in the preamble, without
500 causing any trouble: how come the typesetting that occurs inside these
501 environments does not trigger the ``Missing \verb|\begin{document}|'' error?
502 The answer is simply that these two environments have been specifically made
503 exempt from this error, precisely in order to permit you to include them in the
504 preamble too; and this, in turn, has been done because the concept of
505 ``preamble'' also covers the code included in custom classes that you write
506 yourself.
507
508 This means that you can write your own custom classes that produce your own
509 custom letterhead, which is nice.~\facesmile\space We use the plural, because
510 you will surely want to define customized versions of \emph{both} the \lcdp\
511 class \emph{and} the \acdp\ class; the best way to do so is to write three
512 distinct files, as we are now going to explain.
513
514 %%%%
515 \begin{listing}[p]
516 \cleantop
517 \begin{verbatim}
518 \NeedsTeXFormat{LaTeX2e} % LaTeX2e is required!
519 \ProvidesClass{myletter}
520 [2018/02/08 v0.03 (development)]
521 \LoadClassWithOptions{letteracdp}[2018/02/08]
522 \input{mylogo.def}
523 \endinput
524 \end{verbatim}
525 \caption{Contents of the\/ \filedir{myletter.cls} file}
526 \label{lis:myletter}
527 \end{listing}
528 %%%%
529
530 %%%%
531 \begin{listing}[p]
532 \begin{verbatim}
533 \NeedsTeXFormat{LaTeX2e} % LaTeX2e is required!
534 \ProvidesClass{myarticletter}
535 [2018/02/08 v0.03 (development)]
536 \LoadClassWithOptions{articoletteracdp}[2018/02/08]
537 \input{mylogo.def}
538 \endinput
539 \end{verbatim}
540 \caption{Contents of the\/ \filedir{myarticletter.cls} file}
541 \label{lis:myarticletter}
542 \end{listing}
543 %%%%
544
545 %%%%
546 \begin{listing}[p]
547 \cleantop
548 \begin{verbatim}
549 \ProvidesFile{mylogo.def}[2018/02/08 v0.03 (development)]
550
551 \RequirePackage[customletterhead]{cdpaddon}[2018/02/08]
552
553 \begin{customletterhead}{\textwidth}
554 \centering \Huge
555 My Huge Centered Letterhead
556 \end{customletterhead}
557 \begin{customletterfoot}{\textwidth}
558 \raggedleft \tiny
559 \ruleacrossheadorfoot
560 My (almost unreadable) small print\\
561 flushed against the right margin.
562 \end{customletterfoot}
563
564 \endinput
565 \end{verbatim}
566 \caption{Contents of the\/ \filedir{mylogo.def} file}
567 \label{lis:mylogo}
568 \cleanbotp
569 \end{listing}
570 %%%%
571
572 So, let us suppose that you want to define two custom classes, named
573 \packlass{myletter} and \packlass{myarticletter}, respectively, that both
574 produce the same letterhead as the one we saw in listing~\ref{lis:customletter}.
575 For this, you write three files called \filedir{myletter.cls},
576 \filedir{myarticletter.cls}, and \filedir{mylogo.def}, whose contents are
577 reproduced in listings \ref{lis:myletter}, \ref{lis:myarticletter},
578 and~\ref{lis:mylogo}, respectively. As you can see, the purpose of
579 \filedir{myletter.cls}\slash\filedir{myarticletter.cls} is just to supply ``glue
580 code'' toward (the \lcdp\slash\acdp\ classes and) the \filedir{mylogo.def} file,
581 which is the single place where the redefinition of the letterhead occurs.
582
583 %%%%
584 \begin{listing}[tbp]
585 \cleantop
586 \begin{verbatim}
587 \ProvidesFile{mylogo.def}[2018/02/08 v0.03 (development)]
588
589 \RequirePackage[customletterhead]{cdpaddon}[2018/02/08]
590 \RequirePackage{color}
591
592 \DeclareFontFamily{T1}{my@calli}{}
593 \DeclareFontShape{T1}{my@calli}{m}{n}{<->s*[1.44]callig15}{}
594
595 \definecolor{my@lh@color}{rgb}{0,.4,.4}
596
597 \begin{customletterhead}{\textwidth}
598 \color{my@lh@color}
599 \fontsize{17}{21}\usefont{T1}{my@calli}{m}{n}
600 \leftline{%
601 \setlength{\unitlength}{1cm}%
602 \begin{picture}(0,0) % you can use \includegraphics instead
603 \put(-2,0){\framebox(1.8,1.2){%
604 \normalsize\ttfamily My Logo%
605 }}
606 \end{picture}%
607 My Company'\,s Letterhead\enspace
608 \hrulefill\hspace{-2cm}%
609 }
610 \end{customletterhead}
611
612 \settowidth{\longindentation}{%
613 \fontsize{17}{21}\usefont{T1}{my@calli}{m}{n}%
614 My Company'\,s Letterhead\enspace
615 }
616
617 \begin{customletterfoot}{\textwidth}
618 \color{my@lh@color}
619 \fontsize{5}{6}\usefont{T1}{pplx}{m}{n}
620 \raggedleft
621 \ruleacrossheadorfoot[-2cm]
622 My (almost unreadable) \textsc{small print},\\
623 aligned along the \textit{right} edge\\
624 of the main text.
625 \end{customletterfoot}
626
627 \renewcommand*{\foldingtagrule}{%
628 \color{my@lh@color}\CDPFactoryFoldingTagRule
629 }
630
631 \endinput
632 \end{verbatim}
633 \caption{Contents of a more elaborated\/ \filedir{mylogo.def} file}
634 \label{lis:mylogo-more}
635 \cleanbotp
636 \end{listing}
637 %%%%
638
639 Listing~\ref{lis:mylogo-more} shows a more elaborate example of a
640 \filedir{mylogo.def} file to go together with the same two class files shown in
641 listings~\ref{lis:myletter} and~\ref{lis:myarticletter}. Here we have added a
642 touch of superior style not only by employing color and some fancy fonts, but
643 also by having recourse to the fine adjustments described in
644 \hyperref[P:FinePoints]{the next paragraph} (because of the fonts, this example
645 might not work on all \TeX\ installations). The letterhead defined by this
646 example is exactly the same as the one this letter itself bears on its first
647 page.
648
649
650
651 \paragraph{Fine points of style}
652 \label{P:FinePoints}
653
654 The first fine point of style that should be noted in
655 listing~\ref{lis:mylogo-more} is that the \verb|\longindentation| rigid length
656 is set equal to the width of the writing of the letterhead (``My Company's
657 Letterhead''). Since the ``letter-making'' environments indent the address of
658 the addressee precisely by the amount of \verb|\longindentation|, this will
659 cause such addresses to be neatly aligned with a visually relevant element of
660 the design of the letterhead (the rule on the right); you should do the same
661 with your own letterhead, if it contains a similarly relevant component. If you
662 do not yourself assign it a value, \verb|\longindentation| is set to half the
663 value of \verb|\textwidth|.
664
665 The second fine point to note is that the sign that marks the fold is drawn in
666 the same color as the rest of the letterhead. The \Bundle\ computes the
667 vertical position of this sign, but to actually draw it, it calls the
668 \verb|\foldingtagrule| command, which the end user can redefine. This command
669 works similarly to \verb|\footnoterule|, and, like the latter, should take up no
670 vertical space. Its ``factory'' definition is backed up in the
671 \verb|\CDPFactoryFoldingTagRule| command (which should \emph{never} be
672 redefined, of course); as you can see, in listing~\ref{lis:mylogo-more} we
673 redefine \verb|\foldingtagrule| to simply invoke the factory default after
674 setting the appropriate color.
675
676 The third, and last, point to note is that the \verb|\ruleacrossheadorfoot|
677 command can get an optional argument in which an inset from the text margins can
678 be specified; a \emph{negative} inset, like here, causes the rule to protrude
679 into the margins. A second optional argument let you indicate different insets
680 for the left and the right margin, in this order. Note that these arguments
681 \emph{must} contain \emph{rigid} lengths.
682
683
684
685 \section{Other languages besides Italian}
686 \label{S:Languages}
687
688 Like many other document classes and packages, the classes of the \Bundle\ mark
689 up some portions of the output they produce by adding certain descriptive
690 strings, that, by default, are written in Italian. For example, when you have
691 requested the \sty{headings} page style, the name of the addressee, which is
692 printed atop pages, is preceded by the string ``\emph{A:}'' (=~``To:'');
693 similarly, when you issue the command \verb|\tableofcontents| in a documents
694 that adopts the \acdp\ document class, the table it produces is titled
695 ``\emph{Sommario}'' (=~``Contents''); and so on.
696
697 When the \Bundle\ was used only by the members of the \emph{Coordinamento}, the
698 Italian defaults it provided for those captions were, of course, quite adequate;
699 as long as its use remained confined to the Italian \LaTeX\ community, they were
700 still acceptable; but now, questions about how to adapt the \Bundle\ to foreign
701 languages have begun to be asked in some Internet forums by users around the
702 world, pushing me to reconsider the matter.
703
704 Of course, the Italian captions are not (nor they have ever been) ``hard-wired''
705 in the code: they are defined by macros that follow the usual naming conventions
706 (\verb|\headtoname|, \verb|\contentsname|, and so on). Thus, it's only a matter
707 of redefining these ``hooks'' to suit the target language. However, it would be
708 desirable to have some standard definitions set for each language; but
709 unfortunately, this cannot be attained just by loading the \babel\ package, for
710 two reasons. In the first place, there are some captions that are specific to
711 the \Bundle\ and are therefore not cared for by the \babel\ package: for
712 example, the (optional) subject of a letter is preceded by the expansion of
713 \verb|\subjectname| (which is ``\emph{Oggetto:}'' in Italian and should be
714 ``Subject:'' in English), a hook the \babel\ package knows nothing about.
715 Secondarily, even for those hooks that are standard, sometimes the definition
716 provided by the \babel\ package seems (at least to me) not adequate for a
717 letter; in particular, alas, if you load \babel\ with the \opz{italian} option
718 (as you ordinarily do when you are writing in Italian), it actually
719 \emph{cancels} the definitions preset by the \Bundle, substituting for them
720 strings that I~deem more suitable for articles or books, for which they are
721 indeed intended, than for letters (for example, \( \verb|\contentsname| \to
722 \mbox{``\emph{Indice}''} \) in \babel, instead of \( \verb|\contentsname| \to
723 \mbox{``\emph{Sommario}''} \), as defined by the \Bundle; \( \verb|\refname| \to
724 \mbox{``\emph{Riferimenti bibliografici}''} \) in \babel, instead of \(
725 \verb|\refname| \to \mbox{``\emph{Testi citati}''} \), as I~prefer).
726
727 To supply a \emph{provisional} solution to this problem, a new component has
728 been added to the \Bundle: the \cdpbabel\ package. The idea is that, when using
729 one of the document classes of the \Bundle, you load the \cdpbabel\ package
730 \emph{instead of} \babel, and let the former load the latter on your behalf; in
731 this way, you offer it a chance to augment, or amend, the definitions made by
732 \babel\ itself. This solution might seem inelegant (and admittedly it is), but
733 the problem is more subtle than it may look at first sight, involving also
734 compatibility issues with existing documents, and I~need to further investigate
735 it. It is hoped that a more satisfactory scheme will be found for future
736 releases.
737
738 In practice, all the \cdpbabel\ package has to do is (to load \babel\ and) to
739 issue an \verb|\addto{\captions|\meta{language}\verb|}{|\ldots\verb|}| command
740 (or better, one such command for each required \meta{language}), with ``\ldots''
741 replaced by the appropriate redefinitions; the list, and the details, of such
742 redefintions are of course dictated by \meta{language}, so \cdpbabel\ takes them
743 from what we will call a ``C.D.P. language definition file''. This is a text
744 file that, by convention, must be named
745 \filedir{cdpnames}\meta{language}\filedir{.ldf}, where \meta{language} is the
746 name of the corresponding language option (for example,
747 %
748 \begin{verbatim}
749 \usepackage[english,italian]{cdpbabel}
750 \end{verbatim}
751 %
752 invokes both \filedir{cdpnamesenglish.ldf} and \filedir{cdpnamesitalian.ldf}, in
753 this order), and which must adhere to the format shown in
754 listing~\ref{lis:cdpnames}.
755
756 %%%%
757 \begin{listing}[tbp]
758 \cleantop
759 \zerolistvertspaces
760 \begin{flushleft}
761 \verb|\ProvidesFile{cdpnames|\meta{language}\verb|.ldf}[|%
762 \meta{date \& version}\verb|]|
763 \end{flushleft}
764 \begin{verbatim}
765
766 \def\@cdpbabel@letter@names{%
767 \end{verbatim}
768 \begin{flushleft}
769 \verb| \def\subjectname {|\meta{Subject:}\verb|}%|\\
770 \verb| \def\registeredname {|\meta{Registered}\verb|}%|\\
771 \verb| \def\registeredRRname {|\meta{Registered R.R.}\verb|}%|\\
772 \verb| \def\andccname {|\meta{cc (in addresses)}\verb|}%|\\
773 \verb| \def\ccname {|\meta{cc (at end of letters)}\verb|}%|\\
774 \verb| \def\enclname {|\meta{Encl:}\verb|}%|\\
775 \verb| \def\PSname {|\meta{P.S.:}\verb|}%|\\
776 \verb| \def\headtoname {|\meta{To:}\verb|}%|\\
777 \verb| \def\lettername {|\meta{Letter}\verb|}%|
778 \end{flushleft}
779 \begin{verbatim}
780 % More captions could be added in the future.
781 }
782 \def\@cdpbabel@artlet@names{%
783 \end{verbatim}
784 \begin{flushleft}
785 \verb| \def\contentsname {|\meta{Contents}\verb|}%|\\
786 \verb| \def\listfigurename {|\meta{List of figures}\verb|}%|\\
787 \verb| \def\listtablename {|\meta{List of tables}\verb|}%|\\
788 \verb| \def\refname {|\meta{References}\verb|}%|\\
789 \verb| \def\indexname {|\meta{Index}\verb|}%|\\
790 \verb| \def\figurename {|\meta{Figure}\verb|}%|\\
791 \verb| \def\tablename {|\meta{Table}\verb|}%|\\
792 \end{flushleft}
793 \begin{verbatim}
794 % More captions could be added in the future.
795 }
796
797 \endinput
798 \end{verbatim}
799 \caption{Contents of a
800 \filedir{cdpnames}\protect\meta{language}\filedir{.ldf} file}
801 \label{lis:cdpnames}
802 \cleanbot
803 \end{listing}
804 %%%%
805
806 As you can see, a ``C.D.P. language definition file'' must define two macros,
807 named \verb|\@cdpbabel@letter@names| and \verb|\@cdpbabel@artlet@names|,
808 respectively: in the first you put the redefinitions that should be added to
809 \verb|\captions|\meta{language} when only the \lcdp\ class has been loaded; in
810 the second you list the additional redefinitions that apply if the \acdp\ class
811 is loaded too; and that's all. Listing~\ref{lis:cdpnames} details exactly what
812 hooks need to be redefined when switching to another language; in principle, you
813 must supply a suitable redefinition for each of them, but of course, when a hook
814 is already defined by the \babel\ package in a way that you think suits, you may
815 omit it from your list (or, perhaps better, comment it out).
816
817 At present, the \Bundle\ ships with \emph{just two} such definition files
818 included: they are \filedir{cdpnamesitalian.ldf}, for Italian, and
819 \filedir{cdpnamesenglish.ldf}, for English. For all other languages, you'll
820 have to write and install appropriate files yourself. Needless to say, you are
821 most welcome if, after doing so, you want to contribute your work for inclusion
822 in future releases of the \Bundle. Look at these two provided files, and in
823 particular at \filedir{cdpnamesenglish.ldf}, for inspiration about the intended
824 meaning of the captions (which sould be quite obvious, however).
825
826
827
828 \section{The new \opz{signaturerule} option}
829 \label{S:Options}
830
831 Some users have asked for a means to add a thin rule in signatures, just above
832 the signer's name, to mark the place when the handwritten signature should be
833 put. Although, in my opinion, such usage is highly questionable (only pupils in
834 primary school need rules to guide their writing!\@), nevertheless it has now
835 been supported. You request this behavior by passing the new
836 \opz{signaturerule} option to the \lcdp\ document class. Indeed, the decision
837 whether to draw the rule or not is a matter of style and, as such, should be
838 made, once for all, for the whole document.
839
840 Even if you do specify the \opz{signaturerule} option, the rule will \emph{not}
841 be drawn inside a \env{signatureenv*} environment, because this environment is
842 meant exactly to be used when you are not going to sign the letter by hand.
843 This applies also to the \mbox{$*$-form} of the \verb|\closing| and of the
844 \verb|\makesignature| commands, which are used for the same purpose and which
845 invoke, directly or indirectly, precisely the \env{signatureenv*} environment.
846
847 To produce the rule, the \lcdp\ class calls the \verb|\signaturerule| command,
848 which you can customize, if you want to, to suit your needs. This command is
849 called in \LaTeX's ``LR~mode'' (or, to be more precise, in \TeX's ``restricted
850 horizontal mode''), and it should construct a horizontal box containing the
851 rule, aligned along the baseline of the box itself; for example,
852 %
853 \begin{verbatim}
854 \renewcommand*{\signaturerule}{%
855 \makebox[5cm]{\hrulefill}
856 }
857 \end{verbatim}
858 %
859 could be a typical (re)definition. The default definition of
860 \verb|\signaturerule| is actually like this one, except that it draws a thinner
861 rule, and that it allows you to specify the horizontal length of the rule
862 (\emph{i.e.}, its width). Specifically, the \verb|\signaturerulewidth|
863 parameter, which is a rigid length, indicates the width of the rule produced by
864 the default definition of \verb|\signaturerule|. Should you ever redefine the
865 latter, you should honor this parameter in your redefinition, \emph{e.g.},
866 %
867 \begin{verbatim}
868 \renewcommand*{\signaturerule}{%
869 \makebox[\signaturerulewidth]{\hrulefill}
870 }
871 \end{verbatim}
872 %
873 But I~think you will hardly need this: most users will content themselves with
874 changing the width of the rule.
875
876 For completeness' sake, the \opz{nosignaturerule} option is defined too: it is
877 the default, and it does not draw the rule.
878
879
880
881 \section{Aesthetic adjustments}
882 \label{S:Adjustments}
883
884 The \verb|\cc| and \verb|\encl| command have been reimplemented in such a way to
885 include the ``correct'' interline glue above and below their output. Remember
886 that the output produced by these command is kept on the same page as the
887 signature; this means, in particular, that the \verb|\encl| command should be
888 used only for very short lists of enclosures (one item or two). For longer
889 lists, utilize the \env{enclosures} environment, which mildly encourages a page
890 break above itself.
891
892
893
894 \section{A sample letter}
895 \label{S:Sample}
896
897 Listing~\ref{lis:sample} shows a sample input file that illustrates the features
898 covered in this letter: it uses the \packlass{myletter} sample class defined in
899 Paragraph~\ref{P:Classes}, with the letterhead drawn by the ``more elaborate''
900 version of the \filedir{mylogo.def} file that is reproduced in
901 listing~\ref{lis:mylogo-more}, the \opz{signaturerule} option described in
902 Section~\ref{S:Options}, and the \verb|\encl| command touched upon in
903 Section~\ref{S:Adjustments}. As before, the output produced by this example is
904 shown in a separate letter at the end of this file.
905
906 %%%%
907 \begin{listing}[tbp]
908 \cleantop
909 \begin{verbatim}
910 \documentclass
911 [twoside,boldsubject,italicsignature,shortindent,signaturerule]
912 {myletter}
913 \usepackage[T1]{fontenc}
914 \usepackage[english]{cdpbabel}
915 \usepackage{url,lipsum}
916
917 \name{Michael Youngster Name}
918 \address{
919 Mike Y. \textsc{Name}\\
920 Sails Manager\\
921 \protect\url{[email protected]}
922 }
923 \signature{Mike Y. Name\\Sails Manager}
924 \date{February~8, 2018}
925 \place{Mamina del Rey}
926
927 \hfuzz = 0pt
928 \vfuzz = 0pt
929
930
931
932 \begin{document}
933
934 \begin{foldedletterhead}[R.~J.~Drofnats]{
935 Revinu~J. \textsc{Drofnats}\\
936 Department of Farm Ecology\\
937 University of St.\,Anford\\
938 Haga Alto, CA~94321
939 }[
940 Our new sails.
941 ]
942
943 \opening{Dear affectionate customer:}
944
945 we are delighted to have the opportunity of presenting our new
946 collection of sails for the incoming yachting season\ldots
947
948 \lipsum[1-2]
949
950 \closing{Sincerely,}
951
952 \encl{2018 Catalogue\\Invitation card}
953
954 \end{foldedletterhead}
955
956 \end{document}
957 \end{verbatim}
958 \caption{A sample input file that uses the new features}
959 \label{lis:sample}
960 \cleanbotp
961 \end{listing}
962 %%%%
963
964
965
966 \epilogue
967
968 That, more or less, is all we had to say about version~0.36 of the \Bundle. For
969 further information, write to the author: his e-mail address is on the first
970 page.
971
972 \closing*{Best regards.}
973
974 \PS
975 Please note that \packlass{myletter} also used to be (a great many years ago)
976 the obsolete name of the \packlass{akletter} document class. Instructing you to
977 create a custom class by that name shouldn't cause you any trouble in
978 2018~\facesmile, but I~want to inform you all the same of the potential name
979 conflict.
980
981 \end{letterhead}
982
983
984
985
986
987
988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
989 % %
990 % Letter no. 2 %
991 % %
992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
993
994 \begingroup
995
996 \date{February~8, 2018}
997
998 \begin{customletterhead}{\textwidth}
999 \centering \Huge
1000 My Huge Centered Letterhead
1001 \end{customletterhead}
1002 \begin{customletterfoot}{\textwidth}
1003 \raggedleft \tiny
1004 \ruleacrossheadorfoot
1005 My (almost unreadable) small print\\
1006 flushed against the right margin.
1007 \end{customletterfoot}
1008 \setlength\longindentation{.5\textwidth}
1009 \let \foldingtagrule = \CDPFactoryFoldingTagRule
1010
1011 \begin{foldedletterhead}[Whom it may concern]
1012 {To whom it may concern}
1013 [My own letterhead, at last!]
1014
1015 \makepresentation
1016 \maketopdate\relax
1017
1018 \lipsum[1-2]
1019
1020 \makesignature
1021
1022 \end{foldedletterhead}
1023
1024
1025
1026
1027
1028
1029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1030 % %
1031 % Letter no. 3 %
1032 % %
1033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1034
1035 \begin{foldedletterhead}[Someone Else]{
1036 To Someone Else\\
1037 Some other place\\
1038 Some other city
1039 }[
1040 Another letterhead.
1041 ]
1042
1043 \begin{customletterhead}{\textwidth}
1044 \raggedright \Huge
1045 A different head
1046 \end{customletterhead}
1047 \begin{customletterfoot}{\textwidth}
1048 \centering
1049 \ruleacrossheadorfoot
1050 A different foot
1051 \end{customletterfoot}
1052
1053 \opening{Dear Someone,}
1054
1055 \lipsum[1-2]
1056
1057 \closing{Best regards.}
1058
1059 \end{foldedletterhead}
1060
1061 \endgroup
1062
1063
1064
1065
1066
1067
1068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1069 % %
1070 % Letter no. 3 %
1071 % %
1072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073
1074 \begin{foldedletterhead}[R.~J.~Drofnats]{
1075 Revinu~J. \textsc{Drofnats}\\
1076 Department of Farm Ecology\\
1077 University of St.\,Anford\\
1078 Haga Alto, CA~94321
1079 }[
1080 Our new sails.
1081 ]
1082
1083 \name{Michael Youngster Name}
1084 \address{
1085 Mike Y. \textsc{Name}\\
1086 Sails Manager\\
1087 \protect\url{[email protected]}
1088 }
1089 \signature{Mike Y. Name\\Sails Manager}
1090 \date{February~8, 2018}
1091 \place{Mamina del Rey}
1092
1093 \opening{Dear affectionate customer:}
1094
1095 we are delighted to have the opportunity of presenting our new collection of
1096 sails for the incoming yachting season\ldots
1097
1098 \lipsum[1-2]
1099
1100 \closing{Sincerely,}
1101
1102 \encl{2018 Catalogue\\Invitation card}
1103
1104 \end{foldedletterhead}
1105
1106
1107 \end{document}