3

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 typingI}' or I$' orI\par'. ! Missing $ inserted.

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

  • \linenumbers\relax ? If I comment that out, the compilation goes normally The package is about 9 years old. Is it designed for usage with tables at all? – user31729 Aug 22 '14 at 10:32
  • @ChristianHupfer Yes, but without line numbering. Is there any alternative to lineno? – Medical physicist Aug 22 '14 at 10:35
  • caption should not be used with revtex; the subfig package is compatible, loading it with \usepackage[caption=false]{subfig}. – egreg Aug 22 '14 at 10:52
  • @egreg Using subfig I get the same error: ! Improper \prevdepth... – Medical physicist Aug 22 '14 at 11:07
3

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
  • In as much is this the solution? ;-) – user31729 Aug 22 '14 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.