Closed mikkelee closed 5 years ago
This error message results from a missing \makeatletter
and \makeatother
around your \csvset
.
But, with it, it gives another error message
! File ended while scanning use of \TX@get@body.
I do not know the xltabular
package, but from the error message I guess that this package needs to read the whole table into a macro for further processing. If I am right, then it is not compatible with csvsimple
.
But, you could try your luck at https://tex.stackexchange.com. Maybe, somebody there can help (?).
Aha, that could be it; tabularx
which it is based on defines a column type X
that adjusts to the width of the table, that might explain why it would need to read the whole table. I will experiment with running a \csvloop
instead.
Alright, I got the table working with \csvloop
, but if I use an external file with tab separators, it only reads the first line. Do I need to do something special regarding linefeeds? The file has Unix/LF endings. It's available here:
https://github.com/mikkelee/latex-pua/blob/master/latex/unicode-alphabets.mufi.tsv
\begingroup
\scriptsize
\begin{xltabular}{\linewidth}{r l X l}
\toprule
Code Point & Entity Name & Unicode Name & Version\\
\midrule
\endhead
\bottomrule
\endfoot
\csvloop{
file={unicode-alphabets.mufi.tsv},
separator=tab,
late after line=\\,
command=\csvlinetotablerow,
}
\end{xltabular}
\endgroup
Also, it seems to get stuck in an infinite loop if I use command=\csvcoli & \csvcolii & \csvcoliii & \csvcoliv
instead of \csvlinetotablerow
(my goal is inserting an extra column with each glyph using \mufi{\csvcoli}
from my above package)
I have no clue, why tab separators do not work in combination with xltabular
. They do work inside a normal tabular
.
With commas, your example compiles as expected.
You can replace \csvlinetotablerow
with an own command, but this has to be definded where xltabular
does no 'see' it, e.g.
\def\mycommand{\csvcoli & \csvcolii & \csvcoliii & \csvcoliv}
\begingroup
\scriptsize
\begin{xltabular}{\linewidth}{r l X l}
\toprule
Code Point & Entity Name & Unicode Name & Version\\
\midrule
\endhead
\bottomrule
\endfoot
\csvloop{
file={unicode-alphabets.mufi4.tsv},% <- with commas
%separator=tab,
late after line=\\,
command=\mycommand,
%command=\csvlinetotablerow,
}
\end{xltabular}
\endgroup
Many thanks for the help, I guess I'll have to change my .tsv files to .csv
I have a table with contents that are both very wide and very long, thus I would like to use
xltabular
(basicallylongtable
+tabularx
). I have tried creating a custom style, but I get the error:MWE: