2

I'm creating Latex Tables using Array One of the sample table is mentioned below with merging multi-cell of rows.

enter image description here

Can you please help me to understand, how can i merges rows in arrays Sample Latex table with Array is mentioned below;

\[\begin{array}{*{20}{|c}}
\hline
   {{\text{Differentiation}}} & {{\text{Integration}}} & {}  \\
   {{\text{The problem of finding SLOPE}}} & {} & {}  \\
   {} & {{\text{Leibnitz}}} & {{\text{Archimedes}}}  \\
   a & b & c  \\
   d & e & f  \\
   g & h & i  \\
   j & k & l  \\
   m & n & o  \\
\hline
\end{array} \]
2
  • 1
    Off-topic (for this question): You don't need 20 columns; You don't need all the braces/\text{Leibnitz} would suffice; Why a textual table inside a math display equation? Commented May 20, 2014 at 5:51
  • Dear Sir, text mentioned above is dummy; table is having around 18 rows. I pasted image and array with rough data. Regarding table inside a math display equation; I'm looking for tools using which even person without latex knowledge can practically work with it. In MathType there is a option to convert display code into Latex commands; so textual table is inside a math display equation. Commented May 20, 2014 at 6:10

3 Answers 3

3

This might be a starting point for you. I created a new column type P which makes it easier distributing the columns over the width of the textblock, because with this solution the widths of the n columns should add up to 1 and not to 1-n*\tabcolsep.

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{booktabs,array}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{\dimexpr#1\linewidth-2\tabcolsep}}
\begin{document}
\begin{table}
  \centering
  \begin{tabular}{P{0.3}P{0.35}P{0.35}}
    \toprule
    Differentiation & \multicolumn{2}{c}{Integration} \\
    \midrule
    Slope & \multicolumn{2}{l}{Area} \\
    & Leibnitz & Archimedes, Eudoxus, others \\
    & Anti Deri & Area \\
    & Test 1 & Test 2 \\
    & Indefinite Integral & Definite Integral \\[\baselineskip]
    & \multicolumn{2}{c}{Together constitutes Integral Calculus} \\
    \midrule
    Derivative of a polynomial function decreases its degree by 1 & \multicolumn{2}{p{0.5\textwidth}}{Integral of a polynomial function increases its degree by 1} \\
    \bottomrule
  \end{tabular}
\end{table}
\end{document}

enter image description here

0
2

With {NiceTabular} of nicematrix (≥ 6.28).

\documentclass{article}
\usepackage{booktabs}
\usepackage{nicematrix}

\begin{document}

\begin{table}
  \centering
  \begin{NiceTabular}{X[l,30]X[l,35]X[l,35]}
    \toprule
    Differentiation & \Block{1-2}{Integration} \\
    \midrule
    Slope & \multicolumn{2}{l}{Area} \\
    & Leibnitz & Archimedes, Eudoxus, others \\
    & Anti Deri & Area \\
    & Test 1 & Test 2 \\
    & Indefinite Integral & Definite Integral \\
    & \Block{1-2}{Together constitutes Integral Calculus} \\
    \midrule
    Derivative of a polynomial function decreases its degree by 1 & 
    \Block[j]{1-2}{Integral of a polynomial function increases its degree by 1} \\
    \bottomrule
  \end{NiceTabular}
\end{table}

\end{document}

Output of the above code

1

After 10 years .. as competiton to nice @F. Pantigny answer (+1) with tabularray package:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
    \begin{table}
    \centering
\begin{tblr}{colspec = {X[1.2,l] X[l] X[l]},
             cell{1-2,Y}{2} = {c=2}{c},
             cell{Z}{2} = {c=2}{},
             row{1}  = {font=\bfseries},
             row{2-X}= {rowsep=1pt},
             hspan   = minimal
             }
    \toprule
Differentiation &   Integration         &                               \\
    \midrule
Slope           &   Area                &                               \\
                & Leibnitz              & Archimedes, Eudoxus, others   \\
                & Anti Deri             & Area                          \\
                & Test 1                & Test 2                        \\
                & Indefinite Integral   & Definite Integral             \\
    \addlinespace
                &   Together constitutes Integral Calculus
                                        &                               \\
    \midrule
Derivative of a polynomial function decreases its degree by 1 
                &   Integral of a polynomial function increases its degree by 1
                                        &                               \\
    \bottomrule
\end{tblr}
    \end{table}
\end{document}

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.