[latex3-commits] [git/LaTeX3-latex3-latex2e] gh168: checking code for #168 (2080c405)

Frank Mittelbach frank.mittelbach at latex-project.org
Wed Sep 7 15:40:11 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : gh168
Link       : https://github.com/latex3/latex2e/commit/2080c40523c247610ab50f9c6364c657336d3e6a

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

commit 2080c40523c247610ab50f9c6364c657336d3e6a
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Wed Sep 7 15:40:11 2022 +0200

    checking code for #168


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

2080c40523c247610ab50f9c6364c657336d3e6a
 base/changes.txt               |  5 +++
 base/ltboxes.dtx               | 30 ++++++++++++++++-
 base/testfiles/github-0168.lvt | 48 +++++++++++++++++++++++++++
 base/testfiles/github-0168.tlg | 73 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 155 insertions(+), 1 deletion(-)

diff --git a/base/changes.txt b/base/changes.txt
index e595470d..46d05185 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that
 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)
+
 2022-09-03  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* ltmath.dtx (subsubsection{The UNSORTED Rest}):
diff --git a/base/ltboxes.dtx b/base/ltboxes.dtx
index 43db541b..ff04f912 100644
--- a/base/ltboxes.dtx
+++ b/base/ltboxes.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltboxes.dtx}
-             [2022/01/31 v1.4c LaTeX Kernel (Box Commands)]
+             [2022/09/07 v1.4d LaTeX Kernel (Box Commands)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltboxes.dtx}
@@ -1004,6 +1004,16 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%  \begin{macro}{\if at in@minipage at env}
+%    
+% \changes{v1.4d}{2022/09/07}
+%         {Check for nestd minipages and warn (gh/168)}
+%    \begin{macrocode}
+\newif\if at in@minipage at env
+%    \end{macrocode}
+%  \end{macro}
+%
+%
 % \begin{macro}{\minipage}
 % \changes{v0.1a}{1993/12/03}
 %         {Redefined to support extra optional arguments}
@@ -1060,6 +1070,24 @@
     \color at begingroup
       \hsize\@tempdima
       \textwidth\hsize \columnwidth\hsize
+%    \end{macrocode}
+%    We check for nested minipages inside the box so that there is
+%    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)}
+%    \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}%
+      \else
+        \@in at minipage@envtrue
+      \fi
+%    \end{macrocode}
+%
+%    \begin{macrocode}
       \@parboxrestore
       \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c at mpfootnote\z@
       \let\@footnotetext\@mpfootnotetext
diff --git a/base/testfiles/github-0168.lvt b/base/testfiles/github-0168.lvt
new file mode 100644
index 00000000..2ae9ca8a
--- /dev/null
+++ b/base/testfiles/github-0168.lvt
@@ -0,0 +1,48 @@
+\documentclass[12pt]{article}
+
+\input{test2e}
+
+
+\begin{document}
+
+\START
+
+\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}
+
+
+\vspace*{2cm}
+
+
+\begin{minipage}{6cm}
+  some text\footnote{footnote A}
+
+  \parbox{3cm}{nested}
+ 
+  some text \footnote{footnote B}
+\end{minipage}
+
+
+\vspace*{2cm}
+
+
+\fbox{\parbox{8cm}{nested
+\begin{minipage}{6cm}
+  some text\footnote{footnote A}
+
+  some text \footnote{footnote B}
+\end{minipage}}}
+
+\newpage
+\OMIT
+\end{document}
diff --git a/base/testfiles/github-0168.tlg b/base/testfiles/github-0168.tlg
new file mode 100644
index 00000000..eb46b488
--- /dev/null
+++ b/base/testfiles/github-0168.tlg
@@ -0,0 +1,73 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <12> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <8> on input line ....
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <6> on input line ....
+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 ....
+Overfull \hbox (85.35826pt too wide) in paragraph at lines 15--19
+[]| $[]$ 
+\hbox(18.56668+12.56667)x170.71652
+.\hbox(0.0+0.0)x0.0
+.\rule(*+*)x0.0
+.\penalty 10000
+.\glue 85.35826
+.\glue 0.0
+.\mathon
+.\vbox(18.56668+12.56667)x170.71652
+..\hbox(8.33331+0.0)x85.35826, glue set 52.65443fil
+...\hbox(0.0+0.0)x0.0
+...\OT1/cmr/m/n/12 n
+...\OT1/cmr/m/n/12 e
+...\OT1/cmr/m/n/12 s
+...\OT1/cmr/m/n/12 t
+...\OT1/cmr/m/n/12 e
+...\OT1/cmr/m/n/12 d
+...\penalty 10000
+...\glue(\parfillskip) 0.0 plus 1.0fil
+...\glue(\rightskip) 0.0
+..\glue 10.8 plus 4.0 minus 2.0
+..\kern -3.0
+..\rule(0.4+0.0)x34.14278
+..\kern 2.6
+..\hbox(8.4+3.60004)x170.71652, glue set 105.77191fil
+...\hbox(6.6428+0.0)x18.00005, glue set 13.27779fil
+....\glue 0.0 plus 1.0fil minus 1.0fil
+....\hbox(6.6428+0.0)x4.72226
+.....\mathon
+.....\hbox(3.01389+0.0)x4.72226, shifted -3.62892
+......\OT1/cmr/m/it/7 a
+.....\mathoff
+...\hbox(8.4+0.0)x0.0
+....\rule(8.4+0.0)x0.0
+...\OT1/cmr/m/n/10 f
+...\OT1/cmr/m/n/10 o
+...\kern0.27779
+...\OT1/cmr/m/n/10 o
+...\OT1/cmr/m/n/10 t
+...\OT1/cmr/m/n/10 n
+...\OT1/cmr/m/n/10 o
+...\OT1/cmr/m/n/10 t
+...\OT1/cmr/m/n/10 e
+...\glue 3.33333 plus 1.66666 minus 1.11111
+...\OT1/cmr/m/n/10 A
+...\penalty 10000
+...\rule(0.0+3.60004)x0.0
+...\penalty 10000
+...\glue(\parfillskip) 0.0 plus 1.0fil
+...\glue(\rightskip) 0.0
+.\mathoff
+.\penalty 10000
+.\glue(\parfillskip) 0.0 plus 1.0fil
+.\glue(\rightskip) 0.0
+[1
+]





More information about the latex3-commits mailing list.