Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?)

share|improve this question

migrated from stackoverflow.com Nov 1 '11 at 1:13

This question came from our site for professional and enthusiast programmers.

3  
Which document class are you using? The scrlttr2 class (from the KOMA-script package) is quite flexible with lots of settings. –  Paŭlo Ebermann Nov 1 '11 at 1:00
    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Nov 1 '11 at 5:13
    
Hi, I had a look to the scrlttr2 class, but it seems too complicated to be used as a simple work-around if one doesn't know the KOMA-scripts. I need something that would work quite simple, as I need to send this letter as soon as I can. It would be nice to learn about this 'KOMA-script package', but maybe at some time when I have the time to read the documentation... Oh, and yes, I tried the simple way of replacing the letter class with scrltt2, but of course it didn't compile, so probably one really needs to know the docs before using that class... –  Siska Ádám Nov 1 '11 at 11:48
    
It is always best to compose a MWE that illustrates the problem including the \documentclass so that those trying to help don't have to recreate it. –  Peter Grill Nov 1 '11 at 18:05

1 Answer 1

up vote 9 down vote accepted

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.

share|improve this answer
    
I'm out of votes for today -- you'll have my upvote tomorrow. :-) –  lockstep Nov 1 '11 at 20:22
    
Thank you. This will help until I get my time to learn KOMA. And +1 point for letting me know about the lipsum package, which is FUN. :-) –  Siska Ádám Nov 2 '11 at 7:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.