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.

7
  • Welcome, has `\\\` ever worked for you?
    – Johannes_B
    Commented Mar 14, 2016 at 19:05
  • With the expected error of the four backslashes resolved (and loading graphicx), everything compiles fine.
    – Johannes_B
    Commented Mar 14, 2016 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 ;)) Commented Mar 14, 2016 at 19:10
  • Torbjorn's answer was on point and solved the issue. Commented Mar 14, 2016 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
    Commented Mar 14, 2016 at 19:19

1 Answer 1

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.

4
  • Oh wow. I haven't even seen this error, it instantly thought that the OP forgot to put it in the example :-)
    – Johannes_B
    Commented Mar 14, 2016 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) Commented Mar 14, 2016 at 19:20
  • @FasEtNefas I see. That can be a problem sometimes, editors parsing the log file wrongly. Commented Mar 14, 2016 at 19:22
  • At least this teaches me to read the actual log file, not just the TeXstudio's message board. Thanks! Commented Mar 14, 2016 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .