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?

  • 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 '13 at 15:04
  • \setkomavar is only defined in the scrlttr2 class. (scrlettr would be deprecated anyway). – clemens Jul 16 '13 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 '13 at 14:06
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
    This is not precise enough: \setkomavar is not defined for all KOMA classes but only for scrlttr2! – clemens Jul 15 '13 at 9:43

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.