[Tex/LaTex] Use komavar outside scrlttr2

koma-script

I'm deriving my own class from scrartcl but wan to introduce variables as in scrlttr2 for the user of the class to set several values. I find the \setkomavar resp. \usekomavar mechanism with key, value and description quite convenient.

Is there any way of using komavars if I'm not using the scrlttr2 class?

My actual problem

Currently I get Undefined control sequence. \setkomavar if I use \setkomavar.

My new class will have a title page which includes an address and a logo which I want to set with komavars as it is done in scrlttr2. To define this titlepage I renew the \maketitle command, which is not available if I would derive my class from scrlttr2.

Best Answer

With the current version of KOMA-script you get package scrletter which is is still in beta. It provides the ability to write letters with the with the article, report or book class of KOMA-script. Hence, it defines the mechanism you want.
In the following a simple example to set the page header with the name.

\documentclass{scrartcl}
\usepackage{blindtext}
\usepackage{scrletter}
\newkomavar[Autor:]{name}
\setkomavar{name}{White Gecko}
\usepackage{scrlayer-scrpage}
\ohead*{\usekomavar*{name}~\usekomavar{name}}
\begin{document}
\blinddocument
\end{document}