[latex3-commits] [git/LaTeX3-latex3-latex2e] luatex-softhyphen: Use primitive \- in LuaTeX (6d13a50a)

Marcel Fabian Krüger tex at 2krueger.de
Tue May 12 15:29:21 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : luatex-softhyphen
Link       : https://github.com/latex3/latex2e/commit/6d13a50a2d9dec61018833fa2354d7ab7c6274fb

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

commit 6d13a50a2d9dec61018833fa2354d7ab7c6274fb
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Tue May 12 15:29:21 2020 +0200

    Use primitive \- in LuaTeX


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

6d13a50a2d9dec61018833fa2354d7ab7c6274fb
 base/changes.txt      |  5 +++++
 base/doc/ltnews32.tex | 10 ++++++++++
 base/ltdefns.dtx      | 54 ++++++++++++++++++++++++++++++++++-----------------
 3 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 4d662ee6..3c0c4825 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.
 ================================================================================
 
+2020-05-11  Marcel Krüger    <Marcel.Krueger at latex-project.org>
+
+  * ltdefns.dtx:
+  Use primitive \- with LuaTeX
+
 2020-05-07  Ulrike Fischer <Ulrike.Fischer at latex-project.org>
 
 	* ltxref.dtx:
diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index 60147965..31e6c32d 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -528,6 +528,16 @@ always treats \texttt{U+00AD} as |\-|.
 
 
 
+\subsection{Native Lua\TeX\ behaviour for \cs{-}}
+
+\LaTeX\ changes \cs{-} to add a discretionary hyphen even if \cs{hyphenchar}
+is set to $-1$. This change is not necessary under Lua\TeX\ because in there
+\cs{-} is not affected by \cs{hyphenchar} in the first place. Therefore this
+behaviour has been changed to ensure that Lua\TeX's (language specific)
+hyphenation characters are respected by \cs{-}.
+
+
+
 \begin{thebibliography}{9}
 
 \fontsize{9.3}{11.3}\selectfont
diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index 303b9e56..8a6f424a 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltdefns.dtx}
-             [2020/02/27 v1.5g LaTeX Kernel (definition commands)]
+             [2020/05/11 v1.5h LaTeX Kernel (definition commands)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltdefns.dtx}
@@ -1560,6 +1560,7 @@
 % \changes{v1.0g}{1994/04/12}
 %         {Define \cs{@dischyph}, was previously in ltboxes.dtx}
 % \changes{v1.5b}{2017/03/27}{Define \cs{@dischyph} after \cs{-}}
+% \changes{v1.5h}{2020/05/11}{Do not overwrite \cs{-} under Lua\TeX}
 % \end{macro}
 % Moved here to be after the definition of |\DeclareRobustCommand|.
 %
@@ -1589,35 +1590,52 @@
 % older \LaTeX\ definition accessible via \textsf{latexrelease}
 % as usual.
 %
-%    \begin{macrocode}
-%</2ekernel>
-%<latexrelease>\IncludeInRelease{2017/04/15}{\-}{Use \hyphenchar in \-}%
-%    \end{macrocode}
+% In Lua\LaTeX\ the primitive definition of \cs{-} is used directly
+% because it's use of extended hyphenation parameters means that \cs{-}
+% works correctly even with \cs{hyphenchar} set to $-1$. This change
+% makes \cs{-} under Lua\LaTeX\ compatible with language specific
+% hyphenation characters.
+%
 % Temporary definition of |\@latex at info|, final definition is later.
 %    \begin{macrocode}
-%<*2ekernel>
 \def\@latex at info#1{}
-%</2ekernel>
 %    \end{macrocode}
 %
 %    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2020/05/11}{\-}{Use primitive \- in Lua\LaTeX}%
 %<*2ekernel|latexrelease>
-\DeclareRobustCommand{\-}{%
-  \discretionary{%
-    \char \ifnum\hyphenchar\font<\z@
-            \defaulthyphenchar
-          \else
-            \hyphenchar\font
-          \fi
-               }{}{}%
-}
-\let\@dischyph=\-
+\ifx\directlua\@undefined
+  \DeclareRobustCommand{\-}{%
+    \discretionary{%
+      \char \ifnum\hyphenchar\font<\z@
+              \defaulthyphenchar
+            \else
+              \hyphenchar\font
+            \fi
+                 }{}{}%
+  }
+%<latexrelease>\else \let\-\@@disc
+\fi
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2017/04/15}{\-}{Use \hyphenchar in \-}%
+%<latexrelease>\DeclareRobustCommand{\-}{%
+%<latexrelease>  \discretionary{%
+%<latexrelease>    \char \ifnum\hyphenchar\font<\z@
+%<latexrelease>            \defaulthyphenchar
+%<latexrelease>          \else
+%<latexrelease>            \hyphenchar\font
+%<latexrelease>          \fi
+%<latexrelease>               }{}{}%
+%<latexrelease>}
+%<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{0000/00/00}{\-}{Use \hyphenchar in \-}%
 %<latexrelease>\def\-{\discretionary{-}{}{}}
-%<latexrelease>\let\@dischyph=\-
 %<latexrelease>\EndIncludeInRelease
+%<*2ekernel|latexrelease>
+\let\@dischyph=\-
+%</2ekernel|latexrelease>
 %<*2ekernel>
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list.