[latex3-commits] [git/LaTeX3-latex3-latex2e] gh1022: fix for #1022 (143e4708)

Frank Mittelbach frank.mittelbach at latex-project.org
Wed Mar 22 14:21:09 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : gh1022
Link       : https://github.com/latex3/latex2e/commit/143e47080a65275329eaaf0ffe78eeda529b7351

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

commit 143e47080a65275329eaaf0ffe78eeda529b7351
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Wed Mar 22 14:21:09 2023 +0100

    fix for #1022


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

143e47080a65275329eaaf0ffe78eeda529b7351
 base/changes.txt                                |  6 +++++
 base/doc/ltnews37.tex                           | 14 +++++++++++
 base/ltspace.dtx                                |  4 +++-
 base/testfiles/github-1022.lvt                  | 32 +++++++++++++++++++++++++
 base/testfiles/{tlb2105.tlg => github-1022.tlg} | 12 ++++++----
 5 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index a194aebe..2491cf7a 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,12 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2023-03-22  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltspace.dtx:
+	Add \predisplaypenalty setting of 10000 to \samepage in case
+	that was changed (gh/1022)
+
 2023-03-11  Yukai Chou  <muzimuzhi at gmail.com>
 
     * ltcmd.dtx (subsubsection{Showing the definition of a command}),
diff --git a/base/doc/ltnews37.tex b/base/doc/ltnews37.tex
index d7d6cbca..2aef7f70 100644
--- a/base/doc/ltnews37.tex
+++ b/base/doc/ltnews37.tex
@@ -280,6 +280,20 @@ following output:
 \githubissue{963}
 
 
+\subsection{Improve \cs{samepage}}
+
+The \cs{samepage} declaration sets various parameters to
+\texttt{10000} to prevent undesired page breaks.  The
+\cs{predisplaypenalty} parameter has already by default a value of
+\texttt{10000} and to save space back in the days it was therefore not
+explicitly set. However, there are a few classes that change the
+parameter and as result the user might experience a page break in
+front of a display formula within the scope of \cs{samepage} when
+using such classes. This has now been corrected and
+\cs{predisplaypenalty} is also explicitly set to \texttt{10000}.
+%
+\githubissue{1022}
+
 
 
 \section{Code improvements}
diff --git a/base/ltspace.dtx b/base/ltspace.dtx
index 672ab927..1dbfefc7 100644
--- a/base/ltspace.dtx
+++ b/base/ltspace.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltspace.dtx}
-             [2022/11/28 v1.3o LaTeX Kernel (spacing)]
+             [2023/03/22 v1.3p LaTeX Kernel (spacing)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltspace.dtx}
@@ -308,8 +308,10 @@
 %  \end{macro}
 %
 %  \begin{macro}{\samepage}
+% \changes{v1.3p}{2023/03/22}{Add \cs{predisplaypenalty} setting (gh/1022)}
 %    \begin{macrocode}
 \DeclareRobustCommand\samepage{\interlinepenalty\@M
+   \predisplaypenalty\@M
    \postdisplaypenalty\@M
    \interdisplaylinepenalty\@M
    \@beginparpenalty\@M
diff --git a/base/testfiles/github-1022.lvt b/base/testfiles/github-1022.lvt
new file mode 100644
index 00000000..948954fc
--- /dev/null
+++ b/base/testfiles/github-1022.lvt
@@ -0,0 +1,32 @@
+\documentclass{article}
+
+\usepackage{lipsum}
+
+\input{test2e}
+
+\predisplaypenalty=0         % test
+
+\begin{document}
+
+\START
+
+\lipsum[1-3]
+
+\begin{samepage}
+
+\lipsum[4]
+\label{mypage}
+\lipsum[5]
+Now a formula:
+\[ a=b \]
+\lipsum[6]
+
+\end{samepage}
+
+\typeout{Label should be on page 2}
+\setbox0\hbox{\pageref{mypage}}
+{\showoutput\showbox0}
+
+\OMIT
+\end{document}
+
diff --git a/base/testfiles/tlb2105.tlg b/base/testfiles/github-1022.tlg
similarity index 66%
copy from base/testfiles/tlb2105.tlg
copy to base/testfiles/github-1022.tlg
index 695e49cc..08ddc208 100644
--- a/base/testfiles/tlb2105.tlg
+++ b/base/testfiles/github-1022.tlg
@@ -4,10 +4,12 @@ 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 ....
+Label should be on page 2
 > \box...=
-\hbox(5.39098+0.39098)x7.7778
-.\mathon
-.\OML/cmm/m/it/10 <
-.\mathoff
+\hbox(6.44444+0.0)x5.00002
+.\OT1/cmr/m/n/10 2
+.\hbox(0.0+0.0)x0.0
 ! OK.
-l. ...\showbox0
+<to be read again> 
+                   }
+l. ...{\showoutput\showbox0}





More information about the latex3-commits mailing list.