3

Why is there an additional line being numbered in the following example? I would like to remove this so that the line numbers only correspond to the equations specified. I realize that this is due to a mistake on my part but I can't see what I have done wrong:

\documentclass{article}
\usepackage{amsmath}
\usepackage{lineno}
\linenumbers
\date{}
\begin{document}
\begin{linenomath*}
\begin{flalign}
&Q_{h} = \rho_{a}C_{pa}C_{h}U_{a}\left(T_{s} - T_{a}\right)&\\
&Q_{e} = \rho_{a}LC_{e}U_{a}\left(q_{s}^{*}-q_{s}\right)&\\
&Q_{b} = 0.985\sigma{T_{s}^{4}}\left(\left(0.39-0.05\right)e_{a}^{0.5}\right )\left(1-{0.6 {nc}}\right)
\end{flalign}
\end{linenomath*}
\end{document}
4

lineno ends up numbering some internal boxes that amsmath uses for positioning the alignmnent. Not extensively tested but this modifies lineno to check it isn't numbering a zero sized box.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{lineno}
\makeatletter

\def\MakeLineNo{%
   \@LN@maybe@normalLineNumber                        % v4.31 
   \boxmaxdepth\maxdimen\setbox\z@\vbox{\unvbox\@cclv}%
   \@tempdima\dp\z@ \unvbox\z@
\setbox2\lastbox
\nointerlineskip\copy2
\ifdim\ht2>\z@
   \sbox\@tempboxa{\hb@xt@\z@{\makeLineNumber}}%
   \stepLineNumber
\else
   \setbox\@tempboxa\hbox{}%
\fi
   \ht\@tempboxa\z@ \@LN@depthbox 
%% 
   \@LN@do@vadjusts 
   \count@\lastpenalty 
%% 
   \ifnum\outputpenalty=-\linenopenaltypar 
     \ifnum\count@=\z@ \else 
%% 
       \xdef\@LN@parpgbrk{% 
         \penalty\the\count@
         \global\let\noexpand\@LN@parpgbrk
                      \noexpand\@LN@screenoff@pen}% v4.4 
%% 
     \fi
   \else
%% 
     \@tempcnta\outputpenalty
     \advance\@tempcnta -\linenopenalty
%% 
     \penalty \ifnum\count@<\@tempcnta \@tempcnta \else \count@ \fi 
%% 
   \fi
   }

\makeatletter


\linenumbers
\date{}
\begin{document}


\begin{linenomath*}
\begin{flalign}
&Q_{h} = \rho_{a}C_{pa}C_{h}U_{a}\left(T_{s} - T_{a}\right)&\\
&Q_{e} = \rho_{a}LC_{e}U_{a}\left(q_{s}^{*}-q_{s}\right)&\\
&Q_{b} = 0.985\sigma{T_{s}^{4}}\left(\left(0.39-0.05\right)e_{a}^{0.5}\right )\left(1-{0.6 {nc}}\right)
\end{flalign}%


aaa

\end{linenomath*}%
\end{document}

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.