I am using tikz-qtree
to draw syntax trees that go inside of gb4e
examples.
I was very happy that I was able to get them to center by following this answer: Centering trees
However, I then decided that I wanted to use some Arabic text in my paper, so I loaded Arabic as the other language via polyglossia
. Suddenly, none of my trees were centered. I'm guessing that the problem has something to do with loading bidi
, which polyglossia
does when you add a right-to-left language, but I'm not sure how to get around it.
Here is a MWE:
\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{polyglossia}
\setmainlanguage{english}
% Uncomment the following line to see the problem behavior:
%\setotherlanguage{arabic}
\usepackage{gb4e}
\begin{document}
Here is an example tree that I want to be centered.
\begin{exe}
\ex
\hfil
\begin{tikzpicture}[baseline]
\Tree [.DP
[.D the ]
[.NP [.N center ] ] ]
\end{tikzpicture}
\hfil
\end{exe}
\end{document}
bidi
package (which is loaded bypolyglossia
if you select an RTL language like Arabic or Hebrew) is for use with XeLaTeX only, not LuaLaTeX, and so if your document requires Arabic, you should not use LuaLaTeX. And your sample document works fine with XeLaTeX for me.