I recently wrote a dice package customdice that can do this.
The command to draw standard dice is \dice{n}
. The content inside the {...} looks to me like it is sitting below the line, because it is in line with the surrounding text and the {...} part is below the line. In the customdice package, I provided a command \setdicebaseline{} which can be increased from its default of 0.02 to lower the drawing. Via trial and error, I came to think 0.2 looked okay. This is demonstrated below.
\documentclass{article}
\usepackage{customdice}
\begin{document}
\[ \Omega = \{\dice{1},\dice{2},\dice{3},\dice{4},\dice{5},\dice{6}\} \]
\setdicebaseline{0.2}
\[ \Omega = \{\dice{1},\dice{2},\dice{3},\dice{4},\dice{5},\dice{6}\} \]
\end{document}
This produces output like this
There are various options within the package to customise the size and colour of the dice faces.
You would need to \setdicebaseline{0.02}
if you later want to use \dice
inline with regular text.
Actually, I would probably prefer to reduce the amount of code needed to produce the equation by writing a little loop in a command I've called \drawdice
, like this.
\documentclass{article}
\usepackage{customdice}
\newcounter{num_dice}
\newcommand{\drawdice}[1]{%
% count the items
\foreach \i in {#1}{%
\setcounter{num_dice}{\i}
}%
% draw a dice for each
\foreach \i in {#1}{%
\dice{\i}%
\ifnum\i<\value{num_dice}% include a comma if it's not the last one
,%
\fi%
}
}
\begin{document}
\setdicebaseline{0.2}
\[ \Omega = \{\drawdice{1,2,3,4,5,6}\} \]
\[ \Omega = \{\drawdice{1,3,5,6,8}\} \]
\[ \Omega = \{\drawdice{2,4,6}\} \]
\[ \Omega = \{\drawdice{6}\} \]
\end{document}
Which produces
\[ \Omega = \drawdie{0}, \drawdie{1}, \drawdie{3}... \]
etc.