[Tex/LaTex] Multiple recipients using tabular in letter class

letterstables

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}

%\def \fromaddress{\null}   



\begin{document}

\begin{letter}{\begin{tabular}{p{5cm}p{5cm}}
            {addressname\newline{}line1\newline{}line2} &
            {addressname2\newline{}line1\newline{}line2} 
        \end{tabular}}

%   \begin{letter}{recip1\\address1\\address2}  %<==== This line works
    \opening{Dear my addressees:}



    \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}


%\ihead{Recipient }



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

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

\LetterOptionNeedsPapersize{letter}{letter}
%\setkomafont{backaddress}{\normalfont}
\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
\@addtoplength{lochpos}{1in}
\@setplength{locvpos}{2in}
\@setplength{locheight}{.5in}
\@setplength{toaddrheight}{3.75in }
\@setplength{refaftervskip}{0in }
\@setplength{refvpos}{5in }  % This will move the message body UP or DOWN
\@setplength{subjectbeforevskip}{0pt}
\@setplength{subjectaftervskip}{0pt}
%\@addtoplength{subjectvpos}{-20pt}
\@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}
%       \ThisULCornerWallPaper{1}{letterhead.pdf}
  \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.

Best Answer

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:

enter image description here

\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 @{}}
  Address \\
  of \\
  Sender \\ \\
  \today
\end{tabular}

\bigskip % Vertical skip between sender/receiver address

\begin{tabular}[t]{@{} l}
  Name and \\
  Address \\
  of \\
  Receiver 1
\end{tabular} \quad
\begin{tabular}[t]{@{} l}
  Name and \\
  Address \\
  of \\
  Receiver 2
\end{tabular}

\bigskip % Vertical skip between receive address and letter opening

Dear adressees,

\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}