[comp.text.tex] summary on \midinsert

neumann@FUNCTION.MPS.OHIO-STATE.EDU ("Walter D. Neumann") (03/12/91)

Thank-you to all who responded about the problems with midinserts
getting out of order.  The most severe problems I was having turned
out to be an error in a local style file, though the same problem
existed in early versions of plain.tex.  After careful testing I am
fairly sure that this problem (a midinsert that does not fit on the
current page being converted to a topinsert that then does fit on the
current page) is truly fixed in version 3.0 of plain.tex.  Michael
Downes was the one who pointed this out:
 
"You might try checking your version of plain.tex to see if you have a
recent one (version 3.0 or later).  There was a problem with the
definition of \endinsert in older versions because \pageshrink was not
taken into account."
 
A lesser problem (obscurely documented in Exercise 15.5 of the
TeXbook) was addressed by Romesh Kumar:
 
"The problem arises if a relatively large insertion is followed almost
immediately by a short one, and there is enough space on the current
page to accommodate the second insertion but not the first one.  In
this case, the first insertion is converted (by TeX) to a \topinsert,
after which the second insertion is processed for the current page as
usual.  A possible way to way to avoid this is to type:
   \ifnum \insertpenalties > 0 \topinsert \else \midinsert \fi
instead of \midinsert to begin the insertions. \insertpenalties is the
number of insertions being held over for a succeeding page."
 
Indeed, one might use \MidInsert instead of \midinsert, defined by:
\def\MidInsert{\ifnum\insertpenalties>0\topinsert\else\midinsert\fi}
 
This appears to work fine, but I am not sure why.  My experiments
indicate that \insertpenalties is 100 if any topinsertions are
pending, no matter how many, which is not what the TeXbook led me
(or Kumar) to believe.
 
 
 
--
 Walter Neumann                     Email:       neumann@mps.ohio-state.edu
 Department of Mathematics                       neumann@ohstpy.bitnet
 Ohio State University              Fax: 614-292-3639 to Neumann, Math Dept
 Columbus, OH 43210          Tel: (614)-292-4886(office) 292-4975(messages)

ogawa@ORION.ARC.NASA.GOV (Arthur Ogawa) (03/13/91)

Note that \insertpenalties is checked as part of the \dosupereject macro
(see p. 256 of the TeXbook).
 
The meaning of \insertpenalties can be gleaned from a close reading of
pp 123-125, ending with a deep breath. I think the statment there that
"the total number of such insertinos appears in \insertpenalties
during an \output routine" has been a bit misleading to Walter and
Romesh.  Earlier on, Knuth says that $q$ (\insertpenalties) is
accumulating the value of \floatingpenalty.
 
Anybody can supply details from vol B?  In particular, is the value of
\insertpenalties valid outside of the output routine? Is it different?

ASND@TRIUMFER.BITNET (Donald Arseneau) (03/13/91)

Yes, \insertpenalties has two totally different meanings:
Normally, it is the sum of the penalties for split insertions on a page
(generally 100 because topinserts start with \penalty100), but in
an output routine it is the NUMBER of pending insertions, and has nothing
to do with penalties.
 
Extremely confusion, but typical Knuthian optimization.
ng
 
Donald Arseneau          asnd@triumfcl
                         asnd@reg.triumf.ca

ogawa@ORION.ARC.NASA.GOV (Arthur Ogawa) (03/14/91)

Date: Tue, 12 Mar 91 11:34:38 -0800
From: "Arthur Ogawa" <ogawa>
To: neumann@function.mps.ohio-state.EDU, info-tex@SHSU.BITNET
In-Reply-To: "Walter D. Neumann"'s message of Tue, 12 Mar 91 10:29:50 EST
 <9103121529.AA20581@function.mps.ohio-state.edu>
Subject: summary on \midinsert
 
Note that \insertpenalties is checked as part of the \dosupereject macro
(see p. 256 of the TeXbook).
 
The meaning of \insertpenalties can be gleaned from a close reading of
pp 123-125, ending with a deep breath. I think the statment there that
"the total number of such insertinos appears in \insertpenalties
during an \output routine" has been a bit misleading to Walter and
Romesh.  Earlier on, Knuth says that $q$ (\insertpenalties) is
accumulating the value of \floatingpenalty.
 
Anybody can supply details from vol B?  In particular, is the value of
\insertpenalties valid outside of the output routine? Is it different?