# Multiple recipients using tabular in letter class

When I try to use tabular to accommodate multiple addressees using the letter class, the pdf renders, but I get the error:

line 32: Argument of \@no@pgbk has an extra }. \end{letter}
line 32: Paragraph ended before \@no@pgbk was complete. \end{letter}


MWE:

\documentclass[letterpaper,  11pt]{letter}

\usepackage{lipsum}

\begin{document}

\begin{letter}{\begin{tabular}{p{5cm}p{5cm}}
\end{tabular}}

\lipsum[1]

\vspace{12pt}

\closing{Yours faithfully,\\
\fromsig{THISISME\\}
\fromname{ME\\Title1\\title2}
}

\end{letter}

\end{document}


Note that when I comment out the begin{letter} lines that use the tabular, and pop the vanilla line that's commented, all works.

Any insight at to what's going on and whether I can fix it?

UPDATE:

\documentclass[firsthead=no,pagenumber=topleft, headsepline=yes, 11pt,paper=letter,foldmarks=no,refline=nodate,enlargefirstpage=no,parskip=half,DIV=11]{scrlttr2} %refline=nodate
% stolen from https://tex.stackexchange.com/questions/302281/using-mathpazo-with-scrlttr2-not-globally-changing-font

\usepackage[english]{babel}

%\usepackage{scrlayer-scrpage}
\usepackage{blindtext}
\usepackage{tabularx}
\usepackage{tikz}
\KOMAoptions{DIV=last}

\setkomavar{signature}{This is me\\Lord High Muckety Muck}

\setkomavar{enclseparator}{: }
\setkomavar{location}{\par\raggedleft{\usekomavar{date}}}

\LetterOptionNeedsPapersize{letter}{letter}
\KOMAoptions{DIV=last}

\makeatletter
\@setplength{toaddrindent}{10pt }  %indent the To Address a little bit
\@setplength{lochpos}{\oddsidemargin } %make date in location area align to text
\@setplength{locvpos}{2in}
\@setplength{locheight}{.5in}
\@setplength{refaftervskip}{0in }
\@setplength{refvpos}{5in }  % This will move the message body UP or DOWN
\@setplength{subjectbeforevskip}{0pt}
\@setplength{subjectaftervskip}{0pt}
\@setplength{sigindent}{3in}  %indent of signature

\makeatother

\renewcommand*{\raggedsignature}{\raggedright}
\setlength{\parindent}{1em}

\renewcommand{\pagemark}{{Recipient, page \usekomafont{pagenumber}{\thepage}}}  %%Change recipient name here

\begin{document}
\begin{letter}{\begin{tabularx}{5in}{XX}

a&b  % <======  This works

%       a&b \\
%       c&d           <+++++++++ Two row tabular doesn't work

\end{tabularx}}

%   \setkomavar{subject}{Subject}fDIV=
\KOMAoptions{DIV=last}
\opening{Respected marmots,}

\blindtext

{\begin{tabularx}{5in}{XX}

a&b \\
c&d

\end{tabularx}}

\Blindtext

\closing{Sincerely}
\end{letter}
\end{document}


I tried the scrlttr2 option described below. It worked wonderfully with a 1-row tabularx for the address, but it crashed and burned for a two-row (which you can see by commenting the one-row table and uncommenting the two-row). This gives a (first) error msg of

Argument of \TX@get@body has an extra }. \opening{Respected marmots,}, followed by a whole mess more.

• ... not if you replace \ by \cr, see my updated answer before. BTW, I needed to comment out the babel package, but there might be something wrong with my TeX installation (which I updated just today).
– user121799
Dec 12, 2017 at 0:41

You want something non-boilerplate, which the letter class is not built for, mostly because it makes some assumptions about the content you'll supply. Specifically, the (first) argument of the letter is processed in order to extract information, like the addressee's name and address. As soon as you start doing something else there, you could run into problem.

A possible solution is to build a letter from scratch - it's straight-forward:

\documentclass[11pt]{article}

\usepackage{geometry,lipsum}
\geometry{
margin=1in % or whatever suits you
}

\setlength{\parindent}{0pt}% Remove paragraph indent

\begin{document}

\pagestyle{empty}% Remove page headers/footers

\mbox{}\hfill
\begin{tabular}{l @{}}
of \\
Sender \\ \\
\today
\end{tabular}

\bigskip % Vertical skip between sender/receiver address

\begin{tabular}[t]{@{} l}
Name and \\
of \\
\begin{tabular}[t]{@{} l}
Name and \\
of \\
\end{tabular}

\bigskip % Vertical skip between receive address and letter opening

\medskip % Vertical skip between letter opening and letter body

\lipsum[1]

\medskip % Vertical skip between letter body and closing

%\hspace*{.5\linewidth}% ...for a middle-left-aligned closing
Yours faithfully,

\medskip % Vertical skip between letter closing and signature start

\vspace{5\baselineskip} % Content that includes your signature, or space for it

My signature

