Como impedir que extrarowheight afete a primeira linha

Como impedir que extrarowheight afete a primeira linha

Eu costumava extrarowheightadicionar algum espaço adicional entre as linhas em uma tabela contendo apenas texto. Embora funcione bem, também afeta a primeira linha. Existe uma maneira de impedir isso ou talvez remover o espaçamento adicional apenas na primeira linha? Sei que poderia conseguir o espaço entre as linhas de maneira diferente, mas quero evitar isso, se possível. A seta azul indica o espaço que gostaria de reduzir.

Aqui uma captura de tela e MWE.

Tabela de exemplo

\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}

Responder1

Uma solução alternativa:

\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}

A idéia principal é adicionar um espaçamento negativo após o \toprulepara negar o preenchimento adicionado do \extrarowheight. Adicionando

\\[-3\normalbaselineskip]

parece restaurar a primeira linha à sua altura original (sem preenchimento). Mas é claro, você sempre pode alterar o valor entre colchetes para o que quiser.

insira a descrição da imagem aqui

Responder2

\addlinespace[5mm]o uso do pacote é booktabsuma opção aceitável para você?

\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}

insira a descrição da imagem aqui

informação relacionada