1

I'm trying to use the \opening{} command in a LaTeX letter but getting an undefined control sequence error on it for some obscure reason.

Minimal working example:

\documentclass[11pt]{letter}
\begin{document}

Dear John,

%Letter goes here

\end{document}

And minimal not-working example:

\documentclass[11pt]{letter}
\begin{document}

\opening{Dear John,}

%Letter goes here

\end{document}

Note that for some reason the \closing{} command (not included above) works just fine. I'm using TexMaker and compiling with PdfLaTeX (but LaTeX + dvips + ps2pdf doesn't work any better).

Any clue what's going on?

  • 1
    You have to enclose the letter text in the environment letter that takes as argument the addressee. – egreg Jul 9 '17 at 10:49
  • Well that was quick an on point, thank you! – Alexko Jul 9 '17 at 10:51
2

Many thanks to egreg for the quick answer, which is that the letter needs to be enclosed in a \begin{letter} … \end{letter} block, that I stupidly missed. Here's the working code:

\documentclass[11pt]{letter}

\begin{document}

\begin{letter}{}
\opening{Dear Johnny,}

%Letter goes here

\end{letter}
\end{document}

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.