GeneralReferencing equation with custom tags doesn't work with babel?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Shai-Avr
Posts: 8
Joined: Tue Aug 22, 2023 11:30 am

Referencing equation with custom tags doesn't work with babel?

Post by Shai-Avr »

I use Latex to do my assignments in University in Hebrew. I use the package babel, and I have this sample code:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage[bidi=basic, layout=tabular]{babel}
\babelprovide[main, import, alph=letters, Alph=letters]{hebrew}
\babelprovide[import]{english}
\babelfont[hebrew]{rm}{Calibri}
\babelfont[hebrew]{sf}{Calibri}
\usepackage{amsmath}
\begin{document}
\begin{equation}\label{Pythagoras}
a^2 + b^2 = c^2 \tag{\textasteriskcentered}
\end{equation}
משפט פיתגורס \eqref{Pythagoras}.
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
As you can see, I have an equation with a custom tag (*) and I reference it later using \eqref. When I compile the code, the equation shows up correctly with the (*) tag, but when I look at the reference to the equation, it still says (1) instead of using my custom tag. How can I fix it to use the custom tag for the equation and the reference?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Referencing equation with custom tags doesn't work with babel?

Post by Stefan Kottwitz »

Hi Shai-Avr,

welcome to the forum!

It works for me, when I don't use the Calibri font (I don't have it):
equation.png
equation.png (10.74 KiB) Viewed 8576 times
Perhaps you just need to recompile again after your change?

Stefan
LaTeX.org admin
Shai-Avr
Posts: 8
Joined: Tue Aug 22, 2023 11:30 am

Referencing equation with custom tags doesn't work with babel?

Post by Shai-Avr »

No matter how many times I compile it, it doesn't work for me. It doesn't work on my local system and not on Overleaf. I should mention that I compile with LuaLateX.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Referencing equation with custom tags doesn't work with babel?

Post by Stefan Kottwitz »

Can you share a link to your test document on Overleaf? (not your main document, just for the testing)

Stefan
LaTeX.org admin
Shai-Avr
Posts: 8
Joined: Tue Aug 22, 2023 11:30 am

Referencing equation with custom tags doesn't work with babel?

Post by Shai-Avr »

There: https://www.overleaf.com/read/dchvdppskvzt. It's the same code except I use the Times New Roman font because I don't want to deal with fonts on Overleaf.
Shai-Avr
Posts: 8
Joined: Tue Aug 22, 2023 11:30 am

Referencing equation with custom tags doesn't work with babel?

Post by Shai-Avr »

Did you manage to find a solution, @Stefan?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Referencing equation with custom tags doesn't work with babel?

Post by Stefan Kottwitz »

Unfortunately I did not. It works on my TeX installation, it doesn't work on Overleaf. Perhaps the Overleaf support can help? They also do TeX related support.

Stefan
LaTeX.org admin
Shai-Avr
Posts: 8
Joined: Tue Aug 22, 2023 11:30 am

Referencing equation with custom tags doesn't work with babel?

Post by Shai-Avr »

I don't really care if it works on Overleaf because it doesn't work on my TeX installation either which is my main workspace. I only used Overleaf to test if it's a problem on my local machine or if it's a problem with Latex in general, and the fact it doesn't work on Overleaf only confirms that it isn't an issue with my machine.

I compiled the code on my local machine running Windows 11 with LuaLateX in TeXstudio and got this issue. I also tried to compile from the command line and still got this issue which proves it isn't an issue with the TeXstudio IDE.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Referencing equation with custom tags doesn't work with babel?

Post by Stefan Kottwitz »

How about this, following what Javier Bezos wrote to the issue on Github:

Code: Select all

Code, edit and compile here:
% !TEX=lualatex
\documentclass{article}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage[bidi=basic, layout=tabular]{babel}
\babelprovide[main, import, alph=letters, Alph=letters]{hebrew}
\babelprovide[import]{english}
\babelfont[hebrew]{rm}{Times New Roman}
\babelfont[hebrew]{sf}{Times New Roman}
\usepackage{amsmath}
\makeatletter
\newcommand*{\mytag}[1]{%
\def\@currentlabel{#1}%
\tag{#1}}
\makeatother
\begin{document}
\begin{equation}\label{Pythagoras}
a^2 + b^2 = c^2 \mytag{\textasteriskcentered}
\end{equation}
משפט פיתגורס \eqref{Pythagoras}.
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Stefan
LaTeX.org admin
Post Reply