Package ‘epsdice’ — a scalable dice font

2001/02/11 – Version 1.0 Thomas Heim (thomas.heim@unibas.ch)

1 Introduction

Dice fonts are already available in metafont format.

     \begin{ShamelessPlug}

I should know, I wrote one myself: dice3d.mf

     \end{ShamelessPlug}

For some applications it seems preferable, however, to have the fonts in scalable form. The package epsdice fills this gap.

epsdice.sty provides a single command, \epsdice{#1}. It takes one argument, an integer from 1 to 6. The value of a counter is allowed as an argument, too, so automatic representation of (generated or input) data is possible as well. Depending on the value of the argument, \epsdice includes the appropriately clipped region from the encapsulated PostScript file epsdice.eps that contains simple drawings of dice faces. The drawings scale with the current font because the height of the included graphics file is set in terms of ‘ex’ units.

2 Requirements and limitations

epsdice relies on the graphicx package with package option [dvips] to include the encapsulated PostScript file. It also uses the ithen package to validate the arguments (error checking).

Although the PostScript file is rather small, including it too many times may not be desirable.

3 Configuring this package

To install the package, simply move the following files somewhere in your

“local texmf tree”: epsdice.{sty, eps, cfg}, as well as diceface.eps.
I suggest a new subdirectory /$LOCALTEXMF/tex/latex/epsdice/*, where

$LOCALTEXMF stands for your “local texmf tree” (what a surprise). Refresh your TEX-system’s file name database, and that’s it, you’re all set! The remainder of this section applies only if you want to change the default settings.

The command \epsdice works by including an encapsulated postscript file, so this file must be found by L^{A}TEX 2ε. The package comes with a configuration file epsdice.cfg containing the file name in the variable \dicefile. By default, this variable points to the file epsdice.eps (without file name extension). If you don’t like my drawings and would like to “roll your own” (PostScript code, not dice), a look at the file diceface.eps may help. It contains the same PostScript code as epsdice.eps, with some comments about what’s going on. If you intend to keep the .eps file with the dice drawings in a different place or if you want to use your own version you have to edit the configuration file epsdice.cfg accordingly, by adding the path to the file name, or by changing the file name in the variable \dicefile.

If a configuration file does not exist, the file epsdice.eps is assumed to be located in the present working directory.

4 Examples

This text shows dice faces in an 11pt environment: . The pictures fit into the surrounding text.

Here is some large text. The dice pictures scale accord-

ingly:1 . See? The package works with standard counters, too: Here’s

the result of \epsdice{\value{page}} .

5 Errors

Of course it doesn’t make sense to ask for dice faces with arguments other than 1, 2, 3, 4, 5, or 6. The package generates error messages and simply prints the offending argument in the TEX output. Uncomment the final lines in this documentation to see this feature in action.

1… as they do in footnotes, , like this.