How does the counter in TikZ \foreach work?
By trial and error, it seems like whenever TikZ has an ambiguous step increment size, it simply assumes the previous integer current index minus one, as the step size. In other words, when you enter {1,...4,6,...20}
, it gives you {1,2,3,4,6,11,16}
with step size 6-1=5
and similarly if you enter {1,...4,8.7,...25}
you get {1,2,3,4,8.7, 16.4, 24.09999}
with step size 8.7-1=7.7
. You can test it for yourself using
\begin{tikzpicture}
\foreach \x in {1,...,4,8,...,25}
{\node at (\x / 2,0) {$\x$};}
\end{tikzpicture}
It also applies to letters such that
\begin{tikzpicture}
\foreach \x [count = \xi] in {a,...,c,f,...,z}
{\node at (\xi,0) {$\x$};}
\end{tikzpicture}
results with a,b,c,f,k,p,u,z
This is not an answer to your question but it's a way of drawing your black and blue ticks
with two \foreach
help.
\documentclass[11pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,10)-- (15,10);
\foreach \x in {0,...,4}{
\draw (3*\x,10)--++(0,-0.2);
\foreach \j in {1,...,4}
\draw[draw=blue] ({3*(\x+\j/5)},10)--++(0,-0.2);
}
\draw (3*5,10)--++(0,-0.2);
\end{tikzpicture}
\end{document}