GNU bug report logs - #71436
preview in LuaTeX with RTL as main language does not work

Previous Next

Package: auctex;

Reported by: Udicoudco <udifoglle <at> gmail.com>

Date: Sat, 8 Jun 2024 15:58:02 UTC

Severity: normal

To reply to this bug, email your comments to 71436 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Sat, 08 Jun 2024 15:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Udicoudco <udifoglle <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Sat, 08 Jun 2024 15:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Udicoudco <udifoglle <at> gmail.com>
To: bug-auctex <at> gnu.org
Subject: preview in LuaTeX with RTL as main language does not work
Date: Sat, 8 Jun 2024 13:20:09 +0300
[Message part 1 (text/plain, inline)]
In LuaTeX, when \pagedirection is right to left then \pagerightoffset is
used instead of \hoffset to position the page. I attached a patch and an example
that demonstrates the problem.

Udi
[0001-consider-pagerightoffset-in-luatex-with-rtl-language.patch (text/x-patch, attachment)]
[test.tex (text/x-tex, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Sun, 09 Jun 2024 05:41:02 GMT) Full text and rfc822 format available.

Message #8 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Udicoudco <udifoglle <at> gmail.com>
To: 71436 <at> debbugs.gnu.org
Subject: Fwd: preview in LuaTeX with RTL as main language does not work
Date: Sun, 9 Jun 2024 04:05:09 +0300
[Message part 1 (text/plain, inline)]
On Sat, Jun 8, 2024 at 1:20 PM Udicoudco <udifoglle <at> gmail.com> wrote:

> In LuaTeX, when \pagedirection is right to left then \pagerightoffset is
> used instead of \hoffset to position the page. I attached a patch and an
> example
> that demonstrates the problem.
>
>
There is a typo in the patch, so I attached a new one.

Udi
[Message part 2 (text/html, inline)]
[0001-consider-pagerightoffset-in-luatex-with-rtl-language.patch (application/x-patch, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Tue, 11 Jun 2024 16:23:02 GMT) Full text and rfc822 format available.

Message #11 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Udicoudco <udifoglle <at> gmail.com>
Cc: 71436 <at> debbugs.gnu.org
Subject: Re: bug#71436: Fwd: preview in LuaTeX with RTL as main language does
 not work
Date: Tue, 11 Jun 2024 14:45:54 +0900
Hi Udicoudco,

>>>>> Udicoudco <udifoglle <at> gmail.com> writes:
> On Sat, Jun 8, 2024 at 1:20 PM Udicoudco <udifoglle <at> gmail.com> wrote:
>> In LuaTeX, when \pagedirection is right to left then \pagerightoffset is
>> used instead of \hoffset to position the page. I attached a patch and an
>> example
>> that demonstrates the problem.
>> 
>> 
> There is a typo in the patch, so I attached a new one.

Thanks for your proposal, but "make" doesn't run with this patch:
,----
| gmake[1]: *** [Makefile:91: preview.pdf] Error 1
| gmake[1]: Leaving directory '/usr/home/keita/repo/auctex/auctex/latex'
| gmake: *** [Makefile:247: texmf] Error 2
`----

By the way, I suppose we need copyright assignment if this contribution
is to be incorporated into AUCTeX. Have you signed FSF copyright
assignment form before? If not, please have a look at
https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW




Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Tue, 11 Jun 2024 16:51:01 GMT) Full text and rfc822 format available.

Message #14 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Udicoudco <udifoglle <at> gmail.com>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 71436 <at> debbugs.gnu.org
Subject: Re: bug#71436: Fwd: preview in LuaTeX with RTL as main language does
 not work
Date: Tue, 11 Jun 2024 12:13:06 +0300
[Message part 1 (text/plain, inline)]
Hello Ikumi Keita,
Thank you for the reply.

On Tue, Jun 11, 2024 at 8:45 AM Ikumi Keita <ikumi <at> ikumi.que.jp> wrote:
> >>>>> Udicoudco <udifoglle <at> gmail.com> writes:
> > On Sat, Jun 8, 2024 at 1:20 PM Udicoudco <udifoglle <at> gmail.com> wrote:
> >> In LuaTeX, when \pagedirection is right to left then \pagerightoffset is
> >> used instead of \hoffset to position the page. I attached a patch and an
> >> example
> >> that demonstrates the problem.
> >>
> >>
> > There is a typo in the patch, so I attached a new one.
>
> Thanks for your proposal, but "make" doesn't run with this patch:

Oh, there was another typo. I did not test that the documentation
is typesetting properly, and there was a "\begn{macro}" instead
of `\begin{macro}`. I also updated the checksum of preview.dtx.
Tested now with the various engines and things seems to be working
(but please test thoroughly :)

> By the way, I suppose we need copyright assignment if this contribution
> is to be incorporated into AUCTeX. Have you signed FSF copyright
> assignment form before? If not, please have a look at
> https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future

Just sent an email, but in case it is suffice, when I'll get an answer
I'll attach the assignment. BTW, it is not that important, but
why is my postal address needed?

Regards,
Udi
[0001-consider-pagerightoffset-in-luatex-with-rtl-language.patch (application/x-patch, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Wed, 12 Jun 2024 08:33:02 GMT) Full text and rfc822 format available.

Message #17 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Udicoudco <udifoglle <at> gmail.com>
Cc: 71436 <at> debbugs.gnu.org
Subject: Re: bug#71436: Fwd: preview in LuaTeX with RTL as main language does
 not work
Date: Wed, 12 Jun 2024 17:32:28 +0900
Hi Udicoudco,

>>>>> Udicoudco <udifoglle <at> gmail.com> writes:
> Oh, there was another typo. I did not test that the documentation
> is typesetting properly, and there was a "\begn{macro}" instead
> of `\begin{macro}`. I also updated the checksum of preview.dtx.
> Tested now with the various engines and things seems to be working
> (but please test thoroughly :)

Thanks, it works well with my brief test.

>> By the way, I suppose we need copyright assignment if this contribution
>> is to be incorporated into AUCTeX. Have you signed FSF copyright
>> assignment form before? If not, please have a look at
>> https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future

> Just sent an email, but in case it is suffice, when I'll get an answer
> I'll attach the assignment.

I see. After the paperwork is done, I'll install your proposal.

> BTW, it is not that important, but why is my postal address needed?

I'm not sure :-) Probably some US legal matter is concerned.

Best regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW




Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Wed, 12 Jun 2024 11:27:02 GMT) Full text and rfc822 format available.

Message #20 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Udicoudco <udifoglle <at> gmail.com>
Cc: 71436 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>
Subject: Re: bug#71436: Fwd: preview in LuaTeX with RTL as main language
 does not work
Date: Wed, 12 Jun 2024 13:25:51 +0200
Udicoudco <udifoglle <at> gmail.com> writes:

> Oh, there was another typo. I did not test that the documentation
> is typesetting properly, and there was a "\begn{macro}" instead
> of `\begin{macro}`. I also updated the checksum of preview.dtx.
> Tested now with the various engines and things seems to be working
> (but please test thoroughly :)

Thanks for the patch.  I have some minor comments (and I'm not good at
writing TeX-code):

> From 0fe4d61af2d9494539e79ffd354623df9efde3e1 Mon Sep 17 00:00:00 2001
> From: Udi Fogiel <udifoglle <at> gmail.com>
> Date: Tue, 11 Jun 2024 11:33:35 +0300
> Subject: [PATCH] consider pagerightoffset in luatex with rtl languages
                   ^ Consider

> This patch will calculate \pagerightoffset when LuaTeX is used
> and the page direction is right to left. It is important as in
                                          ^ 2 spaces please

> this case LuaTeX will use this register, and not \hoffset to
> position the page.
> ---
>  latex/preview.dtx | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/latex/preview.dtx b/latex/preview.dtx
> index 23f5b2da..483e6f82 100644
> --- a/latex/preview.dtx
> +++ b/latex/preview.dtx
> @@ -20,7 +20,7 @@
>  %     Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
>  %     Boston, MA 02110-1301  USA
>  % \fi
> -% \CheckSum{1758}
> +% \CheckSum{1779}
>  % \GetFileInfo{preview.sty}
>  % \date{\filedate}
>  % \author{David Kastrup\thanks{\texttt{bug-auctex <at> gnu.org}}}
> @@ -752,6 +752,7 @@
>     \ifx\pr <at> offset <at> override\@undefined
>       \voffset=-\ht\pr <at> box
>       \hoffset=\z@
> +     \pr <at> set <at> pagerightoffset
>     \fi
>     \c <at> page=\pr <at> snippet
>     \pr <at> shipout
> @@ -769,6 +770,22 @@
>  %    \end{macrocode}
>  % \end{macro}
>  % \end{macro}
> +% \begin{macro}{\pr <at> set <at> pagerightoffset}
> +%   In |luatex| when page direction is right to left, |\pagerightoffset|
> +%   is used instead of |\hoffset|, so we need to calculate that as well.
> +%    \begin{macrocode}
> +\let\pr <at> set <at> pagerightoffset\@empty

Why not defining the macro properly instead of \let-ing?

\newcommand*\pr <at> set <at> pagerightoffset{}

> +\ifx\pagerightoffset\@undefined\else
> +  \def\pr <at> set <at> pagerightoffset{%
> +    \ifnum\pagedirection=1

I don't think this relevant here, but

\ifnum\pagedirection=1 %

is the safe version?

> +      \pagerightoffset=-1in
> +      \advance\pagerightoffset-\pr <at> bb <at> i
> +      \advance\pagerightoffset\pr <at> bb <at> iii
> +    \fi
> +  }
> +\fi
> +%    \end{macrocode}
> +% \end{macro}

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Wed, 12 Jun 2024 16:32:01 GMT) Full text and rfc822 format available.

Message #23 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Udicoudco <udifoglle <at> gmail.com>
To: Arash Esbati <arash <at> gnu.org>
Cc: 71436 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>
Subject: Re: bug#71436: Fwd: preview in LuaTeX with RTL as main language does
 not work
Date: Wed, 12 Jun 2024 19:30:18 +0300
On Wed, Jun 12, 2024 at 2:25 PM Arash Esbati <arash <at> gnu.org> wrote:
> Thanks for the patch.  I have some minor comments (and I'm not good at
> writing TeX-code):
>
> > +\let\pr <at> set <at> pagerightoffset\@empty
>
> Why not defining the macro properly instead of \let-ing?
>
> \newcommand*\pr <at> set <at> pagerightoffset{}

no real reason, I've tried to write the code
in the same style of the package. I was reading
the lines

\let\pr <at> ship <at> start\@empty
\let\pr <at> ship <at> end\@empty

just before writing this one. If you prefer to use
\newcommand, that's fine (althogh personally
I don't really like to use \newcommand for internal
commands).

> > +\ifx\pagerightoffset\@undefined\else
> > +  \def\pr <at> set <at> pagerightoffset{%
> > +    \ifnum\pagedirection=1
>
> I don't think this relevant here, but
>
> \ifnum\pagedirection=1 %
>
> is the safe version?

Define "safe". The version in my patch
can theoretically break if \endlinechar is -1
at the time of the definition of  \def\pr <at> set <at> pagerightoffset
for example, as the end of line after \ifnum\pagedirection=1
will be removed and no space will be created after TeX tokenize
the macro definition, so if there are more digits (of something that
expands to digits) after  =1 we can be in trouble, but in this case
what appears after it is \pagerightoffset which is not expandable,
so it is safe.

For example with

\documentclass{article}
\begin{document}
\newcount\foo\foo=20
\endlinechar=-1
\def\bar{%
    \ifnum 1 = 1
    \the\foo Yes\else No\fi
  }
\show\bar\bar
\endlinechar=13
\end{document}

You will get no, as the definition of \ab does
not  have a space between 1 and \the (which
would be there if \endlinecahe wasn't -1), and
\the\foo expands to 20 and so the test actually
check \ifnum 1=120 (after \the\foo \ifnum encounter the 'Y'
which is not a digit so it stops).

With the following (which is similar to the code in the patch)

\documentclass{article}
\begin{document}
\newcount\foo\foo=20
\endlinechar=-1
\def\bar{%
    \ifnum 1 = 1
    \foo=1 Yes\else No\fi
  }
\show\bar\bar
\endlinechar=13
\end{document}

you get 'Yes' because \foo is unexpandable
and is not a digit nor is equivalent in some sense to a digit,
so \ifnum does not include him in the comparison.

Using \ifnum\pagedirection=1 % assume that '%'
has category code 14 (which is usually the case).

In any case, probably the safest way to go
is to use \ifnum\pagedirection=\@ne as it does not
rely on what appears next (\@ne is an unexpandable
token, to \ifnum stop looking after him, and it is equivalent to 1).

I don't really mind doing these changes,
it is really your call. Should I prepare
a new patch using \newcommand and
\ifnum\pagedirection=\@ne?

Regards,
Udi




Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Sun, 16 Jun 2024 11:24:02 GMT) Full text and rfc822 format available.

Message #26 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Udicoudco <udifoglle <at> gmail.com>
Cc: 71436 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>
Subject: Re: bug#71436: Fwd: preview in LuaTeX with RTL as main language
 does not work
Date: Sun, 16 Jun 2024 13:21:08 +0200
Udicoudco <udifoglle <at> gmail.com> writes:

> I don't really mind doing these changes,
> it is really your call. Should I prepare
> a new patch using \newcommand and
> \ifnum\pagedirection=\@ne?

Thanks for your response.  I'd really appreciate if you would prepare a
new patch adding the points above.  TIA.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#71436; Package auctex. (Fri, 14 Feb 2025 11:15:01 GMT) Full text and rfc822 format available.

Message #29 received at 71436 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Udicoudco <udifoglle <at> gmail.com>
Cc: 71436 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>
Subject: Re: bug#71436: preview in LuaTeX with RTL as main language does not
 work
Date: Fri, 14 Feb 2025 12:13:23 +0100
Arash Esbati <arash <at> gnu.org> writes:

> Udicoudco <udifoglle <at> gmail.com> writes:
>
>> I don't really mind doing these changes,
>> it is really your call. Should I prepare
>> a new patch using \newcommand and
>> \ifnum\pagedirection=\@ne?
>
> Thanks for your response.  I'd really appreciate if you would prepare a
> new patch adding the points above.  TIA.

Ping!  Any progress here?  I haven't checked if your assignment is on
file.  Is there any help needed to get the process going?

Best, Arash




This bug report was last modified 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.