1

The MWE uses the default display for all suits except Hearts. I'd prefer to use \varheartsuit for it and elsewhere I use \symbolfamily\char"2666. But if that's directly subsituted it doesn't display. Do I need to declare a new math symbol or is there an easier way to add it?

\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}
DLyons
  • 529
  • 2
  • 9

1 Answers1

1

The (filled) hearts symbol is "2665 ("2666 is diamonds).

I'd reorganize a bit your code.

\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}

enter image description here

It's not clear why hearts are filled and diamonds aren't.

egreg
  • 1,121,712
  • Much appreciated. I plan to fill both, but reckoned I could fill diamonds myself if shown how to fill hearts :-) – DLyons Sep 06 '18 at 08:51