TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I create a "dotted counter" like the one in the picture. enter image description here

\documentclass{article}

\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}

    \end{tikzpicture}
\end{document}
share|improve this question
4  
That is just filled circles with different colors. Should not be hard to find in the manual. – daleif Mar 26 at 18:59
3  
I'm not sure why this should be down voted rather than answered unless it is a duplicate. – A Feldman Mar 26 at 19:13
2  
Very related: Drawing stars/similar with Tikz – Jake Mar 26 at 19:36
    
I think this can be generated with just a loop and \textbullet and colour settings as well. – Christian Hupfer Mar 26 at 20:08
up vote 19 down vote accepted

For fun, here is how to implement this using the visualcounter module in ConTeXt (Full disclosure: I am the author of the module).

\usemodule[visualcounter]

\definepalet
  [ratings]
  [
    active=black,
    past=black,
    future=gray,
  ]

\definevisualcounter
  [ratings]
  [markers]
  [
    last=8,
    palette=ratings,
  ]

\starttext
\starttabulate[|l|l|]
  \NC Adobe Photoshop   \NC \usevisualcounter[n=7]{ratings} \NC \NR
  \NC Adobe Illustrator \NC \usevisualcounter[n=8]{ratings} \NC \NR
  \NC Adobe Indesign    \NC \usevisualcounter[n=7]{ratings} \NC \NR
\stoptabulate
\stoptext

which gives

enter image description here

share|improve this answer
    
Nice! can this be used in any other TeX flavor? – A Feldman Mar 27 at 3:00
    
@AFeldman, no. It uses metapost in the background and in principle the module can be ported to lualatex, but that would require recreating a lot of the core functionality of ConTeXt. – Aditya Mar 27 at 3:06
    
Thanks for the information. – A Feldman Mar 27 at 3:07

Something like this?

\documentclass[tikz,multi,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}
  \path (0,0) foreach \i in {fill,fill,fill,fill,fill,fill,fill,} {++(.5,0) node [circle, draw, \i] {}};
\end{tikzpicture}
\end{document}

counter

share|improve this answer

A very elementary style with tikz, not too sophisticated.

\documentclass{article}

\newcounter{numofdots}


\usepackage{tikz}
\def\myscale{0.5}
\begin{document}
\begin{description}
  \item[Adobe Photoshop]\hfill
  \begin{tikzpicture}
    \setcounter{numofdots}{7}
    \foreach \x in {1,...,8} {%
    \ifnum \x > \value{numofdots}
    \draw[fill=gray,gray] (\x*\myscale,-1) circle (0.1cm);
    \else
    \draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
    \fi
    }
  \end{tikzpicture}
\item[Adobe Illustrator]\hfill
  \begin{tikzpicture}
    \setcounter{numofdots}{8}
  \foreach \x in {1,...,8} {%
    \ifnum \x > \value{numofdots}
    \draw[fill=gray,gray] (\x*\myscale,-1) circle (0.1cm);
    \else
    \draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
    \fi
  }
\end{tikzpicture}
\item[Adobe Indesign]\hfill
  \begin{tikzpicture}
    \setcounter{numofdots}{7}
    \foreach \x in {1,...,8} {%
      \ifnum \x > \value{numofdots}
      \draw[fill=gray,gray] (\x*\myscale,-1) circle (0.1cm);
      \else
      \draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
      \fi
    }
  \end{tikzpicture}
\end{description}
\end{document}

Update

Something easier to use:

\documentclass{article}

\newcounter{numofdots}

\newcommand{\showdots}[3][gray]{%
  \begin{tikzpicture}
    \foreach \x in {1,...,#2} {%
    \ifnum \x > #3
    \draw[fill=#1,#1] (\x*\myscale,-1) circle (0.1cm);
    \else
    \draw[fill=black] (\x*\myscale,-1) circle (0.1cm);
    \fi
  }
  \end{tikzpicture}%
}



\usepackage{tikz}
\def\myscale{0.5}
\begin{document}
\begin{tabular}{ll}
Adobe Photoshop & \showdots{8}{7}\tabularnewline
Adobe Illustrator &\showdots{8}{8}\tabularnewline
Adobe Indesign & \showdots[red]{8}{7} \tabularnewline
\LaTeXe & \showdots[gray]{15}{15} \tabularnewline
Word & \showdots[gray]{15}{0} \tabularnewline
\end{tabular}
\end{document}

enter image description here

Update again -- Just using a plain loop and not Ti*k*Z

\documentclass{article}
\usepackage{xcolor}
\newcounter{numofdots}

\newcommand{\showdots}[3][gray]{%
  \setcounter{numofdots}{0}
  \loop\unless\ifnum\value{numofdots} = #2
  \stepcounter{numofdots}%
  \ifnum\value{numofdots} > #3
  {\color{#1}\textbullet\hskip0.5em}%
  \else
  \textbullet\hskip0.5em%
  \fi
  \repeat%
  \hfill
}



\def\myscale{0.5}
\begin{document}
\begin{tabular}{ll}
Adobe Photoshop & \showdots{8}{7}\tabularnewline
Adobe Illustrator &\showdots{8}{8}\tabularnewline
Adobe Indesign & \showdots[red]{8}{7} \tabularnewline
\LaTeXe & \showdots[gray]{15}{15} \tabularnewline
Word & \showdots[gray]{15}{0} \tabularnewline
\end{tabular}
\end{document}
share|improve this answer

Without TikZ and without loops:

mwe

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabto}
\TabPositions{\dimexpr0.5\linewidth-10.001em, \dimexpr0.5\linewidth}

\def\score#1#2{\tab\makebox[10em][l]{\sffamily #1}\tab%
\makebox[#2em]{\cleaders\hbox to 1em{\Large\hss$\bullet$\hss}\hfill}%
\makebox[\dimexpr10em-#2em]{\color{gray}\cleaders%
\hbox to 1em{\Large\hss$\bullet$\hss}\hfill}\par} 

\begin{document}

\score{Above roof}{5}
\score{Above ground level}{2}
\score{Above clouds}{9}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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