add tag
topnush
I am trying to reproduce 

![Screenshot from 2020-09-13 11-55-55.png](/image?hash=80a4827f3d52c52a95250e4916d53078a58e5a09a280e9110bf706439d9ea141)

but with my own colors.

To make the circles I started with:

```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage{tikz}
\newcommand{\tikzcircle}[3][red]{\tikz[baseline=-0.5ex]{\node[draw={#1}, fill={#1}, circle,text width=#2,minimum width=1.4em,text=black,align=center] at (0,0) {#3};}\hspace{0pt}}%
\definecolorseries{foo}{hsb}{step}{red!90!black}{\pgfmathresult,0,0} 
\resetcolorseries[4]{foo}%
\begin{document}
\begin{frame}
\def\numdots{8}
\def\cols{1,2,3,4,1,2,3,4}
\foreach \x in {1,...,\numdots}{%
  \tikzcircle[{foo!![\cols[\x]]}]{8pt}%
}%
\end{frame}
\end{document}
```

But this is wrong. 

1. I need to be able to choose the colors of each circle.

2. Ideally I would have an outline for the circles as the example screenshot.
Top Answer
marmot
This is merely to honorably mention the amazing `circledsteps` package, which is written by an [amazing squirrel](https://topanswers.xyz/user?id=809&community=tex). :smile_cat: It seems to me that you have reached the point at which you might want to use the circles inside nodes of a `tikzpicture`. However, this prevents you from using a `tikzpicture` for creating these circles as this would mean that you nest `tikzpicture`s (unless you want to use `\savebox`es or play Russian roulette). On the other hand, with the circles created by `circlesteps` there is no problem. (I also think that these circles compile a tiny bit faster, but this is almost impossible to measure.) Then you can use the `matrix` library to create the tables, and to relatively align them to each other.
```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage{circledsteps}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\mycircle}[1][1]{%
\Circled[fill color={foo!![#1]},outer color=blue!60]{\phantom{o}}}%
\def\numcolors{4}
\pgfmathparse{1/\numcolors}%
\definecolorseries{foo}{hsb}{step}{red!90!black}{\pgfmathresult,0,0} 
\resetcolorseries[\numcolors]{foo}%
\begin{document}
\begin{frame}
\frametitle{Using \texttt{circledsteps}}
\centering
\begin{tikzpicture}
\node (crow) {\def\numdots{8}%
\def\cols{1,2,3,4,1,2,3,4}
\foreach \x in {1,...,\numdots}{%
  \pgfmathtruncatemacro{\mycf}{{\cols}[\x-1]}%
  \mycircle[\mycf]\;%
}%
};
\path ([yshift=-1cm]crow.south) node[below right,matrix of nodes,
	ampersand replacement=\&,nodes in empty cells,
	cells={nodes={fill=blue!10,draw=white,minimum width=3em,text height=0.8em}},
	column 1/.style={nodes={fill=none,draw=none,minimum width=0em}}
	] (mat1) {%
	h1 \& ~ \& ~ \& ~\\
	h2 \& ~ \& ~ \& ~\\
};
\path ([xshift=1cm]mat1.south east) 
 node[above right,matrix of nodes,
 ampersand replacement=\&,nodes in empty cells,
	cells={nodes={draw=white,minimum width=3em,text height=0.8em,text depth=0.25ex}},
	every even row/.style={nodes={fill=blue!20}},
	every odd row/.style={nodes={fill=blue!10}}] (mat1) {%
	 |[fill=blue!50]| \& |[fill=blue!50]| h1,g1 \& |[fill=blue!50]| h2,g2\\
	\mycircle[1] \& 2,+\& 1,+\\
	\mycircle[2] \& 3,-\& 2,+\\
	\mycircle[3] \& 1,+\& 3,-\\
	\mycircle[4] \& 2,-\& 3,+\\
};
\end{tikzpicture}

\end{frame}
\end{document}
```
![Screen Shot 2020-09-13 at 12.41.02 PM.png](/image?hash=e824dc37e2ae1888025002ac9cd9b71ad2db241c5e92df8cc5c62638e7638184)

There are various things that one can change/improve, such as the programmatic coloring of the tables. (I am aware of the fact that there are users who find this too hacky, which is why there is also the above code.)
```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage{circledsteps}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\mycircle}[1][1]{%
\Circled[fill color={foo!![#1]},outer color=blue!60]{\phantom{\mbox{o}}}}%
\def\numcolors{4}
\pgfmathparse{1/\numcolors}%
\definecolorseries{foo}{hsb}{step}{red!90!black}{\pgfmathresult,0,0} 
\resetcolorseries[\numcolors]{foo}%
\begin{document}
\begin{frame}
\frametitle{Using \texttt{circledsteps}}
\centering
\begin{tikzpicture}
\node (crow) {\def\numdots{8}%
\def\cols{1,2,3,4,1,2,3,4}
\foreach \x [count=\y] in {1,...,\numdots}{%
  \pgfmathtruncatemacro{\mycf}{{\cols}[\x-1]}%
  \ifnum\y>1\relax\;\fi\mycircle[\mycf]%
}%
};


\path ([yshift=-1cm]crow.south) 
    [cond/.code={%
		\ifnum\pgfmatrixcurrentcolumn>1\relax
 			\tikzset{fill=blue!10,draw=white,minimum width=3em,
			text height=0.8em,text depth=0.2ex}%
		\fi}]
	node[below right,matrix of nodes,
	ampersand replacement=\&,nodes in empty cells,nodes={cond}
	] (mat1) {%
	$h_1$ \&  \&  \& \\
	$h_2$ \&  \&  \& \\
};
\path ([xshift=1cm]mat1.south east) 
    [cond/.code={%
		\ifnum\pgfmatrixcurrentrow=1\relax
 		  \tikzset{fill=blue!50,text=white}%
		\else
		  \ifodd\pgfmatrixcurrentrow
		    \tikzset{fill=blue!10}%
		  \else
		    \tikzset{fill=blue!20}%
		  \fi
		\fi}]
 node[above right,matrix of math nodes,
 ampersand replacement=\&,nodes in empty cells,
	cells={nodes={draw=white,minimum width=3em,
		text height=0.8em,text depth=0.25ex,cond}}] (mat1) {%
	 \& h_1,g_1 \& h_2,g_2\\[0.2ex]
	\mycircle[1] \& 2,+\& 1,+\\
	\mycircle[2] \& 3,-\& 2,+\\
	\mycircle[3] \& 1,+\& 3,-\\
	\mycircle[4] \& 2,-\& 3,+\\
};
\end{tikzpicture}
\end{frame}
\end{document}
```
![Screen Shot 2020-09-13 at 5.01.38 PM.png](/image?hash=18e1d9ea078698320c2d82f06fc0f63c175e677b75ffeddedb15325bb9ed8527)
Answer #2
samcarter
You can iterate over your list rather than counting from 0 to `\numdots`

Some notes about the non-working code:

- to get the numbers into your `\tickcircle` macro, a previous question changed the number of argument to one optional argument and two mandatory arguments - `\tikzcircle[]{}` is missing the second mandatory argument

- `\cols[\x]` is not what you think it is: `1,2,3,4,1,2,3,4[\x]`. You can't just invent syntax and then expect it to work

- the definition of the colour series uses `\pgfmathresult`. If you simply delete the `\pgfmathparse{}` in the line before, you mustn't be surprised if the result is nonsense 

```
\documentclass[xcolor={rgb}]{beamer}

\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm}
\setbeamertemplate{frametitle}[default][center]
\usepackage{tikz}

\newcommand{\tikzcircle}[3][red]{\tikz[baseline=-0.5ex]{\node[draw={#1}, fill={#1}, circle,text width=#2,minimum width=2.5em,text=black,align=center] at (0,0) {#3};}\hspace{0pt}}%


\def\numcolors{4}
\pgfmathparse{1/\numcolors}%
\definecolorseries{foo}{hsb}{step}{red!90!black}{\pgfmathresult,0,0}
\resetcolorseries[\numcolors]{foo}%
\pgfmathsetseed{2}

\usepackage{booktabs}

\begin{document}
\begin{frame}
\foreach \x in {1,2,3,4,1,2,3,4}{%
  \tikzcircle[{foo!![\x]}]{12pt}{}% 
}%

\bigskip

\begin{tabular}{lll}
\toprule
& something & something\\
\midrule
\tikzcircle[{foo!![1]}]{12pt}{} & circle 1 & something\\
\tikzcircle[{foo!![2]}]{12pt}{} & circle 2 & something\\
\tikzcircle[{foo!![3]}]{12pt}{} & circle 3 & something\\
\tikzcircle[{foo!![4]}]{12pt}{} & circle 4 & something\\
\bottomrule
\end{tabular}

\end{frame}
\end{document}
```

![Screen Shot 2020-09-13 at 13.32.41.png](/image?hash=626b908a07d1b7fa600fcd0c2e15a432541484970660322114c3ee7e5314f8e7)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.