3

I would like to write multiple dots in some formation (in circle, in a row, etc.) within text or formulas. Somewhat similar like the token dots in petri nets, which made me look into the TeX/Tikz petri net package. But I need the dots independently from petri net drawings.

To make it more clear, I would like to be able to do something like this:

Some text and now \tokens{3} and some more text.

Or alternatively within math mode:

$dots(3) = \mathtokens{3}$

I any case, I need to put the (in this case 3) dots in-line.

ternary
  • 133
  • 1
    Welcome to TeX.SE. When you have a bit of the time, please visit before the fantastic site TeX.SE. and read these link: https://tex.meta.stackexchange.com/questions/3300/minimum-working-example-mwe and https://tex.meta.stackexchange.com/questions/3932/new-users-how-to-do-good-questions-and-answers. – Sebastiano Jul 20 '19 at 11:45

1 Answers1

5

For straight-line dots, this approach may suffice...

\documentclass[12pt]{article}
\usepackage{stackengine}
\newcommand\tokendots[1]{\ifnum#1>0\relax
  {\ensuremath{\cdot}}\tokendots{\the\numexpr#1-1}\fi}
\newcommand\stackedtokendots[2]{%
  \stackanchor[-2pt]{\tokendots{#1}}{\tokendots{#2}}}
\begin{document}
Some text and now \tokendots{2} and some more text.

$dots(5) = \tokendots{5} = \stackedtokendots{2}{3}$

$dots(6) = \stackedtokendots{3}{3}$
\end{document}

enter image description here