[Tex/LaTex] Autofit a single column to fit text

tables

I have the following table and would like to have the first column (only) reduced so that the whole table is the same width as the text. I don't want to use p{...cm} because I want the table to fit the text automatically. However, I tried using it anyway, but found it doesn't work if I place it in begin{tabular}{p{1cm}l|l|l|l|l|l}.

\documentclass{article}
\usepackage{multirow,blindtext}

\begin{document}

\blindtext

\begin{tabular}{ll|l|l|l|l|l|}
\cline{3-7}
& & \multicolumn{5}{|c|}{Going to ... dice matching}\\ \cline{3-7}
& & 1 & 2 & 3 & 4 & 5\\ \hline
\multicolumn{1}{|c|}{\multirow{5}{*}{From ... dice matching}} & 1 & 720/7776 
& 5400/7776 & 1500/7776 & 150/7776 & 6/7776\\ \cline{2-7}
\multicolumn{1}{|c|}{} & 2 & & 120/216 & 80/216 & 15/216 & 1/216\\ \cline{2-7}
\multicolumn{1}{|c|}{} & 3 & & & 25/36 & 10/36 & 1/36\\ \cline{2-7}
\multicolumn{1}{|c|}{} & 4 & & & & 5/6 & 1/6\\ \cline{2-7}
\multicolumn{1}{|c|}{} & 5 & & & & & 1\\
\hline
\end{tabular}

\end{document}

Where should I place p{...cm} for it to work?
How can I have the first column width automatically adjust to have the table fit the text?

Thank you for your help!

Best Answer

First, by using tabularx you can set a width of the table and insert a X column. The latter is basically like p, butwith its width automatically set to the width needed to get a table with the given width. Here ist is used for the first column.

By changing the column declaration, so that there are vertical lines between all columns, the \multicolumns for the last five lines can be removed. But the first two lines now need \multicolumns to get rid of the unwanted vertical lines.

And finally \multirow{5}{*}... has to be changed to \multirow{5}{=}... so it takes the width of the column.

\documentclass{article}
\usepackage{multirow,blindtext}
\usepackage{tabularx}

\begin{document}

\blindtext

\noindent
\begin{tabularx}{\textwidth}{|X|l|l|l|l|l|l|}
\cline{3-7}
\multicolumn{2}{c|}{} & \multicolumn{5}{c|}{Going to ... dice matching}\\ \cline{3-7}
\multicolumn{2}{c|}{} & 1 & 2 & 3 & 4 & 5\\ \hline
\multirow{5}{=}{From ... dice matching} & 1 & 720/7776 & 5400/7776 & 1500/7776 & 150/7776 & 6/7776\\ \cline{2-7}
 & 2 & & 120/216 & 80/216 & 15/216 & 1/216\\ \cline{2-7}
 & 3 & & & 25/36 & 10/36 & 1/36\\ \cline{2-7}
 & 4 & & & & 5/6 & 1/6\\ \cline{2-7}
 & 5 & & & & & 1\\
\hline
\end{tabularx}

\end{document}