[texhax] tex goes into infinite loop

Ross Moore ross at ics.mq.edu.au
Mon Oct 11 07:51:24 CEST 2004


On 11/10/2004, at 12:22 PM, tom sgouros wrote:

>
> 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!)


Try it this way...

  \makeatletter
  \newbox\IN at topfig
  \newbox\IN at topfiga

  \def\cleartopfig{\global\setbox\IN at topfig\copy\voidb at x}
  \def\settopfig{\global\setbox\IN at topfig \vbox{\hbox{Hola!}}}

  \newtoks\IN at output
  \global\IN at output\expandafter{\the\output}
  \global\output{\the\IN at output
     \ifvoid\IN at topfig\else
       \unvbox\IN at topfig \settopfig
     \fi
   }
  \makeatother

Then use  \settopfig  in your document body (or preamble)
to start the column-header, and don't forget to
   \cleartopfig
at the end --- else it will not end at all.


>
> 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.

I tried playing with the  \outputpenalty ,
before devising the above variant on your coding.


> 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.

Fair comment.

Hopefully the above helps.
Like you, I'm not sure why it has such a radically
different result to what you were trying.

>
> Many thanks,
>

Cheers,

	Ross


> -tom
>
>  ------------------------
>  tomfool at as220 dot org
>  http://sgouros.com
>  http://whatcheer.net
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> TeX newsgroup: http://groups.google.com/groups?group=comp.text.tex
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: 
> http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
>
------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------



More information about the texhax mailing list