左侧的文字很好(即我希望它们与左边距对齐),方程数字也很好(即我希望它们与右边距对齐)。但是,我希望中间的 $\xi$ 和 $\sigma$ 项彼此居中,这样公式看起来更整洁。
我怎样才能做到这一点?
提前致谢!
\documentclass[a4paper,12pt,default]{amsart}
\usepackage{subeqnarray}
\begin{document}
\begin{flalign}\refstepcounter{equation}
\text{Gas injection:} &&
\xi = Y_i, &&
\sigma = \left( \dfrac{\bar{s}_{\textrm{air}}-\bar{s}_{i}}{\bar{c}_p} \right)\xi, && \tag{\theequation $a$-$b$}
\end{flalign}
\begin{flalign}\refstepcounter{equation}
\text{Heat addition:} &&
\xi = 0, &&
\sigma = T^\prime/\bar{T}, &&\tag{\theequation $a$-$b$}
\end{flalign}
\end{document}
答案1
你可以使用我的\Cen
宏,看看https://tex.stackexchange.com/a/209732/4427
\documentclass[a4paper,12pt,reqno]{amsart}
\makeatletter
\newcommand{\Cen}[2]{%
\ifmeasuring@
#2%
\else
\makebox[\ifcase\expandafter #1\maxcolumn@widths\fi]{$\displaystyle#2$}%
\fi
}
\makeatother
\begin{document}
\begingroup\renewcommand{\theequation}{\arabic{equation}a-b}
\begin{flalign}
&\text{Gas injection:} &
&\Cen{4}{\xi = Y_i,} &
&\Cen{6}{\sigma = \left( \frac{\bar{s}_{\mathrm{air}}-\bar{s}_{i}}{\bar{c}_p} \right)\xi,} &&
\\[1ex]
&\text{Heat addition:} &
&\Cen{4}{\xi = 0,} &
&\Cen{6}{\sigma = T^\prime/\bar{T},} &&
\end{flalign}
\endgroup
\end{document}
我还会考虑标准对齐:
\begingroup\renewcommand{\theequation}{\arabic{equation}a-b}
\begin{flalign}
&\text{Gas injection:} &
\xi &= Y_i, &
\sigma &= \left( \frac{\bar{s}_{\mathrm{air}}-\bar{s}_{i}}{\bar{c}_p} \right)\xi, &&
\\[1ex]
&\text{Heat addition:} &
\xi &= 0, &
\sigma &= T^\prime/\bar{T}, &&
\end{flalign}
\endgroup
您可以单独标记方程,但必须明确给出子方程字母。我还为子方程字母实现了数学模式(尽管我自己不会使用它)。
\documentclass[a4paper,12pt,reqno]{amsart}
\makeatletter
\newcommand{\Cen}[2]{%
\ifmeasuring@
#2%
\else
\makebox[\ifcase\expandafter #1\maxcolumn@widths\fi]{$\displaystyle#2$}%
\fi
}
\let\extra@label\label
\newcounter{equationtemp}
\newcommand{\extralabel}[2]{%
\begingroup
\setcounter{equationtemp}{\value{equation}}%
\renewcommand{\theequationtemp}{\arabic{equationtemp}$#1$}%
\refstepcounter{equationtemp}%
\extra@label{#2}%
\endgroup
}
\makeatother
\begin{document}
\begingroup\renewcommand{\theequation}{\arabic{equation}$a$-$b$}
\begin{flalign}
\label{first}
&\text{Gas injection:} &
&\Cen{4}{\xi = Y_i,} \extralabel{a}{one} &
&\Cen{6}{\sigma = \left( \frac{\bar{s}_{\mathrm{air}}-\bar{s}_{i}}{\bar{c}_p} \right)\xi,}
\extralabel{b}{two} &&
\\[1ex]
\label{second}
&\text{Heat addition:} &
&\Cen{4}{\xi = 0,} \extralabel{a}{three} &
&\Cen{6}{\sigma = T^\prime/\bar{T},} \extralabel{b}{four} &&
\end{flalign}
\endgroup
\ref{one} and \ref{two}; \ref{three} and \ref{four}; \ref{first} and \ref{second}.
\eqref{one} and \eqref{two}; \eqref{three} and \eqref{four}; \eqref{first} and \eqref{second}.
\end{document}
答案2
我提出这些解决方案是基于一个正常的align
环境,在一个fleqn
环境中nccmath
,本地设置fleqn
的选项amsmath
,并借助 自定义标签形式mathtools
。
有两种变体:要么列在标志上对齐=
,要么仅左列对齐,但右列居中(在左列中,每行的宽度太近,将它们居中看起来不太好看,但如果您愿意也可以这样做)。使用eqparbox
标签系统的包装可实现居中,因此共享相同标签的盒子的宽度为系列中最大的自然宽度。
\documentclass[a4paper,12pt,default, reqno]{amsart}
\usepackage{mathtools, nccmath}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M]{\eqmakebox[#1]{$\displaystyle#2$}}
\usepackage[showframe]{geometry}
\newtagform{a-b}{(}{a-b)}
\begin{document}
\begin{fleqn}
\usetagform{a-b}
\begin{align}%\
& \text{Gas injection:} &
\xi & = Y_i, & \sigma & = \left( \dfrac{\bar{s}_{\textrm{air}}-\bar{s}_{i}}{\bar{c}_p} \right)\xi, \\[0.5ex]
& \text{Heat addition:} & \xi & = 0, & \sigma & = T^\prime/\bar{T},
\end{align}
\end{fleqn}
\bigskip
\begin{fleqn}
\usetagform{a-b}
\begin{align}%\
& \text{Gas injection:} & \xi &= Y_i, & &
\eqmathbox[R]{\sigma = \left( \dfrac{\bar{s}_{\textrm{air}}-\bar{s}_{i}}{\bar{c}_p} \right)\xi}, \\[0.5ex]
& \text{Heat addition:} & \xi &= 0, & & \eqmathbox[R]{\sigma = T^\prime/\bar{T},}
\end{align}
\end{fleqn}
\end{document}