[latex3-commits] [git/LaTeX3-latex3-latex2e] gh247: First part of fix for #247, restoring \finalhyphendemerits not yet done (05b3414a)

Frank Mittelbach frank.mittelbach at latex-project.org
Sun May 31 22:10:01 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh247
Link       : https://github.com/latex3/latex2e/commit/05b3414af0267352d99aa4a8f5f88d38e45dde82

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

commit 05b3414af0267352d99aa4a8f5f88d38e45dde82
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sun May 31 22:10:01 2020 +0200

    First part of fix for #247, restoring \finalhyphendemerits not yet done


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

05b3414af0267352d99aa4a8f5f88d38e45dde82
 base/changes.txt                                   |  6 ++++
 base/doc/ltnews32.tex                              |  9 ++++++
 base/ltmiscen.dtx                                  | 29 +++++++++++++++--
 base/testfiles/github-0247.lvt                     | 37 ++++++++++++++++++++++
 base/testfiles/github-0247.tlg                     |  5 +++
 .../tlb-latexrelease-rollback-003-often.luatex.tlg |  2 ++
 .../tlb-latexrelease-rollback-003-often.tlg        |  2 ++
 .../tlb-latexrelease-rollback-003-often.xetex.tlg  |  2 ++
 base/testfiles/tlb-rollback-004-often.luatex.tlg   |  1 +
 base/testfiles/tlb-rollback-004-often.tlg          |  1 +
 base/testfiles/tlb-rollback-004-often.xetex.tlg    |  1 +
 11 files changed, 92 insertions(+), 3 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 401f0d85..e2713869 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.
 ================================================================================
 
+2020-05-31  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltmiscen.dtx (subsection{Center, Flushright, Flushleft}):
+	% Added \finalhyphendemerits=0 to avoid extra line in
+	\centering, \raggedleft or \raggedright (gh/247)
+
 2020-05-19  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* ltfssini.dtx (section{Custom series settings for main document families}):
diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index e6b7e415..5f9ad01c 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -262,6 +262,15 @@ names will remain intact.
 \githubissue[s]{217 and 218}
 
 
+\subsection{Avoid extra line in \cs{centering}, \cs{raggedleft} or \cs{raggedright}}
+
+If we aren't justifing paragraphs then a very long word (longer than a
+line) could result in an unnecessary extra line in order to prevent a
+hyphen in the second-last line of the paragraph. This is now avoided
+by setting \cs{finalhyphendemerits} to zero in unjustified settings.
+%
+\githubissue{274}
+
 
 \subsection{Set a non-zero \cs{baselineskip} in text scripts}
 
diff --git a/base/ltmiscen.dtx b/base/ltmiscen.dtx
index 5fb4e77d..c48384b8 100644
--- a/base/ltmiscen.dtx
+++ b/base/ltmiscen.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltmiscen.dtx}
-             [2020/04/24 v1.1t LaTeX Kernel (Misc. Environments)]
+             [2020/05/31 v1.1u LaTeX Kernel (Misc. Environments)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltmiscen.dtx}
@@ -780,33 +780,39 @@
 %    \begin{macrocode}
 %</2ekernel>
 %<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2019/10/01}%
-%<latexrelease>                 {\centering}{Make commands robust}%
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>                 {\centering}{Set finaldhypendemerits}%
 %    \end{macrocode}
 %
 % \begin{macro}{\centering}
+% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)}
 %    \begin{macrocode}
 \DeclareRobustCommand\centering{%
   \let\\\@centercr
   \rightskip\@flushglue\leftskip\@flushglue
+  \finalhyphendemerits=\z@
   \parindent\z@\parfillskip\z at skip}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\raggedright}
+% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)}
 %    \begin{macrocode}
 \DeclareRobustCommand\raggedright{%
   \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
+  \finalhyphendemerits=\z@
   \leftskip\z at skip
   \parindent\z@}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\raggedleft}
+% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)}
 %    \begin{macrocode}
 \DeclareRobustCommand\raggedleft{%
   \let\\\@centercr
   \rightskip\z at skip\leftskip\@flushglue
+  \finalhyphendemerits=\z@
   \parindent\z@\parfillskip\z at skip}
 %    \end{macrocode}
 % \end{macro}
@@ -814,6 +820,23 @@
 %    \begin{macrocode}
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2019/10/01}%
+%<latexrelease>                 {\centering}{Make commands robust}%
+%<latexrelease>
+%<latexrelease>\DeclareRobustCommand\centering{%
+%<latexrelease>  \let\\\@centercr
+%<latexrelease>  \rightskip\@flushglue\leftskip\@flushglue
+%<latexrelease>  \parindent\z@\parfillskip\z at skip}
+%<latexrelease>\DeclareRobustCommand\raggedright{%
+%<latexrelease>  \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
+%<latexrelease>  \leftskip\z at skip
+%<latexrelease>  \parindent\z@}
+%<latexrelease>\DeclareRobustCommand\raggedleft{%
+%<latexrelease>  \let\\\@centercr
+%<latexrelease>  \rightskip\z at skip\leftskip\@flushglue
+%<latexrelease>  \parindent\z@\parfillskip\z at skip}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>
 %<latexrelease>\IncludeInRelease{0000/00/00}%
 %<latexrelease>                 {\centering}{Make commands robust}%
 %<latexrelease>
