2

I ran into the error:

'Undefined control sequence
l.12 \setkomavar{subject}{Regarding: Code 123.456}'

My document preamble looks like this:

\documentclass{letter}
\usepackage{hyperref}
\usepackage[english]{babel}

\signature{M.Y. Name}
\address{Street \\ Place \\ ZIP-code}


\begin{document}


\begin{letter}{Recipient \\ I know where your bed sleeps \\ I know where your house lives}


\setkomavar{subject}{Regarding: Code 123.456}


\opening{Dear Sir, Madam}


\end{letter}


\end{document}

What went wrong?

3
  • 4
    \setkomavar is defined for the KOMA-Script classes, such as scrlettr. It's not a common command for all LaTeX classes.
    – egreg
    Jul 2, 2013 at 15:04
  • \setkomavar is only defined in the scrlttr2 class. (scrlettr would be deprecated anyway).
    – cgnieder
    Jul 16, 2013 at 9:16
  • You might find the etoolbox package of interest if you want commands generally equivalent to \setkomavar. See especially '§ 3.1.1 Macro Definitions'.
    – jon
    Jul 16, 2013 at 14:06

1 Answer 1

5

As egreg already mentioned in his comment the command \setkomavar is part of the letter class scrlttr2 (thanks cgnieder) of the so called Koma-Script (see here). The most important Koma-Script classes are

  • scrartcl (alternative to article)
  • scrreprt (alternative to report)
  • scrbook (alternative to book)
  • scrlttr2 (alternative to letter)

In general the Koma commands are not defined in every documentclass. An example how to use the letter class can be found here (Wikipedia).

1
  • 2
    This is not precise enough: \setkomavar is not defined for all KOMA classes but only for scrlttr2!
    – cgnieder
    Jul 15, 2013 at 9:43

You must log in to answer this question.

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