Which document class is being used?
You want the LaTeX kernel function \@ifclassloaded
:
\makeatletter%
\@ifclassloaded{<someclass>}%
{<true code>}%
{<false coode>}%
\makeatother%
If your package executes \@getclass
then the current class name will be stored in \@currentclass
which you can then test or print out as required (this is probably more general than using \@ifclassloaded
which requires a class name in advance).
You can define \@getclass
like so
\def\@getcl@ss#1.cls#2\relax{\def\@currentclass{#1}}
\def\@getclass{\expandafter\@getcl@ss\@filelist\relax}
and use like:
\@getclass
\typeout{this document uses \@currentclass\space class}
Actually a class is loaded with the same internal macros like packages (both are officially "files with options") and LaTeX doesn't store the class file name in a specific macro. So you can't directly test which class was used, only test whether a specific class was used or not using \@ifclassloaded{<class>}{<true>}{<false>}
(already mentioned in a previous answer).
Also keep in mind that a class can be based on another class by loading it with \LoadClass
or \LoadClassWithOptions
. In this case \@ifclassloaded
will be true for both. However AFAIK the standard classes are not based on any other classes.