# Suppress indentation on the opening line of a letter

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?

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

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}


-

Replace the opening line by:

\opening{\noindent Dear TeX Stack Exchange,}

-
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 '14 at 22:16
I'd accept @egreg's answer instead. – nickie Aug 27 '14 at 22:17
Why is that? Is there any reason that his solution would work better than this one? – Doorknob Aug 27 '14 at 22:20
No, it's the same solution essentially. He just provided an explanation... :-) – nickie Aug 27 '14 at 22:21