# Weird error with memoir sidecaption, subbottom and threepartable package

I have a weird error using threepartable, sidecaption, subbottom and memoir class

! You can't use \prevdepth' in restricted horizontal mode. \TPTdoTablenotes ->\par \prevdepth \z@ \TPT@hsize \list {}{\topsep \z@skip ... l.54 \label{pranking:b}}

Here the MWE (updated with answer)

% !TEX encoding =  UTF-8 Unicode
% -*- program: xelatex -*-
\documentclass[a4paper, 11pt,twoside, openright]{memoir}
\usepackage{polyglossia}
\usepackage[flushleft]{threeparttable}
\usepackage{multirow,multicol}
\usepackage{amssymb}
\usepackage{amsmath,mathtools}
\usepackage{mwe} % just for dummy images
\usepackage{graphicx}
\newsubfloat{figure}
\newsubfloat{table}

\begin{document}

\begin{table}[!p]

\begin{sidecaption}[fortoc]{bla with math}
[tab:pranking]
\centering
\subbottom[blabla]{
\includegraphics[width=.4\linewidth]{example-image-c}
\subbottom[]{
\begin{threeparttable}
\begin{tabular}{>{$}l<{$} >{$}l<{$} >{$}l<{$} >{$}l<{$} >{$}l<{$} >{$}l<{$}}
\toprule
\text{solutions candidates} & f_1 & f_2 & \text{dominé par} & v_1 & v_2 \\
\midrule
a      & 3.5    & 1    &  \varnothing & 1 & 1 \\
b      & 3      & 1,5  &  \varnothing & 1 & 1 \\
c      & 2      & 2    &  \varnothing & 1 & 1 \\
d      & 1      & 3    &  \varnothing & 1 & 1 \\
e      & 0.5    & 4    &  \varnothing & 1 & 1 \\
f      & 0.5    & 4.5  &  \{e \}      & 2 & 2 \\
g      & 1.5    & 4.5  &  \{d,e,f,h \} & 5 & 3 \\
h      & 1.5    & 3.5  &  \{d \}      & 2 & 2 \\
i      & 2      & 3.5  &  \{c,d,h \}  & 4 & 3 \\
j      & 2.5    & 3    &  \{c,d \}    & 3 & 2 \\
k      & 3.5    & 2    &  \{a,b,c \}  & 4 & 2 \\
l      & 4.5    & 1    &  \{a \}      & 2 & 2 \\
m      & 4.5    & 2.5  &  \{a,b,c,k,l \} & 6 & 3 \\
n      & 4      & 4    &  \{a,b,c,d,e,h,i,j,k,o \} & 11 & 5 \\
o      & 3      & 4    &  \{b,c,d,e,h,i,j \} & 8 & 4 \\
p      & 5     & 4.5   &  \{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o \} & 16 & 6 \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item bla
\item bla
\end{tablenotes}
\end{threeparttable}

\label{pranking:b}}
\end{sidecaption}

\end{table}
\end{document}

• You start sidecaption in your table and end it after it. I have not tested your code, but this seems wrong to me. – LaRiFaRi Jul 24 '15 at 10:41
• Correct, i change the code, but the error persist... – reyman64 Jul 24 '15 at 10:43
• please change it in your MWE and try to minimize your code as much as possible. Delete line by line until you find the culprit part. – LaRiFaRi Jul 24 '15 at 10:44
• Take a closer look, the threeparttable goes around the table, thus has to go inside the \subbottom – daleif Jul 24 '15 at 10:44
• Correct, i change the mwe – reyman64 Jul 24 '15 at 10:46

This works just fine. Remember to be exact as to where the threeparttable goes. Also the placement of the threeparttable is what saves you here. \subbottom does not really like the table notes list afterwards. But wrapping it in threeparttable, this now becomes a box, as seen by \subbottom, and it is fine with that.

\documentclass[a4paper]{memoir}
\usepackage[flushleft]{threeparttable}
\newsubfloat{figure}
\newsubfloat{table}

\begin{document}

\begin{table}[!p]
\begin{sidecaption}[fortoc]{bla with math}
[tab:pranking]
\centering
\subbottom[blabla]{
some image
\subbottom[]{
\begin{threeparttable}
\begin{tabular}{l}
\toprule
a table of data\\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item bla
\item bla
\end{tablenotes}
\label{pranking:b}
\end{threeparttable}
}
\end{sidecaption}
\end{table}
\end{document}
`