Menu

#134 Allow direction to be specified while in vertical mode

Future
open
nobody
None
5
2016-11-21
2016-11-21
No

More of a feature request than a bug report but adding issue here as requested by Arthur in the related mailing list thread at

http://tug.org/pipermail/xetex/2016-November/026906.html

xetex (following etex and tex-xet) only allows the typesetting direction to be specified while the current mode is horizontal. In the original tex-xet this was related to the need to add whatsit nodes, but in (x)etex this isn't so clearly required and it leads to a very fragile user interface, and in the case of tables, completey missing functionality.

Normally it is known before a paragraph, the intended direction (for example if the entire document is in Arabic). However as \beginR has to be in horizontal mode you have to first start a left-to-right paragraph (possibliy including indentation) before switching the typesetting order. Macro packages typically try to hide this by automatically including \beginR via \everypar as shown in the paragraph in the attached file, however using \everypar for this use conflicts with its use for everything else (for example in latex, suppressing indentation after headings, or adding list item labels) This can be worked around but means that the bidi macros have to be very invasive and very fragile. There is one place where no workaround is really possible: it is not possible to make \halign columns be stacked from right to left using this mechanism (while leaving the \halign on the main vertical list to allow page breaking).

Conversely the omega/luatex declaration \textdir TFT acts in hmode like a \beginR/\endR pair but is allowed in vmode and does the natural thing, requring far less support from the macro layer.

It has been suggested in the past to add a new halign primitive that adds columns from the right but I think that is the wrong approach just attacking the symptoms, not addressing the root of the problem which is the natural place to specify directionality is often in vmode. It would also complicate cross engine macro support.

The attached file in luatex produces a RTL paragraph and an RTL table, if the \bodydir line is uncommented then the same is produced but with a different setting on the page (starting at the right edge)

If the file is processed with xetex, the \everypar mechanism is used to make the paragraph be RTL but the table is still LTR, with as far as I can see no way to make it RTL other than directly editing the source to change the column order and enter the table in display, rather than reading, order.

If xetex could add a primitive that worked like \textdir TFT (it would not need to be exactly that syntax, especially if vertical typesetting were not added) then the existing \begin[LR]/\end[LR] could be described and possibly even implemented as just use of \textdir in horizontal mode, although such a change in implementation wouldn't be essential if there were compatibility concerns about edge cases. The main suggestion here is to add a declaration usable in vertical mode.

David

1 Attachments

Discussion

Anonymous
Anonymous

Add attachments
Cancel