# Linguex errors: “missing $or } inserted” errors with qtree and glossed examples this is my first question and I'm quite new to this. I have started using the linguex package and it works with all my examples except those including trees (drawn using qtree) or those with glosses. It keeps throwing back about 8 "missing } inserted" and 8 "missing$ inserted" errors per example, and sometimes "missing \endgroup inserted", even though I always leave a blank line after the last example.

Here is a minimal(ish) tree example (I have left in the tree itself as I don't know what element of it might be playing havoc):

\documentclass{article}
\usepackage{qtree}
\usepackage{linguex}
\usepackage{setspace}

\onehalfspacing
\begin{document}

\ex. \Tree [.CPVP \textsc{speaker} [.CPV'1 [.CPV1 \textsc{ask}_i ] [.CPVP2 \textsc{addressee}_j [.CPV'2 [.CPV2 t_i ] [.CP [.AdvP \textsc{pro}_j [.Adv' [.Adv Seriously ] ] ] [\qroof{\ldots}.CP ] ] ] ] ] ]

\end{document}


And here is a glossed example:

\documentclass{article}
\usepackage{linguex}
\usepackage{setspace}

\onehalfspacing
\begin{document}

\exg. ^{?*}This is an ungrammatical sentence\\
{ }This is a lexical gloss\label{label}\\
This is a translation'

\end{document}


The glossed examples do use special characters (they're in French).

I'd be really grateful for any help, thanks!

Both of your problems arise from the fact that you are trying to use math super- and sub-scripts (^ and _) outside of math mode.

Since you have loaded the qtree package, you can make these characters work outside of math mode, by adding the command

\automath


This has some downsides since it can interfere with other packages, sometimes, but many of us use it all the time since it's so convenient.

If you don't want to take this route, you can simply surround the super- and subscripts with $...$:

$^{*}$ and $_{i}$


Alternatively, you can define two subscript and superscript commands:

\usepackage{fixltx2e}
\newcommand{\SB}{\textsubscript}
\newcommand{\SP}{\textsuperscript}


And then use

\SP{i} and \SP{i}


for sub and superscripts, respectively.

By the way, you might want to switch to tikz-qtree (same syntax, more power) and load the tikz-qtree-compat package that comes with it to enable \automath. Also, remember that qtree (and tikz-qtree`) requires whitespace between a terminal and a closing bracket. This is a common source of errors in trees.