# Re: RTL directionality in LaTeX

From: Ross Moore <ross.moore@mq.edu.au>
Date: Wed, 6 Nov 2013 07:34:05 +1100
Cc: Peter Krautzberger <peter.krautzberger@mathjax.org>, Frédéric WANG <fred.wang@free.fr>, Khaled Hosny <khaledhosny@eglug.org>, "www-math@w3.org" <www-math@w3.org>, Azzeddine LAZREK <a_lazrek@yahoo.fr>
Message-Id: <0BFA0F99-0170-4340-9CA4-CC1504EEC8FE@mq.edu.au>
To: Murray Sargent <murrays@exchange.microsoft.com>
Hi all,

On 06/11/2013, at 6:55 AM, Murray Sargent wrote:

> See also the Unicode Arabic Mathematical Alphabetic Symbols<http://www.unicode.org/charts/PDF/U1EE00.pdf>, which were standardized after the Arabic math reference below was published. A Unicode-enabled LaTeX could represent these symbols directly as Unicode characters. Alternatively, they can be represented as styles. The Unicode representation has the advantage that it can be transmitted using plain text.
>
> Murray

> But if it is just some pseudo-LaTeX syntax, I don't think the actual notation matters much, but \rtl{} looks more LaTeX-like to me.
> Or perhaps \dir[rtl]{...} with an optional parameter so that someone can still switch back to LTR with \dir[ltr]{...}.

I beg to disagree.
Choosing a syntax that already conflicts with other usages of the
macro name causes massive headaches for both developers and users.

Directionality is a property of the math environment, not of the
content in that environment, so this form is inappropriate:

\macro[property]{content} .

Rather it should be

\begin{<environment>}<property-spec>
... content ...
\end{<environment>}
e.g.
$$\mathdir{rtl} x^2$$
or
$$[rtl] x^2$$

Using  \dir  is bad, as it leads to a macro-name clash with the Xy-pic
package, used extensively over the past 15+ years for mathematical
and Computer Science (and other) diagrams.
It is a staple for Category Theorists.

I would vote for inserting something like \mathdir{rtl}
at the beginning of the environment.
This allows for:
1. an easy definition for backward compatibility
— let \mathdir just gobble its argument and do nothing;
2. a view forward to a hacky implementation
— the environment macro can look-ahead 1 token, to check
whether it is \mathdir and act accordingly.

A proper implementation would be to have the directionality
passed as an optional argument, with default set according to
what is commonly used in the language of the surrounding text.
John Plaice just gave a great talk on this kind of "mixing
directionalities" problem, 2 weeks ago at TUG 2013 — held in Japan,
where such issues are an everyday occurrence.

Anything else creates new syntax which current developers will
then need to find a way to handle. (La)TeX math is already very
complicated, and any such new concepts are not easily accommodated.

Please always discuss such syntax proposals with the LaTeX math
experts before making anything public. (As you are doing here.)
It is all too easy to try something that looks simple --- at least
for the user --- but is actually fraught with hidden pitfalls.

(They did this with WebEQ in the early years of MathML, introducing
incompatibilities for  {table}  environments. Thank goodness this
never really caught on.)

>
> --
> Frédéric Wang
> maths-informatique-jeux.com/blog/frederic<http://maths-informatique-jeux.com/blog/frederic>

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
------------------------------------------------------------------------

(image/png attachment: logo.png)

Received on Tuesday, 5 November 2013 20:38:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:27:46 UTC