[texhax] tex goes into infinite loop
tom sgouros
tomfool at as220.org
Mon Oct 11 04:22:55 CEST 2004
Ross:
Thanks for the suggestions. But this isn't quite the answer.
>On Mon, 11 Oct 2004 10:11:46 +1000, Ross Moore wrote:
>>
>> \documentclass[twocolumn]{article}
>>
>> \makeatletter
>> \newbox\IN at topfig
>> \newbox\IN at topfiga
>> \newtoks\IN at output
>> \global\IN at output\expandafter{\the\output}
>> \global\output{%
>> \expandafter\the\IN at output%
>> \ifvoid\IN at topfig \else\unvbox\IN at topfig\fi%
>> \global\setbox\IN at topfig \vbox{\hbox{Hola!}}
>> }
> Firstly, don't you want here either:
> \global\output\expandafter{\the\IN at output ... }
Probably you're right here. My way does work, but it would be
neater your way.
> Secondly, your use of \unvbox places material back onto
> the vertical-list, every time the \output routine is called
> (except perhaps for the first time).
> Hence TeX will *always* think that there is more work to do.
If I remove the \setbox line, I can add boxed material in the text and
it appears on the top of the following page with no trouble: no
infinite loop, and the pages look fine. If I follow the
\unvbox with a \setbox to the now-empty box, I get an infinite loop.
If I leave in the \setbox and remove the \unvbox, the looping goes
away, too. (And so does the Hola!)
I had thought that \unvbox emptied the box and it was now available to
use again. I also thought that \setbox wouldn't add anything to the
vertical list. But apparently the interaction is more subtle than I'd
thought, or at least it is in an \output routine, and I can't see how
or why. Which is my problem.
> It looks like you are trying to place constant material on every page,
> by having the \output routine from the previous page place it there.
> Apart from the logical flaw in this approach, whereby TeX can never
> finish, working with \output routines in this way is *very* tricky.
Quite right, it is. This is why I've found myself consulting the list.
> It's much easier to redefine \shipout to position the new material
> as a box of zero size. This is what the {everyshi} package does.
> Have you tried this ?
> Is there a reason that isn't suitable for your needs ?
The everyshi package lets you put material on the page you just
finished. This is good, but if the material you want to place
requires that you had already left extra room on that page to do it,
everyshi doesn't help you.
Many thanks,
-tom
------------------------
tomfool at as220 dot org
http://sgouros.com
http://whatcheer.net
More information about the texhax
mailing list