My file is pretty big (it's over 100 equations and growing) and I don't want to check by hand which equation labels I've used. So my goal was to change all equation environments to equation*, but any reference to a labeled equation* outputs nothing or an "unrelated" number without creating any warning.

Is there a way to force such cases to produce a warning ?


\documentclass[a4paper, 11pt]{article}

\begin{equation*} \label{mylabel}
    \pi = 3.2
I want a warning if i'm trying to reference equation \eqref{mylabel} since the equation environment is starred.
  • It might be easier to solve your initial problem, and to check for each defined label whether it has been referenced. Depending on your OS, there are external solutions (like using regular expressions to extract all strings from \label and \ref commands and display those labels not \refed), or pure LaTeX solutions where each \ref command records its label and the \label commands check whether they have been used (the 'undefined label' check in reverse).
    – gernot
    Jun 24 at 17:44

1 Answer 1


The following causes \label calls from within equation* to print a warning:


    \errmessage{\string\label{#1} used in equation* environment!}%


\begin{equation*} \label{mylabel}
    x = 3.2

  • Perfectly what i was looking for. Thanks ! Jun 24 at 19:12
  • You're welcome, glad to hear that!
    – frougon
    Jun 24 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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