![集中词汇表的组标题](https://linux22.com/image/420697/%E9%9B%86%E4%B8%AD%E8%AF%8D%E6%B1%87%E8%A1%A8%E7%9A%84%E7%BB%84%E6%A0%87%E9%A2%98.png)
我一直用glossaries-extra
它来生成论文中的符号列表,但格式方面却让我很头疼。更具体地说,问题是我的章节标题居中,但词汇表组标题却不是。
我已经看过画廊了自定义组块以及不同的格式style
,但我还没有找到解决办法。理想情况下,列表应该看起来像style=long
(见下图),但有居中的组标题。
是否有一种简单的方法可以将词汇表的组标题居中?
梅威瑟:
\documentclass[parskip,12pt,oneside,a4paper]{scrbook}
\usepackage[record,symbols,nomain,stylemods={tree},shortcuts=other]{glossaries-extra}
\renewcommand*{\raggedchapter}{\centering}% Make chapters centred
\addtokomafont{disposition}{\rmfamily}% Roman fonts for Ch
\glsxtrsetgrouptitle{bte}{Neutron transport}
\glsxtrsetgrouptitle{angdisc}{Angular discretisations}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newentry{r}{
name={\ensuremath{\mathbf{r}}},
description={Position},
group={bte},
type={symbols}
}
\newentry{S2}{
name={\ensuremath{\mathit{S_2}}},
description={Angular domain: the unit sphere},
group={bte},
type={symbols}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newentry{SN}{
name={\ensuremath{S_N}},
description={Discrete Ordinates discretisation of \gls{S2}},
group={angdisc},
type={symbols}
}
\newentry{PN}{
name={\ensuremath{P_N}},
description={Spherical Harmonics discretisation of \gls{S2}},
group={angdisc},
type={symbols}
}
% \printunsrtglossary[type=symbols,style=long,title={List of Symbols}]
\printunsrtglossary[type=symbols,style=indexgroup,title={List of Symbols}]
\clearpage
\end{document}
答案1
答案2
测试了几个替代方案,包括@Venez 发布的答案,我认为这个问题最简单的解决方案是根据 定义一个新的词汇表样式long
。该long
样式实际上是一个longtable
,这意味着简单的列操作可以产生所需的样式,即居中的组标题和词汇表条目被放置在页面的中心。
解决方案:
\documentclass[parskip,12pt,oneside,a4paper]{scrbook}
\usepackage[record,symbols,nomain,stylemods={tree},shortcuts=other]{glossaries-extra}% list of symbols
\renewcommand*{\raggedchapter}{\centering}% Make chapters centred
\addtokomafont{disposition}{\rmfamily}% Roman fonts for Ch
\glsxtrsetgrouptitle{bte}{Neutron transport}
\glsxtrsetgrouptitle{angdisc}{Angular discretisations}
% Define a custom long style for groups; style=long uses longtables
\newglossarystyle{longgroup}{%
\setglossarystyle{long}%
\renewcommand*{\glsgroupheading}[1]{%
&% Add empty column in longtable
\multicolumn{1}{c}{% Change the alignment just for the group title to centre
\glsxtrgetgrouptitle{##1}{\glsxtrgrptitle}%
% \glstreePreHeader{##1}{\glsxtrgrptitle}%
\glstreegroupheaderfmt{\glsxtrgrptitle}%
}%
\cr% newline in table
%\glsgroupskip% Uncomment for additional spacing below group title
}%
}%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newentry{r}{
name={\ensuremath{\mathbf{r}}},
description={Position},
group={bte},
type={symbols}
}
\newentry{S2}{
name={\ensuremath{\mathit{S_2}}},
description={Angular domain: the unit sphere},
group={bte},
type={symbols}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newentry{SN}{
name={\ensuremath{S_N}},
description={Discrete Ordinates discretisation of \gls{S2}},
group={angdisc},
type={symbols}
}
\newentry{PN}{
name={\ensuremath{P_N}},
description={Spherical Harmonics discretisation of \gls{S2}},
group={angdisc},
type={symbols}
}
% \printunsrtglossary[type=symbols,style=long,title={List of Symbols}]
\printunsrtglossary[type=symbols,style=longgroup,title={List of Symbols}]
\clearpage
\end{document}