This answer shows me how I can handle an arbitrary number of arguments. I have adapted it a bit to my purpose:
\usepackage{pgffor}
\newcommand*{\twolinematrix}[1]{%
\foreach \firstrowelement/\secondrowelement in {#1} {%
<something should happen here!}%
}
}
The above macro should take input like this as an example: \autotwolinematrix{1/6, 2/7, 3/8, 4/9, 5/10}.
I have become stuck because, normally, if you want to create a matrix (assuming you have amsmath loaded), you would so something like:
\newcommand{\manualtwolinematrix}[10]{%
\begin{matrix}
#1 & #2 & #3 & #4 & #5 \\
#6 & #7 & #8 & #9 & #10
\end{matrix}%
}
So, this suggests that you'd need to have logic that knows when you are about to be done with the element pairs, because you have to put the \\. I think if we are programmatically generating the matrix, it would be better to think of it like this:
\newcommand{\manualtwolinematrix}[10]{%
\begin{matrix}
#1 & #2 & #3 & #4 & #5 \\ #6 & #7 & #8 & #9 & #10
\end{matrix}%
}
where #1 & #2 & #3 & #4 & #5 \\ #6 & #7 & #8 & #9 & #10 is the string that has to be auto-generated within the body of our macro. Our macro gets input pairwise, so we have to generate this string given pairs. Okay, then in the body of our macro, we should have two variables: call it \firstrow and \secondrow.
The \firstrow and \secondrow should be built up sequentially, given each pair of elements, and then finally a variable called \matrixbody should be generated like so:
\matrixbody = \firstrow \\ \secondrow
Can you help me put these thoughts together?

