From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/yaletter/CHANGES | 10 + macros/latex/contrib/yaletter/README | 31 + macros/latex/contrib/yaletter/lppl.txt | 416 ++++++ macros/latex/contrib/yaletter/yaletter.dtx | 1962 ++++++++++++++++++++++++++++ macros/latex/contrib/yaletter/yaletter.ins | 65 + macros/latex/contrib/yaletter/yaletter.pdf | Bin 0 -> 552053 bytes 6 files changed, 2484 insertions(+) create mode 100644 macros/latex/contrib/yaletter/CHANGES create mode 100644 macros/latex/contrib/yaletter/README create mode 100644 macros/latex/contrib/yaletter/lppl.txt create mode 100644 macros/latex/contrib/yaletter/yaletter.dtx create mode 100644 macros/latex/contrib/yaletter/yaletter.ins create mode 100644 macros/latex/contrib/yaletter/yaletter.pdf (limited to 'macros/latex/contrib/yaletter') diff --git a/macros/latex/contrib/yaletter/CHANGES b/macros/latex/contrib/yaletter/CHANGES new file mode 100644 index 0000000000..3c59b938d0 --- /dev/null +++ b/macros/latex/contrib/yaletter/CHANGES @@ -0,0 +1,10 @@ +v1.1: 1 January 1201 (1 January 2017): There was an error +in setting defaults that meant that paper size had to be set +explicitly. Now it's set to the default installation paper +size, and must be explicitly changed. Also, the default +bottom margin was changed to a full inch, to leave room for +the footer. Finally, added the "signatureword" option to +the documentation. + +v1.0: 23 December 1200 (27 December 2016): Initial +release. diff --git a/macros/latex/contrib/yaletter/README b/macros/latex/contrib/yaletter/README new file mode 100644 index 0000000000..460b8b5d6e --- /dev/null +++ b/macros/latex/contrib/yaletter/README @@ -0,0 +1,31 @@ ++AMDG + +This document is copyright 2016 by Donald P. Goodman, and is +released publicly under the LaTeX Project Public License. The +distribution and modification of this work is constrained by the +conditions of that license. See + http://www.latex-project.org/lppl.txt +for the text of the license. This document is released +under version 1.3 of that license, and this work may be distributed +or modified under the terms of that license or, at your option, any +later version. + +This work has the LPPL maintenance status 'maintained'. + +The Current Maintainer of this work is Donald P. Goodman +(dgoodmaniii@gmail.com). + +This work consists of the files yaletter.ins and +yaletter.dtx, along with derived files yaletter.cls and +yaletter.pdf. + +The yaletter class provides extremely configurable macros +for typesetting letters in any conceivable style. It +provides facilities for maintaining easily-accessible +databases of letterheads and addresses for repeat use. It +further provides easy macros for envelopes and for label +sheets. Finally, it provides some nice defaults for a few +of the more common styles and sizes. + +This class should run properly on any reasonably up-to-date +and operational LaTeX system. diff --git a/macros/latex/contrib/yaletter/lppl.txt b/macros/latex/contrib/yaletter/lppl.txt new file mode 100644 index 0000000000..2244313901 --- /dev/null +++ b/macros/latex/contrib/yaletter/lppl.txt @@ -0,0 +1,416 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2005 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % http://www.latex-project.org/lppl.txt + % and version 1.3 or later is part of all distributions of LaTeX + % version 2005/12/01 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. + diff --git a/macros/latex/contrib/yaletter/yaletter.dtx b/macros/latex/contrib/yaletter/yaletter.dtx new file mode 100644 index 0000000000..0357364972 --- /dev/null +++ b/macros/latex/contrib/yaletter/yaletter.dtx @@ -0,0 +1,1962 @@ +% \iffalse +% +AMDG This document was begun on 6 December 1200, the +% feast of St. Nicholas, and it is humbly dedicated to him +% and to the Immaculate Heart of Mary for her prayers, and +% to the Sacred Heart of Jesus for His mercy. +% +% This document is copyright 2016 by Donald P. Goodman, and is +% released publicly under the LaTeX Project Public License. The +% distribution and modification of this work is constrained by the +% conditions of that license. See +% http://www.latex-project.org/lppl.txt +% for the text of the license. This document is released +% under version 1.3 of that license, and this work may be distributed +% or modified under the terms of that license or, at your option, any +% later version. +% +% This work has the LPPL maintenance status 'maintained'. +% +% The Current Maintainer of this work is Donald P. Goodman +% (dgoodmaniii@gmail.com). +% +% This work consists of yaletter.dtx, yaletter.ins, and +% derived files yaletter.cls and yaletter.pdf. +% \fi + +% \iffalse +%\NeedsTeXFormat{LaTeX2e}[1996/06/01] +%\ProvidesClass{yaletter}[2017/01/01 v1.1 Yet Another Letter Class] +%<*driver> +\documentclass[12pt]{ltxdoc} + +\usepackage{doc} +\usepackage{longtable} +\usepackage{array} +\usepackage{lettrine} + \setcounter{DefaultLines}{3} + \setlength{\DefaultFindent}{2pt} + \renewcommand{\LettrineFontHook}{\color{red}} +\usepackage{url} +\usepackage{booktabs} +\usepackage{spverbatim} +\usepackage{graphicx} +\usepackage[]{xellipsis} +\usepackage{listings} + \lstset{% + name=macrocode, + language=[LaTeX]TeX, + basicstyle=\ttfamily\small, + columns=, + }% +\usepackage[paperheight=11in,paperwidth=8.5in,top=1in,bottom=1in, + right=0.25in,left=1.75in]{geometry} +\usepackage[T1]{fontenc} +\usepackage[typeone]{dozenal} +\usepackage{lmodern} +\usepackage{url} +\usepackage[colorlinks]{hyperref} +\usepackage{makeidx} +\EnableCrossrefs +\PageIndex +\CodelineNumbered +\RecordChanges +\makeindex +\makeatletter +\def\index@prologue{\section*{Index}\markboth{Index}{Index}} +\makeatother +\DoNotIndex{\?,\{,\},\|,\DeclareFontFamily,\DeclareFontShape, + \DeclareMathAccent,\DeclareMathAlphabet,\DeclareMathDelimiter, + \DeclareMathSymbol,\DeclareMathVersion,\DeclareSymbolFont,\def, + \drmsym,\encodingdefault,\familydefault,\fontencoding,\fontfamily, + \fontseries,\fontshape,\hfil,\hbox,\mathalpha,\mathclose, + \mathopen,\mathord,\mathversion,\mp,\nabla,\nbshortroman, + \RedefineMRmdclxvij,\relax,\renewcomand,\RequirePackage, + \selectfont,\SetMathAlphabet,\SetSymbolFont,\drmsymbolredef, + \nodefaultfalse,\nodefaultmathfalse,\nodefaultmathtrue,\nodefaulttrue, + \nodefaulttextfalse,\nodefaulttexttrue,\noindent,\numexpr, + \acute,\addtolength\advance,\backslash,\baselineskip, + \char,\counterA,\counterB,\DeclareOption,\ProcessOptions, + \drmmathlets,\symbolsonlytrue,\if,\else,\fi,\ifnum,\fi,\ifdim,\fi, + \symbolsonlyfalse,\fontsize,\newif,\newcount, + \loop,\iter,\let,\renewcommand,\setbox,\setlength,\the,\vss, + \vskip,\vbox, \newlength, \newcount,\r@@t,\z@,\DeclareMathRadical, + \DeclareRobustCommand,\bBigg@,\@ifnextchar,\@sqrt,\@makefnmark, + \@thefnmark,\catcode,\active,\Q,\csname,\endcsname,\define@key, + \string,\@afterheading,\@afterindentfalse,\AtBeginDocument, + \begin,\divide,\eject,\end,\everypar,\expandafter,\fancyfoot, + \fancyhead,\fancyhf,\fancypagestyle,\global,\geometry, + \hskip,\input,\itshape,\label,\linewidth,\multiply, + \newcommand,\newdimen,\newgeometry,\nl@@p,\nloop,\normalsize, + \oddsidemargin,\pagenumbering,\pageref,\pagestyle,\paperheight, + \paperwidth,\parindent,\parskip,\pdfpageheight,\pdfpagewidth, + \thepage,\clearpage,\ ,\@setfontsize,\@viiipt,\@viipt,\@vipt, + \@vpt,\@xiipt,\@xivpt,\@xviipt,\@xxpt,\@xxvpt,\tiny,\huge, + \Huge,\LARGE,\Large,\large,\scriptsize} + +\long\def\example#1#2{% + \bigskip% + \hrule% + \hbox to\linewidth{% + \hbox to0.5\linewidth{% + \vbox to2in{\vfil#1\vfil}% + }\hbox to0.5\linewidth{% + \vbox to2in{\vfil#2\vfil}% + }% + }% + \hrule% + \bigskip% +} + +\tracingmacros=3 \begin{document} \DocInput{yaletter.dtx} +\end{document} +% \fi +% +% \title{The |yaletter| Class, v1.1} +% \author{Donald P.\ Goodman III} +% \date{\today} +% +% \maketitle +% +% \begin{abstract} +% \noindent +% The |yaletter| (``Yet Another Letter'') class produces +% letters in a variety of preset, but also any arbitrary, +% formats; handles multiple addresses and letterheads, +% including a ``database'' of each; produces envelopes of +% any size; and produces labels of any size (e.g., label +% sheets). +% \end{abstract} +% +% \section{Introduction} +% +% While it may seem archaic in our days of email and other +% electronic communication, sometimes it remains necessary +% to send a simple letter; and sometimes, even electronic +% messages require a nicely-formatted letter with real +% letterhead. Yet despite the presence of multiple +% high-quality letter-writing projects, \LaTeX\ seems +% curiously faulty in this regard. An American letter is a +% very direct thing formatted in a very specific and +% well-defined way, yet despite many attempts I've been +% unable to persuade \LaTeX\ to produce properly spaced and +% styled American-style letters. It's often a minor +% problem---a rule that I can't get rid of, or excessive +% spacing---but it's a problem that simply ruins the +% appearance of the letter in my judgement. +% +% So here's the |yaletter| class, or the ``yet another'' +% letter class. There are plenty of letter classes, of +% course, but I still think this one fills a gap that just +% wasn't filled before. +% +% This document is typeset in accordance with the \LaTeX\ +% \textsc{docstrip} utility, which allows the extraction of +% code and documentation from the same source documentation. +% +% The numbering in this document is in \emph{dozenal}; that +% is, numbering goes 1, 2, 3, 4, 5, 6, 7, 8, 9, \x, \e, 10, +% 11\ldots\ It uses the |dozenal| \LaTeX\ package to make +% this happen. For more information, visit +% \url{http://www.dozenal.org}. +% +% The package \emph{does not} work with anything but +% |pdftex|; it uses a few |pdftex| primitives internally. I +% didn't think it was worth the effort to make it generic. +% +% \section{Letter Commands} +% \label{sect:actletcomm} +% +% To begin with, we need to be able to specify actual letter +% commands; that is, commands which create the date, the +% inside address, the salutation, the farewell, the +% signature, and the enclosure line. Some of these may be +% absent in a particular letter, but a letter document class +% must account for all of them. +% +% These commands will all be defined if you begin your +% document with the following: +% +% \begin{quote} +% |\documentclass{yaletter}| +% \end{quote} +% +% Once you do this, you've got |yaletter| to work with. +% +% |yaletter| does depend on |textpos| (for envelopes and +% labels) and |xkeyval| (for the arguments to +% |\yaoptions|), as well as on |geometry| and |fancyhdr| +% (for the purposes one would expect). If these are not +% installed, go ahead and install them; otherwise |yaletter| +% can't do its work. +% +% \subsection{Parts of a Letter} +% \label{sub:partsletter} +% +% It is important to understand the parts of a normal +% business letter if you are going to use the |yaletter| +% class, so let's go over those very briefly first. +% +% \begin{figure}[htb] +% \centering +% \includegraphics[scale=0.5]{parts_letter_diagram.png} +% \caption{Parts of a Basic American Letter, Labelled} +% \label{fig:parts} +% \end{figure} +% +% Figure \ref{fig:parts} should be pretty self-explanatory, +% so we won't spend time talking about it. These are the +% parts of a letter that we'll be discussing, though, and +% this is (mostly) the default appearance of an opening page +% in |yaletter| (\textit{mutatis mutandis}, of course; e.g., +% you'll almost certainly have a different letterhead). +% +% \subsection{Date Commands} +% \label{sub:dates} +% +% \DescribeMacro{\yadate}|\yadate| takes a single argument, +% which is the date that you want to be printed. It is +% indented from the left margin by the length +% \DescribeMacro{\yahdateskip}|\yahdateskip|, which can be +% set in either the plain-\TeX\ length-setting way (e.g., +% |\yahdateskip=3in|) or the \LaTeX\ way (e.g., +% |\setlength{\yahdateskip}{3in}|). +% +% The space above and below dates are set by |\ya@predate| +% and |\ya@postdate|, but as the |@| in the names suggest, +% these really shouldn't be set in the document itself. +% These should be consistent across all letters of a given +% type, so preferably they should be set in the |\yaoptions| +% command, as explained in Section \ref{sect:pageopts}. +% +% You can style your date arbitrarily by putting your style +% commands into the macro +% \DescribeMacro{\yadatestyle}|\yadatestyle|. +% |\yadatestyle| is expanded right before the date itself. +% Remember that you need to use font-changing commands, not +% environments, for this; e.g., use |\itshape|, not +% |\textit|. +% +% \subsection{Inside Adress} +% \label{sub:insideaddr} +% +% The ``inside address'' is the address of the addressee; it +% is so called because it appears inside the letter, as +% opposed to on the envelope, where it also appears. The +% macro \DescribeMacro{\yainsideaddr}|\yainsideaddr| takes a +% single argument, which is the inside address you want to +% be typeset. +% +% The argument of |\yainsideaddr| will be typeset +% left-justified in a box which will be indented by the +% value of +% \DescribeMacro{\yahinsideaddrskip}|\yahinsideaddrskip|. +% Like |\yahdateskip|, this can be adjusted in either plain +% \TeX\ or \LaTeX\ fashion. +% +% You can insert style commands for your inside address +% using the +% \DescribeMacro{\yainsideaddrstyle}|\yainsideaddrstyle| +% macro, which takes one argument, which is the style +% commands you desire. This is subject to the same +% restrictions as |\yadatestyle|. +% +% The space above and below the inside address is governed +% by |\ya@preinsideaddr| and |\ya@postinsideaddr|; however, +% as the |@| indicates, these should not be adjusted +% internally. Rather, they should be set using the +% |\yaoptions| command discussed in Section \ref{sect:pageopts}. +% +% A typical inside address would probably look something +% like this: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\yainsideaddr{Great Company Name \\ 1234 Otherplace Road \\ + Somewhere, OK 00000} +\end{lstlisting} +% \iffalse +% +% \fi +% +% It's also possible (and often easier) to use addresses +% defined by the |\defineaddress| command, as explained in +% Section \ref{sect:addresses}. +% +% \subsection{Salutation} +% \label{sub:salutation} +% +% The salutation, typically just ``Dear So-and-so,'' is +% produced by the command +% \DescribeMacro{\yasalutation}|\yasalutation|. This also +% takes a single argument, the name which you'd like to +% salute. E.g., running |\yasalutation{Mr.~Anderson}| will +% produce the string, ``Dear Mr.\ Anderson:'' (by default). +% +% It doesn't have to use the word ``Dear,'' or to use a +% colon after the name. The word used in the salutation is +% inserted by the macro |\ya@saluword|, and the punctuation +% by |\ya@salupunct|. The spaces above and below the +% salutation are produced by |\ya@presalutation| and +% |\ya@postsalutation|. All of these, as the |@| sign +% indicates, should not be set in the body of the document; +% rather, they should be set using the |\yaoptions| command +% discussed in Section \ref{sect:pageopts}. +% +% The salutation will be indented from the left by the +% distance |\yahsalutationskip|, which can be set in either +% the plain \TeX\ or \LaTeX\ ways. +% +% The styling of the salutation is governed by +% \DescribeMacro{\yasalutationstyle}|\yasalutationstyle|, +% which is subject to the same limitations as the other +% style commands. +% +% \subsection{Farewell, Signature, and Enclosure} +% \label{sub:faresigs} +% +% We treat these three together, since they always go +% together. Insert the farewell with +% \DescribeMacro{\yafarewell}|\yafarewell|, which is +% indented from the left margin by the value of +% \DescribeMacro{\yahfarewellskip}|\yahfarewellskip|. The +% spacing above and below the farewell are governed by +% |\ya@prefarewell| and |\ya@postfarewell|, but these should +% be set using the |\yaoptions| command discussed in Section +% \ref{sect:pageopts}. +% +% By default, this produces the string ``Sincerely,'' but it +% need not use that word or that punctuation. +% |\ya@farewellword| and |\ya@farewellpunct| set each of +% these; however, these should also +% be set using the |\yaoptions| command discussed in Section +% \ref{sect:pageopts}. +% +% The farewell can be styled with +% \DescribeMacro{\yafarewellstyle}|\yafarewellstyle|, which +% is subject to the same restrictions as the similar +% commands for other parts of the letter. +% +% The signature is given by +% \DescribeMacro{\yasignature}|\yasignature|, which produces +% the value of the macro |\ya@signatureword|, typically set +% in the |\yaoptions| command discussed in Section +% \ref{sect:pageopts}. Similarly, the space above and below +% the signature is governed by |\ya@presignature| and +% |\ya@postsignature|. The signature is indented by the +% value of +% \DescribeMacro{\yahsignatureskip}|\yahsignatureskip|, +% which can be set in the usual ways. It is styled by +% \DescribeMacro{\yasignaturestyle}|\yasignaturestyle|, +% subject to the usual restrictions. +% +% The enclosure is included by issuing +% \DescribeMacro{\yaenclosure}|\yaenclosure|. This produces +% the value of |\ya@enclosureword|, indented by the value of +% \DescribeMacro{\yahenclosureskip}|\yahenclosureskip|, +% styled according to the value of +% \DescribeMacro{\yaenclosurestyle}|\yaenclosurestyle|. The +% space above and below it is governed by |\ya@preenclosure| +% and |\ya@postenclosure|. As usual, commands containing +% |@| should be changed using the |\yaoptions| command +% discussed in Section \ref{sect:pageopts}. +% +% \section{Letter Options} +% \label{sect:pageopts} +% +% Letters simply don't follow the same rules as other typset +% documents. I've never seen a letter, for example, that +% had two-sided formatting. (Except, of course, for +% so-called ``open letters,'' but these are really just +% articles or books addressed at a particular person, so +% they're not really our use case here.) Margins are +% typically much smaller than in other typeset works, +% leading to a much larger typeblock. Headers and footers +% typically \emph{do} contain rules (lines), often with not +% only the current page number but also the total number of +% pages (e.g., ``Page 2 of 4''). +% +% So |yaletter| has the command +% \DescribeMacro{\yaoptions}|\yaoptions|, which gives the +% user the ability to set a variety of different dimensions +% within the letter. It includes |fancyhdr| by itself, +% since the standard \LaTeX\ header styles simply don't +% address the needs of letter-writing. And |\yaoptions| +% allows one to set many of the dimensions that |fancyhdr| +% requires, so that we can keep these things as far as +% possible in just one place. +% +% |\yaoptions| takes a single argument, which is a list of +% key-value assignments. In the table below, you'll +% find a table showing the |\yaoptions| keys, along with +% their default values and a brief description of what +% they're for. +% +% By ``key-value'' options, I mean that they are assigned by +% the means of the phrase \emph{key = value}. For example, +% for a default |yaletter| on half-letter paper, do the +% following: +% +% \begin{quote} +% |\yaoptions{pageheight=8in,pagewidth=5.5in}| +% \end{quote} +% +% All the options here can be set in the same way. +% +% You \emph{can} have multiple |\yaoptions| commands; +% options specified in later ones will override any +% conflicting options in earlier ones. Therefore, you can +% have options set in a file which you include, then +% override some of them after inputting that file to reset +% some of them. +% +% \begin{center} +% \begin{longtable}{llp{0.5\textwidth}} +% \toprule +% Option & Default & Description \\ +% \midrule +% |pageheight| & 11in & The height of the paper \\ +% |pagewidth| & 8.5in & The width of the paper \\ +% |lftmarg| & 0.5in & The left margin of the letter \\ +% |rgtmarg| & 0.5in & The right margin of the letter \\ +% |topmarg| & 0.5in & The top margin of the letter \\ +% |botmarg| & 1.0in & The bottom margin of the letter \\ +% |footskip| & 24pt & The distance bettween the bottom of +% the typeblock and the bottom of the footer \\ +% |headsep| & 12pt& The distance between the bottom of the +% header and the top of the typeblock \\ +% |headheight| & 12pt & The height of the header line \\ +% |headwidth| & |\textwidth| & The width of the header and footer +% lines \\ +% |headrulewidth| & 0.4pt & The thickness of the line underneath +% the header \\ +% |footrulewidth| & 0.4pt & The thickness of the line above +% the footer \\ +% |predate| & 24pt & The space between the letterhead (if +% any) and the date \\ +% |postdate| & 12pt & The space after the date \\ +% |datehskip| & 0pt & The horizontal space prior to the date \\ +% |preinsideaddr| & 12pt & The space inserted before the +% inside address \\ +% |postinsideaddr| & 0pt & The space inserted after the +% inside address \\ +% |insideaddrhskip| & 0pt & The horizontal space inserted +% prior to the inside address \\ +% |presalutation| & 0pt & The space inserted before the +% salutation \\ +% |postsalutation| & 0pt & The space inserted after the +% salutation \\ +% |saluword| & Dear & The word used in the salutation; don't +% forgot to include a space at the end, if you change this \\ +% |salupunct| & : & The punctuation used after the salutation \\ +% |saluskip| & 0pt & The horizontal spacing prior to the +% salutation \\ +% |prefarewell| & 0pt & The space inserted before the +% farewell line (e.g., ``Sincerely,'') \\ +% |postfarewell| & 12pt & The space inserted after the +% farewell line (e.g., ``Sincerely,'') \\ +% |farewellskip| & 0pt & The horizontal space inserted prior +% to the salutation \\ +% |farewellword| & Sincerely & The word used in the farewell +% line \\ +% |farewellpunct| & , & The punctuation used after the +% farewell word \\ +% |presignature| & 12pt & The space inserted before the +% signature line \\ +% |postsignature| & 0pt & The space inserted after the +% signature line \\ +% |signatureskip| & 0pt & The horizontal space inserted +% prior to the signature \\ +% |signatureword| & Your Name Here & The content of the +% signature; typically the name of the letter writer \\ +% |preenclosure| & 0pt & The space inserted before the +% enclosure line \\ +% |postenclosure| & 0pt & The space inserted after the +% enclosure line \\ +% |enclosureskip| & 0pt & The horiziontal space inserted +% prior to the enclosure line \\ +% |enclosureword| & Enclosure & The word inserted when there +% are enclosures \\ +% |parskip| & 12pt & The space between paragraphs \\ +% |parindent| & 0pt & The indentation of the first line of +% each paragraph \\ +% |datafile| & \emph{None} & The file which |yaletter| will read to +% get your letter data \\ +% \bottomrule +% \end{longtable} +% \end{center} +% +% If you put a suitable |\yaoptions| directive in your data +% file, you need only tell |yaletter| where your data file +% is located by saying +% |\yaoptions{datafile={yourdatafile}}|, and you'll have +% consistently formatted letters. +% +% Some of these defaults may seem curiously small; remember +% that these values \emph{stack}. That is, |postdate| and +% |preinsideaddr| are \emph{both} skipped in between the +% date and the inside address. If there is a parskip, that +% space will be added, too. So keep these things in mind +% if the spacing seems larger than you expected. The +% default settings are suitable for a block-formatted +% letter. +% +% The idea behind putting so many different settings in a +% single command is that you can easily run many different +% letters with a consistent look and feel, but by including +% that one command. However, sometimes you may need to +% change some individual parts of these; e.g., maybe you +% want the name in the signature line to change. That's +% certainly doable, as we saw in Section +% \ref{sect:actletcomm}. +% +% \section{Letterheads} +% \label{sect:letterheads} +% +% This is an important part of any letter package; you want +% to be able to use nice-looking, fancy letterhead without +% having to (a) buy paper pre-printed with it, or (b) +% hand-code or hand-copy the letterhead into each +% individual document. +% +% So |yaletter| allows you to save your letterheads in a +% data file (probably kept in your |.texlive| directory or +% some similar place). You can access those letterheads by +% name, by prefixing |\letterhead| to them. +% +% The \DescribeMacro{\defineletterhead}|\defineletterhead| +% macro takes two arguments: the first is the name of the +% letterhead, the second is the letterhead code itself. +% That code can be of arbitrary complexity (though it's +% probably best to enclose it all in a box to prevent any +% settings you use leaking out into the remainder of the +% document), but we'll use something pretty simple for our +% example here. Let's say you want the following code for +% your letterhead: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\vbox{% + \hbox to\linewidth{% + \fontsize{72pt}{72pt}\selectfont% + Your Name\hfil% + }\hbox to\linewidth{% + \vrule width\textwidth depth1.5pt% + } +} +\end{lstlisting} +% \iffalse +% +% \fi +% +% You want to call this letterhead |namehead|. You can tell +% |yaletter| that this is your letterhead and that it's +% called |namehead| by doing this: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\defineletterhead{namehead}{% + \vbox{% + \hbox to\linewidth{% + \fontsize{72pt}{72pt}\selectfont% + Your Name\hfil% + }\hbox to\linewidth{% + \vrule width\textwidth depth1.5pt% + } + } +}% +\end{lstlisting} +% \iffalse +% +% \fi +% +% You then actually use this letterhead by calling +% \DescribeMacro{\letterheadNAME}|\letterheadNAME|, +% replacing the string ``NAME'' with the name you assigned +% your letterhead earlier. In this case, by calling +% |\letterheadnamehead|. +% +% You can also use a letterhead via the +% \DescribeMacro{\yauseletterhead}|\yauseletterhead| +% command, which takes a single argument: the name assigned +% to the letterhead in the |\defineletterhead| command. So +% the letterhead we defined as |namehead| can be put into +% the letter with |\yauseletterhead{namehead}|. +% +% So |\yauseletterhead{namehead}| and |\letterheadnamehead| +% are identical in their effect. +% +% This system allows you to maintain as many letterheads as +% you want, and to easily insert them into a letter, by name, +% with the inclusion of merely a single line. +% +% Although we've not done so here, it's a good idea to keep +% your letterhead names in all-caps, or something similarly +% distinctive. +% +% \section{Letter Styles} +% \label{sect:letstyles} +% +% In American usage, there are primarily two styles of +% letter: ``block'' and ``modified block.'' Block letters +% are universally left-aligned, with a blank space between +% paragraphs and no indentation. Modified block letters are +% left-aligned, with a blank space between paragraphs and no +% indentation, but with the date, saluation, farewell, and +% signature lines indented to halfway across the page. +% +% |yaletter| adds a ``normal'' style, in which paragraphs +% are typeset as normal; that is, with no space between them +% (other than normal glue) and indentation at the beginning, +% but otherwise identical to modified block style. +% +% Block format is the default for |yaletter|, as it's the +% most common in the United States. To explicitly request +% block format, issue +% \DescribeMacro{\yaletterblock}|\yaletterblock| in your +% preamble. To get modified block format, issue +% \DescribeMacro{\yalettermodblock}|\yalettermodblock| in +% your preamble. To get normal format, issue +% \DescribeMacro{\yaletternormal}|\yaletternormal| in your +% preamble. +% +% The actual space between paragraphs is governed by the +% special length \DescribeMacro{\yaparskip}|\yaparskip|. To +% change this, use |\setlength{\yaparskip}{2em}| (or +% whatever your desired length is). This defaults to |12pt|. +% +% The actual indentation for paragraphs is governed by the +% special length \DescribeMacro{\yaparindent}|\yaparindent|. +% To change this, use |\setlength{\yaparindent}{24pt}| (or +% whatever your desired length is). This defaults to |0pt|. +% +% These parameters mean that you have complete control over +% indentation and paragraph skipping, even after specifying +% a particular format (with |\yaletterblock|, for example). +% Issuing |\yaparskip=24pt| and |\yaparindent=24pt| will +% give you the desired paragraph skip and indentation within +% the normal block format. +% +% The only trick here is to remember that, if you're using +% |\yaletternormal| and you want a non-zero |\parskip|, you +% have to set |\yaparskip| \emph{after} your +% |\begin{document}|. I'm not really sure why you'd ever +% want to do this, but you know your needs better than I do, +% so I wanted it to be an option. +% +% Further note that these are merely convenience commands; +% you can do everything these letter styles do simply by +% adjusting the parameters in |\yaoptions|. These little +% macros are merely syntactic sugar. +% +% \section{Headers and Footers} +% \label{sect:headfoot} +% +% It makes sense for letters to have very distinctive +% headers and footers, especially since there is usually no +% indentation beginning paragraphs. Since paragraph breaks +% are marked only by spacing, when such a break falls at the +% end of a page, it may be hard to tell without a clearly +% marked footer. But there should not be a header on the +% first page, which has plenty of information already +% included, possibly including a letterhead, to make it very +% clear to the reader what he is looking at. +% +% So |yaletter| includes |fancyhdr|, since it will be needed +% for almost anything. It furthermore resets both +% |\headrulewidth| and |\footrulewidth| to |0.4pt|, since +% these are both very helpful guides when reading a letter's +% text. (Note that both of these can be changed, if +% desired, in |\yaoptions|.) +% +% On the first page, the page style is automatically set as +% |yafirstpage|. |yafirstpage| is defined as follows: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\fancypagestyle{yafirstpage}{% + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0.4pt} + \fancyhf{}% + \fancyfoot[C]{Page \thepage\ of \yalastpage}% +}% +\end{lstlisting} +% \iffalse +% +% \fi +% +% If you want the first page footer to be different, +% redefine |yafirstpage| with whatever parameters you would +% like. +% +% Headers on subsequent pages are defined by the page style +% |yaotherpage|: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\fancypagestyle{yaotherpage}{% + \renewcommand\headrulewidth{0.4pt} + \renewcommand\footrulewidth{0.4pt} + \fancyhf{}% + \fancyhead[L]{\yawriter\ to \yaaddressee}% + \fancyhead[R]{\yathedate}% + \fancyfoot[C]{Page \thepage\ of \yalastpage}% +}% +\end{lstlisting} +% \iffalse +% +% \fi +% +% This, too, can of course be redefined to be whatever you +% want it to be, with the usual |fancyhdr| commands. +% +% \section{Special Variables} +% \label{sect:specvar} +% +% In Section \ref{sect:headfoot}, we saw a couple of special +% variables used, which contain values like the addressee of +% the letter, the author of the letter, and so forth. We +% can use these variables in headers and footers especially, +% but they are useful in other places, as well. +% +% \DescribeMacro{\yawriter}|\yawriter| contains the author +% of the letter. It is set by using the macro +% \DescribeMacro{\yasetwriter}|\yasetwriter|, and styled +% with the contents of the macro +% \DescribeMacro{\yawriterstyle}|\yawriterstyle|. For +% example, to set the letter's writer as ``John Doe'' and +% set it in italics, run the following: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\yawriterstyle{\itshape} +\yasetwriter{John Doe} +\yawriter +\end{lstlisting} +% \iffalse +% +% \fi +% +% Similarly, there are the macros +% \DescribeMacro{\yasetaddressee}|\yasetaddressee|, +% \DescribeMacro{\yaaddresseestyle}|\yaaddresseestyle|, and +% \DescribeMacro{\yaaddressee}|\yaaddressee|. These can be +% used with the |\yawriter| commands to develop things like +% the default header, which briefly states the parties to +% the letter. +% +% There is also \DescribeMacro{\yathedate}|\yathedate|, +% which holds the date which was entered in the |\yadate| +% macro, and the \DescribeMacro{\yalastpage}|\yalastpage|, +% which holds the page number of the last page. (Note that +% this isn't necessarily the last page of your whole +% document, which might be closed by an envelope or label +% page; rather, it's the page which contains the signature.) +% +% \section{Addresses} +% \label{sect:addresses} +% +% It's likely that you have a list of addresses that you +% normally send letters to, and it doesn't make sense for +% you to have to type them every time. So |yaletter| allows +% you to define addresses, along with shorthands, in a +% database of sorts and refer to them that way, as well as +% simply entering them manually where they need to go. +% +% \DescribeMacro{\defineaddress}|\defineaddress| takes three +% arguments. The first is the name by which you want to +% refer to the address; the second is the short name, which +% will be inserted into the |\yaaddressee| or |\yawriter| +% spot; and the last is the code of the address itself. An +% example would be the following: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\defineaddress{FIRST}{Great Company}{% + Great Company Name \\ + 1234 Otherplace Road \\ + Somewhere, OK 00000% +} +\end{lstlisting} +% \iffalse +% +% \fi +% +% To actual use this address, one has a number of options. +% To use the address as the inside address, |yaletter| +% provides the \DescribeMacro{\yatoaddress}|\yatoaddress| +% macro, which takes the single argument of the name of the +% address defined by |\defineaddress|. For example: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\yainsideaddr{\yatoaddress{FIRST}} +\end{lstlisting} +% \iffalse +% +% \fi +% +% The |\yatoaddress| macro both typesets the address itself +% and resets |\yaaddressee| to the short name given in +% |\defineaddress|. +% +% |yaletter| also provides the similar commands +% \DescribeMacro{\yareturnaddress}|\yareturnaddress|, which +% both typesets the address and sets |\yawriter| to the +% short name given in the corresponding |\defineaddress|; +% and \DescribeMacro{\yafromaddress}|\yafromaddress|, which +% sets |\yawriter| but does not typeset the address itself. +% +% Finally, \DescribeMacro{\yaaddress}|\yaaddress| just +% typesets the address, and doesn't set any other variables. +% +% If you already have an address database, it is probably +% helpful to develop a script which will convert your +% addresses into appropriate |\defineaddress| macros. +% Fortunately, this probably isn't very difficult. +% +% \section{Envelopes} +% \label{sect:envelopes} +% +% |yaletter| also provides plenty of facilities for +% typesetting envelopes. You can use the same convenient +% address facilities for envelopes as you can for letters. +% +% \DescribeMacro{\yaenvelope}|\yaenvelope| is the primary +% macro, and it takes two arguments: the first is the width +% of the envelope, the second is its height. These can be +% given in any dimension that |pdftex| understands; likely +% this will be inches or millimeters. |yaletter| will +% create this envelope at the point in the document that you +% invoke |\yaenvelope|, so if you're doing this in the same +% file as your letter, you should issue this after your +% letter is complete. It will start a new page if +% necessary. So, for a standard American business envelope: +% +% \begin{quote} +% |\yaenvelope{9.5in}{4.125in}| +% \end{quote} +% +% You can control the placing of the return address and the +% to address very precisely. To select the unit you'd like +% to use for that control, use +% \DescribeMacro{\yaenvunit}|\yaenvunit|, which takes a +% single argument, which is the unit you'd like to use for +% positioning envelope elements. I have found a tenth of an +% inch convenient for this purpose, and that is consequently +% the default: +% +% \begin{quote} +% |\yaenvunit{0.1in}| +% \end{quote} +% +% You then set the value of several count registers; those +% count registers will be multiplied by the value of +% |\yaenvunit| for positioning. The registers are: +% +% \begin{center} +% \begin{tabular}{lp{0.6\textwidth}c} +% \toprule +% Dimension & Description & Default\\ +% \midrule +% |\yaenvrethskip| & Return address's distance from the left +% edge of the envelope & 2 \\ +% |\yaenvretvskip| & Return address's distance from the top +% edge of the envelope & 1 \\ +% |\yaenvtohskip| & To address's distance from the left +% edge of the envelope & 42 \\ +% |\yaenvtovskip| & To address's distance from the top +% edge of the envelope & 18 \\ +% \bottomrule +% \end{tabular} +% \end{center} +% +% Set these in the manner of plain-\TeX\ counts, not \LaTeX\ +% counters. E.g.: +% +% \begin{quote} +% |\yaenvtovskip=5| +% \end{quote} +% +% The actual addresses to be printed are held in +% \DescribeMacro{\yaenvtoaddr}|\yaenvtoaddr|, which holds +% the to address; and +% \DescribeMacro{\yaenvretaddr}|\yaenvretaddr|, which holds +% the return address. Redefine these before issuing your +% |\yaenvelope| command: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\def\yaenvretaddr{% + Your Name \\ + 7777 Someplace Street \\ + Nowhere, OK 00000% +}% +\def\yaenvtoaddr{\yaaddress{FIRST}} +\end{lstlisting} +% \iffalse +% +% \fi +% +% Here we have the return address entered manually, but the +% to address entered as an address defined with +% |\defineaddress|, using |\yaaddress|, which typesets the +% address itself but does not set any variables. +% +% Because some envelope sizes are quite common, |yaletter| +% provides them as simple commands. The table below gives +% these commands along with the envelope size they mimic, +% plus the skips for each of their parts. The unit of +% skipping is, in all cases, |0.1in|, which you can change +% if you need to adjust this spacing. Changing the font +% size to any significant degree will likely require such +% adjustments. +% +% All of these commands are prefixed with |ya|; the North +% American sizes are prefixed with |yana|. Subsequently, +% letters in the names are retained, while digits are made +% lowercase roman numerals. Finally, |envelope| is suffixed +% to the end. So, e.g., a C6 envelope becomes +% |\yacvienvelope|. +% +% \begin{longtable}{llcccc} +% \toprule +% {} & {} & Ret. & Ret. & To & To \\ +% Size & Command & hskip & vskip & hskip & vskip \\ +% \midrule +% No.\ 10 & |\business| & 2 & 1 & 42 & 18 \\ +% {} & |\yananoxenvelope| & {} & {} & {} & {} \\ +% DL & |\yadlenvelope| & 2 & 1 & 36 & 18 \\ +% C6 & |\yacvienvelope| & 2 & 1 & 26 & 20 \\ +% C6/C5 & |\yacvicvenvelope| & 2 & 1 & 42 & 18 \\ +% C5 & |\yacvenvelope| & 2 & 1 & 38 & 28 \\ +% C4 & |\yacivenvelope| & 3 & 3 & 60 & 42 \\ +% C3 & |\yaciiienvelope| & 3 & 3 & 84 & 60 \\ +% A-2 & |\yanaaiienvelope| & 2 & 1 & 22 & 20 \\ +% A-6 & |\yanaavienvelope| & 2 & 1 & 26 & 22 \\ +% A-7 & |\yanaaviienvelope| & 2 & 1 & 30 & 24 \\ +% A-8 & |\yanaaviiienvelope| & 2 & 1 & 34 & 24 \\ +% A-9 & |\yanaaixenvelope| & 2 & 1 & 38 & 28 \\ +% A-10 & |\yanaaxenvelope| & 2 & 1 & 42 & 28 \\ +% No.\ 6$\frac{3}{4}$ & |\yananovienvelope| & 2 & 1 & 26 & 14 \\ +% No.\ 7$\frac{3}{4}$ & |\yananoviienvelope| & 2 & 1 & 32 & 16 \\ +% No.\ 9 & |\yananoixenvelope| & 2 & 1 & 36 & 16 \\ +% No.\ 11 & |\yananoxienvelope| & 2 & 1 & 48 & 20 \\ +% No.\ 12 & |\yananoxiienvelope| & 2 & 1 & 48 & 22 \\ +% No.\ 14 & |\yananoxivenvelope| & 2 & 1 & 52 & 24 \\ +% \bottomrule +% \end{longtable} +% +% |yaletter| can print any size of envelope; if your printer +% can handle it, |yaletter| can make it. The table above +% just presents presets for a number of common situations. +% +% It bears repeating that all of these settings assume no +% change in font size; however, especially for the larger +% envelopes, you'll likely want to increase the font size. +% You'll probably want to adjust the hskip and vskip for +% both addresses at that time. +% +% \section{Labels} +% \label{sect:labels} +% +% Oftentimes, however, we don't want to print on envelopes; +% we just want to print on labels, which we can then attach +% to envelopes (or to packages, or to whatever). |yaletter| +% caters to this need, too. +% +% The main macro is +% \DescribeMacro{\yalabelsheet}|\yalabelsheet|, which due to +% the nature of label sheets takes many arguments which are +% best explained explicitly: +% +% \begin{center} +% \cmd{\yalabelsheet} \marg{page-width} \marg{page-height} +% \marg{label-width} \marg{label-height} +% \marg{horizontal-separation} \marg{vertical-separation} +% \marg{number-across} \marg{number-down} +% \end{center} +% +% That's \emph{eight} mandatory arguments. Unfortunately, +% this seems unavoidable; we can't assume that labels are +% evenly spaced on the sheet, nor can we assume that labels +% are sensibly divided on the page. The macro does assume +% that they are arranged in rows and columns; that is all. +% +% The first six arguments are all lengths, and can be given +% in any unit that \TeX\ understands. The last two are +% simply integers; so for a sheet of labels grouped in ten +% rows of three, one simply enters |{3}{10}|. +% +% Even these eight parameters are not sufficient, however, +% because we can't assume that the margins of the label +% sheet are the same as the gaps between the labels +% themselves. So because with \TeX\ we are limited to nine +% arguments, we have separate parameters to set these +% margins: +% +% \begin{center} +% \begin{tabular}{ll} +% \toprule +% \multicolumn{1}{c}{Margin} & \multicolumn{1}{c}{Length} \\ +% \midrule +% Left & |\yalableftmarg| \\ +% Right & |\yalabrightmarg| \\ +% Top & |\yalabtopmarg| \\ +% Bottom & |\yalabbotmarg| \\ +% \bottomrule +% \end{tabular} +% \end{center} +% +% Redefining \DescribeMacro{\yalabeltext}|\yalabeltext| will +% place the contents of that macro in each of the labels on +% the newly-created label page. E.g.: +% +% \begin{quote} +% |\def\yalabeltext{\yaaddress{FIRST}}| +% \end{quote} +% +% \noindent +% will result in the address (defined with |\defineaddress| +% with the label |FIRST|) being typeset in all the labels of +% the newly created label sheet. This is very handy for +% printing out an entire sheet of, say, return address +% labels. However, because often you'd like different +% text on each label, |\yalabeltext| defaults to empty, so +% no text will be printed onto the labels. This means that +% it will appear to be a completely blank page. +% +% You can place individual labels with the +% \DescribeMacro{\yaplacelabel}|\yaplacelabel| command: +% +% \begin{center} +% \cmd{\yaplacelabel} \marg{text} \marg{number-across} +% \marg{number-down} +% \end{center} +% +% The first argument contains the text you'd like printed on +% the label; it consists of arbitrary \LaTeX\ code and can +% be the result of other commands (e.g., your first argument +% may be something like |\yaaddress{FIRST}|). The second +% and third tell |yaletter| which label you'd like this text +% to go on; the second argument is the number of columns +% across you'd like to skip, the third is the number of rows +% down you'd like to skip. +% +% \emph{These are zero-indexed.} That is, if you want to +% typeset a label in the first label on the sheet, use +% |{0}{0}|. The whole first row will have a |{0}| for the +% second argument; the whole first column will have a |{0}| +% for the first argument. +% +% Note that |yaletter| does \emph{not} check if you've given +% it coordinates for a label that actually exists; if you +% tell |yaletter| to typeset a label in the fourth row when +% there are only two, it will obey you, and your label will +% be off the page. +% +% Each label is typeset in a box. You can indent the box +% from the left edge of the label by setting the length +% \DescribeMacro{\yalabelmarg}|\yalabelmarg|, which defaults +% to |0.1in|. +% +% Sometimes it's useful to see the boxes that you're +% typesetting in, even though you don't want to print them. +% E.g., it's easier to tell if your text fits inside the +% label if you can see the boundaries of that label. To +% make these boxes visible, run +% \DescribeMacro{\yashowboxeson}|\yashowboxeson|; to turn +% them off again, run +% \DescribeMacro{\yashowboxesoff}|\yashowboxesoff|. +% +% When you're defining a new label sheet, it's important not +% to trust the measurements on the packaging. For example, +% Avery 8660 says that its labels are one inch high, but it +% also says that they're twenty-five millimeters high; +% obviously, one of these must be slightly off, since one +% inch equals 25.4 millimeters. It turns out that using +% twenty-five millimeters works better, though a ruler +% says that one inch is the correct measurement. Go figure. +% +% |yaletter| offers two presets for label sheets: Avery +% 8660 and Avery 8663. Why these two? Because those are +% the two that I happen to have in my drawer here! In any +% case, they are accessed using the +% \DescribeMacro{\yaavery}|\yaavery| command, which takes +% one argument: the number of the label package. E.g., +% |\yaavery{8660}| will give you a sheet of labels in size +% Avery 8660. +% +% Defining new label sheets is relatively easy. If you want +% it to fit into this |avery| naming scheme, define it like +% so: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\expandafter\def\csname avery????\endcsname{% + \yalabtopmarg=0.5in + \yalabbotmarg=0.5in + \yalableftmarg=0.1875in + \yalabrightmarg=0.1875in + \yalabelsheet{8.5in}{11in}{2.625in}{25mm}{0.125in}{0in}{3}{10}% +}% +\end{lstlisting} +% \iffalse +% +% \fi +% +% That's the setting for Avery 8660; replace |????| with the +% number label you want, and set the appropriate dimensions. +% Use a ruler; it's the only way to be sure. Also, the +% margins are typically not printed on the packaging, so +% you'll need to get those manually anyway. After this, +% |\yaavery{????}| will get you a sheet with these settings. +% +% For some other manufacturer, or if you just don't like +% this naming scheme, don't bother; just replace the first +% line about with |\def\nameoflabelsheet{%|. Then running +% |\nameoflabelsheet| will give you a label sheet with your +% settings. +% +% \section{Examples} +% \label{sect:letexamples} +% +% A common need for label sheets is to print an entire sheet +% with the same text on each label; typically this is to +% produce a sheet of return-address labels, to be attached +% to envelopes when they are mailed. A minimal working +% example to produce such a label sheet: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\documentclass{yaletter} +\defineaddress{HOME}{John Q.\ Public}{% + John Q.\ Public \\ + 65 North Buffalo Terrace \\ + Somewhere, NY 00000 +}% +\begin{document} +\def\yalabeltext{\yaaddress{HOME}} +\yalabtopmarg=0.5in +\yalabbotmarg=0.5in +\yalableftmarg=0.1875in +\yalabrightmarg=0.1875in +\yashowboxeson +\yalabelsheet{8.5in}{11in}{2.625in}{25mm}{0.125in}{0in}{3}{10}% +\end{document} +\end{lstlisting} +% \iffalse +% +% \fi +% +% This will yield a sheet of return address labels (note +% that |\yashowboxeson| was issued here, just so we can see +% the labels bettter; for actual printing, one wouldn't want +% this): +% +% \begin{center} +% \fbox{\includegraphics[scale=0.25]{return_sheet-crop.pdf}} +% \end{center} +% +% The basic types of letters are demonstrated in Figure +% \ref{fig:basiclettypes} on page +% \pageref{fig:basiclettypes}. Specifically, Figure +% \ref{fig:basiclettypes} demonstrates block, modified +% block, and normal-style letters. +% +% \begin{figure}[htbp] +% \begin{tabular}{cc} +% \fbox{\includegraphics[scale=0.65]{sample_block-crop.pdf}} & +% \fbox{\includegraphics[scale=0.65]{sample_modblock-crop.pdf}} \\ +% \noalign{\vskip0.25em} +% \itshape Block Style & \itshape Modified Block Style \\ +% \noalign{\vskip1em} +% \fbox{\includegraphics[scale=0.65]{sample_normal-crop.pdf}} & +% {} \\ +% \itshape Normal Style & {} \\ +% \end{tabular} +% \caption{Examples of the Three Basic Letter Types} +% \label{fig:basiclettypes} +% \end{figure} +% +% A standard American business envelope (No.\ 10) is easier +% to form. A minimal example producing such an envelope is +% as follows: +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\documentclass{yaletter} +\defineaddress{HOME}{John Q.\ Public}{% + Your Name \\ + 7777 Someplace Street \\ + Nowhere, OK 00000% +}% +\def\yaenvretaddr{\yaaddress{HOME}} +\def\yaenvtoaddr{Your Name \\ 7777 Someplace Street \\ Nowhere, OK 00000} +\def +\begin{document} +\global\yaenvrethskip=2 +\global\yaenvretvskip=1 +\global\yaenvtohskip=42 +\global\yaenvtovskip=18 +\yaenvelope{9.5in}{4.125in}% +\end{document} +\end{lstlisting} +% \iffalse +% +% \fi +% +% These are the same settings as can be obtained with +% |\yabusiness| or |\yananoxenvelope|; they're spelled out +% here just for demonstrative purposes. They will result in +% the following envelope: +% +% \begin{center} +% \fbox{\includegraphics[width=\textwidth]{demon_envelope.pdf}} +% \end{center} +% +% You can print this as you wish; but keep in mind that you +% may have to rotate the page with your pdf viewer, +% depending on what orientation your printer expects. +% +% \section{Implementation} +% \label{sect:implementation} +% +% First, we need to require |xkeyval|, so that we can make +% |yaoptions| work correctly without a confusing array of +% options. +% \begin{macrocode} +\RequirePackage{xkeyval} +% \end{macrocode} +% Next, define the necessary options and dimensions. Set +% good defaults for standard \LaTeX\ dimensions. +% \begin{macrocode} +\pagenumbering{arabic} +\newdimen\ya@lftmarg\ya@lftmarg=0.5in +\newdimen\ya@rgtmarg\ya@rgtmarg=0.5in +\newdimen\ya@topmarg\ya@topmarg=0.5in +\newdimen\ya@botmarg\ya@botmarg=1.0in +\paperheight=\the\pdfpageheight +\paperwidth=\the\pdfpagewidth +\newdimen\ya@pageheight\ya@pageheight=\the\paperheight +\newdimen\ya@pagewidth\ya@pagewidth=\the\paperwidth +\marginparwidth=0pt +\marginparpush=0pt +\topmargin=0pt +\headheight=12pt +\headsep=12pt +\footskip=24pt +\marginparsep=0pt +\newdimen\ya@headheight\ya@headheight=\the\headheight +\newdimen\ya@headsep\ya@headsep=\the\headsep +\newdimen\ya@footskip\ya@footskip=\the\footskip +\oddsidemargin=0pt +\newdimen\ya@oddsidemargin\ya@oddsidemargin=\the\oddsidemargin +\newdimen\ya@headwidth\ya@headwidth=0pt +\def\ya@headrulewidth{0.4pt} +\def\ya@footrulewidth{0.4pt} +\newdimen\ya@predate\ya@predate=12pt +\newdimen\ya@postdate\ya@postdate=12pt +\newdimen\ya@preinsideaddr\ya@preinsideaddr=12pt +\newdimen\ya@postinsideaddr\ya@postinsideaddr=0pt +\newdimen\ya@presalutation\ya@presalutation=0pt +\newdimen\ya@postsalutation\ya@postsalutation=0pt +\newdimen\ya@prefarewell\ya@prefarewell=0pt +\newdimen\ya@postfarewell\ya@postfarewell=12pt +\newdimen\ya@presignature\ya@presignature=12pt +\newdimen\ya@postsignature\ya@postsignature=0pt +\newdimen\ya@preenclosure\ya@preenclosure=0pt +\newdimen\ya@postenclosure\ya@postenclosure=0pt +\def\ya@saluword{Dear } +\def\ya@salupunct{:} +\def\ya@farewellword{Sincerely} +\def\ya@farewellpunct{,} +\def\ya@signatureword{Your Name Here} +\def\ya@enclosureword{Enclosure} +\def\yaaddressee{} +\def\yawriter{} +% \end{macrocode} +% Now we define |yaoptions| and the actual key-value pairs +% which serve as its argument. +% \begin{macrocode} +\define@key{yaoptions}{lftmarg}{\global\ya@lftmarg=#1} +\define@key{yaoptions}{rgtmarg}{\global\ya@rgtmarg=#1} +\define@key{yaoptions}{topmarg}{\global\ya@topmarg=#1} +\define@key{yaoptions}{botmarg}{\global\ya@botmarg=#1} +\define@key{yaoptions}{pageheight}{\global\ya@pageheight=#1} +\define@key{yaoptions}{pagewidth}{\global\ya@pagewidth=#1} +\define@key{yaoptions}{footskip}{\global\ya@footskip=#1} +\define@key{yaoptions}{headsep}{\global\ya@headsep=#1} +\define@key{yaoptions}{headheight}{\global\ya@headheight=#1} +\define@key{yaoptions}{oddsidemargin}{\global\ya@oddsidemargin=#1} +\define@key{yaoptions}{headwidth}{\global\ya@headwidth=#1} +\define@key{yaoptions}{headrulewidth}{\global\def\ya@headrulewidth{#1}} +\define@key{yaoptions}{footrulewidth}{\global\def\ya@footrulewidth{#1}} +\define@key{yaoptions}{predate}{\global\ya@predate=#1} +\define@key{yaoptions}{postdate}{\global\ya@postdate=#1} +\define@key{yaoptions}{preinsideaddr}{\global\ya@preinsideaddr=#1} +\define@key{yaoptions}{postinsideaddr}{\global\ya@postinsideaddr=#1} +\define@key{yaoptions}{presalutation}{\global\ya@presalutation=#1} +\define@key{yaoptions}{postsalutation}{\global\ya@postsalutation=#1} +\define@key{yaoptions}{prefarewell}{\global\ya@prefarewell=#1} +\define@key{yaoptions}{postfarewell}{\global\ya@postfarewell=#1} +\define@key{yaoptions}{presignature}{\global\ya@presignature=#1} +\define@key{yaoptions}{postsignature}{\global\ya@postsignature=#1} +\define@key{yaoptions}{preenclosure}{\global\ya@preenclosure=#1} +\define@key{yaoptions}{postenclosure}{\global\ya@postenclosure=#1} +\define@key{yaoptions}{datehskip}{\global\yahdateskip=#1} +\define@key{yaoptions}{insideaddrhskip}{\global\yahinsideaddrskip=#1} +\define@key{yaoptions}{saluskip}{\global\yahsalutationskip=#1} +\define@key{yaoptions}{farewellskip}{\global\yahfarewellskip=#1} +\define@key{yaoptions}{signatureskip}{\global\yahsignatureskip=#1} +\define@key{yaoptions}{enclosureskip}{\global\yahenclosureskip=#1} +\define@key{yaoptions}{enclosureword}{\global\def\ya@enclosureword{#1}} +\define@key{yaoptions}{saluword}{\global\def\ya@saluword{#1}} +\define@key{yaoptions}{salupunct}{\global\def\ya@salupunct{#1}} +\define@key{yaoptions}{farewellword}{\global\def\ya@farewellword{#1}} +\define@key{yaoptions}{farewellpunct}{\global\def\ya@farewellpunct{#1}} +\define@key{yaoptions}{signatureword}{\global\def\ya@signatureword{#1}} +\define@key{yaoptions}{signatureword}{\global\def\ya@signatureword{#1}} +\define@key{yaoptions}{addressee}{\yasetaddressee{#1}} +\define@key{yaoptions}{writer}{\yasetwriter{#1}} +\define@key{yaoptions}{parskip}{\global\yaparskip=#1} +\define@key{yaoptions}{parindent}{\global\yaparindent=#1} +\define@key{yaoptions}{datafile}{\global\input{#1}} +\newcommand\yaoptions[1]{% + \setkeys{yaoptions}{#1}% + \geometry{top=\the\ya@topmarg,bottom=\the\ya@botmarg, + left=\the\ya@lftmarg,right=\the\ya@rgtmarg, + paperheight=\the\ya@pageheight,paperwidth=\the\ya@pagewidth, + footskip=\the\ya@footskip,headsep=\the\ya@headsep, + headheight=\the\ya@headheight} + \ifdim\ya@headwidth=0pt + \global\headwidth=\the\textwidth + \else + \global\headwidth=\the\ya@headwidth + \fi + \renewcommand{\headrulewidth}{\ya@headrulewidth} + \renewcommand{\footrulewidth}{\ya@footrulewidth} +}% +% \end{macrocode} +% Set |\normalsize| so that \LaTeX\ doesn't complain. While +% we're at it, set all the default \LaTeX\ font sizes, since +% people are often accustomed to using them. +% \begin{macrocode} +\renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont} +\newcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt} +\newcommand\tiny{\@setfontsize\tiny\@vpt\@vipt} +\newcommand\large{\@setfontsize\large\@xiipt{14}} +\newcommand\Large{\@setfontsize\Large\@xivpt{18}} +\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} +\newcommand\huge{\@setfontsize\huge\@xxpt{25}} +\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}} +% \end{macrocode} +% Now we need to set some basic page dimensions so that +% |geometry| doesn't complain. We just start with the +% default page dimensions of the system, getting them from +% pdf\TeX; it doesn't really matter, since |geometry| will +% set the actual dimensions later. +% \begin{macrocode} +\paperheight=\the\pdfpageheight +\paperwidth=\the\pdfpagewidth +% \end{macrocode} +% Now we add the necessary package: |geometry| and +% |fancyhdr|. +% \begin{macrocode} +\RequirePackage{geometry} +\RequirePackage{fancyhdr} +% \end{macrocode} +% Now define the default page styles. The first, +% |yafirstpage|, obviously is used for the first page of the +% letter; the other, |yaotherpage|, is used for all other +% pages. +% \begin{macrocode} +\fancypagestyle{yafirstpage}{% + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0.4pt} + \fancyhf{}% + \fancyfoot[C]{Page \thepage\ of \yalastpage}% +}% +\fancypagestyle{yaotherpage}{% + \renewcommand\headrulewidth{0.4pt} + \renewcommand\footrulewidth{0.4pt} + \fancyhf{}% + \fancyhead[L]{\yawriter\ to \yaaddressee}% + \fancyhead[R]{\yathedate}% + \fancyfoot[C]{Page \thepage\ of \yalastpage}% +}% +\fancypagestyle{yaenvpage}{% + \renewcommand\headrulewidth{0pt} + \renewcommand\footrulewidth{0pt} + \fancyhf{}% + \newgeometry{margin=0pt} +}% +% \end{macrocode} +% Now let's define the letterhead code. Each letterhead is +% defined by |\defineletterhead|, which takes two arguments: +% the first is the name of the letterhead, which will be +% appended to another command of the form +% |\letterheadNAME|; and the second is the actual letterhead +% code itself. +% \begin{macrocode} +\def\defineletterhead#1#2{% + \global\expandafter\def\csname letterhead#1\endcsname{% + \hbox{#2}% + }% + \vskip1pt + \@afterindentfalse\@afterheading +}% +% \end{macrocode} +% We also define |\yauseletterhead|, which takes as its +% single argument the name of the letterhead as given in a +% |\defineletterhead| command. +% \begin{macrocode} +\def\yauseletterhead#1{% + \csname letterhead#1\endcsname% +}% +% \end{macrocode} +% Define the basic letter types with |\ya@lettertype|; 0 is +% block, 1 is modified block, and 2 is ``normal.'' +% \begin{macrocode} +\newcount\ya@lettertype\ya@lettertype=0 +% \end{macrocode} +% Now define some of the basic lengths; these are all +% user-accessible (that is, they don't contain ``|@|''). +% They deal with paragraph spacing and indentation. +% \begin{macrocode} +\newdimen\yaparskip\yaparskip=12pt +\newdimen\yaparindent\yaparindent=0pt +\newdimen\yahdateskip\yahdateskip=0pt +\newdimen\yahinsideaddrskip\yahinsideaddrskip=0pt +\newdimen\yahsalutationskip\yahsalutationskip=0pt +\newdimen\yahfarewellskip\yahfarewellskip=0pt +\newdimen\yahsignatureskip\yahsignatureskip=0pt +\newdimen\yahenclosureskip\yahenclosureskip=0pt +% \end{macrocode} +% Define the letter types. These really simply redefine a +% few variables, and can be duplicated entirely with the +% |\yaoptions| command, but these command provide a little +% syntactic sugar. +% \begin{macrocode} +\def\yaletterblock{% + \everypar={% + \parindent=\the\yaparindent + \parskip=\the\yaparskip + }% +}% +\def\yalettermodblock{% + \everypar={% + \parindent=\the\yaparindent + \parskip=\the\yaparskip + }% + \yahdateskip=\textwidth% + \divide\yahdateskip by2% + \yahfarewellskip=\textwidth% + \divide\yahfarewellskip by 2% + \yahsignatureskip=\textwidth% + \divide\yahsignatureskip by 2% + \ya@lettertype=1 +}% +\def\yaletternormal{% + \yaparskip=0pt + \yaparindent=24pt + \everypar={% + \parindent=\the\yaparindent + \parskip=\the\yaparskip + }% + \yahdateskip=\textwidth% + \divide\yahdateskip by2% + \yahfarewellskip=\textwidth% + \divide\yahfarewellskip by2% + \yahsignatureskip=\textwidth% + \divide\yahsignatureskip by2% + \ya@lettertype=2 + \ya@preinsideaddr=24pt% + \ya@presalutation=12pt% + \ya@postsalutation=12pt% + \ya@prefarewell=12pt% +} +% \end{macrocode} +% Now we define some of the actual letter macros. These put +% in things like dates, inside addresses, salutations, and +% so forth. We use our space parameters, defined above, to +% make sure they all get put in the right places. +% \begin{macrocode} +\def\yadatestyle{} +\def\yadate#1{% + \vskip\ya@predate% + \noindent\hskip\yahdateskip\hbox{% + \yadatestyle #1% + \hfil% + }% + \vskip\ya@postdate% + \global\def\yathedate{#1}% +}% +\def\yainsideaddrstyle{} +\def\yainsideaddr#1{% + \vskip\ya@preinsideaddr% + \noindent\hskip\yahinsideaddrskip\hbox{% + \vbox{\yainsideaddrstyle\noindent #1} + } + \vskip\ya@postinsideaddr% +}% +\def\yasalutationstyle{} +\def\yasalutation#1{% + \vskip\ya@presalutation% + \noindent\hskip\yahsalutationskip\hbox{% + \yasalutationstyle% + \ya@saluword #1\ya@salupunct\hfil% + }% + \vskip\ya@postsalutation% +}% +\def\yafarewellstyle{} +\def\yafarewell{% + \vskip\ya@prefarewell% + \noindent\hskip\yahfarewellskip\hbox{% + \yafarewellstyle% + \ya@farewellword\ya@farewellpunct\hfil% + }% + \vskip\ya@postfarewell% +}% +\def\yasignaturestyle{} +\def\yasignature{% + \vskip\ya@presignature% + \noindent\hskip\yahsignatureskip\hbox{% + \yasignaturestyle% + \ya@signatureword\hfil% + }% + \vskip\ya@postsignature% + \label{thelast}% +}% +\def\yaenclosurestyle{} +\def\yaenclosure{% + \vskip\ya@preenclosure% + \noindent\hskip\yahenclosureskip\hbox to\linewidth{% + \yaenclosurestyle% + \ya@enclosureword\hfil% + }% + \vskip\ya@postenclosure% +}% +% \end{macrocode} +% Now we need to include some code for the headers and +% footers. These are basically simply container macros with +% certain information contained in them. +% \begin{macrocode} +\def\yaaddresseestyle{\itshape} +\def\yasetaddressee#1{% + \global\def\yaaddressee{{\yaaddresseestyle #1}}% +}% +\def\yawriterstyle{\itshape} +\def\yasetwriter#1{% + \global\def\yawriter{{\yawriterstyle #1}}% +}% +\def\yalastpagestyle{} +\def\yalastpage{% + {\yalastpagestyle \pageref{thelast}}% +}% +% \end{macrocode} +% Now we can start work on the address commands. These +% define addresses that can then be referred to by name, +% similarly to the letterheads. It takes a first argument, +% the name of the address; a second, the short name you'd +% like to be used for the |\yawriter| or |\yaaddressee|; and +% a third, the actual code for the address. +% \begin{macrocode} +\def\defineaddress#1#2#3{% + \global\expandafter\def\csname address#1\endcsname{% + \noindent\parskip=0pt\parindent=0pt% + #3% + }% + \global\expandafter\def\csname shortname#1\endcsname{% + #2% + }% +}% +% \end{macrocode} +% Now we define three commands to actually use this. We can +% issue |\yatoaddress{NAME}|, which will typeset the actual +% address and set the addressee to the short name define in +% the second argument of |\defineaddress|; and +% |\yareturnaddress{NAME}|, which does the same thing but +% sets the writer rather than the addressee. +% |\yafromaddress| sets the writer but does not typeset the +% address. Finally, |\yaaddress| just typesets the address +% by itself. +% \begin{macrocode} +\def\yatoaddress#1{% + \yasetaddressee{\csname shortname#1\endcsname}% + \csname address#1\endcsname% +}% +\def\yareturnaddress#1{% + \yasetwriter{\csname shortname#1\endcsname}% + \csname address#1\endcsname% +}% +\def\yafromaddress#1{% + \yasetwriter{\csname shortname#1\endcsname}% +}% +\def\yaaddress#1{% + \csname address#1\endcsname% +}% +% \end{macrocode} +% Now we define the code for envelopes. This is pretty +% easy to follow. |\yaenvelope| takes two arguments, the +% width and height of the envelope. It uses |\yaenvtoaddr| +% and |\yaenvretaddr| in the place the appropriate +% addresses. We also provide |\yaenvunit| to let people use +% whatever unit they want; |1in| is the default. +% \begin{macrocode} +\RequirePackage{textpos} +\def\yashowboxeson{% + \TPoptions{showboxes=true} +}% +\def\yashowboxesoff{% + \TPoptions{showboxes=false} +}% +\def\yaenvunit#1{% + \setlength{\TPHorizModule}{#1}% + \setlength{\TPVertModule}{#1}% +}% +\yaenvunit{0.1in} +\def\yaenvtoaddr{% + TO ADDRESS% +}% +\def\yaenvretaddr{% + RETURN ADDRESS% +}% +\newcount\yaenvrethskip\yaenvrethskip=2 +\newcount\yaenvretvskip\yaenvretvskip=1 +\newcount\yaenvtohskip\yaenvtohskip=42 +\newcount\yaenvtovskip\yaenvtovskip=18 +\def\yaenvelope#1#2{% + \clearpage% + \eject\pdfpagewidth=#1 \pdfpageheight=#2% + \thispagestyle{yaenvpage} + \begin{textblock}{100}(\yaenvrethskip,\yaenvretvskip) + \parskip=0pt\parindent=0pt% + \yaenvretaddr% + \end{textblock} + \begin{textblock}{100}(\yaenvtohskip,\yaenvtovskip) + \parskip=0pt\parindent=0pt% + \yaenvtoaddr% + \end{textblock} +}% +\def\yabusiness{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=42 + \global\yaenvtovskip=18 + \yaenvelope{9.5in}{4.125in}% +}% +\def\yananoxenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=42 + \global\yaenvtovskip=18 + \yaenvelope{9.5in}{4.125in}% +}% +\def\yadlenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=36 + \global\yaenvtovskip=18 + \yaenvelope{8.66in}{4.33in}% +}% +\def\yacvienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=26 + \global\yaenvtovskip=20 + \yaenvelope{6.4in}{4.5in}% +}% +\def\yacvicvenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=42 + \global\yaenvtovskip=18 + \yaenvelope{9in}{4.5in}% +}% +\def\yacvenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=38 + \global\yaenvtovskip=28 + \yaenvelope{9in}{6.4in}% +}% +\def\yacivenvelope{% + \global\yaenvrethskip=3 + \global\yaenvretvskip=3 + \global\yaenvtohskip=60 + \global\yaenvtovskip=42 + \yaenvelope{12.8in}{9.0in}% +}% +\def\yaciiienvelope{% + \global\yaenvrethskip=3 + \global\yaenvretvskip=3 + \global\yaenvtohskip=84 + \global\yaenvtovskip=60 + \yaenvelope{18in}{12.8in}% +}% +\def\yanaaiienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=22 + \global\yaenvtovskip=20 + \yaenvelope{5.75in}{4.375in}% +}% +\def\yanaavienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=26 + \global\yaenvtovskip=22 + \yaenvelope{6.5in}{4.75in}% +}% +\def\yanaaviienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=30 + \global\yaenvtovskip=24 + \yaenvelope{7.25in}{5.25in}% +}% +\def\yanaaviiienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=34 + \global\yaenvtovskip=24 + \yaenvelope{8.125in}{5.5in}% +}% +\def\yanaaixenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=38 + \global\yaenvtovskip=28 + \yaenvelope{8.75in}{5.75in}% +}% +\def\yanaaxenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=42 + \global\yaenvtovskip=28 + \yaenvelope{9.5in}{6.00in}% +}% +\def\yananovienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=26 + \global\yaenvtovskip=14 + \yaenvelope{6.5in}{3.625in}% +}% +\def\yananoviienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=32 + \global\yaenvtovskip=16 + \yaenvelope{7.5in}{3.875in}% +}% +\def\yananoixenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=36 + \global\yaenvtovskip=16 + \yaenvelope{8.875in}{3.875in}% +}% +\def\yananoxienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=48 + \global\yaenvtovskip=20 + \yaenvelope{10.375in}{4.5in}% +}% +\def\yananoxiienvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=48 + \global\yaenvtovskip=22 + \yaenvelope{11in}{4.75in}% +}% +\def\yananoxivenvelope{% + \global\yaenvrethskip=2 + \global\yaenvretvskip=1 + \global\yaenvtohskip=52 + \global\yaenvtovskip=22 + \yaenvelope{11.5in}{5in}% +}% +% \end{macrocode} +% +% Lastly, we write the label code. This code allows us to +% print arbitrary pages of labels. +% +% First, we must define a little macro to allow nested +% loops. This is taken wholesale from the accepted +% StackExchange answer to question 58049, written by David +% Carlisle. As is usual with David Carlisle's code, it's +% remarkable in its simplicity and elegance. +% \begin{macrocode} +\def\nloop#1{% + \def\nl@@p##1##2\repeat#1{% + \def##1{##2\relax\expandafter##1\fi}% + ##1\let##1\relax}% + \expandafter\nl@@p\csname nl@@p-\string#1\endcsname +}% +% \end{macrocode} +% Now we can actually define the label code. First we need +% some lengths and counts. +% \begin{macrocode} +\newdimen\ya@labwidth +\newdimen\ya@labheight +\newdimen\ya@tempboxh\newdimen\ya@tempboxv +\newcount\ya@loopi +\newcount\ya@loopj +\newcount\ya@numacross +\newcount\ya@numdown +\newdimen\yalabelmarg\yalabelmarg=0.1in +% \end{macrocode} +% Now comes the main macro, |\yalabelsheet|, which takes +% eight arguments: the width and height of the page itself, +% the width and height of each label, the vertical and +% horizontal distance between each label, how many labels +% are across the width of the page, and how many labels are +% down the height of the page. +% +% This is a bit convoluted due to length limitations in +% |textpos|; so we have to define the lengths as half their +% real value, then multiply them again by 2 later on. +% \begin{macrocode} +\def\yalabeltext{} +\newdimen\yalableftmarg\yalableftmarg=0pt +\newdimen\yalabrightmarg\yalabrightmarg=0pt +\newdimen\yalabtopmarg\yalabtopmarg=0pt +\newdimen\yalabbotmarg\yalabbotmarg=0pt +\def\yalabelsheet#1#2#3#4#5#6#7#8{% + \clearpage% + \eject\pdfpagewidth=#1 \pdfpageheight=#2% + \ifdim\yalableftmarg=0pt \yalableftmarg=#5\fi + \ifdim\yalabrightmarg=0pt \yalabrightmarg=#5\fi + \ifdim\yalabtopmarg=0pt \yalabtopmarg=#6\fi + \ifdim\yalabbotmarg=0pt \yalabbotmarg=#6\fi + \newgeometry{left=\the\yalableftmarg,right=\the\yalabrightmarg, + top=\the\yalabtopmarg,bottom=\the\yalabbotmarg} + \thispagestyle{empty} + \ya@numacross=#7 \ya@numdown=#8 + \ya@labwidth=#3 \ya@labheight=#4 + \ya@tempboxh=#3 \ya@tempboxv=#4 + \advance\ya@labwidth by#5 + \advance\ya@labheight by#6 + \divide\ya@labwidth by2% + \divide\ya@labheight by2% + \newcount\ya@acthfact\newcount\ya@actvfact + \setlength{\TPHorizModule}{\the\ya@labwidth}% + \setlength{\TPVertModule}{\the\ya@labheight}% + \ya@loopi=0 \ya@loopj=0 + \nloop1\ifnum\ya@loopi<\ya@numdown + \ya@actvfact=\ya@loopi\multiply\ya@actvfact by2 + \ya@loopj=0 + \nloop2\ifnum\ya@loopj<\ya@numacross + \ya@acthfact=\ya@loopj\multiply\ya@acthfact by2 + \begin{textblock}{100}(\ya@acthfact,\ya@actvfact) + \hbox to#3{% + \hskip\yalabelmarg% + \vbox to#4{% + \parskip=0pt\parindent=0pt% + \vfil% + \yalabeltext% + \vfil% + }% + }% + \end{textblock} + \advance\ya@loopj by1% + \repeat2 + \advance\ya@loopi by1% + \repeat1 +}% +% \end{macrocode} +% Now we define a macro allowing text to be placed in an +% arbitrary label. Three arguments: the text to be placed; +% the numbers of columns across; and the number of rows +% down. +% \begin{macrocode} +\def\yaplacelabel#1#2#3{% + \newcount\ya@numacrossii\ya@numacrossii=#2 + \newcount\ya@numdownii\ya@numdownii=#3 + \multiply\ya@numacrossii by2% + \multiply\ya@numdownii by2% + \begin{textblock}{100}(\ya@numacrossii,\ya@numdownii) + \hbox to\ya@tempboxh{% + \hskip\yalabelmarg% + \vbox to\ya@tempboxv{% + \parskip=0pt\parindent=0pt% + \vfil% + #1% + \vfil% + }% + }% + \end{textblock} +}% +% \end{macrocode} +% Define a couple of preset options for certain sheets of +% labels; namely, for the two types of sheets that I +% happened to have near me at the time of writing this +% class. (Also the only ones I've ever really used.) +% Individual ones are prefixed with |\avery| and then the +% number put afterwards; you call these by issuing +% |\yaavery| with the single argument of the serial number +% of the label sheet you want. +% \begin{macrocode} +\expandafter\def\csname avery8663\endcsname{% + \yalabtopmarg=0.5in + \yalabbotmarg=0.5in + \yalableftmarg=0.15625in + \yalabrightmarg=0.15625in + \yalabelsheet{8.5in}{11in}{4in}{1.95in}{0.15625in}{0in}{2}{5}% +}% +\expandafter\def\csname avery8660\endcsname{% + \yalabtopmarg=0.5in + \yalabbotmarg=0.5in + \yalableftmarg=0.1875in + \yalabrightmarg=0.1875in + \yalabelsheet{8.5in}{11in}{2.625in}{25mm}{0.125in}{0in}{3}{10}% +}% +\def\yaavery#1{% + \csname avery#1\endcsname% +}% +% \end{macrocode} +% Finally, we put in some code to run at the +% |\begin{document}| command, just to get the ball rolling. +% \begin{macrocode} +\AtBeginDocument{% + \pagestyle{yaotherpage}% + \thispagestyle{yafirstpage}% + \ifnum\ya@lettertype=0 + \yaletterblock + \fi\ifnum\ya@lettertype=1 + \yalettermodblock + \fi\ifnum\ya@lettertype=2 + \yaletternormal + \fi +} +% \end{macrocode} +% +% Happy \TeX{}ing! +% +% \PrintIndex diff --git a/macros/latex/contrib/yaletter/yaletter.ins b/macros/latex/contrib/yaletter/yaletter.ins new file mode 100644 index 0000000000..923da1caa2 --- /dev/null +++ b/macros/latex/contrib/yaletter/yaletter.ins @@ -0,0 +1,65 @@ +% +AMDG This document was begun on 6 December 1200, the +% feast of St. Nicholas, and it is humbly dedicated to him +% and to the Immaculate Heart of Mary for her prayers, and +% to the Sacred Heart of Jesus for His mercy. +% +% This document is copyright 2016 by Donald P. Goodman, and is +% released publicly under the LaTeX Project Public License. The +% distribution and modification of this work is constrained by the +% conditions of that license. See +% http://www.latex-project.org/lppl.txt +% for the text of the license. This document is released +% under version 1.3 of that license, and this work may be distributed +% or modified under the terms of that license or, at your option, any +% later version. +% +% This work has the LPPL maintenance status 'maintained'. +% +% The Current Maintainer of this work is Donald P. Goodman +% (dgoodmaniii@gmail.com). +% +% This work consists of yaletter.dtx, yaletter.ins, and +% derived files yaletter.cls and yaletter.pdf. +% \fi + +\input docstrip.tex + +\preamble +This is a generated file. + +This document is copyright 2014 by Donald P. Goodman, and is +released publicly under the LaTeX Project Public License. The +distribution and modification of this work is constrained by the +conditions of that license. See + http://www.latex-project.org/lppl.txt +for the text of the license. This document is released +under version 1.3 of that license, and this work may be distributed +or modified under the terms of that license or, at your option, any +later version. + +This work has the LPPL maintenance status 'maintained'. + +The Current Maintainer of this work is Donald P. Goodman +(dgoodmaniii@gmail.com). + +This work consists of yaletter.dtx, yaletter.ins, and +derived files yaletter.cls and yaletter.pdf. +\endpreamble + +\keepsilent +\generate{\file{yaletter.cls}{\from{yaletter.dtx}{package}}} + +\Msg{******************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the} +\Msg{* following file into a directory searched by TeX:} +\Msg{*} +\Msg{* \space\space yaletter.sty} +\Msg{*} +\Msg{* To produce the documentation run the file yaletter.dtx} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{******************************************************} + +\endbatchfile diff --git a/macros/latex/contrib/yaletter/yaletter.pdf b/macros/latex/contrib/yaletter/yaletter.pdf new file mode 100644 index 0000000000..82c6a91d83 Binary files /dev/null and b/macros/latex/contrib/yaletter/yaletter.pdf differ -- cgit v1.2.3