Bahador Saket
Bahador Saket

Reputation: 1035

How to create a table that has combination of single column and double columns rows in latex?

I am trying to create a table that has combination of single column and double columns rows? Any idea how can I do that in latex?

See Figure below: enter image description here

Upvotes: 0

Views: 280

Answers (1)

Werner
Werner

Reputation: 15065

You should set the tabular using the maximum number of columns, and then make some columns span \multicolumn:

enter image description here

\documentclass{article}

\usepackage{tabularx}
\usepackage[nopar]{lipsum}

\begin{document}

\noindent
\begin{tabularx}{\linewidth}{| X | X | X |}
  \hline
  & Abstract & Direct \\
  \hline
  Type A & \multicolumn{2}{ p{\dimexpr.6667\linewidth-2\tabcolsep} |}{\lipsum[1]} \\
  \cline{2-3}
  & A & B \\
  \hline
  Type B & \multicolumn{2}{ p{\dimexpr.6667\linewidth-2\tabcolsep} |}{\lipsum[2]} \\
  \cline{2-3}
  & A & B \\
  \hline
\end{tabularx}

\end{document}

Upvotes: 1

Related Questions