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

\usepackage[a4paper, textwidth=490pt, textheight = 690pt]{geometry}
\setkomavar{signature}{John Doe}
\begin{letter}{Dr X \\ Evil Corp}
\opening{Dear Dr X,}
\closing{Kind regards,}

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

\setkomavar{signature}{John Doe}


\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.

  • Welcome, has `\\\` ever worked for you? – Johannes_B Mar 14 '16 at 19:05
  • With the expected error of the four backslashes resolved (and loading graphicx), everything compiles fine. – Johannes_B Mar 14 '16 at 19:09
  • I actually artificially included two backslashes as the stackexchange parser showed only one instead two (I didn't want to confuse anyone, but it seemed to have the exact opposite effect ;)) – Mercury Bench Mar 14 '16 at 19:10
  • Torbjorn's answer was on point and solved the issue. – Mercury Bench Mar 14 '16 at 19:12
  • If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – Johannes_B Mar 14 '16 at 19:19

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


will solve it.

  • 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) – Mercury Bench 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! – Mercury Bench Mar 14 '16 at 19:23

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.