[luatex] Direction of hbox inside math

Vafa Khalighi vafakh84 at gmail.com
Tue Apr 13 02:30:59 CEST 2010


On Tue, Apr 13, 2010 at 4:02 AM, Khaled Hosny <khaledhosny at eglug.org> wrote:

>
> Currently, hbox inside math inherits math not text direction, so in this
> example:
>
> \textdir TRT text $\hbox{math}$
> \bye
>
> The "math" word will be set left-to-right. At first glance this looks
> natural, but with more thought I think it should instead follow the text
> direction. In Iran and Morocco, math is set from left-to-right but with
> Arabic text (sin, cos, "if else" etc.) so it would be simpler if text
> set inside hboxes followed the text not math direction. The other issue,
> which what actually inclined me to think about this, is that many tex
> code abuses math mode to typeset text, most notably latex's tabular
> environment, as a result one either needs to always set mathdir the same
> as textdir (which is not an option for many) or go through hoops
> redefining many internal macros of latex kernel and many other "frozen"
> packages, to get things work.
>
> What do you think?
>
>
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'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'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.



-- 
Best wishes,
Vafa Khalighi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20100413/005b96bf/attachment.html>


More information about the luatex mailing list