我使用词汇表包来定义一些缩写和术语。我还创建了自己的样式(在 MWE 中并不是必需的,但我想在完整的文档中显示更多信息)。问题是我无法阻止词汇表标题和第一个条目之间的分页符。我已经尝试在几个位置引入 \nopagebreak,但没有成功。
% arara: lualatex: { synctex: on }
% arara: makeglossaries
% arara: lualatex: { synctex: on }
% arara: lualatex: { synctex: on }
\documentclass[]{article}
\usepackage[nonumberlist,nopostdot,nogroupskip,savewrites]{glossaries}
\newglossarystyle{myGlossaryStyle}{%
\renewenvironment{theglossary}%
{\begin{longtable}{p{0.125\textwidth}p{0.875\textwidth}}}{\end{longtable}}%
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand{\glossentry}[2]{ \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} \tabularnewline}
\renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
}
\newglossary*{glo1}{Glossary 1}
\newglossary*{glo2}{Glossary 2}
\makeglossaries
\newglossaryentry{e1}{name={e1}, description={e1 with a very very long line such that it needs at least two lines, which even needs some more words}}
\newglossaryentry{e2}{name={e2}, description={e2 with a very very long line such that it needs at least two lines, which even needs some more words}}
\newglossaryentry{e3}{name={e3}, description={e3}}
\newglossaryentry{e4}{name={e4}, description={e4}}
\newglossaryentry{e5}{name={e5}, description={e5}}
\newglossaryentry{e6}{name={e6}, description={e6}}
\newglossaryentry{e7}{name={e7}, description={e7}}
\newglossaryentry{e8}{name={e8}, description={e8}}
\newglossaryentry{e9}{name={e9}, description={e9}}
\newglossaryentry{e10}{name={e10}, description={e10}}
\newglossaryentry{glo1-e1}{name={glo1-e1}, description={glo1-e1 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e2}{name={glo1-e2}, description={glo1-e2 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e3}{name={glo1-e3}, description={glo1-e3 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e4}{name={glo1-e4}, description={glo1-e4 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e5}{name={glo1-e5}, description={glo1-e5 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e6}{name={glo1-e6}, description={glo1-e6 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e7}{name={glo1-e7}, description={glo1-e7 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e8}{name={glo1-e8}, description={glo1-e8 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e9}{name={glo1-e9}, description={glo1-e9 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo1}}
\newglossaryentry{glo1-e10}{name={glo1-e10}, description={glo1-e10}, type={glo1}}
\newglossaryentry{glo2-e1}{name={glo2-e1}, description={glo2-e1 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo2}}
\newglossaryentry{glo2-e2}{name={glo2-e2}, description={glo2-e2 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo2}}
\newglossaryentry{glo2-e3}{name={glo2-e3}, description={glo2-e3 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo2}}
\newglossaryentry{glo2-e4}{name={glo2-e4}, description={glo2-e4 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo2}}
\newglossaryentry{glo2-e5}{name={glo2-e5}, description={glo2-e5}, type={glo2}}
\newglossaryentry{glo2-e6}{name={glo2-e6}, description={glo2-e6}, type={glo2}}
\newglossaryentry{glo2-e7}{name={glo2-e7}, description={glo2-e7}, type={glo2}}
\newglossaryentry{glo2-e8}{name={glo2-e8}, description={glo2-e8 with a very very long line such that it needs at least two lines, which even needs some more words}, type={glo2}}
\newglossaryentry{glo2-e9}{name={glo2-e9}, description={glo2-e9}, type={glo2}}
\newglossaryentry{glo2-e10}{name={glo2-e10}, description={glo2-e10}, type={glo2}}
\begin{document}
\setglossarysection{section}
\glsaddall[types={glo1,glo2}]
\printglossary[type=glo1, style=myGlossaryStyle]
\printglossary[type=glo2, style=myGlossaryStyle]
\printglossary[type=main, title={Main Glossary}, style=myGlossaryStyle]
\end{document}
答案1
作为一个务实的解决方案,我在主词汇表之前添加了手动分页符。
\begin{document}
\setglossarysection{section}
\glsaddall[types={glo1,glo2}]
\printglossary[type=glo1, style=myGlossaryStyle]
\printglossary[type=glo2, style=myGlossaryStyle]
\pagebreak
\printglossary[type=main, title={Main Glossary}, style=myGlossaryStyle]
\end{document}