在同一行的左侧和中心方程式上刷新文本(不起作用!)

在同一行的左侧和中心方程式上刷新文本(不起作用!)

latex 的输出

我想让“质量”和“动量”文本部分与页面左侧对齐(上一段中的“稳定”和“版本”),同时让方程式保持在同一行并居中。我尝试使用 {align}、\llap、{aligned}、{flalign},但都无法正常工作。我想在 {subequations} 命令中标记每个方程式以引用它们,因此在每个子方程式中使用 \begin{equation}。

\llap 已成功帮助我使文本不干扰方程式的中心化,但使用 \begin{flushleft}、\begin{flushright} 等只会产生错误。这是我的代码:

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{graphicx} % Required for the inclusion of images
\usepackage{setspace}        % for use of \singlespacing and \doublespacing
\usepackage{pdfpages}
\usepackage{cite}
\usepackage[section]{placeins}
\usepackage{comment}
\usepackage{hyperref}
\usepackage{siunitx}
\usepackage{color}
\usepackage{ragged2e}
\usepackage{esvect}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{lscape}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{array}
\usepackage{soul}
\usepackage{bm}
\usepackage{url}
\usepackage{xparse}

\begin{document}

We can simplify our analysis by assuming the flow is inviscid ($\tau_{i,j}$ = 0), an ideal gas ($p = \rho RT$), and calorically perfect ($c_p$, $c_v$ = constant). Thus, for a homogeneous, steady, uniform gas flow in a straight duct without heat conduction, the linearised governing equations can be written as:

\begin{subequations}
\begin{equation}
\label{eq:linear_EOM_vector_mass}
\llap{\text{Mass}}\frac{\bar{D}\rho'}{Dt} + \bar{\rho}\nabla\cdot\boldsymbol{u}' = 
\mathbf{0}
\end{equation}
\begin{equation}
\label{eq:linear_EOM_vector_mom}
\llap{\text{Momentum}}\frac{\bar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} 
\nabla p' = \mathbf{0}
\end{equation}
\end{subequations}

\end{document}

我也尝试过使用 \llap 并自己添加空格(如下所示),但是这很混乱,因为每个方程式都需要不同的间距,并且永远无法正确对齐:

\llap{\text{Momentum}\qquad\qquad\qquad\qquad\qquad\qquad\enspace}

请告诉我该怎么办!提前谢谢您。




编辑#2:有用的评论给出的两种不同替代方案的图像:

在此处输入图片描述

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{graphicx} % Required for the inclusion of images
\usepackage{setspace}        % for use of \singlespacing and \doublespacing
\usepackage{pdfpages}
\usepackage{cite}
\usepackage[section]{placeins}
\usepackage{comment}
\usepackage{hyperref}
\usepackage{siunitx}
\usepackage{color}
\usepackage{ragged2e}
\usepackage{esvect}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{lscape}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{array}
\usepackage{soul}
\usepackage{bm}
\usepackage{url}
\usepackage{xparse}

\begin{document}

We can simplify our analysis by assuming the flow is inviscid ($\tau_{i,j}$ = 0), an ideal gas ($p = \rho RT$), and calorically perfect ($c_p$, $c_v$ = constant). Thus, for a homogeneous, steady, uniform gas flow in a straight duct without heat conduction, the linearised governing equations can be written as:

\begin{subequations}
\begin{flalign}
&    \rlap{Mass}     &
    \frac{\bar{D}\rho'}{Dt} + \bar{\rho}\nabla\cdot\boldsymbol{u}'
            & = \mathbf{0}  &   \label{eq:linear_EOM_vector_mass}\\
&    \rlap{Momentum} &
    \frac{\bar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} \nabla p'
            & = \mathbf{0}  &   \label{eq:linear_EOM_vector_mom}\\
&    \rlap{Energy}     &
    c_p\frac{\bar{D}}{Dt}(\bar{\rho}T' + \rho'\bar{T}) + \nabla \cdot     (\boldsymbol{u'}\bar{p} + \bar{\boldsymbol{u}}p')
            & = \dot{q}'\bar{\rho} + \bar{\dot{q}}\rho'   &       \label{eq:linear_EOM_vector_energy}\\
&    \rlap{Entropy}     &
    \frac{\bar{D}s'}{Dt}
            & = \frac{\dot{q}'}{\bar{\rho}\bar{T}}  &       \label{eq:linear_EOM_vector_entropy}\\
&    \rlap{Vorticity}     &            
    \frac{\bar{D}\boldsymbol{\xi}'}{Dt}
            & = \mathbf{0}  &   \label{eq:linear_EOM_vector_vorticity}           
\end{flalign}
\end{subequations}

\begin{subequations}
\begin{flalign}
 & \rlap{Mass} & & \frac{\bar{D}\rho'}{Dt} +     \bar{\rho}\nabla\cdot\boldsymbol{u}' = \mathbf{0} &     \label{eq:linear_EOM_vector_mass}\\
 & \rlap{Momentum} & & \frac{\bar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}}     \nabla p' = \mathbf{0} & \label{eq:linear_EOM_vector_mom}\\
 & \rlap{Energy} & & c_p\frac{\bar{D}}{Dt}(\bar{\rho}T' + \rho'\bar{T}) +     \nabla \cdot (\boldsymbol{u'}\bar{p} +\bar{\boldsymbol{u}}p') =     \dot{q}'\bar{\rho} + \bar{\dot{q}}\rho' & \label{eq:linear_EOM_vector_energy}\\
 & \rlap{Entropy} & & \frac{\bar{D}s'}{Dt} = \frac{\dot{q}'}    {\bar{\rho}\bar{T}} & \label{eq:linear_EOM_vector_entropy}\\
 & \rlap{Vorticity} & & \frac{\bar{D}\boldsymbol{\xi}'}{Dt} = \mathbf{0} &     \label{eq:linear_EOM_vector_vorticity}    
\end{flalign}
\end{subequations}

\end{document}

答案1

这里有三种可能性;前两种是基于环境的变体flalign,方程式相对于左边距文本的位置不同。第三种可能性是将文本彼此对齐,与方程式保持一定距离。它基于alignat

\documentclass[a4paper, 12pt, default, numbered, print, index]{article}
\usepackage{mathtools}

\usepackage{eqparbox} \newcommand{\eqmathbox}2[M]{\eqmakebox[#1]{$\displaystyle#2$}}

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
<5><6><7><8><9><10>
<10.95><12><14.4><17.28><20.74><24.88>
mathx10
}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\widebar}{0}{mathx}{"73}

\begin{document}

We can simplify our analysis by assuming the flow is inviscid ($\tau_{i,j}$ = 0), an ideal gas ($p = ρRT$), and calorically perfect ($c_p$, $c_v$ = constant). Thus, for a homogeneous, steady, uniform gas flow in a straight duct without heat conduction, the linearised governing equations can be written as:

\begin{subequations}
\begin{flalign}
\label{eq:linear_EOM_vector_mass}
 & \rlap{Mass} & &\eqmathbox{\frac{\widebar{D}\rho'}{Dt} + \bar{ρ}∇ · \boldsymbol{u}' = \mathbf{0}} & \\[0.8ex]
\label{eq:linear_EOM_vector_mom}
 & \rlap{Momentum} & &\eqmathbox{\frac{\widebar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{ρ}}
∇ p' = \mathbf{0}}
\end{flalign}
\end{subequations}

\begin{subequations}
\begin{flalign}
\label{eq:linear_EOM_vector_mass}
 & \text{Mass} & & \frac{\widebar{D}\rho'}{Dt} + \bar{ρ}∇ · \boldsymbol{u}' = \mathbf{0} &\hspace{12em} \\[0.8ex]
\label{eq:linear_EOM_vector_mom}
 & \text{Momentum} & & \frac{\widebar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{ρ}}
∇ p' = \mathbf{0}&&
\end{flalign}
\end{subequations}

\begin{subequations}
\begin{alignat}{2}
\label{eq:linear_EOM_vector_mass}
 & \text{Mass} &\hspace{3em} &\frac{\widebar{D}\rho'}{Dt} + \bar{ρ}∇ · \boldsymbol{u}' = \mathbf{0} \\[0.8ex]
\label{eq:linear_EOM_vector_mom}
 & \text{Momentum} & & \frac{\widebar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{ρ}}
∇ p' = \mathbf{0}
\end{alignat}
\end{subequations}

\end{document} 

在此处输入图片描述

编辑:以下是如何将第一个解决方案适配到 OP 代码的最后一个版本(两种变体):

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{graphicx} % Required for the inclusion of images
\usepackage{setspace} % for use of \singlespacing and \doublespacing
\usepackage{pdfpages}
\usepackage{cite}
\usepackage[section]{placeins}
\usepackage{comment}
\usepackage{siunitx}
\usepackage{color}
\usepackage{ragged2e}
\usepackage{esvect}
\usepackage{mathtools}
\usepackage{lscape}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{array}
\usepackage{soul}
\usepackage{bm}
\usepackage{url}
\usepackage{xparse}
\usepackage{hyperref}
\newcommand{\myeqlabel}[1]{\rlap{\bfseries#1}}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M]{\eqmakebox[#1]{$\displaystyle#2$}}

    \DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
    \DeclareFontShape{U}{mathx}{m}{n}{
    <5><6><7><8><9><10>
    <10.95><12><14.4><17.28><20.74><24.88>
    mathx10
    }{}
    \DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
    \DeclareFontSubstitution{U}{mathx}{m}{n}
    \DeclareMathAccent{\widebar}{0}{mathx}{"73}


\begin{document}

We can simplify our analysis by assuming the flow is inviscid ($\tau_{i,j} = 0$), an ideal gas ($p = \rho RT$), and calorically perfect ($c_p$, $c_v$ = constant). Thus, for a homogeneous, steady, uniform gas flow in a straight duct without heat conduction, the linearised governing equations can be written as:
\begin{subequations}
\begin{flalign}
& \myeqlabel{Mass} &&
    \eqmathbox{\frac{\widebar{D}\rho'}{Dt} + \bar{\rho}\,\nabla\cdot\boldsymbol{u}'
            = \mathbf{0}} & \label{eq:linear_EOM_vector_mass}\\
& \myeqlabel{Momentum} &&
    \eqmathbox{\frac{\widebar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} \nabla p'
            = \mathbf{0}} & \label{eq:linear_EOM_vector_mom}\\
& \myeqlabel{Energy} && 
    \eqmathbox{c_p\frac{\widebar{D}}{Dt}(\bar{\rho}\,T' + \rho'\widebar{T}) + \nabla \cdot (\boldsymbol{u'}\bar{p} + \bar{\boldsymbol{u}}p')
            = \dot{q}'\bar{\rho} + \bar{\dot{q}}\rho' }& \label{eq:linear_EOM_vector_energy}\\
& \myeqlabel{Entropy} && 
    \eqmathbox{\frac{\widebar{D}s'}{Dt}
            = \frac{\dot{q}'}{\bar{\rho}\,\bar{T}}} & \label{eq:linear_EOM_vector_entropy}\\
& \myeqlabel{Vorticity} &&
    \eqmathbox{\frac{\widebar{D}\boldsymbol{\xi}'}{Dt}
            = \mathbf{0}} & \label{eq:linear_EOM_vector_vorticity}
\end{flalign}
\end{subequations}
\begin{subequations}
\begin{flalign}
& \myeqlabel{Mass} &&
    \eqmathbox{\frac{\widebar{D}\rho'}{Dt} + \bar{\rho}\,\nabla\cdot\boldsymbol{u}'
            = \mathbf{0}} & \label{eq:linear_EOM_vector_mass}\\
& \textbf{Momen\rlap{tum}} &&
    \eqmathbox{\frac{\widebar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} \nabla p'
            = \mathbf{0}} & \label{eq:linear_EOM_vector_mom}\\
& \myeqlabel{Energy} &&
    \eqmathbox{c_p\frac{\widebar{D}}{Dt}(\bar{\rho}\,T' + \rho'\widebar{T}) + \nabla \cdot (\boldsymbol{u'}\bar{p} + \bar{\boldsymbol{u}}p')
            = \dot{q}'\bar{\rho} + \bar{\dot{q}}\rho' }& \label{eq:linear_EOM_vector_energy}\\
& \myeqlabel{Entropy} &&
    \eqmathbox{\frac{\widebar{D}s'}{Dt}
            = \frac{\dot{q}'}{\bar{\rho}\,\bar{T}}} & \label{eq:linear_EOM_vector_entropy}\\
& \myeqlabel{Vorticity} &&
    \eqmathbox{\frac{\widebar{D}\boldsymbol{\xi}'}{Dt}
            = \mathbf{0}} & \label{eq:linear_EOM_vector_vorticity}
\end{flalign}
\end{subequations}

\end{document} 

在此处输入图片描述

答案2

像这样?

在此处输入图片描述

使用flalign

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{mathtools}

\begin{document}

\lipsum[11]

\begin{subequations}
\begin{flalign}
&    \text{Mass}     &
    \frac{\bar{D}\rho'}{Dt} + \bar{\rho}\nabla\cdot\boldsymbol{u}'
            & = \mathbf{0}  &   \label{eq:linear_EOM_vector_mass}\\
&    \text{Momentum} &
    \frac{\bar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} \nabla p'
            & = \mathbf{0}  &   \label{eq:linear_EOM_vector_mom}
\end{flalign}
\end{subequations}

\end{document}

注意:因此,仅mathtools加载amsmath它就足够了。

附录: 尝试这个:

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{mathtools}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}

\begin{document}

\lipsum[11]

\begin{subequations}
\begin{center}
\begin{tabularx}{\linewidth}{lX}
Mass            &
\begin{equation}\label{eq:linear_EOM_vector_mass}
\frac{\bar{D}\rho'}{Dt} + \bar{\rho}\nabla\cdot\boldsymbol{u}' = \mathbf{0} 
\end{equation}          \\
Momentum        &
\begin{equation}\label{eq:linear_EOM_vector_mom}
\frac{\bar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} \nabla p' = \mathbf{0}    
\end{equation}          \\
Energy          &
\begin{equation}\label{eq:linear_EOM_vector_energy}
c_p\frac{\bar{D}}{Dt}(\bar{\rho}T' + \rho'\bar{T}) + \nabla \cdot     (\boldsymbol{u'}\bar{p} + \bar{\boldsymbol{u}}p') = \dot{q}'\bar{\rho} + \bar{\dot{q}}\rho'   
\end{equation}
\end{tabularx}
\end{center}
\end{subequations}

\end{document}

在此处输入图片描述

答案3

您可能想要使用flalign。在示例中,我删除了所有不必要的包(添加您需要的包,但请注意应该hyperref最后加载)。文本和显示之间不应有空行。

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}

\begin{document}

We can simplify our analysis by assuming the flow is
inviscid ($\tau_{i,j}$ = 0), an ideal gas ($p = \rho RT$),
and calorically perfect ($c_p$, $c_v$ = constant). Thus,
for a homogeneous, steady, uniform gas flow in a straight
duct without heat conduction, the linearised governing
equations can be written as:
\begin{subequations}
\begin{flalign}
\label{eq:linear_EOM_vector_mass}
&\text{Mass}
&&\frac{\bar{D}\rho'}{Dt} + \bar{\rho}\nabla\cdot\boldsymbol{u}' = \mathbf{0}
&
\\[1ex]
\label{eq:linear_EOM_vector_mom}
&\text{Momentum}
&&\frac{\bar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} \nabla p' = \mathbf{0}
&
\end{flalign}
\end{subequations}

\end{document}

在此处输入图片描述

另一方面,我认为没有理由将标签左对齐:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{calc}

\begin{document}

We can simplify our analysis by assuming the flow is
inviscid ($\tau_{i,j}$ = 0), an ideal gas ($p = \rho RT$),
and calorically perfect ($c_p$, $c_v$ = constant). Thus,
for a homogeneous, steady, uniform gas flow in a straight
duct without heat conduction, the linearised governing
equations can be written as:
\begin{subequations}
\begin{alignat}{2}
\label{eq:linear_EOM_vector_mass}
&\makebox[0pt][r]{\makebox[\widthof{Momentum}][l]{Mass}}
&\qquad&\frac{\bar{D}\rho'}{Dt} + \bar{\rho}\nabla\cdot\boldsymbol{u}' = \mathbf{0}
\\[1ex]
\label{eq:linear_EOM_vector_mom}
&\makebox[0pt][r]{Momentum}
&\qquad&\frac{\bar{D}\mathbf{u}'}{Dt} + \frac{1}{\bar{\rho}} \nabla p' = \mathbf{0}
\end{alignat}
\end{subequations}

\end{document}

在此处输入图片描述

相关内容