0

Please can anyone tell me what code should I write for this type of cell splitting?code for table

2 Answers2

3

Is this meets your requirement?

\documentclass{book}
\begin{document}

\begin{tabular}{|l|l|p{4pc}|p{4pc}|}%%change the value 4pc, whatever you likes \hline Serial Number &Loops/Iteration &\multicolumn{2}{|l|}{Execution Time}\ \cline{3-4} & &Execution Time Per Loop &Total Execution Time\ \hline \end{tabular}

\end{document}

enter image description here

MadyYuvi
  • 13,693
1

If you are new to LaTeX, you might need to read a tutorial to get familiar with its language. Here's a particular info on tables but usually more a custom tables require more code than just an environment and the content.

In almost all cases, it's better to merge cells rather than split. If you need to tabulate texts, it's also more convenient to use p{}-type column than regular l, c, or r. p{} converts cells into paragraphs and adds line breaks if necessary or let you add line breaks manually.

The table

enter image description here

and code

\documentclass{article}
\usepackage{array}
\usepackage{multirow}

\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}

\begin{document} \begin{table}[tbh] \centering \renewcommand*{\arraystretch}{1.25} \caption{Cation}\label{tab:table} \vspace{3pt}% \begin{tabular}{|P{1.5cm}|P{2.5cm}|P{3cm}|P{3cm}|} \hline \multirow[t]{2}={Special number} & \multirow[t]{2}={Loops/Iteration} & \multicolumn{2}{l|}{Execution time} \ \cline{3-4} & & Execution\newline Time per Loop & Total execution Time \ \hline \end{tabular} \end{table} \end{document}

Celdor
  • 9,058
  • 1
    Actually, cells cannot be split. You can only merge cells from adjacent columns. Inserting tables in cells is another story which eventually come to account if only one cell in some column in table with many rows should have "subcells". But from question this is not clear. – Zarko Apr 04 '23 at 16:11
  • You are correct. OP seems rather new to LaTeX and I was only following language from the title and the question. Thanks for pointing this out. – Celdor Apr 04 '23 at 17:26