![Quebra de linha em nomencl para nomgroup](https://rvso.com/image/399807/Quebra%20de%20linha%20em%20nomencl%20para%20nomgroup.png)
Eu uso nomencl para criar a nomenclatura da minha tese.
A tese consiste em três capítulos e prefiro ter uma lista separada para cada um deles.
Atualmente consigo isso com o código em meu exemplo mínimo de trabalho.
Infelizmente, os nomes dos capítulos são bastante longos. Portanto, eles não cabem em uma linha.
Como posso fazer com que o nome do capítulo continue na próxima linha?
Como posso alinhá-lo de forma que a segunda linha não comece do início (abaixo de "Capítulo ..."), mas abaixo do nome do capítulo após o travessão ("Um título bastante longo ...") .
\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
Responder1
Consegui resolver o problema com "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}}}{}}}%
]}
Responder2
Sua ideia \parbox
é boa, mas sugiro várias melhorias, antes de mais nada para não adivinhar a largura.
\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}