[latex3-commits] [git/LaTeX3-latex3-latex2e] fix591: In LuaTeX, ensure that empty paragraphs are empty (3931de2b)
Marcel Fabian Krüger
tex at 2krueger.de
Mon Jun 21 16:18:16 CEST 2021
Repository : https://github.com/latex3/latex2e
On branch : fix591
Link : https://github.com/latex3/latex2e/commit/3931de2b5e46feab4c04b61f83dc38df4545c5e4
>---------------------------------------------------------------
commit 3931de2b5e46feab4c04b61f83dc38df4545c5e4
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Mon Jun 21 16:18:16 2021 +0200
In LuaTeX, ensure that empty paragraphs are empty
>---------------------------------------------------------------
3931de2b5e46feab4c04b61f83dc38df4545c5e4
base/changes.txt | 5 +++++
base/ltpara.dtx | 37 ++++++++++++++++++++++++++++++++++---
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index dfd7a960..1b502936 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.
================================================================================
+2021-06-21 Marcel Krüger <Marcel.Krueger at latex-project.org>
+
+ * ltpara.dtx:
+ Don't print effectivly empty paragraphs in RTL contexts in LuaTeX
+
2021-06-09 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
* ltshipout.dtx:
diff --git a/base/ltpara.dtx b/base/ltpara.dtx
index 5ab52a5e..978281cb 100644
--- a/base/ltpara.dtx
+++ b/base/ltpara.dtx
@@ -14,8 +14,8 @@
%%% From File: ltpara.dtx
%
% \begin{macrocode}
-\def\ltparaversion{v1.0g}
-\def\ltparadate{2021/05/27}
+\def\ltparaversion{v1.0h}
+\def\ltparadate{2021/06/21}
% \end{macrocode}
%<*driver>
\documentclass{l3doc}
@@ -714,6 +714,37 @@
%
%
%
+% \begin{macro}{\@@_end_empty_par:}
+% For most engines, running \cs{tex_par:D} in an empty paragraph will drop
+% the paragraph, but in Lua\TeX\ this sometimes leads to paragraphs which
+% contain only direction nodes. Therefore we first make sure that the list
+% is really empty when using Lua\TeX.
+% \changes{v1.0h}{2021/06/21}{Ensure that empty paragraphs are really empty in Lua\TeX}
+% \begin{macrocode}
+\sys_if_engine_luatex:TF
+ {
+ \newluafunction \g_@@_end_empty_par_id_int
+ \exp_args:Nx \everyjob {
+ \exp_not:V \everyjob
+ \exp_not:N \lua_now:n {
+ local~texnest, flush_list, par_token = tex.nest, node.flush_list, token.create'tex_par:D'~
+ lua.get_functions_table()[\int_use:N \g_@@_end_empty_par_id_int] = function()
+ local~nest_level = texnest.top~
+ local~cur_head = nest_level.head~
+ flush_list(cur_head.next)
+ nest_level.tail, cur_head.next = cur_head, nil~
+ token.put_next(par_token)
+ end
+ }
+ }
+ \protected \luadef \@@_end_empty_par: \g_@@_end_empty_par_id_int
+ } {
+ \cs_set_eq:NN \@@_end_empty_par: \tex_par:D
+ }
+%
+%
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\g_@@_standard_everypar_tl}
% Whenever \TeX{} starts a paragraph it inserts first an
% indentation box and then executes the tokens stored in
@@ -746,7 +777,7 @@
% settings will not get lost as we need them for later.
% \begin{macrocode}
\group_begin:
- \tex_par:D
+ \@@_end_empty_par:
\group_end:
% \end{macrocode}
% We then change \cs{tex_everypar:D} to generate an error so that
More information about the latex3-commits
mailing list.