I write a document with mixed languages having different writing direction. The main language is in left to right direction. I want to write a tree diagram in another language having right to left direction.
Firstly I try this:
\documentclass[a4paper,12pt,fleqn]{article}
\usepackage[no-math,quiet]{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
\usepackage{tikz}
\usepackage[quiet]{polyglossia}
\setmainlanguage{bahasai} % Indonesian Language, Left to Right Direction
\setotherlanguage{arabic} % Arabic Language, Right to Left Direction
\begin{document}
\begin{Arabic}
لَاحِظِ الصُّوۡرَةَ الشَّجَرِيَّةَ التَّالِيَةَ:
\end{Arabic}
\begin{Arabic}
\begin{tikzpicture}
[parent anchor=west,child anchor=east,grow=west,
sibling distance=15mm, level distance=35mm
]
\node {الۡأَصۡلُ}
child {node {الۡفَرۡعُ الۡأَوَّلُ}}
child {node {الۡفَرۡعُ الثَّانِيۡ}
child {node {فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الۡأَوَّلُ}}
child {node {فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الثَّانِيۡ}}
};
\end{tikzpicture}
\end{Arabic}
\end{document}
and I get the text displayed in incorrect direction and the tikzpicture displayed in left to right direction.

Secondly I try this
\documentclass[a4paper,12pt,fleqn]{article}
\usepackage[no-math,quiet]{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
\usepackage{tikz}
\usepackage[quiet]{polyglossia}
\setmainlanguage{bahasai} % Indonesian Language, Left to Right Direction
\setotherlanguage{arabic} % Arabic Language, Right to Left Direction
\begin{document}
\begin{Arabic}
لَاحِظِ الصُّوۡرَةَ الشَّجَرِيَّةَ التَّالِيَةَ:
\end{Arabic}
\begin{tikzpicture}
[parent anchor=west,child anchor=east,grow=west,
sibling distance=15mm, level distance=35mm
]
\begin{Arabic}
\node {الۡأَصۡلُ}
child {node {الۡفَرۡعُ الۡأَوَّلُ}}
child {node {الۡفَرۡعُ الثَّانِيۡ}
child {node {فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الۡأَوَّلُ}}
child {node {فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الثَّانِيۡ}}
};
\end{Arabic}
\end{tikzpicture}
\end{document}
and I get the same result as above.
Thirdly I try this
\documentclass[a4paper,12pt,fleqn]{article}
\usepackage[no-math,quiet]{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
\usepackage{tikz}
\usepackage[quiet]{polyglossia}
\setmainlanguage{bahasai} % Indonesian Language, Left to Right Direction
\setotherlanguage{arabic} % Arabic Language, Right to Left Direction
\begin{document}
\begin{Arabic}
لَاحِظِ الصُّوۡرَةَ الشَّجَرِيَّةَ التَّالِيَةَ:
\end{Arabic}
\begin{Arabic}
\begin{tikzpicture}
[parent anchor=west,child anchor=east,grow=west,
sibling distance=15mm, level distance=35mm
]
\node {\RL{الۡأَصۡلُ}}
child {node {\RL{الۡفَرۡعُ الۡأَوَّلُ}}}
child {node {\RL{الۡفَرۡعُ الثَّانِيۡ}}
child {node {\RL{فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الۡأَوَّلُ}}}
child {node {\RL{فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الثَّانِيۡ}}}
};
\end{tikzpicture}
\end{Arabic}
\end{document}
I get the text displayed in correct direction but the tikzpicture is still displayed in left to right direction.

Lastly I try just for a testing to change the default language the language with Right to Left Direction:
\documentclass[a4paper,12pt,fleqn]{article}
\usepackage[no-math,quiet]{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
\usepackage{tikz}
\usepackage[quiet]{polyglossia}
\setmainlanguage{arabic} % Arabic Language, Right to Left Direction
\setotherlanguage{bahasai} % Indonesian Language, Left to Right Direction
\begin{document}
لَاحِظِ الصُّوۡرَةَ الشَّجَرِيَّةَ التَّالِيَةَ:
\begin{tikzpicture}
[parent anchor=west,child anchor=east,grow=west,
sibling distance=15mm, level distance=35mm
]
\node {الۡأَصۡلُ}
child {node {الۡفَرۡعُ الۡأَوَّلُ}}
child {node {الۡفَرۡعُ الثَّانِيۡ}
child {node {فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الۡأَوَّلُ}}
child {node {فَرۡعُ الۡفَرۡعِ الۡأَوَّلِ الثَّانِيۡ}}
};
\end{tikzpicture}
\end{document}
and I get surprisedly the text and the tikzpicture environment both are displayed incorectly similar with the result of the first and second testing.
Is there any solution so I can get both of the text and the tikzpicture environment displayed in Right to Left Direction? Thanks.
\begin{tikzpicture}[xscale=-1] ... \end{tikzpicture}. – AlexG Oct 27 '15 at 11:11