1

I'm attempting to format a letter using the newlfm class. I have two questions:

  1. How do I align the top of the body text on first page with the margin text?
  2. How do I generate margin text to appear on the second and subsequent pages?

Here is a minimal working example that shows the problems I'm encountering:

\documentclass{newlfm}
\usepackage{blindtext}

\newlfmP{busletternofrom,noLines,nolines,dateskipbefore=0in}

\leftmarginskipleft{0.5in}
\leftmarginskipright{0.25in}
\rightmarginsize{1in}

\nameto{John Doe}
\addrto{P.O.~Box 1000 \\ Athens, AK 11111}
\namefrom{Mary Moe}
\closeline{Regards,}
\greetto{Dear Sir or Madam:}

\newsavebox{\Lfirstpagelet}
\sbox{\Lfirstpagelet}{%
  \parbox[t]{1.75in}{%
    \raggedleft
    \printnamefrom}}

\newsavebox{\Lpagelet}
\sbox{\Lpagelet}{%
  \parbox[t]{1.75in}{%
    \raggedleft
    Page \thepage}}

\Lmargin{\usebox{\Lfirstpagelet}}
\lmargin{\usebox{\Lfirstpagelet}}


\begin{document}
  \begin{newlfm}

    \PhrRe{This is a test}

    \Blindtext[5]

  \end{newlfm}
\end{document}

Notice that on the first page, "Mary Moe" and the date are not vertically aligned. I would like them to be.

Notice also that on the second page, nothing appears in the left margin. I would like something to appear there (ideally with the page number).

EDIT: Here's a mockup of what I hope the end result will be.Mock-Up

4
  • I'd advice against newlfm. Can you provide a visual (perhaps using some other word processing software like MS Word) of what your expected output should look like?
    – Werner
    Apr 5, 2017 at 3:31
  • I've added a mockup. I prefer a solution using newlfm because of its other features, but I would also be interested in your thoughts on the best way to generate similar output using other classes/packages.
    – J. King
    Apr 5, 2017 at 15:53
  • What other features?
    – Werner
    Apr 5, 2017 at 16:08
  • I would also like to use the letter database features described in the newlfm manual in Section 7.
    – J. King
    Apr 5, 2017 at 16:27

1 Answer 1

1

I'd use the default article class instead of trying to "make things work" with newlfm.

The example below uses the following:

  • Default article class

  • geometry for adjusting the text block dimensions

  • eso-pic for placing the Page X page number from page two onward to the left of the top-left corner of the text block

  • datatool to provide a way of writing one letter with multiple senders/recipients (and whatever else is needed) in line with the "letter database features" offered by newlfm.

enter image description here

\documentclass{article}

\usepackage{filecontents,datatool}
% Set up your database of mail merge content (in CSV)
\begin{filecontents*}{mail_merge.csv}
letternum, fromperson, toperson, toaddress
1, Mary Moe, John Doe, PO Box 1000 \\ {Athens, AK 11111}
2, Jane Doe, Rumplestiltskin, Castle ABC \\ {Neverland, NL 54321}
\end{filecontents*}

\usepackage{lipsum}% Just for this example
\sloppy% Just for this example

% Set up your document layout
\usepackage[margin=1in,left=2in,includeheadfoot]{geometry}
\usepackage{eso-pic}% Used to place the page number

\setlength{\parindent}{0pt}% Remove paragraph indent
\setlength{\parskip}{1\baselineskip plus 2pt minus 1pt}% Big skip between paragraphs

% Placement of the page number...
\AddToShipoutPictureFG{%
  \AtTextUpperLeft{%
    \ifnum\value{page}>1 % ...only on pages 2, 3, ...
      \raisebox{-.85\baselineskip}{\makebox[0pt][r]{Page \thepage~~~}}%
    \fi
  }%
}
\pagestyle{empty}% Don't place anything in the header/footer

% Load the mail merge database
\DTLloaddb[keys={letternum,fromperson,toperson,toaddress}]{mailmerge}{mail_merge.csv}

% Extract a record of choice...
\DTLassign{mailmerge}{2}% ... like record 2 in this case
  {\letternum=letternum,\fromperson=fromperson,\toperson=toperson,\toaddress=toaddress}

\begin{document}

\makebox[0pt][r]{\fromperson~~~}%
\today

\bigskip

\begin{tabular}{@{} l}
  \toperson \\
  \toaddress
\end{tabular}

\bigskip

Dear Sir or Madam:

\bigskip

\lipsum[1-6]

\bigskip

Regards,

\vspace{4\baselineskip}

\fromperson

\end{document}

Since addresses may have commas in them, {brace} the content that should fall under the same heading.

2
  • Thank you! This solution answers my question directly. Do you have any suggestions if the margin text (in this case the letter author on page 1 and the page number) should run more than one line?
    – J. King
    Apr 7, 2017 at 17:08
  • @J.King: Sure. This was produced using this paste. Setting the margin content in a [t]op-aligned tabular is one way of achieving this. It may depend on what you want to place there and how many lines, but it's doable.
    – Werner
    Apr 7, 2017 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .