Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

right alignment in \address - letter class

1,598 views
Skip to first unread message

alb

unread,
Nov 25, 2013, 10:48:53 AM11/25/13
to
Hi everyone,
I'm not extremely proficient in LaTeX but I thought this was a very
simple task and yet I have some issues.

I want to write my address right aligned in my letter

<code>
\documentclass{letter}

\signature{myself}

\address{
123 this \\
is my \\
home \\
address}

\begin{document}

\begin{letter}

% my letter here...

\end{letter}
\end{document}

</code>

I've so far tried the \flushright environment, minipage, and I've
followed a suggestion on StackExchange:
http://stackoverflow.com/questions/2538173/latex-letter-address-right-aligned

But every one introduced an additional page to my letter as if there was
a \newpage 'before' the document started.

I'm using TeXnicCenter with MikTeX 2.9 and I haven't tested this under a
*nix box.

Any suggestions/pointers?
Thanks a lot,

Al

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Herbert Schulz

unread,
Nov 25, 2013, 11:16:05 AM11/25/13
to
Howdy,

Does

{\raggedleft
123 this\\
is my\\
home\\
address
\par}

do the job?

--
Good Luck,
Herb Schulz

alb

unread,
Nov 26, 2013, 6:13:05 AM11/26/13
to
Hi Herbert,

On 11/25/2013 5:16 PM, Herbert Schulz wrote:
[]
>> I want to write my address right aligned in my letter
>>
>> <code>
>> \documentclass{letter}
>>
>> \signature{myself}
>>
>> \address{
>> 123 this \\
>> is my \\
>> home \\
>> address}
>>
>> \begin{document}
>>
>> \begin{letter}
>>
>> % my letter here...
>>
>> \end{letter}
>> \end{document}
>>
>> </code>
[]
> Howdy,
>
> Does
>
> {\raggedleft
> 123 this\\
> is my\\
> home\\
> address
> \par}
>
> do the job?
>

Nope. Still same problem, I have the address right aligned but then an
additional page is created, as if there's a hard pagebreak somewhere...

Herbert Schulz

unread,
Nov 26, 2013, 8:21:48 AM11/26/13
to
Howdy,

Well, it certainly isn't the what I gave that is doing that. Take a
look at the document class and see what's happening there.

alb

unread,
Nov 27, 2013, 9:49:09 AM11/27/13
to
Hi Herbert,

On 11/26/2013 2:21 PM, Herbert Schulz wrote:
[]
>>> {\raggedleft
>>> 123 this\\
>>> is my\\
>>> home\\
>>> address
>>> \par}
>>>
>>> do the job?
>>>
>>
>> Nope. Still same problem, I have the address right aligned but then an
>> additional page is created, as if there's a hard pagebreak somewhere...
>
> Howdy,
>
> Well, it certainly isn't the what I gave that is doing that. Take a look
> at the document class and see what's happening there.

I'm assuming the code you provide was supposed to go in the preamble, is
that correct?

Anyway, I tried it both in the document environment and in the preamble
but there was no difference, still a pagebreak right after the address.

Looking at the document class there's very little I can say, here it is:

<code>
\documentclass{letter}

% Adjust margins for aesthetics
\addtolength{\voffset}{-0.5in}
\addtolength{\hoffset}{-0.3in}
\addtolength{\textheight}{2cm}
</code>

I doubt that any of the previous commands might cause this... but, as
said, I'm far from being a LaTeX expert and I might have easily
overlooked something.

Al

Herbert Schulz

unread,
Nov 27, 2013, 10:17:59 AM11/27/13
to
Howdy,

It should go in the letter body. That code simply created an ordinary
paragraph that is forced against the right margin via the \raggedleft
command. The final \par ends the paragraph and you control the lines
using \\ within the paragraph. There is NOTHING that forces a pagebreak.

alb

unread,
Nov 27, 2013, 11:10:02 AM11/27/13
to
Hi Herbert,

On 11/27/2013 4:17 PM, Herbert Schulz wrote:
[]
>>>>> {\raggedleft
>>>>> 123 this\\
>>>>> is my\\
>>>>> home\\
>>>>> address
>>>>> \par}
[]
> It should go in the letter body. That code simply created an ordinary
> paragraph that is forced against the right margin via the \raggedleft
> command. The final \par ends the paragraph and you control the lines
> using \\ within the paragraph. There is NOTHING that forces a pagebreak.

Oops. I never tried it in the letter body... my bad!
There's a strange thing though, the signature and closing are left
aligned while prior to this change they were somewhat to the right of
the center.

Any ideas why this may happen?

Al

Herbert Schulz

unread,
Nov 27, 2013, 11:44:54 AM11/27/13
to
Howdy,

I'm quite sure the letter environment does a \newpage since you can
have multiple ``letters'' created within a single document.

