3

I started using the package qtree to draw (simple) trees with LaTeX This package uses the ! to escape some commands/macros.

I tried framing part of the tree, copy/pasting the example in the documentation, but because of babel, loaded with french option, the ! is not caught and interpreted as a new leaf.

M(not)WE:

\documentclass[a4paper, 12pt, twoside]{report}
\usepackage[french]{babel}    % no problems with [english], [greek, english], [german]
\usepackage{qtree}
\begin{document}
  \Tree [.IP [.NP Roses ] [ [.I^0 are ]
    [.VP t [ [.V^0 turning ] [.NP pink ] ] ].VP !{\qframesubtree} ]]
\end{document}
  • 1
    \shorthandoff{!} before the \Tree and \shorthandon{!} after it. – egreg Jan 20 '15 at 18:23
  • Exactly right as usual, thanks a lot! Is it because in french a spacing is needed before the exclamation mark, hence it must be redefined in babel? (I thought about that but didn't know the shorthandoff/on commands, now I do :) ) Could you make it an answer so I can accept it? – luneart Jan 20 '15 at 18:56
3

You have to disable ! as a shorthand:

\documentclass[a4paper, 12pt, twoside]{report}
\usepackage[french]{babel}    
\usepackage{qtree}
\begin{document}
\shorthandoff{!}
  \Tree [.IP [.NP Roses ] [ [.I^0 are ]
    [.VP t [ [.V^0 turning ] [.NP pink ] ] ].VP !{\qframesubtree} ]]
\shorthandon{!}
\end{document}

enter image description here

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.