# expex: referring to sentences

Is there a way to be able to refer to the sentence/gloss right before it?

Like this:

Sentence (1) below shows that...

(1) This is a sentence.

When using \getref, this doesn't work:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{expex}

\lingset{aboveglftskip=-.2ex,interpartskip=\baselineskip,everyglb=\footnotesize}

\title{Some \texttt{expex} Linguistic Examples}
\author{LianTze Lim}

\begin{document}

Consider the sentence \getref{test}

\pex<test> %% "main" example needs a tag
\begingl %% Start glosses
\gla \textbf{syá} lu-keníkéni //
\glb \textsc{di}  11firely/11star//
\glft small/tiny firefly/star'//
\endgl
\xe
I can cite the above sentence like this \getref{test} or like this \getfullref{test}.
But if I do that before the sentence, it doesn't work.
\end{document}

• Please don't post links to code (or in this case, links to links to code). Instead edit your question and include the code into the question. In particular, can you show a compilable document that shows what's not working. It's very hard to know what you've tried. – Alan Munn Apr 28 at 3:01

The built-in referencing facilities of ExPex are non-standard with respect to LaTeX, and so they may be more trouble than they are worth. You may just want to use the standard \label{} and \ref{} facilities of LaTeX. This will not allow the fancy part structures that ExPex provides, but for most purposes should be fine.

To allow forward as well as backward reference in ExPex using its tagging system, you need to issue the \gathertags command in your preamble. Then after compiling twice, the forward references will show up. This is explained in section 13.4 of the ExPex documentation.

Here's your document with forward references working. I've also shown how you can also use \label and \ref with ExPex.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{expex}
\gathertags
\lingset{aboveglftskip=-.2ex,interpartskip=\baselineskip,everyglb=\footnotesize}

\begin{document}

Consider the sentence (\getref{test}) or with traditional reference  (\ref{mytest}):

\pex<test> \label{mytest}%% "main" example needs a tag
\begingl %% Start glosses
\gla \textbf{syá} lu-keníkéni //
\glb \textsc{di}  11firely/11star//
\glft small/tiny firefly/star'//
\endgl
\xe
I can cite the above sentence like this (\getref{test}) or like this (\getfullref{test}). Using traditional methods like this (\ref{mytest}).
But if I do that before the sentence, it now works.
\end{document}