3
\documentclass[12pt]{article}

\usepackage{csvsimple,filecontents}
\usepackage{fontspec}
\usepackage[american]{babel}
\usepackage{libertine}
\newfontfamily\arabicfont[Script=Arabic,Scale=2]{Amiri}
\usepackage[fullvoc]{arabluatex}
\usepackage[linguistics]{forest}



\begin{document}

\begin{forest}
[Possessive Construction[possessor[\arb{al-kitAbi}]][possessed[\arb{.A_ayAtu}]]]
\end{forest}

\end{document}

Because Arabic is right-to-left, in the "tree" above, I need to enter the words in the reverse order. That is okay for this short phrase, but potentially error-prone for long sentences. Is there anything I can do such that I will enter the words left-to-right and it will come out right-to-left?

enter image description here

4

This is quite simple to do in forest. It has a reversed key which can be applied to reverse the order of nodes. This can be applied to an entire tree to get the correct written Arabic word order, even if the tree is entered with the spoken Arabic order.

In the following example, I've made a style called written order which will reverse all the nodes in the tree to reflect the written order. The tree can be entered in the spoken order.

Since I'm a syntactician, I've given a reasonably correct tree for the Arabic sentence, showing the trace of the verb movement, but since I don't know the Arabic transliteration system, I've used a kind of ad hoc version. I've added a helper style arabic which wraps the content of terminal nodes in the \arb macro so that you don't have to type it for each word. I've elected to show traces of movement with angle brackets, but showing just the tranliterated form. Thanks to @cfr for help with making the not arb option to make any particular node not Arabic.

% !TEX TS-program = LuaLaTeX

\documentclass{article}
\usepackage[linguistics]{forest}
\usepackage{libertine}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\usepackage[fullvoc]{arabluatex}
\usepackage[margin=1in]{geometry}

\forestset{
  declare boolean={arb}{1},
  arabic/.style={
    where n children={0}{
      tier=word,
      delay={
        if arb={content={\arb{##1}}}{},
      },
    }{}
  },
  written order/.style={for tree=reversed},
}

\newcommand{\trace}[1]{$\langle$#1$\rangle$}
\begin{document}

\begin{forest}arabic
[TP       
    [T [ra'aa] ] 
    [VP
        [DP [D [al]] [NP [N [rajul]]]]
        [V' 
            [V [{\arb[trans]{\trace{ra'aa}}}]]
            [DP [D [al] ] [NP [N [filam]]]]
        ]
    ]
]
\end{forest}
\hfill
\begin{forest}written order,arabic
[TP       
    [T [ra'aa]] 
    [VP
        [DP [D [al]] [NP [N [rajul]]]]
        [V' 
            [V [{\arb[trans]{\trace{ra'aa}}}]]
            [DP [D [al]] [NP [N [filam]]]]
        ]
    ]
]
\end{forest}
\end{document}

output of code

  • So what don't you want to apply what to? Do you not want \arb for something? I have no idea what any of this means, so it is hard to guess. – cfr Apr 29 '18 at 16:20
  • @cfr Thanks, your code does exactly what I want. – Alan Munn Apr 29 '18 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.