nomencl에서 nomencl의 줄 바꿈

nomencl에서 nomencl의 줄 바꿈

나는 논문의 명명법을 만들 때 nomencl을 사용합니다.
논문은 세 개의 장으로 구성되어 있으며 각 장에 대해 별도의 목록을 갖는 것을 선호합니다.
나는 현재 최소한의 작업 예제에 있는 코드를 사용하여 이를 달성하고 있습니다.
아쉽게도 챕터 이름이 꽤 깁니다. 따라서 한 줄에 맞지 않습니다.

다음 줄에 장 이름을 계속 사용하려면 어떻게 해야 합니까?
두 번째 줄이 처음부터 시작하지 않고("Chapter ..." 아래) 대시 뒤의 장 이름 아래("아주 긴 제목 ...")에 시작되도록 하려면 어떻게 해야 합니까? .

\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}

여기에 이미지 설명을 입력하세요

관련 정보