包含由命令定义的方程式的段落文本的行号\begin{align}
未按预期显示。如何修复此问题?
LaTeX 代码附在此处。
\documentclass[a4paper, 12pt]{article}
\usepackage[utf8]{inputenc} % Use the UTF-8 encoding
\usepackage{amsmath} % For the use of math
\usepackage{amsfonts}
\usepackage{amssymb} % For the use of AMS symbols
\usepackage{indentfirst} % For indentation
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{lineno}
\linenumbers
\usepackage{titlesec}
\titleformat*{\section}{\large\bfseries}
\titleformat*{\subsection}{\normalsize\bfseries}
\titleformat*{\subsubsection}{\normalsize}
\renewcommand{\baselinestretch}{1.5}
\usepackage{authblk} % Use author package
\renewcommand*{\Authfont}{\large}
\renewcommand*{\Affilfont}{\normalsize\normalfont}
\makeatletter
\g@addto@macro\normalsize{%
\setlength\abovedisplayskip{0pt}
\setlength\belowdisplayskip{0pt}
\setlength\abovedisplayshortskip{0pt}
\setlength\belowdisplayshortskip{0pt}
}
\makeatother
\title{\textbf{Globally cumstomize the spacing between the text and equation}}
\date{}
\begin{document}
\maketitle
\section{Air filter}
The air filter is simulated by the Control Valve module (AFT in Fig. 2(a)). The pressure drop through the air filter ($ \Delta P_{af} $) is given by the following equation [11,16].
\begin{align}
\Delta P = \Delta P_{d} \left( \frac{m}{m_{d}}\right)^{1.84} \left( \frac{T}{T_{d}}\right) \left( \frac{P}{P_{d}}\right)^{-1}
\end{align}
where, $ \Delta P_{af} $ is the pressure drop, $ m $ is the mass flow rate, $ T $ is the temperature, and $ P $ is the pressure, and subscript $ d $ denotes the design condition.
\newpage
\section{Air compressor (AC)}
The AC operating characteristics can be described by its performance map, which relates the following dimensionless operational variables. The AC operating characteristics can be described by its performance map, which relates the following dimensionless operational variables.
\begin{align}
& \text{Relative pressure ratio:} && PR_{r} = \frac{PR-1}{PR_{d}-1}\\
& \text{Relative isentropic efficiency:} && \eta_{r} = \frac{\eta}{\eta_{d}} \\
& \text{Relative corrected mass flow:} && m_{cor,r} = \frac{\left(\frac{m_{in}}{P_{in}}\sqrt{T_{in}}\right)}{\left(\frac{m_{in,d}}{P_{in,d}}\sqrt{T_{in,d}}\right)} \\
& \text{Relative corrected speed:} && N_{cor,r} = \frac{\left(\frac{N}{\sqrt{T_{in}}}\right)}{\left(\frac{N_{d}}{\sqrt{T_{in,d}}}\right)}
\end{align}
where, $ \eta $ is the efficiency, $ N $ is the shaft speed, and $ PR = P_{in}/P_{out} $. Subscript $ cor $ denotes the corrected value, $ r $ denotes the relative value, $ in $ denotes the inlet, and $ out $ denotes the outlet.
\end{document}
答案1
文档显示lineno
这不仅是显示器的问题align
,也是其他显示器的问题。它提供了一个环境linenomath
来解决这个问题:
\begin{linenomath}
\begin{align}
...
\end{align}
\end{linenomath}
为了避免重写代码,lineno
还提供了一个包选项displaymath
,用于在标准 LaTeX 环境中自动执行此操作。事实证明,可以调整该代码以适用于 AMS 环境,包括align
以下gather
内容:
\documentclass[a4paper, 12pt]{article}
\usepackage[utf8]{inputenc} % Use the UTF-8 encoding
\usepackage{amsmath} % For the use of math
\usepackage{amsfonts}
\usepackage{amssymb} % For the use of AMS symbols
\usepackage[displaymath]{lineno}
\linenumbers
\makeatletter
\let\LN@align\align
\let\LN@endalign\endalign
\renewcommand{\align}{\linenomath\LN@align}
\renewcommand{\endalign}{\LN@endalign\endlinenomath}
\let\LN@gather\gather
\let\LN@endgather\endgather
\renewcommand{\gather}{\linenomath\LN@gather}
\renewcommand{\endgather}{\LN@endgather\endlinenomath}
\makeatother
\begin{document}
\section{Air filter}
The air filter is simulated by the Control Valve module (AFT in
Fig. 2(a)). The pressure drop through the air filter
($ \Delta P_{af} $) is given by the following equation [11,16].
\begin{align}
\Delta P = \Delta P_{d} \left( \frac{m}{m_{d}}\right)^{1.84} \left( \frac{T}{T_{d}}\right) \left( \frac{P}{P_{d}}\right)^{-1}
\end{align}
where, $ \Delta P_{af} $ is the pressure drop, $ m $ is the mass flow rate, $ T $ is the temperature, and $ P $ is the pressure, and subscript $ d $ denotes the design condition.
\begin{align}
x&=y,\\
z&=u.
\end{align}
More text.
The air filter is simulated by the Control Valve module (AFT in
Fig. 2(a)). The pressure drop through the air filter
($ \Delta P_{af} $) is given by the following equation [11,16].
\begin{equation}
\Delta P = \Delta P_{d} \left( \frac{m}{m_{d}}\right)^{1.84} \left( \frac{T}{T_{d}}\right) \left( \frac{P}{P_{d}}\right)^{-1}
\end{equation}
where, $ \Delta P_{af} $ is the pressure drop, $ m $ is the mass flow rate, $ T $ is the temperature, and $ P $ is the pressure, and subscript $ d $ denotes the design condition.
\begin{gather}
x=y,\\
z=u.
\end{gather}
More text.
\end{document}