flalign 环境中的行号

flalign 环境中的行号

为什么以下示例中多了一个编号行?我想删除它,以便行号仅与指定的方程式相对应。我意识到这是由于我的错误造成的,但我看不出我做错了什么:

\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}

答案1

lineno最终对amsmath用于定位对齐的一些内部框进行编号。未经广泛测试,但此修改lineno可检查它是否对零尺寸框进行编号。

在此处输入图片描述

\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}

相关内容