Guten Abend,

ich brauche ein Konstrukt, dass es mir erlaubt, zu überprüfen ob ein bestimmtes command definiert ist. Konkret handelt es sich da um ein als command definiertes Datum. Ist dies gesetzt soll das Datum mit Text auf der Titelseite erscheinen, sonst soll da nichts stehen. Ich hatte da so in diese Richtung gedacht, allerdings bin ich mir nicht sicher, ob das wirklich der richtige weg ist.

Code:
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}

\newcommand{\test}{Beispeil}

\begin{document}
\@ifundefined{test}{abc}{xyz} 
\end{document}
Hier hätte ich gerne den String "abc", wenn die \newcommand Zeile da steht, wenn ich die auskommentiere solllte stattdessen "xyz" gedruckt werden. In der log-File steht dazu
! You can't use `\spacefactor' in vertical mode.
\@->\spacefactor
\@m
l.7 \@
ifundefined{test}{abc}{xyz}
Sorry, but I'm not programmed to handle this case;
I'll just pretend that you didn't ask for it.
If you're in the wrong mode, you might be able to
return to the right one by typing `I}' or `I$' or `I\par'.

! Missing $ inserted.

$
l.7 \@
ifundefined{test}{abc}{xyz}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 7.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 7.
! Missing $ inserted.

$
l.8 \end{document}

I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

Missing character: There is no \E8 in font cmex10!
[1