2

I remember seeing this before, but I don't know exactly what this is code U+25C8 called.

I have this symbol here, that corresponds to U+25C8 of some code.

How to I get this into latex? Is this some sort of unicode?

Thanks.

3

I know of no font available with (pdf)latex that provides that shape, WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND. On the other hand, it's not really difficult to build it.

\documentclass{article}
\usepackage{pict2e}

\DeclareRobustCommand{\wdcbsd}{%
  \begingroup
  \setlength{\unitlength}{\fontcharht\font`T}%
  \begin{picture}(1,1)
  \polygon(.5,0)(1,.5)(.5,1)(0,.5)
  \polygon*(.5,0.2)(.8,.5)(.5,.8)(.2,.5)
  \end{picture}%
  \endgroup
}

\begin{document}

A\wdcbsd B

\end{document}

You can even use direct input:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pict2e}

\DeclareRobustCommand{\wdcbsd}{%
  \begingroup
  \setlength{\unitlength}{\fontcharht\font`T}%
  \begin{picture}(1,1)
  \polygon(.5,0)(1,.5)(.5,1)(0,.5)
  \polygon*(.5,0.2)(.8,.5)(.5,.8)(.2,.5)
  \end{picture}%
  \endgroup
}
\DeclareUnicodeCharacter{25C8}{\wdcbsd}

\begin{document}

A◈B

\end{document}

enter image description here

Adjust the coordinates to suit you. For instance, if you want the symbol to have the same height as lowercase letters, change the \setlength line into

  \setlength{\unitlength}{1ex}%

enter image description here

For something in between you can use a larger value; with

  \setlength{\unitlength}{1.2ex}%

you get

enter image description here

2

A TikZ solution:

  • The symbol is drawn by filling a path with three rectangles. Because of the even odd fill rule, the middle part remains empty/white.

  • The height of the symbol is the height of uppercase letters.

  • The outer "line width" is 0.4 pt, independent on the font size, the inner rectangle is set at 75% of the outer rectangle, dependent on the font size. By using relative or absolute values, this behavior can be changed.

  • Package accsupp improves the cut and paste behavior a little. The feature ActualText is not supported by all PDF viewers.

  • Also the symbol can be used in bookmarks.

Full example:

\documentclass{article}
\usepackage{accsupp}
\usepackage{tikz}
\DeclareRobustCommand*{\wdcbsd}{%
  \leavevmode
  \begingroup
    \BeginAccSupp{
      method=hex,
      unicode,
      ActualText=25C8,
      space,
    }%
      \setlength{\unitlength}{\fontcharht\font`\H}%
      \pgfmathsetlength{\unitlength}{cos(45)*\unitlength}%
      \tikz[
        rotate=45,
        x=\unitlength,
        y=\unitlength,
        even odd rule,
      ]\fill
        (0, 0) rectangle (1, 1)
        ++(-.4pt, -.4pt) rectangle (.4pt, .4pt)
        (.25, .25) rectangle (.75, .75)
      ;%
    \EndAccSupp{}%
  \endgroup
}

% Support for hyperref's bookmarks
\AtBeginDocument{% 
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname pdfstringdefDisableCommands\endcsname\relax
  \else
    \pdfstringdefDisableCommands{%
      \def\wdcbsd{\unichar{"25C8}}%
    }%
  \fi
}

\usepackage[pdfencoding=auto]{hyperref}
\usepackage{bookmark}

\begin{document}
\tableofcontents
\section{A\wdcbsd B}
\end{document}

Result

1

U25C8 is the unicode no of this character (category Geometric shapes). Its name is ‘WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND’. On this site, you can find a list of fonts which contain this symbol. You can use them with XeLaTeX or LuaLaTeX.

Edit It seems the packages MnSymbol and fdsymbol each have a \diamonddiamond symbol which looks very much like what you're after:

\documentclass{article}%{standalone}
\usepackage{fdsymbol}
% %\usepackage{MnSymbol}

\begin{document}

\Huge$ \diamonddiamond $

 \end{document} 

enter image description here

Edit 2

Here is a way to obtain this qymbol with the \stackinset command from stackengine and two symbols from fdsymbol:

\documentclass[border=2pt]{standalone}
\usepackage{fdsymbol}
\usepackage{stackengine, graphicx} %

\begin{document}$ 
\Huge \stackinset{c}{0pt}{c}{-0.02em}{$ \blackdiamond $}{\scalebox{1.25}{$ \Diamond $}}$

 \end{document} 

enter image description here

2
  • Thanks for this. I am still trying to get it work. But just to double check, when you say XeLaTeX or LuaLaTeX, does that imply latex will not work? May 17 '16 at 20:51
  • 1
    LeTeX needs type 1 fonts (or metafont fonts), a system of TeX metric fonts ( the tfm files) and virtual fonts. Most of the fonts containing this character are Opentype fonts, which cannot be used as they are. There are tools to converts them (LCDF Type Tools, for instance) but it's a time consuming job.
    – Bernard
    May 17 '16 at 21:08

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.