추가 높이가 첫 번째 행에 영향을 주지 않도록 하는 방법

추가 높이가 첫 번째 행에 영향을 주지 않도록 하는 방법

extrarowheight저는 텍스트만 포함된 테이블의 행 사이에 추가 공간을 추가하는 데 사용했습니다 . 이는 제대로 작동하지만 첫 번째 행에도 영향을 미칩니다. 이를 중지할 수 있는 방법이 있습니까? 아니면 첫 번째 행에서만 추가 간격을 제거할 수 있습니까? 행 사이의 공간을 다르게 확보할 수 있다는 것을 알고 있지만 가능하다면 이를 피하고 싶습니다. 파란색 화살표는 축소하려는 공간을 나타냅니다.

여기 스크린샷과 MWE가 있습니다.

예제 테이블

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

답변1

대체 솔루션:

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

주요 아이디어는 \toprule에서 추가된 패딩을 무효화하기 위해 뒤에 음수 공백을 추가하는 것입니다 \extrarowheight. 첨가

\\[-3\normalbaselineskip]

첫 번째 행을 패딩 없이 원래 높이로 복원하는 것 같습니다. 그러나 물론 대괄호 안의 값을 원하는 대로 언제든지 변경할 수 있습니다.

여기에 이미지 설명을 입력하세요

답변2

\addlinespace[5mm]패키지 사용이 booktabs허용되는 옵션인가요?

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

여기에 이미지 설명을 입력하세요

관련 정보