5

I want to show the caption of the figure in Arabic language. Given the unpredictable interactions with other packages, I tended to keep them in the preamble of the MWE.

Questions

  1. How to set the numbers of the caption to appear like in Hindi (Waahid-the blue digit as appeared in the output, Ithnaan, Thalaatha, etc) numbers instead of Arabic ones (1,2,3,etc)?

  2. How to make the "Figure" under the image appear in Arabic language صورة، رسم? As you can see nothing appeared in the output.

  3. How to enter Arabic text in the caption of the figure? As you can see the caption text in Arabic didn't show up in the output.

  4. More general one, suppose I want to write few words in English inside the Arabic text, as you can see image in English appeared in opposite direction English in image, what is the best approach to switch to a left-to-right direction inside Arabic text? Or how to revert back to English locally?

Below is my trial, although the body text seems to be manageable, most of the hassles are with the caption of the figures. I am open to all kinds of suggestion to improve the way of marking up in LaTeX and output.

MWE Code

\documentclass[oneside,16pt]{scrartcl} 
%=====================Graphics ===================================
\usepackage[demo]{graphicx}
\usepackage{xcolor}
\usepackage{tikz} 
%=====================Floats =====================================
\usepackage{floatrow} 
\usepackage{float}
\usepackage{scrhack}
\usepackage{caption}
\captionsetup[figure]{labelfont=bf,labelsep=period,format=plain,skip=0pt,font=small}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{subcaption} 
%=====================Hyphenation ================================
\usepackage[none]{hyphenat}
\usepackage[protrusion = true,final]{microtype}
\emergencystretch=2em
%=====================Hyperref ===================================
\usepackage[hyperindex=true, hyperfootnotes=true]{hyperref}
\hypersetup{
    colorlinks, linkcolor={blue},
    citecolor={blue}, urlcolor={blue} %url can be magenta 
    }
%=====================Font issues ===================================
\usepackage{fontspec}
\usepackage{csquotes}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Traditional Arabic} % or put whatever open type Arabic font you have on your machine inside the two braces
%=====================End of Preamble ===================================
\begin{document}
\begin{Arabic}
هنا النص باللغة العربية، ثم جملة تحتاج الى صورة للتوضيح ، انظر الصورة رقم \ref{fig:image1}. 
 قد تبرز الحاجة احيانا الى استخدام كلمة باللغة الانكليزية مثلا image in English فما افضل طريقة لعمل ذلك؟

\begin{figure}
\begin{mdframed}[
 align=center,
 linecolor=black,
 fontcolor=black,
 backgroundcolor=white,
 userdefinedwidth=0.9\textwidth,
 roundcorner=5pt,
 skipabove=0pt,
 skipbelow=0pt,
 leftmargin=0pt,
 innerleftmargin=0pt,
 innerrightmargin=0pt,
 innertopmargin=5pt,
 innerbottommargin=5pt, 
 innerlinewidth=0pt,
 middlelinewidth=0pt,
 outerlinewidth=2pt]
\centering
\includegraphics[width=0.9\textwidth]{image1}
\end{mdframed}
\RawCaption{\caption{
هنا التعليق عن الصورة باللغة العربية، قد تبرز الحاجة احيانا الى استخدام كلمة باللغة الانكليزية مثلا image فما افضل طريقة لعمل ذلك؟
}
\label{fig:image1}}
\end{figure}
\end{Arabic}
\end{document}

MWE Output

enter image description here

2

This can be done by setting Arabic as the main language and English as the other language.

\documentclass[oneside,16pt]{scrartcl} 
%=====================Graphics ===================================
\usepackage[demo]{graphicx}
\usepackage{xcolor}
\usepackage{tikz} 
%=====================Floats =====================================
\usepackage{floatrow} 
\usepackage{float}
\usepackage{scrhack}
\usepackage{caption}
\captionsetup[figure]{labelfont=bf,labelsep=period,format=plain,skip=0pt,font=small}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{subcaption} 
%=====================Hyperref ===================================
\usepackage[hyperindex=true, hyperfootnotes=true]{hyperref}
\hypersetup{
    colorlinks, linkcolor={blue},
    citecolor={blue}, urlcolor={blue} %url can be magenta 
    }
%=====================Font issues ===================================
\usepackage{fontspec}
\usepackage{csquotes}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Traditional Arabic} % or put whatever open type Arabic font you have on your machine inside the two braces
%=====================End of Preamble ===================================
\begin{document}
\begin{Arabic}
هنا النص باللغة العربية، ثم جملة تحتاج الى صورة للتوضيح ، انظر الصورة رقم \ref{fig:image1}. 
 قد تبرز الحاجة احيانا الى استخدام كلمة باللغة الانكليزية مثلا image in English فما افضل طريقة لعمل ذلك؟

\begin{figure}
\begin{mdframed}[
 align=center,
 linecolor=black,
 fontcolor=black,
 backgroundcolor=white,
 userdefinedwidth=0.9\textwidth,
 roundcorner=5pt,
 skipabove=0pt,
 skipbelow=0pt,
 leftmargin=0pt,
 innerleftmargin=0pt,
 innerrightmargin=0pt,
 innertopmargin=5pt,
 innerbottommargin=5pt, 
 innerlinewidth=0pt,
 middlelinewidth=0pt,
 outerlinewidth=2pt]
\centering
\includegraphics[width=0.9\textwidth]{image1}
\end{mdframed}
\RawCaption{\caption{
هنا التعليق عن الصورة باللغة العربية، قد تبرز الحاجة احيانا الى استخدام كلمة باللغة الانكليزية مثلا image فما افضل طريقة لعمل ذلك؟
}
\label{fig:image1}}
\end{figure}
\end{Arabic}
\end{document}

Output
enter image description here

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.