使用 altlist 词汇表样式进行分组命名

使用 altlist 词汇表样式进行分组命名

我正在使用包altlist的样式glossaries,并希望生成类似于这里(即使用条目和子条目手动对符号进行分组)。如果我尝试类似的代码altlist

\documentclass{report}

\usepackage{setspace}
\usepackage[nopostdot,nonumberlist,acronyms,section]{glossaries}

\newglossarystyle{supergroup}{%
  \setglossarystyle{altlist}%
  \renewcommand*{\glsgroupskip}{}%
  \renewcommand{\glossentry}[2]{%
    \tabularnewline
    \multicolumn{2}{c}{%
     \bfseries\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}}%
    }% 
    \tabularnewline
    \tabularnewline
  }%
  \renewcommand{\subglossentry}[3]{%
     \glssubentryitem{##2}%
     \glstarget{##2}{\glossentryname{##2}}
     &
     \glossentrydesc{##2}\glspostdescription\space
     ##3\tabularnewline
  }%
}

\newglossary[slg]{symbol}{sot}{stn}{Symbols}
\makenoidxglossaries

\newglossaryentry{alpha}{
  type=symbol,
  name={Alphanumeric},
  description={}}

\newglossaryentry{greek}{
  type=symbol,
  name={Greek letters},
  description={}}

\newglossaryentry{area}{
  type=symbol,
  name={\ensuremath{S}},
  description={reference area},
  sort={S},
  parent=alpha
}
\newglossaryentry{span}{
  type=symbol,
  name={\ensuremath{b}},
  sort={b},
  description={wing span},
  parent=alpha
}
\newglossaryentry{dynp}{
  type=symbol,
  name={\ensuremath{q_\infty}},
  description={dynamic pressure},
  sort={q},
  parent=alpha
}
\newglossaryentry{aoa}{
  type=symbol,
  name={\ensuremath{\alpha}},
  description={angle of attack},
  sort={a},
  parent=greek
}
\newacronym
[sort={a}]
{bcr}{BCR}{Block Compressed Row}
\newacronym
[sort={a}]
{cad}{CAD}{Computer-Aided Design}

\begin{document}
\onehalfspacing

\section*{List of Symbols and Acronyms}
\glsaddall

\printnoidxglossary[type=symbol,style=supergroup]
\printnoidxglossary[type=acronym]

\end{document}

这会产生一些错误。我该如何让它正常工作?

编辑:

我找到了部分解决方案:

\documentclass{article}
\usepackage{amssymb, amsfonts, mathrsfs, amsmath, mathabx}
\usepackage[nopostdot,nonumberlist,acronyms,section]{glossaries}
\newglossary[slg]{symbolslist}{sot}{stn}{Symbols}
\makenoidxglossaries
\newglossaryentry{alpha}{
  type=symbolslist,
  name={\hspace{4cm} Alphanumeric},
  description={},
  sort={A}
  }
\newglossaryentry{greek}{
  type=symbolslist,
  name={Greek letters},
  description={}
  }
\newglossaryentry{area}{
  type=symbolslist,
  name={\ensuremath{S}},
  description={reference area},
  sort={B}
  }
\begin{document}
\glsaddall
\printnoidxglossary[type=symbolslist, style=altlist]
\end{document}

现在,描述字段为空的条目将以粗体显示,并且可以alpha向右移动(与条目一样)。是否有可能将这些条目居中,而无需手动使用\hspace{Xcm}适当的X

答案1

这更像吗?

在此处输入图片描述

\documentclass{report}

\usepackage{setspace}
\usepackage[nopostdot,nonumberlist,acronyms,section]{glossaries}

\newglossarystyle{supergroup}{%
  \setglossarystyle{altlist}%
  \renewcommand*{\glsgroupskip}{}%
  \renewcommand{\glossentry}[2]{%
    \item[]%
     \makebox[\linewidth][c]{\bfseries\glsentryitem{##1}\glstarget{##1}\glossentryname{##1}}
  }%
  \renewcommand{\subglossentry}[3]{%
    \item[\glssubentryitem{##2}%
      \glstarget{##2}{\glossentryname{##2}}]%
      \mbox{}\par\nobreak\glossentrydesc{##2}\glspostdescription\space ##3%
   }%
}

\newglossary[slg]{symbol}{sot}{stn}{Symbols}
\makenoidxglossaries

\newglossaryentry{alpha}{
  type=symbol,
  name={Alphanumeric},
  description={}}

\newglossaryentry{greek}{
  type=symbol,
  name={Greek letters},
  description={}}

\newglossaryentry{area}{
  type=symbol,
  name={\ensuremath{S}},
  description={reference area},
  sort={S},
  parent=alpha
}
\newglossaryentry{span}{
  type=symbol,
  name={\ensuremath{b}},
  sort={b},
  description={wing span},
  parent=alpha
}
\newglossaryentry{dynp}{
  type=symbol,
  name={\ensuremath{q_\infty}},
  description={dynamic pressure},
  sort={q},
  parent=alpha
}
\newglossaryentry{aoa}{
  type=symbol,
  name={\ensuremath{\alpha}},
  description={angle of attack},
  sort={a},
  parent=greek
}
\newacronym
[sort={a}]
{bcr}{BCR}{Block Compressed Row}
\newacronym
[sort={a}]
{cad}{CAD}{Computer-Aided Design}

\begin{document}
\onehalfspacing

\section*{List of Symbols and Acronyms}
\glsaddall

\printnoidxglossary[type=symbol,style=supergroup]
\printnoidxglossary[type=acronym]

\end{document}

相关内容