% \iffalse %<*drv> \documentclass{ltxdoc} \usepackage{doc} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} \parindent0pt \begin{document} %\OnlyDescription %Comment out for Desription only \setlength\hfuzz{15pt} \sloppy \DocInput{serial.dtx} \end{document} % %\fi % \MakeShortVerb{\|} % \CheckSum{589} % \section{Guide} % \subsection{Introduction} % This class has been designed as a local wrapper for the KOMA-Script letter % class to allow easy generation of serial letters. % % Three different approaches % are now implemented, one based on the method described in the % scrlettr-guide, and one based on the textmerg package, and one using % the delimtxt-package. % % An interface for a local configuration file is integrated, allowing for % easy modification of the letter layout for your site. % % It is recommended to use the |inputenc| package with suitable options % if interfacing to an tex-unaware database to avoid problems with characters % not in the default character class (e.g. german Umlaut and the like). % % \bigskip % TODO: % Integration of the standard letter class. (KOMA uses some different names % for part of the letter information). % % The documentation is not fully done yet. % The examples still need % to be translated from german to english. % % \bigskip % % Copyright 1999 Bjoern Pedersen % % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or any later version. % % Permission is granted to to customize the declarations in this file % to serve the needs of your installation. However, no permission is % granted to distribute a modified version of this file under its % original name "serial.dtx". % % %\subsection{Class options} % \begin{enumerate} % \item \lbrack |kein|\rbrack |vordruck| switches from preprinted to white paper % \lbrack default:white paper\rbrack % \item |adrentry| use KOMA-Script based data file % \item |merg| use textmerg style data file \lbrack default\rbrack % \item |delim| use delimtxt style data file % \item \lbrack |no|\rbrack |nofoldmarks| switches foldmarks on/off \lbrack on\rbrack % \item |latin1/asciinew/ansi/applemac| If present, these are passed to the |inputenc| % package % \item |draft| This options outputs one letter, skipping the reading % of the data file and substituting the macros with their % name. (useful for testing the letter) %\end{enumerate} % %\subsection{Macros} % \subsubsection{Setup and Utility Macros} % \DescribeMacro{\MyFirstHead}|\MyFirstHead|: % % This generates our local header on the first page of each letter. % % \DescribeMacro{\MyFirstFoot}|\MyFirstFoot|: % This generates our local header on the first page of each letter. % Use |DeclareRobustCommand{\MyFirst[Head/Foot]}| to change it e.g. in the cfg-file. % % \DescribeMacro{\MyNextHead}|\MyNextHead|, % \DescribeMacro{\MyNextFoot}|\MyNextFoot|: % % These are the headers/footers on the following pages and by default empty. % % Behind the scenes, the fancyhdr-package is used to customize these headers/ % footers. % % \subsubsection{KOMA-script -letter macros} % These scrlettr-macros have to be declared either in the config-file or in the preamble. % % \DescribeMacro{\signature}|\signature| % % \DescribeMacro{\place}|\place| % % \DescribeMacro{\name}|\name| % % \DescribeMacro{\location}|\location| % % \DescribeMacro{\telephone}|\telephone| % % \DescribeMacro{\backadress}|\backadress| % % \subsubsection{The serial letter macros} % \DescribeMacro{\Serial} % The |\Serial| macro is the main interface to this class. Its semantics are % as follows: % % |\Serial{adressfile}{letter-body}| % % It will read an adressfile( formatted as decribed in section \ref{adfile}) % and generate the serial letters. In each version an extra counter will enumerate the letters, % so later selected letters could be printed. % % The following macros will be defined in the letterbody (using the textmerg/delimtxt-options % , these can be further customized, see below): % % Entries marked with (\textbf{+}) are used internally and should always be present with this % name if customizing the data base format. Otherwise you have to rewrite the relevant parts % in your local class. % %\DescribeMacro{\Name}|\Name| The surname(\textbf{+}). % %\DescribeMacro{\VorName}|\VorName| The first name(s)(\textbf{+}). % %\DescribeMacro{\Street}|\Street| The street(\textbf{+}). % %\DescribeMacro{\City}|\City| The City (with ZIP-code)(\textbf{+}). % %\DescribeMacro{\Phone}|\Phone| The phone number. % %\DescribeMacro{\Geschlecht}|\Geschlecht| The sex. % %\DescribeMacro{\FreeII}|\FreeII| A multipurpose spare field. % %\DescribeMacro{\Comment}|\Comment| A comment field. % % \DescribeMacro{\Anrede}|\Anrede| Use this for the (by default german) opening. It depends on |\Geschlecht| % being either |w| or |m| and selects \DescribeMacro{\Wanredetext}|\Wanredetext| or % \DescribeMacro{\Manredetext}|\Manredetext|. For other languages, customize it in the configuration file. % % % \subsubsection{The Fields macro} %\DescribeMacro{\Fields} % In the textmerg or delimtxt-based version, the input format can be easily customized using % |\renewcommand{\Fields}|. % % The definition should contain the desired macro names, optionally preceeded by |+| to % allow skipping blank lines in the input. For a full description see the |textmerg|/|delimtxt| description. % Remember not to omit required fields. % % \subsection{The Adressfile format} % \label{adfile} % \subsubsection{The adrentry version} % This file with extension |.adr| should consist of lines containing: % %{\noindent\small |\adrentry{name}{firstname}{street}{city}{phone}{sec}{free}{comment}|} % % \subsubsection{The textmerg version} % This file with extension |.adt| has a more loosely defined format: % Each line corresponds to one entry in the |\Fields|-macro. These blocks are repeated for each letter. % If enabled with the |+| switch, blank lines are ignored in the input. % % So, for the default % % |\Fields{\Name\VorName\Street\City\Phone\Geschlecht\FreeII\Comment}| % % there should be 8 lines for each letter in the adress file. % \subsubsection{The delimtxt version} % This file with extension |.del| is analogous to the textmerg file, but fields are separated by \verb+|+ . % This delimiter can be changed by the delimtxt function |\SetDel|. Each new line starts a new letter. % For more info on delimtxt see the documentation supplied there. % % \StopEventually % % \section{Implementation} % \subsection{Serial-specific setup} %<*class> % % % Announce the classname. % % %% Copyright 1999 Bjoern Pedersen %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN %% archives in directory macros/latex/base/lppl.txt; either %% version 1 of the License, or any later version. %% %% Permission is granted to to customize the declarations in this file %% to serve the needs of your installation. However, no permission is %% granted to distribute a modified version of this file under its %% original name "serial.dtx". % \begin{macrocode} \def\filedate{1999/04/30} \ProvidesClass{serial}[\filedate] \NeedsTeXFormat{LaTeX2e}[1998/06/01] % \end{macrocode} % % Declare the necesary class options. % % \DescribeMacro{\firsthead} % \DescribeMacro{\firstfoot} % This generates our local header and footer on the first page of each letter. % The real definition should be in the configuration file. % % \begin{macrocode} \DeclareOption{keinvordruck}{ \AtBeginDocument{\firsthead{\MyFirstHead} \firstfoot{\MyFirstFoot} % \end{macrocode} % % \DescribeMacro{\nexthead} \DescribeMacro{\nextfoot} % On the following pages, no header or footer is planned. % % \begin{macrocode} \nexthead{\MyNextHead} \nextfoot{\MyNextFoot} \pagestyle{headings} }% end of AtBeginDocument } % \end{macrocode} % % If a preprinted paper is used, use option vordruck. % % \begin{macrocode} \DeclareOption{vordruck}% {\AtBeginDocument{% \firsthead{}% \firstfoot{}% \nexthead{}% \nextfoot{}% \pagestyle{empty} }} % \end{macrocode} % % Load the required package, if any. % To select the right behaviour, we let |\Serial| to either |\Serialx| or |\Seriala|. % For the koma-script version make |\Fields| a no-op. % % \begin{macrocode} \newif\ifTextM \TextMfalse \newif\ifDelT \DelTfalse \newif\ifDraft \Draftfalse \DeclareOption{draft}{\Drafttrue} \DeclareOption{final}{\Draftfalse} \DeclareOption{merg}{% \TextMtrue \AtEndOfClass{\global\let\MyMerge=\Merge \gdef\ext{.adt} \global\let\Serial=\Serialx}} \DeclareOption{delim}{ \DelTtrue \AtEndOfClass{\global\let\MyMerge=\DelimRead \gdef\ext{.del} \global\let\Serial=\Serialx}} \DeclareOption{adrentry}{ \def\Fields#1{\relax} \countdef\LetterCounter=1 \LetterCounter=0 \AtEndOfClass{\global\let\Serial=\Seriala}} % \end{macrocode} % % Some options for foldmarks. % % \begin{macrocode} \DeclareOption{nofoldmarks}{\AtEndOfClass{\foldmarksoff}} \DeclareOption{foldmarks}{\AtEndOfClass{\foldmarkson}} % \end{macrocode} % % Some inputenc.sty options % \begin{macrocode} \DeclareOption{ansinew}{\PassOptionsToPackage{\CurrentOption}{inputenc}} \DeclareOption{latin1}{\PassOptionsToPackage{\CurrentOption}{inputenc}} \DeclareOption{ascii}{\PassOptionsToPackage{\CurrentOption}{inputenc}} \DeclareOption{applemac}{\PassOptionsToPackage{\CurrentOption}{inputenc}} % \end{macrocode} % % Setup the defaults and load |scrlettr.cls|. % % \begin{macrocode} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrlettr}} \ExecuteOptions{keinvordruck,foldmarks,merge} \ProcessOptions\relax \LoadClass[wlocfield,a4paper]{scrlettr} % \end{macrocode} % % Load required packages based on options % % \begin{macrocode} \ifTextM \RequirePackage{textmerg} \fi \ifDelT \RequirePackage{delimtxt} \fi % \end{macrocode} % % We use a possibly very high header, so recalutate scrlettr layout ( a4paper only). % To get those foldmarks right, we calculate the position from the top of the paper. % |\foldhskip| adjusted for HP LJ5L. This can be done in the .cfg file. % % \begin{macrocode} \setlength{\voffset}{-5.5truemm} \setlength{\topmargin}{-1in} \addtolength{\topmargin}{10truemm} \setlength{\headheight}{27truemm} \setlength{\headsep}{4truemm} % \end{macrocode} % % calculate vertical skip for foldmarks from other length at the beginnig % of the document, as head height may be customized in the config file. % This has do be done after setting backadress in the .cfg-file. % \begin{macrocode} \AtEndOfClass{ \setlength{\foldvskipi}{101.5truemm} \setlength{\foldvskipii}{47.5truemm} % mk 960531 (war:40.5truemm) \setlength{\foldvskipiii}{58.5truemm} % mk 960531 (war:58.5mm) \setlength{\foldhskip}{6truemm} % adjust for printer % \end{macrocode} % % Calculate textheight from footheight. % % \begin{macrocode} \newlength{\footheight} \setlength{\footheight}{25truemm} \setlength{\textheight}{297truemm} } % End of AtEndofClass \AtBeginDocument{ } % \end{macrocode} % % Here are the defaults for some scrlettr macros. % They must be overriden in serial.cfg. % % \DescribeMacro{\signature} % \DescribeMacro{\place} % \DescribeMacro{\name} % \DescribeMacro{\location} % \DescribeMacro{\telephone} % \DescribeMacro{\backadress} % \begin{macrocode} %%------------ %% %% this is configurable in serial.cfg %% \signature{Please set this signature in your .cfg file} \place{Please set this place in your .cfg file} \name{Please set this name in your .cfg file} \address{Please set this address in your .cfg file } \location{Please set this location in your .cfg file} \telephone{Please set this telephone in your .cfg file} \backaddress{ Please set this backaddress in your .cfg file } % \specialmail{\ } % \end{macrocode} % \begin{macrocode} \DeclareRobustCommand{\MyFirstHead}{% \parbox[b]{0.99\textwidth} { \begin{minipage}[b]{98truemm} {\sffamily\bfseries\fontsize{4.1truemm}{6.0truemm}\selectfont \ignorespaces SOME NAME\\ Configure in your .cfg}% \end{minipage} \begin{minipage}[b]{48truemm}\hfill\parbox[b]{47.5truemm} {here would be a graphic} \end{minipage} }% } % \end{macrocode} % % \begin{macrocode} \DeclareRobustCommand{\MyFirstFoot}{% \parbox[t]{\textwidth} {\rule{\textwidth}{.4pt}\\[0.6ex]% \sffamily\tiny% You have to override this in your .cfg-file }% end of parbox }% \DeclareRobustCommand{\MyNextHead}{} \DeclareRobustCommand{\MyNextFoot}{} % \end{macrocode} % % \section{The serial letter implementation} % \subsection{Common macros} % % \DescribeMacro{\Anrede} % \DescribeMacro{\Wanredetext} % \DescribeMacro{\Manredetext} % In serial letters, we want to differentiate by sex , these macros will do it for us. No babel support, as for now. % These macros can be redeclared in the configuration file. % % \begin{macrocode} \DeclareRobustCommand{\Wanredetext}{Sehr geehrte Frau} \DeclareRobustCommand{\Manredetext}{Sehr geehrter Herr} \DeclareRobustCommand{\Anrede}{% \if \Geschlecht w \opening{\Wanredetext\ \Name,} \fi% \if \Geschlecht m \opening{\Manredetext\ \Name,} \fi% } % \end{macrocode} % \DescribeMacro{\Serial} % % The macro |\Serial{adrfilebasename}{letterbody}| will expand to either |\Seriala| or|\Serialx| as defined % by the class-options. % % \subsection{The KOMA-Script based version} % % \DescribeMacro{\Seriala} % Here starts the |\Seriala| macro. This is a simple wrapper of the approach used in scrlettr. % The the |komascr|-documentation for details. The support for draft modus has been added. % % In the example file, long lines have been split to allow inclusion in the documentation, % but this not required for normal use. % \begin{macrocode} \DeclareRobustCommand{\Seriala}[2]{ \def\@AddFile{#1.adr} \long\def\@body{#2} % This is the draft part \ifDraft \begingroup \global\advance\LetterCounter by1 \expandafter\def\csname Name\endcsname{\texttt{Name}} \expandafter\def\csname VorName\endcsname{\texttt{VorName}} \expandafter\def\csname Street\endcsname{\texttt{Street}} \expandafter\def\csname City\endcsname{\texttt{City}} \expandafter\def\csname Phone\endcsname{\texttt{Phone}} \expandafter\def\csname Geschlecht\endcsname{w} % to check \Anrede \expandafter\def\csname FreeII\endcsname{\texttt{FreeII}} \expandafter\def\csname Comment\endcsname{\texttt{comment}} \typeout{Addressfile: \@AddFile would be loaded.} \begin{letter}{\VorName\ \Name\\\Street\\[1.5ex]\City} \expandafter\noexpand\@body \end{letter} \endgroup% % end of draft part % This if the final part \else \begingroup \def\adrentry##1##2##3##4##5##6##7##8{% \global\advance\LetterCounter by1 \expandafter\def\csname Name\endcsname{##1} \expandafter\def\csname VorName\endcsname{##2} \expandafter\def\csname Street\endcsname{##3} \expandafter\def\csname City\endcsname{##4} \expandafter\def\csname Phone\endcsname{##5} \expandafter\def\csname Geschlecht\endcsname{##6} \expandafter\def\csname FreeII\endcsname{##7} \ifx\empty\FreeII \def\FreeII{\ } \fi \expandafter\def\csname Comment\endcsname{##8} \expandafter\begin{letter}{##2\ ##1\\##3\\[1.5ex]##4} \expandafter\noexpand\@body \expandafter\end{letter} } \InputIfFileExists{\@AddFile} {\typeout{Load addressfile: \@AddFile.}} {\PackageError{serial} {File \@AddFile not found} {The addressfile you wanted is not available}} \endgroup% % end of final part \fi } % \end{macrocode} %% %%--------------- %% % % \subsection{The textmerg-based version} % % \DescribeMacro{\Serialx} % This is the wrapper for the |textmerg|-package: % use a textmerg style inputfile with extension |.adt|, % containing the desired fields. % Default is: % %|\Name\VorName\Street\City\Phone\Geschlecht\FreeII\Comment| % % \DescribeMacro{\Fields} % The default can be overwritten using |\Fields{fields}| before the letter. % Further information can be found in the documentation for the % textmerge-package. % % \begin{macrocode} \Fields{\Name\VorName\Street\City\Phone\Geschlecht\FreeII\Comment} % \end{macrocode} % % The draft merge helper % In draft mode, we parse the |\Fields| macro and define each csname % to be its string expansion.( This should really go into |textmerg|/|delimtxt|.) % \begin{macrocode} \DeclareRobustCommand{\DraftMerge}[2]{% \typeout{The adressfile: #1 would be loaded} \begingroup \def\DParseFields##1{% \ifx##1\EndParseFields% \let\DNextParse\relax% \else% \let\DNextParse\DParseFields% \ifx##1+\relax% \else% \ifx##1-\relax% \else% \def##1{\string##1} \fi \fi \fi\DNextParse}% \let\EndParseFields\DParseFields \expandafter\DParseFields\the\Fields\EndParseFields \global\advance\Iteratecounter by1 \def\Geschlecht{w} % set for \Anrede -> \Wanredetext #2 \endgroup } % \DeclareRobustCommand{\Serialx}[2] { \def\@AddFile{#1\ext} \ifDraft %begin of draft part \DraftMerge{\@AddFile}{% \begin{letter}{\VorName\ \Name \\\Street\\[1.5ex]\City}% #2% \end{letter}% }% %end of draft part \else % begin of final part \MyMerge{\@AddFile}{% \begin{letter}{\VorName\ \Name \\\Street\\[1.5ex]\City}% #2% \end{letter}% }% % end of final part \fi } % \end{macrocode} % % At the end of the class we input the configuration file. This has to % be done before we set the header and footers to allow them to be customized % via the config file without extra macro invocations. % % \begin{macrocode} \AtEndOfClass{\InputIfFileExists{serial.cfg}% {\typeout{Loaded local configuration from serial.cfg}}% {\typeout{no local configuration in serial.cfg} \PackageError{serial}{Missing configuration file} {You should really create the % cfg-file as described in the documentation}}} % % Now recalculate the layout: \AtEndOfClass{ \addtolength{\foldvskipi}{-1in} \addtolength{\foldvskipi}{-\topmargin} \addtolength{\foldvskipi}{-\headsep} \addtolength{\foldvskipi}{-\headheight} \addtolength{\textheight}{-1in} \addtolength{\textheight}{-\topmargin} \addtolength{\textheight}{-\headsep} \addtolength{\textheight}{-\headheight} \addtolength{\textheight}{-\footheight} \newlength\@backheight \newlength\@backdepth \settoheight\@backheight{\frombackaddress} \settodepth\@backdepth{\frombackaddress} \addtolength{\foldvskipi}{-\@backheight} \addtolength{\foldvskipi}{-\@backdepth} \addtolength{\textheight}{-\@backheight} \addtolength{\textheight}{-\@backdepth} } %% End of file `serial.cls'. % \end{macrocode} % % % \section{The example files} % \subsubsection{Example letters} % % \begin{macrocode} %<*ex1> \documentclass[12pt,draft,adrentry]{serial} % %<*ex2> \documentclass[12pt,draft,merg]{serial} % %<*ex3> \documentclass[12pt,draft,delim]{serial} % %<*exa> \DeclareRobustCommand{\VerbX}[1]{\item[\texttt{\textbackslash#1}]} \begin{document} \date{\today} \Serial{examp}{ \subject{Test} \Anrede Hier sollte der Text des Briefes stehen. Folgende Makros stehen zur Verfügung: \begin{labeling}[:]{\texttt{\textbackslash Geschlecht}} \VerbX{Name} Ist der Nachname in der Adressendatei:\fbox{\Name} \VerbX{VorName} Ist der Vorname in der Adressendatei: \fbox{\VorName} \VerbX{Street} Ist die Strasse in der Adressendatei: \fbox{\Street} \VerbX{City} Ist die Stadt in der Adressendatei: \fbox{\City} \VerbX{Phone} Ist die Telephonnummer in der Adressendatei:\fbox{\Phone} \VerbX{Geschlecht} Ist das Geschlecht in der Adressendatei: \fbox{\Geschlecht} \VerbX{FreeII} Ist noch nicht zugewiesen in der Adressendatei:\fbox{\FreeII} \VerbX{Comment} Ist der Kommentar in der Adressendatei: \fbox{\Comment} \end{labeling} \closing{Hier kommt die Grußformel} }% ende von \Serial \end{document} % % \end{macrocode} % % \subsection{Example KOMA-Script data file} % % \begin{macrocode} %<*adr> \adrentry{Pedersen}{Bjoern}% {Some Street 1}{11111 Somewhere}% {11~00~00}{m}{}{Test Kommentar} \adrentry{Mustermann}{Ingrid}% {Anotherstreet 99}{99999 Elsewhere}% {99~99~99}{w}{Hier steht jetzt auch etwas}{Test} % % \end{macrocode} % \subsection{Example textmerge data file} % \begin{macrocode} %<*adt> Pedersen Bjoern Some Street 1 11111 Somewhere 11~00~00 m Test Kommentar Mustermann Ingrid Anotherstreet 99 99999 Elsewhere 99~99~99 w Hier steht jetz auch etwas Test % % \end{macrocode} % \begin{macrocode} %<*del> Pedersen|Bjoern|Some Street 1|11111 Somewhere|11~00~00|m| |Test Kommentar Mustermann|Ingrid|Anotherstreet 99|99999 Elsewhere|99~99~99|w|Hier steht jetz auch etwas|Test % % \end{macrocode} % \subsection{Example configuration file} % \begin{macrocode} %<*cfg> %% Some packages which may prove useful: remove comments as appropriate %%\RequirePackage[germanb]{babel} %%\RequirePackage[T1]{fontenc} %%\RequirePackage{inputenc} %%\RequirePackage[final]{graphicx} %%\RequirePackage{times} %% change certain sizes is allowed here: uncomment and adjust as necessary. %% The margin will be calculated from the top rim of the paper! %%\addtolength{\topmargin}{10truemm} %%\setlength{\headheight}{27truemm} %%\setlength{\headsep}{4truemm} %%\setlength{\foldhskip}{6truemm} % adjust for printer %%\setlength{\footheight}{25truemm} \signature{Your Name} \place{Your Place} \name{Your Name} \address{% Your adress name\\% Your Street\\[1.5ex]% Your location% } \location{\sffamily\scriptsize% Your Text for the location field } \telephone{Your Phone} \backaddress{\fontsize{7}{8}\selectfont\parbox{70truemm}% {Your Backaddress,\\ can even be two lines}\rule[-1ex]{0pt}{0pt}} \DeclareRobustCommand{\MyFirstHead}{% \parbox[b]{0.99\textwidth}% {% \begin{minipage}[b]{98truemm} {\sffamily\bfseries\fontsize{4.1truemm}{6.0truemm}\selectfont \ignorespaces Something for the letter head.}% \end{minipage}\hfil \begin{minipage}[b]{48truemm}% \hfill\vfill%\parbox[b]{47.5truemm}% {% % maybe ypu want a logo? %\includegraphics[width=47truemm]{logo.eps}% } \end{minipage} }% } \DeclareRobustCommand{\MyFirstFoot}{% \parbox[t]{\textwidth} {\rule{\textwidth}{.4pt}\\[0.6ex]% \sffamily\footnotesize% \begin{tabular}{lll} Vorstand:& Sparkasse & Raiffeisenbank \\% someone &BLZ 700\,530\,70 &BLZ 701\,693\,80\\% &Kto.-Nr.: 1\,11\,111 &Kto.-Nr.: 999\,999\,999% \end{tabular}% }% end of parbox }% \endinput % % \end{macrocode} %\Finale