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.

I admit that this post is purely idle curiosity. But I recently stumbled upon a little factoid saying that the TeX error "Interwoven alignment preambles are not allowed" has the following explanation in the manual

If you have been so devious as to get this message, you will understand it, and you will deserve no sympathy.

This tickles my funny bone in the right way, but it also scratches my curiosity cat behind the ears. Does anyone know what real reason for this error message, and why it's treated as so utterly abhorrent?

share|improve this question
1  
The TeX program (texdoc tex) has five call points for this error. Two of the more informative comments are in the introductions to section 1131: "An align group code is supposed to remain on the save stack during an entire alignment, until fin align removes it. A devious user might force an endv command to occur just about anywhere; we must defeat such hacks." and section 789: "This part of the program had better not be activated when the preamble to another alignment is being scanned, or when no alignment preamble is active." –  mas Sep 12 '11 at 9:59

1 Answer 1

The shortest way I know to get the error is

\halign{\valign#\cr\cr

There's also

\halign\valign\cr\cr

which however produces other errors before the "Interwoven alignment" one. It's a situation where reading further tokens won't be sufficient to keep TeX going as it's possible with other errors: at least looking at the fatal_error routine called when it's found, it seems that Knuth wasn't able to find other ways to escape from the situation.

share|improve this answer
    
Could you explain a little what goes wrong here? My naive reading says that TeX should start scanning \halign's header, find that the first cell contains a "u-part" \valign and an empty "v-part", and that there are no further cells, and then start processing the body. It would see \cr immediately, so place \valign before the (empty) content. That would be an error, but I don't see why it represents an "interwoven alignment preamble", since the first preamble would have ended by the time \valign was actually executed. –  Ryan Reich Nov 6 '11 at 19:26
    
@RyanReich While it wouldn't be strictly necessary to have a brace after \valign, since the # might provide it, TeX needs to set up its alignment mechanism, and in this case it turns out to be impossible; with \halign instead of \valign you'd not get the dreadful error, but other errors anyway. –  egreg Nov 6 '11 at 19:58

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.