FrankMittelbach / fmitex-footmisc

The footmisc package originally developed and mainted by Robin Fairbairns
7 stars 2 forks source link

footmisc + marginfix + (\marginpar or todonotes) = error #10

Closed ghost closed 1 year ago

ghost commented 1 year ago

Feeding

\documentclass{article}
\usepackage{footmisc}
\usepackage{marginfix}
\begin{document}
\marginpar{test}
\end{document}

or

\documentclass{article}
\usepackage{footmisc}
\usepackage{marginfix}
\usepackage{todonotes}
\begin{document}
\todo{test}
\end{document}

to pdflatex leads to a compilation error:

! Package marginfix Error: lost some margin notes.

See the marginfix package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.7 \end{document}

?

Unfortunately, the explanation of “lost some margin notes” in § 13 of the documentation of marginfix says nothing to me. Having a bit more text, say,

\begin{document}
test

\marginpar{test}% or \todo{test} if you happen to use todonotes

test
\end{document}

doesn't help.

Used versions:

These versions were in TeX Live in Debian-testing this spring.

Who is the culprit? Any more permanent bugfix than \usepackage{footmisc}[=v5] (thx to David Carlisle) or loading marginfix before footmisc (thx to Frank Mittelbach)?

Crossposts: http://github.com/shicks/marginfix/issues/19 and http://github.com/henrikmidtiby/todonotes/issues/71 .

Old version of the same bug: https://tex.stackexchange.com/questions/652835/footmisc-marginfix-todonotes-error .

Probably related: http://github.com/shicks/marginfix/issues/18 .

FrankMittelbach commented 1 year ago

footmisc contains an updated output routine (that will eventually make it into the LaTeX kernel, even if not quite in that form) and marginfix patches low-level into the old one. Both packages try to do their thing in a way that other packages aren't effected, but footmisc is actually somewhat more successful :-)

So if you change the loading order (marginfix first) your problem vanishes.

I could change footmisc to anticipate the patching of \@combinefloats even if it happens later (and I may do so, but mid-term it would be best if fixmargin is not patching internals of the OR whether old or new) --- for this the kernel version will get apprpriate hooks so that such issues will not happen in the future if every package uses the right interfaces.

ghost commented 1 year ago

@FrankMittelbach Thank you! Indeed, changing the order of loading gets rid of the bug:

\documentclass{article}
\usepackage{marginfix}
\usepackage{footmisc}
\usepackage{todonotes}
\begin{document}
\todo{test}
\end{document}

I've just pinged the marginfix maintainer on this and updated the two remaining bug reports (todonotes now excluded) with information you provided.

ghost commented 1 year ago

@FrankMittelbach Since your message implies that marginfix is now less successful than footmisc concerning patching the output routine, does marginfix still work as originally intended? Or, if it no longer works properly, could marginfix be dropped?

FrankMittelbach commented 1 year ago

@AlMa0r nothing like that was implied, that was kind of a midnight joke.

ghost commented 1 year ago

@FrankMittelbach I see you've just adapted footmisc; thanks a lot! Will be looking forward to test it as soon as it gets into TeX Live!