3

This one deals more with vertical, not horizontal, space: Positioning the address in a Letter

I know about the scrlttr2 document class, but the letter class has much better default formatting (I only need to change ONE parameter), whereas the scrlttr2 produces an aesthetically unpleasing document, which redundant output in the sender's info, and needs a lot of work to make it look like the letter class, which I find almost perfect: LaTeX letter with address field in the right place for a "C5 envelope with window"

I would be willing to use the scrlttr2 class, but I can't find a template for it that makes it look like the better looking letter class. Here is one:

scrlttr2: Position of the recipient's address

But I would rather just make this small fix to the letter class, if possible.

Here is what I have so far for my .tex file:

\documentclass{letter}
\usepackage{hyperref}
\usepackage[english=nohyphenation]{hyphsubst}
\usepackage{tabularx}
\usepackage[left=2.0cm, right=3.0cm, top=3cm, bottom=2cm, bindingoffset=0cm, showframe=false]{geometry}
\renewcommand{\tabcolsep}{15cm}
\newcommand{\subject}[1]{% This macro will need one argument
  {\begin{center} \bfseries \underline{#1} \end{center}}% Centred and bold text
}
\signature{Shafique Jamal}
\address{Shafique Jamal \\ 31 Streetname Drive \\ Town, Province \\ Canada ZIP POS}
\longindentation=0pt
\begin{document}
\begin{letter}{\TeX Stack Exchange Group \\ Office \\ 23 Streets Name \\ Town, Country POSTAL }
\opening{Dear Fellow Stack People:}
\subject{Subject: Subject goes here}

Can you help me move the sender's address to the left? It is too close to the right edge. I would like to make sure that it does not go more to the right than does the text in the body of the letter.

\closing{Sincerely,}
\end{letter}
\end{document}

And here is what this produces:

Screenshot of LaTeX output

The sender's address is too far to the right - I would like to bring it more to the left, so that the text of the sender's address goes no further to the right than does the text in the body of the letter. Any suggestions?

3

I don't know the purpose of the line

\renewcommand{\tabcolsep}{15cm}

used in your code. This is the source of the problem. Commenting this will cure the disease.

On the other hand, if you are tied to a \tabcolsep of 15cm (which looks weird), Add this to your preamble.

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

Or with etoolbox

\usepackage{etoolbox}

\patchcmd{\opening}{\begin{tabular}{l@{}}}    %% search
                    {\begin{tabular}{@{}l@{}}} %% replace
                    {}{}

Full code:

\documentclass{letter}
\usepackage{hyperref}
\usepackage[english=nohyphenation]{hyphsubst}
\usepackage{tabularx}
\usepackage[left=2.0cm, right=3.0cm, top=3cm, bottom=2cm, bindingoffset=0cm, showframe]{geometry}
\renewcommand{\tabcolsep}{15cm}
\newcommand{\subject}[1]{% This macro will need one argument
  {\begin{center} \bfseries \underline{#1} \end{center}}% Centred and bold text
}
\signature{Shafique Jamal}
\address{Shafique Jamal \\ 31 Streetname Drive \\ Town, Province \\ Canada ZIP POS}
\longindentation=0pt

\usepackage{etoolbox}
\patchcmd{\opening}{\begin{tabular}{l@{}}}    %% search
                    {\begin{tabular}{@{}l@{}}} %% replace
                    {}{}


%\makeatletter
%\renewcommand*{\opening}[1]{\ifx\@empty\fromaddress
%  \thispagestyle{firstpage}%
%    {\raggedleft\@date\par}%
%  \else  % home address
%    \thispagestyle{empty}%
%    {\hspace*{\fill}\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}
%\makeatother

\begin{document}
\begin{letter}{\TeX Stack Exchange Group \\ Office \\ 23 Streets Name \\ Town, Country POSTAL }
\opening{Dear Fellow Stack People:}
\subject{Subject: Subject goes here}

Can you help me move the sender's address to the left? It is too close to the right edge. I would like to make sure that it does not go more to the right than does the text in the body of the letter.

\closing{Sincerely,}
\end{letter}
\end{document}

enter image description here

  • Harish, thanks for this answer. Yes, the line \renewcommand{\tabcolsep}{15cm} was vestigial, from something else I was trying to do. My stupid mistake, thank you for catching it and proposing this solution. – Shafique Jamal May 26 '14 at 21:10
2

I've always felt that the letter class was very restrictive and difficult in terms of its composition. It is really simple to recreate the layout in a very flexible way:

enter image description here

\documentclass{article}
\usepackage[left=2.0cm, right=3.0cm, top=3cm, bottom=2cm, bindingoffset=0cm, showframe=false]{geometry}
\newcommand{\subject}[1]{% This macro will need one argument
  {\begin{center} \bfseries \underline{#1} \end{center}}% Centred and bold text
}
\setlength{\parindent}{0pt}
\begin{document}

\vspace*{3cm}

\hfill
\begin{tabular}{l@{}}
  Shafique Jamal \\
  31 Streetname Drive \\
  Town, Province \\
  Canada ZIP POS \\ \\
  \today
\end{tabular}

\bigskip

\begin{tabular}{@{}l}
  \TeX Stack Exchange Group \\
  Office \\
  23 Streets Name \\
  Town, Country POSTAL
\end{tabular}

\bigskip

Dear Fellow Stack People:

\subject{Subject: Subject goes here}

Can you help me move the sender's address to the left? 
It is too close to the right edge. I would like to make 
sure that it does not go more to the right than does the 
text in the body of the letter.

\bigskip

Sincerely,

\vspace{4\baselineskip}

Shafique Jamal

\end{document}
  • Werner - thanks for this. Your solution here has a large advantage over the scrlttr2 and letter document classes: the article class allows using tables and captions, which scrlttr2 and letter do not support by default. This is useful for including in a letter formatted information that is easy for the reader to quickly find. Cheers – Shafique Jamal May 28 '14 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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