5

I want to create a xltabular table by loading the content of a CSV file, which is imported by way of csvreader. At the end of the table, an extra empty undesired row is shown. I can't figure out what I'm doing wrong. Here below my MWE, thank you for your help.

\begin{filecontents*}{\jobname.csv}
keyword|type|range of value|m.u.|description
version|uint32\_t| current  version |-| version of  the  FGFS  structure  in  use  (check  net_fdm.hxx  for  its  value).  It  is  not  necessary  to  assign  a  value  to  this  field,  it  is  detected  automatically. 
padding|uint32\_t|none|-| not  used.  Never  assign  a  value. 
longitude|double|[-180,+180]|rad| geodetic  longitude 
latitude|double|[-90,+90]|rad| geodetic  latitude 
altitude|double|-|m| altitude  above  sea  level 
agl|float|-|m| altitude  above  ground  level 
phi|float|[-180,+180]|rad| roll  angle 
theta|float|[-180,+180]|rad| pitch  angle 
psi|float|[-180,+180]|rad| true  heading 
alpha|float|-|rad| angle  of  attack 
beta|float|-|rad| side  slip  angle 
\end{filecontents*}

\documentclass{article}
\usepackage{longtable}
\usepackage{xltabular}
\usepackage{csvsimple}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}

\begin{document}
\begin{xltabular}{\linewidth}{|l|l|r|l|X|}\toprule
  \csvreader[
      late after line=\\\midrule,
      late after last line=\\\bottomrule,
      respect underscore = true,
      separator = pipe,]
      {\jobname.csv}{}{\csvcoli & \csvcolii & \csvcoliii & \csvcoliv & \csvcolv }
\end{xltabular}
\end{document}

enter image description here

1

I had the same problem. I think it is caused by

late after last line=\\\bottomrule,

as this command starts a new line after the last csv-entry, without new data to fill it.

I solved this problem by using

late after last line=\ ,

as it only adds an empty space instead of the new line. I used the longtable environment, but i guess the bottom line can by created with xltabular too.

I know this may not be a proper solution, but it worked for me.

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.