Sunday, November 25, 2007

LaTeX Letters

I was trying to write a letter in LaTeX the other day:

\documentclass{letter}\address{Nowheresville}\signature{Me}\begin{document}\begin{letter}\opening{To Whom It May Concern:}Hello, there.\closing{Sincerely,}\end{letter}\end{document}

This led to the following two errors, which shed little light on the situation:
! LaTeX Error: There's no line here to end.See the LaTeX manual or LaTeX Companion for explanation.Type H  for immediate help. ...l.10 \opening{To Whom It May Concern:}

and (on a different example)
! Incomplete \iffalse; all text was ignored after line 66.                 \fi l.16 \end{letter}                 Runaway text?\@mlabel{}{\unhbox \voidb@x \ignorespaces \global \let

The problem, as it was gently explained to me, is I had omitted the second mandatory argument of \begin{letter}, which is the address of the recipient. The following is correct:
\documentclass{letter}\address{Nowheresville}\signature{Me}\begin{document}\begin{letter}{Foo Corp.}\opening{To Whom It May Concern:}Hello, there.\closing{Sincerely,}\end{letter}\end{document}

[UPDATE] I just realized that the reason I got so confused about this is that I was working off a previous business letter that was formatted like:
\begin{document}\begin{letter}{Foo Corp. \\... \\ATTN: Warranty Dept.}...

I'm not sure if I intended it to be the case (probably not), but LaTeX picked up the braces around the address as the argument to letter. When I used this as the template for a personal letter and deleted the address, all hell broke loose.

1 comment:

fs said...

Thanks for posting. I was having a similar errors (using a different class) and my solution was the same.