1

I want to draw a special chart, for which the data are given as shown in the minimal example: The first row shows years, the first column Companies and at the cross-points you find a string of data. Using the readarray package, I can extract each cell. Furthermore, I also want to break down the sting of data. For such a task, the listofitems comes along the readarray package. However, I fail to do so. The (not) working examples leads to

Paragraph ended before \dataA was complete.

Using \numberlen, which is supposed to show the number of list entries, I got 2 -- not 4.

Does anybody have a hint on a solution?

\documentclass{article}
\usepackage{readarray}
\readarraysepchar{;}
\setsepchar{,}

\begin{document}
\def\dataF{%
;2014;2015
A;36,3,29,4;35,6,27,8
B;19,4,35,7;23,10,33,7}
\readarray*\dataF\dataA[2,2]

\begin{tabular}{c|c}
    \dataA[1,1] & \dataA[1,2] \\
    \dataA[2,1] & \dataA[2,2] \\
\end{tabular}

\readlist*\numbers{\dataA[2,2]}

%\def\numbersF{\Daten[2,2]}
%\readlist*\numbers{\numbersF} % fails as well

\begin{tabular}{c|c}
    \dataA[1,1] & \dataA[1,2] \\
    \dataA[2,1] & \dataA[2,2] \\
    \dataA[2,1] & \number[1] \\
\end{tabular}

\end{document}

1 Answers1

0

You had a few typos, and one misunderstanding (need \edef rather than \def).

  1. \def\numbersF... should be \edef\numbersF...

  2. {\Daten[2,2]} should be {\dataA[2,2]}

  3. & \number[1] \\ should be & \numbers[1] \\

The revised MWE:

\documentclass{article}
\usepackage{readarray}
\readarraysepchar{;}
\setsepchar{,}

\begin{document}
\def\dataF{%
;2014;2015
A;36,3,29,4;35,6,27,8
B;19,4,35,7;23,10,33,7}
\readarray*\dataF\dataA[-,2]

\begin{tabular}{c|c}
    \dataA[1,1] & \dataA[1,2] \\
    \dataA[2,1] & \dataA[2,2] \\
\end{tabular}

\readlist*\numbers{\dataA[2,2]}

\edef\numbersF{\dataA[2,2]}
\readlist*\numbers{\numbersF} % fails as well

\begin{tabular}{c|c}
    \dataA[1,1] & \dataA[1,2] \\
    \dataA[2,1] & \dataA[2,2] \\
    \dataA[2,1] & \numbers[1] \\
\end{tabular}

\end{document}

enter image description here