Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

eTeX's \currentgrouptype distinguishes two types of \hbox group types

\hbox{\showthe\currentgrouptype} % 3 "adjusted hbox group"
\noindent
\hbox{\showthe\currentgrouptype} % 2 "hbox group"

Looking at tex.web, I see a couple of places where hbox_group occurs:

@d hbox_group=2 {code for `\.{\\hbox}\grp'}
@d adjusted_hbox_group=3 {code for `\.{\\hbox}\grp' in vertical mode}

@<Initiate the construction of an hbox or vbox, then |return|@>=
...
  if (box_context<box_flag)and(abs(mode)=vmode) then
    scan_spec(adjusted_hbox_group,true)
  else scan_spec(hbox_group,true)

@<Cases of |handle...@>=
hbox_group: package(0);
adjusted_hbox_group: begin adjust_tail:=adjust_head; package(0);
  end;

I don't understand what adjust_tail:=adjust_head does. Perhaps something to do with the \vadjust command?

share|improve this question
    
Indeed I get currengrouptype=3 when I say \vadjust{\hbox{\showthe\currentgrouptype}} –  egreg Aug 3 '12 at 18:07
    
@egreg you get this simply because the inner pert of \vadjust is processed in vertical mode. –  Frank Mittelbach Aug 3 '12 at 18:37

1 Answer 1

up vote 15 down vote accepted

Whenever TeX starts a new level of grouping it records the current type of group so that it can do the right kind of action if a group ends. If hboxes are build it distinguishes between hboxes in horizontal mode (group code 2) and those in vertical mode (group code 3).

What is different betwen the two is that in the vertical case ins_node, mark_node and adjust_node nodes (from \insert, \mark and \vadjust) migrate out of the box into the outer part.

They are collected in the hpack routine in the list starting at the pointer adjust_head. Then when the group ends (group code 3) the head of this list is assigned to the tail of the list ending at adjust_tail and this is what you see in the above code happening.

See also §647.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.