MWE 使用默认显示除红心以外的所有花色。我更喜欢使用 \varheartsuit,在其他地方我使用 \symbolfamily\char"2666。但如果直接替换它,它就不会显示。我需要声明一个新的数学符号吗?或者有更简单的方法来添加它?
\documentclass{article}%
\RequirePackage{fontspec}%
\newfontfamily\symbolfamily{Asana Math}
\RequirePackage[HTML, hyperref, x11names]{xcolor}
\RequirePackage[bookmarks, psdextra, unicode, colorlinks,%
allcolors=DeepSkyBlue4,%
hyperfootnotes=false, linktoc=all]{hyperref}%
\usepackage[symbols]{glossaries-extra}
\makeglossaries
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the clubs}]
{*1clubs}% label (and sort value)
{\ensuremath{\clubsuit}}% symbol
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the diamonds}]
{*2diamonds}% label (and sort value)
{\ensuremath{\color{red}\diamondsuit}}% symbol
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the hearts}]
{*3hearts}% label (and sort value)
{\ensuremath{\color{red}\symbolfamily\char"2666}}% symbol
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the spades}]
{*4spades}% label (and sort value)
{\ensuremath{\spadesuit}}% symbol
\renewcommand{\glspostdescription}{\dotfill}
\makeglossaries
\begin{document}
Some sample usage of operators:
\[
\gls{*1clubs}
\]
text \gls{*4spades}
\newpage
More sample usage:
\[
\gls{*1clubs}
\]
text \gls{*4spades}
text \gls{*3hearts}
\newpage
text \gls{*2diamonds}
\printglossaries
\end{document}
答案1
(已填充)心形符号是"2665
("2666
是钻石)。
我会重新组织一下你的代码。
\documentclass{article}
\usepackage{fontspec}
\usepackage[HTML, hyperref, x11names]{xcolor}
\usepackage[symbols]{glossaries-extra}
\usepackage[
bookmarks,
psdextra,
unicode,
colorlinks,
allcolors=DeepSkyBlue4,
hyperfootnotes=false,
linktoc=all
]{hyperref}
\makeglossaries
\renewcommand{\glspostdescription}{\dotfill}
\newfontfamily\symbolfamily{Asana Math}
\NewDocumentCommand{\varhearts}{}{{\symbolfamily\symbol{"2665}}}
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the clubs}]
{*1clubs}% label (and sort value)
{\ensuremath{\clubsuit}}% symbol
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the diamonds}]
{*2diamonds}% label (and sort value)
{\ensuremath{\textcolor{red}{\diamondsuit}}}% symbol
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the hearts}]
{*3hearts}% label (and sort value)
{\text{\textcolor{red}{\varhearts}}}% symbol
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option
[description={the spades}]
{*4spades}% label (and sort value)
{\ensuremath{\spadesuit}}% symbol
\begin{document}
Some sample usage of operators:
\[
\gls{*1clubs}
\]
text \gls{*4spades}
\newpage
More sample usage:
\[
\gls{*1clubs}
\]
text \gls{*4spades}
text \gls{*3hearts}
\newpage
text \gls{*2diamonds}
\printglossaries
\end{document}
目前还不清楚为什么心形是填充的,而钻石却不是。