I have a table with a horizontal title above the multi-columns. In some cases, the horizontal title is wider than the multi-columns. This result in non-equally distributed columns that does not look nice. I need to fix this issue by equally distribute the columns among the space. This is a sample script with afigure.
\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}
\newcommand{\xmark}{\ding{55}}
\newcommand*\rot{\rotatebox{90}}
\begin{document}
\begin{table}
\caption{MyTable}
\centering
\resizebox{\textwidth}{!} {
\begin{tabular} {@{} lc*{14}l @{}}
\hline
\\
\multicolumn{1}{c}{Column1}
&&\multicolumn{3}{c}{Column2}
&&\multicolumn{3}{c}{ColumnLongTitle}
&&\multicolumn{2}{c}{Column3}
&&\multicolumn{2}{c}{Column4}
\\
\cmidrule(lr){1-1}
\cmidrule(lr){3-5}
\cmidrule(lr){7-9}
\cmidrule(lr){11-12}
\cmidrule(lr){14-15}
\\
& \vline &\rot{Title1} & \rot{Title2} & \rot{Title3}
& \vline & \rot{Title1} & \rot{Title2} & \rot{Title3}
& \vline & \rot{Title1} & \rot{Title2}
& \vline & \rot{Title1} & \rot{Title2}
\\ \hline
Row1 & \vline & {} & \cmark & {} & \vline & \cmark & {} & {} & \vline & & \cmark & \vline & \cmark & {} & \\
\hline
Row2 & \vline & \cmark & {} & {} & \vline & \cmark & {} & {} & \vline & {} & \cmark & \vline & \cmark & {} & \\
\hline
Row3 & \vline & {} & \cmark & {} & \vline & \cmark & {} & {} & \vline & {} & \cmark & \vline & \cmark & {} & \\
\hline
\end{tabular}
}
\end{table}
\end{document}
EDIT 2: I tried the solution provided by @Bernard. But, there is another problem. When I need to add long text in the first row, the whole table get distorted. Can you clarify how to avoid such problem. My text length varies. I have quite long text in the most left cell in each row. This is an example of script you can run to see the issue.
\documentclass[10pt]{article}
%\usepackage{showframe}
%\renewcommand\ShowFrameLinethickness{0.3pt}
\usepackage{graphicx}
\usepackage{booktabs, tabularx, caption, makecell}
\setcellgapes{3pt}
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}
\newcommand{\xmark}{\ding{55}}
\newcommand*\rot{\rotatebox{90}}
\begin{document}
\begin{table}
\caption{MyTable}
\centering\makegapedcells
\begin{tabularx}{\linewidth}{@{} l|*{3}{>{\centering\arraybackslash}X} |*{3}{>{\centering\arraybackslash}X}| *{2}{>{\centering\arraybackslash}X}| *{2}{>{\centering\arraybackslash}X}|@{}}
\hline
\multicolumn{1}{c}{Column1}
&\multicolumn{3}{c}{Column2}
&\multicolumn{3}{c}{ColumnLongTitle}
&\multicolumn{2}{c}{Column3}
&\multicolumn{2}{c}{Column4}
\\
\cmidrule(lr){1-1}
\cmidrule(lr){2-4}
\cmidrule(lr){5-7}
\cmidrule(lr){8-9}
\cmidrule(lr){10-11}
\addlinespace
&\rot{Title1} & \rot{Title2} & \rot{Title3}
& \rot{Title1} & \rot{Title2} & \rot{Title3}
& \rot{Title1} & \rot{Title2}
& \rot{Title1} & \rot{Title2}
\\\hline
AAAAAAAAAAAAAAAAAAAAAAAA & {} & \cmark & {} & \cmark & {} & {} & & \cmark & \cmark & {} \\
\hline
Row2 & \cmark & {} & {} & \cmark & {} & {} & {} & \cmark & \cmark & {} \\
\hline
Row3 & {} & \cmark & {} & \cmark & {} & {} & {} & \cmark & \cmark & {} \\
\hline
\end{tabularx}
\end{table}
\end{document}