You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I write my documents in Hebrew and I noticed a weird issue. If I try to put a reference above an equal sign in the align or gather environments, it's not aligned correctly. This problem only happens in Hebrew. Switching the current language to English fixes it:
The code for this example:
\documentclass{article}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage[bidi=basic, layout=tabular]{babel}
\babelprovide[main, import, alph=letters, Alph=letters]{hebrew}
\babelprovide[import]{english}
% Font setup\babelfont[hebrew]{rm}[Renderer=HarfBuzz]{Assistant}
\babelfont[hebrew]{sf}[Renderer=HarfBuzz]{Assistant}
\usepackage{amsmath}
\begin{document}
\begin{equation}\label{eq:he-pythagoras} a^2 + b^2 = c^2\end{equation}
לפי משוואה
\eqref{eq:he-pythagoras}
נסיק כי
\begin{align*}
c^4 \overset{\scriptscriptstyle\eqref{eq:he-pythagoras}}{=} (a^2 + b^2)^2\end{align*}
נמשיך
\selectlanguage{english}
\begin{equation}\label{eq:en-pythagoras} a^2 + b^2 = c^2\end{equation}
According to equation \eqref{eq:en-pythagoras}, we can conclude that:
\begin{align*}
c^4 \overset{\scriptscriptstyle\eqref{eq:en-pythagoras}}{=} (a^2 + b^2)^2\end{align*}
Let's continue
\end{document}
When I was working on Overleaf, I would wrap the align/gather environments with the \babelsublr command to fix this, but for a weird reason, this workaround didn't work when I tried to transition to a local compiler and caused the reference to break. I asked this on tex.stackexchange and got a working workaround:
\documentclass{article}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage[bidi=basic, layout=tabular]{babel}
\babelprovide[main, import, alph=letters, Alph=letters]{hebrew}
\babelprovide[import]{english}
% Font setup\babelfont[hebrew]{rm}[Renderer=HarfBuzz]{Assistant}
\babelfont[hebrew]{sf}[Renderer=HarfBuzz]{Assistant}
\usepackage{amsmath}
\makeatletter\NewDocumentCommand{\exref}{ m }{%\let\bbl@ams@lap\relax%\eqref{#1}%
}%\makeatother\begin{document}
\begin{equation}\label{eq:he-pythagoras} a^2 + b^2 = c^2\end{equation}
לפי משוואה
\exref{eq:he-pythagoras}
נסיק כי
\begin{align*}
c^4 \overset{\scriptscriptstyle\exref{eq:he-pythagoras}}{=} (a^2 + b^2)^2\end{align*}
נמשיך
\selectlanguage{english}
\begin{equation}\label{eq:en-pythagoras} a^2 + b^2 = c^2\end{equation}
According to equation \exref{eq:en-pythagoras}, we can conclude that:
\begin{align*}
c^4 \overset{\scriptscriptstyle\exref{eq:en-pythagoras}}{=} (a^2 + b^2)^2\end{align*}
Let's continue
\end{document}
which produces:
According to Javier's answer to my question, it looks like babel patches an internal macro in some amsmath environments to correctly align the tag. \eqref uses this macro in its original form in the text, but in the context of my example the modified form is the active one.
In other words, it seems to be a bug with babel and this should be fixed.
The text was updated successfully, but these errors were encountered:
I write my documents in Hebrew and I noticed a weird issue. If I try to put a reference above an equal sign in the
align
orgather
environments, it's not aligned correctly. This problem only happens in Hebrew. Switching the current language to English fixes it:The code for this example:
When I was working on Overleaf, I would wrap the
align
/gather
environments with the\babelsublr
command to fix this, but for a weird reason, this workaround didn't work when I tried to transition to a local compiler and caused the reference to break. I asked this on tex.stackexchange and got a working workaround:which produces:
According to Javier's answer to my question, it looks like
babel
patches an internal macro in someamsmath
environments to correctly align the tag.\eqref
uses this macro in its original form in the text, but in the context of my example the modified form is the active one.In other words, it seems to be a bug with
babel
and this should be fixed.The text was updated successfully, but these errors were encountered: