Google Groupes n'accepte plus les nouveaux posts ni abonnements Usenet. Les contenus de l'historique resteront visibles.

Problem in ETeX with right to left typesetting.

3 vues
Accéder directement au premier message non lu

mike

non lue,
13 sept. 2005, 18:01:2013/09/2005
à
Hello,

I use ETeX with plain TeX.
Since I print documents in a semitic language, I use the right to left
features of ETeX. I have discovered a thing that sounds like a bug:
To write a document from right to left, I do not know another mean that
typing: \everypar={\beginR}.
But then, when a display math formula appears, ETeX is no more able to
compute the difference between short lines and long ones before the
display formula; that is, \abovedisplayskip is always used even if the
line is short and \abovedisplayshortskip has to be used. To give an
example, compare theses two codes, the one using right to left feature,
and the other without this feature:

<<
\TeXXeTstate=1 %to enable the particular features of ETeX.
\everypar={\beginR} % put a \beginR at the beginning of every par
\abovedisplayshortskip=0pt %to make the difference clear
\abovedisplayskip=50pt % '' '' ''
hello word $$ax+b=0$$ \end

and
<<
\abovedisplayshortskip=0pt
\abovedisplayskip=50pt
hello word. $$ ax+b$$ \end

Does anyone know how to restitute the difference between long and short
lines before a display formula, while typesetting from right to left?

Thanks,
Michael.

Jonathan Fine

non lue,
14 sept. 2005, 03:16:4914/09/2005
à

Thank you for posting this problem.

As you know, you first posted it 11 days ago. And no-one replied.

I've no experience of bidirectional typesetting, but I think I
know how TeX works. So I'll have a look at this problem over
the next few days.

Unless, that is, someone more qualified takes it up.

--
Jonathan

Ralf Stubner

non lue,
14 sept. 2005, 04:13:3814/09/2005
à
"mike" <maim...@hotmail.com> writes:

> Does anyone know how to restitute the difference between long and short
> lines before a display formula, while typesetting from right to left?

I don't know why this is happening. However, it looks as if this is
similar to the case where \parfillskip has only finite strechability:

%%%%%%%%%%%%%%%%
\abovedisplayshortskip=0pt
\abovedisplayskip=50pt
hello word. $$\the\predisplaysize$$

{\parfillskip=1cm plus 1cm
hello word. $$\the\predisplaysize$$ \par}

\TeXXeTstate=1
\everypar={\beginR}
hello word. $$\the\predisplaysize$$

\end
%%%%%%%%%%%%%%%%

Maybe this helps somebody debugging this problem.

cheerio
ralf

Taco Hoekwater

non lue,
14 sept. 2005, 07:13:5514/09/2005
à

Jonathan Fine wrote:
> mike wrote:
>
>> Hello,
>>
>> I use ETeX with plain TeX.
>> Since I print documents in a semitic language, I use the right to left
>> features of ETeX. I have discovered a thing that sounds like a bug:
>> To write a document from right to left, I do not know another mean that
>> typing: \everypar={\beginR}.
>> But then, when a display math formula appears, ETeX is no more able to
>> compute the difference between short lines and long ones before the
>> display formula; that is, \abovedisplayskip is always used even if the
>> line is short and \abovedisplayshortskip has to be used. To give an

It is not always wrong. It seems there is only a problem when there is
just a single line above the formula. This example comes out ok:

\TeXXeTstate=1 %to enable the particular features of ETeX.
\everypar={\beginR} % put a \beginR at the beginning of every par
\abovedisplayshortskip=0pt %to make the difference clear
\abovedisplayskip=50pt % '' '' ''

hello word. Here is a longer sentence that wraps over to the second line
of the paragraph even with plain.tex's long line width
$$ax+b=0$$ \end

Greetings, Taco

Donald Arseneau

non lue,
14 sept. 2005, 07:33:1914/09/2005
à
Jonathan Fine <jf...@pytex.org> writes:

> I've no experience of bidirectional typesetting, but I think I
> know how TeX works.

SAme here, and the behaviour observed is exactly what I would
expect, given that:

- the short partial line is on the right, not the left.
- the display math is typeset left to right. and ...
- the display layout is unaltered by xet mode

-> The \displayindent spacing is on the right, but the
\predisplaysize occupancy is on the left. It would be
a mistake to correlate them.

--
Donald Arseneau as...@triumf.ca

Morten Høgholm

non lue,
14 sept. 2005, 14:21:0714/09/2005
à
On Wed, 14 Sep 2005 13:33:19 +0200, Donald Arseneau <as...@triumf.ca> wrote:

> SAme here, and the behaviour observed is exactly what I would
> expect, given that:
>
> - the short partial line is on the right, not the left.
> - the display math is typeset left to right. and ...
> - the display layout is unaltered by xet mode
>
> -> The \displayindent spacing is on the right, but the
> \predisplaysize occupancy is on the left. It would be
> a mistake to correlate them.

eTeX has \predisplaydirection which is negative when $$ is encountered in
right-to-left mode. If that is the case, \displayindent is set negative.
As Taco showed, ensuring that the text has more than one line gets eTeX
back on the right track. I suspect the line breaking done right before a
display does something strange if the text ends with an right-to-left bit
and fits on one line. I suggest we take this up on the tex-k list.

For the time being, maybe the hebrew support in babel can help. It
contains the following code, which when adapted to plain TeX seems to
alleviate the problem:

% Take care of Right-to-Left indentation in every paragraph.
% Originally, \cs{noindent} was redefined for right-to-left by
% Yaniv Bargury, then the implementation was rewritten by Alon Ziv
% using an idea by Chris Rowley: \cs{noindent} now works
% unmodified.
% \begin{macrocode}
\def\rl@everypar{\if@rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
\let\o@everypar=\everypar
\def\everypar#1{\o@everypar{\rl@everypar#1}}
% \end{macrocode}
%
--
Morten

Donald Arseneau

non lue,
14 sept. 2005, 15:36:1214/09/2005
à
Morten Høgholm <morten....@gmail.com> writes:

> eTeX has \predisplaydirection which is negative when $$ is encountered in
> right-to-left mode. If that is the case, \displayindent is set negative.

Thanks so much for the explanation!

> \def\rl@everypar{\if@rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi}

That makes a lot of sense, if etex only uses rl-style display
positioning when the *entire* line above is in rl mode. A
mixed-mode line should indeed be treated specially.

--
Donald Arseneau as...@triumf.ca

mike

non lue,
16 sept. 2005, 03:16:4716/09/2005
à
Thank you very much to all for your explannation. especially thank you
Mortem for having giving me a way to correct the "bug".

Michael.

0 nouveau message