# How to set the width of \multirow within \multicolumn to full table width

I wish to have a multirowed-multicolumned text on the bottom of my table.

Where i put in explanatory text for superscripts in the table, as well as explain any abbreviations.

I can in a way force this just using multicolumn and manually breaking my text into many rows, but the text is then not justified, which I want.

MWE:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{multirow}

\begin{document}
\begin{table}[]
\centering
\caption{Caption}}
\label{}
\resizebox{\textwidth}{!}{%
\begin{tabular}{ccccccccccccc}
&                           &              &  & \multicolumn{9}{c}{A}                                                                                     \\ \cline{5-13}
&                           &              &  & \multicolumn{4}{c}{1}                          &  & \multicolumn{4}{c}{2}                            \\ \cline{5-8} \cline{10-13}
C:DBE     & \textit{m/z} [M + Na]$^+$ & Compound$^e$ &  & Peaks & Isomers &      & Most abundant FA pair$^a$ &  & Peaks & Isomers &      & Most abundant FA pair$^a$   \\ \cline{1-3} \cline{5-8} \cline{10-13}
C:DBE        & value                 &              &  &       &         &      &                           &  & 1     & 2       &      & thing/                   \\
\multicolumn{13}{l}{\multirow{}{\dimexpr\textwidth-2\tabcolsep\relax}{$^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns}}

\end{tabular}%
}
\end{table}

\end{document}


I want the very long text to span the full width of the table. i tried setting width as \textwidth, but it ends up exactly similar to this.

Sorry if the image appears in the middle of the text I cant figure out how to move it.

• why do you need it to be multirow?? if it is full width it can not be spanning rows in other columns. It just needs to be in a \multicolumn or simpler, put it after the table. Apr 23 '20 at 10:52
• try to avoid \resizebox{\textwidth}{!}{% resizing tables should only be a last resort (and even then avoid it) Apr 23 '20 at 10:53
• @DavidCarlisle how do I put it after the table and at the same time "stick it" to the table - and keep the text the same size as the text in the table. As for the resize - the table needs to fit within an A4 page (standard for journals) - and I don't know how to do it otherwise... Apr 23 '20 at 10:58
• just use a blank line after the end tabular and then place the text remove the resizebox so you can control the font size, then use \small or \footnotesize or whatever font size works, using scaling and getting inconsistent fonts and rule widths makes it impossible to get reasonable output Apr 23 '20 at 11:00
• Ah, thanks. Placing the text between \end{tabular} and \end{table} worked great. Didn't know I could do that. I can't figure out the sizeing without resize though, it becomes a mess with 13 columns. But I can live with using the resize. Apr 23 '20 at 11:06

You do not need \multicolumn or \multirow here nor to scale the table to an arbitrary and inconsistent font size.

Just choose a smaller font size (\scriptsize here) and move the notes after the table.

\documentclass[12pt]{article}

\newcommand\hd[1]{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}

\begin{document}
\begin{table}[htp]

\caption{Caption\label{zz}}

\scriptsize
\setlength\tabcolsep{1.9pt}
\begin{tabular}{@{}ccccccccccccc@{}}
&                           &              &  & \multicolumn{9}{c@{}}{A}                                                                                     \\ \cline{5-13}
&                           &              &  & \multicolumn{4}{c}{1}                          &  & \multicolumn{4}{c@{}}{2}                            \\ \cline{5-8} \cline{10-13}
C:DBE     & \textit{m/z} [M + Na]$^+$ & Compound$^e$ &  & Peaks & Isomers &      & \hd{Most abundant\\ FA pair$^a$} &  & Peaks & Isomers &      & \hd{Most abundant\\ FA pair$^a$}   \\
\cline{1-3} \cline{5-8} \cline{10-13}
C:DBE        & value                 &              &  &       &         &      &                           &  & 1     & 2       &      & thing/                   \\
\end{tabular}

$^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns

\end{table}

\end{document}


Here is an attempt of putting in a MWE what David already said. I used adjustbox instead of \resizebox. ragged2e is for \justify.

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{ragged2e}

\begin{document}
\begin{table}[]
\centering
\caption{Caption}
\label{}
\begin{tabular}{*{13}{c}}
&                           &              & & \multicolumn{9}{c}{A}                                                                                     \\ \cline{5-13}
&                           &              & & \multicolumn{4}{c}{1}                                                                                                     &         & \multicolumn{4}{c}{2}                            \\ \cline{5-8} \cline{10-13}
C:DBE & \textit{m/z} [M + Na]$^+$ & Compound$^e$ & & Peaks                                                                                                                     & Isomers &                                                                               & Most abundant FA pair$^a$ & & Peaks & Isomers & & Most abundant FA pair$^a$   \\ \cline{1-3} \cline{5-8} \cline{10-13}
C:DBE & value                     &              & &                                                                                                                           &         &                                                                               &                           & & 1     & 2       & & thing/                   \\
\end{tabular}%
}
\justify{\scriptsize
a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns a very long text that spans 4-5 lines and all columns
}
\end{table}

\end{document}


• er no I said don't resize tables!!! changing \resizebox to adjustbox isn't a change at all as adjustbox just calls \resizebox agaon and also you have omited teh % after \adjustbox{width=\textwidth}{ and the syntax \justify{\scriptsize a very long text ... } is completely wrong and sets the small text on a large baseline, as your image shows. Apr 23 '20 at 15:52

I think that probably you're after the functionality of threeparttable Other than that, it is almost impossible to have 13 columns fitting the text width of a4 paper, even playing with the fontsize and the value of \tabcolsep. So I suggest to use a sidewaystable. I added some æsthetic improvements such as the use of the rules from booktabs and two-line columnheads with makecell:

\documentclass[12pt]{article}
\usepackage{graphicx, rotating}
\usepackage{threeparttable}
\usepackage{makecell}
\usepackage{booktabs}

\begin{document}

\begin{sidewaystable}%[!htb]
\centering\small \setlength{\tabcolsep}{3pt}
\setlength{\cmidrulekern}{0.25em}
\begin{threeparttable}
\caption{Caption}
\label{}
\begin{tabular}{*{13}{c}}
& & & & \multicolumn{9}{c}{A} \\ \cmidrule[\heavyrulewidth]{5-13}
& & & & \multicolumn{4}{c}{1} & & \multicolumn{4}{c}{2} \\ \cmidrule(lr){5-8} \cmidrule(lr){10-13}
C:DBE & \textit{m/z} [M + Na]$^+$ & Compound\tnote{e} & & Peaks & Isomers & & \thead{Most abundant\\ FA pair\tnote{a}} & & Peaks & Isomers & & \thead{Most abundant\\ FA pair\tnote{a}} \\ \cmidrule(lr){1-3} \cmidrule(lr){5-8} \cmidrule(lr){10-13}
C:DBE & value & & & & & & & & 1 & 2 & & thing/ \\
\bottomrule
\end{tabular}%
\begin{tablenotes}[flushleft]\footnotesize\smallskip
\item[a] very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns
\item[e]very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns $^a$ very long text that spans 4-5 lines and all columns
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}

\end{document}
`