[Tex/LaTex] Wrapping text within a multirow cell

tables

I've managed to create a table with multirow and multicolumn with fixed widths in the columns. However, I cannot change the width of the column that contains 'Condition'. Ideally I want the text within the column to wrap. Does someone know how I can get the text to wrap and be a set width? Right now I gave it the default '*'. Thank you!

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

\begin{table}
  \begin{tabular}{|c|c|c|c|c|c|c|}

    \hline
    \multirow{3}{*}{Condition} &

    \multicolumn{6}{|c|}{Metrics} \\
    \cline{2-7}

    & \multicolumn{2}{|C{3cm}|}{Length ($\mu$m)}
    & \multicolumn{2}{|C{3cm}|}{Width ($\mu$m)}
    & \multicolumn{2}{|C{3cm}|}{Area ($\mu$m\textsuperscript{2})} \\

    \cline{2-7}
    & \multicolumn{1}{|C{1.5cm}|}{Mean}
    & \multicolumn{1}{|C{1.5cm}|}{SD}
    & \multicolumn{1}{|C{1.5cm}|}{Mean}
    & \multicolumn{1}{|C{1.5cm}|}{SD}
    & \multicolumn{1}{|C{1.5cm}|}{Mean}
    & \multicolumn{1}{|C{1.5cm}|}{SD}  \\
    \hline
  \end{tabular}

\end{table}

Best Answer

Instead of using fixed column widths and the m column type, I would load the tabularx package and use its tabularx environment. This approach makes sure that the table will fit inside the width of the text block. In addition, the X column type (and derived column types, such as C and L in the example below) allow automatic line-wrapping.

I would also omit all vertical bars (they're not needed! really!) and use the line-drawing macros of the booktabs package instead of \hline and \cline. Oh, and do look into the siunitx package and, in particular, this package's \si macro that simplifies the consistent writing of scientific units)

enter image description here

\documentclass{article}
\usepackage{tabularx,booktabs,ragged2e,siunitx}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}
\newcommand\mytab[1]{\smash{%
  \begin{tabular}[t]{@{}L@{}} #1 \end{tabular}}}
\begin{document}
\begin{table}
\setlength\tabcolsep{5pt} % optional (default is 6pt)

\begin{tabularx}{\textwidth}{@{} L *{6}{C} @{}}
\toprule
\mytab{Condition} & \multicolumn{6}{c@{}}{Metrics} \\
\cmidrule(l){2-7}
& \multicolumn{2}{c}{Length (\si{\micro\meter})}
& \multicolumn{2}{c}{Width (\si{\micro\meter})}
& \multicolumn{2}{c@{}}{Area (\si{\micro\meter\squared})} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7} 
& Mean & SD & Mean & SD & Mean & SD  \\
\midrule
Whatever & \dots & \dots & \dots & \dots & \dots & \dots \\
$\cdots$ \\
Whatever \\
\bottomrule
\end{tabularx}

\end{table}
\end{document}