Multiline/language linguistic glosses

I'm trying to typeset a linguistic gloss with at least two languages in it, although I'd like to add more.

Unfortunately, it seems that the gb4e package doesn't support more gloss lines. I've searched the internet and this site, and the most related result I found is Align glosses in more than one language with gb4e

The examples a, b, and c should be spaced as if they were glossed alone. Is is it better to use an alternative way? Maybe some tabbing method? The problem is also that, unlike the answers in the question linked above, I want to still have the possibility to reference the examples using \label and \ref, which is not possible without adding \ex, which in turn gives an error if used like this.

Here's the code (which doesn't work), but it shows what I'd like to be able to do. The information for the gloss is provided.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{expex}
\usepackage{gb4e, cgloss}

\begin{document}

\begin{exe}
\ex\label{par1} % Arabic numbering
\begin{xlist} % the next ones, alphabetic numbering  as usual
\ex\label{par1a} Ho fame, sete, caldo, freddo, sonno\\
\ex\label{par1b} Tengo hambre, sed, calor, frio, sueño\\
\ex\label{par1c} Tenzo gana, sidiu, calore, vrittu, sonnu\\
have.\textsc{1sg} hunger thirst hot cold sleep
I am hungry, thirsty, hot, cold, sleepy’ (lit. ‘I have hunger, thirst, heat, cold, sleep’)
\end{xlist}
\end{exe}

References to \ref{par1a} and \ref{par1c}. But let's not forget \ref{par1b}.
\end{document}

This is only possible to do in gb4e with 2 languages, because gb4e supports at most two lines of gloss plus the example itself. It is possible to do with and arbitrary number of languages with the much more powerful ExPex package.

Since what you are doing is really perverting the glossing mechanism (since you want to have multiple gloss lines with labels as if they are examples) it requires a bit of a hack in either way.

In the code below, I've created a counter for your numbered gloss lines, and a command to display it. This is then used as the first element of each gloss line. There are some minor differences between the gb4e code and the ExPex code, mainly in the way the counter is reset in each environment.

Note that the \numgloss command must be terminated with {} if it is not followed immediately by a \label command otherwise it will be treated as part of the next word and the final gloss will not line up correctly.

gb4eversion

This version is limited to two languages. It uses the same basic technique and the \glll macro to introduce a three line gloss (note the extra l).

\documentclass{article}
\makeatletter\def\new@fontshape{}\makeatother
\usepackage{chngcntr}
\usepackage{gb4e,cgloss}

\newcounter{glossnum}

\newcommand{\numgloss}{\refstepcounter{glossnum}\alph{glossnum}.\space}
\counterwithin{glossnum}{xnumi}
\renewcommand{\theglossnum}{\thexnumi\alph{glossnum}}
\begin{document}

\begin{exe}
\ex\label{ex1}
\glll
\numgloss\label{par1a} Ho fame, sete, caldo, freddo, sonno\\
\numgloss\label{par1b} Tengo hambre, sed, calor, frio, sueño\\
{} have.\textsc{1sg} hunger thirst hot cold sleep\\
\glt I am hungry, thirsty, hot, cold, sleepy’ (lit. ‘I have hunger, thirst, heat, cold, sleep’)
\end{exe}

References to \ref{par1a} and \ref{par1b}.
\begin{exe}
\ex\label{ex2}
\glll
\numgloss\label{par2a} Ho fame, sete, caldo, freddo, sonno\\
\numgloss\label{par2b} Tengo hambre, sed, calor, frio, sueño\\
{} have.\textsc{1sg} hunger thirst hot cold sleep\\
\glt I am hungry, thirsty, hot, cold, sleepy’ (lit. ‘I have hunger, thirst, heat, cold, sleep’)
\end{exe}

References to \ref{par2a} and \ref{par2b}.
\end{document}

ExPex version

Since ExPex allows an arbitrary number of gloss lines, this version has no real limit.

\documentclass{article}
\usepackage{expex}
\newcounter{glossnum}
\newcommand{\numgloss}{\refstepcounter{glossnum}\alph{glossnum}.\space}
\renewcommand{\theglossnum}{\the\excnt\alph{glossnum}}
\begin{document}

\ex[everygla={\setcounter{glossnum}{0}}]\label{ex1}
\begingl
\gla \numgloss\label{par1a} Ho fame, sete, caldo, freddo, sonno//
\glb \numgloss\label{par1b} Tengo hambre, sed, calor, frio, sueño//
\glb \numgloss\label{par1c} Tenzo gana, sidiu, calore, vrittu, sonnu//
\glb  {} have.\textsc{1sg} hunger thirst hot cold sleep//
\glft I am hungry, thirsty, hot, cold, sleepy’ (lit. ‘I have hunger, thirst, heat, cold, sleep’)//
\endgl
\xe
References to \ref{par1a} and \ref{par1c}. But let's not forget \ref{par1b}.

\ex[everygla={\setcounter{glossnum}{0}}]\label{ex2}
\begingl
\gla \numgloss{}\label{par2a} Ho fame, sete, caldo, freddo, sonno//
\glb \numgloss{}\label{par2b} Tengo hambre, sed, calor, frio, sueño//
\glb \numgloss{}\label{par2c} Tenzo gana, sidiu, calore, vrittu, sonnu//
\glb  {} have.\textsc{1sg} hunger thirst hot cold sleep//
\glft `I am hungry, thirsty, hot, cold, sleepy’ (lit. ‘I have hunger, thirst, heat, cold, sleep’)//
\endgl
\xe

References to \ref{par2a} and \ref{par2c}. But let's not forget \ref{par2b}.

\end{document}

• Thanks, your example works even better now. I forgot to upvote you, but I did now. :D However when inserted in the document, I get a ton of errors. I have a question though: how come you use \ex\begingl ... \endgl\xe and not \begin{exe} ... \end{exe}? Jan 5 '16 at 18:38
• @Alenanno ExPex is an entirely different package, with its own syntax and not really usable in conjunction with gb4e. So you can't really mix and match the two. There are ways of making the two work together, but I really don't recommend it. Jan 5 '16 at 20:04