1

Following example shows only the square and lozenge (XeTeX, Version 3.14159265-2.6-0.99998) the other three symbols being shown as spaces whereas if unicode-math is removed, the symbols are shown correctly. Is there a way to show the symbols correctly whilst using unicode-math?

\documentclass{article}

\usepackage{amssymb}
\usepackage{unicode-math}

\begin{document}
$$a\blacksquare \blacklozenge \blacktriangle \blacktriangledown \bigstar b$$
\end{document}
3

I wouldn't mix amssymb with unicode-math.

You can supply the missing glyphs from another math font.

\documentclass{article}

\usepackage{unicode-math}

\setmathfont{Latin Modern Math}
\setmathfont{STIX Two Math}[
  range={\mdlgblklozenge,\mdblksquare,\blacktriangle,\blacktriangledown,\bigstar}
]

\providecommand{\blacksquare}{\mdblksquare}
\providecommand{\blacklozenge}{\mdlgblklozenge}

\begin{document}

\[
a\blacksquare \blacklozenge \blacktriangle \blacktriangledown \bigstar b
\]

\end{document}

enter image description here

There are smaller variants; it makes sense to load also them and then decide about the size at the end.

\documentclass{article}

\usepackage{unicode-math}

\setmathfont{Latin Modern Math}
\setmathfont{STIX Two Math}[
  range={
    \mdlgblklozenge,
    \smblklozenge,
    \mdblksquare,
    \smblksquare,
    \blacktriangle,
    \blacktriangledown,
    \bigstar,
  },
]

\providecommand{\blacksquare}{\smblksquare}
\providecommand{\blacklozenge}{\smblklozenge}

\begin{document}

\[
a\blacksquare \blacklozenge \blacktriangle \blacktriangledown \bigstar b
\]

\end{document}

enter image description here

You're not tied to using math fonts for specific symbols. For instance, you might resort to a standard font supplying them.

\documentclass{article}

\usepackage{amsmath}
\usepackage{unicode-math}

\newfontface{\altfont}{FreeSerif}

\AtBeginDocument{%
  \providecommand{\blacksquare}{\text{\altfont\symbol{"25A0}}}%
  \providecommand{\blacklozenge}{\text{\altfont\symbol{"29EB}}}%
  \renewcommand{\blacktriangle}{\text{\altfont\symbol{"25B2}}}%
  \renewcommand{\blacktriangledown}{\text{\altfont\symbol{"25BC}}}%
  \renewcommand{\bigstar}{\text{\altfont\symbol{"2605}}}%
}

\begin{document}

\[
a\blacksquare \blacklozenge \blacktriangle \blacktriangledown \bigstar b
\]

\end{document}

enter image description here

| improve this answer | |
5

The log shows

Missing character: There is no ▴ in font [latinmodern-math.otf]/OT:script=math;
language=DFLT;!
Missing character: There is no ▾ in font [latinmodern-math.otf]/OT:script=math;
language=DFLT;!
Missing character: There is no ★ in font [latinmodern-math.otf]/OT:script=math;
language=DFLT;!

so the font doesn't contain these characters. You could try a different main font, or define these to come from the ams fonts

For example I get

enter image description here

if I add

\setmathfont{Stix Two Math}
| improve this answer | |
  • I tried but couldn't find the right result. +1. I have tried with \setmathfont{texgyrepagella-math.otf} – Sebastiano Apr 7 '19 at 9:06
  • 3
    @Sebastiano the tex gyre fonts come from the same team as the OTF latin modern and have similar character set. stix is more complete. – David Carlisle Apr 7 '19 at 9:14
  • 2
    @Sebastiano - Give XITS Math and Stix Two Math a try. – Mico Apr 7 '19 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.