[Tex/LaTex] Automatically adjusting the size table cells

tables

Is it possible to automatically adjust the size table cells according to their content, or to make the size of all cells uniform ?

This is an example:

\begin{table}[t]
\center
\footnotesize
\caption{resultsss}
\label{labss}
\begin{tabular}{ c c }

\begin{tabular}{ | c || c | c | c | c | } \hline
\multicolumn{4}{|c|}{\textbf{a text over here a text over here}} \\ \hline
\textit{Method 1} & 19923 & 123 & 123 \\ \hline
\textit{Method 2} & 1203 & 123 & 123 \\ \hline
\end{tabular}

&

\begin{tabular}{ | c || c | c | c | c | } \hline
\multicolumn{5}{|c|}{\textbf{another text over here}} \\ \hline
\textit{Method 1} & 789 & 789 & 789 & 789 \\ \hline
\textit{Method 2} & 789 & 789 & 789 & 789 \\ \hline
\end{tabular}


\end{tabular}
\end{table}

Best Answer

If \multicolumn span is wider than the columns it spans then all the extra width goes into the last spanned column. This is a feature of the underlying \halign primitive. One solution is to make the intercolumn space wider but shrinkable so that the default sum of the column widths is always greater then the span width. this looks better though if you don't have vertical lines.

enter image description here

I also corrected the \center to \centering and added a necessary preamble.

\documentclass{article}

\begin{document}

\begin{table}[t]
\centering
\footnotesize
\caption{resultsss}
\label{labss}
\begin{tabular}{ c c }

\begin{tabular*}{.5\textwidth}{ @{\extracolsep{\textwidth minus \textwidth}}| c || c | c | c |@{} } \hline
\multicolumn{4}{@{}|c|@{}}{\textbf{a text over here a text over here}}\\ \hline
\textit{Method 1} & 19923 & 123 & 123 \\ \hline
\textit{Method 2} & 1203 & 123 & 123 \\ \hline
\end{tabular*}

&

\begin{tabular}{ | c || c | c | c | c | } \hline
\multicolumn{5}{|c|}{\textbf{another text over here}} \\ \hline
\textit{Method 1} & 789 & 789 & 789 & 789 \\ \hline
\textit{Method 2} & 789 & 789 & 789 & 789 \\ \hline
\end{tabular}


\end{tabular}
\end{table}


\end{document}