# \autoref and linguex

I use the linguex package for linguistics examples, and I'd like to be able to refer to the examples with the \autoref command. This works great for examples with labels:

\ex. \label{example} Hi.


In \autoref{example}, I wrote an example.

In a very long piece of work, I've primarily been referring to examples using \Next and \Last, rather than labels. Is there a simple way to link the \Next and \Last references using linguex and the hyperref package? Thank you!

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Herr K. Feb 5 '15 at 22:11

The counter is ExNo, then the name for \autoref can be defined the following way:

\newcommand*{\ExNoautorefname}{Example}


\Next and friends call \printExNo to print the example number, thus it can be redefined to add the anchor (assuming default options of hyperref regarding links):

\makeatletter
\renewcommand{\printExNo}{%
\@ifnextchar[{\complexExNo}{%

• @Teresa Unhappily this is much more complicate, because also the anchor setting need to be changed to get better anchor names for \autoref. Thus it would be more or less a rewrite of the package linguex. – Heiko Oberdiek Feb 25 '15 at 14:46