# Solving "overfull \vbox" in table with multirow

This table has been causing me nothing but problems. Right now, it looks OK:

But it's clear the vertical spacing is not so good. "Region" is too high (which I tried to address with the [fixup] parameter of multirow: [-0.5em]). I used \parbox to get line breaking and centering of the middle columns proper. To fit my page width these columns need to line-wrap on three lines.

When I run, I get two errors for these two columns:

Overfull \vbox (5.89192pt too high) detected
Overfull \vbox (6.57993pt too high) detected


Like I said, it looks OK, but I'd like to understand what's going on (even if I could just change table content to fix the problem, that won't tell me why it was a problem). Perhaps I'm a glutton for punishment, but after a few hours pounding away at my thesis I enjoy taking a break by debugging \LaTeX errors/warnings.

I have read several questions/answers here and tried inserting invisible rules (from a comment), \smash (which broke line-wrapping), \vphantom (which made text disappear), adding [1em] in various places of varying sizes, and several other methods.

MWE:

\documentclass{article} % The class file specifying the document structure

\usepackage{palatino} % Use the Palatino font by default
\usepackage{siunitx}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{array}
\usepackage[referable]{threeparttablex}
\usepackage{multirow}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}

\geometry{
paper=letterpaper, % Change to letterpaper for US letter
inner=2.5cm, % Inner margin
outer=3.8cm, % Outer margin
bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
}

\begin{document}

\begin{table}[!htb]
\sisetup{input-decimal-markers = .,group-separator={,}, group-four-digits = true}
\captionsetup{skip=0.5\baselineskip,size=footnotesize}
\footnotesize
\centering
\begin{threeparttable}
\begin{tabular}{L{2.8cm}*4{S[table-format=2.1]}}
\toprule
\multicolumn{1}{c}{\multirow{2}{*}[-0.5em]{\parbox[c]{2.7cm}{\centering \textbf{Region}}}} &
\multicolumn{1}{c}{\multirow{2}{*}{\parbox[c]{1.8cm}{\centering \textbf{Electric outages per month}\tnote{a}}}} &
\multicolumn{1}{c}{\multirow{2}{*}{\parbox[c]{2.0cm}{\centering \textbf{Typical outage duration (hours)}\tnote{a}}}} &
\multicolumn{2}{c}{\centering\textbf{Population with electricity access}\tnote{b}}         \\  \cmidrule{4-5}
& ~ & ~ & \multicolumn{1}{c}{\parbox[c]{1.7cm}{\centering \textbf{~~Total [\si{\percent}]}}} & \multicolumn{1}{c}{\parbox[c]{1.7cm}{\centering\textbf{~~Rural [\si{\percent}]}}} \\ [0.2cm]
\midrule
South Asia & 25.4 & 3.1 & 78. & 69.3 \\%
Sub-Saharan Africa & 9.0 & 4.2 & 35.3 & 15.3 \\%
OECD countries & 0.4 & 0.4 & 99.9 & 99.7 \\%
\bottomrule
\end{tabular}
\begin{tablenotes}
\item[a] For commercial users only
\item[b] For residential users only
\end{tablenotes}
\end{threeparttable}
\caption[Grid statistics for selected regions]{Grid statistics for selected regions.}
\label{tab:grid}
\end{table}

\end{document}


Note that the screenshot and MWE use the article class, but for my document I'm using a slightly modified version of the custom class MastersDoctoralThesis (but the errors are identical either way):

\documentclass[11pt,oneside,english,singlespacing,
{MastersDoctoralThesis}

• Just to be sure, you changed the name of the class file if you changed the contents? Apr 16 '17 at 5:32
• @Johannes_B not sure what you're asking. The MWE and screenshot use {article} class and give the same errors I get when using {MastersDoctoralThesis}. Apr 16 '17 at 5:36
• My comment was off-topic. The license of the class permits changes without changing the name as well. ;-) Apr 16 '17 at 5:45
• Compliments for your table, we rarely see one so very well done, in a question! Apr 16 '17 at 5:53

The first argument of \multirow is not really the number of rows replaced by a single cell, but the number of lines – or equivalent thereof – which are replaced. Taking a value of 4 does the job.

I took the opportunity to simplify your code using the makecell package, and its \multirowthead command, which allows for line breaks in cells, and a common formatting. Also, I propose to have the leftmost column head left-aligned, but it's easy to change that (the default for all makecell commands is centred both vertically and horizontally).

Last point: palatino is obsolete, and has no support for maths. I replaced this package with newpx, based on the palatino clone TeX Gyre Pagella.

\documentclass{article} % The class file specifying the document structure
\usepackage{newpxtext, newpxmath} %
\usepackage{siunitx}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{array}
\usepackage[referable]{threeparttablex}
\usepackage{multirow, makecell}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}

\geometry{
paper=letterpaper, % Change to letterpaper for US letter
inner=2.5cm, % Inner margin
outer=3.8cm, % Outer margin
bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
}

\begin{document}

\begin{table}[!htb]
\sisetup{input-decimal-markers = .,group-separator={,}, group-four-digits = true}
\captionsetup{skip=0.5\baselineskip,size=footnotesize}
\footnotesize
\centering
\begin{threeparttable}
\begin{tabular}{L{2.8cm}*4{S[table-format=2.1]}}
\toprule
\multicolumn{2}{c}{\centering\textbf{Population with electricity access}\tnote{b}} \\%
\midrule
South Asia & 25.4 & 3.1 & 78. & 69.3 \\%
Sub-Saharan Africa & 9.0 & 4.2 & 35.3 & 15.3 \\%
OECD countries & 0.4 & 0.4 & 99.9 & 99.7 \\%
\bottomrule
\end{tabular}
\begin{tablenotes}
\item[a] For commercial users only
\item[b] For residential users only
\end{tablenotes}
\end{threeparttable}
\caption[Grid statistics for selected regions]{Grid statistics for selected regions.}
\label{tab:grid}
\end{table}

\end{document}


• Increasing to 3 in multirow fixed the issue... I'll have to disagree with makecell simplifying the code, since it requires me to manually insert line-breaks in headings. It works here, but on the next table I'd prefer not to spend time fiddling with number of rows and location of linebreaks! Finally, those fonts caused many errors for me, even just in the re-worked MWE. TeXblog indicates mathpazo replaces palatino, which worked for me. Apr 16 '17 at 12:20
• Manual line breaking allows you to have full control on the break points (e.g. I deliberately managed to obtain per month on the same line – semantically better). What's strange is I really needed 4. If mathpazo works, it's fine, but you won't have true small caps. Concerning the newpx fonts, is your version up-to-date? What's your distribution? Apr 16 '17 at 12:27
• From the log: This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9.6210 64-bit). Using TeXstudio on Windows 10. I just updated all my packages a few days ago as well (in the process of debugging this very issue! I agree your solution is semantically better - but I'd still prefer automatic linebreaks with the option to add my own... Apr 16 '17 at 12:39
• @Bernard -- to get "per month" on one line, try using a tie: per~month. that should make it possible to avoid using \\  to indicate the breaks. Apr 16 '17 at 14:47
• @Teepeemm: Trial and error coupled with dichotomy is not that long. Furhermore, you can use a non-integer number of rows as an argument to \multirow. You also can try the valign=c key for \includegraphics (load adjustbox with option [export]). Jun 24 '20 at 19:48