
패키지로 작은 스페인어 사전을 만들어 보려고 합니다 glossaries
. 그룹 제목을 섹션으로 재정의하려고 했습니다. 이것은 MWE입니다( polyglossia
생략해도 PDF 출력이 없으므로 필요한 것 같습니다).
%!TEX program = xelatex
\documentclass[a4paper,12pt]{article}
\usepackage{polyglossia}
\setdefaultlanguage{spanish}
\usepackage{hyperref}
\usepackage[automake,style=long,xindy={language={spanish-modern}}]{glossaries-extra}
\newcommand{\entrada}[4][]{%
\renewcommand*{\glsgroupheading}[1]{%
\section{\glsgetgrouptitle{##1}}
}
\newglossaryentry{#2}%
{%
name=#2,%
symbol=#3,%
description=#4,%
#1%
}%
\glsadd{#2}%
}
\newglossarystyle{entrada}%
{%
\renewenvironment*{theglossary}{}{}
\renewcommand*{\glossaryentryfield}[5]{%
\par\vspace{0.25\baselineskip}%
\noindent{}##4\textbf{##2.} {##3}%
}%
}%
\makeglossaries
\begin{document}
\tableofcontents
\entrada{Pollo}{}{Ave}
\entrada{Carne}{}{Parte blanda de los animales}
\entrada{Cosa}{}{Objeto de}
\printglossary[style=entrada]
\end{document}
내가 얻는 것은 다음과 같은 문제 라인입니다
Undefined control sequence. \glsgroupheading{C}
Undefined control sequence. \glsgroupheading{P}
또한 를 통해 수동으로 TOC에 추가하여 번호가 없는 섹션을 사용해 보았 \addcontentsline
으나 실패했습니다. 이러한 오류를 해결할 수 있는 방법이 있나요?
답변1
문제는 \glsgetgrouptitle
의 인수를 사용하는 것입니다 \section
. 이는 소위 이동 인수(즉, 문서의 다른 위치에서 실행됨)이기 때문입니다. 확장할 수 없고 \glsgetgrouptitle
문서의 어느 곳에서도 작동하지 않으므로 작동할 수 없습니다.
귀하의 예에서는 \glsgetgrouptitle
실제로 아무것도 수행하지 않으므로 그냥 생략해도 됩니다. \glsgroupheading
가 아닌 용어집 스타일에서 재정의해야 합니다 \entrada
.
%!TEX program = xelatex
\documentclass[a4paper,12pt]{article}
\usepackage{polyglossia}
\setdefaultlanguage{spanish}
\usepackage{hyperref}
\usepackage[automake,style=long,xindy={language={spanish-modern}}]{glossaries-extra}
\makeglossaries
\newcommand{\entrada}[4][]{%
\newglossaryentry{#2}%
{%
name=#2,%
symbol=#3,%
description=#4,%
#1%
}%
\glsadd{#2}%
}
\newglossarystyle{entrada}%
{%
\renewenvironment*{theglossary}{}{}%
\renewcommand*\glossaryheader{}%
\renewcommand*\glsgroupheading[1]{%
\section{##1}%
}%
\renewcommand*\glsgroupskip{}%
\renewcommand*{\glossaryentryfield}[5]{%
\par\vspace{0.25\baselineskip}%
\noindent{}##4\textbf{##2.} {##3}%
}%
}%
\begin{document}
\tableofcontents
\entrada{Pollo}{}{Ave}
\entrada{Carne}{}{Parte blanda de los animales}
\entrada{Cosa}{}{Objeto de}
\printglossary[style=entrada]
\end{document}