我想要使用 tikz 图片创建一个包含波斯语单词的循环流(对于波斯语,需要使用 xepersian 包和 xelatex 编译器),但是 latex 会使波斯语单词的字符分开。我该如何修复它?
\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{xepersian}
\settextfont{XB Niloofar}
\newcommand{\arcarrow}[8]% inner radius, middle radius, outer radius, start angle, end angle, tip protusion angle, options, text
{ \pgfmathsetmacro{\rin}{#1}
\pgfmathsetmacro{\rmid}{#2}
\pgfmathsetmacro{\rout}{#3}
\pgfmathsetmacro{\astart}{#4}
\pgfmathsetmacro{\aend}{#5}
\pgfmathsetmacro{\atip}{#6}
\fill[#7] (\astart:\rin) arc (\astart:\aend:\rin) -- (\aend+\atip:\rmid) -- (\aend:\rout) arc (\aend:\astart:\rout) -- (\astart+\atip:\rmid) -- cycle;
\path[decoration={text along path, text={#8}, text align={align=center}, raise=-0.5ex},decorate] (\astart+\atip:\rmid) arc (\astart+\atip:\aend+\atip:\rmid);
}
\begin{document}
\begin{tikzpicture}
\fill[even odd rule,lime!30] circle (3.8) circle (3.2);
\arcarrow{3}{3.5}{4}{0}{118}{5}{magenta,draw=red!50!black,very thick}{کاهش ارزش آورده}
\arcarrow{3}{3.5}{4}{120}{238}{5}{green,draw=red!50!black,very thick}{{کاهش ارزش آورده}}
\arcarrow{3}{3.5}{4}{240}{358}{5}{cyan,draw=red!50!black,very thick}{{کاهش ارزش آورده}}
\end{tikzpicture}
\end{document}
答案1
下面的代码可以解决问题(参见关联)。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{xepersian}
\settextfont{XB Niloofar}
\newcommand{\arcarrow}[8]% inner radius, middle radius, outer radius, start angle, end angle, tip protusion angle, options, text
{ \pgfmathsetmacro{\rin}{#1}
\pgfmathsetmacro{\rmid}{#2}
\pgfmathsetmacro{\rout}{#3}
\pgfmathsetmacro{\astart}{#4}
\pgfmathsetmacro{\aend}{#5}
\pgfmathsetmacro{\atip}{#6}
\fill[#7] (\astart:\rin) arc (\astart:\aend:\rin) -- (\aend+\atip:\rmid) -- (\aend:\rout) arc (\aend:\astart:\rout) -- (\astart+\atip:\rmid) -- cycle;
\path[decoration={text effects along path, text align=center,
text={#8},
text effects/.cd,
group letters,
reverse text,
characters={text along path,},
text effects={align=center},
},
decorate] (\astart+\atip:\rmid) arc (\astart+\atip:\aend+\atip:\rmid);
}
\begin{document}
\begin{tikzpicture}
\fill[even odd rule,lime!30] circle (3.8) circle (3.2);
\arcarrow{3}{3.5}{4}{0}{118}{5}{magenta,draw=red!50!black,very thick}{کاهش ارزش آورده}
\arcarrow{3}{3.5}{4}{120}{238}{5}{green,draw=red!50!black,very thick}{کاهش ارزش آورده}
\arcarrow{3}{3.5}{4}{240}{358}{5}{cyan,draw=red!50!black,very thick}{کاهش ارزش آورده}
\end{tikzpicture}
\end{document}