Please let me know if the code and explanation I'm providing are insufficient; I'll gladly add what I can if it helps.


I'm using LaTex (specifically Overleaf running the XeLaTeX engine) to write a paper for which I have more than a dozen .csv tables I'm importing for display. Because of factors I no longer perfectly recall, since they had to do with my first few LaTeX papers written many moons ago, I tend to use a combination of the table, pgfplotstable, and tabu environments (functions?) to get this to work well. And work well it has, for the first ~13 or so tables I've imported from .csv into this paper -- they render beautifully. Until now, that is.

The Problem:

I have a table with 3 columns and 36 rows (inc. header row) in .csv form that I'm trying to import into its own page in my LaTeX document, but while the rows fit just fine into the page's width (1in. margins all around are obligatory for this paper), the length of the table goes right off the bottom of the page. It seems that the height of each row, or the padding between rows, is massive!

The code I'm using to display the table is the exact same as the other 13 tables already in the paper, most of which have a similar number of rows. All I've done is replace the label, caption, a source .csv file arguments. Here's the code for the table:

    \caption{Odds ratios}
      col sep=comma,
      string type,
      column type=,
      begin table={\begin{tabu} to \textwidth{X [1.3] X[.8] X[.8]} \hline},
      end table={\end{tabu}},
      every head row/.style={after row=\toprule},
      %every last row/.style={after row=\bottomrule},
  % \begin{tablenotes}[flushleft]
  %     \tiny
  %     \item * Race / ethnicity categories were changed beginning in the 2002 MEPS.
  %     %\item † \textit{Hispanic} is a separate category from race / ethnicity throughout the MEPS. 
  %   \end{tablenotes}

Here's an image taken from a CSV viewer of what the table is supposed to look like in raw form:


As you can tell, I've wrapped everything in brackets so I don't have LaTeX spit out any errors about text - but maybe I've missed something. I've followed this approach for the other tables and it works fine. Here's a couple of snippets of how it compiles into a LaTeX pdf document. First, a close-up of the top of the rendered table:


And here's another screenshot of it coming off the bottom of the page (you can see page number 23 in the middle there):

enter image description here

What I've tried:

  • Cutting off a bunch of rows from the csv doesn't do much to the padding problem -- I can get it to (barely) fit on the page, but it looks awful with the huge row height / padding.

  • I've also fiddled with the row width parameters (those X[.7] you see in the code) but that doesn't do much either.

  • I can't find any parameter in the pgf documentation about row height or padding.

Any ideas?

1 Answer 1


Woo boy, do I have egg on my face. This doesn't exactly solve the question about row height in pgfplotstable when importing a .csv file, especially when using tabu for bigger tables -- I'd still love to know that answer because it's plagued me before.

However, here's a tip for anyone who might stumble upon this page: ensure that any blank cells in your table are actually blank cells! In this case, it turned out that many of the blank cells in my table were actually blank cells with a single space (e.g. " ") or several blank spaces (e.g. " ", that's 4 spaces). I'm not sure how pgfplotstable or the basic table environments interpreted those as somehow asking for more vertical space by row height or between-row padding, but they did. Removing any blank spaces from "empty" cells fixed the problem, and now the table looks nice and pretty:


Lesson: when importing a .csv file to display as a table, make sure any empty cells are truly empty -- even of spaces or carriage returns / "enter"!

  • 2
    +1 for figuring this out and telling us about it! A word of warning, however, the tabu package is unmaintained and buggy, so I would avoid it if possible, and just use standard tabular or tabularx methods for your tables.
    – Alan Munn
    Commented Jun 7, 2021 at 1:26
  • @Alan, wow really? Thanks so much for telling me. I have to get past this deadline and then I'll fiddle with my csv->LaTeX workflow to get tabular or tabularx working with pgfplotstable instead of tabu. In fact, today I tried modifying the code to use tabularx for the row height issue and I got a ton of errors. So it may take more time, but I'll have to do it if tabu is no longer maintained. How long has this been the case?
    – logjammin
    Commented Jun 7, 2021 at 5:06
  • It hasn't really been updated by the original author since 2011; there have been some emergency fixes by the LaTeX team, but they are not maintaining it. See github.com/tabu-issues-for-future-maintainer/tabu
    – Alan Munn
    Commented Jun 7, 2021 at 14:40

You must log in to answer this question.

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