# [Dev-luatex] LuaTeX doesn't discard empty paragraphs when textdir is used

luigi scarso luigi.scarso at gmail.com
Mon Aug 2 17:55:18 CEST 2021

On Mon, Aug 2, 2021 at 5:52 PM Marcel Fabian Krüger <tex at 2krueger.de> wrote:

> 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 <tex at 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  ?
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/dev-luatex/attachments/20210802/5ac26464/attachment.htm>