views:

808

answers:

2

This is my first time using Latex to write a letter. I am using the letter class. When I use:

\address{100 From Address \\ City, State \\ Pin}

The from address becomes right aligned. Is there someway I can make this left aligned. The format of the letter I am looking for is: the from address left aligned, followed by the date left aligned, followed by the to address left aligned, then opening and body, and finally signature left aligned.

I managed to get the signature left aligned by using: \longindentation=0pt, the rest of the items are properly aligned - its just the from address that is right aligned.

+4  A: 
\makeatletter
\def\opening#1{\ifx\@empty\fromaddress
  \thispagestyle{firstpage}%
    {\raggedleft\@date\par}%
  \else  % home address
    \thispagestyle{empty}%
    {\noindent\let\\\cr\halign{##\hfil\cr\ignorespaces
      \fromaddress \cr\noalign{\kern 2\parskip}%
      \@date\cr}\par}%
  \fi
  \vspace{2\parskip}%
  {\raggedright \toname \\ \toaddress \par}%
  \vspace{2\parskip}%
  #1\par\nobreak}
\makeatother
Alexey Malistov
A: 

I assume by "left aligned" you mean that you want the address block to be on the left margin of the page, since the individual lines of the block are left aligned, but the block is at the right margin.

The best way I have found to adjust LaTeX styles is to locate in the LaTeX source where the original style is defined, copy it to a style file, and fiddle. In this case, the original source is the letter.cls file, and I tracked down the address formatting by looking for the \address macro, which led to the \fromaddress macro, and then to the \opening macro. In the original, it is:


\newcommand*{\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{2\parskip}%
  {\raggedright \toname \\ \toaddress \par}%
  \vspace{2\parskip}%
  #1\par\nobreak}

Removing the \raggedleft macro moves the address block to the right side, but leaves some extra spacing, so I removed the tabular environment as well.


\renewcommand*{\opening}[1]{\ifx\@empty\fromaddress
  \thispagestyle{firstpage}%
    {\@date\par}%
  \else  % home address
    \thispagestyle{empty}%
    \ignorespaces%
      \fromaddress \\*[2\parskip]%
      \@date \par%
  \fi
  \vspace{2\parskip}%
  {\raggedright \toname \\ \toaddress \par}%
  \vspace{2\parskip}%
  #1\par\nobreak}

This \renewcommand call needs to be put in a .sty style file, since it uses macros containing the @ character. (I just saw Alexey Malistov's answer; the other alternative is the \makeatletter and \makeatother macros.) Use


\usepackage{myletter}

to bring in the new style.

Tommy McGuire