创建显示希腊和罗马单位的符号表时出错

创建显示希腊和罗马单位的符号表时出错

我正在写一篇论文,在编制符号表时遇到了问题。我使用的是如何制作一个带有分隔的希腊和罗马符号的自定义符号列表?并获得了运行的最小示例代码。但是,当我在论文中改编它时,我得到了关于定义函数的错误\renewcommand{\glslongextraSubNameFmt}

我的序言中有以下代码:

\usepackage[pdftex,plainpages=false,pdfpagelabels]{hyperref}
\usepackage{siunitx}    \sisetup{detect-all}

\usepackage[nopostdot, toc, nogroupskip, nomain, indexonlyfirst, acronym, symbols, style=long4col, stylemods={longbooktabs}]{glossaries-extra}
%\GlsXtrEnablePreLocationTag{page~}{pages~}

\glsaddkey
{unit}          % new key
{\relax}        % default value if "unit" isn't used in \newglossaryentry
{\glsentryunit} % analogous to \glsentrytext
{\Glsentryunit} % analogous to \Glsentrytext
{\glsunit}      % analogous to \glstext
{\Glsunit}      % analogous to \Glstext
{\GLSunit}      % analogous to \GLStext

\makeglossaries

% Define the parent roman and greek symbols
\newglossaryentry{romanletter}{
    name={\textbf{Roman letters}},
    description={\nopostdesc}, 
    sort={1}, 
    type=symbols,
}
\newglossaryentry{greekletter}{
    name={\textbf{Greek letters}},
    description={\nopostdesc}, 
    sort={2}, 
    type=symbols,
}

% Don't expand the unit field 
\glssetnoexpandfield{unit}

词汇表样式定义如下:

% Inform glossary about your own key (see manual v1.41, p.60 about its original definition)

\renewcommand{\glslongextraSubNameFmt}[2]{
    \glssubentryitem{#2}\glstarget{#2}{\glsentryunit{#2}\strut}
}
% Set the new glossary style
\newglossarystyle{long-sym-desc-unit-loc}{%
    \setglossarystyle{long-sym-desc-name}%
    \renewenvironment{theglossary}%
    {%
        \glspatchLToutput
        \glslongextraSymLocSetDescWidth
        \edef\@glslongextra@begintab{%
            \noexpand\begin{longtable}{%
                    \expandonce\glslongextraSymbolAlign
                    \expandonce\glslongextraDescAlign
                    \expandonce\glslongextraNameAlign
                    %\expandonce\glslongextraLocationAlign
            }}%
            \@glslongextra@begintab
        }   %
        {   \end{longtable}
    }%
    \renewcommand*{\glossaryheader}{%
        \bfseries Symbol%
        & \bfseries \descriptionname %
        & \bfseries Unit %
        \tabularnewline%
        \midrule%
        \endhead%
    }%
    \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{4}{##1}}%
    \renewcommand{\glossentry}[2]{%
        \tabularnewline
        \glslongextraNameFmt{##1} & & %
        \tabularnewline
    }% 
    \renewcommand{\subglossentry}[3]{%
        \glslongextraSubSymbolFmt{##1}{##2} &
        \glslongextraSubDescFmt{##1}{##2} &
        \glslongextraSubNameFmt{##1}{##2} %
        \tabularnewline
    }%
}

我收到以下错误:

Command \glslongextraSubNameFmt undefined. \renewcommand{\glslongextraSubNameFmt}
Package glossaries-extra Error: Glossary style `long-sym-desc-name' undefined. ...ype=symbols, style=long-sym-desc-unit-loc]
\include should only be used after \begin{document}

过去 3 个小时里我尝试了各种方法,但都没有成功。请帮忙。

提前感谢 Vivan

相关内容