# tikz: Right to left text within text along path

I have this example to write text along path using decorations.text library, and I want to insert arabic text starting from right to left

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{fontspec}
\usepackage[rldocument]{bidi}

\setmainfont[Script=Arabic]{Amiri}

\tikzset{decoration={text along path,
text={Very very long text I need to show it from right to left}}}

\begin{document}

\begin{tikzpicture}
\path [decorate] (0,0)..controls +(45:4cm) and +(225:4cm)..(8,0);
\end{tikzpicture}

\end{document}


My hope is to show the text along path from right to left in like manner

left to right from it show to need I text long very Very

• the pgf manual has an entry /pgf/decoration/text effects/reverse text on page 602. It might help. – Denis Jan 17 '18 at 13:24

As it has been mentioned already, the reverse text effect described in the TikZ manual is what you are looking for.

However, you also want to first group the letters using the group letters effect, otherwise it reverses every single letter.

Note that the order of both keys is important, in the example I provide below I wrote both orders to showcase the difference.

EDIT: Forgot to slope the text to follow the path. Using characters={text along path} you make sure that the text is sloped with the path.

\documentclass[border=5mm]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\tikzset{
decoration={
text effects along path,
text={Very very long text I need to show it from right to left}
}
}

\begin{document}

\subsection*{Group letters, reverse text}
\begin{tikzpicture}
\path [
decorate,
decoration= {
text effects/.cd,
group letters,
reverse text,
characters={text along path}
}] (0,0)..controls +(45:4cm) and +(225:4cm)..(8,0);
\end{tikzpicture}

\subsection*{Reverse text, group letters}
\begin{tikzpicture}
\path [
decorate,
decoration= {
text effects/.cd,
reverse text,
group letters,
characters={text along path}
}] (0,0)..controls +(45:4cm) and +(225:4cm)..(8,0);
\end{tikzpicture}

\end{document}


• Can you also demonstrate with actual RTL language characters? – percusse Jan 17 '18 at 14:01
• There's a chance that the OP will want it right aligned along the path. You could add text align=right if this is desired. – David Purton Jan 17 '18 at 14:02
• @Percusse, can you provide a text you want to use? I couldn't use xelatex with the arabic fonts on the question, since I don't have those fonts. – Alex Recuenco Jan 17 '18 at 14:11
• Thanks for the answer that's what I need group letters then reverse text. – Salim Bou Jan 17 '18 at 14:11