0

I was trying to import a csv table to my Tex, with csvsimple. The idea was to fix every column width and make the text wrapped around. However, whenever I change the last column identifier l to p{2cm} or >{\centering}p{2cm}, it gives me error "missing number" and "illegal units of measure

  1. Basically this works, but the last column is not at the right width:
\begin{table}[h]


\scriptsize
\csvreader[no head, table head =\hline, column count=14,tabular=|>{\centering}m{1.2cm}|c|>{\centering}m{1.6cm}|>{\centering}m{1.6cm}|c|c|>{\centering}m{0.9cm}|>{\centering}m{1.2cm}|>{\centering}m{0.9cm}|>{\centering}m{0.7cm}|>{\centering}m{0.7cm}|>{\centering}m{1.3cm}|>{\centering}m{1.3cm}|l|, late after first line=\\\hline, table foot=\hline]%
{MBxxx210601-01.csv}%
{}
{\csvcolv & \csvcolvi & \csvcolvii & \csvcolviii & \csvcolix & \csvcolx & \csvcolxi  & \csvcolxii & \csvcolxiii & \csvcolxiv & \csvcolxv & \csvcolxvi & \csvcolxvii & \csvcolxviii}


\end{table}
  1. and after I change the last column identifier like I did for others, it gives error
\begin{table}[h]


\scriptsize
\csvreader[no head, table head =\hline, column count=14,tabular=|>{\centering}m{1.2cm}|c|>{\centering}m{1.6cm}|>{\centering}m{1.6cm}|c|c|>{\centering}m{0.9cm}|>{\centering}m{1.2cm}|>{\centering}m{0.9cm}|>{\centering}m{0.7cm}|>{\centering}m{0.7cm}|>{\centering}m{1.3cm}|>{\centering}m{1.3cm}|>{\centering}m{1.3cm}|, late after first line=\\\hline, table foot=\hline]%
{MBxxx210601-01.csv}%
{}
{\csvcolv & \csvcolvi & \csvcolvii & \csvcolviii & \csvcolix & \csvcolx & \csvcolxi  & \csvcolxii & \csvcolxiii & \csvcolxiv & \csvcolxv & \csvcolxvi & \csvcolxvii & \csvcolxviii}


\end{table}

The error is a bunch of "missing number" and "illegal unit of measure" alternate.

Anyone has an idea of what the reason could be? Thanks!

2

Use \centering\arraybackslash so that \\ retains its end of table roww meaning.

1
  • I tried >{\centering\arraybackslash}p{2cm}| It didn't help, with the same error msg.
    – Chengmeng
    Jun 8 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.