I was trying to figure out an automatic answer to Sharing alignment between equations in two different items by way of typesetting an {align}
inside a \vbox
and then using \unvbox
and \lastbox
repeatedly to get the lines of the alignment. Alas, this does not work, as this session with latex
shows:
>latex
**\relax
*\documentclass{article}\usepackage{amsmath}\begin{document}
*\setbox0=\vbox{\begin{align*} a&=b \end{align*}}
*\tracingonline=1
*\showbox0
> \box0= []
! OK.
<*> \showbox0
?
*
*\unvbox0
*\unskip
*\setbox1=\lastbox
*\showbox1
> \box1=void
! OK.
<*> \showbox1
?
How can there be nothing in the box? Doesn't TeX typeset something? This is surely a mathmode thing, except that the following does work:
> tex
**\relax
*\setbox0=\vbox{$$\eqalign{a&=b}$$}
*\tracingonline=1
*\showbox0
> \box0=
\vbox(22.5+0.0)x469.75499
.\hbox(0.0+0.0)x469.75499, glue set 449.75499fil
..\hbox(0.0+0.0)x20.0
..\penalty 10000
..\glue(\parfillskip) 0.0 plus 1.0fil
..\glue(\rightskip) 0.0
.\penalty 10000
.\glue(\abovedisplayshortskip) 0.0 plus 3.0
.\glue(\baselineskip) 3.5
.\hbox(8.5+3.5)x26.24402, shifted 221.7555
..\hbox(0.0+0.0)x0.0
..\glue 1.66663
..\vbox(8.5+3.5)x22.91077
...\hbox(8.5+3.5)x22.91077 []
..\glue 1.66663
.etc.
! OK.
<*> \showbox0
?
*
(\eqalign
is the TeX version of {align}
, to some extent). Perhaps it is more that the AMS environments do what the TikZ documentation refers to as "wicked things", but I don't see how they could trick TeX itself into thinking the box were empty. I do notice that even in the \eqalign
example, the innermost box of the alignment is \hbox(8.5+3.5)x22.91077 []
; going by the dimensions \hbox(0.0+0.0)x469.75499, glue set 449.75499fil
, this is the text (i.e. a = b
) but the empty brackets indicate that there is nothing inside the box. So maybe it is a mathmode thing after all and the AMS' wickedness is just hiding the surrounding material as well?
So, is there any way to unwrap an {align}
?
\intertext
.amsmath
uses\noalign
to solve the problem. I think it is the right way.\item
s but between different paragraphs.\noalign
won't work for that.