2

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.

1
  • 1
    ... 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
    Commented Dec 12, 2017 at 0:41

2 Answers 2

2

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

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]{address1}\makebox[5cm][l]{address2}\\
\makebox[5cm][l]{mountain1}\makebox[5cm][l]{mountain2}
}

 \opening{Dear my addressees:}


    \lipsum[1]


\vspace{12pt}

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


\end{letter}

\end{document}

enter image description here

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}

\LoadLetterOption{DIN}
\setkomavar{fromname}{From Name}
\setkomavar{fromaddress}{From Street\\00000 From City}
\setkomavar{fromphone}{+49 0000 0\,00\,00\,00}
\setkomavar{fromemail}{[email protected]}
\setkomavar{backaddressseparator}{\enspace\textperiodcentered\enspace}
\setkomavar{signature}{(From Name)}
\setkomavar{place}{From City}
\setkomavar{date}{\today}
\setkomavar{enclseparator}{: }

\setkomafont{backaddress}{\normalfont}

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

enter image description here

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}


%\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\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}
5
  • It is a workaround, but having to shuffle the lines of each address together is a chore. Commented Dec 11, 2017 at 0:41
  • 1
    @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
    Commented 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. Commented 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 Commented 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. Commented Dec 12, 2017 at 0:17

You must log in to answer this question.

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