5

List of symbols with page numbers based on symbol position

I'm using the code below to create a list of symbols consisting of the symbol, description, and page number. The problem is that the page number displayed is the number where the list appears, and it doesn't show the actual page numbers based on the symbol position, as shown in the attached image.

\documentclass[12pt,a4paper]{report}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage{nomencl}
\usepackage{fancyhdr}
\usepackage{etoolbox}
\usepackage{setspace}
\usepackage{amsmath,amssymb}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}

%---------------------------------
%---------------------------------
\makenomenclature
\renewcommand{\nomname}{\centering\Large\bfseries List of Symbols}
\setlength{\nomitemsep}{1\parsep}

\newlength{\symbolwidth}
\setlength{\symbolwidth}{3.2cm} 
\renewcommand{\nomlabel}[1]{\makebox[\symbolwidth][l]{#1} --- }
\renewcommand{\nomentryend}{\dotfill\makebox[2em][r]{\thepage}}
\patchcmd{\thenomenclature}{\section*{\nomname}}{%
  \chapter*{\nomname}%
  \addcontentsline{toc}{chapter}{List of Symbols}%
  \markboth{List of Symbols}{List of Symbols}}{}{}

\begin{document}

\chapter*{Abstract}

\printnomenclature

\chapter{Introduction}
Example, $\lambda 1$ \nomenclature{$\lambda 1$}{example 1}


\chapter{Ex 2}
Example, $\lambda 2$ \nomenclature{$\lambda 2$}{example 2}

\chapter{Ex 3}
Example, $\lambda 3$ \nomenclature{$\lambda 3$}{example 3}

\end{document}

enter image description here

I use build.bat

@echo off
set FNAME=min

echo 1) Running pdflatex (1st pass)...
pdflatex -interaction=nonstopmode %FNAME%.tex

echo.
echo 2) Running makeindex for nomenclature...
makeindex %FNAME%.nlo -s nomencl.ist -o %FNAME%.nls

echo.
echo 3) Running pdflatex (2nd pass)...
pdflatex -interaction=nonstopmode %FNAME%.tex

echo.
echo Done. Check %FNAME%.pdf
pause

What is the problem with the correct page number not appearing? Please help.

1
  • I wonder if the Glossary package would help here. Commented 11 hours ago

1 Answer 1

3

\thepage refers to the current page.

You want to use the package option \refpage and to redefine \pagedeclaration.

\documentclass[12pt,a4paper]{report}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage[refpage]{nomencl}
\usepackage{fancyhdr}
\usepackage{etoolbox}
\usepackage{setspace}
\usepackage{amsmath,amssymb}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}

%---------------------------------
%---------------------------------
\makenomenclature
\renewcommand{\nomname}{\centering\Large\bfseries List of Symbols}
\setlength{\nomitemsep}{1\parsep}

\newlength{\symbolwidth}
\setlength{\symbolwidth}{3.2cm}
\renewcommand{\nomlabel}[1]{\makebox[\symbolwidth][l]{#1} --- }
\renewcommand{\pagedeclaration}[1]{\dotfill\makebox[2em][r]{#1}}
\patchcmd{\thenomenclature}{\section*{\nomname}}{%
  \chapter*{\nomname}%
  \addcontentsline{toc}{chapter}{List of Symbols}%
  \markboth{List of Symbols}{List of Symbols}}{}{}

\begin{document}

\chapter*{Abstract}

\printnomenclature

\chapter{Introduction}
Example, $\lambda 1$ \nomenclature{$\lambda 1$}{example 1}


\chapter{Ex 2}
Example, $\lambda 2$ \nomenclature{$\lambda 2$}{example 2}

\chapter{Ex 3}
Example, $\lambda 3$ \nomenclature{$\lambda 3$}{example 3}

\end{document}

output

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.