[Tex/LaTex] epsdice does not respect beamer overlay with \setbeamercovered{dynamic}

beameroverlays

I am trying to use the package epsdice in a beamer presentation.

This package provides the command \epsdice which takes a numerical argument between 1 and 6 and draws the corresponding face of a die. (It's quite useful for teaching Probability.)

I have noticed the following problem. If I use \setbeamercovered{dynamic}, then any instance of \epsdice inside an overlay appears in all the frames, ignoring the overlay specification.

I'm guessing that this is because all epsdice does is to include a portion of a PDF file containing the corresponding face of the die and there is no way to control its opacity.

Still, if anyone has any ideas on how I could get this to work, I'd be grateful.

Best Answer

For fun, here's a very quick mock up of a tikz replacement. Still needs tweaking, obviously.

\documentclass[border=2em]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
  \draw[very thick, rounded corners] (0,0) rectangle (1,1);
  \node[ellipse,fill=black,minimum height=0.1em] at (0.5,0.5){};
\end{tikzpicture}
\end{document}

a die


Clearly, I have too much time on my hands. Here's a customisable tikz-y replacement for epsdice:

\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
}

\def\dotsize{0.1}

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

\drawdie{3}

\drawdie[line colour=red]{4}

\drawdie[dot colour=blue]{6}
\end{document}

This uses the trick of optional arguments from over here. The mandatory argument is the number and the optional argument takes one of two keys line colour=<colour> and dot colour=<colour> where <colour> is any colour tikz recognises.

enter image description here

Related Question