5

what is the best way to split a table cell like this:

| Header1    | Header2| Header3  |
----------------------------------
| text11      | text12 | text13   |
----------------------------------
| text21      | text22 | text23   |
----------------------------------
|       |t311 |text312 | text313  | 
| text31|     |        |          |  
|       |t312 |text322 | text323 | 

thanks

2
  • Could you post a full compilable code?
    – Bernard
    Dec 22, 2016 at 11:36
  • Check out this page for easy table creation in Latex. tablesgenerator.com Create your table using GUI on the site and automatically generate Latex code for the table you created. This site saved a lot of my time! And headache to create table in latex.
    – dnth
    Apr 23, 2018 at 8:08

2 Answers 2

8

Is this what you want?

enter image description here

\documentclass{article}

\usepackage{multirow}

\begin{document}
\begin{tabular}{| l | l | c | c |}
  \hline 
  \multicolumn{2}{|l|}{Header1}    & Header2 & Header3  \\
  \hline
  \multicolumn{2}{|l|}{text11}      & text12 & text13   \\
  \hline
  \multicolumn{2}{|l|}{text21}     & text22 & text23   \\
  \hline
  \multirow{2}*{text31}      & t311 &text312 & text313  \\
       & t312 & text322 & text323 \\
  \hline 
\end{tabular}
\end{document}
1

Here is how you can do that tabular with {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{llcc}[hvlines]
  \Block{1-2}{Header1} &      & Header2 & Header3 \\
  \Block{1-2}{text11}  &      & text12  & text13  \\
  \Block{1-2}{text21}  &      & text22  & text23  \\
  \Block{2-1}{text31}  & t311 & text312 & text313 \\
                       & t312 & text322 & text323 \\
\end{NiceTabular}

\end{document}

Output of the above code

You must log in to answer this question.

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