1

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}

Here is a photo of the desired output: A centered tree in gb4e

And here is the output I get when bidi is loaded: enter image description here

  • Welcome! I get the same result whether I uncomment the line or not with XeTeX. With LuaTeX, it doesn't work at all and centring seems the least of the issues. – cfr Feb 20 '17 at 0:56
  • I can't reproduce this either. – Alan Munn Feb 20 '17 at 4:35
  • Weird... I had been using XeLaTeX, through TeXShop on a Mac, which has the problem I described. I had never tried LuaLaTeX, but I just tried it and it works with including Arabic or without it. – Aidan Kaplan Feb 20 '17 at 5:31
  • @AidanKaplan As far as I know, the bidi package (which is loaded by polyglossia 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. – Alan Munn Feb 20 '17 at 16:21
  • Hi Aidan! I also can't replicate the effect you're describing with XeLaTeX. – Jason Zentz Feb 20 '17 at 17:00
3

The original poster is my student, so I met with him in person to debug this problem since none of the commenters were able to replicate the issue he reported.

It turns out that the problem is not specific to tikz-qtree or gb4e. It is caused by a bug in older versions of bidi (previously reported here) that interferes with the tikzpicture environment of tikz. With these older versions of bidi, you can see the effect in any list environment, not just gb4e's exe environment.

There are two solutions:

  1. Update bidi to the current version, which no longer has the bug. In general this is what I would recommend, but Aidan has opted not to do this for now because he is nearly finished writing a thesis and doesn't want other things in his setup to break.
  2. Surround the tikzpicture environment in a \makebox{}, as suggested in this answer.

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.