我想将一组方程向左对齐。我试着用了以下文件提供的解决方案
向左对齐。
它成功了。但是,我想为整个 "flalign "设置一个单一的方程编号,以便以后参考。就像 "方程+拆分 "的情况。当使用equation+align
时,我能够得到它。但是,如果我使用equation+flalign
,方程仍然被居中。有什么方法可以做到这一点吗?
使用 "公式+对齐 "的例子。
\begin{equation}
\begin{align}
\mbox{Minimize } & x_1+x_2+x_3 \\
\mbox{Subject to} & \\
& x_1+x_2 \leq 10 \\
& x_2+x_3 \leq 8 \\
& x_1+x_3 \leq 5
\end{align}
\end{equation}
我想在方程左对齐的情况下进行。 如果方程能与左页边距拉开一点(例如1厘米),而不是从左页边距开始,那就更好了。 而不是从左边缘开始。
预先感谢
一个选择将是使用
\usepackage[fleqn]{amsmath}
另一方面,这个选项([fleqn]
)也可以传递给documentclass
,作为
\documentclass[fleqn]{article}
\usepackage{amsmath}
MWE将是
\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{txfonts}
\usepackage{showframe}% to show frames
\begin{document}
\begin{equation}
\begin{aligned}
\text{Minimize } & x_1+x_2+x_3 \\
\text{Subject to} &\\
& x_1+x_2 \leq 10 \\
& x_2+x_3 \leq 8 \\
& x_1+x_3 \leq 5
\end{aligned}
\end{equation}
\end{document}
输出将是
。
但通过这种方法,文件中的所有方程式都会向左对齐。
根据定义,equation
环境将使方程处于显示模式。要想按照你的意愿只让一个方程左对齐,一种方法是使用phantom
,如下所示。
\documentclass{article}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{showframe}% to show frames
\begin{document}
\begin{equation}
\begin{aligned}
\text{Minimize } & x_1+x_2+x_3 \\
\text{Subject to} &\\
& x_1+x_2 \leq 10 \\
& x_2+x_3 \leq 8 \\
& x_1+x_3 \leq 5
\end{aligned}
\phantom{\hspace{6cm}} %%<---adjust the value as you want
\end{equation}
\end{document}