ExPex - hide the example number

I'm trying to prevent ExPex glosses from being numbered. I've tried defining the number format to simply be an invisible character, but that fails as it seems that the character X must be present in the format string. Is there another way to hide the number completely?

My attempt:

\ex[exnoformat=\hphantom]
\begingl
\gla Something here//
\glc The gloss//
\glft ‘Something here’//
\endgl
\xe


It's true that you can create an unnumbered example using \begingl...\endgl without a surrounding \ex...\xe. However, you will not get the extra vertical space around it that you would with a numbered example. You also can't pass any example-level style commands to it, and any global commands that you want to apply across all examples (using \lingeveryex or \lingEveryex) won't apply to it.

The expex package provides a command \exdisplay that can be used in place of \ex when you want an unnumbered example that acts like a normal example except it has no number or indent. This is what the documentation says about it on p. 71 (this is kind of buried in a section about plain TeX tables that most LaTeX users wouldn't bother to read):

Like \ex, \exdisplay must be closed by \xe. \exdisplay...\xe is just like \ex...\xe except that an example number is not printed and the horizontal dimensions \numoffset and \textoffset are irrelevant. aboveexskip and belowexskip play the same role, paragraph indentation is cancelled, \lingeveryex and \lingEveryex are executed, and \excnt is advanced.

\noexno is provided in case the user wants to use \exdisplay for something other than a numbered example. It cancels the automatic advancement of \excnt. You can say \exdisplay\noexno or \exdisplay[...]\noexno to cancel \excnt advancement.

Here is an illustration of how this works so you can see the difference between omitting \ex...\xe and using \exdisplay...\xe. You can decide which one fits your needs better.

\documentclass{article}

\usepackage{expex}

\begin{document}

Here's an example without a surrounding \verb|\ex...\xe| environment. Notice the lack of vertical space before and after:

\begingl % this works, but you are missing the vertical space you typically get with \ex
\gla Something here//
\glb The gloss//
\glft Something here'//
\endgl

When you put a normal numbered example using \verb|\ex...\xe| after unnumbered ones that only have \verb|\begingl...\endgl|, the numbers start at the beginning because the \verb|\excnt| count has not been incremented:

\ex % this is (1) and not (2) because the \excnt count does not advance when you use \begingl / \endgl without a surrounding environment
\begingl
\gla Something here//
\glb The gloss//
\glft Something here'//
\endgl
\xe

Here's an unnumbered example with \verb|\exdisplay...\xe|. Notice that the vertical space surrounding the example is maintained.

\exdisplay % includes the spacing above and below a normal \ex, but without the numbered label; it also advances the \excnt, unless you use \noexno
\begingl
\gla Something here//
\glc The gloss//
\glft Something here'//
\endgl
\xe

When you put a normal numbered example using \verb|\ex...\xe| after unnumbered ones that with \verb|\exdisplay...\endgl|, the number may be higher than you expect because the \verb|\excnt| count is incremented by \verb|\exdisplay| unless you put \verb|\noexno| inside the example.

\ex % this is numbered (3) instead of (2) because \exdisplay advanced the \excnt; use \noexno if you want your unnumbered examples to not advance the \excnt count
\begingl
\gla Something here//
\glb The gloss//
\glft Something here'//
\endgl
\xe

\end{document}


• That works much better than my solution, thank you! – Cadel Watson Feb 14 '17 at 0:34

I worked it out - the \ex command is providing the number. It, along with the closing \xe, can simply be omitted and the gloss will be formatted correctly.