命名法标签中的新行与 \nomgroup 冲突

命名法标签中的新行与 \nomgroup 冲突

按照给出的解决方案 术语中的新行

我在用

\renewcommand{\nomlabel}[1]{\smash{\parbox[t]{1.5cm}{#1}}\hfil}

然而,它与\nomgroup(见下文)相冲突。

代码示例:

\documentclass{article}

\usepackage{ifthen}
\usepackage{calc}

\usepackage[noprefix]{nomencl}

% Configure title of groups
\newcommand{\bfdz}[1]{\bf\fontsize{12}{14}\selectfont #1}
\newcommand{\meru}[1]{\rule[2pt]{\textwidth-(\widthof{#1})}{.5pt}}

% Enable two line label
\renewcommand{\nomlabel}[1]{\smash{\parbox[t]{1.5cm}{#1}}\hfil}

% Create Groups
\renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{A}}{\vspace{5mm} \item[\bfdz General Symbols] \meru{\bfdz General Symbols~~}}{%
\ifthenelse{\equal{#1}{G}}{\vspace{5mm} \item[\bfdz Greek Symbols] \meru{\bfdz Greek Symbols~~}}{}}}

\makenomenclature 

\begin{document}

\printnomenclature[1.5cm]

\nomenclature[A]{$p(r_m,t)$, $p_m(t)$}{Received signal at the $m^{th}$ microphone\nomrefpage}%{}{}

\nomenclature[G]{$\Delta t_{\vec{x}}$}{Emission time delay at focus point $\vec{x}$, $\Delta t_{\vec{x}}=r_{\vec{x}} / c$\nomrefpage}%{}{}

\end{document}

如果你评论这一行

\renewcommand{\nomlabel}[1]{{\parbox[t]{1.5cm}{#1}}\hfil}

您将获得正确的标题,但标签尺寸错误。

标题不正确 截屏

有人知道如何修复它吗?

答案1

www.latex-community.org我对同一问题提出了以下建议:

% arara: pdflatex
% arara: nomencl
% arara: pdflatex
\documentclass{article}

\usepackage{ragged2e}
\usepackage[noprefix]{nomencl}

% define a command for the group heading:
% \rlap overlaps to the right => ``break out'' of the labels box
% and set a box over the whole textwidth;
% create the rule with \hrulefill rather than measuring the
% remaining space.
% let's also not use \bf but rather \bfseries (see https://tex.stackexchange.com/q/516/5049)
% and use \large instead of explicitly chhoose the font size:
\newcommand\grouphead[1]{%
  \rlap{%
    \parbox{\textwidth}{\textbf{\large#1 \hrulefill}}%
  }\hfill
}

% Enable two line label
% I added \RaggedRight from the `ragged2e' package here to avoid
% over- and underfull boxes
\renewcommand{\nomlabel}[1]{%
  \smash{\parbox[t]{.15\linewidth}{\RaggedRight#1}}}

% Create Groups
% the tests can be done without any additional package
% (they will fail, though, for a group like `aa')
\renewcommand{\nomgroup}[1]{%
  \ifx#1A\relax
    \item[\grouphead{General Symbols}]
  \fi
  \ifx#1G\relax
    \item[\grouphead{Greek Symbols}]
  \fi
  \bigskip}

\makenomenclature 

\begin{document}

Text bla bla

\printnomenclature[1.5cm]

\nomenclature[A]{$p(r_m,t)$, $p_m(t)$}{Received signal at the $m^{th}$
  microphone\nomrefpage}

\nomenclature[G]{$\Delta t_{\vec{x}}$}{Emission time delay at focus point
  $\vec{x}$, $\Delta t_{\vec{x}}=r_{\vec{x}} / c$\nomrefpage}

\end{document}

在此处输入图片描述

请注意我选择\bfseries\bf(见我使用 \textit 或 \it、\bfseries 或 \bf 等有关系吗出于原因)\large等等\fontsize{}{}\selectfont

对于更粗的线条,可以按照 David 的回答\hrulefill 的厚度是多少并可能定义一个相应的\nomgrouprulefill

相关内容