32

I'm looking for symbols for dice faces. So far, I've found these two possibilities: The command \Cube{n} in the ifsym package, and the command \dice{n} in the epsdice package.

However, both commands only allow the standard symbols for n = 1..6.

What I'm looking for are dice symbols that include the digits 7, 8, 9 as they can be found in some extended versions of domino games.

The number 7 should look like this:

* *
***
* *

The number 8 like this:

***
* *
***

and the number 9 like this:

***
***
***

For completeness, it would also be nice if there is a blank face symbol for the digit n=0.

Is there any package allowing me to do this? If not, can anyone show me how to produce such symbols?

5
  • Welcome to TeX.sx!, we usually dont put a thank you in the question. Hence, I have removed it. :)
    – nickpapior
    Commented Mar 15, 2013 at 13:38
  • 3
    @zeroth: ok...May I say thank you now? :)
    – azimut
    Commented Mar 15, 2013 at 13:40
  • 1
    In the ifsym package the dice are created in metafont (so the symbols are characters in a font), and in epsdice the dice are created in PostScript and the symbols are images clipped from a multipage file. So if you want to extend those packages you have to use either metafont or PostScript. As for "If not," you are bound to get several TikZ solutions soon. Commented Mar 15, 2013 at 13:44
  • @MatthewLeingang: I am using LaTeX (pdflatex) a lot, but I have to admit that I don't have much of an idea what is going on under the hood (concerning characters, fonts, etc). What do you think is the preferable way? Adjusting ifsym, adjusting epsdice or using TikZ?
    – azimut
    Commented Mar 15, 2013 at 13:51
  • @azimut: definitely, TikZ is the way to go. Using Metafont and ifsym restricts you to bitmap fonts (unless you want to learn Metatype1, which you don't;)), epsdice is a Postscript solution so it might be nontrivial to get it to work with pdflatex, and TikZ is both supported by pdflatex and easy to learn/use.
    – mbork
    Commented Mar 15, 2013 at 14:06

4 Answers 4

33

A tikz solution is obtained by modifying the answer https://tex.stackexchange.com/a/41628/15925

Sample output

\documentclass[border=0.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}
\tikzset{
  dot hidden/.style={},
  line hidden/.style={},
  dot colour/.style={dot hidden/.append style={color=#1}},
  dot colour/.default=black,
  line colour/.style={line hidden/.append style={color=#1}},
  line colour/.default=black
}

\usepackage{xparse}
\NewDocumentCommand{\drawdie}{O{}m}{%
\begin{tikzpicture}[x=1em,y=1em,radius=0.1,#1]
  \draw[rounded corners=0.5,line hidden] (0,0) rectangle (1,1);
  \ifodd#2
    \fill[dot hidden] (0.5,0.5) circle;
  \fi
  \ifnum#2>1
    \fill[dot hidden] (0.2,0.2) circle;
    \fill[dot hidden] (0.8,0.8) circle;
   \ifnum#2>3
     \fill[dot hidden] (0.2,0.8) circle;
     \fill[dot hidden] (0.8,0.2) circle;
    \ifnum#2>5
      \fill[dot hidden] (0.8,0.5) circle;
      \fill[dot hidden] (0.2,0.5) circle;
     \ifnum#2>7
       \fill[dot hidden] (0.5,0.8) circle;
       \fill[dot hidden] (0.5,0.2) circle;
      \fi
    \fi
  \fi
\fi
\end{tikzpicture}%
}  
\begin{document}

\drawdie{0}
\drawdie{1}
\drawdie[radius=0.5pt]{3}
\drawdie{7}
\drawdie[line colour=blue,thick]{8}
\drawdie[scale=0.5,dot colour=green,very thin,line hidden/.append style={fill=red}]{9}

\end{document}

The changes I have made are to add an extra case for numbers >7 (7 worked already) and removed the thick default for the border, allowing it to be set to other values in smaller sizes. I have also removed the external dotsize variable and given an example of filling.

0
18

You can use also the domino font:

\documentclass{article}
\font\domino=domino
\def\die#1{{\domino#1}}
\begin{document}
Normal dice: \die1 \die2 \die3 \die4 \die5 \die6 \par 
Extended version:  \die7  \die8 \die9 \die0  
\end{document}

mwe

5
  • 3
    Just to be picky: “dice” is already a plural form.
    – egreg
    Commented Jan 7, 2016 at 14:04
  • 4
    @egreg My English vocabulary about games is null, but I'm going to die of embarrassment, I never imagined that was a gloomy plural. Fixed up.
    – Fran
    Commented Jan 7, 2016 at 15:46
  • 1
    @Fran: Whereas die is ... a nice pun? :D
    – user31729
    Commented Jan 7, 2016 at 15:46
  • @ChristianHupfer Not particularly nice, just the one that came to my mind. :)
    – Fran
    Commented Jan 7, 2016 at 15:51
  • 1
    It's all a bit dicey, actually. According to the Oxford dictionary, "in modern standard English dice is both the singular and the plural"...
    – PatrickT
    Commented Mar 19, 2018 at 9:31
6

(Yes, I'm adding an answer to a 7.5-year-old question).

I teach a decision sciences (math / stats) class and needed to produce a variety of icons including a 36-pair graphic of six-sided dice (seen below). That was enough to push me to make a quick, single purpose function library based on Andrew Swann's answer, above, and then to extend it to include 0-, 7-, 8-, and 9-pip icons. The code can be found at

https://github.com/jessehamner/tikzdice

Here's a screenshot of a small example (the code to make this document and one small Beamer document are also available in the repository).

screen capture of a LaTeX document displaying various dice icons

2
  • This is fantastic!
    – Simd
    Commented Sep 30, 2020 at 20:43
  • You can consider making it a package.
    – hola
    Commented Sep 30, 2020 at 23:47
5

I saw this a couple of weeks after making a dice package customdice. I didn't think of wanting 7, 8, or 9 dots, but it is straightforward to do so I incorporated this into an update v1.1.

This code

\documentclass{standalone}
\usepackage{customdice}
\begin{document}
   \dice{0}
   \dice{1}
   \dice{2}
   \dice{3}
   \dice{4}
   \dice{5}
   \dice{6}
   \dice{7}
   \dice{8}
   \dice{9}   
\end{document}

produces dice like this

dice faces showing 0 to 9 dots

There are various options within the package to customise the size and colour of the dice faces.

2
  • Thanks, I have done! Commented Aug 11, 2022 at 17:20
  • Great package API.
    – projetmbc
    Commented Jan 31 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .