我是 LaTex 新手,但我正在尝试使方程编号与方程对齐。但是,一直发生的情况(我无法解释原因)是,我的方程编号开始出现在第 10 个方程的下方。前 9 个方程似乎没问题,但我并没有真正改变我的格式,所以我无法解释问题所在。此外,我不确定您将如何在方程编号前获得一些额外的空间,因为它看起来相当混乱。
就像我说的,我对 LaTex 还很陌生,所以我的代码可能很粗糙,但如果有人有任何建议,我会很高兴听到。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage[margin=1in, includefoot]{geometry}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{enumitem}
\usepackage{ stmaryrd }
\usepackage{comment}
\begin{document}
\begin{align}
\min_{L_{t}} \quad & \sum_{i=1}^I\sum_{j=1}^J\sum_{t=1}^T(a + b L_{t}^{ij}) G_{t,PostDispersal}^{ij} \\
\text{s.t.} \quad & j_{t,k} = sj_{t-1,k-1} & k=2,...,kmax; \quad \forall i,j,t \\
\quad & j_{t,1} = dJ_{t-1} + \tilde{d}\mathcal{G}_{t-1} & \forall i,j,t \\
\quad & J_{t} = \sum_{k=1}^{kmax} j_{t,k} & \forall i,j,t \\
\quad & S_{t} = \max\left\{S_{t-1} + sj_{t-1,kmax} - G_{t-1,NewGrowth}, 0\right\} & \forall i,j,t \\
\quad & R_{t} = G_{t-1,PostTreatment} & t=1, ... ,T; \quad \forall i,j \\
\quad & \mathcal{G}_{t} = \mathcal(1-\tilde{d})\mathcal{G}_{t-1} + R_{t} & \forall i,j,t \\
\quad & G_{t,B4Dispersal} = G_{t-1,PostTreatment} & \forall i,j,t \\
\quad & D_{t}^{(i,j)_n \shortrightarrow(i,j)} = \lambda\sum_{(o,p) \in N}G_{t,B4Dispersal} & \forall i,j,t \\
\quad & D_{t}^{(i,j)\shortrightarrow(i,j)} = \lambda\mathcal{N}G_{t,B4Dispersal} & \forall i,j,t \\
\quad & G_{t,PostDispersal} = \max\left\{G_{t,B4Dispersal}+D_{t}^{(i,j)_n\shortrightarrow(i,j)} -D_{t}^{(i,j)\shortrightarrow(i,j)}, 0\right\} & \forall i,j,t & \tag{11}\\
\quad & G_{t,NewGrowth} = \frac{G_{t,PostDispersal}^{2}} {G_{t,PostDispersal}^{2} + a^2} S_{t} & \forall i,j,t & \tag{12}\\
\quad & G_{t,PostTreatment} = (1-L_{t})G_{t,NewGrowth} & \forall i,j,t & \tag{13}\\
\quad & \sum_{i=1}^I\sum_{j=1}^J\sum_{t=1}^TbL_{t}^{ij} \le B & \forall i,j,t & \tag{14}
\end{align}
\begin{align*}
S_{0},R_{0},\mathcal{G}_{0}, J_{0},G_{0,PostTreatment} \ge 0
\end{align*}
\end{document}
答案1
这是因为公式 (11) 太长了。您可以使用公式的最后一部分\mathrlap
来解决这个问题mathtools
。它借此机会添加了一些代码简化和布局的一些改进:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[margin=1in, includefoot]{geometry}
\usepackage{mathtools, nccmath}
\usepackage{amssymb}
\usepackage{ stmaryrd }
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{comment}
\begin{document}
\begin{alignat}{2}
\min_{L_{t}} \quad & \sum_{i=1}^I\sum_{j=1}^J\sum_{t=1}^T(a + b L_{t}^{ij}) G_{t, \text{PostDispersal}}^{ij} \\
\text{s.t.} \quad & j_{t,k} = sj_{t-1,k-1} & k=2,...,k_{\max}; \quad &\forall i,j,t \\
& j_{t,1} = dJ_{t-1} + \tilde{d}\mathcal{G}_{t-1} & & \forall i,j,t \\
& J_{t} = \sum_{k=1}^{\mathclap{k_{\max}}} j_{t,k} & & \forall i,j,t \\
& S_{t} = \max\left\{S_{t-1} + sj_{t-1,k_{\max}} - G_{t-1,\text{NewGrowth}}, 0\right\} & & \forall i,j,t \\
& R_{t} = G_{t-1,\text{PostTreatment}} & t=1, ... ,T; \quad & \forall i,j \\
& \mathcal{G}_{t} = \mathcal(1-\tilde{d})\mathcal{G}_{t-1} + R_{t} & & \forall i,j,t \\
& G_{t,\text{B4Dispersal}} = G_{t-1,\text{PostTreatment}} & & \forall i,j,t \\
& D_{t}^{(i,j)_n \shortrightarrow(i,j)} = \lambda\sum_{\mathclap{(o,p) \in N}}G_{t,\text{B4Dispersal}} & & \forall i,j,t \\
& D_{t}^{(i,j)\shortrightarrow(i,j)} = \lambda\mathcal{N}G_{t,\text{B4Dispersal}} & & \forall i,j,t \\
& G_{t,\text{PostDispersal}} = \max\Bigl\{G_{t,\text{B4Dispersal}}+D_{t}^{(i,j)_n\shortrightarrow(i,j)} -\mathrlap{D_{t}^{(i,j)\shortrightarrow(i,j)}, 0\Bigr\}} && \forall i,j,t \\
& G_{t,\text{NewGrowth}} = \frac{G_{t,\text{PostDispersal}}^{2}} {G_{t,\text{PostDispersal}}^{2} + a^2} S_{t} && \forall i,j,t \\
& G_{t,\text{PostTreatment}} = (1-L_{t})G_{t,\text{NewGrowth}} & & \forall i,j,t \\
& \smash[b]{\sum_{i=1}^I\sum_{j=1}^J\sum_{t=1}^T}bL_{t}^{ij} \le B & & \forall i,j,t
\end{alignat}
\useshortskip
\begin{align*}
S_{0},R_{0},\mathcal{G}_{0}, J_{0},G_{0,\text{PostTreatment}} \ge 0
\end{align*}
\end{document}
答案2
您正在强制对齐,使得 for-all 和 k==.. 条件位于显示中最长的条目的右侧,这使得它们与它们相关的术语相距很远,并迫使行太宽而无法在同一行上取方程编号。
我放弃了那种对齐方式,并且在那里使用了\mathrm
多字母标识符(永远不要使用数学斜体,它是为单字母变量的乘积而不是单词设计的)并允许行自动编号而不是使用数字\tag
,\tag
如果与自动编号的结构一起使用,将会非常混乱。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage[margin=1in, includefoot]{geometry}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{enumitem}
\usepackage{ stmaryrd }
\usepackage{comment}
\begin{document}
\begin{align}
\min_{L_{t}} \quad & \sum_{i=1}^I\sum_{j=1}^J\sum_{t=1}^T(a + b L_{t}^{ij}) G_{t,\mathrm{PostDispersal}}^{ij} \\
\text{s.t.} \quad j_{t,k} &= sj_{t-1,k-1} \qquad k=2,...,\mathrm{kmax}; \quad \forall i,j,t \\
j_{t,1} &= dJ_{t-1} + \tilde{d}\mathcal{G}_{t-1} \qquad\forall i,j,t \\
J_{t} &= \sum_{k=1}^{kmax} j_{t,k} \qquad\forall i,j,t \\
S_{t} &= \max\left\{S_{t-1} + sj_{t-1,\mathrm{kmax}} - G_{t-1,\mathrm{NewGrowth}}, 0\right\} \qquad\forall i,j,t \\
R_{t} &= G_{t-1,\mathrm{PostTreatment}} \qquad t=1, ... ,T; \quad \forall i,j \\
\mathcal{G}_{t} &= \mathcal(1-\tilde{d})\mathcal{G}_{t-1} + R_{t} \qquad\forall i,j,t \\
G_{t,\mathrm{B4Dispersal}} &= G_{t-1,\mathrm{PostTreatment}} \qquad\forall i,j,t \\
D_{t}^{(i,j)_n \shortrightarrow(i,j)} &= \lambda\sum_{(o,p) \in N}G_{t,\mathrm{B4Dispersal}} \qquad\forall i,j,t \\
D_{t}^{(i,j)\shortrightarrow(i,j)} &= \lambda\mathcal{N}G_{t,\mathrm{B4Dispersal}} \qquad\forall i,j,t \\
G_{t,\mathrm{PostDispersal}} &= \max\left\{G_{t,\mathrm{B4Dispersal}}+D_{t}^{(i,j)_n\shortrightarrow(i,j)} -D_{t}^{(i,j)\shortrightarrow(i,j)}, 0\right\} \qquad\forall i,j,t \\
G_{t,\mathrm{NewGrowth}} &= \frac{G_{t,\mathrm{PostDispersal}}^{2}} {G_{t,\mathrm{PostDispersal}}^{2} + a^2} S_{t} \qquad\forall i,j,t \\
G_{t,\mathrm{PostTreatment}} &= (1-L_{t})G_{t,\mathrm{NewGrowth}} \qquad\forall i,j,t \\
\sum_{i=1}^I\sum_{j=1}^J\sum_{t=1}^TbL_{t}^{ij} &\le B \qquad\forall i,j,t \\
S_{0},R_{0},\mathcal{G}_{0}, J_{0},G_{0,\mathrm{PostTreatment}} &\ge 0
\end{align}
\end{document}