
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. Udi