Tikz:节点中的阿拉伯语文本被反转且放错位置

Tikz:节点中的阿拉伯语文本被反转且放错位置

下面显示的 MWE,Tikz 图片节点中的文本出现在节点之外,节点绘制正确,但其中的文本在外面,我该如何解决这个问题?此外,有时字母会以相反的顺序输出。我该如何解决此类问题?

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,margin=2.5cm,bindingoffset=0.5cm]{geometry} 
\usepackage{pdflscape}
\usepackage[hidelinks,colorlinks=true,breaklinks,allcolors=blue]{hyperref} 

\usepackage{tikz} 
    \usetikzlibrary{tikzmark,arrows.meta,arrows,positioning,matrix,quotes, shapes.geometric,calc,decorations.pathreplacing}
\usepackage[edges]{forest}  


\begin{filecontents}{babel-cop.ini}
[identification]
charset = utf8
version = 0.1
date = 2019-08-25
name.local = ϯⲙⲉⲧⲣⲉⲙⲛ̀ⲭⲏⲙⲓ
name.english = Coptic
name.babel = coptic
tag.bcp47 = cop
tag.opentype = COP
script.name = Coptic
script.tag.bcp47 = Copt
script.tag.opentype = copt
level = 1
encodings = 
derivate = no
[captions]
[date.gregorian]
[date.islamic]
[time.gregorian]
[typography]
[characters]
[numbers]
[counters]
\end{filecontents}

\usepackage[bidi=basic,layout=lists.tabular]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}
\babelprovide[import=el]{polutonikogreek}
\babelprovide[import=cop]{coptic}

\babelfont{rm}{Latin Modern Roman}
\babelfont[arabic]{rm}{amiri}
\babelfont[english]{rm}{Times New Roman}
\babelfont[polutonikogreek]{rm}[Language=Default]{Palatino Linotype}
\babelfont[coptic]{rm}[Language=Default]{FreeSerifAvvaShenouda}

\usepackage{booktabs}
\usepackage{makecell} 
\usepackage{boldline} 



\usepackage{fancyhdr} 
\usepackage[normalem]{ulem}



\begin{document}

\newgeometry{landscape,margin=2.5cm}
\pagewidth  = \paperwidth
\pageheight = \paperheight
\fancyheadoffset[lh]{0pt}%
%begin Flow chart
%%%%%%%%%%%%%%%%%%%%%%%%%%%Block definition%%%%%%%%%%%%%%%
%start and stop blocks.
\tikzset{startstop/.style={circle, minimum width=1.5cm, minimum height=1cm,text centered, draw=black, fill=black}}

\tikzset{io/.style={trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=1.5cm, minimum height=1cm, text centered, draw=black, none}}

\tikzset{process/.style={rectangle, minimum width=1.5cm, minimum height=1cm, text centered,draw=black, fill=none}}

\tikzset{emph/.style={rectangle, minimum width=1.5cm, minimum height=1cm, text centered, draw=black, fill=none}}

\tikzset{decision/.style={diamond, minimum width=1.5cm, minimum height=1cm, text centered, draw=black, fill=none}}

\tikzset{arrow/.style={thick,->,>=stealth}}
\tikzset{line/.style={thick}}

%%%%%%%%%%%%%%%%Building the flow chart%%%%%%%%%%%%%%%%%

\begin{tikzpicture}[node distance=0.5cm,auto]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node (start) [startstop] {};
%%%%%%%%%%%%%%%%325%%%%%%%%%%%%%%%%%%%
\node (325) [process, left = of start,text width=2cm,align={center}]{ذهب الولد};
\node (325-emph) [process, below = of 325, dashed,text width=2cm] 
{\textbf{جاء الإنسان}
لم ينام
\uline{سعيد}
\foreignlanguage{polutonikogreek}{δφσδφδσ}
};
%%%%%%%%%%%%%%%%325%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%arrows%%%%%%%%%%%%%%%%%%%

\draw [arrow] (start) -- (325);
\draw [line,dashed] (325) -- (325-emph);
%\draw [arrow] (325) -- (381);


\end{tikzpicture}

%\end{sidewaysfigure}
%\end{landscape}

\clearpage
\restoregeometry
\pagewidth  = \paperwidth
\pageheight = \paperheight
\fancyheadoffset[lh]{0pt}%


