Is it possible to have a conditional that allow us to do something if a given command is being used in the document? For example for the \part command would be:
\@ifcommandisbeingused{\part}{<then>}{<else>} Clarification
The following would avoid the \bfseries for the chapter entry in the TOC, because the \part command is being used in the document.
\documentclass{book} \makeatletter \@ifcommandisbeingused{\part} { \renewcommand*\l@chapter[2]{% \ifnum \c@tocdepth >\m@ne \addpenalty{-\@highpenalty}% \vskip 1.0em \@plus\p@ \setlength\@tempdima{1.5em}% \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth \leavevmode \advance\leftskip\@tempdima \hskip -\leftskip #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par \penalty\@highpenalty \endgroup \fi} }{} \makeatother \begin{document} \part{Lorem} \chapter{Ipsum} \end{document} P.S.
I've changed \@ifcommandIsBeingUsed to \@ifcommandisbeingused 'cause I've remembered that in TeX/LaTeX language is common to use uppercase letters only in "very low level" macros.

\@ifcommandIsBeingUsedbefore it is actually used...ifthenpackage in an answer here: tex.stackexchange.com/questions/165873/…