
On 2/5/2025 9:57 PM, Udicoudco wrote:
This is the current test for deciding not to use shortskip
((d + line_s <= pre_display_size_par) || ((! dir_math_save && l) || (dir_math_save && ! l)))
It has two problems:
* if eqno_box is null then l (the leqno bool) is always false, so for short unnumbered equations the test is reduced to the value of dir_math_save which is based on \textdirection and \mathdirection, but in this case shortskip should always be used.
* dir_math_save is correlated to \textdirection, but the shortskip detection should be based on the position of the equation number, and parfillskip, none of which \textdirection controls. I think \pardirection should be tested here.
Here is a faulty example, where shortskip should be used but it is not
\matheqdirmode=1\pardirection=1\textdirection=1 Test $$ Test $$ Test \bye
In fact if I change \textdirection in this example shortskip is used, which kind of demonstrates the second point.
For a better example of the second point you can test
\matheqdirmode=1\textdirection=1 Test $$ Test\leqno(1) $$ Test \bye
Whereas \textdirection and \mathdirection are opposites dir_math_save is true and leqno bool is false, hence short skp is used but the output clearly shows it should not be, as the equation number is right below the text.
Note that I also tested with LuaTeX 1.18.0 to make sure this is not the fault of recent changes.
I attached a patch.
we (luatex team) are starting to worry about this kind of accumulated patching because it all interferes so one option is to delay these patches till after the 2025 code freeze one can make a point that if we have directions at all, short skips should never kick in and that one should handle it either in macros or in lua callbacks where one can fine tune for a specific situation these three-dir-var relates heuristics are messy Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------