I like to create a nomenclature that shows a page number (with \pageref or \hyperlink, etc) pointing to a page elsewhere that I assigned a label. Possibly, this label should be an argument to the nomenclature command.
In a similar question it is possible to add page numbers to nomenclature, but they place the number of the page where \nomenclature itself is located at. While, I need to assign the page myself.
The motivation for this question is that I write all my nomenclatures in one file, say symbols.tex, like
% In symbolds.tex
% We have groups of symbols (here S, and P)
\nomenclature[S,001]{$N$}{Integer}{\ref{numencl:N}}
\nomenclature[P,001]{$M$}{Another integer}{\ref{numencl:M}}
and include them before any chapter starts (\include{symbolds.tex}). This way I can reorder and regroup the entries better in a large document. Later in each chapter, I add anchors (\label) to places where a variable is first defined. I like the nomenclature to know where to find the page number to the labels that are placed forward in the document. Something like
% In symbolds.tex
\nomenclature[S,001]{$N$}{An integer}{\ref{numencl:N}}
% Later in a chapter
The variable $N$ \label{nomencl:N} is ...
Here is an example
% In main.tex
\documentclass{memoir}
\usepackage{lipsum}
% Nomenclature stuff
\usepackage[refpage]{nomencl}
\usepackage[backref=page,pageanchor]{hyperref}
% I am not sure I need the next line, this is from the linked stack exchange page above
\def\pagedeclaration#1{, \dotfill\hyperlink{page.#1}{\nobreakspace#1}}
\makenomenclature
% Grouping symbols
usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{S}{Sets}{%
\ifstrequal{#1}{P}{Symbols}{}}%
]}
% ------------------
\begin{document}
% Some fillers here (title page, abstract, table of content, list of figures, etc.
\frontmatter
\tableofcontents*
\clearpage
\thispagestyle{plain}
\begin{abstract}
\lipsum[1]
\end{abstract}
% Here is the nomenclature
\include{symbols}
\clearpage
\printnomenclature
% Chapters start
\chapter{Introduction}
Let $N$ be an integer \label{nomencl:N} ... and $M$ another integer \label{nomencl:M} defined by ...
\end{document}
I am wondering how I can renew \nomenclature or other related commands, so that it accept \label{nomencl:N}) as an option.
If this is not possible, what is a feasible solution to place a reference to an arbitrary page?


\nomenclaturecan fall back to no 4th option, or perhaps accept a null input{}on the last option. – Sia Oct 18 '19 at 22:16