10

I am writing a letter with the wikibooks template. The letter is going to be printed on a official paper which contains the address already. So I thought I can omit the \address command. For some strange reason the signature will not indent as shown on the webpage. I tried the \longindentation=20pt command, no matter what numbers I change, the closing and the signature are all aligned to the left margin of the body and will not indent. I was able to get it work by the command \address{\phantom{a}}, but that should not be how it is supposed to work (yes, I did try \address{}, but that doesn't work). Any better solutions?

What is wrong with omitting the \address command anyway?

Edit: Here is the what I am doing.

----------------------------------------------------------------------------------
\documentclass[11pt]{letter}

\signature{James Bond}
%\address{\phantom{i}}
%\longindentation=0pt
\begin{document}
\begin{letter}{}

\opening{To whom it may concern:}

The body of the letter goes on here. 

\closing{Yours sincerely,}

\end{letter}

\end{document}
------------------------------------------------------------------------------

As it stands now, without the address command, the closing and signature will not indent. However, if we uncomment the \address command, then they indents as shown in the Wikibook LaTeX example.

1
  • 1
    Teh UK TUG FAQ correctly states that the letter class is widely disliked. It suggests akletter, brief, dinbrief, newlfm, and scrlttr2 as alternatives.
    – user10274
    Mar 2, 2012 at 6:19

3 Answers 3

9

The reason for the apparent "conditional indentation" stems from the source code for \closing:

\newcommand{\closing}[1]{\par\nobreak\vspace{\parskip}%
  \stopbreaks
  \noindent
  \ifx\@empty\fromaddress\else
  \hspace*{\longindentation}\fi
  \parbox{\indentedwidth}{\raggedright
       \ignorespaces #1\\[6\medskipamount]%
       \ifx\@empty\fromsig
           \fromname
       \else \fromsig \fi\strut}%
   \par}

The indent of \longindentation is only executed if \fromaddress is non-empty. And, \fromaddress is defined when using \address:

\newcommand*{\address}[1]{\def\fromaddress{#1}}

So, in order for the indentation to work properly (for whatever reason), you need something in \fromaddress. Using \def\fromaddress{\null} works just as well.

9

you can also put

\longindentation=0pt    

in the preamble (i.e. before \begin{document}).

1
  • 3
    It's better to give more details and, preferably, a minimal working example to verify that you have solved the OP. You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui.
    – user30471
    Nov 16, 2016 at 1:29
1

You can patch it as follows:

\documentclass[11pt]{letter}
%\address{\phantom{i}}
\signature{James Bond}
\makeatletter
\renewcommand{\closing}[1]{\par\nobreak\vspace{\parskip}%
 \stopbreaks
 \noindent
% \ifx\@empty\fromaddress\else
 \hspace*{\longindentation}
 \parbox{\indentedwidth}{\raggedright
 \ignorespaces #1\\[6\medskipamount]%
 \ifx\@empty\fromsig
 \fromname
 \else \fromsig \fi\strut}%
\par}

\begin{document}
\begin{letter}{}

\opening{To whom it may concern:}

The body of the letter goes on here. 

\closing{Yours sincerely,}

\end{letter}

\end{document}

You must log in to answer this question.

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