1

I was using both subfig and lineno at the same time.

\documentclass[aapm,graphicx]{revtex4-1}
\usepackage{graphicx}  
\usepackage[caption=false, font=footnotesize]{subfig}
\usepackage{floatrow}

\usepackage[mathlines]{lineno}
\modulolinenumbers[5]
\linenumbers\relax 

\begin{document}

However, when I draw the figure:

\floatsetup[figure]{style=plain,subcapbesideposition=top}
\begin{figure}[htbp]
\sidesubfloat[]{\includegraphics[height=2.0in]{figure5a.eps}}
\sidesubfloat[]{\includegraphics[height=2.0in]{figure5b.eps}}
\caption{  }
\label{fig5}
\end{figure}

\end{document}

Errors come out:

! Improper \prevdepth.<recently read> \prevdepth ...ludegraphics[height=2.0in]{figure5a.eps}}
! You can't use `\prevdepth' in restricted horizontal mode.

But if I comment out \linenumbers\relax, the errors go away although the line number cannot be displayed. Does anyone know how to solve this?

1

First of all, your example document compiles fine when using article instead of revtex4-1, so it seems it's an incompatibility between revtex4-1 and lineno, the figure using floatrow and subfig is just triggering the problem.

Now back to the problem itself: The lineno package tries hard to prevent page breaks at unwanted locations, and this code has changed over time. An excerpt from lineno.sty:

% (New v4.00) 
%                                                  \begin{old}\begin{verbatim}
% %          \kern\z@ 
% \end{verbatim}
%                                                                    \end{old}
% was here previously. What for? 
% According to \TeX book p._125, Stephan's 
% interline penalty is changed into 10000. At the end of a 
% paragraph, the ~\parskip~ would follow that penalty of 10000, 
% so there could be a page break neither at the 
% ~\parskip~ nor at the ~\baselineskip~ (\TeX book p._110)---so 
% there could never be a page break between two paragraphs. 
% So something must screen off the 10000 penalty. 
% Indeed, the ~\kern~ is a place to break. 
% (Stephan once knew this: see `allow pagebreaks' above.)
% 
% Formerly, I tried to replace ~\kern\z@~ by 
%                                                  \begin{old}\begin{verbatim}
% %         \penalty\@LN@parpgpen\relax 
% \end{verbatim}
%                                                                    \end{old}
% ---but this allows a page break after heading. So: 
%% 
      \@LN@parpgbrk 
%% 
%% After heading, ~\kern\z@~ resulting from previous line 
%% (see below) is followed by ~\write~ or ~\penalty10000~, 
%% so causes no page break. 
% 
% These and similar changes were formerly done by ~linenox1.sty~. 
% (/New v4.00) 

\@LN@parpgbrk is defined as:

% (New v4.00, v4.4) Initialize ~\@LN@parpgbrk~, accounting 
% for earlier space and for appropriate columndepth. 
% We use former ~\MakeLineNo~'s depth-preverving trick 
% ~\@LN@depthbox~ again: 

\def\@LN@screenoff@pen{% 
  \ifdim\lastskip=\z@ 
    \@tempdima\prevdepth \setbox\@tempboxa\null 
    \@LN@depthbox                           \fi}

\global\let\@LN@parpgbrk\@LN@screenoff@pen 

% (/New v4.4, v4.00) 

This code is faulty. It assumes that it's in vertical mode always, using \prevdepth without extra check.

Since I don't have enough inside into the code of lineno to offer a bullet-proof fix (Is adding \ifvmode..\fi sufficient?), I suggest simply reverting \@LN@parpgbrk back to \penalty\@LN@parpgpen\relax, so we have at least a workaround for your problem:

\documentclass[aapm,graphicx]{revtex4-1}
\usepackage[demo]{graphicx}  
\usepackage[caption=false, font=footnotesize]{subfig}
\usepackage{floatrow}

\usepackage[mathlines]{lineno}
\modulolinenumbers[5]
\linenumbers\relax 

% Workaround for problem in lineno.sty
\usepackage{etoolbox}
\makeatletter
\patchcmd\linenumberpar{\@LN@parpgbrk}{\penalty\@LN@parpgpen\relax}{}{}
\makeatother

\begin{document}

\floatsetup[figure]{style=plain,subcapbesideposition=top}
\begin{figure}[htbp]
\sidesubfloat[]{\includegraphics[height=2.0in]{figure5a.eps}}%
\sidesubfloat[]{\includegraphics[height=2.0in]{figure5b.eps}}%
\caption{  }
\label{fig5}
\end{figure}

\end{document}

I suggest sending the maintainer of the lineno package a bug report and trying using the above workaround until the problem is fixed.

0

When using \linenumbers\relax in {revtex4-1}, I got a similar error

! Improper \prevdepth.<recently read> \prevdepth \begin{document}. 

By moving the \linenumbers\relax inside \begin{document}...\end{document}, this error is solved!

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.