# How to iterate foreach with two variables and a list of values

Iteration with foreach brings error in the moment I use a list with two variables as you can see in the mwe. Is there a solution possible? As the output PDF shows the error occurs when trying to use a list. Howto integrate the mwe?

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}

\begin{document}
%two variables
\foreach \x   in    {1.00,1.033,...,2.000,2.033,2.083,...,3.000,3.050,3.15,...,4.000}
{
x \x ;
}

% output 3 series of variables(x and y). 1. between 1 and 2 thirty steps,   2. betw. 2 a. 3 twenty steps, 3. betw. 3 a. 4 ten steps. thats the aim. here  shortened to the end of three(3.000)
\foreach \x / \y in
%{1.00/1.033,1.033/1.066}% 0 errors, pdf ok
{1.00/1.033,1.033/1.066,...,2.000/2.033} % 63 errors, pdf output gen  erated! shows wrong variable contents
% third version 88 errors, but pdf generated! shows wrong variable values
%{1.00/1.033,1.033/1.066,...,2.000/2.033,2.033/2.066,2.116/2.166,...,3.000/3.050}
{
x1: \x,  y1: \y \\
}
\end{document}

• Not sure, but could you use an alternative notation? As an example: \foreach \x [evaluate=\x as \y using \x+0.033] in {1.0,1.033,...,2.0} { x1: \x, y1: \y \\} – Ignasi Jan 11 '16 at 9:44
• @ignasi that gives an emergency stop don't know why. Your syntax is a nice proposal. But I see no solution for the three series of two variables I need. The addition \x+0.033 must change. – gizeh Jan 11 '16 at 10:03
• @gizeh Ignasi's code worked for me. It's very odd that it gave you an emergency stop. Also, how the addition must change? Is the 0.033 addition not a constant? – Alenanno Jan 11 '16 at 10:22
• My code works for me. You can type this three-part-series with three different foreach. Why do you want only one? – Ignasi Jan 11 '16 at 10:26
• If you want to automatically type complex tables you could also use pgfplotstable which is part of pgfplots. – Ignasi Jan 11 '16 at 10:28