# [texhax] \noalign{\nobreak} seems not work!

doug waud douglas.waud at umassmed.edu
Mon Jul 14 16:23:45 CEST 2003

```Hi

Rodolfo Medina wrote:

> Something strange seems to happen:
> In the TeXbook, page 193, it is said that the command
> \noalign{\nobreak}
> after the \cr in \eqalignno
> will prohibit a page break after that line.
>
> I tried it, but it does not seem to work!
>
> On the contrary,
> \noalign{\break}
> seems to perfectly work in forcing a page breaking.
> I can't explain to myself!

This posting caught my attention and I quickly found myself in over my

I created a test file with an \eqalingnno with 12 lines positioned at
the bottom of where the first page should end and then some. TeX broke
it after line 3. I confirmed your observations --- break worked and
nobreak did not.

I then spent some time rereading the Texbook and, in particular inserted
a \tracingpages=1 along the lines of page 112. The cost reached a
minimum after the third line of that \eqalignno and then began to rise
and finally blew up when the glue on the total would no longer shrink
down to the goal. At this point things went back to that best (lowest)
cost. So far ok.

I then tried inserting nobreaks (aka penalty 10000) and they did not
appear in the \tracingpages output! All I saw was relatively small
penalties of the order of 100. In contrast, inserting a break gave a
line with a penalty of -10000 and an immediate page break. So the
problem is reproduced in the log with \tracingpages.

I also found that, if I put a break after lines four to about 9 or ten,
I could force a break there. In other words I stumbled onto a kludge
which gave the effect of a nobreak at the lines between the original
break and that inserted break!  :-). Examination of the log file with
\tracingpages on showed the reason. Where before the cost had started
slowly to climb up, it now did so until it hit that -10000 penalty and
immediately prefered that point to the old favorite.

So now the question became how did the breaks get rhough TeX's innards
but not the nobreaks.

I think the answer may lie on page 314 in the answer to exercise 14.10.
There it says that if you have two penalties in a row TeX takes the
lower one. Now, the log output indicated a penalty of about 100 without
the an inserted nobreak (I did not chase down where this came from; I
suspect it would be found in the definition of \noeqalignno) so adding
one of 10000 would do nothing.

Now it would appear that the behaviour matches the Texbook except for
the original statement you reported on P 193. Is the Texbook is