I would like to to get this:
I tried using ifthenelse inside foreach but I get an error: Missing number, treated as zero.
<to be read again>
=
l.9 }. Here esdd says "\ifthenelse is "normal" LaTeX code. Therefore you can not use this command inside a TikZ path specification." However, I do not know how to fix this the problem.
Here is my code:
\documentclass[border=0.2cm]{standalone}
\usepackage{tikz}
\usepackage{ifthen}
\begin{document}
\begin{tikzpicture}
\foreach \y in {0,0.2,0.4,...,1.6}{
\ifthenelse{\y==1.6}{\draw [thin,-latex] (-0.8,1.6) -- (-0.3,1.6) node [above,midway] {U};}{\draw [thin,-latex] (-0.8,\y) -- (-0.3,\y);}
}
\end{tikzpicture}
\end{document}


=, but it can only compare integers. – egreg Feb 18 '16 at 18:34foreachfrom 1.6 to 1; then I tried using\ifthenelse{\y=1}but it does not work. – Marco Feb 18 '16 at 18:40=test in ifthen (not ==) is n\ifnumso only for integers – David Carlisle Feb 18 '16 at 18:47