4

I have used extrarowheight to add some additional space between rows in a table containing text only. While this works fine, it also affects the first row. Is there a way to stop this, or maybe remove the additional spacing in the first row only? I realise I could achieve the space between the rows differently, but I want to avoid that if possible. The blue arrow denotes the space I would like reduced.

Here a screenshot and MWE.

Example Table

\documentclass[12pt, a4paper]{memoir}
\usepackage[utf8]{inputenc}

\settypeblocksize{237mm}{150mm}{*} % size of text block on page

\begin{document}

\begin{table}[!htb]
\caption{Severity of identified problems and proposed changes}
\label{some_changes}
\setlength{\extrarowheight}{5mm} %add row padding
\begin{tabular}{>{\raggedright}p{3.5cm} >{\raggedright}p{8.5cm} p{1.5cm}}
\toprule
Change & Justification & Severity\\
\midrule
1. \parbox[t]{3cm}{\raggedright A few meaningful definitions} &
Just some sample text that is longer than a couple of lines. This text has 
no meaning, it's just a sample text and does not do anything but fill some 
space here. & 
High\\
2. \parbox[t]{3cm}{\raggedright Some other thing that needs a change} &
Just some sample text that is longer than a couple of lines. This text has 
no meaning, it's just a sample text and does not do anything but fill some 
space here. & 
Medium\\
3. \parbox[t]{3cm}{\raggedright Some other thing that needs a change} &
Just some sample text that is longer than a couple of lines. This text has 
no meaning, it's just a sample text and does not do anything but fill some 
space here. &  
Low\\
\bottomrule
\end{tabular}
\end{table}

\end{document}
3
  • off-the-wall suggestion, not tested. \smash the entries in the first row so that they have no height or depth. (not in a position to test, and admittedly this is rather farfetched, if not downright weird.) Apr 21, 2017 at 1:51
  • Thanks, @barbarabeeton. I tried it, by putting all entries in the first row in smash ... \smash{changes} etc. That had an effect! It made the row height much larger :D But thanks for the weird suggestion :)
    – Tina
    Apr 21, 2017 at 1:56
  • well, now we know that it's not a useful approach. thanks for the feedback! Apr 21, 2017 at 12:15

2 Answers 2

3

An alternative solution:

\documentclass[12pt, a4paper]{memoir}
\usepackage[utf8]{inputenc}

\settypeblocksize{237mm}{150mm}{*} % size of text block on page

\begin{document}
\begin{table}[!htb]
\caption{Severity of identified problems and proposed changes}
\label{some_changes}
\setlength{\extrarowheight}{5mm} %add row padding
\begin{tabular}{>{\raggedright}p{3.5cm} >{\raggedright}p{8.5cm} p{1.5cm}}
\toprule
\\[-3\normalbaselineskip] % <------------- Add this
Change & Justification & Severity\\
\midrule
1. \parbox[t]{3cm}{\raggedright A few meaningful definitions} &
Just some sample text that is longer than a couple of lines. This text has 
no meaning, it's just a sample text and does not do anything but fill some 
space here. & 
High\\
2. \parbox[t]{3cm}{\raggedright Some other thing that needs a change} &
Just some sample text that is longer than a couple of lines. This text has 
no meaning, it's just a sample text and does not do anything but fill some 
space here. & 
Medium\\
3. \parbox[t]{3cm}{\raggedright Some other thing that needs a change} &
Just some sample text that is longer than a couple of lines. This text has 
no meaning, it's just a sample text and does not do anything but fill some 
space here. &  
Low\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

The main idea is to add a negative spacing after the \toprule to negate the padding added from the \extrarowheight. Adding

\\[-3\normalbaselineskip]

seems to restore the first row to its original height (without padding). But of course, you can always change the value in the square brackets to whatever you like.

enter image description here

1
  • Thank you Zarko and @Troy. Both solutions work of course, but I chose Troy's answer as it is what I had wanted, and because I had tried the addlinespace-solution before myself. Thanks very much to both you. Much appreciated :)
    – Tina
    Apr 21, 2017 at 9:00
4

is use \addlinespace[5mm] from package booktabs acceptable option to you?

\documentclass[12pt, a4paper]{memoir}
\usepackage[utf8]{inputenc}

\settypeblocksize{237mm}{150mm}{*} % size of text block on page

\usepackage{lipsum}
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}

\begin{document}
    \begin{table}[htb]
\caption{Severity of identified problems and proposed changes}
\label{some_changes}
\begin{tabular}{>{\raggedright}p{0.6cm}@{\ }>{\raggedright}p{3cm} >{\raggedright}p{8.5cm} p{1.5cm}}
\toprule
\multicolumn{2}{l}{Change} & Justification & Severity\\
\midrule\addlinespace[5mm]
1. & A few meaningful definitions &
\lipsum*[11] &
High\\  \addlinespace[5mm]
2. & \raggedright Some other thing that needs a change &
\lipsum*[11] &
Medium\\ \addlinespace[5mm]
3. &  Some other thing that needs a change &
\lipsum*[11] &
Low\\
\bottomrule
\end{tabular}
    \end{table}
\end{document}

enter image description here

1
  • Zarko - special thanks also for showing me an alternative way to deal with my columns, so I don't have to use parbox anymore. Your way is better :)
    – Tina
    Apr 21, 2017 at 9:09

You must log in to answer this question.

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