7

I want my table to have separated cells. Basically double lines but I can't figure how to have horizontal lines disconnected. I tried \hline and \cline but those connect too.

This is best I can do:

enter image description here

This is how I want my table to look: enter image description here

\begin{tabular}{|c||c||c||c|}
  \hline
  \multicolumn{2}{|c||}{First Cell}&
  Second Cell&
  Third Cell\\
  \hline
  \hline
  \begin{tabular}{@{}l@{}} Data\\ Data\\ Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}\\

  \hline

\end{tabular}
2
  • Welcome to TeX - LaTeX! What have you tried? Please post a minimal working example (MWE) demonstrating your set-up. Commented Mar 2, 2016 at 13:03
  • I also tried putting every cell in its nested tabular environement but that way it messes up spaceing between cells of primary table
    – ssekav
    Commented Mar 2, 2016 at 13:10

3 Answers 3

7

You can achieve this with the hhline package:

Result

\documentclass{article}
\usepackage{hhline}
\begin{document}
\begin{tabular}{|c||c||c||c|}
  \hhline{|--||-||-|}
  \multicolumn{2}{|c||}{First Cell}&
  Second Cell&
  Third Cell\\
  \hhline{=:t:=::=::=:}
  \begin{tabular}{@{}l@{}} Data\\ Data\\ Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}\\
  \hhline{=::=::=::=:}
  More data &
  More data &
  More data &
  More data\\
  \hhline{|-||-||-||-|}

\end{tabular}
\end{document}
6

enter image description here

\documentclass{article}

\usepackage{array,hhline}

\begin{document}

\setlength\extrarowheight{2pt}
\begin{tabular}{|c||c||c||c|}
  \hhline{|--||-||-|}
  \multicolumn{2}{|c||}{First Cell}&
  Second Cell&
  Third Cell\\
  \hhline{=:t:=::=::=}
  \begin{tabular}{@{}l@{}} Data\\ Data\\ Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}&
  \begin{tabular}{@{}l@{}}
    Data\\
    Data\\
    Data\\
  \end{tabular}\\
  \hhline{|-||-||-||-|}
\end{tabular}

\end{document}
1

Here is a way to construct that table with {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

\renewcommand{\arraystretch}{1.3}

\begin{NiceTabular}{cccc}
\Block{1-2}{First Cell} && Second Cell & Third cell \\
\Block{3-1}{} Data & \Block{3-1}{} Data & \Block{3-1}{} Data & \Block{3-1}{} Data \\
Data & Data & Data & Data \\
Data & Data & Data & Data \\
More Data & More Data & More Data & More Data \\
\CodeAfter
  \TikzEveryCell{offset=1pt,draw}
\end{NiceTabular}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the first code

It's also possible to add rounded corners:

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

\renewcommand{\arraystretch}{1.3}

\begin{NiceTabular}{cccc}
\Block{1-2}{First Cell} && Second Cell & Third cell \\
\Block{3-1}{} Data & \Block{3-1}{} Data & \Block{3-1}{} Data & \Block{3-1}{} Data \\
Data & Data & Data & Data \\
Data & Data & Data & Data \\
More Data & More Data & More Data & More Data \\
\CodeAfter
  \TikzEveryCell{offset=1pt,draw,rounded corners}
\end{NiceTabular}

\end{document}

Output of the second code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .