Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here's a simple example:

\documentclass[12pt]{letter}
\setlength{\parindent}{15pt}
\signature{Doorknob}

\begin{document}
\begin{letter}{}
    \noindent \opening{Dear TeX Stack Exchange,}

    Waffles are pancakes with built-in syrup reservoirs.

    Unicorns are magically weaponized ponies.

    This is a generic paragraph.

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

When I try viewing a document created with that code, the opening line ("Dear TeX Stack Exchange") is still indented, despite the \noindent command.

How can I tell LaTeX not to indent the opening line of a letter?

share|improve this question
    
Drop the \setlength{\parindent}{15pt} line by % ;-) –  Christian Hupfer Aug 27 at 22:08
    
@ChristianHupfer Heh, well I suppose that does solve one problem... :P –  Doorknob 冰 Aug 27 at 22:09
    
Is there another one? –  Christian Hupfer Aug 27 at 22:10

2 Answers 2

up vote 4 down vote accepted

The letter class is built on the assumption that \parindent is zero.

Patch the \opening command:

\documentclass[12pt]{letter}
\usepackage{showframe} % just for the example
\usepackage{etoolbox}

\patchcmd{\opening}{#1}{\noindent#1}{}{}

\setlength{\parindent}{15pt}

\signature{Doorknob}

\begin{document}

\begin{letter}{Some Body\\
  Some Where\\
  42 Some Street}

\opening{Dear TeX Stack Exchange,}

Waffles are pancakes with built-in syrup reservoirs.

Unicorns are magically weaponized ponies.

This is a generic paragraph.

\closing{Sincerely,}

\end{letter}

\end{document}

enter image description here

share|improve this answer

Replace the opening line by:

\opening{\noindent Dear TeX Stack Exchange,}
share|improve this answer
    
Great; this worked perfectly! I'll accept this answer (in 4 minutes when I can) because there's only one opening anyway, so this is easier than the patchcmd solution in the other answer. –  Doorknob 冰 Aug 27 at 22:16
    
I'd accept @egreg's answer instead. –  nickie Aug 27 at 22:17
    
Why is that? Is there any reason that his solution would work better than this one? –  Doorknob 冰 Aug 27 at 22:20
    
No, it's the same solution essentially. He just provided an explanation... :-) –  nickie Aug 27 at 22:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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