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 Santos Aug 12 '11 at 04: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 04:13\makeatletter ... \makeatother. I don't think you can nest then but have not tried that. – Peter Grill Aug 12 '11 at 04:14\typeout{Using article class} (needs one more closing brace) (ii) the macro\QUITHERE` is not a real macro: it was a pseudo-code macro that Peter used in his answer, so remove it. – Alan Munn Aug 12 '11 at 05:15texdoc clsguidefor some information on this. – Alan Munn Aug 12 '11 at 05:16