I'm trying to display values from a csv file inside a tabular. To do so, I'm using the macro \csvreader. I would like thr tabulat to like this way :

desired result

with a toprule, the head of columns, a midrule, the values with no line and a bottomrule.

Here is the code I made

    \textbf{Mesh} & $h$ & \textbf{nDof $\P_1$} & \textbf{nDof $\P_2$}\\
    \csvreader[head to column names]{fig/meshInformation3D.csv}{}
    {\texttt{\mesh} & \pgfmathprintnumber{\hAvg} & \pgfmathprintnumber{\nDofPUn} & \pgfmathprintnumber{\nDofPDeux}\\}

For each line, I display the information of the csv row, then I insert a \\. With this code, I get the following result


with an additional empty line. I tried to remove the \\ in front of the \bottomrule, but it result in the error Misclaced \noalign. \bottomrule->\noalign.

How could I remove this extra line ?

  • You should probably use the option late after line = \\ . See the answers to this question. Did you take a look at the manual? The manual has a lot of nice examples, including the use of \bottomrule. Mar 13, 2023 at 15:17

1 Answer 1


Using the option late after line=\\ solves this problem:


mesh, hAvg, nDofPUn, nDofPDeux 
M0  , 0.86, 47384  , 327000    
M1  , 0.74, 68993  , 473000    

    \textbf{Mesh} & $h$ & \textbf{nDof $\mathbb{P}_1$} & \textbf{nDof $\mathbb{P}_2$} \\
    \csvreader[head to column names, late after line=\\]{mylist.csv}{}{
        \texttt{\mesh} & 
        \pgfmathprintnumber{\hAvg} & 
        \pgfmathprintnumber{\nDofPUn} & 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .