texlive[55058] Master/texmf-dist: marginfix (7may20)
commits+karl at tug.org
commits+karl at tug.org
Thu May 7 23:25:56 CEST 2020
Revision: 55058
http://tug.org/svn/texlive?view=revision&revision=55058
Author: karl
Date: 2020-05-07 23:25:56 +0200 (Thu, 07 May 2020)
Log Message:
-----------
marginfix (7may20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/marginfix/marginfix.pdf
trunk/Master/texmf-dist/source/latex/marginfix/marginfix.dtx
trunk/Master/texmf-dist/tex/latex/marginfix/marginfix.sty
Modified: trunk/Master/texmf-dist/doc/latex/marginfix/marginfix.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/marginfix/marginfix.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/marginfix/marginfix.dtx 2020-05-07 21:25:38 UTC (rev 55057)
+++ trunk/Master/texmf-dist/source/latex/marginfix/marginfix.dtx 2020-05-07 21:25:56 UTC (rev 55058)
@@ -12,10 +12,10 @@
%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{marginfix}%
- [2013/09/08 v1.1 Fix Margin Paragraphs]
+ [2020/05/06 v1.2 Fix Margin Paragraphs]
%<*driver>
\documentclass{ltxdoc}
-\CheckSum{1197}
+\CheckSum{1159}
%\OnlyDescription % (un)comment this line to show (hide) source code
\RecordChanges
\EnableCrossrefs
@@ -70,6 +70,9 @@
% {(SDH) Globally calculate margin phantoms over 4 passes.}
% \changes{v1.1}{2013/09/08}
% {(SDH) Add \cs{topskip} to notes at the top of the margin.}
+% \changes{v1.2}{2020/05/06}
+% {(SDH) Fix long-standing bug where margin notes called out in
+% the last few points of a page were being entirely dropped.}
%
% \GetFileInfo{marginfix.dtx}
% \title{\Lopt{marginfix} package documentation}
@@ -225,8 +228,7 @@
% \begin{macros}{\MFX at debug}
% We have some optionally-included code for debugging. \cs{MFX at debug}
% prints a new line followed by ``|MFX: |'' and then the message.
-% The newline can be suppressed with a |*|. We'll also ask for more
-% error context in the debug mode.
+% We'll also ask for more error context in the debug mode.
% \begin{macrocode}
%<*debug>
\def\MFX at debug{\message{^^JMFX:}\message}
@@ -234,8 +236,6 @@
\def\MFX at mac#1{\expandafter\MFX@@mac\meaning#1>>>}
\def\MFX@@mac#1->{<<<}
\def\MFX at htdp#1{\ht#1=\the\ht#1, \dp#1=\the\dp#1}
-\showboxbreadth=100
-\showboxdepth=10
%</debug>
% \end{macrocode}
% \end{macros}
@@ -511,11 +511,11 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\MFX at cons,\MFX at snoc,\MFX at run@clear}
+% \begin{macros}{\MFX at cons,\MFX at snoc}
% In passing we'll define the cons macro, which fully-expands
% its second argument, but makes sure to only expand the first
% one once, so that any fragile control sequences in it are
-% corectly protected. We also define snoc, which prepends.
+% correctly protected. We also define snoc, which prepends.
% Note that we could put the \cs{temp@} definition into a group
% if it was really gonna matter\ldots
% \begin{macrocode}
@@ -533,6 +533,9 @@
\expandafter\expandafter\expandafter{\expandafter\temp@#1}%
}
% \end{macrocode}
+% \end{macros}
+%
+% \begin{macros}{\MFX at run@clear}
% Finally, \cs{MFX at run@clear} is a quick trick to expand the
% contents of a macro and then clear it (to \cs{@empty}) before
% any of its tokens are consumed.
@@ -602,7 +605,7 @@
% \end{macros}
%
% \section{Shipout-time patches}
-% \begin{macros}{\@combinefloats,\MFX at combinefloats@before}
+% \begin{macros}{\@combinefloats}
% We need to patch in somewhere before \cs{@combinefloats} at the latest,
% so that any heights calculated from \cs{@pageht} are correct---otherwise
% the top figures will confuse us. So we'll start by simply adding our
@@ -611,7 +614,9 @@
\expandafter\def\expandafter\@combinefloats\expandafter{\expandafter
\MFX at combinefloats@before\@combinefloats}
% \end{macrocode}
-%
+% \end{macros}
+%
+% \begin{macros}{\MFX at combinefloats@before}
% \cs{MFX at combinefloats@before} is then responsible for picking the
% needed notes from \cs{mfx at marginlist}, building them into a box, and
% attaching that box onto the correct side of \cs{@outputbox}. We also
@@ -636,25 +641,11 @@
\def\MFX at attachmargin{%
%<debug>\MFX at debug{attachmargin}%
% \end{macrocode}
-% First, we need to make sure that the boxes we're combining are the
-% same size.
+% We start by moving the reference point of \cs{Mfx at marginbox} to the top.
% \begin{macrocode}
%<debug>\MFX at debug{attachmargin: \MFX at htdp\@outputbox, \MFX at htdp\Mfx at marginbox}%
- %<debug>\showbox\@outputbox
- %<debug>\showbox\Mfx at marginbox
\setbox\Mfx at marginbox\vtop{%
\vskip\z@\unvbox\Mfx at marginbox}%
- %% \ifdim\ht\@outputbox<\ht\Mfx at marginbox
- %% \setbox\Mfx at marginbox\vbox to \ht\@outputbox{%
- %% \unvbox\Mfx at marginbox
- %% \vskip\z@ shrink 1filll\relax
- %% }%
- %% \else
- %% \setbox\Mfx at marginbox\vbox to \ht\@outputbox{%
- %% \unvbox\Mfx at marginbox
- %% \vfill
- %% }%
- %% \fi
% \end{macrocode}
% Next we need to figure out which side of \cs{@outputbox} to attach
% the \cs{Mfx at marginbox} on. We now use \cs{columnwidth} instead of
@@ -665,10 +656,10 @@
% might have unintended consequences w.r.t. any glue being retained that
% should have been swallowed. This will require further investigation.
% \begin{macrocode}
- \setbox\@outputbox\vbox{% to \ht\@outputbox{%
+ \setbox\@outputbox\vbox{%
\begingroup
- \setbox\@tempboxa\vbox{% to \ht\@outputbox{%
- \hbox{% to \wd\@outputbox{%
+ \setbox\@tempboxa\vbox{%
+ \hbox{%
\if\MFX at leftmargin
\llap{\box\Mfx at marginbox\hskip\marginparsep}%
\else
@@ -683,7 +674,6 @@
\unskip
\unvbox\@outputbox
}%
- %<debug>\showbox\@outputbox
}
% \end{macrocode}
% \end{macros}
@@ -704,7 +694,7 @@
% line up the notes with their callouts). This procedure happens in
% four passes. But first, we initialize \cs{Mfx at marginheight} to
% \cs{@colroom}, which is the height of the page minus any floats that
-% have been added to the top of bottom (these floats may extend into the
+% have been added to the top or bottom (these floats may extend into the
% margins: in the future we may look into detecting this and using the
% whole page, with overwide floats blocked off as phantoms). We add
% \cs{@colroom} rather than assigning it because any global or per-page
@@ -794,12 +784,10 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\MFX at margin@note at down,\MFX at margin@skip at down,
-% \MFX at margin@clear at down}
% We now define the various |\MFX at margin@... at down| macros.
% At this stage in the game, the only difference between notes
% and skips is that we ignore skips before any notes by setting
-% \cs{mfx at build@note} initially to \cs{@gobble}. Once we've
+% \cs{mfx at build@skip} initially to \cs{@gobble}. Once we've
% seen the first note, skips are treated exactly the same: as
% fixed-height material. If there is room in the current piece
% for the given height, then we prepend it to \cs{mfx at marginout},
@@ -808,6 +796,7 @@
% \cs{mfx at pieceheights} and try again, until \cs{mfx at pieceheights}
% is empty and we simply defer everything to later pages.
%
+% \begin{macros}{\MFX at margin@note at down}
% Upon seeing a note, we must do several things:
% \begin{enumerate}
% \item determine which box (left or right) is needed for the
@@ -836,7 +825,9 @@
\fi
}
% \end{macrocode}
+% \end{macros}
%
+% \begin{macros}{\MFX at margin@skip at down}
% Skips are similar. A skip needs only to save itself back into
% \cs{mfx at marginout}, provided it fits. If not, there is no need
% to defer it because it will just get gobbled at the top of the
@@ -851,7 +842,9 @@
\fi
}
% \end{macrocode}
+% \end{macros}
%
+% \begin{macros}{\MFX at margin@clear at down}
% Finally, \cs{MFX at margin@clear at down} is the only place we actually
% need to handle full-margin clears, since the downward pass does not
% ever push \cs{mfx at build@clear} onto \cs{mfx at marginout}. When we
@@ -870,7 +863,7 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\MFX at check@fit,\MFX at popdimen}
+% \begin{macros}{\MFX at check@fit}
% We factored out some of the common functionality between the
% note and skip routines, so that must now be defined. The
% \cs{MFX at check@fit} macro acts as a conditional and should be
@@ -901,6 +894,8 @@
\if at tempswa % start a new \if
}
% \end{macrocode}
+% \end{macros}
+% \begin{macros}{\MFX at popdimen}
% Here is a quick convenience routine. \cs{MFX at popdimen}\marg{dimen}%
% \marg{list} removes the first dimension from \emph{list} and stores
% it into \emph{dimen}.
@@ -917,7 +912,7 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\MFX at whichbox,\MFX at leftmargin}
+% \begin{macros}{\MFX at whichbox}
% We also need to determine which box should be used, since they
% may have different heights. The macro \cs{MFX at whichbox}%
% \marg{target-box}\marg{left-box}\marg{right-box} checks which margin
@@ -933,9 +928,11 @@
%<debug>\MFX at debug{whichbox: \@marbox (\the\dimexpr\ht#1+\dp#1)}%
}
% \end{macrocode}
+% \end{macros}
%
-% And here is the logic to figure out which margin were in, based
-% on the page number and other flags. This is another conditional-like
+% \begin{macros}{\MFX at leftmargin}
+% And here is the logic to figure out which margin we're in, based on
+% the page number and other flags. This is another conditional-like
% macro, and should be used after an \cs{if}, as in
% \cs{if}\cs{MFX at leftmargin}\ldots\cs{else}\ldots\cs{fi}.
%
@@ -1022,7 +1019,7 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\MFX at margin@note at up,\MFX at margin@skip at up}
+% \begin{macros}{\MFX at margin@note at up}
% We must again define the specific behavior of each build command.
% These macros simply reuse \cs{MFX at check@fit}, but ask it to
% decrement the piece counter when a piece runs out of space.
@@ -1045,7 +1042,7 @@
% look for a piece that can fit this note, making sure to decrement
% the piece count and pop off a phantom for each new piece we check.
% Once it's found, we add the note back to \cs{mfx at marginout} with
-% the corect piece.
+% the correct piece.
% \begin{macrocode}
\if\MFX at check@fit{\advance\Mfx at piece@count\m at ne
\MFX at popdimen\dimen@\mfx at phantomheights}{\ht#1+\dp#1}%
@@ -1055,6 +1052,9 @@
\else\MFX at AssertionError\fi
}
% \end{macrocode}
+% \end{macros}
+%
+% \begin{macros}{\MFX at margin@skip at up}
% Skips are similar, but we have the added complication of handling
% margin phantoms. When we cross between phantom and piece, we split
% the skip so that we can use the simplest recursion possible.
@@ -1095,7 +1095,7 @@
% \end{macros}
%
% \subsection{Margin pieces}
-% \begin{macros}{\MFX at buildmargin@pieces,\MFX at buildmargin@piece}
+% \begin{macros}{\MFX at buildmargin@pieces}
% Before we can start the third and fourth passes, we need to set up
% a loop over the pieces so that each piece can do these passes at
% one time. In case we didn't use up all the pieces in the second
@@ -1114,10 +1114,12 @@
\let\@elt\MFX at buildmargin@piece
\MFX at run@clear\mfx at marginpieces
\let\@elt\relax
- \Mfx at piece@count\z@
+ \global\Mfx at piece@count\z@
}
% \end{macrocode}
+% \end{macros}
%
+% \begin{macros}{\MFX at buildmargin@piece}
% The \cs{MFX at buildmargin@piece} macro is called for each piece of
% the margin, and is passed the top and bottom positions of the piece.
% Here we need to do a few things. First, if the output so far is
@@ -1185,7 +1187,7 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\MFX at piece@note at down,\MFX at piece@skip at down,\MFX at piece@clear}
+% \begin{macros}{\MFX at piece@note at down}
% We again define each of our building macros. First, the note builder.
% When we encounter a note, we first zero out \cs{Mfx at marginspace}. Then
% we need to decide whether to put it in the current piece, or whether
@@ -1261,7 +1263,9 @@
\fi
}
% \end{macrocode}
+% \end{macros}
%
+% \begin{macros}{\MFX at piece@skip at down}
% Skips are a bit more complicated now. We no longer gobble the
% initial skips (since the skips at the top and bottom of the page
% have already been eaten). Instead, we need to look at
@@ -1301,7 +1305,9 @@
\fi
}
% \end{macrocode}
+% \end{macros}
%
+% \begin{macros}{\MFX at piece@clear}
% Finally, we need to handle the case of deferring material. By
% analogy with the previous two passes, we'll continue to refer to
% this as clearing. In this case, we need to redefine the note and
@@ -1365,7 +1371,7 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\MFX at piece@note at up,\MFX at piece@skip at up}
+% \begin{macros}{\MFX at piece@note at up}
% Now that we've taken care of late deferrals, we can define the
% standard behavior without worrying as much about that.
% These macros finally set their contents into \cs{Mfx at piece@content},
@@ -1379,6 +1385,8 @@
\let\mfx at build@skip\MFX at piece@skip at up
}
% \end{macrocode}
+% \end{macros}
+% \begin{macros}{\MFX at piece@skip at up}
% Skips are also straightforward.
% \begin{macrocode}
\def\MFX at piece@skip at up#1#2{%
@@ -1451,7 +1459,7 @@
% \end{macrocode}
% \end{macros}
%
-% \begin{macros}{\clearmargin,\softclearmargin}
+% \begin{macros}{\clearmargin}
% Likewise, \cs{clearmargin} is easy too.
% \begin{macrocode}
\def\clearmargin{%
@@ -1458,6 +1466,8 @@
\MFX at cons\mfx at marginlist{\noexpand\mfx at build@clear}%
}
% \end{macrocode}
+% \end{macros}
+% \begin{macros}{\softclearmargin}
% While we call \cs{softclearmargin} a ``clear margin'', it's
% actually just a big \cs{marginskip}. This allows us to stack
% multiple copies without backing them all up.
Modified: trunk/Master/texmf-dist/tex/latex/marginfix/marginfix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/marginfix/marginfix.sty 2020-05-07 21:25:38 UTC (rev 55057)
+++ trunk/Master/texmf-dist/tex/latex/marginfix/marginfix.sty 2020-05-07 21:25:56 UTC (rev 55058)
@@ -22,7 +22,7 @@
%% in the same archive or directory.)
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{marginfix}%
- [2013/09/08 v1.1 Fix Margin Paragraphs]
+ [2020/05/06 v1.2 Fix Margin Paragraphs]
\makeatletter
\newif\ifmfx at ypos
\DeclareOption{ypos}{\mfx at ypostrue}
@@ -101,25 +101,12 @@
\global\Mfx at marginheight\z@
}
\def\MFX at attachmargin{%
- %<debug>\showbox\@outputbox
- %<debug>\showbox\Mfx at marginbox
\setbox\Mfx at marginbox\vtop{%
\vskip\z@\unvbox\Mfx at marginbox}%
- %% \ifdim\ht\@outputbox<\ht\Mfx at marginbox
- %% \setbox\Mfx at marginbox\vbox to \ht\@outputbox{%
- %% \unvbox\Mfx at marginbox
- %% \vskip\z@ shrink 1filll\relax
- %% }%
- %% \else
- %% \setbox\Mfx at marginbox\vbox to \ht\@outputbox{%
- %% \unvbox\Mfx at marginbox
- %% \vfill
- %% }%
- %% \fi
- \setbox\@outputbox\vbox{% to \ht\@outputbox{%
+ \setbox\@outputbox\vbox{%
\begingroup
- \setbox\@tempboxa\vbox{% to \ht\@outputbox{%
- \hbox{% to \wd\@outputbox{%
+ \setbox\@tempboxa\vbox{%
+ \hbox{%
\if\MFX at leftmargin
\llap{\box\Mfx at marginbox\hskip\marginparsep}%
\else
@@ -134,7 +121,6 @@
\unskip
\unvbox\@outputbox
}%
- %<debug>\showbox\@outputbox
}
\def\MFX at buildmargin{%
\advance\Mfx at marginheight\@colroom
@@ -296,7 +282,7 @@
\let\@elt\MFX at buildmargin@piece
\MFX at run@clear\mfx at marginpieces
\let\@elt\relax
- \Mfx at piece@count\z@
+ \global\Mfx at piece@count\z@
}
\def\MFX at buildmargin@piece#1#2{%
\ifdim\ht\Mfx at marginbox<#1\relax
More information about the tex-live-commits
mailing list.