Quantcast
Channel: Merge rows in the middle of a table using multirow package - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

Merge rows in the middle of a table using multirow package

$
0
0

How can I merge some non-adjacent rows in a table? I'm using a template that uses booktabs, threeparttable, and multirow. I don't have flexibility to change the template.

Here is an example that works, call it table-ok.tex:

\begin{tabular}{c|c|c|c|c}\specialrule{1.5pt}{0pt}{0pt}Col1 & Col2 & Col3 & Col4 & Col5 \\\hline\hline\multirow{3}{*}{Blah}& A & i& \multirow{3}{*}{Same Text-1} & \multirow{3}{*}{Same Text-2} \\ \cline{2-3}& B & ii & \\ \cline{2-3}& C & iii & \\ \cline{2-3}\specialrule{1.5pt}{0pt}{0pt}\end{tabular}

enter image description here

But how can I merge only column 4 in the following?

\begin{tabular}{c|c|c|c|c}\specialrule{1.5pt}{0pt}{0pt}Col1 & Col2 & Col3 & Col4 & Col5 \\\hline\hline\multirow{3}{*}{Blah}& A & i & Same Text & Different for A \\ \cline{2-3}& B & ii &  Same Text & Different for B \\  \cline{2-3}& C & iii &  Same Text & Different for C \\ \cline{2-3}\specialrule{1.5pt}{0pt}{0pt}\end{tabular}

enter image description here

Here is the main.tex for reproducibility:

\documentclass[12pt]{report}\usepackage{booktabs}\usepackage{threeparttable}\usepackage{multirow} %-------------------------------------------------------\begin{document}\begin{table}\centering\begin{threeparttable}\caption{Easy when all merges are adjacent.}\input{table-ok}\end{threeparttable}\end{table}\begin{table}\centering\begin{threeparttable}\caption{How to do this one?}\input{table-help}\end{threeparttable}\end{table}\end{document}

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images