3

Is there a way to get arabic cells' tables rendered from right to left just like they are typesetted. here is a minimal example!

\documentclass[]{article}
\usepackage[ utf8 ]{inputenc}
\usepackage[LAE]{fontenc}

\usepackage[arabic]{babel} 

\usepackage{array}

\newsavebox{\RTLbox}
\newcolumntype{R}{>{\begin{lrbox}{\RTLbox}}c<{\end{lrbox}\AR{\usebox{\RTLbox}}}}

\begin{document}

أ ب ت

\vspace{2cm}

\begin{tabular}{*{3}R}
أ & ب & ت
\end{tabular}

\end{document}

2 Answers 2

2

I suggest you using polyglossia and change to xelatex instead of pdflatex engine.

polyglossia re­lies on the fontspec pack­age to manipulate fonts, and bidi to change direction of text from right to left (arabic script).

You can insert tabular in RTL mode, or in LTR mode depending on context.


MWE

% compile with xelatex 
\documentclass[a4paper]{article}
\usepackage{polyglossia}

\setdefaultlanguage[calendar=gregorian]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.3]{Amiri} % font for arabic text 
\parindent 0pt
\begin{document}

أ ب ت

\vspace{1cm}

\begin{tabular}{*{3}c}
أ & ب & ت
\end{tabular}

\vspace{1cm}

\begin{english}

\begin{tabular}{*{3}c}
a & b & c
\end{tabular}

\end{english}

\end{document}

enter image description here

4
  • is there any solution in latex ? How to install xelatex Commented Apr 15, 2016 at 18:21
  • XeLaTeX is included by default in miktex.
    – Salim Bou
    Commented Apr 15, 2016 at 18:41
  • and what about texlive ? I am on linux! Commented Apr 15, 2016 at 18:45
  • xetex is available on texlive. so it is ok Commented Apr 15, 2016 at 19:58
0

You defined a new kind of column R with:

\newcolumntype{R}{>{\begin{lrbox}{\RTLbox}}c<{\end{lrbox}\AR{\usebox{\RTLbox}}}}

but you don't use it since you use the c type of column in your document.

Try to use \begin{tabular}{*{3}R}, it should be better.

1
  • yes it is a mistake so I correct it Commented Apr 15, 2016 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .