On Sat, Jun 8, 2024 at 1:20 PM Udicoudco <udifog...@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
From 603fb87c3e9cbeaec133cddcdc09379591dbb645 Mon Sep 17 00:00:00 2001
From: Udi-Fogiel <udifoglle@gmail.com>
Date: Sun, 9 Jun 2024 03:04:56 +0300
Subject: [PATCH] consider pagerightoffset in luatex with rtl languages

This patch will calculate \pagerightoffset when LuaTeX is used
and the page direction is right to left. It is important as in
this case LuaTeX will use this register, and not \hoffset to
position the page.
---
 latex/preview.dtx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/latex/preview.dtx b/latex/preview.dtx
index 23f5b2da..cf5530e4 100644
--- a/latex/preview.dtx
+++ b/latex/preview.dtx
@@ -752,6 +752,7 @@
    \ifx\pr@offset@override\@undefined
      \voffset=-\ht\pr@box
      \hoffset=\z@
+     \pr@set@pagerightoffset
    \fi
    \c@page=\pr@snippet
    \pr@shipout
@@ -769,6 +770,22 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+% \begn{macro}{\pr@set@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@set@pagerightoffset\@empty
+\ifx\pagerightoffset\@undefined\else
+  \def\pr@set@pagerightoffset{%
+    \ifnum\pagedirection=1
+      \pagerightoffset=-1in
+      \advance\pagerightoffset-\pr@bb@i
+      \advance\pagerightoffset\pr@bb@iii
+    \fi
+  }
+\fi
+%    \end{macrocode}
+% \end{macro}
 % Oh, and we kill off the usual meaning of \cmd{\shipout} in case
 % somebody makes a special output routine.  The following test is
 % pretty much the same as in |everyshi.sty|.  One of its implications
-- 
2.44.0

_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to