I have a problem regarding the package qtree in combination with the Springer Nature Template. Once I put my paper in this template, the trees appear in a weird shape: the nodes appear separated, the tree image overlaps with the text. Does anyone know the solution to this issue?








\ex. \Tree  [.A \qroof{something here}.DP [.B  C  ]]

` tree image

In the documentation of qtree, it says:

Qtree will not work with journal style X Any number of things could be going wrong, of course, but start by checking if the journal’s style redefines the tabular environment. Qtree makes internal calls to tabular, so this is a frequent source of problems. Usually the style’s writer has saved the original definition of \tabular under a different name, so all you need to do is arrange for the original definition to be restored during the calls to \Tree. You can define \qtreeinithook to carry out the necessary redefinitions. It is called at the beginning of each call to \Tree, with local scope (so that any redefinitions it makes are automatically canceled at the end of the call to \Tree). For example, the JNLE style (nle.sty) saves the standard commands to begin and end a table as \oldtabular and \endoldtabular, respectively, and the replacement macros result in r e a l l y w i d e trees.

The following will restore the original definitions for calls to \Tree only. \def\qtreeinithook{\let\tabular=\oldtabular \let\endtabular=\endoldtabular}

However, I don't know how to find the commands in the style file of the journal to define the qtreeinithook.

  • 4
    You could always use standalone and \includegraphics. Commented Dec 28, 2022 at 19:31
  • It is not clear to me how to combine the standalone class with the class provided by the template. I am not sure if standalone will work with qtree.
    – crealp
    Commented Dec 28, 2022 at 19:43
  • 4
    The idea is to make a separate LaTeX document \documentclass{standalone}\usepackage{qtree}\begin{document}\Tree [your tree here]\end{document}, compile that into a pdf, and then use that pdf in your main document using \documentclass{sn-jnl}\usepackage{graphicx}\usepackage{linguex}\begin{document}\ex. \includegraphics{mytree.pdf}\end{document}.
    – Marijn
    Commented Dec 28, 2022 at 19:55
  • 1
    @Marijn +1 This is the way!
    – DG'
    Commented Dec 28, 2022 at 20:35
  • 1
    Regarding \qtreeinithook: a partial solution is to set \def\qtreeinithook{\singlespacing}, this already reduces the separation between the nodes. However, the spacing is still too big, I have been trying to find which part of sn-jnl.cls Is responsible for this but so far no luck (it doesn't help that the class is 1700+ lines of code...)
    – Marijn
    Commented Dec 28, 2022 at 20:44

1 Answer 1


There are two things going on here. As noted in the comments, the [referee] option of the class loads setspace and sets the spacing to \doublespacing. But the class also redefines \raggedright which results in extra space being inserted above node labels, because the qtree labels are created using the {flushleft} environment (which is defined as a list using \raggedright).

The class should absolutely not have clobbered the kernel definition of \raggedright but since it's almost impossible to get publishers to change their class files, here's a general solution which solves at least part of the underlying problem by fixing the {flushleft} environment itself. This will solve your glossing problem too, since the clgoss4e glossing macros that linguex uses also uses the {flushleft} environment. It will also solve any similar problems with any package that uses the {flushleft} environment.

With the restored definition of {flushleft} we only need to add \singlespacing to the \qtreeinithook macro to make sure that the rest of the tree is single spaced. I've also added some extra space after trees; you can remove this if you don't need it.

% We first create a version of the kernel \raggedright command
  \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
% Now redefine \flushleft to use the original version
% Add \singlespacing to trees
% Add some extra space after the tree 

\ex.\Tree  [.A \qroof{something here}.DP [.B  C  ]]



output of code

  • 2
    I did see the raggedright redefinition, but I didn't realize qtree was using raggedright - thanks for answering, now it doesn't bother me anymore :) The solution would be more robust if the document also loads setspace, because in sn-jnl this is only loaded if the referee option is active (now if you remove referee the MWE will give an undefined control sequence for \singlespacing).
    – Marijn
    Commented Dec 29, 2022 at 9:32
  • 3
    @Marijn Thanks, I've updated the answer, using \providecommand rather than requiring setspace be loaded, which is cleaner. qtree uses the flushleft environment which uses \raggedright. This is really a bad error in the class, since it should not be redefining such relatively low-level commands.
    – Alan Munn
    Commented Dec 29, 2022 at 14:35
  • I also have a problem with a weird indentation in the translation line of the examples generated with the linguex package. I guess the issue is similar to the one found with qtree.
    – crealp
    Commented Dec 30, 2022 at 10:15
  • 1
    @crealp Yes, that's the same problem for sure. I can edit this question with a solution that will solve both problems. But there will continue to be issues with this class because \raggedright is used in all sorts of unexpected places and should absolutely not have been redefined by the class.
    – Alan Munn
    Commented Dec 30, 2022 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .