テキストのみを含む表の行間にスペースを追加していました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}