I try to format a CSV file as a table and ran into the issue that the csvsimple
package repeats the head elements after a % sign appears in the file. Consider the following MWE (strongly reduced from my original classicthesis file):
\documentclass[paper=a4]{scrreprt}
\RequirePackage{tabularx}
\usepackage{filecontents}
\RequirePackage{csvsimple}
\csvset{every csv/.style={
separator=semicolon,
respect percent
}}
\begin{filecontents*}[overwrite]{Courses.csv}
A;B;C;D;E;F;G;Portion;H;I
a;b;c;d;e;f;g;100%;1,00;3,00
a;b;c;d;e;f;g;100%;2,00;4,00
\end{filecontents*}
\begin{document}
\begin{table}[h]
\centering
\begin{tabularx}{\textwidth}{XXXXXXXXXX}
\csvreader[no head, late after line=\\]{Courses.csv}{}{\csvlinetotablerow}\\
\end{tabularx}
\end{table}
\end{document}
Note that the % signs are missing in the first and second data row (second and third row of the table) and that the last two columns are filled with the column headings instead of the content. I verified that csvsimple is configured to respect % signs (see package options) and that the output of filecontents is actually correct. (Note: Even respect all
does not change this behavior)
Oddly, if I remove the no head
flag, csvsimple prints the first table row correctly, but skips all remaining rows. Even if I add 100 additional rows, only 1 is printed:
I am a bit lost on what else to try. How can I can configure/convince csvsimple to print all rows correctly in my table?