On 1/19/2026 2:55 PM, luigi scarso wrote:


On Wed, 14 Jan 2026 at 10:56, Udi Fogiel <[email protected] <mailto:[email protected]>> wrote:

    Hello,

    Here is what happens when \vcenter is encountered:

    staticvoidrun_vcenter(void){
         scan_spec(vcenter_group);
         normal_paragraph();
         push_nest();
         mode = -vmode;
         prev_depth_par = ignore_depth;
    if(every_vbox_par != null)
             begin_token_list(every_vbox_par, every_vbox_text);
    }

    So unlike other boxes is uses scan_spec and not scan_full_spec,
    which means it cannot accept the attr and (b)dir keywords, and the
    directions registers are not set to its direction
    inside of it.

    Then when it finishes we have:

    voidfinish_vcenter(void)
    {
         halfword p;
         unsave();
         save_ptr--;
         p = vpack(vlink(cur_list.head_field), saved_value(0),
    saved_level(0), -1);
         pop_nest();
         p = math_vcenter_group(p);
         tail_append(p);
    }

    And because of the -1 in the last argument, its direction is
    determined by \bodydirection,
    unlike other boxes which in math context use \mathdirection if a
    (b)dir keyword was not specified.

    Why is that? It feels a bit inconsistent, and makes it a bit hard to
    follow directions.


I guess since mathematical typesetting is quite complex and we want to maintain some degree of compatibility with pdftex, \vcenter remains largely unchanged (on the other hand, I think using the token lib it is possible to get something similar to \hbox/\vbox for \vcenter) .

also, in luatex, vcenter is a math only command and injects a noad and not a box (vlist) so introducing attr and dir there would also mean figuring out how to deal with it in the perspective of math (like what should get the attr and when); as vcenter is often used low level and can wrap any content one can mess with that instead

so here compatibility is indeed the verdict (changing this after two decades is also a bit dangerous wrt compatibility)

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
-----------------------------------------------------------------
_______________________________________________
dev-luatex mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to