5

I am using LyX to write a report. The nomenclature is divided in groups. Within the "Roman Symbols" group the entries which start with math are sorted before all the non-math entries. See the image at the end of the question.

For example, the entry below should be sorted with the "R"s.

\nomenclature[R]{$\hat{R}$}{Dis}

Starting with the second to last entry, the sorting works fine. After many correctly sorted entries (not shown in the image), the last two entries (also not shown) are out of place. They should be sorted with the "D"s. They are written below.

\nomenclature[R]{${\Delta}Z_0$}{Lig}

\nomenclature[R]{${\Delta}t$}{Snap}

I have tried the solution here: Make nomenclature sort math correctly

This did not work for me. It might be because I use nomgroups. I do not know. Any ideas? Thanks.

I have written the preamble and the nomenclature entries for the file below. I am rather new to LaTeX so let me know if you need me to post more information.

Preamble:

% Preview source code

%% LyX 2.1.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{color}
\usepackage{babel}
\usepackage{amsmath}
\usepackage[authoryear]{natbib}
\usepackage{nomencl}

% the following is useful when we have the old nomencl.sty package
\providecommand{\printnomenclature}{\printglossary}
\providecommand{\makenomenclature}{\makeglossary}
\makenomenclature
\usepackage[unicode=true,
 bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=3,
 breaklinks=true,pdfborder={0 0 0},backref=false,colorlinks=true]
 {hyperref}
\hypersetup{pdftitle={Title Here},
 pdfauthor={Author Here},
 pdfsubject={Subject Here},
 pdfkeywords={Keywords Here},
 citecolor=blue}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{table}{section}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
}

%For matlab2tex support
\usepackage{alltt}
    \usepackage{color}
    \definecolor{string}{rgb}{0.7,0.0,0.0}
    \definecolor{comment}{rgb}{0.13,0.54,0.13}
    \definecolor{keyword}{rgb}{0.0,0.0,1.0}


%For nomenclature
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\large\bfseries
  \ifstrequal{#1}{A}{Acronyms}{%
  \ifstrequal{#1}{R}{Roman Symbols}{%
  \ifstrequal{#1}{G}{Greek Symbols}{%
  \ifstrequal{#1}{U}{Subscripts}{%
  \ifstrequal{#1}{X}{Other Symbols}{}}}}}]%
  }
\makenomenclature

\makeatother

\begin{document}

Nomenclature Entries:

\printnomenclature{}

%Roman Symbols (Sort as R)

%With math

\nomenclature[R]{$\mathbf{C}$}{DM}

\nomenclature[R]{$\mathbf{A}$}{DM}

\nomenclature[R]{$\tilde{A}$}{DM}

\nomenclature[R]{$\vec{R}$}{Par}

\nomenclature[R]{$\vec{r}$}{Par}

\nomenclature[R]{$\hat{R}$}{Dis}

\nomenclature[R]{$\bar{I}$}{Loc}

\nomenclature[R]{$\left\Vert u_{i}\right\Vert $}{Ve}

\nomenclature[R]{$\overline{v}$}{Ave}

\nomenclature[R]{$\left\Vert \overline{u}_{i}\right\Vert $}{Ave}

\nomenclature[R]{$\overline{u}$}{Aver}

\nomenclature[R]{${\Delta}Z_0$}{Lig}

\nomenclature[R]{${\Delta}t$}{Snap}

%Without Math

\nomenclature[R]{$A$}{DM}

\nomenclature[R]{$a$}{PO}

enter image description here

2 Answers 2

7

Nomenclature package pastes your prefix and entry to form the sorting label. Since $\Delta$ starts with backslash, makeindex sorts the entry \nomenclature[R]{${\Delta}Z_0$}{Lig} as R${\Delta$}, and the entry \nomenclature[R]{$D$}{Letter D} as R$D$. If you want \Delta to be sorted as D, use \nomenclature[R$D$]{${\Delta}Z_0$}{Lig} as well as \nomenclature[R$D$]{$\mathbf{C}$}{DM}, \nomenclature[R$A$]{$\tilde{A}$}{DM} etc.

In general if your math entry does not start with a letter, use R$LETTER$ as prefix.

4
  • Thanks for the quick and accurate response. It worked perfectly. I would up-vote your answer but I don't have enough reputation yet as I just registered this morning. Commented Apr 9, 2015 at 18:21
  • Well, I wrote the first version of this package long ago, so I try to answer questions about it...
    – Boris
    Commented Apr 9, 2015 at 19:13
  • It works very well for Roman symbols. However for sorting alphabetically Greek symbols, it is not evident. Do you have any recommendations?
    – uknown
    Commented Apr 13, 2020 at 13:01
  • Please see section 2.5 of the manual, where Greek letters are discussed in legth
    – Boris
    Commented Apr 13, 2020 at 19:25
0

I want to print in nomenclature this expression $\mathrm{ \bar{v}}$. What should I do since the \nomenclature[R]{$\mathrm{ \bar{v}}$}{mean velocity} does not work

2
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 21, 2022 at 11:47
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
    – MS-SPO
    Commented Jun 21, 2022 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .