Take the 2-minute tour ×  I want something like
\ifmmode\else\GenerateWarning{The command \backslash uzuka is
supported only in math mode.}\fi, which is supposed to generate
a warning "The command \uzuka is supported only in math mode.".
Is there a command or a package with this capacibility?
share|improve this question add comment  3 Answers  up vote 13
down vote accepted  For LaTeX, use the commands described in
section 4.9 of clsguide.pdf:    • \PackageWarning and
\PackageWarningNoLine if you are writing a package   •
\ClassWarning and \ClassWarningNoLine if you are writing a class
• The internal generic version for warnigns is \GenericWarning
The expl3 bundle has another interface for warnings and similar
messages, see Part XVII in source3.pdf.  share|improve this
answer I'd add that the expl3 approach has been designed to
allow suppression of messages in a selective fashion. Packages
such as silence can do the same for LaTeX2e messages but as an
'add on'. –  Joseph Wright Sep 20 '10 at 11:43 @doncher