3

LaTeX symbols like \diamond, \circ and \square when compiled are in the form of symbols that are transparent. How can I fill black color into these shapes? For example, \circ shaded black is \bullet. Is there any command similar for \diamond and \square?

Werner
  • 603,163
Leo Lukose
  • 41
  • 1
  • 4

3 Answers3

4

amssymb has them, otherwise, for example, you could use fdsymbol:

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{fdsymbol}
\begin{document}
\noindent With \texttt{amsmath}:
\[
\blacklozenge \quad \blacksquare
\]
With \texttt{fdsymbol}:
\[
\medblackdiamond \quad \medblacksquare \quad
\smallblackdiamond \quad \smallblacksquare \quad
\]
\end{document}

enter image description here

Edit: Since \nabla is affected by fdsymbol, you could use stix, instead:

\documentclass{article}
\usepackage{amsmath}
\usepackage{stix}
\usepackage{array}
\setlength\extrarowheight{4pt}

\begin{document}
    \begin{tabular}{>{\ttfamily\textbackslash}l>{$}l<{$}}
        \multicolumn{2}{l}{With \texttt{stix} package:}\\
        mdblkdiamond & \mdblkdiamond \\
        mdblksquare & \mdblksquare \\
        mdlgblkdiamond & \mdlgblkdiamond \\
        mdlgblksquare \textnormal{or its alias} \textbackslash\texttt{blackquare} & \mdlgblksquare \quad \blacksquare\\
        nabla \textnormal{is correct}& \nabla
    \end{tabular}
\end{document}

enter image description here

CarLaTeX
  • 62,716
1

An option for a simple staring point (the purpose of the symbols is not clear (e.g. math/text/graphics symbol?):

\documentclass{article}
\usepackage{tikz}
\begin{document}
  \tikz\shadedraw (0, 0) rectangle (1, 1);
  \tikz[rotate=45]\shadedraw (0, 0) rectangle ({1/sqrt(2)}, {1/sqrt(2)});
  \tikz[rotate=45]\shadedraw[shading angle=45]
    (0, 0) rectangle ({1/sqrt(2)}, {1/sqrt(2)});
\end{document}

Result

Heiko Oberdiek
  • 271,626
0

Run with xelatex or lualatex

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{XITSMath}
\begin{document}
$\mdwhtcircle\mdblkcircle$
$\mdlgwhtdiamond\mdlgblkdiamond$
$\mdlgwhtsquare\mdlgblksquare$
\end{document}

enter image description here