Markus Kohm

unread,
Nov 28, 2013, 8:01:26 AM11/28/13
to
alb (Montag, 25. November 2013 16:48):

> I want to write my address right aligned in my letter

Do you realy want it right aligned or simply a letter with address at the
right side following the Swiss Norm SN 010130, like:

\documentclass[a4paper,SN]{scrlttr2}
\usepackage[english]{babel}
\usepackage{lipsum}
\setkomavar{fromname}{myself}
\setkomavar{fromaddress}{somewhere}

\begin{document}
\begin{letter}{You\\there}
\opening{Hi,}
\lipsum
\closing{Bye}
\end{letter}
\end{document}

For more examples see the KOMA-Script manual, scrguien.pdf, chapter 4.

Markus Kohm
--
KOMA-Script, a versatile bundle of classes and packages for LaTeX2e
Current: KOMA-Script 3.11b (see <http://www.komascript.de/release> in
German)

alb

unread,
Nov 29, 2013, 3:53:13 AM11/29/13
to
On 11/28/2013 2:01 PM, Markus Kohm wrote:
> alb (Montag, 25. November 2013 16:48):
>
>> I want to write my address right aligned in my letter
>
> Do you realy want it right aligned

I do not know if this is 'against' any sort of norm or etiquette but I'd
like it better right aligned on the right side.

> or simply a letter with address at the
> right side following the Swiss Norm SN 010130, like:
>
> \documentclass[a4paper,SN]{scrlttr2}
> \usepackage[english]{babel}
> \usepackage{lipsum}
> \setkomavar{fromname}{myself}
> \setkomavar{fromaddress}{somewhere}
>
> \begin{document}
> \begin{letter}{You\\there}
> \opening{Hi,}
> \lipsum
> \closing{Bye}
> \end{letter}
> \end{document}
>
> For more examples see the KOMA-Script manual, scrguien.pdf, chapter 4.

Thanks for the hint, that was an alternative option, but the letter
class was good enough and I just wanted to have the address right aligned.

The solution proposed by Herbert, with \raggedleft, is working but it
causes the closing and the signature to shift to the left for some
reasons...

On top of this the use of \raggedleft is somewhat suboptimal since it
prevents me the use of \address in the preamble. Can I somehow
'overload' the \address command to be right aligned?

Al

Markus Kohm

unread,
Nov 29, 2013, 5:36:21 AM11/29/13
to
alb (Freitag, 29. November 2013 09:53):

> but I'd
> like it better right aligned on the right side.

BTW: scrlttr2 can also align your address right:

\documentclass[fromalign=right,backaddress=false]{scrlttr2}
\usepackage[english]{babel}
\usepackage{lipsum}
\setkomavar{fromname}{myself}
\setkomavar{fromaddress}{somewhere\\there}
\let\raggedsignature\raggedright

\begin{document}
\begin{letter}{You\\there}
\opening{Hi,}
\lipsum
\closing{Bye}
\end{letter}
\end{document}

And if you absolutely want old commands like \address:

\documentclass[KOMAold,fromalign=right,backaddress=false]{scrlttr2}
\usepackage[english]{babel}
\usepackage{lipsum}
\name{myself}
\address{somewhere\\there}
\let\raggedsignature\raggedright

\begin{document}
\begin{letter}{You\\there}
\opening{Hi,}
\lipsum
\closing{Bye}
\end{letter}
\end{document}


Dan Luecking

unread,
Dec 2, 2013, 1:36:00 PM12/2/13
to
On Fri, 29 Nov 2013 09:53:13 +0100, alb <alessand...@cern.ch>
wrote:
Your best bet is to use a more flexible class for letters.
Markus suggested scrlttr2; another possibility is newlfm
(though I can't say how -- or if -- one can right justify
the lines).

If you stick with letter.cls, a change to \address is not
feasible, as all it actually does is copy its contents into
the macro \fromaddress (used later in \opening). Changing
\fromaddress is also not feasible, as the \opening command
simply copies its contents into the body if a tabular.
However, it *is* feasible to change \opening, and only one
change is needed (see comment below). Put in your preamble:

\makeatletter
\renewcommand*{\opening}[1]{\ifx\@empty\fromaddress
\thispagestyle{firstpage}%
{\raggedleft\@date\par}%
\else % home address
\thispagestyle{empty}
% ------------------------------------------ %
% I changed "l" in the alignment spec to "r" %
{\raggedleft\begin{tabular}{r@{}}\ignorespace
\fromaddress \\*[2\parskip]%
\@date \end{tabular}\par}%
\fi
\vspace{2\parskip}%
{\raggedright \toname \\ \toaddress \par}%
\vspace{2\parskip}%
#1\par\nobreak}
\makeatother


Dan
To reply by email, change LookInSig to luecking
0 new messages