This question already has an answer here:

I have a macros.tex file where I keep my macros and I use them with different document classes. I want to skip including some of my macros based on the document class (e.g. if it is beamer). How can I branch based the document class?

marked as duplicate by Kaveh, Community May 31 '16 at 3:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \@ifclassloaded{class}[true}{false} See CTAN source2e ctan.org/pkg/source2e – John Kormylo May 31 '16 at 3:19
  • 1
    There's \@ifclassloaded{<class>}{<true>}{<false>}. And other, related, commands.... – jon May 31 '16 at 3:20