6

When I try to cross-reference with \ref to gb4e's cross-references with primes (\exp) I fail.

Consider the following example:

\documentclass{article}

\usepackage{gb4e}

\begin{document}

\begin{exe}
  \ex\label{ex:1}Example one.
\end{exe}
Reference \ref{ex:1}.
\begin{exe}
  \exp{ex:1}\label{ex:2}Example two.
\end{exe}
Reference \ref{ex:2}.

\end{document}

Which gives the following output:

Output of the example

Why does not \ref{ex:2} produce a cross-reference? Am I doing something wrong?

3
  • Maybe I am better off in trying to come up with something similar with enumitem?
    – N.N.
    May 7, 2012 at 14:48
  • As far as I understand the documentation exp is not meant for creating a new item, so there's nothing to reference. The same is valid for \exr btw. So using enumitem might be a good idea.
    – Martin
    May 7, 2012 at 15:12
  • 3
    There's a very simple solution: don't use primes for example numbers, they're evil. ;-)
    – Alan Munn
    May 7, 2012 at 16:53

2 Answers 2

8

The \exp command uses the \exi command underlyingly, and this latter command is designed for arbitrarily specified example numbers, so the regular counter system won't work (except that the argument to \exp is a label.)

Personally I think that primed example numbers are not a good idea, so I would advise against doing this. See below for some discussion. However, if you insist, you could create a \primeref command that would refer to a primed example using the label of the original non-primed example:

\newcommand*{\primeref}[1]{\ref{#1}$'$}

Then in your document you would have a label for the original unprimed example, and use \exp{<label>} and \primeref{<label>} to introduce and refer to the primed examples.

Why primed examples are bad (for linguistics)

Although there may be some justification for primed equation numbers in math, I don't think there are equivalently good justifications for their use in linguistics, and certainly not for linguistic examples (as opposed to e.g. semantic formulas that are being developed piecewise.) The only purpose to use a primed example I would think would be to show an alternative version of something that was essentially the same. But this is not really correct for linguistic examples, which, even if they differ minimally from each other, are not really the same ever.

3
  • Thanks for your answer. Your answer would be even better if you include some argument for why they are bad and some notes on how to do without them.
    – N.N.
    May 7, 2012 at 17:21
  • It took me a while to understand that in the \primeref{} you use the label of the unprimed example and it will "magically" refer to the primed example. The primed example itself doesnt have a \label{}. Just in case anybody else faces the same problem.
    – Philip
    Oct 21, 2015 at 8:45
  • If an example is described in the paper as somehow derived from another one (morphologically, syntactically, historically, ...), then I think that a primed label <i>is</i> a good idea. As for doing without them: use a (sub)sublist with only the parallel examples inside it.
    – benjamin
    Jun 27, 2019 at 6:30
4

This should work. But while "primed" equation numbers can be justified in math papers, I'm with Alan Munn in discouraging "primed example numbers".

\documentclass{article}
\usepackage{gb4e,refcount}
\makeatletter
\def\new@exp#1{\exi{{(\ref {#1}$'$)}}\edef\@currentlabel{\getrefnumber{#1}$\noexpand'$}}
\AtBeginDocument{\let\exp\new@exp}
\makeatother

\begin{document}

\begin{exe}
  \ex\label{ex:1}Example one.
\end{exe}
Reference \ref{ex:1}.
\begin{exe}
  \exp{ex:1}\label{ex:2}Example two.
\end{exe}
Reference \ref{ex:2}.

\end{document}

It requires a couple of LaTeX runs to stabilize.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .