多语言展示
当前在线:1574今日阅读:59今日分享:29

Latex公式环境中如何对齐公式?

问题介绍:我们在使用latex进行SCI科技论文写作的过程中经常会遇到公式对齐问题,这篇文档将通过8个具体的程序代码介绍如何在公式环境中如何对齐公式。
工具/原料

latex

方法1

\documentclass{report} \usepackage{amsmath} \usepackage[usestackEOL]{stackengine} \stackMath \setstackgap{L}{1.2\normalbaselineskip} \begin{document} \begin{align} & a+b+c+d+e+f = 15000 && \text{for } a = 1 ... 15  \\ & D_t= \left\{\Centerstack[l]{\text{equation} ,\\ \text{another equation}}\right. &&   \Centerstack{ \text{for } t = 1 ... 10 \\ \text{for } t = 1 ... 10} \end{align} \end{document}程序编译代码如下图

方法2

\documentclass{article} \usepackage{mathtools}  \begin{document}  \begin{alignat}{2} & a+b+c+d+e+f = 15000 &\quad & \text{for } a = 1 ... 15 \\ & D_t= \begin{cases}   \text{equation} , \\   \text{another equation} , \end{cases} & & \begin{aligned}   \text{for } t = 1 ... 10 \\   \text{for } t = 1 ... 10 \end{aligned} \end{alignat}   \end{document}程序编译代码如下图

方法3

\documentclass{article} \usepackage{mathtools}  \begin{document}  \begin{alignat}{2} & a+b+c+d+e+f = 15000 &\quad & \text{for } a = 1 ... 15 \\ & D_t= \mathrlap{\begin{cases}   \text{equation} , & \text{for } t = 1 ... 10 \\   \text{another equation} ,\hspace{1.9em}& \text{for }t = 1 ... 10 \end{cases}} \end{alignat}  \end{document}程序编译代码如下图

方法4

\begin{equation}\label{eq:02}%\begin{aligned}d_{ek}=\left\{\begin{array}{ll} \sqrt{(\bar{x}_{k1}-\bar{x}_{e})^2+(\bar{y}_{k1}-\bar{y}_{e})^2}& {\rm if}  \, \bar{x}_{e}<\bar{x}_{k1}\\ \frac{\left \| \textbf{A}_{ek} \right \|}{l_k} & {\rm if}  \, \bar{x}_{k1} \leq\bar{x}_{e} \leq \bar{x}_{k2}  \\ \sqrt{(\bar{x}_{k2}-\bar{x}_{e})^2+(\bar{y}_{k2}-\bar{y}_{e})^2} &{\rm if}  \, \bar{x}_{e}> \bar{x}_{k2}\end{array}\right.%\end{aligned}\end{equation}程序编译代码如下图

方法5

\begin{equation}\label{eq:05}%\begin{aligned}\left\{\begin{array}{ll}\phi(\textbf{x})>0 & {\rm if}  \, \textbf{x} \in (D \backslash \Omega)\\\phi(\textbf{x})= 0  & {\rm if} \, \textbf{x} \in (\partial \Omega \cap D) \\ \phi(\textbf{x})< 0 &{\rm if}  \, \textbf{x} \in (\Omega \backslash \partial \Omega)\end{array}\right.%\end{aligned}\end{equation}程序编译代码如下图

方法6

\documentclass{article} \usepackage{amsmath} \begin{document}  \[  \begin{cases}    W_n(\mathcal{O}_k) = \bigl\{ X^{(n)}= (x_0, x_1, \dotsc, x_{n-1}) \in      W_n(k) \mid x_i \in \mathcal{O}_k,\ 0 \le i \le n-1 \bigl\}\\   W_n(m_k) = \bigl\{ X^{(n)}= (x_0, x_1, \dotsc, x_{n-1}) \in W_n(k)   \mid x_i\in m_k,\ 0 \le i \le n-1 \bigl\}\\    W_n(m_k)^{(m)} = \bigl\{ X^{(n)} = (x_0, x_1, \dotsc, x_{n-1}) \in      W_n(k) \mid {}\\[-2pt]    \hfill v(x_i)\geq m/p^{n-1-i},\ 0 \le i\le n-1 \bigl\} \end{cases} \]  \end{document}程序编译代码如下图

方法7

\documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{empheq}\begin{document}\[\begin{cases}    W_n(\mathcal{O}_k) =\bigl\{X^{(n)}=(x_0,x_1,\cdots,x_{n-1})\in W_n(k): x_i\in \mathcal{O}_k,\text{ } i\in \{0,1,\cdots, n-1\}\bigr \}\\[1ex]   W_n(m_k)=\bigl\{X^{(n)}=(x_0,x_1,\cdots,x_{n-1})\in W_n(k) :x_i\in m_k,\text{ } i\in \{0,1,\cdots, n-1\} \bigr\} \\[1ex]    W_n(m_k)^{(m)}=     \biggl\{X^{(n)}=(x_0,x_1,\cdots,x_{n-1})\in W_n(k): \:\Bigm\vert     \begin{matrix*}[l]v(x_i)\geq m/p^{n-1-i},\text{ }\\[-0.5ex] i\in\{0,1,\cdots, n-1\}\end{matrix*}\biggr \}    \end{cases}\]\end{document}程序编译代码如下图

方法8

\documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{empheq}\begin{document}\begin{empheq}[left=\empheqlbrace\,, right ={\qquad( i\in \{0,1,\cdots, n-1\})} ]{align*}     & W_n(\mathcal{O}_k) =\bigl\{X^{(n)}=(x_0,x_1,\cdots,x_{n-1})\in W_n(k): x_i\in \mathcal{O}_k \}\bigr \}\\[1ex]     & W_n(m_k)=\bigl\{X^{(n)}=(x_0,x_1,\cdots,x_{n-1})\in W_n(k) :x_i\in m_k \bigr\} \\[1ex]     & W_n(m_k)^{(m)} = \Bigl\{X^{(n)}=(x_0,x_1,\cdots,x_{n-1})\in W_n(k): v(x_i)\geq m/p^{n-1-i} \Bigr \}    \end{empheq}\end{document}程序编译代码如下图

注意事项

欢迎提问,有问必答, 如果对您帮助,请在下面投票,您的认可是我不断分享的动力!

推荐信息