5

I'm really weirded out. The following letter compiles nicely:

\documentclass{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage[a4paper, textwidth=490pt, textheight = 690pt]{geometry}
\setkomavar{signature}{John Doe}
\begin{document} 
\begin{letter}{Dr X \\ Evil Corp}
\setkomavar{subject}{Application}
\opening{Dear Dr X,}
blabla
\closing{Kind regards,}
\end{letter} 
\end{document}

But when I include an (existing) signature image by replacing

\setkomavar{signature}{John Doe}

with

\setkomavar{signature}{\includegraphics{sig} \\\\ John Doe},

my compiler refuses to create a pdf, saying

Undefined control sequence \closing{Kind regards,}

I don't know what to do.

Torbjørn T.
  • 206,688

1 Answers1

3

The error is actually

! Undefined control sequence.
\scr@signature@var ->\includegraphics 
                                      {sig}John Doe
l.12 \closing{Kind regards,}

When you get a Undefined control sequence error, the macro (control sequence) it complains about is the last one on the first line, in this case \includegraphics.

\includegraphics is defined by the graphicx package, which should always be added if you're adding images. Hence, adding

\usepackage{graphicx}

will solve it.

Torbjørn T.
  • 206,688
  • Oh wow. I haven't even seen this error, it instantly thought that the OP forgot to put it in the example :-) – Johannes_B Mar 14 '16 at 19:17
  • I read the error message, but I was thoroughly confused because in TeXstudio, the abbreviated error message just shows what I posted above (and doesn't include the line ! Undefined control sequence. \scr@signature@var ->\includegraphics {sig}John Doe) – Philipp Wacker Mar 14 '16 at 19:20
  • @FasEtNefas I see. That can be a problem sometimes, editors parsing the log file wrongly. – Torbjørn T. Mar 14 '16 at 19:22
  • At least this teaches me to read the actual log file, not just the TeXstudio's message board. Thanks! – Philipp Wacker Mar 14 '16 at 19:23