xkeyval 錯誤:「HEIGHT」(「WIDTH」)在「psvectorian」系列中未定義

xkeyval 錯誤:「HEIGHT」(「WIDTH」)在「psvectorian」系列中未定義

我想更改我的術語表的標題,例如符號列表,如下所示(使用從包中藉用的一些實體psvectorian)。

\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\[\baselineskip]List of Symbols\\[0.9\baselineskip]\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\

這是我的MWE

\documentclass{memoir}

\usepackage{psvectorian}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{tocloft}
\usepackage{glossaries}
\usepackage{fontspec}

\renewcommand*\glspostdescription{\dotfill}

\newcommand{\abc}[1]{\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\[\baselineskip]#1\\[0.9\baselineskip]\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\}

\loadglsentries{gloss-symb}

\newglossarystyle{mylong}{%
    \setglossarystyle{long}%
    \renewenvironment{theglossary}%
    {\begin{longtable}[l]{@{}p{\dimexpr 2.5cm-\tabcolsep}p{0.8\hsize}}}
        {\end{longtable}}%
}

\makenoidxglossaries

\begin{document}

    \tableofcontents
    
    \clearpage
    
    \renewcommand{\glossaryname}{\abc{List of Symbols}}
    
        \addcontentsline{toc}{chapter}{List of Symbols}
        \printnoidxglossary[style=mylong]

    \newpage
    
    \gls{sigma} is an event set.
\end{document}

其中gloss-symb.tex只包括

\newglossaryentry{sigma}{name={\ensuremath{\Sigma}}, description={Event set}}

但是,我遇到了以下錯誤:

Package xkeyval Error: `HEIGHT' undefined in families `psvectorian'. \end{document}

Package xkeyval Error: `WIDTH' undefined in families `psvectorian'. \end{document}

psvectorian 手動的(第 2 頁)已經注意到width並且height確實是有效的密鑰。那麼,我在這裡做錯了什麼?

答案1

width並且height確實存在,但是WIDTH並且HEIGHT不存在。問題是,在排版時,\glossaryname巨集會展開並擴展為\MakeUppercased,因此widthWIDTH出現錯誤。這是程式碼(等)與文字混合的問題\psvectorian:一些需要純文字的程式碼在一般命令中表現不佳。

一種簡單的方法是將\psvectorian命令打包到\protected巨集中,以便它們在大寫之前不會擴展(因此它們也不是大寫的)。將您的定義分為\abc三個部分即可完成工作:

\protected\def\abcbefore{\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\[\baselineskip]}
\protected\def\abcafter{\\[0.9\baselineskip]\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\}
\newcommand{\abc}[1]{\abcbefore#1\abcafter}

可編譯程式碼:

\documentclass{memoir}
\usepackage{psvectorian}
\usepackage{glossaries}

\begin{filecontents*}{gloss-symb}
\newglossaryentry{sigma}{name={\ensuremath{\Sigma}}, description={Event set}}
\end{filecontents*}

\renewcommand*\glspostdescription{\dotfill}

\protected\def\abcbefore{\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\[\baselineskip]}
\protected\def\abcafter{\\[0.9\baselineskip]\hfil\hspace*{-3.5cm}\psvectorian[height=3mm, width=8cm]{88}\hfil\\}
\newcommand{\abc}[1]{\abcbefore#1\abcafter}

\loadglsentries{gloss-symb}

\newglossarystyle{mylong}{%
    \setglossarystyle{long}%
    \renewenvironment{theglossary}%
    {\begin{longtable}[l]{@{}p{\dimexpr 2.5cm-\tabcolsep}p{0.8\hsize}}}
        {\end{longtable}}%
}

\makenoidxglossaries

\begin{document}

\tableofcontents

\clearpage

\renewcommand{\glossaryname}{\abc{List of Symbols}}

\addcontentsline{toc}{chapter}{List of Symbols}
\printnoidxglossary[style=mylong]

\newpage

\gls{sigma} is an event set.
\end{document}

相關內容