Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
Welcome to TeX.SE. –  Peter Grill Oct 5 '12 at 7:12
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.) –  Marc van Dongen Oct 5 '12 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.

share|improve this answer

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
share|improve this answer
Thanks. nag package is worked fine. –  user19551 Oct 5 '12 at 9:53
@user19551, you should click the checkmark next to the nag answer to indicate that it resolved your question. –  dbaupp Oct 5 '12 at 10:31
What a Harry-Potteresque error message ;-) \it (The one command that must not be named) has been used!! Very nice :-D –  Benedikt Bauer Oct 5 '12 at 21:16
@BenediktBauer: Well before I figured out how to add the back slash, the message was even better "it was used!" :-). –  Peter Grill Oct 6 '12 at 0:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.