This is centered:
$$\vbox{\halign{#\cr A\cr}}$$
Why this is not centered?
$$\halign{#\cr A\cr}$$
BTW, why \hbox{\halign{#\cr A\cr}}
does not work?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityThis is centered:
$$\vbox{\halign{#\cr A\cr}}$$
Why this is not centered?
$$\halign{#\cr A\cr}$$
BTW, why \hbox{\halign{#\cr A\cr}}
does not work?
\halign
is a vertical command, meaning that it starts vertical mode when encountered, as this example shows
\parindent=0pt % To see the left margin
Foo bar baz \halign{#\cr A\cr} bar foo baz
\bye
Vertical commands raise an error when used in restricted horizontal mode (i.e. within \hbox
).
However, there exists the display alignment, specified as
$$⟨assignments⟩ \halign⟨box specification⟩{...} ⟨assignments⟩$$
where the ⟨assignments⟩ are optional things like parameter changes that do not produce any math lists.
Such an alignment is shifted by \displayindent
and surrounded
by \abovedisplayskip
and \belowdisplayskip
glue. (From TeX by Topic, Sec 25.2.1.) Usually within a paragraph \displayindent
is 0pt
(but \parshape
or \hangindent
can change this); that's why you see a left-aligned formula
\parindent=0pt % To see the left margin
Foo bar baz
$$\halign{#\cr A\cr}$$
Foo bar baz
$$\displayindent=1em\halign{#\cr A\cr}$$
\bye
$$\vbox{\halign...
. But answers to 22.9, 22.7 and 22.6 consistently use $$\halign...
. Just wondering...
– Igor Liferenko
Jan 14 '20 at 8:39
$$
, the second form is the special display alignment construct as described in this answer.
– David Carlisle
Jan 14 '20 at 9:26
\halign to\displaywidth
, the other two have \halign to\hsize
.
– egreg
Jan 14 '20 at 17:14