TransWikia.com

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

TeX - LaTeX Asked by quark67 on July 3, 2021

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}

Resulting output is OK

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:

Resulting output is not OK

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.

2 Answers

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} 

enter image description here

Correct answer by Bernard on July 3, 2021

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}

Output of the above code

Answered by F. Pantigny on July 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP