I've been trying to find the right way to load angles from CSV file with pgfplotstable
, format them using siunitx
's \ang{}
command and display them using pgfplotstable
. My idea was to pass the data in the postprocessing stage to the \ang
command but I get the following error:
Runaway argument? \l__siunitx_number_arg_tl \tl_map_function:NN \l__siunitx_number_arg_tl \ETC. ! File ended while scanning use of __siunitx_number_in_parse_relation:w.
If I remove the \ang
command, everything compiles so I presume that I'm formatting the numbers in a bad way. Is there a proper way to load angular data from the .csv with pgfplotstable
?
My MWE is given below:
\documentclass[margin=5mm,preview]{standalone}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.13}
\usepackage{filecontents}
\begin{filecontents*}{mytable.csv}
angle, magnitude
0,1
5;15;0,2
10;5;5,4
\end{filecontents*}
\begin{document}
\pgfplotstabletypeset[
col sep=comma,
string type,
header=true,
every head row/.style={before row=\toprule,after row=\midrule},
every last row/.style={after row=\bottomrule},
display columns/angle/.style={string type,postproc cell content/.code={\ang{#1}}},
display columns/magnitude/.style={column name={$a$}},
]{mytable.csv}
\end{document}
The result is given below:
Edit 1: I've used column names in the display columns/../.style
lines and the error has gone but the data is not processed at all.
Edit 2: I've added the result of the previous edit.
mytable.csv
is in the MWE, it is made using thefilecontents
package. – Budo Zindovic May 24 '17 at 12:47