# Weird huge row height when using cellspace on p-column type with empty cell

When using this code, all is OK:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{cellspace}
\begin{document}

\begin{tabular}{|c|S{p{1cm}}|}
\hline
foo & bar \\
\hline
a & É \\
\hline
\end{tabular}

\end{document}


But when a p-column type with the cellspace contain an empty cell, as in this code:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{cellspace}
\begin{document}

\begin{tabular}{|c|S{p{1cm}}|}
\hline
foo &  \\
\hline
a & É \\
\hline
\end{tabular}

\end{document}


I obtain a white first page, and on the second page, an huge height for the first row:

The log contain this message:

Overfull \vbox (482.37025pt too high) has occurred while \output is active

Is this the expected behaviour?

To workaround this, instead of an empty cell, I can use an explicit white space (\ ). But perhaps there is a better solution?

Same bug with an m-column-type (from the array package). l, c and r column-types aren't affected by this strange behaviour.

• You didn't specify any value for \cellspacetoplimit  or \cellspacebottomlimit. – Bernard Mar 21 at 23:47
• @Bernard Default value of \cellspacetoplimit and \cellspacebottomlimit is 1pt (see line 66 and 67 of github.com/JosselinNoirel/cellspace/blob/master/cellspace.sty). The problem is not here. – quark67 Mar 22 at 0:23

Add an >{\arraybackslash} to the last column:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{4pt}

\begin{document}

\begin{tabular}{|c|S{>{\arraybackslash}p{1cm}}|}
\hline
foo & \\
\hline
a & É \\
\hline
\end{tabular}

\end{document}


• What is the technical reason for the necessity to adding >{\arraybackslash} on this S-column, when a cell is empty? Why only for p or m column type? – quark67 Mar 22 at 11:51
• I don't know the details, but as far as I know, there may be problems with the \\ row breaking in tables when the last column is p{some length} or similar, because it may happen that latex doesn't know whether it is used for a new row or for a line break in the cell? – Bernard Mar 22 at 11:56
• But without the S specification, >{\arraybackslash} isn't needed. Anyway, I have opened an issue on the GitHub project for the cellspace package. – quark67 Mar 22 at 11:59
• You did well. I guess there's an interaction between cellspace, the paragraph-like column types and \\, for some reason. I already had a similar problem with an X column type. – Bernard Mar 22 at 12:02

For information, if you use nicematrix and its parameter cell-space-limits, you don't have that problem.

\documentclass[11pt]{article}
\usepackage{nicematrix}
\begin{document}

\NiceMatrixOptions{cell-space-limits=1pt}
\begin{NiceTabular}{|c|p{1cm}|}
\hline
foo &  \\
\hline
a & É \\
\hline
\end{NiceTabular}

\end{document}
`

• Good to know. Thanks. – quark67 Mar 22 at 12:02