Re: [XeTeX] bidi vs luabidi and polyglossia with Hebrew

2014-07-29 Thread Karljurgen Feuerherm
Thank-you, Khaled. That is encouraging! I will try to play with this.

K


On 2014-07-29, 19:33, "Khaled Hosny"  wrote:

>On Tue, Jul 29, 2014 at 11:24:52PM +, Karljurgen Feuerherm wrote:
>> * Why does this work with luabidi but not bidi? (or even, what¹s a
>>likely
>> reason)
>
>It is likely because with current XeTeX nodes are reversed
>unconditionally, so some starting \special node is coming after its
>ending one, which confuses the XDV driver.
>
>> * Is perhaps all of this likely to go away with the new XeTeX currently
>> under discussion?
>
>It should help.
>
>Regards,
>Khaled
>
>
>
>
>--
>Subscriptions, Archive, and List information, etc.:
>  http://tug.org/mailman/listinfo/xetex




--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] bidi vs luabidi and polyglossia with Hebrew

2014-07-29 Thread Khaled Hosny
On Tue, Jul 29, 2014 at 11:24:52PM +, Karljurgen Feuerherm wrote:
> * Why does this work with luabidi but not bidi? (or even, what¹s a likely
> reason)

It is likely because with current XeTeX nodes are reversed
unconditionally, so some starting \special node is coming after its
ending one, which confuses the XDV driver.

> * Is perhaps all of this likely to go away with the new XeTeX currently
> under discussion?

It should help.

Regards,
Khaled




--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


[XeTeX] bidi vs luabidi and polyglossia with Hebrew

2014-07-29 Thread Karljurgen Feuerherm
On July 5, I posted a query due to a problem I was having in creating
media9 buttons in RTL mode. The error I was getting when placing a media
button command in an RTL environment was "xdvipdfmx:fatal: A pending form
XObject at the end of page.²

A. Grahn offered a solution
(http://tex.stackexchange.com/questions/188434/media-button-in-rtl; see
the MWE there) which, however, depended upon using the luaTeX engine in
place of XeTeX and fooling polyglossia into loading luabidi in place of
bidi.

I have found that I can compile my real document now, and it seems ok. But
I am obviously concerned at a) using luaTeX for a production document,
given that lua documentation warns against it, b) pulling tricks on
polyglossia to get it to work, and c) the fact that I get "Package
polyglossia Warning: Hebrew is not supported with LuaTeX.   I will proceed
with the compilation, but the output is not guaranteed to be correct and
may look very wrong.²

I have searched but cannot find info on what the issue is with Hebrew and
luaTeX (my output so far seems fine). I wonder a number of things:

* Dare I proceed? (I rather need the RTL media buttonsŠ.)
* Why does this work with luabidi but not bidi? (or even, what¹s a likely
reasonŠ)
* What¹s the issue with Hebrew and luaTex?
* Is perhaps all of this likely to go away with the new XeTeX currently
under discussion?

Any insight at all on this would be appreciated. I follow the XeTeX
discussion with interest though I confess that the details are beyond me :)

Karljürgen G. Feuerherm, PhD | 2-139 Department of History | Wilfrid
Laurier University | 75 University Avenue West | Waterloo, Ontario N2L
3C5





--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread David Carlisle
On 29 July 2014 16:27, Khaled Hosny  wrote:

>>
>> \hbox \bgroup \beginR$
>
> That wouldn't work, as math (inline and display) are ensured to always
> be LTR.

oh yes, I knew that really:-) sorry Vafa, I shouldn't have queried you:-)

David



--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread Khaled Hosny
On Tue, Jul 29, 2014 at 03:35:57PM +0100, David Carlisle wrote:
> > \hbox \bgroup $\beginR
> 
> but couldn't you just do
> 
> \hbox \bgroup \beginR$

That wouldn't work, as math (inline and display) are ensured to always
be LTR. The original assumption was that you never need RTL math, but
this is wrong both for actual math (which is set right to left in
countries like Egypt) and (ab)using math mode for non-math material like
here.

Regards,
Khaled



--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread Vafa Khalighi
>
>
>
> but couldn't you just do
>
> \hbox \bgroup \beginR$
>
> to get the same, but working with older engines?
>


That was the first thing I tried when I wanted to implement RTL tabular in
bidi. Unfortunately that neither works with old xetex nor with new one.



