[Tex/LaTex] Merge table cells or column

tables

enter image description here

Please help me merge the extra cells or column. I want to get ride of the empty column without separating my table into two.

\documentclass[a4paper,12p]{report}
\begin{document}
\begin{center}
    \begin{table}[h]
        \centering
        \caption{Initial conditions for HPAI infection in poultry only} 
        \small\addtolength{\tabcolsep}{-6pt}    
        \begin{tabular}{|*{12}{c|}}
            \hline 
            \multicolumn{3}{|c|}{Ghana} & \multicolumn{3}{|c|}{South Africa}  \\ 
            \multicolumn{3}{|c}{H5N1, 2007} & \multicolumn{3}{|c|}{H5N8, 2017} \\   \hline \cline{1-4}
            Initial condition &value  & reference & Initial condition &value  & reference \\ \hline
            $A_e$ & 6500 & Pelletier et al (2013) & $A_e$ & 285,000 & chikwati (2017)  \\ \hline
            $P_I$ & 11743 & OIE(2007) & $P_I$ & 24,000 & chikwati (2017)  \\ \hline
            $P_N$ & \num{2.0263e+5} & OIE(2017) & $P_N$ & 400,000 & schnirrring(2017)  \\ \hline    
            $P_s$ & 48052 & OIE(2007) & $P_s$ & 107,000 & OIE(2017) & \\ \hline
            S & 406,390 & wikipedia & S & \num{4.4442e+6} & www.gov.za  \\ \hline 
        \multicolumn{3}{|c|}{Zimbabwe} \\   
        \multicolumn{3}{|c|}{H5N8, 2017}\\  \hline
        \cline{1-3}
    Initial condition & value & reference\\ \hline
        $A_e$ & 140,000 &chikwati (2017) \\ \hline  
        $P_I$ & 7485 & pathfinder(2017)  \\ \hline
        $P_N$ & \num{2e+6} & Reuters(2017) \\ \hline    
         $P_s$ & 19172 & pathfinder(2017)\\ \hline
         S & \num{1.16706e+6} & www.Pindula.co.zw \\ \hline
        \end{tabular}
    \end{table}
\end{center}
\end{document}

Best Answer

First of all a couple of suggestions:

  1. don't enclose table in a center environment; use \centering after \begin{table}, instead;

  2. don't use the single [h] position specifier, but rather [htp];

  3. three separate tables seem better.

Here's how you can do it. Note that in \multicolumn the rules belong to the preceding column (except the first, of course). I added geometry in order to make the table fit.

\documentclass[a4paper,12pt]{report}
\usepackage[margin=1cm]{geometry}

\usepackage{siunitx}

\begin{document}

\begin{table}[htp]
\centering

\caption{Initial conditions for HPAI infection in poultry only} 

\small\addtolength{\tabcolsep}{-6pt}    

\begin{tabular}{|*{6}{c|}}
\hline 
\multicolumn{3}{|c|}{Ghana} & \multicolumn{3}{c|}{South Africa}  \\ 
\multicolumn{3}{|c|}{H5N1, 2007} & \multicolumn{3}{c|}{H5N8, 2017} \\
\hline
Initial condition & value  & reference & Initial condition &value  & reference \\
\hline
$A_e$ & 6500 & Pelletier et al (2013) & $A_e$ & 285,000 & chikwati (2017)  \\
\hline
$P_I$ & 11743 & OIE(2007) & $P_I$ & 24,000 & chikwati (2017)  \\
\hline
$P_N$ & \num{2.0263e+5} & OIE(2017) & $P_N$ & 400,000 & schnirrring(2017)  \\
\hline
$P_s$ & 48052 & OIE(2007) & $P_s$ & 107,000 & OIE(2017) & \\
\hline
$S$ & 406,390 & wikipedia & S & \num{4.4442e+6} & www.gov.za  \\
\hline 
\multicolumn{3}{|c|}{Zimbabwe} \\   
\multicolumn{3}{|c|}{H5N8, 2017}\\
\cline{1-3}
Initial condition & value & reference\\
\cline{1-3}
$A_e$ & 140,000 &chikwati (2017) \\
\cline{1-3}
$P_I$ & 7485 & pathfinder(2017)  \\
\cline{1-3}
$P_N$ & \num{2e+6} & Reuters(2017) \\
\cline{1-3}
$P_s$ & 19172 & pathfinder(2017)\\
\cline{1-3}
$S$ & \num{1.16706e+6} & www.Pindula.co.zw \\
\cline{1-3}
\end{tabular}

\end{table}

\end{document}

enter image description here

A different implementation:

\documentclass[a4paper,12pt]{report}
\usepackage[margin=1cm]{geometry}
\usepackage{siunitx,booktabs}

\begin{document}

\begin{table}[htp]
\centering

\caption{Initial conditions for HPAI infection in poultry only} 

\small
%\addtolength{\tabcolsep}{-3pt}

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} c  c @{}}
\toprule
\begin{tabular}{@{} l c c @{}}
\multicolumn{3}{c}{Ghana, H5N1, 2007} \\
Initial condition & value  & reference \\
\midrule
$A_e$ & 6500 & Pelletier et al (2013) \\
$P_I$ & 11743 & OIE(2007) \\
$P_N$ & \num{2.0263e+5} & OIE(2017) \\
$P_s$ & 48052 & OIE(2007) \\
$S$   & 406,390 & wikipedia \\
\end{tabular}
&
\begin{tabular}{@{} l c c @{}}
\multicolumn{3}{c}{South Africa, H5N8, 2017} \\
Initial condition & value  & reference \\
\midrule
$A_e$ & 285,000 & chikwati (2017)  \\
$P_I$ & 24,000 & chikwati (2017)  \\
$P_N$ & 400,000 & schnirrring(2017)  \\
$P_s$ & 107,000 & OIE(2017) \\
$S$   & \num{4.4442e+6} & www.gov.za  \\
\end{tabular}
\\
\midrule
\begin{tabular}{@{} l c c @{}}
\multicolumn{3}{c}{Zimbabwe, H5N8, 2017}\\
Initial condition & value & reference\\
\midrule
$A_e$ & 140,000 &chikwati (2017) \\
$P_I$ & 7485 & pathfinder(2017)  \\
$P_N$ & \num{2e+6} & Reuters(2017) \\
$P_s$ & 19172 & pathfinder(2017)\\
$S$ & \num{1.16706e+6} & www.Pindula.co.zw \\
\end{tabular}
\\
\bottomrule
\end{tabular*}

\end{table}

\end{document}

enter image description here