Possible Duplicate:
How to configure theorems depending on the document class?
I would like to have if the book class is loaded but if the article class is loaded. Can I do this with some sort of conditional?
I tried, but failed.
\makeatletter%
\@ifclassloaded{book}{%
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhead{}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\fancyhead[LE]{\bfseries\leftmark}
\fancyhead[RO]{\bfseries\rightmark}
\fancyfoot{}
\fancyfoot[LE,RO]{\bfseries\thepage}
\fancyfoot[LO,RE]{Régis}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{%
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
}
\typeout{Using book class.}%
}{%
\@ifclassloaded{article}{%
% \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhead{}
% \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\fancyhead[R]{\bfseries\rightmark}
\fancyfoot{}
\fancyfoot[R]{\bfseries\thepage}
\fancyfoot[L]{Régis}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{%
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
}
\typeout{Using article class.}%
}{%
\@ifclassloaded{report}{%
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhead{}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\fancyhead[L]{\bfseries\leftmark}
\fancyhead[R]{\bfseries\rightmark}
\fancyfoot{}
\fancyfoot[R]{\bfseries\thepage}
\fancyfoot[L]{Régis}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{%
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
}
\typeout{Using report class.}%
}{%
\typeout{Error: Unsupported class: 'article' or 'report' or 'book' are suported.}\QUITHERE
}%
}%
\makeatother%
\makeatletter%on the same file? – Regis da Silva Aug 12 '11 at 4:13#1is intended to refer to the first parameter to a macro call. Here you are not defining a macro so it doesn't have meaning. – Peter Grill Aug 12 '11 at 4:13