TransWikia.com

Forest package: Tree connector apear reversed

TeX - LaTeX Asked on February 8, 2021

For the following MWE, I am sing the {forest} package to make a hierarchy, however the node connector for the second level apears on the opposite side, it emerges from the opposite node on far LHs while it should be on the RHS. I do not know what is the issue.

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}

result

enter image description here

One Answer

The cause of the issue is the use of arabic language as the main language, and thus write from right to left, upon locally switching to a left to right language, the issue is resolved

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}

enter image description here

Answered by Silva on February 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP