So verhindern Sie, dass Extrarowheight die erste Zeile beeinflusst

So verhindern Sie, dass Extrarowheight die erste Zeile beeinflusst

Ich habe extrarowheightin einer Tabelle, die nur Text enthält, etwas zusätzlichen Abstand zwischen den Zeilen eingefügt. Das funktioniert zwar einwandfrei, wirkt sich aber auch auf die erste Zeile aus. Gibt es eine Möglichkeit, dies zu verhindern oder vielleicht den zusätzlichen Abstand nur in der ersten Zeile zu entfernen? Mir ist klar, dass ich den Abstand zwischen den Zeilen auch anders erreichen könnte, aber das möchte ich möglichst vermeiden. Der blaue Pfeil kennzeichnet den Abstand, den ich verkleinern möchte.

Hier ein Screenshot und MWE.

Beispieltabelle

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

Antwort1

Eine alternative Lösung:

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

Die Grundidee besteht darin, einen negativen Abstand nach dem einzufügen, \topruleum die Polsterung, die durch das hinzugefügt wurde, zu negieren \extrarowheight. Das Hinzufügen

\\[-3\normalbaselineskip]

scheint die erste Zeile auf ihre ursprüngliche Höhe (ohne Polsterung) zurückzusetzen. Aber natürlich können Sie den Wert in den eckigen Klammern jederzeit beliebig ändern.

Bildbeschreibung hier eingeben

Antwort2

Ist die Verwendung \addlinespace[5mm]aus dem Paket booktabsfür Sie eine akzeptable Option?

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

Bildbeschreibung hier eingeben

verwandte Informationen