For example, in the following MWE, there're 12 elements in the first line of the array while the second line of the array has 10 elements, so I'd like a command that can automatically printed the number of elements in the row with the largest number of elements in the array: 12.
MWE:
\documentclass[tikz]{standalone}
\ExplSyntaxOn
\seq_new:N \l_node_row_seq
\seq_new:N \l_node_tmp_seq
\cs_set:Npn \timelist #1 {
\seq_set_split:Nnn \l_node_row_seq {;} {#1}
\int_step_inline:nn{\seq_count:N \l_node_row_seq}
{
\seq_if_exist:cF {l_node_row_##1_seq}
{
\seq_new:c {l_node_row_##1_seq}
}
\exp_args:Ncx\seq_set_from_clist:Nn {l_node_row_##1_seq} {\seq_item:Nn \l_node_row_seq{##1}}
}
}
\cs_set:Npn \PrintTime [#1][#2] {
\tl_if_empty:nTF { #1 }
{
\tl_if_empty:nTF { #2 }
{
\seq_use:Nn \l_node_row_seq {,}
}
{
\int_step_inline:nn{\seq_count:N \l_node_row_seq}
{
\seq_put_right:Nn \l_node_tmp_seq {\seq_item:cn {l_node_row_##1_seq}{#2}}
}
\seq_use:Nn \l_node_tmp_seq {,}
}
}
{
\tl_if_empty:nTF {#2}
{
\seq_use:cn {l_node_row_#1_seq}{,}
}
{
\seq_item:cn {l_node_row_#1_seq}{#2}
}
}
}
\ExplSyntaxOff
\usetikzlibrary{calc}
\begin{document}
\timelist{
3,.,1,4,1,5,9,2,6,5,3,5;
2,.,7,1,8,2,8,1,8,2}
\tikz
{
\foreach \x in {1,2,...,12}
{
\node[xshift=.5\x in] at (-\x,1) {\texttt{\PrintTime[1][\x]}};
\node[xshift=.5\x in] at (-\x,0) {\texttt{\PrintTime[2][\x]}};
}
}
\end{document}
Now if there's a command, for example, the name of the command is count, then if I input
\count{
3,.,1,4,1,5,9,2,6,5,3,5;
2,.,7,1,8,2,8,1,8,2
}
Then it will print 12 automatically. How can I realize it?
