LuaTeX doesn't discard empty paragraphs when textdir is used
Hi, consider the following plain LuaTeX document: \textdir TRT \noindent\par \bye without the `\textdir TRT` line or with `\textdir TLT`, this would lead to "warning (pdf backend): no pages of output.", but with the non default "\textdir", it creates an empty (except for the page number) page instead. This can be avoided by setting \pardir too: \textdir TRT\pardir TRT \noindent\par \bye again produces no output, but adding a group around it reintroduces the issue: \begingroup \textdir TRT\pardir TRT \noindent\par \endgroup \bye leads to an empty page. Of course similar things happen not only for otherwise empty documents: Instead of empty paragraphs disappearing, they add empty lines. Together, this is not only inconsistent with other engines which always discard empty paragraphs, but also leads to hard to predict behavior (especially for users who are not familiar with the implementation of LuaTeX's directional system), so I think it would be great if LuaTeX could always remove such empty paragraphs. Best, Marcel
On Mon, Jun 21, 2021 at 5:03 PM Marcel Krüger
Hi,
consider the following plain LuaTeX document:
\textdir TRT \noindent\par \bye
without the `\textdir TRT` line or with `\textdir TLT`, this would lead to "warning (pdf backend): no pages of output.", but with the non default "\textdir", it creates an empty (except for the page number) page instead.
This can be avoided by setting \pardir too:
\textdir TRT\pardir TRT \noindent\par \bye
again produces no output, but adding a group around it reintroduces the issue:
\begingroup \textdir TRT\pardir TRT \noindent\par \endgroup \bye
leads to an empty page.
Of course similar things happen not only for otherwise empty documents: Instead of empty paragraphs disappearing, they add empty lines.
Together, this is not only inconsistent with other engines which always discard empty paragraphs, but also leads to hard to predict behavior (especially for users who are not familiar with the implementation of LuaTeX's directional system), so I think it would be great if LuaTeX could always remove such empty paragraphs.
Best, Marcel
confirmed. -- luigi
On Mon, Jun 21, 2021 at 5:03 PM Marcel Krüger
Hi,
consider the following plain LuaTeX document:
\textdir TRT \noindent\par \bye
without the `\textdir TRT` line or with `\textdir TLT`, this would lead to "warning (pdf backend): no pages of output.", but with the non default "\textdir", it creates an empty (except for the page number) page instead.
This can be avoided by setting \pardir too:
\textdir TRT\pardir TRT \noindent\par \bye
again produces no output, but adding a group around it reintroduces the issue:
\begingroup \textdir TRT\pardir TRT \noindent\par \endgroup \bye
leads to an empty page.
Of course similar things happen not only for otherwise empty documents: Instead of empty paragraphs disappearing, they add empty lines.
Together, this is not only inconsistent with other engines which always discard empty paragraphs, but also leads to hard to predict behavior (especially for users who are not familiar with the implementation of LuaTeX's directional system), so I think it would be great if LuaTeX could always remove such empty paragraphs.
(sorry for the delay) Do you have a patch to propose ? -- luigi
On 7/29/2021 9:54 AM, luigi scarso wrote:
On Mon, Jun 21, 2021 at 5:03 PM Marcel Krüger
mailto:tex@2krueger.de> wrote: Hi,
consider the following plain LuaTeX document:
\textdir TRT \noindent\par \bye
without the `\textdir TRT` line or with `\textdir TLT`, this would lead to "warning (pdf backend): no pages of output.", but with the non default "\textdir", it creates an empty (except for the page number) page instead.
This can be avoided by setting \pardir too:
\textdir TRT\pardir TRT \noindent\par \bye
again produces no output, but adding a group around it reintroduces the issue:
\begingroup \textdir TRT\pardir TRT \noindent\par \endgroup \bye
leads to an empty page.
Of course similar things happen not only for otherwise empty documents: Instead of empty paragraphs disappearing, they add empty lines.
Together, this is not only inconsistent with other engines which always discard empty paragraphs, but also leads to hard to predict behavior (especially for users who are not familiar with the implementation of LuaTeX's directional system), so I think it would be great if LuaTeX could always remove such empty paragraphs.
(sorry for the delay) Do you have a patch to propose ?
it's a side effect of the direction handler picking up states ... kind of tricky code but i can probably come up with a fix (maybe under parameter control) (of course normally a macro package will catch these kind of things if needed) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hi, 1) sometimes styles requires to use small vertical indentation between paragraphs and naturally we choose to use \parskip and it leads to some painful programming dealing with spaces For example after float if there will be paragraph the space will be \|textfloatsep + \parskip. |The problem is that there is no control on this and I want to ask consider the possibility to add some tokens list like \everyparskip{} which would be inserted before \parskip where could be possible to check \lastskip: FOR EXAMPLE: \parskip=5pt \everypar{\showthe\lastskip} a \vskip20pt \showthe\lastskip b \showlists \bye STDOUT:
0.0pt. <everypar> \showthe \lastskip
<to be read again> a l.3 a ?
20.0pt. l.6 \showthe\lastskip
?
0.0pt. <everypar> \showthe \lastskip
<to be read again> b l.7 b POSSIBLE PLACE OF \everyparskip: .\tenrm a .\penalty 10000 .\glue(\parfillskip) 0.0 plus 1.0fil .\glue(\rightskip) 0.0 \glue 20.0 ----------- HERE \glue(\parskip) 5.0 \glue(\baselineskip) 5.05556 \hbox(6.94444+0.0)x469.75499, glue set 444.1994fil, direction TLT .\localpar ..\localinterlinepenalty=0 ..\localbrokenpenalty=0 ..\localleftbox=null ..\localrightbox=null .\hbox(0.0+0.0)x20.0, direction TLT .\tenrm b Or \everyparskip{} could be always in the format like \everyparskip{\vskip\parskip} and one could deal with it. Thanks, Linas ||
On 9/2/2021 2:48 PM, Linas Stonys wrote:
Hi, 1) sometimes styles requires to use small vertical indentation between paragraphs and naturally we choose to use \parskip and it leads to some painful programming dealing with spaces For example after float if there will be paragraph the space will be \|textfloatsep + \parskip. |The problem is that there is no control on this and I want to ask consider the possibility to add some tokens list like \everyparskip{} which would be inserted before \parskip where could be possible to check \lastskip:
FOR EXAMPLE: \parskip=5pt \everypar{\showthe\lastskip} a \vskip20pt
\showthe\lastskip b \showlists \bye
STDOUT:
0.0pt. <everypar> \showthe \lastskip
<to be read again> a l.3 a
?
20.0pt. l.6 \showthe\lastskip
?
0.0pt. <everypar> \showthe \lastskip
<to be read again> b l.7 b
POSSIBLE PLACE OF \everyparskip: .\tenrm a .\penalty 10000 .\glue(\parfillskip) 0.0 plus 1.0fil .\glue(\rightskip) 0.0 \glue 20.0 ----------- HERE \glue(\parskip) 5.0 \glue(\baselineskip) 5.05556 \hbox(6.94444+0.0)x469.75499, glue set 444.1994fil, direction TLT .\localpar ..\localinterlinepenalty=0 ..\localbrokenpenalty=0 ..\localleftbox=null ..\localrightbox=null .\hbox(0.0+0.0)x20.0, direction TLT .\tenrm b
Or \everyparskip{} could be always in the format like \everyparskip{\vskip\parskip} and one could deal with it. in luametatex we have
\starttext test \vskip10pt \everybeforepar{\writestatus{!}{\the\lastskip}} test \stoptext (plus more to experiment with) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On Thu, Jul 29, 2021 at 09:54:20AM +0200, luigi scarso wrote:
On Mon, Jun 21, 2021 at 5:03 PM Marcel Krüger
wrote: Hi,
consider the following plain LuaTeX document:
\textdir TRT \noindent\par \bye
without the `\textdir TRT` line or with `\textdir TLT`, this would lead to "warning (pdf backend): no pages of output.", but with the non default "\textdir", it creates an empty (except for the page number) page instead.
This can be avoided by setting \pardir too:
\textdir TRT\pardir TRT \noindent\par \bye
again produces no output, but adding a group around it reintroduces the issue:
\begingroup \textdir TRT\pardir TRT \noindent\par \endgroup \bye
leads to an empty page.
Of course similar things happen not only for otherwise empty documents: Instead of empty paragraphs disappearing, they add empty lines.
Together, this is not only inconsistent with other engines which always discard empty paragraphs, but also leads to hard to predict behavior (especially for users who are not familiar with the implementation of LuaTeX's directional system), so I think it would be great if LuaTeX could always remove such empty paragraphs.
(sorry for the delay) Do you have a patch to propose ?
I attached a patch which adds a \emptyparmode parameter with three possible states: - 0: Never ignore empty paragraphs. Not sure if this is useful, but it seemed like an obvious thing to add. - 1: The default: A paragraph is empty is it contains at most one node. This is the old behavior. - 2: A paragraph is empty if it only contains local_par and dir nodes. This is what I would consider the expected behavior. Best regards, Marcel
On Mon, Aug 2, 2021 at 5:52 PM Marcel Fabian Krüger
On Mon, Jun 21, 2021 at 5:03 PM Marcel Krüger
wrote: Hi,
consider the following plain LuaTeX document:
\textdir TRT \noindent\par \bye
without the `\textdir TRT` line or with `\textdir TLT`, this would lead to "warning (pdf backend): no pages of output.", but with the non default "\textdir", it creates an empty (except for the page number)
On Thu, Jul 29, 2021 at 09:54:20AM +0200, luigi scarso wrote: page
instead.
This can be avoided by setting \pardir too:
\textdir TRT\pardir TRT \noindent\par \bye
again produces no output, but adding a group around it reintroduces the issue:
\begingroup \textdir TRT\pardir TRT \noindent\par \endgroup \bye
leads to an empty page.
Of course similar things happen not only for otherwise empty documents: Instead of empty paragraphs disappearing, they add empty lines.
Together, this is not only inconsistent with other engines which always discard empty paragraphs, but also leads to hard to predict behavior (especially for users who are not familiar with the implementation of LuaTeX's directional system), so I think it would be great if LuaTeX could always remove such empty paragraphs.
(sorry for the delay) Do you have a patch to propose ?
I attached a patch which adds a \emptyparmode parameter with three possible states:
- 0: Never ignore empty paragraphs. Not sure if this is useful, but it seemed like an obvious thing to add. - 1: The default: A paragraph is empty is it contains at most one node. This is the old behavior. - 2: A paragraph is empty if it only contains local_par and dir nodes. This is what I would consider the expected behavior.
Best regards, Marcel
Thank you ! -- luigi
On Mon, Aug 02, 2021 at 05:55:18PM +0200, luigi scarso wrote:
On Mon, Aug 2, 2021 at 5:52 PM Marcel Fabian Krüger
wrote: I attached a patch which adds a \emptyparmode parameter with three possible states:
- 0: Never ignore empty paragraphs. Not sure if this is useful, but it seemed like an obvious thing to add. - 1: The default: A paragraph is empty is it contains at most one node. This is the old behavior. - 2: A paragraph is empty if it only contains local_par and dir nodes. This is what I would consider the expected behavior.
Best regards, Marcel
I just noticed that my repo wasn't up-to-date, so here is the patch again after resolving a conflict with the partoken change. Marcel
participants (5)
-
Hans Hagen
-
Linas Stonys
-
luigi scarso
-
Marcel Fabian Krüger
-
Marcel Krüger