The expex
package provides a \nogloss
macro to exempt certain elements from being counted as in the gloss. I've made two bracketing macros to create upright brackets: \lb
creates an upright left bracket, and \rb{XP}
creates an upright right bracket with a label "XP".
Unfortunately, due to the way expex
is written, you can't include the \nogloss
command inside the \lb
and \rb
macros, so they need to be used explicitly.
\documentclass[12pt]{article}
\usepackage{fixltx2e} % This package not needed for > 2015 distributions
\usepackage{expex}
\newcommand{\lb}{\upshape[}
\newcommand{\rb}[1]{\upshape]\textsubscript{#1}}
\begin{document}
\ex
\begingl
\gla \nogloss{\lb} Mon ami \nogloss{\rb{NP}} est \nogloss{\lb} grand \nogloss{\rb{AP}}//
\glb my friend is tall//
\glft `My friend is tall'//
\endgl
\xe
\end{document}

\documentclass{...}
and ending with\end{document}
.