TeX - LaTeX Asked by Roboticist on July 2, 2021
I’d like to change the title of my glossary, say, List of Symbols, as follows (using some entities borrowed from the psvectorian
package).
hfilhspace*{-3.5cm}psvectorian[height=3mm, width=8cm]{88}hfil[baselineskip]List of Symbols[0.9baselineskip]hfilhspace*{-3.5cm}psvectorian[height=3mm, width=8cm]{88}hfil
Here is my MWE
documentclass{memoir}
usepackage{psvectorian}
usepackage[english]{babel}
usepackage{tikz}
usepackage{tocloft}
usepackage{glossaries}
usepackage{fontspec}
renewcommand*glspostdescription{dotfill}
newcommand{abc}[1]{hfilhspace*{-3.5cm}psvectorian[height=3mm, width=8cm]{88}hfil[baselineskip]#1[0.9baselineskip]hfilhspace*{-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.8hsize}}}
{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}
in which gloss-symb.tex
just includes
newglossaryentry{sigma}{name={ensuremath{Sigma}}, description={Event set}}
However, I’ve faced the following errors:
Package xkeyval Error: `HEIGHT' undefined in families `psvectorian'. end{document}
Package xkeyval Error: `WIDTH' undefined in families `psvectorian'. end{document}
The psvectorian
manual (the page 2) already noted that width
and height
are indeed valid keys. So, what am I doing wrong here?
width
and height
do in fact exist, but WIDTH
and HEIGHT
do not. The problem is that at some point when typesetting glossaryname
the macro is expanded and MakeUppercase
d, so width
becomes WIDTH
and you get the error. This is the problem of intermixing code (psvectorian
and such) with text: some code that expects pure text will not behave well with general commands.
One easy way out is to pack the psvectorian
commands into protected
macros so that they don't expand before uppercasing (thus they aren't uppercased either). Dividing your definition of abc
into three parts gets the job done:
protecteddefabcbefore{hfilhspace*{-3.5cm}psvectorian[height=3mm, width=8cm]{88}hfil[baselineskip]}
protecteddefabcafter{[0.9baselineskip]hfilhspace*{-3.5cm}psvectorian[height=3mm, width=8cm]{88}hfil}
newcommand{abc}[1]{abcbefore#1abcafter}
Compilable code:
documentclass{memoir}
usepackage{psvectorian}
usepackage{glossaries}
begin{filecontents*}{gloss-symb}
newglossaryentry{sigma}{name={ensuremath{Sigma}}, description={Event set}}
end{filecontents*}
renewcommand*glspostdescription{dotfill}
protecteddefabcbefore{hfilhspace*{-3.5cm}psvectorian[height=3mm, width=8cm]{88}hfil[baselineskip]}
protecteddefabcafter{[0.9baselineskip]hfilhspace*{-3.5cm}psvectorian[height=3mm, width=8cm]{88}hfil}
newcommand{abc}[1]{abcbefore#1abcafter}
loadglsentries{gloss-symb}
newglossarystyle{mylong}{%
setglossarystyle{long}%
renewenvironment{theglossary}%
{begin{longtable}[l]{@{}p{dimexpr 2.5cm-tabcolsep}p{0.8hsize}}}
{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}
Correct answer by Phelype Oleinik on July 2, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP