%% noreins.sty -- experimental fix of bug %% latex/3370, 3541, 3719. %% (C) 2005 Uwe Lueck http://contact-ednotes.sty.de.vu %% Adapted from lineno.sty, due to Stephan I. Boettcher %% and Frank Mittelbach. \def\filedate{2005/04/01} \def\fileversion{v0.1} %% RIGHTS: LaTeX Project Public License (LPPL) v1.3a %% -- author-maintained. %% %% * FIRST BRIEF INTRODUCTION: * % %% PURPOSE/WARNING: % Experts know well that \@reinserts in LaTeX's \@specialoutput % -- which handles floats (figures, tables) and \marginpar's -- % may cause wrong order of footnote splits or output of % footnotes on unnecessarily late pages. Just disabling % \@reinserts or dropping it, as David Kastrup recommends in % latex/3541, has other disadvantages. TeX3 was equipped with % \holdinginserts to deal with problems of this kind. Yet LaTeX % has still not made use of it, since it seems that this would % still require redisigning LaTeX's output routine entirely. % Here is an experimental, simple fix (!?). It replaces the % problem by another one, yet the new one might show up more % rarely or might easier be dealt with by non-expert users -- I % would like to know. % %% USAGE: % Just load the package. It doesn't define any user commands. % %% MISSING: % Demonstration files showing problems must be added. One % problem with the problem is that it seems to show up only % accidentally during working, but disappears when you try to % make a demonstration file. Even although I think that I can, % in a somewhat abstract way, name the conditions under which % the problem shows up, I find it difficult to "reliably" % demonstrate it. E.g., when I try to tie two lines together, a % surprising \penalty0 comes from the float mechanism and makes % it impossible. The "reliable" demonstration files that I could % make so far use lineno.sty and so are little useful for a % general discussion of \@reinserts and \holdinginserts. -- And % it would be good to have a review of discussions of the matter % here or in one nearby file. And a digest for non-experts would % be good. % %% MORE INFORMATIONS: % In the recent days, there was an intense discussion of the % matter on the LaTeX-L e-mail list. % %% WELCOME: % Suggestions on nearly everything, especially implementation, % different algorithms, different names; demonstration files; % where, how, whether present these experiments. % %% ACKNOWLEDGEMENT / PRESENT IMPLEMENTATION: % This is a variant of how lineno.sty, say v3.02ff., has used % \holdinginserts, due to Stephan I. Boettcher and Frank % Mittelbach. Particular purposes: As compared with the proposal % in latex/3719, the implementation is intended to work % relatively independently of other changes of the output % routine, maybe due to different LaTeX versions or due to % packages like longtable. It is even intended that it doesn't % conflict with uses of \holdinginserts by other packages or a % future LaTeX version, but it is not clear to me how probably % this works. -- The problem that the implementation introduces % is that the float mechanism measures the \footins box to % decide about placement of floats, while with \holdinginserts>0 % the \footins box is "spuriously" empty. -- One further % difference to the proposal in latex/3719 is that % \holdinginserts is not decreased for \clearpage here. -- A % problem discussed on LaTeX-L is whether/how % \penalty\outputpenalty should be used. The present proposal is % just what lineno.sty has done when I found it. -- \@reinserts % is neither defined away nor circumvented, it will just find % that there is nothing to reinsert. % \ProvidesPackage{noreins}[\filedate\space\fileversion\space do without \string\@reinserts] % \let\@reinserts\relax % TODO!? another package might use it. \chardef\@vl=45 % Latin `vl' is written `ul' in critical editions. \global\holdinginserts\@vl % But how cooperate ...!? % (cf. lineno.sty) \let\@UAR@output\output % Universally Avoiding \@reinserts. \newtoks\output \output\expandafter{\the\@UAR@output} \newif\if@UAR@goodoutput % lineno.sty has used \[log in to unmask] \@UAR@output{% \@UAR@goodoutputtrue \ifnum\holdinginserts=\@vl \ifnum\outputpenalty>-\@Mii \@UAR@goodoutputfalse \else \ifnum\outputpenalty<-\@Miv % \@Miii breaks. \@UAR@goodoutputfalse \fi \fi \fi \if@UAR@goodoutput \the\output \ifnum\holdinginserts-\@vl \global\holdinginserts\vl \fi \else \unvbox\@cclv \global\holdinginserts-\@vl \ifnum\outputpenalty=\@M \else \penalty\outputpenalty \fi \fi } \endinput