改进词汇表的符号列表,增加第三列

改进词汇表的符号列表,增加第三列

基于这个话题,我构建了如下所示的 MWE。它使用词汇表包生成带有物理单位的符号列表。列表应该在单元格之间有线条,就像表格一样。表格顶部和列表边框处的线条应该是黑色的。在每个条目之间,线条应该是灰色的。

\documentclass{report}

\usepackage[dvipsnames,table]{xcolor} % The option "table" enables coloured tables.

\usepackage[unicode=true,breaklinks=false,backref=false,pdfstartview=FitH]{hyperref} % This package is inevitable in the project.

\usepackage[acronym,sort=standard,nonumberlist]{glossaries}

\setlength{\glsdescwidth}{0.6\linewidth}
\newglossary[slg]{symbolslist}{syi}{syg}{List of physical quantities} % This is necessary in any case if a list of symbols is to be produced, no matter which style is used.
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
\newglossarystyle{symbunitlong}{
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
  \begin{longtable}{| l | p{\glsdescwidth}|>{\centering\arraybackslash}p{2cm}|}}
  {\end{longtable}}
\renewcommand*{\glossaryheader}{%  Change the table header
  \hline
    \bfseries Sign & \bfseries Description & \bfseries Unit \\
  \hline
  \endhead}
\renewcommand*{\glossentry}[2]{%  Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glsunit{##1} \tabularnewline \arrayrulecolor{lightgray}\hline\arrayrulecolor{black}}}

\makeglossaries % This seems to be necessary.

\newglossaryentry{sy-c}{name=\ensuremath{c},
    description={velocity of light in vacuum},
    unit={\ensuremath{\rm{m}/\rm{s}}},
    type=symbolslist,
    sort=c}

\newglossaryentry{sy-height}{name=\ensuremath{h},
    description={Height},
    unit={\ensuremath{\rm{m}}},
    type=symbolslist,
    sort=height}
        
\newglossaryentry{sy-h}{name=\ensuremath{h_{\rm{Pl}}},
    description={Planck's constant},
    unit={\ensuremath{\rm{J}\cdot\rm{s}}},
    type=symbolslist,
    sort=hplanck}

\newglossaryentry{sy-pi}{name=\ensuremath{\pi},
    description={Geometrical value},
    unit={},
    type=symbolslist,
    sort=pi}
        
\newglossaryentry{sy-power}{name=\ensuremath{P},
    description={Power},
    unit={\ensuremath{\rm{W}}},
    type=symbolslist,
    sort=power}
        
\newglossaryentry{sy-x1}{name=\ensuremath{x_1},
    description={Dimensionless energy of particle 1},
    unit={},
    type=symbolslist,
    sort=x1}

\newglossaryentry{sy-x2}{name=\ensuremath{x_2},
    description={Dimensionless energy of particle 2},
    unit={},
    type=symbolslist,
    sort=x2}


\begin{document}

\gls{sy-c}\\
\gls{sy-height}\\
\gls{sy-h}\\
\gls{sy-power}\\
\gls{sy-pi}\\
\gls{sy-x1}\\
\gls{sy-x2}\\

\printglossary
\printglossary[type=symbolslist,style=symbunitlong]   % Produce the list of symbols

\end{document}

以下是输出 pdf 的相关部分:

在此处输入图片描述

现在,输出的pdf中出现了三个问题:

  1. 在最后一个列表条目下方,有一条灰线。但是,这条线应该是黑色的。我该如何实现呢?
  2. 为什么单位列中的条目是超链接?我该如何抑制这种情况?
  3. 每次列出新的字母时,如何才能抑制创建一个空行?

相关内容