\bigskip % Vertical skip between signature and attachment references

cc: % people this letter is cc-ed to

\medskip

encl: % list of anything enclosed

\medskip

ps: % any post scriptums

\end{document}


This is not a solution, but a workaround.

\documentclass[letterpaper,  11pt]{letter}

\usepackage{lipsum}

\begin{document}

\begin{letter}{{\makebox[5cm][l]{marmot1}}\makebox[5cm][l]{marmot2}\\
\makebox[5cm][l]{mountain1}\makebox[5cm][l]{mountain2}
}

\lipsum[1]

\vspace{12pt}

\closing{Yours faithfully,\\
\fromsig{THISISME\\}
\fromname{ME\\Title1\\title2}
}

\end{letter}

\end{document}


EDIT/UPDATE If you are open to a different document class, you may try

\documentclass{scrlttr2}
% stolen from https://tex.stackexchange.com/questions/302281/using-mathpazo-with-scrlttr2-not-globally-changing-font
\usepackage{blindtext}

\setkomavar{fromname}{From Name}
\setkomavar{fromaddress}{From Street\\00000 From City}
\setkomavar{fromphone}{+49 0000 0\,00\,00\,00}
\setkomavar{fromemail}{from.name@mail.com}
\setkomavar{signature}{(From Name)}
\setkomavar{place}{From City}
\setkomavar{date}{\today}
\setkomavar{enclseparator}{: }

\begin{document}
\begin{letter}{\begin{tabular}{p{4cm}p{4cm}}
Murmeltier\newline Saas Fee\newline Switzerland &
Marmot\newline Vancouver Island\newline  Canada
\end{tabular}}
\setkomavar{subject}{Subject}
\opening{Respected marmots,}

\blindtext

\closing{Sincerely,}
\end{letter}
\end{document}


OK, another round. I find that tabularx also works if one uses \cr (which is deprecated, right;-) instead of \\.

\documentclass[firsthead=no,pagenumber=topleft, headsepline=yes, 11pt,paper=letter,foldmarks=no,refline=nodate,enlargefirstpage=no,parskip=half,DIV=11]{scrlttr2} %refline=nodate
% stolen from https://tex.stackexchange.com/questions/302281/using-mathpazo-with-scrlttr2-not-globally-changing-font

%\usepackage[english]{babel} % I had to comment this out.

%\usepackage{scrlayer-scrpage}
\usepackage{blindtext}
\usepackage{tabularx}
\usepackage{tikz}
\KOMAoptions{DIV=last}

\setkomavar{signature}{This is me\\Lord High Muckety Muck}

\setkomavar{enclseparator}{: }
\setkomavar{location}{\par\raggedleft{\usekomavar{date}}}

\LetterOptionNeedsPapersize{letter}{letter}
\KOMAoptions{DIV=last}

\makeatletter
\@setplength{toaddrindent}{10pt }  %indent the To Address a little bit
\@setplength{lochpos}{\oddsidemargin } %make date in location area align to text
\@setplength{locvpos}{2in}
\@setplength{locheight}{.5in}
\@setplength{refaftervskip}{0in }
\@setplength{refvpos}{5in }  % This will move the message body UP or DOWN
\@setplength{subjectbeforevskip}{0pt}
\@setplength{subjectaftervskip}{0pt}
\@setplength{sigindent}{3in}  %indent of signature

\makeatother

\renewcommand*{\raggedsignature}{\raggedright}
\setlength{\parindent}{1em}

\renewcommand{\pagemark}{{Recipient, page \usekomafont{pagenumber}{\thepage}}}  %%Change recipient name here

\begin{document}
\begin{letter}{\begin{tabularx}{5in}{XX}
a & b\cr
c & d       %    <+++++++++ Two row tabular doesn't work
\end{tabularx}}

%   \setkomavar{subject}{Subject}fDIV=
\KOMAoptions{DIV=last}
\opening{Respected marmots,}

\blindtext

{\begin{tabularx}{5in}{XX}

a&b \\
c&d

\end{tabularx}}

\Blindtext

\closing{Sincerely}
\end{letter}
\end{document}

• It is a workaround, but having to shuffle the lines of each address together is a chore. Dec 11, 2017 at 0:41
• @ScottSeidman I agree, but it is not too different in effort from separating the entries by \newline commands. It is (probably) not too different from writing a macro that does the reshuffling, but I am suspecting that there must be a better solution.
– user121799
Dec 11, 2017 at 0:55
• The update is particularly interesting. I hadn't ever considered using KOMA scripts, but this is certainly worth a look. Already figured out how to move the date above the addresses. Dec 11, 2017 at 14:35
• The scrlttr2 works really well for a one-row tabularx, but when I tried to add rows to the tabular, it crashed and burned Dec 12, 2017 at 0:12
• There are two tables in there in one tabularx. It runs the way it is, but if you comment out the one-row entry and uncomment the two-row, it crashes. I haven't tried it as a tabular. I suppose that's next. Dec 12, 2017 at 0:17