1

I am trying to use a multi-row table such that I can have some extra spacing before and after the table's entire header and before and after the first element of the rows. The screenshot is enclosed:

enter image description here

A working example of the same is as follows:

\begin{table}
\begin{tabular}{l|l|l}
\hline
\textbf{A} & \textbf{B} & \textbf{C} \\
\hline
\multirow{17}{0.11\textwidth}{A} & B & \begin{tabular}[c]{@{}c@{}}C \\ D\\ E \\ \end{tabular}\\ 
\cline{2-3} 
& X & \begin{tabular}[c]{@{}l@{}} C \\ D\\ E \\ \end{tabular}  \\ \hline
\end{tabular}
\end{table}

Apologies for my poor knowledge of LaTeX.

Mico
  • 506,678
Qureshi
  • 65
  • 1
    One way is to use \makegapedcells defined in the makecell package, the another ways is use \cellspace package and define spaces for \cellspacetoplimit and \cellspacebottomlimit. Well, your knowing of LaTeX will grow with their use :-), so happy TeXing! – Zarko Dec 27 '20 at 21:35

2 Answers2

1

I think you're looking to insert typographic struts in various locations. See the following for an example of how this may be done. The screeshot shows the tabular without struts on the left and with struts on the right.

enter image description here

\documentclass{article}
\usepackage{multirow}

% see https://tex.stackexchange.com/a/50355/5001 \newcommand\Tstrut{\rule{0pt}{2.6ex}} % Top strut \newcommand\Bstrut{\rule[-1.2ex]{0pt}{0pt}} % Bottom strut \newcommand\TBstrut{\Tstrut\Bstrut} % Top-and-Bottom strut

\begin{document} \begin{table} % first, without struts \begin{tabular}[t]{p{0.11\textwidth}|l|l} \hline \textbf{A} & \textbf{B} & \textbf{C} \ \hline \multirow{3}{}{A} & B & \begin{tabular}[c]{@{}c@{}}C \ D\ E \ \end{tabular}\ \cline{2-3} & X & \begin{tabular}[c]{@{}l@{}} C \ D\ E \ \end{tabular} \ \hline \end{tabular} \qquad % second, with* struts \begin{tabular}[t]{p{0.11\textwidth}|l|l} \hline \textbf{A} & \textbf{B} & \textbf{C}\TBstrut \ % <-- note the "\TBstrut" directive \hline \multirow{3}{*}{A} & B & \begin{tabular}[c]{@{}c@{}}C\Tstrut \ D\ E\Bstrut \ \end{tabular}\ \cline{2-3} & X & \begin{tabular}[c]{@{}l@{}} C\Tstrut \ D\ E\Bstrut \ \end{tabular} \ \hline \end{tabular} \end{table} \end{document}

Mico
  • 506,678
1

Now I'm not sure, what is your problem. However, based on my comment, in the first I understood that you looking for something like this:

enter image description here

Above table example is produced by:

\documentclass{article}
\usepackage{makecell, multirow}

\begin{document} \begin{table}[ht] \setcellgapes{5pt} \makegapedcells \renewcommand\multirowsetup{\centering} % if you like to have horizontal % centered multirow cells contains \begin{tabular}{l|l|l} \hline \textbf{A} & \textbf{B} & \textbf{C} \ \hline \multirow{5}{0.11\textwidth}{A} & B & \makecell[l]{C \ D\ E } \ \cline{2-3} & X & \makecell[l]{C \ D\ E } \ \hline \end{tabular} \end{table} \end{document}

Zarko
  • 296,517