In another post I asked how to create a new equation-like environment called inequality that will share equation's counter. I received two good answers. However, these answers are not satisfactory under additional two conditions that I'm interested in. The conditions are:

  • that the document's language be set to Hebrew via babel.
  • that the labels be shown.

I use the showlabels package to show the labels, however I have no particular attachment to this package; if there's a solution to my problem that doesn't use showlabels, it will be just as welcome. On the other hand, the babel package is a hard requirement for a solution to be accepted.

Consider, for example, egreg's answer to my other post, to which I have added the \usepackage{showlabels} command at the end of the preamble.





x \leq y

x = y


When this code is compiled with two calls to lualatex, the following output is produced.

egreg's solution in an English document

If now the document's language is set to Hebrew by uncommenting the four commented lines and recompiling, the resulting output is:

egreg's solution in a Hebrew document

Note how the labels have disappeared! A similar outcome is observed with the solution given in BotonF's answer. (Bear in mind that Hebrew is a right-to-left language, and so the text's right-alignment is to be expected, and isn't a problem.)

Three other solutions have been considered, but none of them is adequate.

  • Mico's solution suffers from the problem, which I described here, that in a Hebrew document the inequality environment's numbering is left aligned.
  • David's Carlisle's solution suffers from the problem that in a Hebrew document the label is positioned inside the equation instead of in the margin.
  • Javier Bezos' solution works well in a Hebrew document, but fails in an English document, as I described in this question (which remains unanswered at the present time). I'd like a solution which will work well both in Hebrew documents and in English ones (as well as in bilingual documents).

1 Answer 1


both showlabels and showkeys patch the \@eqnnum command to retrieve labels in the equation environment.

Sadly babel overwrites this command again in luababel.def. You could try this (but I didn't check if it works with the additional complication of cleveref):



      % do nothing


x = y


enter image description here

  • Yes, it works with cleveref. Thank you very much!
    – Evan Aad
    Dec 6, 2022 at 16:06
  • From my tests it looks like it doesn't matter where your patch is placed in the preamble: it can be the last thing in the preamble, after showlabels, or the first thing, before babel, or anywhere in between; it works regardless. Are there any placement considerations I should take into account when deploying this patch in the "real world"?
    – Evan Aad
    Dec 6, 2022 at 16:15

You must log in to answer this question.

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