| 1 |
% \iffalse |
| 2 |
% +AMDG This document was begun on 6 December 1200, the |
| 3 |
% feast of St. Nicholas, and it is humbly dedicated to him |
| 4 |
% and to the Immaculate Heart of Mary for her prayers, and |
| 5 |
% to the Sacred Heart of Jesus for His mercy. |
| 6 |
% |
| 7 |
% This document is copyright 2016 by Donald P. Goodman, and is |
| 8 |
% released publicly under the LaTeX Project Public License. The |
| 9 |
% distribution and modification of this work is constrained by the |
| 10 |
% conditions of that license. See |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% for the text of the license. This document is released |
| 13 |
% under version 1.3 of that license, and this work may be distributed |
| 14 |
% or modified under the terms of that license or, at your option, any |
| 15 |
% later version. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status 'maintained'. |
| 18 |
% |
| 19 |
% The Current Maintainer of this work is Donald P. Goodman |
| 20 |
% ([email protected]). |
| 21 |
% |
| 22 |
% This work consists of yaletter.dtx, yaletter.ins, and |
| 23 |
% derived files yaletter.cls and yaletter.pdf. |
| 24 |
% \fi |
| 25 |
|
| 26 |
% \iffalse |
| 27 |
%<package>\NeedsTeXFormat{LaTeX2e}[1996/06/01] |
| 28 |
%<package>\ProvidesClass{yaletter}[2017/01/01 v1.1 Yet Another Letter Class] |
| 29 |
%<*driver> |
| 30 |
\documentclass[12pt]{ltxdoc} |
| 31 |
|
| 32 |
\usepackage{doc} |
| 33 |
\usepackage{longtable} |
| 34 |
\usepackage{array} |
| 35 |
\usepackage{lettrine} |
| 36 |
\setcounter{DefaultLines}{3} |
| 37 |
\setlength{\DefaultFindent}{2pt} |
| 38 |
\renewcommand{\LettrineFontHook}{\color{red}} |
| 39 |
\usepackage{url} |
| 40 |
\usepackage{booktabs} |
| 41 |
\usepackage{spverbatim} |
| 42 |
\usepackage{graphicx} |
| 43 |
\usepackage[]{xellipsis} |
| 44 |
\usepackage{listings} |
| 45 |
\lstset{% |
| 46 |
name=macrocode, |
| 47 |
language=[LaTeX]TeX, |
| 48 |
basicstyle=\ttfamily\small, |
| 49 |
columns=, |
| 50 |
}% |
| 51 |
\usepackage[paperheight=11in,paperwidth=8.5in,top=1in,bottom=1in, |
| 52 |
right=0.25in,left=1.75in]{geometry} |
| 53 |
\usepackage[T1]{fontenc} |
| 54 |
\usepackage[typeone]{dozenal} |
| 55 |
\usepackage{lmodern} |
| 56 |
\usepackage{url} |
| 57 |
\usepackage[colorlinks]{hyperref} |
| 58 |
\usepackage{makeidx} |
| 59 |
\EnableCrossrefs |
| 60 |
\PageIndex |
| 61 |
\CodelineNumbered |
| 62 |
\RecordChanges |
| 63 |
\makeindex |
| 64 |
\makeatletter |
| 65 |
\def\index@prologue{\section*{Index}\markboth{Index}{Index}} |
| 66 |
\makeatother |
| 67 |
\DoNotIndex{\?,\{,\},\|,\DeclareFontFamily,\DeclareFontShape, |
| 68 |
\DeclareMathAccent,\DeclareMathAlphabet,\DeclareMathDelimiter, |
| 69 |
\DeclareMathSymbol,\DeclareMathVersion,\DeclareSymbolFont,\def, |
| 70 |
\drmsym,\encodingdefault,\familydefault,\fontencoding,\fontfamily, |
| 71 |
\fontseries,\fontshape,\hfil,\hbox,\mathalpha,\mathclose, |
| 72 |
\mathopen,\mathord,\mathversion,\mp,\nabla,\nbshortroman, |
| 73 |
\RedefineMRmdclxvij,\relax,\renewcomand,\RequirePackage, |
| 74 |
\selectfont,\SetMathAlphabet,\SetSymbolFont,\drmsymbolredef, |
| 75 |
\nodefaultfalse,\nodefaultmathfalse,\nodefaultmathtrue,\nodefaulttrue, |
| 76 |
\nodefaulttextfalse,\nodefaulttexttrue,\noindent,\numexpr, |
| 77 |
\acute,\addtolength\advance,\backslash,\baselineskip, |
| 78 |
\char,\counterA,\counterB,\DeclareOption,\ProcessOptions, |
| 79 |
\drmmathlets,\symbolsonlytrue,\if,\else,\fi,\ifnum,\fi,\ifdim,\fi, |
| 80 |
\symbolsonlyfalse,\fontsize,\newif,\newcount, |
| 81 |
\loop,\iter,\let,\renewcommand,\setbox,\setlength,\the,\vss, |
| 82 |
\vskip,\vbox, \newlength, \newcount,\r@@t,\z@,\DeclareMathRadical, |
| 83 |
\DeclareRobustCommand,\bBigg@,\@ifnextchar,\@sqrt,\@makefnmark, |
| 84 |
\@thefnmark,\catcode,\active,\Q,\csname,\endcsname,\define@key, |
| 85 |
\string,\@afterheading,\@afterindentfalse,\AtBeginDocument, |
| 86 |
\begin,\divide,\eject,\end,\everypar,\expandafter,\fancyfoot, |
| 87 |
\fancyhead,\fancyhf,\fancypagestyle,\global,\geometry, |
| 88 |
\hskip,\input,\itshape,\label,\linewidth,\multiply, |
| 89 |
\newcommand,\newdimen,\newgeometry,\nl@@p,\nloop,\normalsize, |
| 90 |
\oddsidemargin,\pagenumbering,\pageref,\pagestyle,\paperheight, |
| 91 |
\paperwidth,\parindent,\parskip,\pdfpageheight,\pdfpagewidth, |
| 92 |
\thepage,\clearpage,\ ,\@setfontsize,\@viiipt,\@viipt,\@vipt, |
| 93 |
\@vpt,\@xiipt,\@xivpt,\@xviipt,\@xxpt,\@xxvpt,\tiny,\huge, |
| 94 |
\Huge,\LARGE,\Large,\large,\scriptsize} |
| 95 |
|
| 96 |
\long\def\example#1#2{% |
| 97 |
\bigskip% |
| 98 |
\hrule% |
| 99 |
\hbox to\linewidth{% |
| 100 |
\hbox to0.5\linewidth{% |
| 101 |
\vbox to2in{\vfil#1\vfil}% |
| 102 |
}\hbox to0.5\linewidth{% |
| 103 |
\vbox to2in{\vfil#2\vfil}% |
| 104 |
}% |
| 105 |
}% |
| 106 |
\hrule% |
| 107 |
\bigskip% |
| 108 |
} |
| 109 |
|
| 110 |
\tracingmacros=3 \begin{document} \DocInput{yaletter.dtx} |
| 111 |
\end{document} |
| 112 |
%</driver> \fi |
| 113 |
% |
| 114 |
% \title{The |yaletter| Class, v1.1} |
| 115 |
% \author{Donald P.\ Goodman III} |
| 116 |
% \date{\today} |
| 117 |
% |
| 118 |
% \maketitle |
| 119 |
% |
| 120 |
% \begin{abstract} |
| 121 |
% \noindent |
| 122 |
% The |yaletter| (``Yet Another Letter'') class produces |
| 123 |
% letters in a variety of preset, but also any arbitrary, |
| 124 |
% formats; handles multiple addresses and letterheads, |
| 125 |
% including a ``database'' of each; produces envelopes of |
| 126 |
% any size; and produces labels of any size (e.g., label |
| 127 |
% sheets). |
| 128 |
% \end{abstract} |
| 129 |
% |
| 130 |
% \section{Introduction} |
| 131 |
% |
| 132 |
% While it may seem archaic in our days of email and other |
| 133 |
% electronic communication, sometimes it remains necessary |
| 134 |
% to send a simple letter; and sometimes, even electronic |
| 135 |
% messages require a nicely-formatted letter with real |
| 136 |
% letterhead. Yet despite the presence of multiple |
| 137 |
% high-quality letter-writing projects, \LaTeX\ seems |
| 138 |
% curiously faulty in this regard. An American letter is a |
| 139 |
% very direct thing formatted in a very specific and |
| 140 |
% well-defined way, yet despite many attempts I've been |
| 141 |
% unable to persuade \LaTeX\ to produce properly spaced and |
| 142 |
% styled American-style letters. It's often a minor |
| 143 |
% problem---a rule that I can't get rid of, or excessive |
| 144 |
% spacing---but it's a problem that simply ruins the |
| 145 |
% appearance of the letter in my judgement. |
| 146 |
% |
| 147 |
% So here's the |yaletter| class, or the ``yet another'' |
| 148 |
% letter class. There are plenty of letter classes, of |
| 149 |
% course, but I still think this one fills a gap that just |
| 150 |
% wasn't filled before. |
| 151 |
% |
| 152 |
% This document is typeset in accordance with the \LaTeX\ |
| 153 |
% \textsc{docstrip} utility, which allows the extraction of |
| 154 |
% code and documentation from the same source documentation. |
| 155 |
% |
| 156 |
% The numbering in this document is in \emph{dozenal}; that |
| 157 |
% is, numbering goes 1, 2, 3, 4, 5, 6, 7, 8, 9, \x, \e, 10, |
| 158 |
% 11\ldots\ It uses the |dozenal| \LaTeX\ package to make |
| 159 |
% this happen. For more information, visit |
| 160 |
% \url{http://www.dozenal.org}. |
| 161 |
% |
| 162 |
% The package \emph{does not} work with anything but |
| 163 |
% |pdftex|; it uses a few |pdftex| primitives internally. I |
| 164 |
% didn't think it was worth the effort to make it generic. |
| 165 |
% |
| 166 |
% \section{Letter Commands} |
| 167 |
% \label{sect:actletcomm} |
| 168 |
% |
| 169 |
% To begin with, we need to be able to specify actual letter |
| 170 |
% commands; that is, commands which create the date, the |
| 171 |
% inside address, the salutation, the farewell, the |
| 172 |
% signature, and the enclosure line. Some of these may be |
| 173 |
% absent in a particular letter, but a letter document class |
| 174 |
% must account for all of them. |
| 175 |
% |
| 176 |
% These commands will all be defined if you begin your |
| 177 |
% document with the following: |
| 178 |
% |
| 179 |
% \begin{quote} |
| 180 |
% |\documentclass{yaletter}| |
| 181 |
% \end{quote} |
| 182 |
% |
| 183 |
% Once you do this, you've got |yaletter| to work with. |
| 184 |
% |
| 185 |
% |yaletter| does depend on |textpos| (for envelopes and |
| 186 |
% labels) and |xkeyval| (for the arguments to |
| 187 |
% |\yaoptions|), as well as on |geometry| and |fancyhdr| |
| 188 |
% (for the purposes one would expect). If these are not |
| 189 |
% installed, go ahead and install them; otherwise |yaletter| |
| 190 |
% can't do its work. |
| 191 |
% |
| 192 |
% \subsection{Parts of a Letter} |
| 193 |
% \label{sub:partsletter} |
| 194 |
% |
| 195 |
% It is important to understand the parts of a normal |
| 196 |
% business letter if you are going to use the |yaletter| |
| 197 |
% class, so let's go over those very briefly first. |
| 198 |
% |
| 199 |
% \begin{figure}[htb] |
| 200 |
% \centering |
| 201 |
% \includegraphics[scale=0.5]{parts_letter_diagram.png} |
| 202 |
% \caption{Parts of a Basic American Letter, Labelled} |
| 203 |
% \label{fig:parts} |
| 204 |
% \end{figure} |
| 205 |
% |
| 206 |
% Figure \ref{fig:parts} should be pretty self-explanatory, |
| 207 |
% so we won't spend time talking about it. These are the |
| 208 |
% parts of a letter that we'll be discussing, though, and |
| 209 |
% this is (mostly) the default appearance of an opening page |
| 210 |
% in |yaletter| (\textit{mutatis mutandis}, of course; e.g., |
| 211 |
% you'll almost certainly have a different letterhead). |
| 212 |
% |
| 213 |
% \subsection{Date Commands} |
| 214 |
% \label{sub:dates} |
| 215 |
% |
| 216 |
% \DescribeMacro{\yadate}|\yadate| takes a single argument, |
| 217 |
% which is the date that you want to be printed. It is |
| 218 |
% indented from the left margin by the length |
| 219 |
% \DescribeMacro{\yahdateskip}|\yahdateskip|, which can be |
| 220 |
% set in either the plain-\TeX\ length-setting way (e.g., |
| 221 |
% |\yahdateskip=3in|) or the \LaTeX\ way (e.g., |
| 222 |
% |\setlength{\yahdateskip}{3in}|). |
| 223 |
% |
| 224 |
% The space above and below dates are set by |\ya@predate| |
| 225 |
% and |\ya@postdate|, but as the |@| in the names suggest, |
| 226 |
% these really shouldn't be set in the document itself. |
| 227 |
% These should be consistent across all letters of a given |
| 228 |
% type, so preferably they should be set in the |\yaoptions| |
| 229 |
% command, as explained in Section \ref{sect:pageopts}. |
| 230 |
% |
| 231 |
% You can style your date arbitrarily by putting your style |
| 232 |
% commands into the macro |
| 233 |
% \DescribeMacro{\yadatestyle}|\yadatestyle|. |
| 234 |
% |\yadatestyle| is expanded right before the date itself. |
| 235 |
% Remember that you need to use font-changing commands, not |
| 236 |
% environments, for this; e.g., use |\itshape|, not |
| 237 |
% |\textit|. |
| 238 |
% |
| 239 |
% \subsection{Inside Adress} |
| 240 |
% \label{sub:insideaddr} |
| 241 |
% |
| 242 |
% The ``inside address'' is the address of the addressee; it |
| 243 |
% is so called because it appears inside the letter, as |
| 244 |
% opposed to on the envelope, where it also appears. The |
| 245 |
% macro \DescribeMacro{\yainsideaddr}|\yainsideaddr| takes a |
| 246 |
% single argument, which is the inside address you want to |
| 247 |
% be typeset. |
| 248 |
% |
| 249 |
% The argument of |\yainsideaddr| will be typeset |
| 250 |
% left-justified in a box which will be indented by the |
| 251 |
% value of |
| 252 |
% \DescribeMacro{\yahinsideaddrskip}|\yahinsideaddrskip|. |
| 253 |
% Like |\yahdateskip|, this can be adjusted in either plain |
| 254 |
% \TeX\ or \LaTeX\ fashion. |
| 255 |
% |
| 256 |
% You can insert style commands for your inside address |
| 257 |
% using the |
| 258 |
% \DescribeMacro{\yainsideaddrstyle}|\yainsideaddrstyle| |
| 259 |
% macro, which takes one argument, which is the style |
| 260 |
% commands you desire. This is subject to the same |
| 261 |
% restrictions as |\yadatestyle|. |
| 262 |
% |
| 263 |
% The space above and below the inside address is governed |
| 264 |
% by |\ya@preinsideaddr| and |\ya@postinsideaddr|; however, |
| 265 |
% as the |@| indicates, these should not be adjusted |
| 266 |
% internally. Rather, they should be set using the |
| 267 |
% |\yaoptions| command discussed in Section \ref{sect:pageopts}. |
| 268 |
% |
| 269 |
% A typical inside address would probably look something |
| 270 |
% like this: |
| 271 |
% |
| 272 |
% \iffalse |
| 273 |
%<*example> |
| 274 |
% \fi |
| 275 |
\begin{lstlisting} |
| 276 |
\yainsideaddr{Great Company Name \\ 1234 Otherplace Road \\ |
| 277 |
Somewhere, OK 00000} |
| 278 |
\end{lstlisting} |
| 279 |
% \iffalse |
| 280 |
%</example> |
| 281 |
% \fi |
| 282 |
% |
| 283 |
% It's also possible (and often easier) to use addresses |
| 284 |
% defined by the |\defineaddress| command, as explained in |
| 285 |
% Section \ref{sect:addresses}. |
| 286 |
% |
| 287 |
% \subsection{Salutation} |
| 288 |
% \label{sub:salutation} |
| 289 |
% |
| 290 |
% The salutation, typically just ``Dear So-and-so,'' is |
| 291 |
% produced by the command |
| 292 |
% \DescribeMacro{\yasalutation}|\yasalutation|. This also |
| 293 |
% takes a single argument, the name which you'd like to |
| 294 |
% salute. E.g., running |\yasalutation{Mr.~Anderson}| will |
| 295 |
% produce the string, ``Dear Mr.\ Anderson:'' (by default). |
| 296 |
% |
| 297 |
% It doesn't have to use the word ``Dear,'' or to use a |
| 298 |
% colon after the name. The word used in the salutation is |
| 299 |
% inserted by the macro |\ya@saluword|, and the punctuation |
| 300 |
% by |\ya@salupunct|. The spaces above and below the |
| 301 |
% salutation are produced by |\ya@presalutation| and |
| 302 |
% |\ya@postsalutation|. All of these, as the |@| sign |
| 303 |
% indicates, should not be set in the body of the document; |
| 304 |
% rather, they should be set using the |\yaoptions| command |
| 305 |
% discussed in Section \ref{sect:pageopts}. |
| 306 |
% |
| 307 |
% The salutation will be indented from the left by the |
| 308 |
% distance |\yahsalutationskip|, which can be set in either |
| 309 |
% the plain \TeX\ or \LaTeX\ ways. |
| 310 |
% |
| 311 |
% The styling of the salutation is governed by |
| 312 |
% \DescribeMacro{\yasalutationstyle}|\yasalutationstyle|, |
| 313 |
% which is subject to the same limitations as the other |
| 314 |
% style commands. |
| 315 |
% |
| 316 |
% \subsection{Farewell, Signature, and Enclosure} |
| 317 |
% \label{sub:faresigs} |
| 318 |
% |
| 319 |
% We treat these three together, since they always go |
| 320 |
% together. Insert the farewell with |
| 321 |
% \DescribeMacro{\yafarewell}|\yafarewell|, which is |
| 322 |
% indented from the left margin by the value of |
| 323 |
% \DescribeMacro{\yahfarewellskip}|\yahfarewellskip|. The |
| 324 |
% spacing above and below the farewell are governed by |
| 325 |
% |\ya@prefarewell| and |\ya@postfarewell|, but these should |
| 326 |
% be set using the |\yaoptions| command discussed in Section |
| 327 |
% \ref{sect:pageopts}. |
| 328 |
% |
| 329 |
% By default, this produces the string ``Sincerely,'' but it |
| 330 |
% need not use that word or that punctuation. |
| 331 |
% |\ya@farewellword| and |\ya@farewellpunct| set each of |
| 332 |
% these; however, these should also |
| 333 |
% be set using the |\yaoptions| command discussed in Section |
| 334 |
% \ref{sect:pageopts}. |
| 335 |
% |
| 336 |
% The farewell can be styled with |
| 337 |
% \DescribeMacro{\yafarewellstyle}|\yafarewellstyle|, which |
| 338 |
% is subject to the same restrictions as the similar |
| 339 |
% commands for other parts of the letter. |
| 340 |
% |
| 341 |
% The signature is given by |
| 342 |
% \DescribeMacro{\yasignature}|\yasignature|, which produces |
| 343 |
% the value of the macro |\ya@signatureword|, typically set |
| 344 |
% in the |\yaoptions| command discussed in Section |
| 345 |
% \ref{sect:pageopts}. Similarly, the space above and below |
| 346 |
% the signature is governed by |\ya@presignature| and |
| 347 |
% |\ya@postsignature|. The signature is indented by the |
| 348 |
% value of |
| 349 |
% \DescribeMacro{\yahsignatureskip}|\yahsignatureskip|, |
| 350 |
% which can be set in the usual ways. It is styled by |
| 351 |
% \DescribeMacro{\yasignaturestyle}|\yasignaturestyle|, |
| 352 |
% subject to the usual restrictions. |
| 353 |
% |
| 354 |
% The enclosure is included by issuing |
| 355 |
% \DescribeMacro{\yaenclosure}|\yaenclosure|. This produces |
| 356 |
% the value of |\ya@enclosureword|, indented by the value of |
| 357 |
% \DescribeMacro{\yahenclosureskip}|\yahenclosureskip|, |
| 358 |
% styled according to the value of |
| 359 |
% \DescribeMacro{\yaenclosurestyle}|\yaenclosurestyle|. The |
| 360 |
% space above and below it is governed by |\ya@preenclosure| |
| 361 |
% and |\ya@postenclosure|. As usual, commands containing |
| 362 |
% |@| should be changed using the |\yaoptions| command |
| 363 |
% discussed in Section \ref{sect:pageopts}. |
| 364 |
% |
| 365 |
% \section{Letter Options} |
| 366 |
% \label{sect:pageopts} |
| 367 |
% |
| 368 |
% Letters simply don't follow the same rules as other typset |
| 369 |
% documents. I've never seen a letter, for example, that |
| 370 |
% had two-sided formatting. (Except, of course, for |
| 371 |
% so-called ``open letters,'' but these are really just |
| 372 |
% articles or books addressed at a particular person, so |
| 373 |
% they're not really our use case here.) Margins are |
| 374 |
% typically much smaller than in other typeset works, |
| 375 |
% leading to a much larger typeblock. Headers and footers |
| 376 |
% typically \emph{do} contain rules (lines), often with not |
| 377 |
% only the current page number but also the total number of |
| 378 |
% pages (e.g., ``Page 2 of 4''). |
| 379 |
% |
| 380 |
% So |yaletter| has the command |
| 381 |
% \DescribeMacro{\yaoptions}|\yaoptions|, which gives the |
| 382 |
% user the ability to set a variety of different dimensions |
| 383 |
% within the letter. It includes |fancyhdr| by itself, |
| 384 |
% since the standard \LaTeX\ header styles simply don't |
| 385 |
% address the needs of letter-writing. And |\yaoptions| |
| 386 |
% allows one to set many of the dimensions that |fancyhdr| |
| 387 |
% requires, so that we can keep these things as far as |
| 388 |
% possible in just one place. |
| 389 |
% |
| 390 |
% |\yaoptions| takes a single argument, which is a list of |
| 391 |
% key-value assignments. In the table below, you'll |
| 392 |
% find a table showing the |\yaoptions| keys, along with |
| 393 |
% their default values and a brief description of what |
| 394 |
% they're for. |
| 395 |
% |
| 396 |
% By ``key-value'' options, I mean that they are assigned by |
| 397 |
% the means of the phrase \emph{key = value}. For example, |
| 398 |
% for a default |yaletter| on half-letter paper, do the |
| 399 |
% following: |
| 400 |
% |
| 401 |
% \begin{quote} |
| 402 |
% |\yaoptions{pageheight=8in,pagewidth=5.5in}| |
| 403 |
% \end{quote} |
| 404 |
% |
| 405 |
% All the options here can be set in the same way. |
| 406 |
% |
| 407 |
% You \emph{can} have multiple |\yaoptions| commands; |
| 408 |
% options specified in later ones will override any |
| 409 |
% conflicting options in earlier ones. Therefore, you can |
| 410 |
% have options set in a file which you include, then |
| 411 |
% override some of them after inputting that file to reset |
| 412 |
% some of them. |
| 413 |
% |
| 414 |
% \begin{center} |
| 415 |
% \begin{longtable}{llp{0.5\textwidth}} |
| 416 |
% \toprule |
| 417 |
% Option & Default & Description \\ |
| 418 |
% \midrule |
| 419 |
% |pageheight| & 11in & The height of the paper \\ |
| 420 |
% |pagewidth| & 8.5in & The width of the paper \\ |
| 421 |
% |lftmarg| & 0.5in & The left margin of the letter \\ |
| 422 |
% |rgtmarg| & 0.5in & The right margin of the letter \\ |
| 423 |
% |topmarg| & 0.5in & The top margin of the letter \\ |
| 424 |
% |botmarg| & 1.0in & The bottom margin of the letter \\ |
| 425 |
% |footskip| & 24pt & The distance bettween the bottom of |
| 426 |
% the typeblock and the bottom of the footer \\ |
| 427 |
% |headsep| & 12pt& The distance between the bottom of the |
| 428 |
% header and the top of the typeblock \\ |
| 429 |
% |headheight| & 12pt & The height of the header line \\ |
| 430 |
% |headwidth| & |\textwidth| & The width of the header and footer |
| 431 |
% lines \\ |
| 432 |
% |headrulewidth| & 0.4pt & The thickness of the line underneath |
| 433 |
% the header \\ |
| 434 |
% |footrulewidth| & 0.4pt & The thickness of the line above |
| 435 |
% the footer \\ |
| 436 |
% |predate| & 24pt & The space between the letterhead (if |
| 437 |
% any) and the date \\ |
| 438 |
% |postdate| & 12pt & The space after the date \\ |
| 439 |
% |datehskip| & 0pt & The horizontal space prior to the date \\ |
| 440 |
% |preinsideaddr| & 12pt & The space inserted before the |
| 441 |
% inside address \\ |
| 442 |
% |postinsideaddr| & 0pt & The space inserted after the |
| 443 |
% inside address \\ |
| 444 |
% |insideaddrhskip| & 0pt & The horizontal space inserted |
| 445 |
% prior to the inside address \\ |
| 446 |
% |presalutation| & 0pt & The space inserted before the |
| 447 |
% salutation \\ |
| 448 |
% |postsalutation| & 0pt & The space inserted after the |
| 449 |
% salutation \\ |
| 450 |
% |saluword| & Dear & The word used in the salutation; don't |
| 451 |
% forgot to include a space at the end, if you change this \\ |
| 452 |
% |salupunct| & : & The punctuation used after the salutation \\ |
| 453 |
% |saluskip| & 0pt & The horizontal spacing prior to the |
| 454 |
% salutation \\ |
| 455 |
% |prefarewell| & 0pt & The space inserted before the |
| 456 |
% farewell line (e.g., ``Sincerely,'') \\ |
| 457 |
% |postfarewell| & 12pt & The space inserted after the |
| 458 |
% farewell line (e.g., ``Sincerely,'') \\ |
| 459 |
% |farewellskip| & 0pt & The horizontal space inserted prior |
| 460 |
% to the salutation \\ |
| 461 |
% |farewellword| & Sincerely & The word used in the farewell |
| 462 |
% line \\ |
| 463 |
% |farewellpunct| & , & The punctuation used after the |
| 464 |
% farewell word \\ |
| 465 |
% |presignature| & 12pt & The space inserted before the |
| 466 |
% signature line \\ |
| 467 |
% |postsignature| & 0pt & The space inserted after the |
| 468 |
% signature line \\ |
| 469 |
% |signatureskip| & 0pt & The horizontal space inserted |
| 470 |
% prior to the signature \\ |
| 471 |
% |signatureword| & Your Name Here & The content of the |
| 472 |
% signature; typically the name of the letter writer \\ |
| 473 |
% |preenclosure| & 0pt & The space inserted before the |
| 474 |
% enclosure line \\ |
| 475 |
% |postenclosure| & 0pt & The space inserted after the |
| 476 |
% enclosure line \\ |
| 477 |
% |enclosureskip| & 0pt & The horiziontal space inserted |
| 478 |
% prior to the enclosure line \\ |
| 479 |
% |enclosureword| & Enclosure & The word inserted when there |
| 480 |
% are enclosures \\ |
| 481 |
% |parskip| & 12pt & The space between paragraphs \\ |
| 482 |
% |parindent| & 0pt & The indentation of the first line of |
| 483 |
% each paragraph \\ |
| 484 |
% |datafile| & \emph{None} & The file which |yaletter| will read to |
| 485 |
% get your letter data \\ |
| 486 |
% \bottomrule |
| 487 |
% \end{longtable} |
| 488 |
% \end{center} |
| 489 |
% |
| 490 |
% If you put a suitable |\yaoptions| directive in your data |
| 491 |
% file, you need only tell |yaletter| where your data file |
| 492 |
% is located by saying |
| 493 |
% |\yaoptions{datafile={yourdatafile}}|, and you'll have |
| 494 |
% consistently formatted letters. |
| 495 |
% |
| 496 |
% Some of these defaults may seem curiously small; remember |
| 497 |
% that these values \emph{stack}. That is, |postdate| and |
| 498 |
% |preinsideaddr| are \emph{both} skipped in between the |
| 499 |
% date and the inside address. If there is a parskip, that |
| 500 |
% space will be added, too. So keep these things in mind |
| 501 |
% if the spacing seems larger than you expected. The |
| 502 |
% default settings are suitable for a block-formatted |
| 503 |
% letter. |
| 504 |
% |
| 505 |
% The idea behind putting so many different settings in a |
| 506 |
% single command is that you can easily run many different |
| 507 |
% letters with a consistent look and feel, but by including |
| 508 |
% that one command. However, sometimes you may need to |
| 509 |
% change some individual parts of these; e.g., maybe you |
| 510 |
% want the name in the signature line to change. That's |
| 511 |
% certainly doable, as we saw in Section |
| 512 |
% \ref{sect:actletcomm}. |
| 513 |
% |
| 514 |
% \section{Letterheads} |
| 515 |
% \label{sect:letterheads} |
| 516 |
% |
| 517 |
% This is an important part of any letter package; you want |
| 518 |
% to be able to use nice-looking, fancy letterhead without |
| 519 |
% having to (a) buy paper pre-printed with it, or (b) |
| 520 |
% hand-code or hand-copy the letterhead into each |
| 521 |
% individual document. |
| 522 |
% |
| 523 |
% So |yaletter| allows you to save your letterheads in a |
| 524 |
% data file (probably kept in your |.texlive| directory or |
| 525 |
% some similar place). You can access those letterheads by |
| 526 |
% name, by prefixing |\letterhead| to them. |
| 527 |
% |
| 528 |
% The \DescribeMacro{\defineletterhead}|\defineletterhead| |
| 529 |
% macro takes two arguments: the first is the name of the |
| 530 |
% letterhead, the second is the letterhead code itself. |
| 531 |
% That code can be of arbitrary complexity (though it's |
| 532 |
% probably best to enclose it all in a box to prevent any |
| 533 |
% settings you use leaking out into the remainder of the |
| 534 |
% document), but we'll use something pretty simple for our |
| 535 |
% example here. Let's say you want the following code for |
| 536 |
% your letterhead: |
| 537 |
% |
| 538 |
% \iffalse |
| 539 |
%<*example> |
| 540 |
% \fi |
| 541 |
\begin{lstlisting} |
| 542 |
\vbox{% |
| 543 |
\hbox to\linewidth{% |
| 544 |
\fontsize{72pt}{72pt}\selectfont% |
| 545 |
Your Name\hfil% |
| 546 |
}\hbox to\linewidth{% |
| 547 |
\vrule width\textwidth depth1.5pt% |
| 548 |
} |
| 549 |
} |
| 550 |
\end{lstlisting} |
| 551 |
% \iffalse |
| 552 |
%</example> |
| 553 |
% \fi |
| 554 |
% |
| 555 |
% You want to call this letterhead |namehead|. You can tell |
| 556 |
% |yaletter| that this is your letterhead and that it's |
| 557 |
% called |namehead| by doing this: |
| 558 |
% |
| 559 |
% \iffalse |
| 560 |
%<*example> |
| 561 |
% \fi |
| 562 |
\begin{lstlisting} |
| 563 |
\defineletterhead{namehead}{% |
| 564 |
\vbox{% |
| 565 |
\hbox to\linewidth{% |
| 566 |
\fontsize{72pt}{72pt}\selectfont% |
| 567 |
Your Name\hfil% |
| 568 |
}\hbox to\linewidth{% |
| 569 |
\vrule width\textwidth depth1.5pt% |
| 570 |
} |
| 571 |
} |
| 572 |
}% |
| 573 |
\end{lstlisting} |
| 574 |
% \iffalse |
| 575 |
%</example> |
| 576 |
% \fi |
| 577 |
% |
| 578 |
% You then actually use this letterhead by calling |
| 579 |
% \DescribeMacro{\letterheadNAME}|\letterheadNAME|, |
| 580 |
% replacing the string ``NAME'' with the name you assigned |
| 581 |
% your letterhead earlier. In this case, by calling |
| 582 |
% |\letterheadnamehead|. |
| 583 |
% |
| 584 |
% You can also use a letterhead via the |
| 585 |
% \DescribeMacro{\yauseletterhead}|\yauseletterhead| |
| 586 |
% command, which takes a single argument: the name assigned |
| 587 |
% to the letterhead in the |\defineletterhead| command. So |
| 588 |
% the letterhead we defined as |namehead| can be put into |
| 589 |
% the letter with |\yauseletterhead{namehead}|. |
| 590 |
% |
| 591 |
% So |\yauseletterhead{namehead}| and |\letterheadnamehead| |
| 592 |
% are identical in their effect. |
| 593 |
% |
| 594 |
% This system allows you to maintain as many letterheads as |
| 595 |
% you want, and to easily insert them into a letter, by name, |
| 596 |
% with the inclusion of merely a single line. |
| 597 |
% |
| 598 |
% Although we've not done so here, it's a good idea to keep |
| 599 |
% your letterhead names in all-caps, or something similarly |
| 600 |
% distinctive. |
| 601 |
% |
| 602 |
% \section{Letter Styles} |
| 603 |
% \label{sect:letstyles} |
| 604 |
% |
| 605 |
% In American usage, there are primarily two styles of |
| 606 |
% letter: ``block'' and ``modified block.'' Block letters |
| 607 |
% are universally left-aligned, with a blank space between |
| 608 |
% paragraphs and no indentation. Modified block letters are |
| 609 |
% left-aligned, with a blank space between paragraphs and no |
| 610 |
% indentation, but with the date, saluation, farewell, and |
| 611 |
% signature lines indented to halfway across the page. |
| 612 |
% |
| 613 |
% |yaletter| adds a ``normal'' style, in which paragraphs |
| 614 |
% are typeset as normal; that is, with no space between them |
| 615 |
% (other than normal glue) and indentation at the beginning, |
| 616 |
% but otherwise identical to modified block style. |
| 617 |
% |
| 618 |
% Block format is the default for |yaletter|, as it's the |
| 619 |
% most common in the United States. To explicitly request |
| 620 |
% block format, issue |
| 621 |
% \DescribeMacro{\yaletterblock}|\yaletterblock| in your |
| 622 |
% preamble. To get modified block format, issue |
| 623 |
% \DescribeMacro{\yalettermodblock}|\yalettermodblock| in |
| 624 |
% your preamble. To get normal format, issue |
| 625 |
% \DescribeMacro{\yaletternormal}|\yaletternormal| in your |
| 626 |
% preamble. |
| 627 |
% |
| 628 |
% The actual space between paragraphs is governed by the |
| 629 |
% special length \DescribeMacro{\yaparskip}|\yaparskip|. To |
| 630 |
% change this, use |\setlength{\yaparskip}{2em}| (or |
| 631 |
% whatever your desired length is). This defaults to |12pt|. |
| 632 |
% |
| 633 |
% The actual indentation for paragraphs is governed by the |
| 634 |
% special length \DescribeMacro{\yaparindent}|\yaparindent|. |
| 635 |
% To change this, use |\setlength{\yaparindent}{24pt}| (or |
| 636 |
% whatever your desired length is). This defaults to |0pt|. |
| 637 |
% |
| 638 |
% These parameters mean that you have complete control over |
| 639 |
% indentation and paragraph skipping, even after specifying |
| 640 |
% a particular format (with |\yaletterblock|, for example). |
| 641 |
% Issuing |\yaparskip=24pt| and |\yaparindent=24pt| will |
| 642 |
% give you the desired paragraph skip and indentation within |
| 643 |
% the normal block format. |
| 644 |
% |
| 645 |
% The only trick here is to remember that, if you're using |
| 646 |
% |\yaletternormal| and you want a non-zero |\parskip|, you |
| 647 |
% have to set |\yaparskip| \emph{after} your |
| 648 |
% |\begin{document}|. I'm not really sure why you'd ever |
| 649 |
% want to do this, but you know your needs better than I do, |
| 650 |
% so I wanted it to be an option. |
| 651 |
% |
| 652 |
% Further note that these are merely convenience commands; |
| 653 |
% you can do everything these letter styles do simply by |
| 654 |
% adjusting the parameters in |\yaoptions|. These little |
| 655 |
% macros are merely syntactic sugar. |
| 656 |
% |
| 657 |
% \section{Headers and Footers} |
| 658 |
% \label{sect:headfoot} |
| 659 |
% |
| 660 |
% It makes sense for letters to have very distinctive |
| 661 |
% headers and footers, especially since there is usually no |
| 662 |
% indentation beginning paragraphs. Since paragraph breaks |
| 663 |
% are marked only by spacing, when such a break falls at the |
| 664 |
% end of a page, it may be hard to tell without a clearly |
| 665 |
% marked footer. But there should not be a header on the |
| 666 |
% first page, which has plenty of information already |
| 667 |
% included, possibly including a letterhead, to make it very |
| 668 |
% clear to the reader what he is looking at. |
| 669 |
% |
| 670 |
% So |yaletter| includes |fancyhdr|, since it will be needed |
| 671 |
% for almost anything. It furthermore resets both |
| 672 |
% |\headrulewidth| and |\footrulewidth| to |0.4pt|, since |
| 673 |
% these are both very helpful guides when reading a letter's |
| 674 |
% text. (Note that both of these can be changed, if |
| 675 |
% desired, in |\yaoptions|.) |
| 676 |
% |
| 677 |
% On the first page, the page style is automatically set as |
| 678 |
% |yafirstpage|. |yafirstpage| is defined as follows: |
| 679 |
% |
| 680 |
% \iffalse |
| 681 |
%<*example> |
| 682 |
% \fi |
| 683 |
\begin{lstlisting} |
| 684 |
\fancypagestyle{yafirstpage}{% |
| 685 |
\renewcommand\headrulewidth{0pt} |
| 686 |
\renewcommand\footrulewidth{0.4pt} |
| 687 |
\fancyhf{}% |
| 688 |
\fancyfoot[C]{Page \thepage\ of \yalastpage}% |
| 689 |
}% |
| 690 |
\end{lstlisting} |
| 691 |
% \iffalse |
| 692 |
%</example> |
| 693 |
% \fi |
| 694 |
% |
| 695 |
% If you want the first page footer to be different, |
| 696 |
% redefine |yafirstpage| with whatever parameters you would |
| 697 |
% like. |
| 698 |
% |
| 699 |
% Headers on subsequent pages are defined by the page style |
| 700 |
% |yaotherpage|: |
| 701 |
% |
| 702 |
% \iffalse |
| 703 |
%<*example> |
| 704 |
% \fi |
| 705 |
\begin{lstlisting} |
| 706 |
\fancypagestyle{yaotherpage}{% |
| 707 |
\renewcommand\headrulewidth{0.4pt} |
| 708 |
\renewcommand\footrulewidth{0.4pt} |
| 709 |
\fancyhf{}% |
| 710 |
\fancyhead[L]{\yawriter\ to \yaaddressee}% |
| 711 |
\fancyhead[R]{\yathedate}% |
| 712 |
\fancyfoot[C]{Page \thepage\ of \yalastpage}% |
| 713 |
}% |
| 714 |
\end{lstlisting} |
| 715 |
% \iffalse |
| 716 |
%</example> |
| 717 |
% \fi |
| 718 |
% |
| 719 |
% This, too, can of course be redefined to be whatever you |
| 720 |
% want it to be, with the usual |fancyhdr| commands. |
| 721 |
% |
| 722 |
% \section{Special Variables} |
| 723 |
% \label{sect:specvar} |
| 724 |
% |
| 725 |
% In Section \ref{sect:headfoot}, we saw a couple of special |
| 726 |
% variables used, which contain values like the addressee of |
| 727 |
% the letter, the author of the letter, and so forth. We |
| 728 |
% can use these variables in headers and footers especially, |
| 729 |
% but they are useful in other places, as well. |
| 730 |
% |
| 731 |
% \DescribeMacro{\yawriter}|\yawriter| contains the author |
| 732 |
% of the letter. It is set by using the macro |
| 733 |
% \DescribeMacro{\yasetwriter}|\yasetwriter|, and styled |
| 734 |
% with the contents of the macro |
| 735 |
% \DescribeMacro{\yawriterstyle}|\yawriterstyle|. For |
| 736 |
% example, to set the letter's writer as ``John Doe'' and |
| 737 |
% set it in italics, run the following: |
| 738 |
% |
| 739 |
% \iffalse |
| 740 |
%<*example> |
| 741 |
% \fi |
| 742 |
\begin{lstlisting} |
| 743 |
\yawriterstyle{\itshape} |
| 744 |
\yasetwriter{John Doe} |
| 745 |
\yawriter |
| 746 |
\end{lstlisting} |
| 747 |
% \iffalse |
| 748 |
%</example> |
| 749 |
% \fi |
| 750 |
% |
| 751 |
% Similarly, there are the macros |
| 752 |
% \DescribeMacro{\yasetaddressee}|\yasetaddressee|, |
| 753 |
% \DescribeMacro{\yaaddresseestyle}|\yaaddresseestyle|, and |
| 754 |
% \DescribeMacro{\yaaddressee}|\yaaddressee|. These can be |
| 755 |
% used with the |\yawriter| commands to develop things like |
| 756 |
% the default header, which briefly states the parties to |
| 757 |
% the letter. |
| 758 |
% |
| 759 |
% There is also \DescribeMacro{\yathedate}|\yathedate|, |
| 760 |
% which holds the date which was entered in the |\yadate| |
| 761 |
% macro, and the \DescribeMacro{\yalastpage}|\yalastpage|, |
| 762 |
% which holds the page number of the last page. (Note that |
| 763 |
% this isn't necessarily the last page of your whole |
| 764 |
% document, which might be closed by an envelope or label |
| 765 |
% page; rather, it's the page which contains the signature.) |
| 766 |
% |
| 767 |
% \section{Addresses} |
| 768 |
% \label{sect:addresses} |
| 769 |
% |
| 770 |
% It's likely that you have a list of addresses that you |
| 771 |
% normally send letters to, and it doesn't make sense for |
| 772 |
% you to have to type them every time. So |yaletter| allows |
| 773 |
% you to define addresses, along with shorthands, in a |
| 774 |
% database of sorts and refer to them that way, as well as |
| 775 |
% simply entering them manually where they need to go. |
| 776 |
% |
| 777 |
% \DescribeMacro{\defineaddress}|\defineaddress| takes three |
| 778 |
% arguments. The first is the name by which you want to |
| 779 |
% refer to the address; the second is the short name, which |
| 780 |
% will be inserted into the |\yaaddressee| or |\yawriter| |
| 781 |
% spot; and the last is the code of the address itself. An |
| 782 |
% example would be the following: |
| 783 |
% |
| 784 |
% \iffalse |
| 785 |
%<*example> |
| 786 |
% \fi |
| 787 |
\begin{lstlisting} |
| 788 |
\defineaddress{FIRST}{Great Company}{% |
| 789 |
Great Company Name \\ |
| 790 |
1234 Otherplace Road \\ |
| 791 |
Somewhere, OK 00000% |
| 792 |
} |
| 793 |
\end{lstlisting} |
| 794 |
% \iffalse |
| 795 |
%</example> |
| 796 |
% \fi |
| 797 |
% |
| 798 |
% To actual use this address, one has a number of options. |
| 799 |
% To use the address as the inside address, |yaletter| |
| 800 |
% provides the \DescribeMacro{\yatoaddress}|\yatoaddress| |
| 801 |
% macro, which takes the single argument of the name of the |
| 802 |
% address defined by |\defineaddress|. For example: |
| 803 |
% |
| 804 |
% \iffalse |
| 805 |
%<*example> |
| 806 |
% \fi |
| 807 |
\begin{lstlisting} |
| 808 |
\yainsideaddr{\yatoaddress{FIRST}} |
| 809 |
\end{lstlisting} |
| 810 |
% \iffalse |
| 811 |
%</example> |
| 812 |
% \fi |
| 813 |
% |
| 814 |
% The |\yatoaddress| macro both typesets the address itself |
| 815 |
% and resets |\yaaddressee| to the short name given in |
| 816 |
% |\defineaddress|. |
| 817 |
% |
| 818 |
% |yaletter| also provides the similar commands |
| 819 |
% \DescribeMacro{\yareturnaddress}|\yareturnaddress|, which |
| 820 |
% both typesets the address and sets |\yawriter| to the |
| 821 |
% short name given in the corresponding |\defineaddress|; |
| 822 |
% and \DescribeMacro{\yafromaddress}|\yafromaddress|, which |
| 823 |
% sets |\yawriter| but does not typeset the address itself. |
| 824 |
% |
| 825 |
% Finally, \DescribeMacro{\yaaddress}|\yaaddress| just |
| 826 |
% typesets the address, and doesn't set any other variables. |
| 827 |
% |
| 828 |
% If you already have an address database, it is probably |
| 829 |
% helpful to develop a script which will convert your |
| 830 |
% addresses into appropriate |\defineaddress| macros. |
| 831 |
% Fortunately, this probably isn't very difficult. |
| 832 |
% |
| 833 |
% \section{Envelopes} |
| 834 |
% \label{sect:envelopes} |
| 835 |
% |
| 836 |
% |yaletter| also provides plenty of facilities for |
| 837 |
% typesetting envelopes. You can use the same convenient |
| 838 |
% address facilities for envelopes as you can for letters. |
| 839 |
% |
| 840 |
% \DescribeMacro{\yaenvelope}|\yaenvelope| is the primary |
| 841 |
% macro, and it takes two arguments: the first is the width |
| 842 |
% of the envelope, the second is its height. These can be |
| 843 |
% given in any dimension that |pdftex| understands; likely |
| 844 |
% this will be inches or millimeters. |yaletter| will |
| 845 |
% create this envelope at the point in the document that you |
| 846 |
% invoke |\yaenvelope|, so if you're doing this in the same |
| 847 |
% file as your letter, you should issue this after your |
| 848 |
% letter is complete. It will start a new page if |
| 849 |
% necessary. So, for a standard American business envelope: |
| 850 |
% |
| 851 |
% \begin{quote} |
| 852 |
% |\yaenvelope{9.5in}{4.125in}| |
| 853 |
% \end{quote} |
| 854 |
% |
| 855 |
% You can control the placing of the return address and the |
| 856 |
% to address very precisely. To select the unit you'd like |
| 857 |
% to use for that control, use |
| 858 |
% \DescribeMacro{\yaenvunit}|\yaenvunit|, which takes a |
| 859 |
% single argument, which is the unit you'd like to use for |
| 860 |
% positioning envelope elements. I have found a tenth of an |
| 861 |
% inch convenient for this purpose, and that is consequently |
| 862 |
% the default: |
| 863 |
% |
| 864 |
% \begin{quote} |
| 865 |
% |\yaenvunit{0.1in}| |
| 866 |
% \end{quote} |
| 867 |
% |
| 868 |
% You then set the value of several count registers; those |
| 869 |
% count registers will be multiplied by the value of |
| 870 |
% |\yaenvunit| for positioning. The registers are: |
| 871 |
% |
| 872 |
% \begin{center} |
| 873 |
% \begin{tabular}{lp{0.6\textwidth}c} |
| 874 |
% \toprule |
| 875 |
% Dimension & Description & Default\\ |
| 876 |
% \midrule |
| 877 |
% |\yaenvrethskip| & Return address's distance from the left |
| 878 |
% edge of the envelope & 2 \\ |
| 879 |
% |\yaenvretvskip| & Return address's distance from the top |
| 880 |
% edge of the envelope & 1 \\ |
| 881 |
% |\yaenvtohskip| & To address's distance from the left |
| 882 |
% edge of the envelope & 42 \\ |
| 883 |
% |\yaenvtovskip| & To address's distance from the top |
| 884 |
% edge of the envelope & 18 \\ |
| 885 |
% \bottomrule |
| 886 |
% \end{tabular} |
| 887 |
% \end{center} |
| 888 |
% |
| 889 |
% Set these in the manner of plain-\TeX\ counts, not \LaTeX\ |
| 890 |
% counters. E.g.: |
| 891 |
% |
| 892 |
% \begin{quote} |
| 893 |
% |\yaenvtovskip=5| |
| 894 |
% \end{quote} |
| 895 |
% |
| 896 |
% The actual addresses to be printed are held in |
| 897 |
% \DescribeMacro{\yaenvtoaddr}|\yaenvtoaddr|, which holds |
| 898 |
% the to address; and |
| 899 |
% \DescribeMacro{\yaenvretaddr}|\yaenvretaddr|, which holds |
| 900 |
% the return address. Redefine these before issuing your |
| 901 |
% |\yaenvelope| command: |
| 902 |
% |
| 903 |
% \iffalse |
| 904 |
%<*example> |
| 905 |
% \fi |
| 906 |
\begin{lstlisting} |
| 907 |
\def\yaenvretaddr{% |
| 908 |
Your Name \\ |
| 909 |
7777 Someplace Street \\ |
| 910 |
Nowhere, OK 00000% |
| 911 |
}% |
| 912 |
\def\yaenvtoaddr{\yaaddress{FIRST}} |
| 913 |
\end{lstlisting} |
| 914 |
% \iffalse |
| 915 |
%</example> |
| 916 |
% \fi |
| 917 |
% |
| 918 |
% Here we have the return address entered manually, but the |
| 919 |
% to address entered as an address defined with |
| 920 |
% |\defineaddress|, using |\yaaddress|, which typesets the |
| 921 |
% address itself but does not set any variables. |
| 922 |
% |
| 923 |
% Because some envelope sizes are quite common, |yaletter| |
| 924 |
% provides them as simple commands. The table below gives |
| 925 |
% these commands along with the envelope size they mimic, |
| 926 |
% plus the skips for each of their parts. The unit of |
| 927 |
% skipping is, in all cases, |0.1in|, which you can change |
| 928 |
% if you need to adjust this spacing. Changing the font |
| 929 |
% size to any significant degree will likely require such |
| 930 |
% adjustments. |
| 931 |
% |
| 932 |
% All of these commands are prefixed with |ya|; the North |
| 933 |
% American sizes are prefixed with |yana|. Subsequently, |
| 934 |
% letters in the names are retained, while digits are made |
| 935 |
% lowercase roman numerals. Finally, |envelope| is suffixed |
| 936 |
% to the end. So, e.g., a C6 envelope becomes |
| 937 |
% |\yacvienvelope|. |
| 938 |
% |
| 939 |
% \begin{longtable}{llcccc} |
| 940 |
% \toprule |
| 941 |
% {} & {} & Ret. & Ret. & To & To \\ |
| 942 |
% Size & Command & hskip & vskip & hskip & vskip \\ |
| 943 |
% \midrule |
| 944 |
% No.\ 10 & |\business| & 2 & 1 & 42 & 18 \\ |
| 945 |
% {} & |\yananoxenvelope| & {} & {} & {} & {} \\ |
| 946 |
% DL & |\yadlenvelope| & 2 & 1 & 36 & 18 \\ |
| 947 |
% C6 & |\yacvienvelope| & 2 & 1 & 26 & 20 \\ |
| 948 |
% C6/C5 & |\yacvicvenvelope| & 2 & 1 & 42 & 18 \\ |
| 949 |
% C5 & |\yacvenvelope| & 2 & 1 & 38 & 28 \\ |
| 950 |
% C4 & |\yacivenvelope| & 3 & 3 & 60 & 42 \\ |
| 951 |
% C3 & |\yaciiienvelope| & 3 & 3 & 84 & 60 \\ |
| 952 |
% A-2 & |\yanaaiienvelope| & 2 & 1 & 22 & 20 \\ |
| 953 |
% A-6 & |\yanaavienvelope| & 2 & 1 & 26 & 22 \\ |
| 954 |
% A-7 & |\yanaaviienvelope| & 2 & 1 & 30 & 24 \\ |
| 955 |
% A-8 & |\yanaaviiienvelope| & 2 & 1 & 34 & 24 \\ |
| 956 |
% A-9 & |\yanaaixenvelope| & 2 & 1 & 38 & 28 \\ |
| 957 |
% A-10 & |\yanaaxenvelope| & 2 & 1 & 42 & 28 \\ |
| 958 |
% No.\ 6$\frac{3}{4}$ & |\yananovienvelope| & 2 & 1 & 26 & 14 \\ |
| 959 |
% No.\ 7$\frac{3}{4}$ & |\yananoviienvelope| & 2 & 1 & 32 & 16 \\ |
| 960 |
% No.\ 9 & |\yananoixenvelope| & 2 & 1 & 36 & 16 \\ |
| 961 |
% No.\ 11 & |\yananoxienvelope| & 2 & 1 & 48 & 20 \\ |
| 962 |
% No.\ 12 & |\yananoxiienvelope| & 2 & 1 & 48 & 22 \\ |
| 963 |
% No.\ 14 & |\yananoxivenvelope| & 2 & 1 & 52 & 24 \\ |
| 964 |
% \bottomrule |
| 965 |
% \end{longtable} |
| 966 |
% |
| 967 |
% |yaletter| can print any size of envelope; if your printer |
| 968 |
% can handle it, |yaletter| can make it. The table above |
| 969 |
% just presents presets for a number of common situations. |
| 970 |
% |
| 971 |
% It bears repeating that all of these settings assume no |
| 972 |
% change in font size; however, especially for the larger |
| 973 |
% envelopes, you'll likely want to increase the font size. |
| 974 |
% You'll probably want to adjust the hskip and vskip for |
| 975 |
% both addresses at that time. |
| 976 |
% |
| 977 |
% \section{Labels} |
| 978 |
% \label{sect:labels} |
| 979 |
% |
| 980 |
% Oftentimes, however, we don't want to print on envelopes; |
| 981 |
% we just want to print on labels, which we can then attach |
| 982 |
% to envelopes (or to packages, or to whatever). |yaletter| |
| 983 |
% caters to this need, too. |
| 984 |
% |
| 985 |
% The main macro is |
| 986 |
% \DescribeMacro{\yalabelsheet}|\yalabelsheet|, which due to |
| 987 |
% the nature of label sheets takes many arguments which are |
| 988 |
% best explained explicitly: |
| 989 |
% |
| 990 |
% \begin{center} |
| 991 |
% \cmd{\yalabelsheet} \marg{page-width} \marg{page-height} |
| 992 |
% \marg{label-width} \marg{label-height} |
| 993 |
% \marg{horizontal-separation} \marg{vertical-separation} |
| 994 |
% \marg{number-across} \marg{number-down} |
| 995 |
% \end{center} |
| 996 |
% |
| 997 |
% That's \emph{eight} mandatory arguments. Unfortunately, |
| 998 |
% this seems unavoidable; we can't assume that labels are |
| 999 |
% evenly spaced on the sheet, nor can we assume that labels |
| 1000 |
% are sensibly divided on the page. The macro does assume |
| 1001 |
% that they are arranged in rows and columns; that is all. |
| 1002 |
% |
| 1003 |
% The first six arguments are all lengths, and can be given |
| 1004 |
% in any unit that \TeX\ understands. The last two are |
| 1005 |
% simply integers; so for a sheet of labels grouped in ten |
| 1006 |
% rows of three, one simply enters |{3}{10}|. |
| 1007 |
% |
| 1008 |
% Even these eight parameters are not sufficient, however, |
| 1009 |
% because we can't assume that the margins of the label |
| 1010 |
% sheet are the same as the gaps between the labels |
| 1011 |
% themselves. So because with \TeX\ we are limited to nine |
| 1012 |
% arguments, we have separate parameters to set these |
| 1013 |
% margins: |
| 1014 |
% |
| 1015 |
% \begin{center} |
| 1016 |
% \begin{tabular}{ll} |
| 1017 |
% \toprule |
| 1018 |
% \multicolumn{1}{c}{Margin} & \multicolumn{1}{c}{Length} \\ |
| 1019 |
% \midrule |
| 1020 |
% Left & |\yalableftmarg| \\ |
| 1021 |
% Right & |\yalabrightmarg| \\ |
| 1022 |
% Top & |\yalabtopmarg| \\ |
| 1023 |
% Bottom & |\yalabbotmarg| \\ |
| 1024 |
% \bottomrule |
| 1025 |
% \end{tabular} |
| 1026 |
% \end{center} |
| 1027 |
% |
| 1028 |
% Redefining \DescribeMacro{\yalabeltext}|\yalabeltext| will |
| 1029 |
% place the contents of that macro in each of the labels on |
| 1030 |
% the newly-created label page. E.g.: |
| 1031 |
% |
| 1032 |
% \begin{quote} |
| 1033 |
% |\def\yalabeltext{\yaaddress{FIRST}}| |
| 1034 |
% \end{quote} |
| 1035 |
% |
| 1036 |
% \noindent |
| 1037 |
% will result in the address (defined with |\defineaddress| |
| 1038 |
% with the label |FIRST|) being typeset in all the labels of |
| 1039 |
% the newly created label sheet. This is very handy for |
| 1040 |
% printing out an entire sheet of, say, return address |
| 1041 |
% labels. However, because often you'd like different |
| 1042 |
% text on each label, |\yalabeltext| defaults to empty, so |
| 1043 |
% no text will be printed onto the labels. This means that |
| 1044 |
% it will appear to be a completely blank page. |
| 1045 |
% |
| 1046 |
% You can place individual labels with the |
| 1047 |
% \DescribeMacro{\yaplacelabel}|\yaplacelabel| command: |
| 1048 |
% |
| 1049 |
% \begin{center} |
| 1050 |
% \cmd{\yaplacelabel} \marg{text} \marg{number-across} |
| 1051 |
% \marg{number-down} |
| 1052 |
% \end{center} |
| 1053 |
% |
| 1054 |
% The first argument contains the text you'd like printed on |
| 1055 |
% the label; it consists of arbitrary \LaTeX\ code and can |
| 1056 |
% be the result of other commands (e.g., your first argument |
| 1057 |
% may be something like |\yaaddress{FIRST}|). The second |
| 1058 |
% and third tell |yaletter| which label you'd like this text |
| 1059 |
% to go on; the second argument is the number of columns |
| 1060 |
% across you'd like to skip, the third is the number of rows |
| 1061 |
% down you'd like to skip. |
| 1062 |
% |
| 1063 |
% \emph{These are zero-indexed.} That is, if you want to |
| 1064 |
% typeset a label in the first label on the sheet, use |
| 1065 |
% |{0}{0}|. The whole first row will have a |{0}| for the |
| 1066 |
% second argument; the whole first column will have a |{0}| |
| 1067 |
% for the first argument. |
| 1068 |
% |
| 1069 |
% Note that |yaletter| does \emph{not} check if you've given |
| 1070 |
% it coordinates for a label that actually exists; if you |
| 1071 |
% tell |yaletter| to typeset a label in the fourth row when |
| 1072 |
% there are only two, it will obey you, and your label will |
| 1073 |
% be off the page. |
| 1074 |
% |
| 1075 |
% Each label is typeset in a box. You can indent the box |
| 1076 |
% from the left edge of the label by setting the length |
| 1077 |
% \DescribeMacro{\yalabelmarg}|\yalabelmarg|, which defaults |
| 1078 |
% to |0.1in|. |
| 1079 |
% |
| 1080 |
% Sometimes it's useful to see the boxes that you're |
| 1081 |
% typesetting in, even though you don't want to print them. |
| 1082 |
% E.g., it's easier to tell if your text fits inside the |
| 1083 |
% label if you can see the boundaries of that label. To |
| 1084 |
% make these boxes visible, run |
| 1085 |
% \DescribeMacro{\yashowboxeson}|\yashowboxeson|; to turn |
| 1086 |
% them off again, run |
| 1087 |
% \DescribeMacro{\yashowboxesoff}|\yashowboxesoff|. |
| 1088 |
% |
| 1089 |
% When you're defining a new label sheet, it's important not |
| 1090 |
% to trust the measurements on the packaging. For example, |
| 1091 |
% Avery 8660 says that its labels are one inch high, but it |
| 1092 |
% also says that they're twenty-five millimeters high; |
| 1093 |
% obviously, one of these must be slightly off, since one |
| 1094 |
% inch equals 25.4 millimeters. It turns out that using |
| 1095 |
% twenty-five millimeters works better, though a ruler |
| 1096 |
% says that one inch is the correct measurement. Go figure. |
| 1097 |
% |
| 1098 |
% |yaletter| offers two presets for label sheets: Avery |
| 1099 |
% 8660 and Avery 8663. Why these two? Because those are |
| 1100 |
% the two that I happen to have in my drawer here! In any |
| 1101 |
% case, they are accessed using the |
| 1102 |
% \DescribeMacro{\yaavery}|\yaavery| command, which takes |
| 1103 |
% one argument: the number of the label package. E.g., |
| 1104 |
% |\yaavery{8660}| will give you a sheet of labels in size |
| 1105 |
% Avery 8660. |
| 1106 |
% |
| 1107 |
% Defining new label sheets is relatively easy. If you want |
| 1108 |
% it to fit into this |avery| naming scheme, define it like |
| 1109 |
% so: |
| 1110 |
% |
| 1111 |
% \iffalse |
| 1112 |
%<*example> |
| 1113 |
% \fi |
| 1114 |
\begin{lstlisting} |
| 1115 |
\expandafter\def\csname avery????\endcsname{% |
| 1116 |
\yalabtopmarg=0.5in |
| 1117 |
\yalabbotmarg=0.5in |
| 1118 |
\yalableftmarg=0.1875in |
| 1119 |
\yalabrightmarg=0.1875in |
| 1120 |
\yalabelsheet{8.5in}{11in}{2.625in}{25mm}{0.125in}{0in}{3}{10}% |
| 1121 |
}% |
| 1122 |
\end{lstlisting} |
| 1123 |
% \iffalse |
| 1124 |
%</example> |
| 1125 |
% \fi |
| 1126 |
% |
| 1127 |
% That's the setting for Avery 8660; replace |????| with the |
| 1128 |
% number label you want, and set the appropriate dimensions. |
| 1129 |
% Use a ruler; it's the only way to be sure. Also, the |
| 1130 |
% margins are typically not printed on the packaging, so |
| 1131 |
% you'll need to get those manually anyway. After this, |
| 1132 |
% |\yaavery{????}| will get you a sheet with these settings. |
| 1133 |
% |
| 1134 |
% For some other manufacturer, or if you just don't like |
| 1135 |
% this naming scheme, don't bother; just replace the first |
| 1136 |
% line about with |\def\nameoflabelsheet{%|. Then running |
| 1137 |
% |\nameoflabelsheet| will give you a label sheet with your |
| 1138 |
% settings. |
| 1139 |
% |
| 1140 |
% \section{Examples} |
| 1141 |
% \label{sect:letexamples} |
| 1142 |
% |
| 1143 |
% A common need for label sheets is to print an entire sheet |
| 1144 |
% with the same text on each label; typically this is to |
| 1145 |
% produce a sheet of return-address labels, to be attached |
| 1146 |
% to envelopes when they are mailed. A minimal working |
| 1147 |
% example to produce such a label sheet: |
| 1148 |
% |
| 1149 |
% \iffalse |
| 1150 |
%<*example> |
| 1151 |
% \fi |
| 1152 |
\begin{lstlisting} |
| 1153 |
\documentclass{yaletter} |
| 1154 |
\defineaddress{HOME}{John Q.\ Public}{% |
| 1155 |
John Q.\ Public \\ |
| 1156 |
65 North Buffalo Terrace \\ |
| 1157 |
Somewhere, NY 00000 |
| 1158 |
}% |
| 1159 |
\begin{document} |
| 1160 |
\def\yalabeltext{\yaaddress{HOME}} |
| 1161 |
\yalabtopmarg=0.5in |
| 1162 |
\yalabbotmarg=0.5in |
| 1163 |
\yalableftmarg=0.1875in |
| 1164 |
\yalabrightmarg=0.1875in |
| 1165 |
\yashowboxeson |
| 1166 |
\yalabelsheet{8.5in}{11in}{2.625in}{25mm}{0.125in}{0in}{3}{10}% |
| 1167 |
\end{document} |
| 1168 |
\end{lstlisting} |
| 1169 |
% \iffalse |
| 1170 |
%</example> |
| 1171 |
% \fi |
| 1172 |
% |
| 1173 |
% This will yield a sheet of return address labels (note |
| 1174 |
% that |\yashowboxeson| was issued here, just so we can see |
| 1175 |
% the labels bettter; for actual printing, one wouldn't want |
| 1176 |
% this): |
| 1177 |
% |
| 1178 |
% \begin{center} |
| 1179 |
% \fbox{\includegraphics[scale=0.25]{return_sheet-crop.pdf}} |
| 1180 |
% \end{center} |
| 1181 |
% |
| 1182 |
% The basic types of letters are demonstrated in Figure |
| 1183 |
% \ref{fig:basiclettypes} on page |
| 1184 |
% \pageref{fig:basiclettypes}. Specifically, Figure |
| 1185 |
% \ref{fig:basiclettypes} demonstrates block, modified |
| 1186 |
% block, and normal-style letters. |
| 1187 |
% |
| 1188 |
% \begin{figure}[htbp] |
| 1189 |
% \begin{tabular}{cc} |
| 1190 |
% \fbox{\includegraphics[scale=0.65]{sample_block-crop.pdf}} & |
| 1191 |
% \fbox{\includegraphics[scale=0.65]{sample_modblock-crop.pdf}} \\ |
| 1192 |
% \noalign{\vskip0.25em} |
| 1193 |
% \itshape Block Style & \itshape Modified Block Style \\ |
| 1194 |
% \noalign{\vskip1em} |
| 1195 |
% \fbox{\includegraphics[scale=0.65]{sample_normal-crop.pdf}} & |
| 1196 |
% {} \\ |
| 1197 |
% \itshape Normal Style & {} \\ |
| 1198 |
% \end{tabular} |
| 1199 |
% \caption{Examples of the Three Basic Letter Types} |
| 1200 |
% \label{fig:basiclettypes} |
| 1201 |
% \end{figure} |
| 1202 |
% |
| 1203 |
% A standard American business envelope (No.\ 10) is easier |
| 1204 |
% to form. A minimal example producing such an envelope is |
| 1205 |
% as follows: |
| 1206 |
% |
| 1207 |
% \iffalse |
| 1208 |
%<*example> |
| 1209 |
% \fi |
| 1210 |
\begin{lstlisting} |
| 1211 |
\documentclass{yaletter} |
| 1212 |
\defineaddress{HOME}{John Q.\ Public}{% |
| 1213 |
Your Name \\ |
| 1214 |
7777 Someplace Street \\ |
| 1215 |
Nowhere, OK 00000% |
| 1216 |
}% |
| 1217 |
\def\yaenvretaddr{\yaaddress{HOME}} |
| 1218 |
\def\yaenvtoaddr{Your Name \\ 7777 Someplace Street \\ Nowhere, OK 00000} |
| 1219 |
\def |
| 1220 |
\begin{document} |
| 1221 |
\global\yaenvrethskip=2 |
| 1222 |
\global\yaenvretvskip=1 |
| 1223 |
\global\yaenvtohskip=42 |
| 1224 |
\global\yaenvtovskip=18 |
| 1225 |
\yaenvelope{9.5in}{4.125in}% |
| 1226 |
\end{document} |
| 1227 |
\end{lstlisting} |
| 1228 |
% \iffalse |
| 1229 |
%</example> |
| 1230 |
% \fi |
| 1231 |
% |
| 1232 |
% These are the same settings as can be obtained with |
| 1233 |
% |\yabusiness| or |\yananoxenvelope|; they're spelled out |
| 1234 |
% here just for demonstrative purposes. They will result in |
| 1235 |
% the following envelope: |
| 1236 |
% |
| 1237 |
% \begin{center} |
| 1238 |
% \fbox{\includegraphics[width=\textwidth]{demon_envelope.pdf}} |
| 1239 |
% \end{center} |
| 1240 |
% |
| 1241 |
% You can print this as you wish; but keep in mind that you |
| 1242 |
% may have to rotate the page with your pdf viewer, |
| 1243 |
% depending on what orientation your printer expects. |
| 1244 |
% |
| 1245 |
% \section{Implementation} |
| 1246 |
% \label{sect:implementation} |
| 1247 |
% |
| 1248 |
% First, we need to require |xkeyval|, so that we can make |
| 1249 |
% |yaoptions| work correctly without a confusing array of |
| 1250 |
% options. |
| 1251 |
% \begin{macrocode} |
| 1252 |
\RequirePackage{xkeyval} |
| 1253 |
% \end{macrocode} |
| 1254 |
% Next, define the necessary options and dimensions. Set |
| 1255 |
% good defaults for standard \LaTeX\ dimensions. |
| 1256 |
% \begin{macrocode} |
| 1257 |
\pagenumbering{arabic} |
| 1258 |
\newdimen\ya@lftmarg\ya@lftmarg=0.5in |
| 1259 |
\newdimen\ya@rgtmarg\ya@rgtmarg=0.5in |
| 1260 |
\newdimen\ya@topmarg\ya@topmarg=0.5in |
| 1261 |
\newdimen\ya@botmarg\ya@botmarg=1.0in |
| 1262 |
\paperheight=\the\pdfpageheight |
| 1263 |
\paperwidth=\the\pdfpagewidth |
| 1264 |
\newdimen\ya@pageheight\ya@pageheight=\the\paperheight |
| 1265 |
\newdimen\ya@pagewidth\ya@pagewidth=\the\paperwidth |
| 1266 |
\marginparwidth=0pt |
| 1267 |
\marginparpush=0pt |
| 1268 |
\topmargin=0pt |
| 1269 |
\headheight=12pt |
| 1270 |
\headsep=12pt |
| 1271 |
\footskip=24pt |
| 1272 |
\marginparsep=0pt |
| 1273 |
\newdimen\ya@headheight\ya@headheight=\the\headheight |
| 1274 |
\newdimen\ya@headsep\ya@headsep=\the\headsep |
| 1275 |
\newdimen\ya@footskip\ya@footskip=\the\footskip |
| 1276 |
\oddsidemargin=0pt |
| 1277 |
\newdimen\ya@oddsidemargin\ya@oddsidemargin=\the\oddsidemargin |
| 1278 |
\newdimen\ya@headwidth\ya@headwidth=0pt |
| 1279 |
\def\ya@headrulewidth{0.4pt} |
| 1280 |
\def\ya@footrulewidth{0.4pt} |
| 1281 |
\newdimen\ya@predate\ya@predate=12pt |
| 1282 |
\newdimen\ya@postdate\ya@postdate=12pt |
| 1283 |
\newdimen\ya@preinsideaddr\ya@preinsideaddr=12pt |
| 1284 |
\newdimen\ya@postinsideaddr\ya@postinsideaddr=0pt |
| 1285 |
\newdimen\ya@presalutation\ya@presalutation=0pt |
| 1286 |
\newdimen\ya@postsalutation\ya@postsalutation=0pt |
| 1287 |
\newdimen\ya@prefarewell\ya@prefarewell=0pt |
| 1288 |
\newdimen\ya@postfarewell\ya@postfarewell=12pt |
| 1289 |
\newdimen\ya@presignature\ya@presignature=12pt |
| 1290 |
\newdimen\ya@postsignature\ya@postsignature=0pt |
| 1291 |
\newdimen\ya@preenclosure\ya@preenclosure=0pt |
| 1292 |
\newdimen\ya@postenclosure\ya@postenclosure=0pt |
| 1293 |
\def\ya@saluword{Dear } |
| 1294 |
\def\ya@salupunct{:} |
| 1295 |
\def\ya@farewellword{Sincerely} |
| 1296 |
\def\ya@farewellpunct{,} |
| 1297 |
\def\ya@signatureword{Your Name Here} |
| 1298 |
\def\ya@enclosureword{Enclosure} |
| 1299 |
\def\yaaddressee{} |
| 1300 |
\def\yawriter{} |
| 1301 |
% \end{macrocode} |
| 1302 |
% Now we define |yaoptions| and the actual key-value pairs |
| 1303 |
% which serve as its argument. |
| 1304 |
% \begin{macrocode} |
| 1305 |
\define@key{yaoptions}{lftmarg}{\global\ya@lftmarg=#1} |
| 1306 |
\define@key{yaoptions}{rgtmarg}{\global\ya@rgtmarg=#1} |
| 1307 |
\define@key{yaoptions}{topmarg}{\global\ya@topmarg=#1} |
| 1308 |
\define@key{yaoptions}{botmarg}{\global\ya@botmarg=#1} |
| 1309 |
\define@key{yaoptions}{pageheight}{\global\ya@pageheight=#1} |
| 1310 |
\define@key{yaoptions}{pagewidth}{\global\ya@pagewidth=#1} |
| 1311 |
\define@key{yaoptions}{footskip}{\global\ya@footskip=#1} |
| 1312 |
\define@key{yaoptions}{headsep}{\global\ya@headsep=#1} |
| 1313 |
\define@key{yaoptions}{headheight}{\global\ya@headheight=#1} |
| 1314 |
\define@key{yaoptions}{oddsidemargin}{\global\ya@oddsidemargin=#1} |
| 1315 |
\define@key{yaoptions}{headwidth}{\global\ya@headwidth=#1} |
| 1316 |
\define@key{yaoptions}{headrulewidth}{\global\def\ya@headrulewidth{#1}} |
| 1317 |
\define@key{yaoptions}{footrulewidth}{\global\def\ya@footrulewidth{#1}} |
| 1318 |
\define@key{yaoptions}{predate}{\global\ya@predate=#1} |
| 1319 |
\define@key{yaoptions}{postdate}{\global\ya@postdate=#1} |
| 1320 |
\define@key{yaoptions}{preinsideaddr}{\global\ya@preinsideaddr=#1} |
| 1321 |
\define@key{yaoptions}{postinsideaddr}{\global\ya@postinsideaddr=#1} |
| 1322 |
\define@key{yaoptions}{presalutation}{\global\ya@presalutation=#1} |
| 1323 |
\define@key{yaoptions}{postsalutation}{\global\ya@postsalutation=#1} |
| 1324 |
\define@key{yaoptions}{prefarewell}{\global\ya@prefarewell=#1} |
| 1325 |
\define@key{yaoptions}{postfarewell}{\global\ya@postfarewell=#1} |
| 1326 |
\define@key{yaoptions}{presignature}{\global\ya@presignature=#1} |
| 1327 |
\define@key{yaoptions}{postsignature}{\global\ya@postsignature=#1} |
| 1328 |
\define@key{yaoptions}{preenclosure}{\global\ya@preenclosure=#1} |
| 1329 |
\define@key{yaoptions}{postenclosure}{\global\ya@postenclosure=#1} |
| 1330 |
\define@key{yaoptions}{datehskip}{\global\yahdateskip=#1} |
| 1331 |
\define@key{yaoptions}{insideaddrhskip}{\global\yahinsideaddrskip=#1} |
| 1332 |
\define@key{yaoptions}{saluskip}{\global\yahsalutationskip=#1} |
| 1333 |
\define@key{yaoptions}{farewellskip}{\global\yahfarewellskip=#1} |
| 1334 |
\define@key{yaoptions}{signatureskip}{\global\yahsignatureskip=#1} |
| 1335 |
\define@key{yaoptions}{enclosureskip}{\global\yahenclosureskip=#1} |
| 1336 |
\define@key{yaoptions}{enclosureword}{\global\def\ya@enclosureword{#1}} |
| 1337 |
\define@key{yaoptions}{saluword}{\global\def\ya@saluword{#1}} |
| 1338 |
\define@key{yaoptions}{salupunct}{\global\def\ya@salupunct{#1}} |
| 1339 |
\define@key{yaoptions}{farewellword}{\global\def\ya@farewellword{#1}} |
| 1340 |
\define@key{yaoptions}{farewellpunct}{\global\def\ya@farewellpunct{#1}} |
| 1341 |
\define@key{yaoptions}{signatureword}{\global\def\ya@signatureword{#1}} |
| 1342 |
\define@key{yaoptions}{signatureword}{\global\def\ya@signatureword{#1}} |
| 1343 |
\define@key{yaoptions}{addressee}{\yasetaddressee{#1}} |
| 1344 |
\define@key{yaoptions}{writer}{\yasetwriter{#1}} |
| 1345 |
\define@key{yaoptions}{parskip}{\global\yaparskip=#1} |
| 1346 |
\define@key{yaoptions}{parindent}{\global\yaparindent=#1} |
| 1347 |
\define@key{yaoptions}{datafile}{\global\input{#1}} |
| 1348 |
\newcommand\yaoptions[1]{% |
| 1349 |
\setkeys{yaoptions}{#1}% |
| 1350 |
\geometry{top=\the\ya@topmarg,bottom=\the\ya@botmarg, |
| 1351 |
left=\the\ya@lftmarg,right=\the\ya@rgtmarg, |
| 1352 |
paperheight=\the\ya@pageheight,paperwidth=\the\ya@pagewidth, |
| 1353 |
footskip=\the\ya@footskip,headsep=\the\ya@headsep, |
| 1354 |
headheight=\the\ya@headheight} |
| 1355 |
\ifdim\ya@headwidth=0pt |
| 1356 |
\global\headwidth=\the\textwidth |
| 1357 |
\else |
| 1358 |
\global\headwidth=\the\ya@headwidth |
| 1359 |
\fi |
| 1360 |
\renewcommand{\headrulewidth}{\ya@headrulewidth} |
| 1361 |
\renewcommand{\footrulewidth}{\ya@footrulewidth} |
| 1362 |
}% |
| 1363 |
% \end{macrocode} |
| 1364 |
% Set |\normalsize| so that \LaTeX\ doesn't complain. While |
| 1365 |
% we're at it, set all the default \LaTeX\ font sizes, since |
| 1366 |
% people are often accustomed to using them. |
| 1367 |
% \begin{macrocode} |
| 1368 |
\renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont} |
| 1369 |
\newcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt} |
| 1370 |
\newcommand\tiny{\@setfontsize\tiny\@vpt\@vipt} |
| 1371 |
\newcommand\large{\@setfontsize\large\@xiipt{14}} |
| 1372 |
\newcommand\Large{\@setfontsize\Large\@xivpt{18}} |
| 1373 |
\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} |
| 1374 |
\newcommand\huge{\@setfontsize\huge\@xxpt{25}} |
| 1375 |
\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}} |
| 1376 |
% \end{macrocode} |
| 1377 |
% Now we need to set some basic page dimensions so that |
| 1378 |
% |geometry| doesn't complain. We just start with the |
| 1379 |
% default page dimensions of the system, getting them from |
| 1380 |
% pdf\TeX; it doesn't really matter, since |geometry| will |
| 1381 |
% set the actual dimensions later. |
| 1382 |
% \begin{macrocode} |
| 1383 |
\paperheight=\the\pdfpageheight |
| 1384 |
\paperwidth=\the\pdfpagewidth |
| 1385 |
% \end{macrocode} |
| 1386 |
% Now we add the necessary package: |geometry| and |
| 1387 |
% |fancyhdr|. |
| 1388 |
% \begin{macrocode} |
| 1389 |
\RequirePackage{geometry} |
| 1390 |
\RequirePackage{fancyhdr} |
| 1391 |
% \end{macrocode} |
| 1392 |
% Now define the default page styles. The first, |
| 1393 |
% |yafirstpage|, obviously is used for the first page of the |
| 1394 |
% letter; the other, |yaotherpage|, is used for all other |
| 1395 |
% pages. |
| 1396 |
% \begin{macrocode} |
| 1397 |
\fancypagestyle{yafirstpage}{% |
| 1398 |
\renewcommand\headrulewidth{0pt} |
| 1399 |
\renewcommand\footrulewidth{0.4pt} |
| 1400 |
\fancyhf{}% |
| 1401 |
\fancyfoot[C]{Page \thepage\ of \yalastpage}% |
| 1402 |
}% |
| 1403 |
\fancypagestyle{yaotherpage}{% |
| 1404 |
\renewcommand\headrulewidth{0.4pt} |
| 1405 |
\renewcommand\footrulewidth{0.4pt} |
| 1406 |
\fancyhf{}% |
| 1407 |
\fancyhead[L]{\yawriter\ to \yaaddressee}% |
| 1408 |
\fancyhead[R]{\yathedate}% |
| 1409 |
\fancyfoot[C]{Page \thepage\ of \yalastpage}% |
| 1410 |
}% |
| 1411 |
\fancypagestyle{yaenvpage}{% |
| 1412 |
\renewcommand\headrulewidth{0pt} |
| 1413 |
\renewcommand\footrulewidth{0pt} |
| 1414 |
\fancyhf{}% |
| 1415 |
\newgeometry{margin=0pt} |
| 1416 |
}% |
| 1417 |
% \end{macrocode} |
| 1418 |
% Now let's define the letterhead code. Each letterhead is |
| 1419 |
% defined by |\defineletterhead|, which takes two arguments: |
| 1420 |
% the first is the name of the letterhead, which will be |
| 1421 |
% appended to another command of the form |
| 1422 |
% |\letterheadNAME|; and the second is the actual letterhead |
| 1423 |
% code itself. |
| 1424 |
% \begin{macrocode} |
| 1425 |
\def\defineletterhead#1#2{% |
| 1426 |
\global\expandafter\def\csname letterhead#1\endcsname{% |
| 1427 |
\hbox{#2}% |
| 1428 |
}% |
| 1429 |
\vskip1pt |
| 1430 |
\@afterindentfalse\@afterheading |
| 1431 |
}% |
| 1432 |
% \end{macrocode} |
| 1433 |
% We also define |\yauseletterhead|, which takes as its |
| 1434 |
% single argument the name of the letterhead as given in a |
| 1435 |
% |\defineletterhead| command. |
| 1436 |
% \begin{macrocode} |
| 1437 |
\def\yauseletterhead#1{% |
| 1438 |
\csname letterhead#1\endcsname% |
| 1439 |
}% |
| 1440 |
% \end{macrocode} |
| 1441 |
% Define the basic letter types with |\ya@lettertype|; 0 is |
| 1442 |
% block, 1 is modified block, and 2 is ``normal.'' |
| 1443 |
% \begin{macrocode} |
| 1444 |
\newcount\ya@lettertype\ya@lettertype=0 |
| 1445 |
% \end{macrocode} |
| 1446 |
% Now define some of the basic lengths; these are all |
| 1447 |
% user-accessible (that is, they don't contain ``|@|''). |
| 1448 |
% They deal with paragraph spacing and indentation. |
| 1449 |
% \begin{macrocode} |
| 1450 |
\newdimen\yaparskip\yaparskip=12pt |
| 1451 |
\newdimen\yaparindent\yaparindent=0pt |
| 1452 |
\newdimen\yahdateskip\yahdateskip=0pt |
| 1453 |
\newdimen\yahinsideaddrskip\yahinsideaddrskip=0pt |
| 1454 |
\newdimen\yahsalutationskip\yahsalutationskip=0pt |
| 1455 |
\newdimen\yahfarewellskip\yahfarewellskip=0pt |
| 1456 |
\newdimen\yahsignatureskip\yahsignatureskip=0pt |
| 1457 |
\newdimen\yahenclosureskip\yahenclosureskip=0pt |
| 1458 |
% \end{macrocode} |
| 1459 |
% Define the letter types. These really simply redefine a |
| 1460 |
% few variables, and can be duplicated entirely with the |
| 1461 |
% |\yaoptions| command, but these command provide a little |
| 1462 |
% syntactic sugar. |
| 1463 |
% \begin{macrocode} |
| 1464 |
\def\yaletterblock{% |
| 1465 |
\everypar={% |
| 1466 |
\parindent=\the\yaparindent |
| 1467 |
\parskip=\the\yaparskip |
| 1468 |
}% |
| 1469 |
}% |
| 1470 |
\def\yalettermodblock{% |
| 1471 |
\everypar={% |
| 1472 |
\parindent=\the\yaparindent |
| 1473 |
\parskip=\the\yaparskip |
| 1474 |
}% |
| 1475 |
\yahdateskip=\textwidth% |
| 1476 |
\divide\yahdateskip by2% |
| 1477 |
\yahfarewellskip=\textwidth% |
| 1478 |
\divide\yahfarewellskip by 2% |
| 1479 |
\yahsignatureskip=\textwidth% |
| 1480 |
\divide\yahsignatureskip by 2% |
| 1481 |
\ya@lettertype=1 |
| 1482 |
}% |
| 1483 |
\def\yaletternormal{% |
| 1484 |
\yaparskip=0pt |
| 1485 |
\yaparindent=24pt |
| 1486 |
\everypar={% |
| 1487 |
\parindent=\the\yaparindent |
| 1488 |
\parskip=\the\yaparskip |
| 1489 |
}% |
| 1490 |
\yahdateskip=\textwidth% |
| 1491 |
\divide\yahdateskip by2% |
| 1492 |
\yahfarewellskip=\textwidth% |
| 1493 |
\divide\yahfarewellskip by2% |
| 1494 |
\yahsignatureskip=\textwidth% |
| 1495 |
\divide\yahsignatureskip by2% |
| 1496 |
\ya@lettertype=2 |
| 1497 |
\ya@preinsideaddr=24pt% |
| 1498 |
\ya@presalutation=12pt% |
| 1499 |
\ya@postsalutation=12pt% |
| 1500 |
\ya@prefarewell=12pt% |
| 1501 |
} |
| 1502 |
% \end{macrocode} |
| 1503 |
% Now we define some of the actual letter macros. These put |
| 1504 |
% in things like dates, inside addresses, salutations, and |
| 1505 |
% so forth. We use our space parameters, defined above, to |
| 1506 |
% make sure they all get put in the right places. |
| 1507 |
% \begin{macrocode} |
| 1508 |
\def\yadatestyle{} |
| 1509 |
\def\yadate#1{% |
| 1510 |
\vskip\ya@predate% |
| 1511 |
\noindent\hskip\yahdateskip\hbox{% |
| 1512 |
\yadatestyle #1% |
| 1513 |
\hfil% |
| 1514 |
}% |
| 1515 |
\vskip\ya@postdate% |
| 1516 |
\global\def\yathedate{#1}% |
| 1517 |
}% |
| 1518 |
\def\yainsideaddrstyle{} |
| 1519 |
\def\yainsideaddr#1{% |
| 1520 |
\vskip\ya@preinsideaddr% |
| 1521 |
\noindent\hskip\yahinsideaddrskip\hbox{% |
| 1522 |
\vbox{\yainsideaddrstyle\noindent #1} |
| 1523 |
} |
| 1524 |
\vskip\ya@postinsideaddr% |
| 1525 |
}% |
| 1526 |
\def\yasalutationstyle{} |
| 1527 |
\def\yasalutation#1{% |
| 1528 |
\vskip\ya@presalutation% |
| 1529 |
\noindent\hskip\yahsalutationskip\hbox{% |
| 1530 |
\yasalutationstyle% |
| 1531 |
\ya@saluword #1\ya@salupunct\hfil% |
| 1532 |
}% |
| 1533 |
\vskip\ya@postsalutation% |
| 1534 |
}% |
| 1535 |
\def\yafarewellstyle{} |
| 1536 |
\def\yafarewell{% |
| 1537 |
\vskip\ya@prefarewell% |
| 1538 |
\noindent\hskip\yahfarewellskip\hbox{% |
| 1539 |
\yafarewellstyle% |
| 1540 |
\ya@farewellword\ya@farewellpunct\hfil% |
| 1541 |
}% |
| 1542 |
\vskip\ya@postfarewell% |
| 1543 |
}% |
| 1544 |
\def\yasignaturestyle{} |
| 1545 |
\def\yasignature{% |
| 1546 |
\vskip\ya@presignature% |
| 1547 |
\noindent\hskip\yahsignatureskip\hbox{% |
| 1548 |
\yasignaturestyle% |
| 1549 |
\ya@signatureword\hfil% |
| 1550 |
}% |
| 1551 |
\vskip\ya@postsignature% |
| 1552 |
\label{thelast}% |
| 1553 |
}% |
| 1554 |
\def\yaenclosurestyle{} |
| 1555 |
\def\yaenclosure{% |
| 1556 |
\vskip\ya@preenclosure% |
| 1557 |
\noindent\hskip\yahenclosureskip\hbox to\linewidth{% |
| 1558 |
\yaenclosurestyle% |
| 1559 |
\ya@enclosureword\hfil% |
| 1560 |
}% |
| 1561 |
\vskip\ya@postenclosure% |
| 1562 |
}% |
| 1563 |
% \end{macrocode} |
| 1564 |
% Now we need to include some code for the headers and |
| 1565 |
% footers. These are basically simply container macros with |
| 1566 |
% certain information contained in them. |
| 1567 |
% \begin{macrocode} |
| 1568 |
\def\yaaddresseestyle{\itshape} |
| 1569 |
\def\yasetaddressee#1{% |
| 1570 |
\global\def\yaaddressee{{\yaaddresseestyle #1}}% |
| 1571 |
}% |
| 1572 |
\def\yawriterstyle{\itshape} |
| 1573 |
\def\yasetwriter#1{% |
| 1574 |
\global\def\yawriter{{\yawriterstyle #1}}% |
| 1575 |
}% |
| 1576 |
\def\yalastpagestyle{} |
| 1577 |
\def\yalastpage{% |
| 1578 |
{\yalastpagestyle \pageref{thelast}}% |
| 1579 |
}% |
| 1580 |
% \end{macrocode} |
| 1581 |
% Now we can start work on the address commands. These |
| 1582 |
% define addresses that can then be referred to by name, |
| 1583 |
% similarly to the letterheads. It takes a first argument, |
| 1584 |
% the name of the address; a second, the short name you'd |
| 1585 |
% like to be used for the |\yawriter| or |\yaaddressee|; and |
| 1586 |
% a third, the actual code for the address. |
| 1587 |
% \begin{macrocode} |
| 1588 |
\def\defineaddress#1#2#3{% |
| 1589 |
\global\expandafter\def\csname address#1\endcsname{% |
| 1590 |
\noindent\parskip=0pt\parindent=0pt% |
| 1591 |
#3% |
| 1592 |
}% |
| 1593 |
\global\expandafter\def\csname shortname#1\endcsname{% |
| 1594 |
#2% |
| 1595 |
}% |
| 1596 |
}% |
| 1597 |
% \end{macrocode} |
| 1598 |
% Now we define three commands to actually use this. We can |
| 1599 |
% issue |\yatoaddress{NAME}|, which will typeset the actual |
| 1600 |
% address and set the addressee to the short name define in |
| 1601 |
% the second argument of |\defineaddress|; and |
| 1602 |
% |\yareturnaddress{NAME}|, which does the same thing but |
| 1603 |
% sets the writer rather than the addressee. |
| 1604 |
% |\yafromaddress| sets the writer but does not typeset the |
| 1605 |
% address. Finally, |\yaaddress| just typesets the address |
| 1606 |
% by itself. |
| 1607 |
% \begin{macrocode} |
| 1608 |
\def\yatoaddress#1{% |
| 1609 |
\yasetaddressee{\csname shortname#1\endcsname}% |
| 1610 |
\csname address#1\endcsname% |
| 1611 |
}% |
| 1612 |
\def\yareturnaddress#1{% |
| 1613 |
\yasetwriter{\csname shortname#1\endcsname}% |
| 1614 |
\csname address#1\endcsname% |
| 1615 |
}% |
| 1616 |
\def\yafromaddress#1{% |
| 1617 |
\yasetwriter{\csname shortname#1\endcsname}% |
| 1618 |
}% |
| 1619 |
\def\yaaddress#1{% |
| 1620 |
\csname address#1\endcsname% |
| 1621 |
}% |
| 1622 |
% \end{macrocode} |
| 1623 |
% Now we define the code for envelopes. This is pretty |
| 1624 |
% easy to follow. |\yaenvelope| takes two arguments, the |
| 1625 |
% width and height of the envelope. It uses |\yaenvtoaddr| |
| 1626 |
% and |\yaenvretaddr| in the place the appropriate |
| 1627 |
% addresses. We also provide |\yaenvunit| to let people use |
| 1628 |
% whatever unit they want; |1in| is the default. |
| 1629 |
% \begin{macrocode} |
| 1630 |
\RequirePackage{textpos} |
| 1631 |
\def\yashowboxeson{% |
| 1632 |
\TPoptions{showboxes=true} |
| 1633 |
}% |
| 1634 |
\def\yashowboxesoff{% |
| 1635 |
\TPoptions{showboxes=false} |
| 1636 |
}% |
| 1637 |
\def\yaenvunit#1{% |
| 1638 |
\setlength{\TPHorizModule}{#1}% |
| 1639 |
\setlength{\TPVertModule}{#1}% |
| 1640 |
}% |
| 1641 |
\yaenvunit{0.1in} |
| 1642 |
\def\yaenvtoaddr{% |
| 1643 |
TO ADDRESS% |
| 1644 |
}% |
| 1645 |
\def\yaenvretaddr{% |
| 1646 |
RETURN ADDRESS% |
| 1647 |
}% |
| 1648 |
\newcount\yaenvrethskip\yaenvrethskip=2 |
| 1649 |
\newcount\yaenvretvskip\yaenvretvskip=1 |
| 1650 |
\newcount\yaenvtohskip\yaenvtohskip=42 |
| 1651 |
\newcount\yaenvtovskip\yaenvtovskip=18 |
| 1652 |
\def\yaenvelope#1#2{% |
| 1653 |
\clearpage% |
| 1654 |
\eject\pdfpagewidth=#1 \pdfpageheight=#2% |
| 1655 |
\thispagestyle{yaenvpage} |
| 1656 |
\begin{textblock}{100}(\yaenvrethskip,\yaenvretvskip) |
| 1657 |
\parskip=0pt\parindent=0pt% |
| 1658 |
\yaenvretaddr% |
| 1659 |
\end{textblock} |
| 1660 |
\begin{textblock}{100}(\yaenvtohskip,\yaenvtovskip) |
| 1661 |
\parskip=0pt\parindent=0pt% |
| 1662 |
\yaenvtoaddr% |
| 1663 |
\end{textblock} |
| 1664 |
}% |
| 1665 |
\def\yabusiness{% |
| 1666 |
\global\yaenvrethskip=2 |
| 1667 |
\global\yaenvretvskip=1 |
| 1668 |
\global\yaenvtohskip=42 |
| 1669 |
\global\yaenvtovskip=18 |
| 1670 |
\yaenvelope{9.5in}{4.125in}% |
| 1671 |
}% |
| 1672 |
\def\yananoxenvelope{% |
| 1673 |
\global\yaenvrethskip=2 |
| 1674 |
\global\yaenvretvskip=1 |
| 1675 |
\global\yaenvtohskip=42 |
| 1676 |
\global\yaenvtovskip=18 |
| 1677 |
\yaenvelope{9.5in}{4.125in}% |
| 1678 |
}% |
| 1679 |
\def\yadlenvelope{% |
| 1680 |
\global\yaenvrethskip=2 |
| 1681 |
\global\yaenvretvskip=1 |
| 1682 |
\global\yaenvtohskip=36 |
| 1683 |
\global\yaenvtovskip=18 |
| 1684 |
\yaenvelope{8.66in}{4.33in}% |
| 1685 |
}% |
| 1686 |
\def\yacvienvelope{% |
| 1687 |
\global\yaenvrethskip=2 |
| 1688 |
\global\yaenvretvskip=1 |
| 1689 |
\global\yaenvtohskip=26 |
| 1690 |
\global\yaenvtovskip=20 |
| 1691 |
\yaenvelope{6.4in}{4.5in}% |
| 1692 |
}% |
| 1693 |
\def\yacvicvenvelope{% |
| 1694 |
\global\yaenvrethskip=2 |
| 1695 |
\global\yaenvretvskip=1 |
| 1696 |
\global\yaenvtohskip=42 |
| 1697 |
\global\yaenvtovskip=18 |
| 1698 |
\yaenvelope{9in}{4.5in}% |
| 1699 |
}% |
| 1700 |
\def\yacvenvelope{% |
| 1701 |
\global\yaenvrethskip=2 |
| 1702 |
\global\yaenvretvskip=1 |
| 1703 |
\global\yaenvtohskip=38 |
| 1704 |
\global\yaenvtovskip=28 |
| 1705 |
\yaenvelope{9in}{6.4in}% |
| 1706 |
}% |
| 1707 |
\def\yacivenvelope{% |
| 1708 |
\global\yaenvrethskip=3 |
| 1709 |
\global\yaenvretvskip=3 |
| 1710 |
\global\yaenvtohskip=60 |
| 1711 |
\global\yaenvtovskip=42 |
| 1712 |
\yaenvelope{12.8in}{9.0in}% |
| 1713 |
}% |
| 1714 |
\def\yaciiienvelope{% |
| 1715 |
\global\yaenvrethskip=3 |
| 1716 |
\global\yaenvretvskip=3 |
| 1717 |
\global\yaenvtohskip=84 |
| 1718 |
\global\yaenvtovskip=60 |
| 1719 |
\yaenvelope{18in}{12.8in}% |
| 1720 |
}% |
| 1721 |
\def\yanaaiienvelope{% |
| 1722 |
\global\yaenvrethskip=2 |
| 1723 |
\global\yaenvretvskip=1 |
| 1724 |
\global\yaenvtohskip=22 |
| 1725 |
\global\yaenvtovskip=20 |
| 1726 |
\yaenvelope{5.75in}{4.375in}% |
| 1727 |
}% |
| 1728 |
\def\yanaavienvelope{% |
| 1729 |
\global\yaenvrethskip=2 |
| 1730 |
\global\yaenvretvskip=1 |
| 1731 |
\global\yaenvtohskip=26 |
| 1732 |
\global\yaenvtovskip=22 |
| 1733 |
\yaenvelope{6.5in}{4.75in}% |
| 1734 |
}% |
| 1735 |
\def\yanaaviienvelope{% |
| 1736 |
\global\yaenvrethskip=2 |
| 1737 |
\global\yaenvretvskip=1 |
| 1738 |
\global\yaenvtohskip=30 |
| 1739 |
\global\yaenvtovskip=24 |
| 1740 |
\yaenvelope{7.25in}{5.25in}% |
| 1741 |
}% |
| 1742 |
\def\yanaaviiienvelope{% |
| 1743 |
\global\yaenvrethskip=2 |
| 1744 |
\global\yaenvretvskip=1 |
| 1745 |
\global\yaenvtohskip=34 |
| 1746 |
\global\yaenvtovskip=24 |
| 1747 |
\yaenvelope{8.125in}{5.5in}% |
| 1748 |
}% |
| 1749 |
\def\yanaaixenvelope{% |
| 1750 |
\global\yaenvrethskip=2 |
| 1751 |
\global\yaenvretvskip=1 |
| 1752 |
\global\yaenvtohskip=38 |
| 1753 |
\global\yaenvtovskip=28 |
| 1754 |
\yaenvelope{8.75in}{5.75in}% |
| 1755 |
}% |
| 1756 |
\def\yanaaxenvelope{% |
| 1757 |
\global\yaenvrethskip=2 |
| 1758 |
\global\yaenvretvskip=1 |
| 1759 |
\global\yaenvtohskip=42 |
| 1760 |
\global\yaenvtovskip=28 |
| 1761 |
\yaenvelope{9.5in}{6.00in}% |
| 1762 |
}% |
| 1763 |
\def\yananovienvelope{% |
| 1764 |
\global\yaenvrethskip=2 |
| 1765 |
\global\yaenvretvskip=1 |
| 1766 |
\global\yaenvtohskip=26 |
| 1767 |
\global\yaenvtovskip=14 |
| 1768 |
\yaenvelope{6.5in}{3.625in}% |
| 1769 |
}% |
| 1770 |
\def\yananoviienvelope{% |
| 1771 |
\global\yaenvrethskip=2 |
| 1772 |
\global\yaenvretvskip=1 |
| 1773 |
\global\yaenvtohskip=32 |
| 1774 |
\global\yaenvtovskip=16 |
| 1775 |
\yaenvelope{7.5in}{3.875in}% |
| 1776 |
}% |
| 1777 |
\def\yananoixenvelope{% |
| 1778 |
\global\yaenvrethskip=2 |
| 1779 |
\global\yaenvretvskip=1 |
| 1780 |
\global\yaenvtohskip=36 |
| 1781 |
\global\yaenvtovskip=16 |
| 1782 |
\yaenvelope{8.875in}{3.875in}% |
| 1783 |
}% |
| 1784 |
\def\yananoxienvelope{% |
| 1785 |
\global\yaenvrethskip=2 |
| 1786 |
\global\yaenvretvskip=1 |
| 1787 |
\global\yaenvtohskip=48 |
| 1788 |
\global\yaenvtovskip=20 |
| 1789 |
\yaenvelope{10.375in}{4.5in}% |
| 1790 |
}% |
| 1791 |
\def\yananoxiienvelope{% |
| 1792 |
\global\yaenvrethskip=2 |
| 1793 |
\global\yaenvretvskip=1 |
| 1794 |
\global\yaenvtohskip=48 |
| 1795 |
\global\yaenvtovskip=22 |
| 1796 |
\yaenvelope{11in}{4.75in}% |
| 1797 |
}% |
| 1798 |
\def\yananoxivenvelope{% |
| 1799 |
\global\yaenvrethskip=2 |
| 1800 |
\global\yaenvretvskip=1 |
| 1801 |
\global\yaenvtohskip=52 |
| 1802 |
\global\yaenvtovskip=22 |
| 1803 |
\yaenvelope{11.5in}{5in}% |
| 1804 |
}% |
| 1805 |
% \end{macrocode} |
| 1806 |
% |
| 1807 |
% Lastly, we write the label code. This code allows us to |
| 1808 |
% print arbitrary pages of labels. |
| 1809 |
% |
| 1810 |
% First, we must define a little macro to allow nested |
| 1811 |
% loops. This is taken wholesale from the accepted |
| 1812 |
% StackExchange answer to question 58049, written by David |
| 1813 |
% Carlisle. As is usual with David Carlisle's code, it's |
| 1814 |
% remarkable in its simplicity and elegance. |
| 1815 |
% \begin{macrocode} |
| 1816 |
\def\nloop#1{% |
| 1817 |
\def\nl@@p##1##2\repeat#1{% |
| 1818 |
\def##1{##2\relax\expandafter##1\fi}% |
| 1819 |
##1\let##1\relax}% |
| 1820 |
\expandafter\nl@@p\csname nl@@p-\string#1\endcsname |
| 1821 |
}% |
| 1822 |
% \end{macrocode} |
| 1823 |
% Now we can actually define the label code. First we need |
| 1824 |
% some lengths and counts. |
| 1825 |
% \begin{macrocode} |
| 1826 |
\newdimen\ya@labwidth |
| 1827 |
\newdimen\ya@labheight |
| 1828 |
\newdimen\ya@tempboxh\newdimen\ya@tempboxv |
| 1829 |
\newcount\ya@loopi |
| 1830 |
\newcount\ya@loopj |
| 1831 |
\newcount\ya@numacross |
| 1832 |
\newcount\ya@numdown |
| 1833 |
\newdimen\yalabelmarg\yalabelmarg=0.1in |
| 1834 |
% \end{macrocode} |
| 1835 |
% Now comes the main macro, |\yalabelsheet|, which takes |
| 1836 |
% eight arguments: the width and height of the page itself, |
| 1837 |
% the width and height of each label, the vertical and |
| 1838 |
% horizontal distance between each label, how many labels |
| 1839 |
% are across the width of the page, and how many labels are |
| 1840 |
% down the height of the page. |
| 1841 |
% |
| 1842 |
% This is a bit convoluted due to length limitations in |
| 1843 |
% |textpos|; so we have to define the lengths as half their |
| 1844 |
% real value, then multiply them again by 2 later on. |
| 1845 |
% \begin{macrocode} |
| 1846 |
\def\yalabeltext{} |
| 1847 |
\newdimen\yalableftmarg\yalableftmarg=0pt |
| 1848 |
\newdimen\yalabrightmarg\yalabrightmarg=0pt |
| 1849 |
\newdimen\yalabtopmarg\yalabtopmarg=0pt |
| 1850 |
\newdimen\yalabbotmarg\yalabbotmarg=0pt |
| 1851 |
\def\yalabelsheet#1#2#3#4#5#6#7#8{% |
| 1852 |
\clearpage% |
| 1853 |
\eject\pdfpagewidth=#1 \pdfpageheight=#2% |
| 1854 |
\ifdim\yalableftmarg=0pt \yalableftmarg=#5\fi |
| 1855 |
\ifdim\yalabrightmarg=0pt \yalabrightmarg=#5\fi |
| 1856 |
\ifdim\yalabtopmarg=0pt \yalabtopmarg=#6\fi |
| 1857 |
\ifdim\yalabbotmarg=0pt \yalabbotmarg=#6\fi |
| 1858 |
\newgeometry{left=\the\yalableftmarg,right=\the\yalabrightmarg, |
| 1859 |
top=\the\yalabtopmarg,bottom=\the\yalabbotmarg} |
| 1860 |
\thispagestyle{empty} |
| 1861 |
\ya@numacross=#7 \ya@numdown=#8 |
| 1862 |
\ya@labwidth=#3 \ya@labheight=#4 |
| 1863 |
\ya@tempboxh=#3 \ya@tempboxv=#4 |
| 1864 |
\advance\ya@labwidth by#5 |
| 1865 |
\advance\ya@labheight by#6 |
| 1866 |
\divide\ya@labwidth by2% |
| 1867 |
\divide\ya@labheight by2% |
| 1868 |
\newcount\ya@acthfact\newcount\ya@actvfact |
| 1869 |
\setlength{\TPHorizModule}{\the\ya@labwidth}% |
| 1870 |
\setlength{\TPVertModule}{\the\ya@labheight}% |
| 1871 |
\ya@loopi=0 \ya@loopj=0 |
| 1872 |
\nloop1\ifnum\ya@loopi<\ya@numdown |
| 1873 |
\ya@actvfact=\ya@loopi\multiply\ya@actvfact by2 |
| 1874 |
\ya@loopj=0 |
| 1875 |
\nloop2\ifnum\ya@loopj<\ya@numacross |
| 1876 |
\ya@acthfact=\ya@loopj\multiply\ya@acthfact by2 |
| 1877 |
\begin{textblock}{100}(\ya@acthfact,\ya@actvfact) |
| 1878 |
\hbox to#3{% |
| 1879 |
\hskip\yalabelmarg% |
| 1880 |
\vbox to#4{% |
| 1881 |
\parskip=0pt\parindent=0pt% |
| 1882 |
\vfil% |
| 1883 |
\yalabeltext% |
| 1884 |
\vfil% |
| 1885 |
}% |
| 1886 |
}% |
| 1887 |
\end{textblock} |
| 1888 |
\advance\ya@loopj by1% |
| 1889 |
\repeat2 |
| 1890 |
\advance\ya@loopi by1% |
| 1891 |
\repeat1 |
| 1892 |
}% |
| 1893 |
% \end{macrocode} |
| 1894 |
% Now we define a macro allowing text to be placed in an |
| 1895 |
% arbitrary label. Three arguments: the text to be placed; |
| 1896 |
% the numbers of columns across; and the number of rows |
| 1897 |
% down. |
| 1898 |
% \begin{macrocode} |
| 1899 |
\def\yaplacelabel#1#2#3{% |
| 1900 |
\newcount\ya@numacrossii\ya@numacrossii=#2 |
| 1901 |
\newcount\ya@numdownii\ya@numdownii=#3 |
| 1902 |
\multiply\ya@numacrossii by2% |
| 1903 |
\multiply\ya@numdownii by2% |
| 1904 |
\begin{textblock}{100}(\ya@numacrossii,\ya@numdownii) |
| 1905 |
\hbox to\ya@tempboxh{% |
| 1906 |
\hskip\yalabelmarg% |
| 1907 |
\vbox to\ya@tempboxv{% |
| 1908 |
\parskip=0pt\parindent=0pt% |
| 1909 |
\vfil% |
| 1910 |
#1% |
| 1911 |
\vfil% |
| 1912 |
}% |
| 1913 |
}% |
| 1914 |
\end{textblock} |
| 1915 |
}% |
| 1916 |
% \end{macrocode} |
| 1917 |
% Define a couple of preset options for certain sheets of |
| 1918 |
% labels; namely, for the two types of sheets that I |
| 1919 |
% happened to have near me at the time of writing this |
| 1920 |
% class. (Also the only ones I've ever really used.) |
| 1921 |
% Individual ones are prefixed with |\avery| and then the |
| 1922 |
% number put afterwards; you call these by issuing |
| 1923 |
% |\yaavery| with the single argument of the serial number |
| 1924 |
% of the label sheet you want. |
| 1925 |
% \begin{macrocode} |
| 1926 |
\expandafter\def\csname avery8663\endcsname{% |
| 1927 |
\yalabtopmarg=0.5in |
| 1928 |
\yalabbotmarg=0.5in |
| 1929 |
\yalableftmarg=0.15625in |
| 1930 |
\yalabrightmarg=0.15625in |
| 1931 |
\yalabelsheet{8.5in}{11in}{4in}{1.95in}{0.15625in}{0in}{2}{5}% |
| 1932 |
}% |
| 1933 |
\expandafter\def\csname avery8660\endcsname{% |
| 1934 |
\yalabtopmarg=0.5in |
| 1935 |
\yalabbotmarg=0.5in |
| 1936 |
\yalableftmarg=0.1875in |
| 1937 |
\yalabrightmarg=0.1875in |
| 1938 |
\yalabelsheet{8.5in}{11in}{2.625in}{25mm}{0.125in}{0in}{3}{10}% |
| 1939 |
}% |
| 1940 |
\def\yaavery#1{% |
| 1941 |
\csname avery#1\endcsname% |
| 1942 |
}% |
| 1943 |
% \end{macrocode} |
| 1944 |
% Finally, we put in some code to run at the |
| 1945 |
% |\begin{document}| command, just to get the ball rolling. |
| 1946 |
% \begin{macrocode} |
| 1947 |
\AtBeginDocument{% |
| 1948 |
\pagestyle{yaotherpage}% |
| 1949 |
\thispagestyle{yafirstpage}% |
| 1950 |
\ifnum\ya@lettertype=0 |
| 1951 |
\yaletterblock |
| 1952 |
\fi\ifnum\ya@lettertype=1 |
| 1953 |
\yalettermodblock |
| 1954 |
\fi\ifnum\ya@lettertype=2 |
| 1955 |
\yaletternormal |
| 1956 |
\fi |
| 1957 |
} |
| 1958 |
% \end{macrocode} |
| 1959 |
% |
| 1960 |
% Happy \TeX{}ing! |
| 1961 |
% |
| 1962 |
% \PrintIndex |