[Tex/LaTex] Easily aligning ‘from’ and ‘to’ address fields in LaTeX letters

formattinglettersvertical alignment

When you write a letter in LaTeX, you can add your address with the \address block, while you have the possibility of adding the recipient address after the \begin{letter} statement as an extra argument. However, in such case, your address will always come above the recipient address.

Is there a way to tell LaTeX that I want my address to begin in the same line as the recipient's address? Or, more generally, is there a way to control the distances of these fields from the top of the page in a more flexible way?

Bonus question: is there a way to tell LaTeX that I don't want to have an extra blank line between my address and the date of the letter? (Or, again, more generally: to fine-tune the distance between the sender's address and the date field?)

Best Answer

You can do this be redefining the \opening command to produce:

enter image description here

I also removed the blank line before that date. If you want to adjust this space before the date replace the value in \fromaddress\\[0.0em]:

\documentclass{letter}
\usepackage{lipsum}% for dummy text

\makeatletter
\renewcommand*{\opening}[1]{\ifx\@empty\fromaddress%
  \thispagestyle{firstpage}%
    {\raggedleft\@date\par}%
  \else% home address
   \thispagestyle{empty}%
   {%
    \begin{minipage}[c]{0.50\linewidth}
    \toname \\
    \toaddress
    \end{minipage}
    \begin{minipage}[c]{0.45\linewidth}
    \raggedleft\begin{tabular}{l@{}}\ignorespaces
    \fromaddress\\[0.0em]% replace 0.0em with space desired before date
    \@date
    \end{tabular}
    \end{minipage}
    \par
}%
  \fi
  \vspace{2\parskip}%
  #1\par\nobreak}
\makeatother

\address{123 Main Street \\ Anytown \\ USA 90210}

\begin{document}
\begin{letter}{Siska Adam \\ 123 Some Street \\ TeXLand \\ IP3 5RT}

\opening{Dear Sir or Madam:}

\lipsum[1]
\end{letter}
\end{document}

Alternatively, since you were under a deadline, you could just have manually done this:

\documentclass{letter}
\usepackage{lipsum}

\begin{document}
\begin{letter}{}
\begin{tabular}{@{}p{3.0in}l}
Siska Adam        & Mr. T\\
123 Some Street   & 123 Main Street\\
TeXLand           & Anytown, USA 90210\\
IP3 5RT           & \today
\end{tabular}

\bigskip
Dear Sir or Madam:

\lipsum[1]
\end{letter}
\end{document}

See How can I insert address blocks on the left and right side of the page? for other options on how to do this manually.