In my work with linear algebra and matrices I have been quite restricted by LaTeX2 and its maximum of 9 arguments that may be passed to a \newcommand. While LaTeX3 imposes that same limitation for the \NewDocumentCommand I noticed (with considerable excitement) that the xparse package provides a number of argument processors which will work around this limitation. In particular \SplitArgument appears to offer just what I need. Regrettably I am quite unable to extract enough information from my reading of the interface3 documentation to write the layer that will use the data extracted by \SplitArgument and put them where I need them. The code below I hope is self-explanatory; it compiles for \myNinePerm but does not compile for mynPerm for obvious reasons. I am sure an answer to my problem would not only be a great help to me but serve all newcomers to TeX and LaTeX3 as a welcome practical example.
%document name: LaTeX3_xparse2.tex
%RN 16/3/2012
%COMMENTS:
% OBJECTIVE: Want to populate an nxn matrix by passing its elements separated by semicolons
% as a single argument rather than by passing them individually (which poses the restriction
% to 3 x 3 matrices since LaTeX3 imposes the same maximum number of arguments, 9, as does
% LaTeX2). LaTeX3 and one or other of the argument processors in xparse, for instance
% \SplitArgument will to the job, but once again, due to the lack of at least one concrete
% example, I cannot get the syntax right, especially for the internal function!
% APPROACH:
% (1) Have a simple function, call it \myNinePerm which displays a permutation of a 9-set
% as a 2 x 9 matrix with the top row showing the elements of the set in natural order and
% row 2 allowing the user to plug in their images under the mapping as individual arguments
% by passing the values as arguments(the LaTeX2 approach);
% (2) rewrite this same function by passing a single argument which contains the values
% separated by some token, for example a semi-colon. The restriction to nine elements is no
% longer relevant, but is maintained in order to avoid clouding the issue.
%==============================================================================================
\documentclass{article}
%\usepackage{expl3}
\usepackage{amsmath,xparse}
\ExplSyntaxOn
\NewDocumentCommand{\myNinePerm}{ m m m m m m m m m }
{
{\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
#1 & #2 & #3 & #4 & #5 & #6 & #7 & #8 & #9
\end{pmatrix}}
}
\ExplSyntaxOff
\ExplSyntaxOn
\NewDocumentCommand{\mynPerm}{ m }
{ > { \SplitArgument { 8 } { ; } } m }
% assuming that the argument now contains nine values, how do I move these values to
% occupy the second row in the matrix below?
{
{\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
% <val 1>&<val 2>&<val 3>&<val 4>&<val 5>&<val 6>&<val 7>&<val 8>&<val 9>
\end{pmatrix}}
}
\ExplSyntaxOff
\begin{document}
$\myNinePerm{9}{8}{7}{6}{5}{4}{3}{2}{1}$\\
$\mynPerm{{9;8;7;6;5;4;3;2;1}}$\\
\end{document}

interface3document. At the same time, inferior or not, I would still like to grasp the detail of the\SplitArgumentapproach. – Reinhard Neuwirth Mar 16 '12 at 11:54\mynPerm, don't you? – Bruno Le Floch Mar 17 '12 at 10:01