[Tex/LaTex] How to move the from (sender) address position to the left in a letter document class

horizontal alignmentletters

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?

Best Answer

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