[Tex/LaTex] Subtables and lineno incompatibility

line-numberingsubcaptionsubfloats

Is there any incompatibility between packages subcaption and lineno?

I cannot compile this (dummy) text:

\documentclass{revtex4-1}

\usepackage{subcaption}

\usepackage[mathlines]{lineno}% Enable numbering of text and display math
\modulolinenumbers[2]% Line numbers with a gap of 5 lines
\linenumbers\relax % Commence numbering lines

\begin{document}

\section{Introduction}

Table~\ref{tab:Taula} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\begin{table*}[h!]
\caption{\label{tab:Taula} Mean uncertainties...}

\begin{subtable}{\linewidth}
\caption{S}    
\begin{ruledtabular}
\begin{tabular}{cccccc}
\multicolumn{3}{c}{x} & \multicolumn{3}{c}{y}\\
\cline{1-3} \cline{4-6}
R & G & B & R & G & B\\
\hline
1.8 & 2.2 & 5.5 & 2.0 & 2.4 & 6.3 \\
\end{tabular}
\end{ruledtabular}
\end{subtable}

\begin{subtable}{\linewidth}
\caption{S}    
\begin{ruledtabular}
\begin{tabular}{cccccc}
\multicolumn{3}{c}{x} & \multicolumn{3}{c}{y}\\
\cline{1-3} \cline{4-6}
R & G & B & R & G & B\\
\hline
3.3 & 2.3 & 5.6 & 3.9 & 3.0 & 8.1 \\
\end{tabular}
\end{ruledtabular}
\end{subtable}

\end{table*}

\end{document}

I get this kind of errors:

! Improper \prevdepth. \prevdepth l.16
…n{\label{tab:Taula} Mean uncertainties…} You can refer to
\spacefactor only in horizontal mode; you can refer to \prevdepth only
in vertical mode; and neither of these is meaningful inside \write. So
I'm forgetting what you said and using zero instead. ! You can't use
\prevdepth' in restricted horizontal mode. \nointerlineskip
->\prevdepth
-\@m \p@ l.16 ...n{\label{tab:Taula} Mean uncertainties...} Sorry, but I'm not programmed to handle this case; I'll just pretend that you
didn't ask for it. If you're in the wrong mode, you might be able to
return to the right one by typing
I}' or I$' orI\par'. ! Missing $
inserted.

UPDATE:
It looks like the incompatibility appears when using the revtex documentclass.

Best Answer

Ok, I found an easy solution:

Remove the lineno package and add the option linenumbers in documentclass:

\documentclass[linenumbers]{revtex4-1}

\usepackage{subcaption}

%\usepackage[mathlines]{lineno}% Enable numbering of text and display math
%\modulolinenumbers[2]% Line numbers with a gap of 5 lines
%\linenumbers\relax % Commence numbering lines
Related Question