4

I need to place the right-side address differently in my .tex file but I can not figure out how to do. What I would like is to have the last line from the right-placed address at the same line as the first line of left-placed address. How is that possible ?

Here is my snippet code :

% !TeX encoding = utf8

\documentclass[a4paper]{letter}
\usepackage[lmargin=20mm, rmargin=20mm]{geometry}

\begin{document}
\begin{letter}{
            Nom\\
            Adresse 1\\
            Adresse 2\\
            Ville\\
            Pays\\
            Code Postal\\
            \vspace{0.5cm}
            Date}

\address{
            Nom\\
            Adresse 1\\
            Adresse 2\\
            Ville\\
            Pays\\
            Code Postal\\}

\date{}

\opening{Opening}

\closing{\mbox{}}

\end{letter}
\end{document}

When I compile that, I have two different address blocks (one on the left, and one on the right), but I would like to pull down the right one by playing with its position.

Any ideas how can I do that ?

Thank you.

5
  • I don't know the details of the letter class, buts as you seem to be a French-speaking user of LaTeX, may be you should use the lettre class which suits better the French habits and is well documented.
    – Bernard
    Commented Apr 21, 2014 at 11:15
  • @FlorentP: Perhaps the french style of lettre is the key to the solution, unfortunately, my knowledge of French is very limited and I do not know of specific style issues concerning letters in french language.
    – user31729
    Commented Apr 22, 2014 at 9:18
  • @ChristianHupfer, Hi Christian, thanks for answering. Actually no need to use french here, I could totally replace "Nom", "Adresse", Ville" etc.. by "Name", "Address", and "Town" for example. I just need to use the letter class here, and then align my right-side address as shown in the picture. Any ideas?
    – hacks4life
    Commented Apr 22, 2014 at 9:20
  • 1
    @FlorentP: See egregs answer, I think, you can rely on his posts! ;-)
    – user31729
    Commented Apr 22, 2014 at 9:21
  • @ChristianHupfer, I have just seen his answer. That's brilliant !
    – hacks4life
    Commented Apr 22, 2014 at 9:28

1 Answer 1

5

There is no parameter for changing that vertical space, so the only way is to redefine the \opening command; the place to act upon is marked by <-----.

\documentclass[a4paper]{letter}
\usepackage[lmargin=20mm, rmargin=20mm]{geometry}
\usepackage{lipsum}

\makeatletter
\renewcommand*{\opening}[1]{\ifx\@empty\fromaddress
  \thispagestyle{firstpage}%
    {\raggedleft\@date\par}%
  \else  % home address
    \thispagestyle{empty}%
    {\raggedleft\begin{tabular}{l@{}}\ignorespaces
      \fromaddress \\*[2\parskip]%
      \@date \end{tabular}\par}%
  \fi
  \vspace{-5\parskip}% <------- was 2\parskip
  {\raggedright \toname \\ \toaddress \par}%
  \vspace{2\parskip}%
  #1\par\nobreak}
\makeatother

% the following definitions are just for showing the spaces
\protected\def\rightrule{\leavevmode\rlap{\vrule width \textwidth height 0.1pt depth 0.1pt}}
\protected\def\leftrule{\leavevmode\llap{\vrule width \textwidth height 0.1pt depth 0.1pt}}

\begin{document}
\begin{letter}{
            \rightrule Nom\\
            Adresse 1\\
            Adresse 2\\
            Ville\\
            Pays\\
            Code Postal\\
            \vspace{0.5cm}
            Date}

\address{
            Nom\\
            Adresse 1\\
            Adresse 2\\
            Ville\\
            Pays\\
            \leftrule Code Postal\\}

\date{}

\opening{Opening}

\lipsum

\closing{\mbox{}}

\end{letter}
\end{document}

The two commands \rightrule and \leftrule are just for showing the relative positions and aren't necessary for a normal job.

enter image description here

You may try scrlettr2 or lettre.

4
  • Hey egreg, thank you so much that's perfect ! I am going to play a little bit with those two classes you've just suggested, I think this could be a better option than the actual letter classe. Thanks again !
    – hacks4life
    Commented Apr 22, 2014 at 9:30
  • By the way, how did you draw those line ? Is there a way to hide them ? And last question, do you know how I can align to the right my right-side address? (see the Edit in my question)
    – hacks4life
    Commented Apr 22, 2014 at 9:44
  • 1
    @FlorentP Just remove \rightrule and \leftrule; for right alignment change \begin{tabular}{l@{}}\ignorespaces into \begin{tabular}{r@{}}\ignorespaces
    – egreg
    Commented Apr 22, 2014 at 9:46
  • Perfet, just removed it, it worked. Thanks again for the right alignment it worked too. Thank you very much egreg !!
    – hacks4life
    Commented Apr 22, 2014 at 9:47

You must log in to answer this question.

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