此示例将打印以下组:物理常数、数字集、其他符号。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{nomencl}
\makenomenclature
%% This will add the subgroups
%----------------------------------------------
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{A}{Physics Constants}{%
\ifstrequal{#1}{B}{Number Sets}{%
\ifstrequal{#1}{C}{Other Symbols}{}}}%
]}
%----------------------------------------------
%% This will add the units
%----------------------------------------------
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}}
%----------------------------------------------
\title{Nomenclatures Example}
\author{ShareLaTeX Team}
\date{\today}
\begin{document}
\maketitle
This is an example to show how the \textbf{Nomenclature} package works:
\clearpage
\mbox{}
\nomenclature[A, 02]{$c$}{Speed of light in a vacuum inertial system
\nomunit{$299,792,458\, m/s$}}
\nomenclature[A, 03]{$h$}{Plank Constant
\nomunit{$6.62607 \times 10^{-34}\, Js$}}
\nomenclature[A, 01]{$g$}{Gravitational Constant
\nomunit{$6.67384 \times 10^{-11}\, N \cdot m^2/kg^2$}}
\nomenclature[B, 03]{$\mathbb{R}$}{Real Numbers}
\nomenclature[B, 02]{$\mathbb{C}$}{Complex Numbers}
\nomenclature[B, 01]{$\mathbb{H}$}{Quaternions}
\nomenclature[C]{$V$}{Constant Volume}
\nomenclature[C]{$\rho$}{Friction Index}
\printnomenclature
\end{document}
但是如何将顺序改为:数字集、物理常数、其他符号?
答案1
您只需修改重新定义即可\nomgroup
成为
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{B}{Physics Constants}{%
\ifstrequal{#1}{A}{Number Sets}{%
\ifstrequal{#1}{C}{Other Symbols}{}}}%
]}