On Sat, 1 Feb 2025 at 17:18, Udicoudco <udifoglle@gmail.com> wrote:
On Sat, Feb 1, 2025 at 4:24 PM Ulrike Fischer <news3@nililand.de> wrote:
>
> Am Sat, 1 Feb 2025 14:41:57 +0100 schrieb Hans Hagen:
>
> > You can best try to handle this at the macro level. Page direction can
> > badly interfere anyway and every change we make to the diretion code
> > will introduce another issue. Just don't use it. FWIW, in luametatex we
> > don't even have \pagedirection any more.
>
> I came to the same conclusion after doing a number of tests (in
> https://github.com/LaTeX-Package-Repositories/geometry/issues/20#issuecomment-2154455298)
> where my summary was "As you want 'left margin' to mean 'left
> margin' imho the correct way to handle this not to set these
> directions at all. It looks wrong to change all reference points and
> then to add lots of complicated calculations to get the old
> behaviour back."
>

I was probably rambling too much :)
In practice there is only one bad case left,
which could be fixed like the other cases:

\catcode`\{=1\catcode`\}=2\catcode`\$=3
\directlua{tex.enableprimitives("",{"Umathquad", "mathdirection",
"predisplaydirection",
"pagedirection", "bodydirection"})}

\font\tenrm=cmr10
\textfont0=\tenrm\textfont1=\tenrm
\tenrm
\hsize=345pt\vsize=550pt\parfillskip=0.0pt plus 1.0fil
\parindent=15pt\parskip=0pt plus1pt
\Umathquad\textstyle=10pt

\mathdirection1
(l)=false swapdir=true mathdir=TRT
$$\predisplaydirection=-1 1 \leqno(1)$$

\pagedirection=1\bodydirection=1
\end

but as you suggested' I'm trying to avoid
the usage of \pagedirection and \bodydirection,
so I don't have a strong opinion if it should be fixed or not.

I attached another patch.
*Most Importantly* this patch also
amends the last one, as I did not consider
correctly some cases in a situation where
the equation number is "too close".

If you don't want to fix this last case, I'll send a patch
which only fixes the last commit.

I apply the patch on gitlab-lisn
but I wait to upload it to texlive;
if there are problems we will decide the final version.
 
--
luigi