neumann@FUNCTION.MPS.OHIO-STATE.EDU ("Walter D. Neumann") (03/19/91)
The following is my attempt to correct some problems Larry Siebenmann
and I have been having with the \midinsert and \topinsert macros of
plain. Our use of these is to include figures into articles in a
Proceedings we are editing, as in:
\midinsert
\special{<appropriate command to load graphics file>}
\medskip\centerline{Figure 1.1}
\endinsert
Comments would be appreciated. -walter neumann
%% newinsert.tex 3/17/91
% walter neumann (neumann@mps.ohio-state.edu)
%
% Include with ``\input newinsert.tex'' to fix following
% problems with plain's handling of \midinsert and \topinsert:
%
% 1. An insert that falls at the top of the page is too high: it's
% top is at top-of-page (baseline of an imaginary line of text
% above the top line of text on page) rather than top-of-ink.
% 2. Space around inserts is given by \bigskip, rather than being
% independently setable.
% 3. Too much space between inserts that directly follow each other.
% 4. Inserts can get out of order (see Exercise 15.5 of TeXbook).
%
\chardef\OldCatAt\the\catcode `\@
\catcode `\@=11
%
%%%%%%%%%%%%%%%%%
% Corrected insert macros for plain.tex
%
% Plain.tex puts \bigskipamount of space before and after inserts.
% We provide \insertskipamount for this purpose (default \medskipamount).
% In addition, \inserthardskipamount of glue is added at the top
% of EVERY insert; it remains even at top of page (default 6pt).
%
% The following is new
%
\newskip\insertskipamount\newskip\inserthardskipamount
\insertskipamount\medskipamount
\inserthardskipamount 6pt
\def\insertskip{\vskip\insertskipamount}
%
% From here on we modify definitions in plain.tex.
%
% Redefine \midinsert so it converts to \topinsert if any middle
% insertions have already been split, to prevent inserts getting
% out of order (cf. TeXbook Exercise 15.5).
% Was: \def\midinsert{\@midtrue\@ins}
\def\midinsert{\ifnum\insertpenalties>0
\topinsert\else\@midtrue\@ins\fi}
% Redefine \@ins to put in the \inserthardskipamount of glue
% Was: \def\@ins{\par\begingroup\setbox\z@\vbox\bgroup}
\def\@ins{\par\begingroup\setbox\z@\vbox\bgroup%
\vglue\inserthardskipamount}
% Changes to \endinsert of plain.tex 3.0:
% - Use \insertskipamount instead of \bigskipamount throughout.
% - Remove previous skip if less than skip to be inserted.
% - Add \nointerlineskip to avoid unwanted extra 1pt skip.
\def\endinsert{\egroup % finish the \vbox
\if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@
\advance\dimen@\insertskipamount% was 12pt
\advance\dimen@\pagetotal\advance\dimen@-\pageshrink
\ifdim\dimen@>\pagegoal\@midfalse\p@gefalse\fi\fi
% The following ...
\if@mid\ifdim\lastskip<\insertskipamount
\removelastskip\insertskip\fi
\nointerlineskip\box\z@\penalty-200\insertskip
% ... was: \if@mid \bigskip\box\z@\bigbreak
\else\insert\topins{\penalty100 % floating insertion
\splittopskip\z@skip
\splitmaxdepth\maxdimen \floatingpenalty\z@
\ifp@ge \dimen@\dp\z@
\vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero
\else \box\z@\nobreak\insertskip\fi}\fi\endgroup}
%
% End of changes
%
\catcode `\@=\OldCatAt
\endinput
%%% end newinsert.tex
--
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)