W3C home > Mailing lists > Public > www-math@w3.org > November 2013

RE: RTL directionality in LaTeX

From: Daniel Marques <dani@wiris.com>
Date: Wed, 6 Nov 2013 12:32:09 +0100
Message-ID: <0958de362a4753f4bb27da4a89ce4c26@mail.gmail.com>
To: Ross Moore <ross.moore@mq.edu.au>, David Carlisle <davidc@nag.co.uk>
Cc: Murray Sargent <murrays@exchange.microsoft.com>, Peter Krautzberger <peter.krautzberger@mathjax.org>, Frédéric WANG <fred.wang@free.fr>, Khaled Hosny <khaledhosny@eglug.org>, www-math@w3.org, Azzeddine LAZREK <a_lazrek@yahoo.fr>
Some of my conclusions:

1. The MathML 3 specification allows the dir at any level (remember the
original question was related to MathML and LaTeX mutual conversion, thus
math mode only).
2. We assume that UTF-8 is used for encoding Arabic or Hebrew characters
(this is not related to RTL but worth to mention).
3. "As far as directionality is concerned, there is only two models; LTR
and RTL. Other changes are merely differences in the notation used and
this should be reflected in the content of the equations themselves
(unless some form of abstraction is used)." (Khaled)
4. The \dir and \mathdir are already used as macro names.
5. The use of \style{direction:rtl}{x^2} is tempting but difficult to
implement in TeX/LaTeX (although I do not care very much).
6. The use of {\mathdir{rtl}x^2} seems a quite good compromise solution.
7. Another option is to use \mathRTL and \mathLRT as a possible extension
of the \RTL and \LTR commands of the bidi package.

Dani

-----Original Message-----
From: Ross Moore [mailto:ross.moore@mq.edu.au]
Sent: martes, 05 de noviembre de 2013 23:05
To: David Carlisle
Cc: Murray Sargent; Peter Krautzberger; Frédéric WANG; Khaled Hosny;
www-math@w3.org; Azzeddine LAZREK
Subject: Re: RTL directionality in LaTeX

Hi David,

On 06/11/2013, at 8:07 AM, David Carlisle wrote:

> On 05/11/2013 20:34, Ross Moore wrote:
>> Directionality is a property of the math environment, not of the
>> content in that environment
>
>
> Usually but not always. After the review of use cases in the Arabic
> math note, directionality in MathML3 is allowed at the level of
> <mrow>, not just on the top level <math>. (Whether any particular TeX
> or MathML rendering agent can support switching at that level is
> another issue but the specification allows it.)

OK. Thanks for that clarification.


On 06/11/2013, at 8:43 AM, Khaled Hosny wrote:

> On Wed, Nov 06, 2013 at 07:34:05AM +1100, Ross Moore wrote:
>> I would vote for inserting something like \mathdir{rtl}
>
> Please note that \mathdir is already an Omega/Aleph/LuaTeX[1]
> primitive name.
>
> Regards,
> Khaled
>
> 1. In case of LuaTeX it is "hidden" by default, but formats my choose to
>   enable it.


With this information, my advice would be to have a macro that effectively
just sets a switch, in the usual TeX-like way, whose value is confined to
a brace-delimited environment.
Internal macro expansion either respects the value of that switch or
ignores it.
The details are left to developers to fill in.

e.g. user-syntax could be:
  \[
     x^2 + 2\,x + 1 =
    \begin{cases}
          (x+1)^2 & \text{ in Roman LTR script (LTR)}\\
      {\setmathdir{rtl} (x+1)^2 } & \text{in Arabic (RTL)}
    \end{cases}
  \]

Thus in Omega/Aleph/LuaTeX  the primitive is set locally.
Other formats would need to implement much more to get it right, or just
gobble the argument and issue a warning message that directionality
support is not yet available.

This is in accordance, I think, with the discussion here:

  http://tug.org/pipermail/luatex/2012-December/003929.html

where direct use of the primitive is delimited.


>
> David


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore@mq.edu.au
Mathematics Department                           office: E7A-206
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------
Received on Wednesday, 6 November 2013 11:32:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 6 November 2013 11:32:37 UTC