0

I would like to be able to define equations (or other things), for which I am able to list the locations, where this equation/thing is referenced throughout the document. To this end I define a dedicated glossary which contains all the labeled things and I create a reference to the glossary entry everytime I reference the thing. All this seems to work fine, as one can see in the provided MWE. What does not work yet, is to put below each equation the links to its references seperately, since everything is collected in the index at the end.

How can I just pick one entry from the glossary index and put it below the equation?

\documentclass{article}

\usepackage{blindtext}
\usepackage{hyperref}
\usepackage[automake,nomain]{glossaries-extra}
\usepackage{cleveref}

\newglossary[clg]{citations}{cld}{cln}{Citations}
\newcommand{\myequation}[2]{
  \newglossaryentry{#1-ref}{
    type=citations,
    name={References of \cref{#1}},
    description={}
  }
  \begin{equation}\label{#1}
  #2
  \end{equation}
}

\newcommand{\mycref}[1]{
  \glsadd[]{#1-ref}
  \cref{#1}
  \glsadd[]{#1-ref}
}

\makeglossaries

\begin{document}
\section{hihi}
\blindtext
\myequation{linear}{
A \cdot x = b
}

Citations of \cref{linear}: \dots

\Blindtext
See \mycref{linear}.
\blindtext
\section{haha}
\blindtext
\printglossary[type=citations]
\end{document}

EDIT: I would also be happy about a solution that does not use glossaries, but still acomplishes my task.

1
  • Is bumping allowed? – Labello Apr 9 '20 at 6:50
3
+100

The \glsentrynumberlist command does that, combined with the savenumberlist option:

  • change \usepackage[automake,nomain]{glossaries-extra} to

\usepackage[automake,nomain,savenumberlist]{glossaries-extra}
  • Add this line at the end of the definition of \myequation:

\glsentryname{#1-ref}: \glsentrynumberlist{#1-ref}

and it does the job after two compilations. See p.157 of the User Manual for glossaries for more details.

1
  • Dang! Thank you! – Labello Apr 11 '20 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.