![Разрыв строки в номенклатуре для номгруппы](https://rvso.com/image/399807/%D0%A0%D0%B0%D0%B7%D1%80%D1%8B%D0%B2%20%D1%81%D1%82%D1%80%D0%BE%D0%BA%D0%B8%20%D0%B2%20%D0%BD%D0%BE%D0%BC%D0%B5%D0%BD%D0%BA%D0%BB%D0%B0%D1%82%D1%83%D1%80%D0%B5%20%D0%B4%D0%BB%D1%8F%20%D0%BD%D0%BE%D0%BC%D0%B3%D1%80%D1%83%D0%BF%D0%BF%D1%8B.png)
Я использую nomencl для создания номенклатуры моей диссертации.
Диссертация состоит из трех глав, и я предпочитаю иметь отдельный список для каждой из них.
В настоящее время я достигаю этого с помощью кода в моем минимальном рабочем примере.
К сожалению, названия глав довольно длинные. Поэтому они не помещаются в одну строку.
Как мне сделать так, чтобы название главы продолжалось в следующей строке?
Как мне выровнять его таким образом, чтобы вторая строка начиналась не с начала (ниже «Глава ...»), а под названием главы после тире («Довольно длинное название ...»).
\documentclass[a4paper,12pt]{book}
\usepackage[british,ngerman]{babel}
\usepackage{longtable} % longtable lets you have tables that span multiple pages
\usepackage{nomencl}
\makenomenclature
\renewcommand{\nomname}{List of Symbols}
\renewcommand{\nompreamble}{just some symbols}
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{A}{Common}{%
\ifstrequal{#1}{B}{Chapter 2 - A quite long title, a quite long title, a quite long title, a quite long title, a quite long title}{%
\ifstrequal{#1}{C}{Chapter 3 - A quite long title, a quite long title, a quite long title, a quite long title, a quite long title}{}}}%
]}
\begin{document}
\tableofcontents
\nomenclature[A, 1]{$\gamma$}{text}
\nomenclature[A, 2]{$B$}{text}
\nomenclature[B, 1]{$\beta$}{text}
\nomenclature[B, 2]{$S$}{text}
\nomenclature[C, 1]{$\alpha$}{text}
\nomenclature[C, 2]{$\beta$}{text}
\printnomenclature[2cm]
\end{document}enter code here
решение1
Мне удалось решить проблему с помощью «parbox»:
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{A}{Common}{%
\ifstrequal{#1}{B}{{\parbox[t]{16cm}{Chapter 2 - A quite long title, a quite long title, a quite long title, a quite long title, a quite long title}}}{%
\ifstrequal{#1}{C}{{\parbox[t]{16cm}{Chapter 3 - A quite long title, a quite long title, a quite long title, a quite long title, a quite long title}}}{}}}%
]}
решение2
Ваша идея \parbox
хороша, но я предлагаю несколько улучшений, прежде всего, чтобы избежать угадывания ширины.
\documentclass[a4paper,12pt]{book}
\usepackage[british,ngerman]{babel}
\usepackage{nomencl}
\usepackage{xparse}
\makenomenclature
\renewcommand{\nomname}{List of Symbols}
\renewcommand{\nompreamble}{just some symbols}
\newcommand{\nomA}{Common}
\newcommand{\nomB}{%
\parbox[t]{\textwidth}{%
Chapter 2 - A quite long title, a quite long title, a quite long title,
a quite long title, a quite long title%
}\kern-\labelsep
}
\newcommand{\nomC}{%
\parbox[t]{\textwidth}{%
Chapter 3 - A quite long title, a quite long title, a quite long title,
a quite long title, a quite long title%
}\kern-\labelsep
}
% this is easier than a long list of nested \ifstrequal calls and more easily scalable
\ExplSyntaxOn
\NewDocumentCommand{\nomgroupmake}{m}
{
\str_case:nnF { #1 }
{
{A}{\nomA}
{B}{\nomB}
{C}{\nomC}
}
{\ERROR}
}
\ExplSyntaxOff
\renewcommand\nomgroup[1]{\item[\bfseries\nomgroupmake{#1}]}
\begin{document}
Some text to make the nomenclature appear
\nomenclature[A,1]{$\gamma$}{text}
\nomenclature[A,2]{$B$}{text}
\nomenclature[B,1]{$\beta$}{text}
\nomenclature[B,2]{$S$}{text}
\nomenclature[C,1]{$\alpha$}{text}
\nomenclature[C,2]{$\beta$}{text}
\printnomenclature[2cm]
\end{document}