How to get a black hexagon symbol?

As for most unicode symbols, there are filled hexagons in the STIX font.

They can be imported without importing the whole font.

\documentclass{article}
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareSymbolFont{symbols4}{LS1}{stixbb}{m}{it}
\DeclareMathSymbol{\varhexagonblack}{\mathord}{symbols4}{"DD}
\DeclareMathSymbol{\hexagonblack}   {\mathord}{symbols4}{"DE}
\begin{document}
\verb|\hexagonblack|: \( \hexagonblack \)

\verb|\varhexagonblack|: \( \varhexagonblack \)
\end{document}

Just it is a bit complex but I had used thus how I have written in the image a combination between tikz and \usetikzlibrary{shapes} that get the hexagon symbol: regular polygon sides=6. After I have used \mathord like suggested by user @Thruston in the recent comment.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage{xcolor}

\newcommand{\bhexagon}{\mathord{\raisebox{0.6pt}{\tikz{\node[draw,scale=.65,regular polygon, regular polygon sides=6,fill=black](){};}}}}

\begin{document}
\verb|tikz package with shapes|
$\triangle+\bhexagon=\square$
\end{document} 

enter image description here

Remember that STIX font change also the font of the text. Thus with the previous code you have always (for example) the font computer modern with the default symbol of amssymb.

ADDENDUM: It is possibile to have another hexagon symbol with the package oplotsymbl (using graphicx+rotatebox you can have the classic hexagon):

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{oplotsymbl}
\usepackage{amssymb}
\begin{document}
Another option
\[\hexagofill+\diamond=\blacksquare\]
\end{document}

ADDENDUM 2: Now I have seen that exist also a new package called dbnsymb rev. 7 Mar. 2, 2020 that it give us also the symbol \hexagon. It is important to have dbnsymb.sty to use this package.

enter image description here

I think that using xcolor package this symbol can be coloured.

ADDENDUM 3: Surely you can directly to use the symbol using XeLaTeX or LuaLaTeX (Unicode characters) with fontspec:

Symbol, Title/Description   Unicode Code / HTML Code

⬢, Black Hexagon, ⬢ ⬢

⬣, Horizontal, Black Hexagon, ⬣ ⬣

ADDENDUM 4: using unicode-math + XITS Math

\documentclass[12pt]{article}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\newcommand{\vbh}{\mathbin{\varhexagonblack}}
\newcommand{\hb}{\mathbin{\hexagonblack}}

\begin{document}
First $\hb+\vbh=\triangle$ second
\end{document}

enter image description here


The STIX font also has two versions of the symbol (in different rotations). For pdfLaTeX you can use the stix2 package. Downside is that STIX becomes the font for your entire document.

\documentclass{article}
\usepackage{stix2}
\begin{document}
\(a+b=\varhexagonblack\).

\(b+a=\hexagonblack\).
\end{document}

enter image description here

Tags:

Symbols