Attempting to write a command that will produce a line of circles with the first n filled. Desired functionality would be \IBmark{l}{m} where l is the length of the line and m is the number of filled circles.

Using LaTeX in overleaf


Is my best attempt to get this working using the tikz package however it returns this


For l = 5, and m = 3 rather than the desired


Attempts to use the rounding allowed by the pgf print command returned worse results. I can not seem to find a way to remove the error.

  • Try adding int, as in \pgfmathparse{int(#1-#2)} Apr 24, 2020 at 10:27

3 Answers 3


You need to add int(...) to the \pgfmathparse calculation.

Also, in this implementation, the use of \textbf is irrelevant and is thus removed.


enter image description here


Welcome! From the pictures I take that you might want something like this:

\path (1,-0.25ex) node (X) {\vphantom{X}}foreach \X in {1,...,#1}
{(\X*1.2em,0) node[circle,draw,minimum size=1em,cfill] {}};
Hello \IBmark{5}{3}.

enter image description here

You can adjust the vertical position of the phantom node to get any alignment you want. In principle one does not need TikZ for that but it is certainly very easy to get this done with TikZ.


If we are using OpTeX then we can do:

\def\ibmark#1#2{\fornum 1..#1\do{\ifnum##1>#2$\circ$\else$\bullet$\fi}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .