A demonstration of the issue by way of a minimal working example
I saved the following LaTeX code in the file ~/Test.tex
.
\documentclass{article}
\usepackage[bidi=basic,english,hebrew,provide=*]{babel}
\babelfont{rm}{FreeSerif}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{cc}
left & right
\end{tblr}
\end{document}
The code uses the babel
package to set the document's main language to Hebrew (a language written from right to left), and the document's secondary language to English. It then creates a simple table using the tabularray
package. The table has two columns, and a single row. The first entry in the row is left
, and the second entry is right
.
I then executed the following commands in the Terminal.
> cd ~
> lualatex Test
This resulted in the file ~/Test.pdf
being created. When opened in a PDF viewer this file displays as follows. (I screenshot only the relevant part of the display.)
As can be seen, the relative order of the words "left" and "right" is the reverse of what their meanings indicate. This is not a bug. It is due to the fact that the document's main language is Hebrew.
If it is desired to keep the document's main language as Hebrew, but change the table's directionality, one way to accomplish this is to change the language to English just before the table's definition, and change it back to Hebrew just after the table's definition, thus:
\selectlanguage{english}
\begin{tblr}{cc}
left & right
\end{tblr}
\selectlanguage{hebrew}
This produces
Questions
- Is there a way to change the table's language and directionality by passing an argument to
tblr
rather than by wrapping it in\selectlanguage
commands? - Is there a way to change the language and directionality of all the tables in the document using
tabularray
's\SetTblrInner
or\SetTblrOuter
commands?
Remark
I'm interested in changing two independent properties: the table's directionality, and the table's language. To clarify the distinction by way of an example, the PDF file of the following Hebrew document containing a tabularrray
with a single column and a single row (and therefore no directionality) and the entry -2
in its single cell displays, displays 2-
(i.e. the minus sign is typeset to the right of the digit 2
), because the table's language is Hebrew, as inherited from the document.
\documentclass{article}
\usepackage[bidi=basic,english,hebrew,provide=*]{babel}
\babelfont{rm}{FreeSerif}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{c}
-2
\end{tblr}
\end{document}