2

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}
1

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

  • is there any solution in latex ? How to install xelatex – Hafid Boukhoulda Apr 15 '16 at 18:21
  • XeLaTeX is included by default in miktex. – Salim Bou Apr 15 '16 at 18:41
  • and what about texlive ? I am on linux! – Hafid Boukhoulda Apr 15 '16 at 18:45
  • xetex is available on texlive. so it is ok – Hafid Boukhoulda Apr 15 '16 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.