Writing linguistic texts one often just refers to the preceeding or following example. Usually one does not need labels for this. I would like the (\mex{1}) references to behave more like references using labels and make them hyperlinked like \ref is in connection with hyperref. Is this possible? Right now, the makro \mex does not take the enumerated examples into account. So a, b, and c are not part of the referencing. I just write them down by hand. Is there a clever way to integrated reference to subexamples?
\documentclass{article}
\usepackage{langsci-gb4e}
\makeatletter
\newcommand{\mex}[1]{\the\numexpr\c@equation+#1\relax}
\makeatother
\begin{document}
This is some text referring to example (\mex{1}):
\ea
Test examples are always fun!
\z
As the existance of examples like (\mex{0}) shows.
There are even more complicated cases with enummerations of examples:
\eal
\ex This is the first example.
\ex This is the second example.
\zl
The example in (\mex{0}a) is similar to the one in (\mex{0}b).
\end{document}
\mexcommand to do? Refer to last/current item in last/current list? – Cicada May 17 '20 at 15:10\mex. – Stefan Müller May 18 '20 at 12:37