latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
125 stars 34 forks source link

When the main language is Hebrew, and the showlabels package is used, labels of equations and labels of theorems are placed in different parts of the logical page #200

Closed EvanAad closed 1 year ago

EvanAad commented 1 year ago

The issues to be raised below were partly discussed in following post: https://tex.stackexchange.com/q/665499/21685 and in the following comment to said post: https://tex.stackexchange.com/questions/665499/numbering-and-labeling-of-equations-in-hebrew-documents#comment1654950_665499

When the document's main language is Hebrew, and the showlabels package is used, labels of equations and labels of theorems are placed in different parts of the logical page: labels of theorems are placed in the left margin, whereas labels of equations (using amsmath's equation, align, and multline environments) are placed in the right margin. Here is a minimal example demonstrating this fact.

\documentclass{article}

\usepackage[bidi=basic]{babel}
\babelprovide[main,import]{hebrew}
\babelfont{rm}[Renderer=Harfbuzz]{FreeSans}

\usepackage{amsmath}
\newtheorem{theorem}{Theorem}

\usepackage{showlabels}

\begin{document}

\begin{theorem}\label{T}
Everything that rises must converge.
\end{theorem}

\begin{multline}\label{M}
x = a + b\\
+ y + z
\end{multline}

\end{document}

Following is a screenshot of the relevant part of the resulting PDF file (produced with lualatex).

LabelPlacement

The situation described above holds even when the showlabels package is passed an explicit label placement option, e.g. "right".

This behavior is in contrast to the behavior demonstrated in an English document, where all labels are placed in the same margin (the right one, by default), and are moved together when a label placement option is given to the showlabels package.

The very raison etre of the showlabels package is to make it easy to visually locate labels in the typeset document. When the labels are placed in different parts of the page, and the eye has to jump from the left of the page to the right, the functionality of the showlabels package is damaged.

The problem is particularly severe when the "leqno" class option is specified. This option causes equation numbers to be placed on the left side of the page. When the document's main language is Hebrew, the labels are not placed in the margin, but inside the text area. Besides aesthetic and functional considerations, this has the consequence that in some cases the label is superimposed on the equation and both the equation and the label are then difficult to read. The following minimal example demonstrates this issue.

\documentclass[leqno]{article}

\usepackage[bidi=basic]{babel}
\babelprovide[main,import]{hebrew}
\babelfont{rm}[Renderer=Harfbuzz]{FreeSans}

\usepackage{amsmath}
\newtheorem{theorem}{Theorem}

\usepackage{showlabels}

\begin{document}

\begin{multline}\label{M}
x = a + b\\
+ y + z
\end{multline}

\end{document}

The relevant part of the resulting PDF file (produced with lualatex).

LabelPlacementWithLeqno

For greatest flexibility, the user should be allowed to choose where to place equation labels, but if no choice is given, the behavior should be the same as in an English document: that all labels - those of equations and those of theorem environments - be placed in the same logical part of the page. And this should be the case regardless of whether the "leqno" class option is specified. Furthermore, labels should not be placed inside the text area unless explicitly instructed to be so placed.

jbezos commented 1 year ago

I‘m closing this issue because it’s now listed in Enhancements requests. This doesn’t mean it’s rejected, just moved to a specific page for enhancements.