![glossaries-extra 删除 \glossentrydesc 中长文本的缩进](https://linux22.com/image/396123/glossaries-extra%20%E5%88%A0%E9%99%A4%20%5Cglossentrydesc%20%E4%B8%AD%E9%95%BF%E6%96%87%E6%9C%AC%E7%9A%84%E7%BC%A9%E8%BF%9B.png)
我想删除词汇表条目描述中长文本的缩进。实际上这是一个非常简单的任务,但我找不到解决方案。不知何故\glossentrydesc{##1}自动缩进。我更希望采用不定义新样式的解决方案,但我愿意这么做。
这里是 MWE:
\documentclass{scrbook}
\usepackage{hyperref}
\usepackage[acronym = true]{glossaries-extra}
\makeglossaries
\newglossarystyle{mylong}{
\renewenvironment{theglossary}
{\begin{longtable}{lp{\glsdescwidth}}}
{\end{longtable}}
\renewcommand*{\glossaryheader}{}
\renewcommand*{\glsgroupheading}[1]{}
\renewcommand{\glossentry}[2]{
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
}%
\renewcommand{\subglossentry}[3]{
&
\glssubentryitem{##2}
\glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space
##3\tabularnewline
}
\ifglsnogroupskip
\renewcommand*{\glsgroupskip}{}%
\else
\renewcommand*{\glsgroupskip}{ & \tabularnewline}%
\fi
}
\renewcommand\glspostdescription{\dotfill}
\setlength{\glsdescwidth}{0.95\hsize}
\longnewglossaryentry{apig}{
name = {API},
description = {
An Application Programming Interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API
}}
\newglossaryentry{api}{
type = \acronymtype,
name = {API},
description = {Application Programming Interface},
first = {Application Programming Interface (API) \glsadd{apig}}}
\begin{document}
\printglossary[
type = \acronymtype,
style = long,
title = Acronym,
toctitle = Acronym,
nonumberlist = false
]
\printglossary[
type = main,
style = mylong,
title = Glossar,
toctitle = Glossar,
nonumberlist = false
]
\newpage
\section{Sec1}
\gls{api}
\newpage
\gls{api}
\newpage
\gls{api}
\newpage
\section{Sec2}
\gls{api}
\end{document}
答案1
这个缩进称为空格,您可以自己插入它:
\longnewglossaryentry{apig}{
name = {API},
description = {
An Application Programming Interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API
}}
只需删除空格:
\longnewglossaryentry{apig}{
name = {API},
description = {%
An Application Programming Interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API
}}
这有什么区别?请参阅这个答案。