森林包:树连接器出现反转

森林包:树连接器出现反转

对于以下 MWE,我使用 {forest} 包来创建层次结构,但是第二级的节点连接器出现在另一侧,它从远处 LH 上的对面节点出现,而它应该在 RHS 上。我不知道问题是什么。

\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{tikz-qtree}
\usepackage[edges,linguistics]{forest}  

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

\babelfont{rm}{Latin Modern Roman}
\babelfont[arabic]{rm}{amiri}


\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{figure}[!htbp]
\centering
\begin{forest}baseline, for tree={draw,edge=->},forked edges%For tree=draw, is to make the recrangles inclding the words, edge is to change all connectors to arrows
[
اللغة السامية
    [
    سامية شرقية     
        [الآكادية]       
    ]
    [
سامية غربية     
    ]   
[سامية جنوبية]   
]   
\end{forest}
\caption
[اللغة السامية]
{
اللغة السامية
\cite{bbbb}
}
\label{fig:اللغة السامية}
\end{figure}
\clearpage
\restoregeometry
\pagewidth  = \paperwidth
\pageheight = \paperheight
\fancyheadoffset[lh]{0pt}%

\end{document}

结果

在此处输入图片描述

答案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{tikz-qtree}
\usepackage[edges,linguistics]{forest}  

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

\babelfont{rm}{Latin Modern Roman}
\babelfont[arabic]{rm}{amiri}


\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{figure}[!htbp]
\centering
\begin{otherlanguage}{coptic}
\begin{forest}baseline, for tree={draw,edge=->},forked edges%For tree=draw, is to make the recrangles inclding the words, edge is to change all connectors to arrows
[
\foreignlanguage{arabic}{اللغة السامية}
    [
\foreignlanguage{arabic}{سامية شرقية}       
        [
\foreignlanguage{arabic}{الآكادية}      
        ]        
    ]
    [
\foreignlanguage{arabic}{سامية غربية}   
    ]   
[
\foreignlanguage{arabic}{سامية جنوبية}
]    
]   
\end{forest}
\end{otherlanguage}
\caption
[اللغة السامية]
{
اللغة السامية
\cite{bbbb}
}
\label{fig:اللغة السامية}
\end{figure}
\clearpage
\restoregeometry
\pagewidth  = \paperwidth
\pageheight = \paperheight
\fancyheadoffset[lh]{0pt}%

\end{document}

在此处输入图片描述

相关内容