You can build your TeX database, based on your needs simply by creating a list to hold the list of persons you sending your mailing. We will create a list with fields as shown in the table below, will also keep it sorted to make life easier.
This is done by creating first an empty list \let\alist\@empty
The format of the input file, is best to be in TeX format, to make the programming easier and to enable the use of a comma in the addresses. I have used the following format for capturing the fields, but please feel free to use your own:
\RB Nisbet|John|Mr.| 235, Highlands, Scotland | United Kingdom;
\RB Guevara|Che|Dr.| 527 Main Street, Havana | Cuba;
\RB Zapata|Emiliano|Mr.| 5237, Mexico City | Mexico;
\RB von Kleist-Schmenzin|Herr| Ewald| Greens, Dubberow| Germany;
Names are delimited by "|" and an ending semicolon. The standard part of the letter is on a separate file called stdletter.dat
. I have generated it on the fly using the filecontents
package. The MWE example is shown below.
\documentclass{article}
\usepackage{lstdoc,booktabs,filecontents}
\begin{filecontents}{stdletter.dat}
We are happy to enclose our new catalogue.
\vspace{20pt}
Regards,
\vspace{20pt}
Some CEO
\end{filecontents}
\begin{document}
\pagestyle{plain}
\makeatletter
\let\alist\@empty
\let\blist\@empty
\def\addtolist#1#2{%
\lst@lAddTo#1{#2}
}
\def\addtolist#1#2{%
\lst@lAddTo#1{#2}
}
\def\RB#1|#2|#3|#4|#5;{%
\addtolist{\alist}{#1#2,}%
% macro for table
\expandafter\gdef\csname#1#2@table\endcsname{\textit{#1}\cr\relax}
% macro for salutation
\expandafter\gdef\csname#1#2@salut\endcsname{Dear #3 #2\relax}
\lst@BubbleSort{\alist}
}
%% adding the data now
\RB Nisbet|John|Mr.| 235, Highlands, Scotland | United Kingdom;
\RB Guevara|Che|Dr.| 527 Main Street, Havana | Cuba;
\RB Zapata|Emiliano|Mr.| 5237, Mexico City | Mexico;
\RB von Kleist-Schmenzin|Herr| Ewald| Greens, Dubberow| Germany;
%% typesetting the table
\def\addresslist{%
\newsavebox{\tempbox}
\savebox{\tempbox}{
\centering
\begin{tabular}{llll}
\toprule[1pt]
First Name & Second Name & Salutation & Address\\
\midrule
\@for\i:=\alist \do{\csname\i @table\endcsname}
\vspace{-14pt}\\\bottomrule
\end{tabular}}
\begin{table}
\usebox{\tempbox}
\caption{Client List}
\end{table}
}
\addresslist
\mbox{}\newpage
\@for\i:=\alist \do{\csname\i\endcsname
\csname\i \endcsname
\expandafter\csname \i @salut\endcsname
\par\medskip
\input{stdletter.dat}
\pagebreak
}
\makeatletter
\end{document}
The "article" part can be created the same way or preferably printed separately and resetting page numbering (much easier).
Try adjusting the vertical position of the "address" layer:
\setupletterlayer[address][alternative=example,y=8cm,]
and adjusting the vertical position of the "reference" layer, which includes the date:
\setupletterlayer[reference][y=5cm]
and see http://www.ntg.nl/pipermail/ntg-context/2013/074165.html
\usemodule[letter]
\starttext
\setupletter
[name={Hazy Smoke},
address={My Address Line One\\My Address Line Two\\My Address Line Three},
toname={Mr.\ So-and-so},
toaddress={Address Line 4\\Address Line 5\\Address Line 6}]
\defineletterelement[layer][location][example]{\correspondenceparameter{address}\par}
\setupletterlayer[location][alternative=example,y=2cm,x=30mm]
\defineletterelement[layer][addressee][example]%
{\correspondenceparameter{toname}\\\correspondenceparameter{toaddress}\par}
\setupletterlayer[addressee][alternative=example,y=8cm,]
%% Delete the word "Date"
\setuplettertext[en][date=]
%% Move the date line so that it starts 8 cm from the top of the page
\setupletterlayer[reference][y=8cm]
\startletter
[opening={Dear \correspondenceparameter{toname}},
closing={Sincerely,},
signature={\correspondenceparameter{name}}]
How have you been? I've doing great!
\stopletter
\stoptext
Best Answer
The letter ending rolls over to a subsequent page. If you wish it to remain on a single page, then you need to reduce the content you currently have.
The distance between the header and the start of the address block is consumed by lengths like
\headermarginskip
,\datebeforeskip
and\dateafterskip
. Setting any one of these to an appropriate negative value will push up the content.The date in
newlfm
is set using\dateset
. I would suggest, if you plan on requiring an alignment with the "from" address, to include the date there using\today\\[<len>]
(where you specify an appropriate length<len>
to separate the date from the address, if needed) and use\dateset{}
(to remove the traditional date setting.On a related note, you can also obtain the formatting you want without sticking to structure provided by
newlfm
. Here's a take on such a document structure, written in thearticle
class:I find the readability of the code to be easier. The sequence of input matches the output, rather than a scattered preamble for specifying content that makes its way into the start/end of the
newlfm
environment. There is, of course, alsomoderncv
, which provides a similar layout.If you wish to add a personalized signature to your letter, consider reading Adding a signature on an online job application.