按首字母对词汇表进行分组

按首字母对词汇表进行分组

我正在使用glossariesxindy它按首字母对条目进行分组,并在各组之间留出垂直空格。如何更改输出样式以在每组的开头显示其首字母?

\documentclass[10pt,a4paper]{report}
\usepackage[xindy]{glossaries}
\makeglossaries

\newglossaryentry{A}{name={A}, description={A is A}}
\newglossaryentry{AA}{name={AA}, description={AA is AA}}

\newglossaryentry{B}{name={B}, description={B is B}}

\newglossaryentry{C}{name={C}, description={C is C}}
\newglossaryentry{CC}{name={CC}, description={CC is CC}}


\begin{document}

Here I cite either \gls{A}, \gls{AA}, \gls{B}, \gls{C} or \gls{CC}.
I want three groups in the glossary output, indicated by \textbf{A},
\textbf{B} and \textbf{C} with entries in them according to their initial letter.

\printglossaries

\end{document}

答案1

在德国社区MrUnix我发布了这样的东西。

首先你可以尝试一下这种风格indexgroup

该命令\printglossaries不允许任何可选参数。为了与您的示例配合使用,我改用\printglossary宽度可选参数style=indexgroup

\documentclass[10pt,a4paper]{report}
\usepackage[xindy]{glossaries}
\makeglossaries

\newglossaryentry{A}{name={A}, description={A is A}}
\newglossaryentry{AA}{name={AA}, description={AA is AA}}

\newglossaryentry{B}{name={B}, description={B is B}}

\newglossaryentry{C}{name={C}, description={C is C}}
\newglossaryentry{CC}{name={CC}, description={CC is CC}}


\begin{document}

Here I cite either \gls{A}, \gls{AA}, \gls{B}, \gls{C} or \gls{CC}.
I want three groups in the glossary output, indicated by \textbf{A},
\textbf{B} and \textbf{C} with entries in them according to their initial letter.

\printglossary[style=indexgroup]

\end{document}

相关内容