2

For example 2.41 becomes 41.2

\documentclass{book}
\usepackage[format=hang, labelfont=bf]{caption}
\usepackage{xepersian}
\settextfont[Scale=2]{Times New Roman}
\setlatintextfont[Scale=2]{Times New Roman}
\defpersianfont\Sayeh[Scale=1.5]{Times New Roman}
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{rrl}
\toprule
\multicolumn{1}{l}{\textbf{النسبة (\%)}} & \multicolumn{1}{l}{\textbf{المساحة (كام²)}} & \textbf{الجماعة} \\
\midrule
    2.41                 & 4.22                 & زريزر \\
    3.79                 & 6.66                 & خلالفة \\
    26.51                & 46.56                & مزراوة \\
\midrule
\textbf{100.00}      & \textbf{175.65}      & \textbf{المجموع} \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
\end{document}
0

When you use xepersian package (at the end of your package), your text will be written right to left.
But for decimal number this structure will change (This is intentional; for example, it is used for the chapters numbering and also equation numbering ...).
The xepersian package have a nice command for this situation. you should use \setlatin command for this purpose.
And also I use array package for extended column definitions.
This is your codes:


\documentclass{book}
\usepackage[format=hang, labelfont=bf]{caption}
\usepackage{booktabs}
\usepackage{array}% for extended column definitions 
\usepackage{xepersian}
\settextfont[Scale=2]{Times New Roman}
\setlatintextfont[Scale=2]{Times New Roman}
\defpersianfont\Sayeh[Scale=1.5]{Times New Roman}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{>{\setlatin}r>{\setlatin}r>{\setlatin}l}
\toprule
\multicolumn{1}{l}{\textbf{النسبة (\%)}} & \multicolumn{1}{l}{\textbf{المساحة (كام²)}} & \textbf{الجماعة} \\
\midrule
2.41 
& 
4.22                
& زريزر \\
    3.79                 & 6.66                 & خلالفة \\
    26.51                & 46.56                & مزراوة \\
\midrule
\textbf{100.00}      & \textbf{175.65}      & \textbf{المجموع} \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
\end{document}

And this is your output:


enter image description here

Good luck.

2

Using XePersian your decimal numbers will get messed up. You have 3 options:

  1. Type numbers inversed (Not recommended)
  2. Put your number in math inline mode, $ $
  3. Use Persian/Arabic decimal point instead of .

    \documentclass{article} 
    \usepackage{xepersian} 
    \settextfont{Yas}
    \setdigitfont{Yas}

    \begin{document}
        \centering
        اعداد \\
        12.75\\
        75.12\\
        $12.75$\\
        12٫75 % type ٫ using  SHIFT+3 (Persian standard keyboard) or SHIFT+k (Arabic keyboard)
    \end{document}

Output

  • 1
    This is kind of workaround but does not solve the problem, for a small table it is ok, but when we have a a big table with many rows and sells, it is not ok, it becomes a big problem when we use Excel2LaTx, i am going to accept your answer. – Abdelhak Elfengour Sep 6 '18 at 15:59

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.