diff --git a/base/testfiles/github-0247.lvt b/base/testfiles/github-0247.lvt
new file mode 100644
index 00000000..c4c56250
--- /dev/null
+++ b/base/testfiles/github-0247.lvt
@@ -0,0 +1,37 @@
+\documentclass{article}
+
+\input{test2e}
+
+\begin{document}
+
+\START
+
+\raggedright
+
+methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-%
+methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl some more words
+
+% \prevgraf value lost inside \typeout so better save it ...
+\edef\lastprevgraf{\the\prevgraf}
+\typeout{Previous paragraph has \lastprevgraf\space lines (should be 2)}
+
+\raggedleft
+
+methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-%
+methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl some more words
+
+% \prevgraf value lost inside \typeout so better save it ...
+\edef\lastprevgraf{\the\prevgraf}
+\typeout{Previous paragraph has \lastprevgraf\space lines (should be 2)}
+
+\centering
+
+methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-%
+methyl\-methyl\-methyl\-methyl\-methyl\-methyl\-methyl some more words
+
+% \prevgraf value lost inside \typeout so better save it ...
+\edef\lastprevgraf{\the\prevgraf}
+\typeout{Previous paragraph has \lastprevgraf\space lines (should be 2)}
+
+
+\END
diff --git a/base/testfiles/github-0247.tlg b/base/testfiles/github-0247.tlg
new file mode 100644
index 00000000..a9fcc79f
--- /dev/null
+++ b/base/testfiles/github-0247.tlg
@@ -0,0 +1,5 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+Previous paragraph has 2 lines (should be 2)
+Previous paragraph has 2 lines (should be 2)
+Previous paragraph has 2 lines (should be 2)
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
index fc3fec0b..e2895d23 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
@@ -288,6 +288,7 @@ Skipping: [....-..-..] Make robust on input line ....
 Applying: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Skipping: [....-..-..] Make commands robust on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 Skipping: [....-..-..] Disable hyphenation in verbatim on input line ....
@@ -686,6 +687,7 @@ Skipping: [....-..-..] Make robust on input line ....
 Applying: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 LaTeX Info: Redefining \centering on input line ....
 LaTeX Info: Redefining \raggedright on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
index 051fa843..11f52bb8 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
@@ -286,6 +286,7 @@ Skipping: [....-..-..] Make robust on input line ....
 Applying: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Skipping: [....-..-..] Make commands robust on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 Skipping: [....-..-..] Disable hyphenation in verbatim on input line ....
@@ -678,6 +679,7 @@ Skipping: [....-..-..] Make robust on input line ....
 Applying: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 LaTeX Info: Redefining \centering on input line ....
 LaTeX Info: Redefining \raggedright on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
index 7d00f714..56ca12a2 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
@@ -286,6 +286,7 @@ Skipping: [....-..-..] Make robust on input line ....
 Applying: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Skipping: [....-..-..] Make commands robust on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 Skipping: [....-..-..] Disable hyphenation in verbatim on input line ....
@@ -687,6 +688,7 @@ Skipping: [....-..-..] Make robust on input line ....
 Applying: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 LaTeX Info: Redefining \centering on input line ....
 LaTeX Info: Redefining \raggedright on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.luatex.tlg b/base/testfiles/tlb-rollback-004-often.luatex.tlg
index 5da4345d..e326a33c 100644
--- a/base/testfiles/tlb-rollback-004-often.luatex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.luatex.tlg
@@ -687,6 +687,7 @@ Applying: [....-..-..] Make robust on input line ....
 Already applied: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 LaTeX Info: Redefining \centering on input line ....
 LaTeX Info: Redefining \raggedright on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.tlg b/base/testfiles/tlb-rollback-004-often.tlg
index 89b69839..e68329d2 100644
--- a/base/testfiles/tlb-rollback-004-often.tlg
+++ b/base/testfiles/tlb-rollback-004-often.tlg
@@ -685,6 +685,7 @@ Applying: [....-..-..] Make robust on input line ....
 Already applied: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 LaTeX Info: Redefining \centering on input line ....
 LaTeX Info: Redefining \raggedright on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.xetex.tlg b/base/testfiles/tlb-rollback-004-often.xetex.tlg
index ec43c985..7006003c 100644
--- a/base/testfiles/tlb-rollback-004-often.xetex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.xetex.tlg
@@ -685,6 +685,7 @@ Applying: [....-..-..] Make robust on input line ....
 Already applied: [....-..-..] Make robust on input line ....
 Skipping: [....-..-..] centering, etc support calc on input line ....
 Applying: [....-..-..] centering, etc support calc on input line ....
+Skipping: [....-..-..] Set finaldhypendemerits on input line ....
 Applying: [....-..-..] Make commands robust on input line ....
 LaTeX Info: Redefining \centering on input line ....
 LaTeX Info: Redefining \raggedright on input line ....





More information about the latex3-commits mailing list.