[latex3-commits] [git/LaTeX3-latex3-latex2e] gh168: only warn if the outer minipage actually contains footnotes (753e9867)

Frank Mittelbach frank.mittelbach at latex-project.org
Sat Sep 10 13:02:20 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : gh168
Link       : https://github.com/latex3/latex2e/commit/753e98675b2b0c23b10d7cba872ceefaed6991e5

>---------------------------------------------------------------

commit 753e98675b2b0c23b10d7cba872ceefaed6991e5
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sat Sep 10 13:02:20 2022 +0200

    only warn if the outer minipage actually contains footnotes


>---------------------------------------------------------------

753e98675b2b0c23b10d7cba872ceefaed6991e5
 base/changes.txt               |  2 +-
 base/doc/ltnews36.tex          | 19 +++++++++++++++----
 base/ltboxes.dtx               | 16 ++++++++++------
 base/testfiles/github-0168.lvt | 16 ++++++++++++++++
 base/testfiles/github-0168.tlg |  5 +----
 5 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 46d05185..c9b9b1c2 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -9,7 +9,7 @@ are not part of the distribution.
 2022-09-07  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* ltboxes.dtx (section{\LaTeX\ Box commands}):
-	Check for nestd minipages and warn (gh/168)
+	Check for nested minipages and warn if the outer one contains footnotes (gh/168)
 
 2022-09-03  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
diff --git a/base/doc/ltnews36.tex b/base/doc/ltnews36.tex
index fb8fce64..cf571797 100644
--- a/base/doc/ltnews36.tex
+++ b/base/doc/ltnews36.tex
@@ -244,11 +244,13 @@ font instead.
 
 \subsection{Detect nested \texttt{minipage} environments}
 
-Nesting of \texttt{minipage} environments is not supported in \LaTeX{}
-and leads to incorrect output, such as overfull boxes or footnotes
-appearing in the wrong place. However, until now there was no warning
+Nesting of \texttt{minipage} environments is only partially supported
+in \LaTeX{} and can lead to incorrect output, such as overfull boxes
+or footnotes appearing in the wrong place;
+see~\cite[p.~106]{36:Lamport}. However, until now there was no warning
 if that happpened.  This has been changed and the environment now
-warns if you nest it in another \texttt{minipage} environment.
+warns if you nest it in another \texttt{minipage} environment that
+already contains footnotes.
 %
 \githubissue{168}
 
@@ -377,6 +379,15 @@ tall, in which case aligning is pointless anyway).
 %  \emph{\LaTeXe{} news 33}.\\
 %  \url{https://latex-project.org/news/latex2e-news/ltnews33.pdf}
 
+
+\bibitem{36:Lamport}
+Leslie Lamport.
+\newblock {\LaTeX}: {A} Document Preparation System: User's Guide and Reference
+  Manual.
+\newblock \mbox{Addison}-Wesley, Reading, MA, USA, 2nd edition, 1994.
+\newblock ISBN 0-201-52983-1.
+\newblock Reprinted with corrections in 1996.
+
 \bibitem{36:ltnews32} \LaTeX{} Project Team:
   \emph{\LaTeXe{} news 32}.\\
   \url{https://latex-project.org/news/latex2e-news/ltnews32.pdf}
diff --git a/base/ltboxes.dtx b/base/ltboxes.dtx
index ff04f912..b82f5bdb 100644
--- a/base/ltboxes.dtx
+++ b/base/ltboxes.dtx
@@ -1007,7 +1007,7 @@
 %  \begin{macro}{\if at in@minipage at env}
 %    
 % \changes{v1.4d}{2022/09/07}
-%         {Check for nestd minipages and warn (gh/168)}
+%         {Check for nested minipages and warn (gh/168)}
 %    \begin{macrocode}
 \newif\if at in@minipage at env
 %    \end{macrocode}
@@ -1075,13 +1075,17 @@
 %    always a group resetting the switch even if the code does not use
 %    \cs{begin} to start the minipage.
 % \changes{v1.4d}{2022/09/07}
-%         {Check for nestd minipages and warn (gh/168)}
+%         {Check for nested minipages and warn (gh/168)}
 %    \begin{macrocode}
       \if at in@minipage at env
-        \@latex at warning{Nested `minipage' environment found.\MessageBreak
-          Nesting of such environments is not supported\MessageBreak
-          and can lead to formatting errors.\MessageBreak
-          Consider using \string\parbox\space instead}%
+%    \end{macrocode}
+%    We only issue a warning if the outer minipage contained footnotes
+%    because that is the problematical case.
+%    \begin{macrocode}
+        \ifvoid\@mpfootins\else
+          \@latex at warning{Nested minipage:
+            footnotes may be misplaced}%
+        \fi
       \else
         \@in at minipage@envtrue
       \fi
diff --git a/base/testfiles/github-0168.lvt b/base/testfiles/github-0168.lvt
index 2ae9ca8a..72da4dae 100644
--- a/base/testfiles/github-0168.lvt
+++ b/base/testfiles/github-0168.lvt
@@ -43,6 +43,22 @@
   some text \footnote{footnote B}
 \end{minipage}}}
 
+
+\section{nested but no warn}
+
+\begin{minipage}{6cm}
+  some text
+
+  \hspace*{3cm}%
+  \begin{minipage}{3cm}
+    nested
+  \end{minipage}
+  
+  some text \footnote{footnote C}
+\end{minipage}
+
+
+
 \newpage
 \OMIT
 \end{document}
diff --git a/base/testfiles/github-0168.tlg b/base/testfiles/github-0168.tlg
index eb46b488..62eb91e0 100644
--- a/base/testfiles/github-0168.tlg
+++ b/base/testfiles/github-0168.tlg
@@ -10,10 +10,7 @@ LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <7> on input line ....
 LaTeX Font Info:    External font `cmex10' loaded for size
 (Font)              <5> on input line ....
-LaTeX Warning: Nested `minipage' environment found.
-               Nesting of such environments is not supported
-               and can lead to formatting errors.
-               Consider using \parbox instead on input line ....
+LaTeX Warning: Nested minipage: footnotes may be misplaced on input line ...
 Overfull \hbox (85.35826pt too wide) in paragraph at lines 15--19
 []| $[]$ 
 \hbox(18.56668+12.56667)x170.71652





More information about the latex3-commits mailing list.