11

I am trying to create a TikZ figure as below, but the compilation is problematic when one adds some Arabic text.

\documentclass[tikz, border=5pt, multi]{standalone}
\usepackage{polyglossia}
\usepackage [utf] {arabxetex}
\usepackage{fontspec}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{fourier}
\setmainlanguage[variant=british]{english}
\newfontfamily\arabicfont{Amiri}[Script=Arabic]
\usetikzlibrary{arrows.meta,calc}
\usepackage{color}
\usepackage{tikz,pgfornament,tikzrput}         % altermundus.com/pages/tkz/tikzrput/
\usetikzlibrary{decorations,decorations.text}  % altermundus.com/pages/tkz/ornament/ 

\begin{document}

    \begin{tikzpicture}

    \node[circle, minimum size=7cm, draw, fill=yellow] (a) {};
    \node[circle, minimum size=6cm, draw, fill=green] (b) {};
    \draw [decorate, decoration={text along path, text =\textarabic{المنزل العربي الكبير يحب الخير} }]
    (150:3.1) arc (150:30:3.1cm);
    %\draw [decorate, decoration={text along path, text =XXXXX YYYYY XXXXX}]
    %(150:3.1) arc (150:30:3.1cm);
    \end{tikzpicture}

\end{document}

enter image description here

3
  • 1
    Side note: you might try the packages unicode-math and libertinus-otf as an alternative to legacy NFSS fonts. Libertinus Math and Amiri were created by the same person, Khaled Hosny, and complement each other very well.
    – Davislor
    Dec 22, 2018 at 20:30
  • Could you show me an example how? Dec 22, 2018 at 20:47
  • 1
    Here’s one: tex.stackexchange.com/questions/453115/…
    – Davislor
    Dec 22, 2018 at 21:29

1 Answer 1

13

Because Arabic is complex, characters are connected to form a word, unlike English and Latin, it can not bend to follow a path easily. To remedy this, you have to break the text into separate words using text format delimiters={|}{|} and activate the font at the begining of the tikzpicture by adding \arabicfont\fontsize{12pt}{20}\selectfont.

\documentclass[tikz, border=5pt, multi]{standalone}
\usepackage{polyglossia}
\usepackage [utf] {arabxetex}
\usepackage{fontspec}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{fourier}
\setmainlanguage[variant=british]{english}
\newfontfamily\arabicfont{Amiri}[Script=Arabic]    
\usetikzlibrary{arrows.meta,calc}
\usepackage{color}
\usepackage{tikz,pgfornament,tikzrput}         % altermundus.com/pages/tkz/tikzrput/
\usetikzlibrary{decorations,decorations.text}  % altermundus.com/pages/tkz/ornament/ 


\begin{document}

    \begin{tikzpicture}\arabicfont\fontsize{12pt}{20}\selectfont

    \node[circle, minimum size=7cm, draw, fill=yellow] (a) {};
    \node[circle, minimum size=6cm, draw, fill=green] (b) {};
    \draw [decorate, decoration={text along path,text format delimiters={|}{|},text={|\textarabic|{الخير} |\textarabic|{يحب} |\textarabic|{الكبير} |\textarabic|{العربي} |\textarabic|{الوطن}},raise=1.5pt}]
    (150:3.1) arc (150:30:3.1cm);
    %\draw [decorate, decoration={text along path, text =XXXXX YYYYY XXXXX}]
    %(150:3.1) arc (150:30:3.1cm);
    \end{tikzpicture}

\end{document}

enter image description here

0

You must log in to answer this question.

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