On Fri, 6 Feb 2026 at 12:28, Udi Fogiel <[email protected]> wrote:

>
>
>
>
>
> Sent with Proton Mail secure email.
>
> On Monday, January 19th, 2026 at 4:55 PM, Hans Hagen <[email protected]>
> wrote:
>
> >
> >
> > 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)
> >
>
> Thanks for the answers luigi and Hans.
>
> The fact that \vcenter does not accept a (b)dir and attr keywords
> does make sense, but what more bother me is if the side effects of that,
> i.e. setting the vlist direction as \bodydirection rather than
> \mathdirection (which I find it odd for math typesetting), and not setting
> \textdirection, \pardirection and \bodydirection inside the group (which is
> a bit inconsistent), are desired.
>
> At the end these facts are not really bad, just peculiarities I guess. So
> unless you think it should be changed
> probably just more technical documentation about how the directions model
> work in LuaTeX will make this less surprising. I don't mind working on
> that at some point.
>
>

I guess this isn't a new idea, but you can ask some free AI chat something
like "In luatex, why doesn't \vcenter have the (b)dir attribute like
\vbox?"
and, once in context,
"A Lua script that "monkey-patches" \vcenter to take a dir argument."

At least you can have some fun coding.
--
luigi
_______________________________________________
dev-luatex mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to