2

I'm looking to create a function or a macro that takes as an input a number n between 0 and 5 and returns five circles with the n leftmost circles filled, something like this:

circles, some filled

I'm still reading documentation, but I've never made a macro or a function like this before, so I cannot show a MWE. Any help will be appreciated.

Thank you very much in advance!

3

Here you go, basically the same macro you'll find here, but modified a bit to look like the picture you posted (No underline dots included).

To use it just put \dotexp{<n>} wherever you need.

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\definecolor{rpgblue}{HTML}{1A5A75}

\newcommand{\dotexp}[1]{%
\edef\DEnum{\the#1}%
\tikz{\foreach \x in {1,...,5}{\draw[rpgblue,fill=rpgblue] ({\x/2.5+0.01},0) circle (.58ex);
      \ifnum\x>\DEnum
        \def\DEfill{white}%
      \else
        \def\DEfill{rpgblue}%
      \fi
      \draw[\DEfill,fill=\DEfill] (\x/2.5,0) circle (.5ex);}}%
    }

\begin{document}
\newcount\x
\x=0
\loop
 \the\x\dotexp{\x}

 \advance \x by 1
 \ifnum\x<6
\repeat
\end{document}

Not the answer you're looking for? Browse other questions tagged or ask your own question.