如何在词汇表(longtable)中使用 ragged2e 进行抑制?

如何在词汇表(longtable)中使用 ragged2e 进行抑制?

我正在尝试使用包long中提供的样式glossary来处理我的首字母缩略词列表。但是,我也在使用该ragged2e包,并且我的段落也缩进了。这会导致表格和首字母缩略词描述的第一行都缩进。有什么建议吗?

\documentclass{report}
\usepackage[top=1.0in,hmargin=1.25in,height=9.0in,letterpaper,showframe]{geometry}
\usepackage{setspace}
\usepackage[document]{ragged2e}
\usepackage{calc}
\usepackage[acronyms,nonumberlist,nopostdot,nogroupskip]{glossaries}

\setlength{\RaggedRightParindent}{0.5in}

\setacronymstyle{long-short}
\renewcommand*{\glsnamefont}[1]{\normalfont{#1}}
\newacronym{AAA}{AAA}{some text}
\newacronym{BBB}{BBB}{some very very very very very very very very very very very very very long long long long long long long long text}
\newacronym{CCC}{CCC}{an acronym}

\makenoidxglossaries
\setglossarystyle{long}
\newlength\glsnamewidth
\settowidth{\glsnamewidth}{MMMMM}
\setlength{\glsdescwidth}{\textwidth-\glsnamewidth-\tabcolsep}
\renewenvironment{theglossary}%
{\begin{longtable}[l]{@{}p{\glsnamewidth}p{\glsdescwidth}}}%
{\end{longtable}}%

\begin{document}
\doublespace
\printnoidxglossary[type=acronym,title={LIST OF ACRONYMS}]
\printacronyms

\gls{AAA}. Text text text \gls{BBB}. More text \gls{CCC}.

\end{document}

给出:

错误的

尽管我希望它看起来更像下一个,但下面的文本缩进。

正确的

答案1

找到了一种方法,即在更新的环境中更改缩进glossary,然后在关闭表后重置它。它适用于这种情况,但不确定是否有更优雅的方法。

完整代码:

\documentclass{report}
\usepackage[top=1.0in,hmargin=1.25in,height=9.0in,letterpaper,showframe]{geometry}
\usepackage{setspace}
\usepackage[document]{ragged2e}
\usepackage{calc}
\usepackage[acronyms,nonumberlist,nopostdot,nogroupskip]{glossaries}

\setlength{\RaggedRightParindent}{0.5in}

\setacronymstyle{long-short}
\renewcommand*{\glsnamefont}[1]{\normalfont{#1}}
\newacronym{AAA}{AAA}{some text}
\newacronym{BBB}{BBB}{some very very very very very very very very very very very very very long long long long long long long long text}
\newacronym{CCC}{CCC}{an acronym}

\makenoidxglossaries
\setglossarystyle{long}
\newlength\glsnamewidth
\settowidth{\glsnamewidth}{MMMMM}
 \setlength{\glsdescwidth}{\textwidth-\glsnamewidth-\tabcolsep}
\renewenvironment{theglossary}{%
    \setlength{\RaggedRightParindent}{0pt}\begin{longtable}[l{@{}p{\glsnamewidth}p{\glsdescwidth}}}%
{\end{longtable}\setlength{\RaggedRightParindent}{0.5in}}%

\begin{document}
\doublespace
\printnoidxglossary[type=acronym,title={LIST OF ACRONYMS}]
\printacronyms

\gls{AAA}. Text text text \gls{BBB}. More text \gls{CCC}.

\end{document}

相关内容