[Tex/LaTex] Multicolumn table with different size

multicolumntableswidth

I have the following multicolumn table, but I would like to have these columns in different width. For example, columns "Cast name" should be wider that columns "percentage". Could someone kindly let me know how can I do it in latex?

\begin{table}[h]
    \centering
    \caption{Top 5 popular casts(1) VS popular casts(2)}
    \label{table:popularCasts}
        \begin{tabular}{|l|p{3.5cm}|p{0.5cm}|p{3.5cm}|p{0.5cm}|}
    \toprule        
    Rank & \multicolumn{2}{|p{3.5cm}|}{Popular casts selected by users} & \multicolumn{2}{p{3.5cm}|}{popular casts based on movies selected by users} \\ \hline      
     & Cast name & Popularity
     & Cast name & Popularity  \\
     \midrule        
    1 & Leonardo DiCaprio & 10 & Tom Cruise & 12\\
    2 & Johnny Depp & 9 & Robert De Niro & 10\\
    3 & Al Pacino & 8 & Leonardo DiCaprio & 9 \\
    4 & Robert De Niro & 8 & Brad Pitt & 8\\
    5 & Brad Pitt & 7& Johnny Depp & 8\\ \bottomrule
    \end{tabular}
 \end{table}

Best Answer

I suggest you drop the vertical lines completely. And increase the value for width of p columns in your \multicolumn.

\documentclass[12pt]{article}
\usepackage{lmodern,array,booktabs}
\begin{document}

\begin{table}[h]
  \centering
  \caption{Top 5 popular casts(1) VS popular casts(2)}
  \label{table:popularCasts}
  \begin{tabular}{@{}l>{\raggedright}p{2cm}>{\raggedright}p{2cm}>{\raggedright}p{2cm}p{2cm}@{}}
    \toprule
    Rank
    & \multicolumn{2}{p{4cm}}{Popular casts selected by users}
    & \multicolumn{2}{p{4cm}@{}}{Popular casts based on movies selected
      by users} \\ \cmidrule(lr){2-3}\cmidrule(l){4-5}
    & Cast name & Popularity & Cast name & Popularity   \\
    \cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(l){5-5}
    1 & Leonardo DiCaprio & 10 & Tom Cruise        & 12 \\
    2 & Johnny Depp       & 9  & Robert De Niro    & 10 \\
    3 & Al Pacino         & 8  & Leonardo DiCaprio & 9  \\
    4 & Robert De Niro    & 8  & Brad Pitt         & 8  \\
    5 & Brad Pitt         & 7  & Johnny Depp       & 8  \\ \bottomrule
  \end{tabular}
\end{table}
\end{document}

enter image description here

Related Question