# Merging the two leftmost column at the end of a Table

A frustrated \LaTeX user here. I want to merge the end of my table so the "terrain correction uncertainty" get merged with cell below the "No." column.

What I want:

What I have done is this:

\begin{table} [!htb]
\caption{Summary of uncertainties in the AVF Bouguer anomaly data}
\medskip
\centering
\begin{tabular}{| m{23pt} | m{180pt}| m{180pt} |}
\hline
\rowcolor{black!30}
\rule[-1ex]{0pt}{2.5ex} \Centering \bfseries No.
& \Centering \bfseries Source of Uncertainty & \Centering \bfseries Estimated Uncertainty (mGal)\\
\hline
\rule[-1ex]{0pt}{2.5ex}
\Centering 1 & \makecell[l]{ Latitude correction \\ (horizontal positioning)} &\Centering $\pm0.05$ mGal \\
\hline
\rule[-1ex]{0pt}{2.5ex}
\multicolumn{2}{c}{Terrain correction uncertainty} &\Centering $\pm0.03$ mGal \\
\hline
\end{tabular}
\label{Tab:AVFUncertTable}
\end{table}


the \multicolumn at the end gives out "Misplaced \omit. ...umn{2}{c}{Terrain correction uncertainty}" error. All example that I read in StackExchange all give header merging. I need footer merging.

• Welcome to TeX SX! User \multicolumn[2}[|r|}{…}. – Bernard Feb 4 at 12:48
• delete the rules as they are not allowed at that point. After any error the pdf is not intended to be usable so it is not surprising if the pdf output is not as you want. (If the intention is to give more height to the rows, set \setlength\extrarowheight{5pt} before the tabular. Or if you want the rules put them inside not before the multicolumn. – David Carlisle Feb 4 at 14:22
• please have a look if the answer suits the requirement --\hline not required in the header since the \rowcolor sets it apart -- the correct way to bold the headers is with \thead --\multicolumn is now right aligned -- to get centering in the headers simply add \centering in the definition of \thead in the preamble of the code – js bibra Feb 4 at 15:52

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage[table]{xcolor}
\usepackage{makecell}

\begin{document}
\begin{table} [!htb]
\caption{Summary of uncertainties in the AVF Bouguer anomaly data}
\medskip
\centering
\begin{tabular}{m{23pt} m{180pt} m{180pt}}

\rowcolor{black!30}

1 & \makecell[l]{ Latitude correction \\ (horizontal positioning)} & $\pm0.05$ mGal \\
\hline

\multicolumn{2}{r}{Terrain correction uncertainty} &$\pm0.03$ mGal \\
\hline
\end{tabular}
\label{Tab:AVFUncertTable}
\end{table}
\end{document}


With {NiceTabular} of nicematrix (with a advantage: the rules won't seem to disappear near the gray cells in some PDF readers at some levels of zoom).

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{table} [!htb]
\caption{Summary of uncertainties in the AVF Bouguer anomaly data}
\medskip
\centering
\begin{NiceTabular}{wc{23pt}m{180pt}wc{180pt}}%
[hvlines,colortbl-like,cell-space-limits=3pt]
\rowcolor{black!30}
\bfseries No. & \centering \bfseries Source of Uncertainty &  \bfseries Estimated Uncertainty (mGal)\\
1 & \Block[l]{}{ Latitude correction \\ (horizontal positioning)} & $\pm0.05$ mGal \\
\Block[r]{1-2}{Terrain correction uncertainty} & & $\pm0.03$ mGal \\
\end{NiceTabular}
\label{Tab:AVFUncertTable}
\end{table}

\end{document}


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

• Thanks man, I have upvoted this answer though it will not show because I lack reputation 👍🏼 – Alutsyah Luthfian Feb 4 at 20:07