-
-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nested minipage highjacks the footnote #168
Comments
Not only the footnote goes to the wrong place, but also the inner minipage inherits the width of the outer one, resulting in an overfull box. Adding \makeatletter
\def\@iiiminipage#1#2[#3]#4{%
\leavevmode
\@pboxswfalse
\setlength\@tempdima{#4}%
\def\@mpargs{{#1}{#2}[#3]{#4}}%
\setbox\@tempboxa\vbox\bgroup
\color@begingroup
\hsize\@tempdima
\textwidth\hsize \columnwidth\hsize
\@parboxrestore
\def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
\let\@footnotetext\@mpfootnotetext
\let\@listdepth\@mplistdepth \@mplistdepth\z@
\setbox\@mpfootins\box\voidb@x% <=================================
\@minipagerestore
\@setminipage}
\makeatother
\RequirePackage{latexbug}
\documentclass[12pt]{article}
\begin{document}
\section{nested}
\begin{minipage}{6cm}
some text\footnote{footnote A}
\hspace*{3cm}%
\begin{minipage}{3cm}
nested
\end{minipage}
some text \footnote{footnote B}
\end{minipage}
\end{document} The outer minipage starts with |
@PhelypeOleinik your code solves my example, but if the inner minipage has also a footnote one looses the first:
|
@u-fischer Oh :/ The code for Changing |
Maybe nested minipages were never supported (at least not with footnotes everywhere!) so this is simply a documentation problem? But a package extending coverage to “recursive minipages” may be a good idea. Good for making pages that contain reduced copies of themselves, I guess. |
Maybe replace
\setbox\@mpfootins\box\voidb@x
in Phelype's code by
\setbox\mybox\box\@mpfootins
(with a better name for the box than \mybox, of course) and in the
\end{minipage} code do
\global\setbox\@mpfootins\box\mybox
|
This is a documented restriction: LaTeX Book page 106, so it works as designed. That does not mean that we can't change it. However, I'm not sure that it is correct that a tikz picture is internally using a minipage instead of a parbox ... is that supposed to support inner footnotes? |
I should have RTFM :-). |
@FrankMittelbach I don't know why tikz or todonotes (which triggered the issue) use minipage. It could be footnotes, but perhaps simply as environments are easier to handle in begin/end code. I never saw a question about the side-effect before and even if one know in theory that a single mp-footnote counter and insert means that nesting could be problematic it is easy to forget that in practice. |
So it would be a good idea to at least issue a warning when a nested minipages us spotted. Not that anyone will notice a warning, of course. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. |
the above commit is a red herring it should have referenced #186 |
This issue has been automatically marked as stale because it has not had recent activity. |
I have now added a check and a warning if minipages are nested. |
Reference: https://tex.stackexchange.com/q/504688/2388 (here with todonotes)
A nested minipage grabs footnotes from the outer minipage:
Log file (required) and possibly PDF file
test-utf8.log
This can be surprising for the user if the inner minipage is actually hidden, e.g. in a tikzpicture:
The text was updated successfully, but these errors were encountered: