Closed pkl97 closed 9 months ago
This is a known incompatibility which is documented on page 55 of the documentation. S
cannot be used as a first or last column.
Fortunately, it is easy to circumvent the problem. The best choice is to use \tablenum
instead of an S
column:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple-l3}
\usepackage{siunitx}
\begin{filecontents}[overwrite,noheader]{TheCSVFile.csv}
station,rClear
VIENNA,0.985
\end{filecontents}
\begin{document}
\csvreader[
head to column names,
tabular = l|c,
]{TheCSVFile.csv}{}{ \station & \tablenum{\rClear} }
\end{document}
Alternatively, you could an invisible dummy final column:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple-l3}
\usepackage{siunitx}
\begin{filecontents}[overwrite,noheader]{TheCSVFile.csv}
station,rClear
VIENNA,0.985
\end{filecontents}
\begin{document}
\csvreader[
head to column names,
tabular = l|S@{}c,
]{TheCSVFile.csv}{}{ \station & \rClear & }
\end{document}
Finally, you could collect the table data before using it:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple-l3}
\usepackage{siunitx}
\begin{filecontents}[overwrite,noheader]{TheCSVFile.csv}
station,rClear
VIENNA,0.985
\end{filecontents}
\begin{document}
\csvreader[
collect data,
head to column names,
]{TheCSVFile.csv}{}{ \csvexpval\station & \csvexpval\rClear }
\begin{tabular}{l|S}
\csvdatacollection
\end{tabular}
\end{document}
Personally, I would go for the first possibily, i.e. using \tablenum
Thanks a lot for the documentation hint and the 3 workarounds!
The first two worked out-of-the-box.
For the third an additional \\
was necessary in case the table has more than one row:
]{TheCSVFile.csv}{}{ \csvexpval\station & \csvexpval\rClear \\ }
When csvsimple-l3 (version 2.3.2) is combined with siunitx and the last column in the table is of type "S", TeX runs out of memory.
This sample document shows the behavior:
The error message of command 'pdflatex example.tex':
If the last column is of type "r", the problem disappears.