最后显示的词汇表条目的悬挂缩进因索引样式而丢失

最后显示的词汇表条目的悬挂缩进因索引样式而丢失

glossaries我在文档中使用该包并使用index其中的样式(因为我需要在词汇表中显示可选符号)。

奇怪的是,最后显示的项目的悬挂缩进丢失了。

这是一个只有两个项目的最小示例。我遗漏了什么?

\documentclass{article}

\usepackage{glossaries}

\makeglossary

\newglossaryentry{GLO1}{name={GLO1},text={Glossary Entry 1},description={Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. }}

\newglossaryentry{GLO2}{name={GLO2},text={Glossary Entry 2},description={Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text }}

\begin{document}

\gls{GLO1}
\gls{GLO2}

\printglossary[style=index]

\end{document}

在此处输入图片描述

我正在使用最近安装的(稳定)texlive 2013 并使用 pdflatex 和 makeglossaries 进行编译。

答案1

这似乎是样式定义中的一个错误index。样式定义theglossary环境以没有特殊命令结束,需要的是。您可以通过更新文档中的索引样式来修复此问题。下面我刚刚从其所在位置\par复制了定义,替换为并修复了结束命令。glossary-tree.sty\newglossary\renewglossary

示例输出

\documentclass{article}

\usepackage{glossaries}

\makeatletter
\renewglossarystyle{index}{%
  \renewenvironment{theglossary}%
    {\setlength{\parindent}{0pt}%
     \setlength{\parskip}{0pt plus 0.3pt}%
     \let\item\@idxitem}%
    {\par}%            %%%%%% Addition here
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glossaryentryfield}[5]{%
\item\glsentryitem{##1}\textbf{\glstarget{##1}{##2}}%
  \ifx\relax##4\relax
  \else
    \space(##4)%
  \fi
  \space ##3\glspostdescription \space ##5}%
  \renewcommand*{\glossarysubentryfield}[6]{%
    \ifcase##1\relax
      % level 0
      \item
    \or
      % level 1
      \subitem
      \glssubentryitem{##2}%
    \else
      % all other levels
      \subsubitem
    \fi
    \textbf{\glstarget{##2}{##3}}%
    \ifx\relax##5\relax
    \else
      \space(##5)%
    \fi
    \space##4\glspostdescription\space ##6}%
  \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}}
\makeatother

\makeglossary

\newglossaryentry{GLO1}{name={GLO1},text={Glossary Entry 1},description={Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. }}

\newglossaryentry{GLO2}{name={GLO2},text={Glossary Entry 2},description={Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text }}

\newglossaryentry{GLO3}{name={GLO3},text={Glossary Entry 3},description={Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text. Some other text }}

\begin{document}

\gls{GLO1}
\gls{GLO2}
\gls{GLO3}

\printglossary[style=index]

\end{document}

相关内容