# Width of table and text wrapping using tabularx, cline, multicolumn

I am having problems making a table fit my page. I have used the tabularx environment and the \linewidth parameter, which successfully shortens the width of the \cline, but doesn't force the text to wrap so the table still falls off the page. Ideally, I'd like the headings '(t, n, d)-RTS' and 'Underlying (m, d, 1)-Schemes' to wrap and make the table slightly slimmer. Please see below for an example.

Any help would be appreciated. I've never had any issues with making tabularx and \linewidth work, but don't tend to use \multicolumn that often... is tabularx conflicting with \multicolumn somehow?

\documentclass{article}
\usepackage{tabularx}
\begin{document}

\begin{table}[]
\centering
\begin{tabularx}{\linewidth}{l | l l | l l l | l  l l | }
\cline{2-9}
& \multicolumn{5}{l|}{Combinatorial Schemes [1] }         & \multicolumn{3}{ l | }{MBR Schemes [2]}    \\ \hline
\multicolumn{1}{|l|}{$(t, n, d)-$RTS }  &Underlying  $(m, d, 1)-$ Schemes     & $n$ & $x$ & $y$ & $z$ & $x$ & $y$ & $z$ \\ \cline{1-9}
\multicolumn{1}{|l|}{$(2, n, 3)$}  & $(9, 3, 1)$    & $6 \le n \le 12$  & $1/2$   & $3/2$   & $0.1111$       & $2/3$    & $3/2$     & $1$    \\
\multicolumn{1}{|l|}{$(2, n, 3)$}  & $(15, 3, 1)$    & $10 \le n \le 35$ & $1/2$   & $3/2$   & $0.2222$      & $2/3$    & $3/2$     & $1$    \\
\multicolumn{1}{|l|}{$(2, n, 3)$}  & $(21, 3, 1)$    & $14 \le n \le 70$ & $1/2$   & $3/2$   & $0.3333$       & $2/3$    & $3/2$     & $1$    \\
\hline
\end{tabularx}
\end{table}

\end{document}

• your tabularx has no X columns, so can not work. But you do npt want line breaking here so you would be better to use tabular than tabularx – David Carlisle Jun 23 '17 at 9:05
• Thank you. What are X columns sorry? I have replaced the \tabular line with "\begin{tabular}{p{0.1cm}p{2cm}p{2cm}p{0.5cm}p{0.5cm}p{1cm}p{0.5cm}p{0.5cm}p{0.5cm}} ", which definitely helps, but no matter how small I make the first column, the '(t, n, d)-RTS' does not seem to wrap at all. – arthurmilton Jun 23 '17 at 9:10
• Also, by replacing the line with "\begin{tabular}{p{0.1cm} | p{1.7cm}p{2.3cm} | p{0.5cm}p{0.5cm}p{1cm} | p{0.5cm}p{0.5cm}p{0.5cm} |}", everything fits kind of okay, but on the right, the 'MBR Schemes [2]' does not wrap either. – arthurmilton Jun 23 '17 at 9:18
• you must have seen somewhere some documentation that told you that tabularx existed? The only feature tabularx adds is a new column type X for variable width columns, so any documentation that tells you about tabularx should have mentioned X. (see texdoc tabularx for the main package documentation.) – David Carlisle Jun 23 '17 at 9:20

I would never use tabularx for such a table, also in $n$-foo the - should be a text hyphen, not a minus.

\documentclass{article}
\newcommand\hd[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
\begin{document}

\begin{table}
\centering
\begin{tabular}{l | l l | l l l | l  l l | }
\cline{2-9}
& \multicolumn{5}{c|}{\hd{Combinatorial Schemes\\{}[1]}}         &
\multicolumn{3}{ c | }{\hd{MBR Schemes\\{}[2]}}    \\ \hline
\multicolumn{1}{|c|}{\hd{$(t, n, d)$-\\RTS} }  &
\hd{Underlying\\$(m, d, 1)$-\\Schemes}     & $n$ & $x$ & $y$ & $z$ & $x$ & $y$ & $z$ \\ \cline{1-9}
\multicolumn{1}{|l|}{$(2, n, 3)$}  & $(9, 3, 1)$    & $6 \le n \le 12$  & $1/2$   & $3/2$   & $0.1111$       & $2/3$    & $3/2$     & $1$    \\
\multicolumn{1}{|l|}{$(2, n, 3)$}  & $(15, 3, 1)$    & $10 \le n \le 35$ & $1/2$   & $3/2$   & $0.2222$      & $2/3$    & $3/2$     & $1$    \\
\multicolumn{1}{|l|}{$(2, n, 3)$}  & $(21, 3, 1)$    & $14 \le n \le 70$ & $1/2$   & $3/2$   & $0.3333$       & $2/3$    & $3/2$     & $1$    \\
\hline
\end{tabular}
\end{table}

\end{document}