结果

答案1

导致该问题的原因是使用阿拉伯语作为主要语言,因此从右向左书写,在本地切换到从左向右的语言后,该问题得到解决

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,margin=2.5cm,bindingoffset=0.5cm]{geometry} 
\usepackage{pdflscape}
\usepackage[hidelinks,colorlinks=true,breaklinks,allcolors=blue]{hyperref} 

\usepackage{tikz} 
    \usetikzlibrary{tikzmark,arrows.meta,arrows,positioning,matrix,quotes, shapes.geometric,calc,decorations.pathreplacing}
\usepackage[edges]{forest}  


\begin{filecontents}{babel-cop.ini}
[identification]
charset = utf8
version = 0.1
date = 2019-08-25
name.local = ϯⲙⲉⲧⲣⲉⲙⲛ̀ⲭⲏⲙⲓ
name.english = Coptic
name.babel = coptic
tag.bcp47 = cop
tag.opentype = COP
script.name = Coptic
script.tag.bcp47 = Copt
script.tag.opentype = copt
level = 1
encodings = 
derivate = no
[captions]
[date.gregorian]
[date.islamic]
[time.gregorian]
[typography]
[characters]
[numbers]
[counters]
\end{filecontents}

\usepackage[bidi=basic,layout=lists.tabular]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}
\babelprovide[import=el]{polutonikogreek}
\babelprovide[import=cop]{coptic}

\babelfont{rm}{Latin Modern Roman}
\babelfont[arabic]{rm}{amiri}
\babelfont[english]{rm}{Times New Roman}
\babelfont[polutonikogreek]{rm}[Language=Default]{Palatino Linotype}
\babelfont[coptic]{rm}[Language=Default]{FreeSerifAvvaShenouda}

\usepackage{booktabs}
\usepackage{makecell} 
\usepackage{boldline} 



\usepackage{fancyhdr} 
\usepackage[normalem]{ulem}



\begin{document}

\newgeometry{landscape,margin=2.5cm}
\pagewidth  = \paperwidth
\pageheight = \paperheight
\fancyheadoffset[lh]{0pt}%
%begin Flow chart
%%%%%%%%%%%%%%%%%%%%%%%%%%%Block definition%%%%%%%%%%%%%%%
%start and stop blocks.
\tikzset{startstop/.style={circle, minimum width=1.5cm, minimum height=1cm,text centered, draw=black, fill=black}}

\tikzset{io/.style={trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=1.5cm, minimum height=1cm, text centered, draw=black, none}}

\tikzset{process/.style={rectangle, minimum width=1.5cm, minimum height=1cm, text centered,draw=black, fill=none}}

\tikzset{emph/.style={rectangle, minimum width=1.5cm, minimum height=1cm, text centered, draw=black, fill=none}}

\tikzset{decision/.style={diamond, minimum width=1.5cm, minimum height=1cm, text centered, draw=black, fill=none}}

\tikzset{arrow/.style={thick,->,>=stealth}}
\tikzset{line/.style={thick}}

%%%%%%%%%%%%%%%%Building the flow chart%%%%%%%%%%%%%%%%%
\begin{otherlanguage}{coptic}
\begin{tikzpicture}[node distance=0.5cm,auto]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node (start) [startstop] {};
%%%%%%%%%%%%%%%%325%%%%%%%%%%%%%%%%%%%
\node (325) [process, left = of start,text width=2cm,align={center}]{\foreignlanguage{arabic}{ذهب الولد}};
\node (325-emph) [process, below = of 325, dashed,text width=2cm] 
{\foreignlanguage{arabic}{\textbf{جاء الإنسان}
لم ينام
\uline{سعيد}}
\foreignlanguage{polutonikogreek}{δφσδφδσ}
};
%%%%%%%%%%%%%%%%325%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%arrows%%%%%%%%%%%%%%%%%%%

\draw [arrow] (start) -- (325);
\draw [line,dashed] (325) -- (325-emph);
%\draw [arrow] (325) -- (381);


\end{tikzpicture}
\end{otherlanguage}
%\end{sidewaysfigure}
%\end{landscape}

\clearpage
\restoregeometry
\pagewidth  = \paperwidth
\pageheight = \paperheight
\fancyheadoffset[lh]{0pt}%


在此处输入图片描述

相关内容