<div dir="ltr"><br><br><div class="gmail_quote">On Tue, Apr 13, 2010 at 4:02 AM, Khaled Hosny <span dir="ltr">&lt;<a href="mailto:khaledhosny@eglug.org">khaledhosny@eglug.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Currently, hbox inside math inherits math not text direction, so in this<br>
example:<br>
<br>
\textdir TRT text $\hbox{math}$<br>
\bye<br>
<br>
The &quot;math&quot; word will be set left-to-right. At first glance this looks<br>
natural, but with more thought I think it should instead follow the text<br>
direction. In Iran and Morocco, math is set from left-to-right but with<br>
Arabic text (sin, cos, &quot;if else&quot; etc.) so it would be simpler if text<br>
set inside hboxes followed the text not math direction. The other issue,<br>
which what actually inclined me to think about this, is that many tex<br>
code abuses math mode to typeset text, most notably latex&#39;s tabular<br>
environment, as a result one either needs to always set mathdir the same<br>
as textdir (which is not an option for many) or go through hoops<br>
redefining many internal macros of latex kernel and many other &quot;frozen&quot;<br>
packages, to get things work.<br>
<br>
What do you think?<br>
<br>
</blockquote><div><br>I think luatex behaviour in this matter is right and the direction inside math is better not to follow the text direction in the engine level. If you need to typeset an hbox RTL in math mode, you can simply have $\hbox dir TRT{math}$. I think  a macro package can provide all of this ideas, it can implement \hboxR and \hboxL like what I have done in the recent version of  bidi package. If one is doing math RTL, then would not mathdir TRT, already make that \hbox inside math mode RTL? with latex&#39;s tabular thing, I guess you are right but we could redefine hbox to be always RTL inside tabular by some macro programming and one tabular environment is finished, hbox gets back its original definition. However, I think this is not clean, I believe a clean way for latex&#39;s tabular is to have a primitive \halignR, such that it makes tabular RTL, if Taco wants, I even can send a source code where he can actually extract the implementation of \halignR from the source code.<br>
</div></div><br><br clear="all"><br>-- <br>Best wishes,<br>Vafa Khalighi<br>
</div>