I want to validate my LaTeX file. I.e. the file should contain only \textit not \it. i want to validate throughout the file with my style command. is there any possibility to do this?

  • 1
    Welcome to TeX.SE. Oct 5, 2012 at 7:12
  • 3
    Perhaps an easier way is grep '\it\>' > /dev/null. On Unix this should only return an exit status of 0 if there aren't '\it` commands in the file. Of course it won't detect \csname it\endcsname and friends. BTW why do you want to implement this check? (It may be the case that you also don't want \textit because \emph is what you really want.)
    – user10274
    Oct 5, 2012 at 8:02

2 Answers 2


You might be interested in the nag package.

\RequirePackage[l2tabu, orthodox]{nag}

It nags about \it, \bf, …, \centerline, outdated packages and figures and tables without caption

Related: l2tabu

The “sins” of LaTeX users, and how to correct them. The document provides a list of obsolete packages and commands.


You could redefine \it to trigger an error if it is used:

Package JOBNAME Error: \it was used!!.

where JOBNAME will be the name of the file that you are processing.


\def\it{\PackageError{\jobname}{\string\it\space was used!!}}

\it abc
  • 13
    @user19551, you should click the checkmark next to the nag answer to indicate that it resolved your question.
    – huon
    Oct 5, 2012 at 10:31
  • 2
    What a Harry-Potteresque error message ;-) \it (The one command that must not be named) has been used!! Very nice :-D Oct 5, 2012 at 21:16
  • 2
    @BenediktBauer: Well before I figured out how to add the back slash, the message was even better "it was used!" :-). Oct 6, 2012 at 0:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .