Closed ShaiAvr closed 9 months ago
As a workaround, try with
\begin{equation}\label{Pythagoras}
a^2 + b^2 = c^2
\makeatletter\def\@currentlabel{\textasteriskcentered}%
\tag{\textasteriskcentered}
\end{equation}
@jbezos This workaround indeed works and by wrapping it in a custom command:
\makeatletter
\newcommand*{\mytag}[1]{%
\def\@currentlabel{#1}%
\tag{#1}}
\makeatother
it becomes more usable.
After further experimentation, I found that this issue only occurs in Hebrew (and possibly other non-English languages I can't check?). Doing \selectlanguage{english}
or using the \begin{otherlanguage}{english}
environment fixes the issue and the references use the correct tags again.
The problem is the printed form in RTL contexts must be wrapped somehow (with a group) to get the correct direction, and amsmath
sets the label exactly when the tag is printed, which means its value is lost when exiting the group.
@jbezos I wouldn't close this issue as completed since it's still a bug in babel
which requires an unintuitive workaround. I faced this bug today and then remembered I opened an issue about it on Github, so I was reminded of the solution. This can easily happen to other Hebrew document writers, and this should be fixed, or at the very least, this solution should be documented. An easy fix is just for babel
to redefine \tag
with this workaround as I did, but I have no experience in package development, so I don't know how practical or useful this solution is.
Please, post a new MWE, because the original one works as expected.
@jbezos That's weird. The original works as expected on my local machine now, but it gives the wrong result on Overleaf. Both use LuaLatex with TexLive 2023.
It’s natural it fails in Overleaf: it’s an old version (2023/07/15 v3.92) without the fix.
I use Latex with
babel
for my assignments in Hebrew and I have this simple code snippet:As you can see, the equation has a custom tag
I think it's a bug with
(*)
and I reference it later. When compiling this code, the equation indeed shows with the custom tag, but the reference still uses the default tag of(1)
:babel
since I didn't have this problem withbabel
disabled or withpolyglossia
. I also get this issue on Overleaf. If someone could provide a fix for this, I'd highly appreciate it.