>
> > I will look at longtable and see if the same kind of thing can be done
> there.
>
> I don't have it here but can you put \beginR at the start of $$ and
> still have a display \halign? if so you could easily make longtable do
> the right thing
>
> $$\beginR\halign{&#\hfil\cr a&b&c\cr}\endR$$
>
> ?
>
>
In this case, using \beginR, \endR inside display mode gives "Improper
\halign inside $$'s." error.


--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread David Carlisle
> \hbox \bgroup $\beginR

but couldn't you just do

\hbox \bgroup \beginR$

to get the same, but working with older engines?

> I will look at longtable and see if the same kind of thing can be done there.

I don't have it here but can you put \beginR at the start of $$ and
still have a display \halign? if so you could easily make longtable do
the right thing

$$\beginR\halign{&#\hfil\cr a&b&c\cr}\endR$$

?



--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread Vafa Khalighi
Hi David

I just did a quick experiment with new XeTeX. Since in new TeX-XeT
algorithm, \beginR, \beginL, \endR, and \endL can also be used in math
mode, the previous approach is not needed. Here is a test file for standard
LaTeX tabular environment:

\documentclass{article}
\begin{document}
\makeatletter
\def\@tabular{\leavevmode \hbox \bgroup $\beginR\let\@acol\@tabacol
   \let\@classz\@tabclassz
   \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}

 \def\endtabular{\crcr\egroup\egroup \endR$\egroup}
\makeatother
\begin{tabular}{}
First&Second&Third&Fourth\\
\end{tabular}
\end{document}


I will look at longtable and see if the same kind of thing can be done
there.


On Tue, Jul 29, 2014 at 10:20 PM, David Carlisle 
wrote:

> On 29 July 2014 12:55, Vafa Khalighi  wrote:
> >
> >
> >>
> >>
> >> If you are looking at extending xetex's RTL support is there any
> >> chance of addressing RTL tables (as affects for example longtable in
> >> the other thread)?
> >> as the nodes can only go in hmode there is no good place to put them
> >> to affect the ordering of columns in an halign.
> >>
> >
> >
> >
> > Hi David,
> >
> > The only way to make RTL \halign in TeX-XeT is to do a construct like
> >
> > \hbox{\beginR\vbox{%
> > \halign material
> > }\endR}
>
> Yes, but (as you know)  that's bad if the halign is on the main vertical
> list
> your bidi-longtable patch does as well as it can do to try to add the nodes
> in the output routine but it's not really got enough information.
>
> >
> > The parsitex change file (http://ctan.org/pkg/parsitex) which is also
> based
> > on Knuth TeX-XeT implements a \semihalign primitive that has the reverse
> > order column of \halign.
> >
> >
>
>
> That sounds good:-) an extension to flip the order of halign
> (or as you say a different primitive) would be easier to get right
> (and easier to share macro code with luatex)
>
> David
>
>
>
> --
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex
>


--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread David Carlisle
On 29 July 2014 12:55, Vafa Khalighi  wrote:
>
>
>>
>>
>> If you are looking at extending xetex's RTL support is there any
>> chance of addressing RTL tables (as affects for example longtable in
>> the other thread)?
>> as the nodes can only go in hmode there is no good place to put them
>> to affect the ordering of columns in an halign.
>>
>
>
>
> Hi David,
>
> The only way to make RTL \halign in TeX-XeT is to do a construct like
>
> \hbox{\beginR\vbox{%
> \halign material
> }\endR}

Yes, but (as you know)  that's bad if the halign is on the main vertical list
your bidi-longtable patch does as well as it can do to try to add the nodes
in the output routine but it's not really got enough information.

>
> The parsitex change file (http://ctan.org/pkg/parsitex) which is also based
> on Knuth TeX-XeT implements a \semihalign primitive that has the reverse
> order column of \halign.
>
>


That sounds good:-) an extension to flip the order of halign
(or as you say a different primitive) would be easier to get right
(and easier to share macro code with luatex)

David



--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread Vafa Khalighi
>
> If you are looking at extending xetex's RTL support is there any
> chance of addressing RTL tables (as affects for example longtable in
> the other thread)?
> as the nodes can only go in hmode there is no good place to put them
> to affect the ordering of columns in an halign.
>
>


Hi David,

The only way to make RTL \halign in TeX-XeT is to do a construct like

\hbox{\beginR\vbox{%
\halign material
}\endR}

The parsitex change file (http://ctan.org/pkg/parsitex) which is also based
on Knuth TeX-XeT implements a \semihalign primitive that has the reverse
order column of \halign.


--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread David Carlisle
On 29 July 2014 10:55, Khaled Hosny  wrote:
> On Mon, Jul 28, 2014 at 07:25:39PM +0200, Khaled Hosny wrote:
>> On Mon, Jul 28, 2014 at 10:24:39PM +1000, Vafa Khalighi wrote:
>> > >
>> > > Thanks, fixed.
>> > >
>> > >
>> > Thanks. I will try that. I know that in the new algorithm, \beginR,
>> > \beginL, \endR, and \endL are also allowed in math mode. But consider this
>> > minimal document
>> >
>> > \documentclass{article}
>> > \begin{document}
>> > \hbox{\beginR\vbox{%
>> > $$1+2=3$$
>> > }\endR}
>> > \end{document}
>> >
>> > The display math will be typeset RTL. Is there any switch that allows this
>> > to not happen? in etex, display math was always LTR but if there is some
>> > switch to turn this on/off, it would be great.
>>
>> So far there is not, but I'm still figuring what is the best option
>> here, may be a new primitive, say, \XeTeXmathdirection, with the values
>> 0 meaning math is always LTR (the default) and 1 meaning math respects
>> the surrounding text direction?
>
> Looking more closely, it seems I misidentified the issue. TeX-XeT resets
> the direction before inline and display math, so math is always LTR, but
> it seems that there is a bug that prevents this from happening in your
> example, I'll check that.
>
> In XeTeX we additionally allow the direction primitives in math mode so
> that one can manually override the default. I still think
> \XeTeXmathdirection primitive is needed to allow for document wide RTL
> math, but this is a different issue.
>
> Regards,
> Khaled
>

If you are looking at extending xetex's RTL support is there any
chance of addressing RTL tables (as affects for example longtable in
the other thread)?
as the nodes can only go in hmode there is no good place to put them
to affect the ordering of columns in an halign.

David



--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread Khaled Hosny
On Mon, Jul 28, 2014 at 07:25:39PM +0200, Khaled Hosny wrote:
> On Mon, Jul 28, 2014 at 10:24:39PM +1000, Vafa Khalighi wrote:
> > >
> > > Thanks, fixed.
> > >
> > >
> > Thanks. I will try that. I know that in the new algorithm, \beginR,
> > \beginL, \endR, and \endL are also allowed in math mode. But consider this
> > minimal document
> > 
> > \documentclass{article}
> > \begin{document}
> > \hbox{\beginR\vbox{%
> > $$1+2=3$$
> > }\endR}
> > \end{document}
> > 
> > The display math will be typeset RTL. Is there any switch that allows this
> > to not happen? in etex, display math was always LTR but if there is some
> > switch to turn this on/off, it would be great.
> 
> So far there is not, but I'm still figuring what is the best option
> here, may be a new primitive, say, \XeTeXmathdirection, with the values
> 0 meaning math is always LTR (the default) and 1 meaning math respects
> the surrounding text direction?

Looking more closely, it seems I misidentified the issue. TeX-XeT resets
the direction before inline and display math, so math is always LTR, but
it seems that there is a bug that prevents this from happening in your
example, I'll check that.

In XeTeX we additionally allow the direction primitives in math mode so
that one can manually override the default. I still think
\XeTeXmathdirection primitive is needed to allow for document wide RTL
math, but this is a different issue.

Regards,
Khaled



--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex


Re: [XeTeX] New version of xetex

2014-07-29 Thread Vafa Khalighi
Sounds good.


On Tue, Jul 29, 2014 at 3:25 AM, Khaled Hosny  wrote:

> On Mon, Jul 28, 2014 at 10:24:39PM +1000, Vafa Khalighi wrote:
> > >
> > > Thanks, fixed.
> > >
> > >
> > Thanks. I will try that. I know that in the new algorithm, \beginR,
> > \beginL, \endR, and \endL are also allowed in math mode. But consider
> this
> > minimal document
> >
> > \documentclass{article}
> > \begin{document}
> > \hbox{\beginR\vbox{%
> > $$1+2=3$$
> > }\endR}
> > \end{document}
> >
> > The display math will be typeset RTL. Is there any switch that allows
> this
> > to not happen? in etex, display math was always LTR but if there is some
> > switch to turn this on/off, it would be great.
>
> So far there is not, but I'm still figuring what is the best option
> here, may be a new primitive, say, \XeTeXmathdirection, with the values
> 0 meaning math is always LTR (the default) and 1 meaning math respects
> the surrounding text direction?
>
> Regards,
> Khaled
>
>
>
> --
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex
>


--
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex