[Tex/LaTex] Nomenclature sorting: Sort by Number

nomenclaturesorting

How would I use the Nomenclature to display a list of symbols sorted by the page number rather than symbol letter.

The code below was used to generate this List of Notations. However, I am trying to figure out how to sort by page number instead.

enter image description here

===

\documentclass[11pt,oneside,a4paper,onecolumn]{article}  
\usepackage[left=1.5in,top=1.25in,bottom=1.25in,right=1.25in,papersize={8.50in,11.00in}]{geometry} % Sets the proper margins.
\usepackage{amsmath, amssymb, amsthm,mathtools} % AMS packages
\usepackage{hyperref}
\usepackage{appendix}
\usepackage[refpage]{nomencl}
\renewcommand{\nomname}{List of Notations}
\renewcommand*{\pagedeclaration}[1]{\unskip\dotfill\hyperpage{#1}}
\makenomenclature

\usepackage{makeidx}
\makeindex

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Begin List of Notation Page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\phantomsection % Create a phantom section such that the 'List of Notation' may be properly added to the table of contents.
\addcontentsline{toc}{section}{List of Notation} 
\printnomenclature[1.5cm] % This command automatically generates the list of tables based on tables in the document.
\pagebreak[4]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% End List of Notation Page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\begin{equation*}
F=ma
\end{equation*}

$\nomenclature{$F$}{Force}
$\nomenclature{$a$}{Acceleration}

\pagebreak[4]

\begin{equation*}
E=MC^2
\end{equation*}

$\nomenclature{$E$}{Energy}
$\nomenclature{$M$}{Mass}
$\nomenclature{$c$}{Speed of Light}

\end{document}

Best Answer

Not to contradict egreg (this is still an odd request), but since you asked, you can add an optional sort key to the nomenclature entries. Normally this is used for a few sort categories (uppercase Greek versus lowercase Greek versus acronyms versus ...), but you can make the page number the sort prefix:

\documentclass[11pt,oneside,a4paper,onecolumn]{article}  
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage[refpage]{nomencl}
\renewcommand{\nomname}{List of Notations}
\renewcommand*{\pagedeclaration}[1]{\unskip\dotfill\hyperpage{#1}}
\makenomenclature
\usepackage{lipsum}
\makeatletter
\newcommand{\nomentry}[2]{% to sort by pages
  \nomenclature[\two@digits{\value{page}}]{#1}{#2}%
} % Ref: https://tex.stackexchange.com/questions/30930/how-to-output-a-counter-with-leading-zeros
%\newcommand{\nomentry}[2]{% to sort normally
%  \nomenclature{#1}{#2}%
%}
\makeatother
\begin{document}
\printnomenclature[1.5cm]
\clearpage

\begin{equation*}
F=ma
\end{equation*}

\nomentry{$F$}{Force}
\nomentry{$a$}{Acceleration}

\clearpage

\begin{equation*}
E=MC^2
\end{equation*}

\nomentry{$E$}{Energy}
\nomentry{$M$}{Mass}
\nomentry{$c$}{Speed of Light}

\lipsum
\lipsum
\lipsum
\lipsum
\lipsum
\lipsum
\lipsum
\lipsum

Also, in some cases, \(m\ddot{x} + + k x = 0\)
\nomentry{$m$}{Mass (also)}
\nomentry{$k$}{Spring Stiffness}
\nomentry{$x$}{Displacement}
\end{document}

enter image description here

This has a limitation of not sorting properly past 99 pages, and you'll still be sorting each page by case-sensitive alphabet, rather than sequentially. I expect there's some way to integrate fmtcount with an arbitrary amount of zero-padding to fix the page limitation, but I've not figured that out yet.