对齐:文本和居中公式

对齐:文本和居中公式

我得到了一个以句子开头的对齐环境。在这个介绍性句子之后,我希望将方程式置于页面的中心,每个等号都位于彼此下方。遵循 MEW:

\documentclass{article}

\usepackage{amsmath,bm}
\usepackage{mathtools}

\begin{document}

\begin{align} \label{eq:gen_alpha}
    \begin{aligned}
        \text{Given } \mathbf{d}_{n},\mathbf{v}_{n} \text{ and } \mathbf{a}_{n} \text{. Find } \mathbf{d}_{n+1},\mathbf{v}_{n+1}, \mathbf{a}_{n+1},\mathbf{d}_{n+\alpha_{f}},\mathbf{v}_{n+\alpha_{f}}, \mathbf{a}_{n+\alpha_{m}} \text {and } \bm{\Phi}_{n+1} \text{ so that:} \\  
        \mathbf{R}^{u}\left(\mathbf{d}_{n+\alpha_{f}},\mathbf{v}_{n+\alpha_{f}},\mathbf{a}_{n+\alpha_{m}},\mathbf{\Phi}_{n+1}\right) &= 0, \\
    \mathbf{R}^{c}\left(\mathbf{d}_{n+\alpha_{f}},\mathbf{\Phi}_{n+1}\right) &= 0, \\
        \mathbf{d}_{n+\alpha_{f}} &= \mathbf{d}_{n}+\alpha_{f}\left(\mathbf{d}_{n+1}-\mathbf{d}_{n}\right), \\      
        \mathbf{v}_{n+\alpha_{f}} &= \mathbf{v}_{n}+\alpha_{f}\left(\mathbf{v}_{n+1}-\mathbf{v}_{n}\right), \\
        \mathbf{a}_{n+\alpha_{m}} &= \mathbf{a}_{n}+\alpha_{m}\left(\mathbf{a}_{n+1}-\mathbf{a}_{n}\right), \\
        \mathbf{v}_{n+1} &= \mathbf{v}_{n}+\Delta t\left(\left(1-\gamma\right)\mathbf{a}_{n}+\gamma\mathbf{a}_{n+1}\right), \\  
        \mathbf{d}_{n+\alpha f} &= \mathbf{d}_{n}+\alpha_{f}\left(\mathbf{d}_{n+1}-\mathbf{d}_{n}\right).
    \end{aligned}
\end{align}

\end{document}

文本对齐很棒,只有所有方程式都应该居中。

感谢帮助 :)

答案1

从定义中删除句子aligned。同样,只有一个编号元素时,使用equation而不是align

\documentclass{article}

\usepackage{amsmath,bm}
\usepackage{mathtools}

\begin{document}

        Given $\mathbf{d}_{n}$, $\mathbf{v}_{n}$ and $\mathbf{a}_{n}$. Find $\mathbf{d}_{n+1}$, $\mathbf{v}_{n+1}$, $\mathbf{a}_{n+1}$, $\mathbf{d}_{n+\alpha_{f}}$, $\mathbf{v}_{n+\alpha_{f}}$, $\mathbf{a}_{n+\alpha_{m}}$ and $\bm{\Phi}_{n+1}$ so that:
\begin{equation} \label{eq:gen_alpha}
    \begin{aligned}  
        \mathbf{R}^{u}\left(\mathbf{d}_{n+\alpha_{f}},\mathbf{v}_{n+\alpha_{f}},\mathbf{a}_{n+\alpha_{m}},\mathbf{\Phi}_{n+1}\right) &= 0, \\
    \mathbf{R}^{c}\left(\mathbf{d}_{n+\alpha_{f}},\mathbf{\Phi}_{n+1}\right) &= 0, \\
        \mathbf{d}_{n+\alpha_{f}} &= \mathbf{d}_{n}+\alpha_{f}\left(\mathbf{d}_{n+1}-\mathbf{d}_{n}\right), \\      
        \mathbf{v}_{n+\alpha_{f}} &= \mathbf{v}_{n}+\alpha_{f}\left(\mathbf{v}_{n+1}-\mathbf{v}_{n}\right), \\
        \mathbf{a}_{n+\alpha_{m}} &= \mathbf{a}_{n}+\alpha_{m}\left(\mathbf{a}_{n+1}-\mathbf{a}_{n}\right), \\
        \mathbf{v}_{n+1} &= \mathbf{v}_{n}+\Delta t\left(\left(1-\gamma\right)\mathbf{a}_{n}+\gamma\mathbf{a}_{n+1}\right), \\  
        \mathbf{d}_{n+\alpha f} &= \mathbf{d}_{n}+\alpha_{f}\left(\mathbf{d}_{n+1}-\mathbf{d}_{n}\right).
    \end{aligned}
\end{equation}

\end{document}

在此处输入图片描述

答案2

这可能就是您正在寻找的。 gerdieAlign

\documentclass{article}

\usepackage{amsmath,bm}
\usepackage{mathtools}

\begin{document}

\begin{align*} \label{eq:gen_alpha}
        \intertext{Given  $\mathbf{d}_{n},\mathbf{v}_{n}$  and  $\mathbf{a}_{n}$. Find  $\mathbf{d}_{n+1},\mathbf{v}_{n+1}, \mathbf{a}_{n+1},\mathbf{d}_{n+\alpha_{f}},\mathbf{v}_{n+\alpha_{f}}, \mathbf{a}_{n+\alpha_{m}}$ and  $\bm{\Phi}_{n+1}$  so that:} 
        \mathbf{R}^{u}\left(\mathbf{d}_{n+\alpha_{f}},\mathbf{v}_{n+\alpha_{f}},\mathbf{a}_{n+\alpha_{m}},\mathbf{\Phi}_{n+1}\right) &= 0, \\
    \mathbf{R}^{c}\left(\mathbf{d}_{n+\alpha_{f}},\mathbf{\Phi}_{n+1}\right) &= 0, \\
        \mathbf{d}_{n+\alpha_{f}} &= \mathbf{d}_{n}+\alpha_{f}\left(\mathbf{d}_{n+1}-\mathbf{d}_{n}\right), \\      
        \mathbf{v}_{n+\alpha_{f}} &= \mathbf{v}_{n}+\alpha_{f}\left(\mathbf{v}_{n+1}-\mathbf{v}_{n}\right), \\
        \mathbf{a}_{n+\alpha_{m}} &= \mathbf{a}_{n}+\alpha_{m}\left(\mathbf{a}_{n+1}-\mathbf{a}_{n}\right), \\
        \mathbf{v}_{n+1} &= \mathbf{v}_{n}+\Delta t\left(\left(1-\gamma\right)\mathbf{a}_{n}+\gamma\mathbf{a}_{n+1}\right), \\  
        \mathbf{d}_{n+\alpha f} &= \mathbf{d}_{n}+\alpha_{f}\left(\mathbf{d}_{n+1}-\mathbf{d}_{n}\right).
\end{align*}

\end{document}

答案3

我不会对齐前两个关系的等号,因为它们是不同类型的,显示会非常不平衡。

\documentclass{article}

\usepackage{amsmath,bm}
\usepackage{mathtools}

\newcommand{\bv}[1]{%
  \ifcat\noexpand#1\relax
    \bm{#1}%
  \else
    \mathbf{#1}%
  \fi
}

\begin{document}

Given $\bv{d}_{n}$, $\bv{v}_{n}$ and $\bv{a}_{n}$, find $\bv{d}_{n+1}$,
$\bv{v}_{n+1}$, $\bv{a}_{n+1}$, $\bv{d}_{n+\alpha_{f}}$, $\bv{v}_{n+\alpha_{f}}$,
$\bv{a}_{n+\alpha_{m}}$ and $\bv{\Phi}_{n+1}$ so that:
\begin{equation}\label{eq:gen_alpha}
\begin{aligned}
&\bv{R}^{u}(\bv{d}_{n+\alpha_{f}},\bv{v}_{n+\alpha_{f}},\bv{a}_{n+\alpha_{m}},\bv{\Phi}_{n+1})=0,\\
&\bv{R}^{c}(\bv{d}_{n+\alpha_{f}},\bv{\Phi}_{n+1}) = 0, \\
&\begin{aligned}
\bv{d}_{n+\alpha_{f}} &= \bv{d}_{n}+\alpha_{f}(\bv{d}_{n+1}-\bv{d}_{n}), \\
\bv{v}_{n+\alpha_{f}} &= \bv{v}_{n}+\alpha_{f}(\bv{v}_{n+1}-\bv{v}_{n}), \\
\bv{a}_{n+\alpha_{m}} &= \bv{a}_{n}+\alpha_{m}(\bv{a}_{n+1}-\bv{a}_{n}), \\
\bv{v}_{n+1} &= \bv{v}_{n}+\Delta t((1-\gamma)\bv{a}_{n}+\gamma\bv{a}_{n+1}), \\
\bv{d}_{n+\alpha f} &= \bv{d}_{n}+\alpha_{f}(\bv{d}_{n+1}-\bv{d}_{n}).
\end{aligned}
\end{aligned}
\end{equation}

\end{document}

在此处输入图片描述

为 找到一个更好的名称\bv(该命令要求参数为单个拉丁字母或单个希腊字母命令)。我还删除了所有 ,\left除了\right引入不需要的空格外,它们没有任何用处。

或者,将前两个置于中央,并在它们后面留出一些垂直空间。

\documentclass{article}

\usepackage{amsmath,bm}
\usepackage{mathtools}

\newcommand{\bv}[1]{%
  \ifcat\noexpand#1\relax
    \bm{#1}%
  \else
    \mathbf{#1}%
  \fi
}

\begin{document}

Given $\bv{d}_{n}$, $\bv{v}_{n}$ and $\bv{a}_{n}$, find $\bv{d}_{n+1}$,
$\bv{v}_{n+1}$, $\bv{a}_{n+1}$, $\bv{d}_{n+\alpha_{f}}$, $\bv{v}_{n+\alpha_{f}}$,
$\bv{a}_{n+\alpha_{m}}$ and $\bv{\Phi}_{n+1}$ so that:
\begin{equation}\label{eq:gen_alpha}
\begin{gathered}
\bv{R}^{u}(\bv{d}_{n+\alpha_{f}},\bv{v}_{n+\alpha_{f}},\bv{a}_{n+\alpha_{m}},\bv{\Phi}_{n+1})=0,\\
\bv{R}^{c}(\bv{d}_{n+\alpha_{f}},\bv{\Phi}_{n+1}) = 0, \\[1ex]
\begin{aligned}
\bv{d}_{n+\alpha_{f}} &= \bv{d}_{n}+\alpha_{f}(\bv{d}_{n+1}-\bv{d}_{n}), \\
\bv{v}_{n+\alpha_{f}} &= \bv{v}_{n}+\alpha_{f}(\bv{v}_{n+1}-\bv{v}_{n}), \\
\bv{a}_{n+\alpha_{m}} &= \bv{a}_{n}+\alpha_{m}(\bv{a}_{n+1}-\bv{a}_{n}), \\
\bv{v}_{n+1} &= \bv{v}_{n}+\Delta t((1-\gamma)\bv{a}_{n}+\gamma\bv{a}_{n+1}), \\
\bv{d}_{n+\alpha f} &= \bv{d}_{n}+\alpha_{f}(\bv{d}_{n+1}-\bv{d}_{n}).
\end{aligned}
\end{gathered}
\end{equation}

\end{document}

在此处输入图片描述

相关内容