Possible Duplicate:
Which documentclass is being used?
Is it possible to get the name of the current document class name from a package being used by that document? An example of what I mean:
In the document:
\documentclass{article}
\usepackage{foo}
\begin{document}
Foo claims \bar! What does he know?
\end{document}
In the package foo used above:
\newcommand{\bar}{the current document class is \DocumentClassName}
I'm actually interested in using this to modify the behavior of some of my own macros slightly, based on the document class. I've currently worked around this issue, by defining options based on class names. I thought I could keep these options to force certain behaviors, but it would be nice if the default could be chosen based on the document class name.
It suffices for my purposes to differentiate between books, reports, articles, and "other" (anything else). Testing for the existence of a chapter counter almost works, except that it can't differentiate between books and reports.