[texhax] testing the document class

Lars Madsen daleif at imf.au.dk
Tue Feb 24 10:10:17 CET 2009


Christian Bird wrote:
> Hi all,
> 
> I'm trying to define a command that changes it's behavior depending on
> whether the class file defines chapters or not.  Is there an easy way to
> test for whether a macro is defined?  I'd like to do something like this:
> 
> \newcommand{\todo}[2][]
> \stepcounter{TodoCounter}
> \ifx <\chapter is defined>
> \addcontentsline{tdo}{todo}{\textbf{\arabic{chapter}.\arabic{section}-\arabic{TodoCounter}:}
> #2}
> \else
> \addcontentsline{tdo}{todo}{\textbf{\arabic{section}-\arabic{TodoCounter}:}
> #2}
> \fi
> }
> 
> Can anyone let me know what the correct way to test for this is?  Thanks!
> 
> -- Chris
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> 
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org

\@ifundefined{chapter}{is undefined}{is defined}

-- 

/daleif


More information about the texhax mailing list