我有一个方程式需要在cases
环境中左对齐。这是我目前的代码,它确实不是工作:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\diff}{\mathop{}\!d}
\begin{document}
\begin{equation}\label{eq:algin}
\begin{aligned}
\begin{cases}
u_i^{k+1}(x)=\arg \min_{u} \Bigg\{
{}& \lambda\sum_{i=1}^{N}\int_{\Omega} r_i(x)u_i(x)\diff x
+ \frac{\gamma}{2} \sum_{i=1}^{N}\int_{\Omega} \left( u_i(x)-m(x) \right)^2\diff x
+ \frac{\mu}{2}\int_{\Omega} \left( u_i(x)-m(x) \right)^2\diff x
\Bigg\},
\\
f'(x_{0})=0 \text{ : } z=f(x_{0}) \text{ is de horizontale raaklijn.}
\\
\lim_{x\to x_{0}} f'(x)=\pm\infty \text{ : } x=x_{0} \text{ is de verticale raaklijn.}
\\
g(x_{0}){R}_{0} \text{ : } z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})
\text{ is de raaklijn.}
\end{cases}
\end{aligned}
\end{equation}
\end{document}
我试图获得这样的输出:
这是我的预期结果
谢谢 egreg。我发现当方程很长时(我们之前已经截断了),方程编号会自动位于底部。我们可以将它重新定位到中间吗?代码
\documentclass{article}
\usepackage{amsmath,mathtools}
\newcommand{\diff}{\mathop{}\!d}
\DeclareMathOperator*{\argmin}{arg\,min}
\begin{document}
\begin{equation}
\begin{dcases}
u_i^{k+1}(x)
\!\begin{multlined}[t]
=\frac{-\lambda r_i(x)+\gamma \bigl( r_i(x)+b_i(x)\bigr)+\gamma \bigl( \alpha-\beta\bigr)}{\theta}\\
-\frac{\sigma \bigl( -\lambda\int_{i=1}^N r_i(x) \diff x + \sigma\sum_{i=1}^N \bigl( r_i(x)-b_i(x)\bigr) +\gamma N \bigl( 1-r_i(x)\bigr)\bigr)}{\gamma\bigl( \sigma N -1\bigr)},
\end{multlined}
\\[1ex]
f'(x_{0})=0 : z=f(x_{0}) \text{ is de horizontale raaklijn.}
\\[1ex]
\lim_{x\to x_{0}} f'(x)=\pm\infty : x=x_{0} \text{ is de verticale raaklijn.}
\\[1ex]
g(x_{0}){R}_{0} : z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})
\text{ is de raaklijn.}
\end{dcases}
\end{equation}
This is text
\end{document}
答案1
我建议使用mathtools
及其dcases
和multlined
环境。
我提出了两种解决方案;第一种方法避免了公式中的歧义,其中相同的索引既用作边界变量又用作自由变量;第二种方法与您的类似。
我删除了不必要的\left
和\right
;改成\Bigg
和\biggl
;\biggr
改成\text{ : }
简单的冒号;定义\argmin
。
\documentclass{article}
\usepackage{amsmath,mathtools}
\newcommand{\diff}{\mathop{}\!d}
\DeclareMathOperator*{\argmin}{arg\,min}
\begin{document}
\begin{equation}
\begin{dcases}
u_j^{k+1}(x)=
\!\begin{multlined}[t]
\argmin_{u}
\biggl\{
\frac{\mu}{2}\int\limits_{\Omega} (u_j(x)-m(x))^2\diff x \\
+\sum_{i=1}^{N}\biggl(
\lambda\int\limits_{\Omega} r_i(x)u_i(x)\diff x
+ \frac{\gamma}{2}\int\limits_{\Omega} (u_i(x)-m(x))^2\diff x
\biggr)
\biggr\},
\end{multlined}
\\[1ex]
f'(x_{0})=0 : z=f(x_{0}) \text{ is de horizontale raaklijn.}
\\[1ex]
\lim_{x\to x_{0}} f'(x)=\pm\infty : x=x_{0} \text{ is de verticale raaklijn.}
\\[1ex]
g(x_{0}){R}_{0} : z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})
\text{ is de raaklijn.}
\end{dcases}
\end{equation}
\begin{equation}
\begin{dcases}
\!\begin{aligned}[t]
u_j^{k+1}(x)&=
\argmin_{u}
\biggl\{
\lambda\sum_{i=1}^{N}\int_{\Omega} r_i(x)u_i(x)\diff x \\
&\quad+ \frac{\gamma}{2} \sum_{i=1}^{N}\int_{\Omega} (u_i(x)-m(x))^2\diff x
+ \frac{\mu}{2}\int_{\Omega} (u_i(x)-m(x))^2\diff x
\biggr\},
\end{aligned}
\\[1ex]
f'(x_{0})=0 : z=f(x_{0}) \text{ is de horizontale raaklijn.}
\\[1ex]
\lim_{x\to x_{0}} f'(x)=\pm\infty : x=x_{0} \text{ is de verticale raaklijn.}
\\[1ex]
g(x_{0}){R}_{0} : z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})
\text{ is de raaklijn.}
\end{dcases}
\end{equation}
\end{document}
答案2
最好手动选择换行的位置:
代码:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\diff}{\mathop{}\!d}
\begin{document}
\begin{equation}\label{eq:algin}
\begin{cases}
u_i^{k+1}(x) =\arg \min_{u} \Bigg\{
{} \lambda\sum_{i=1}^{N}\int_{\Omega} r_i(x)u_i(x)\diff x \\
\qquad\qquad + \frac{\gamma}{2} \sum_{i=1}^{N}\int_{\Omega} \left( u_i(x)-m(x) \right)^2\diff x
+ \frac{\mu}{2}\int_{\Omega} \left( u_i(x)-m(x) \right)^2\diff x
\Bigg\},
\\
f'(x_{0})=0 \text{ : } z=f(x_{0}) \text{ is de horizontale raaklijn.}
\\
\lim_{x\to x_{0}} f'(x)=\pm\infty \text{ : } x=x_{0} \text{ is de verticale raaklijn.}
\\
g(x_{0}){R}_{0} \text{ : } z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})
\text{ is de raaklijn.}
\end{cases}
\end{equation}
\end{document}
答案3
我不会使用cases
环境;left\{
在环境开头和\right.
结尾各使用一个指令equation
需要的计算开销要少得多。在\left\{ ... \right.
对中,我会使用嵌套aligned
指令。环境的内容aligned
会自动排版为显示数学样式,这似乎适合长(子)方程。
顺便说一句,代码中的内部\left( ... \right)
指令不会生成更大的“围栏”,因为它们封闭的材料并不“大”。我会改用\bigl( ... \bigr)
。
(以下屏幕截图顶部的水平线只是为了说明文本块的宽度。)
\documentclass{article}
\usepackage[dutch]{babel}
\usepackage{mathtools} % for '\mathclap' macro
\newcommand{\diff}{\mathop{}\!d}
\begin{document}
\hrule % just to illustrate width of textblock
\begin{equation}\label{eq:algin}
\left\{
\begin{aligned}
&\begin{aligned}
u_i^{k+1}(x)
&=\arg\min_{u} \Biggl\{
\lambda\sum_{i=1}^{N}\int_{\Omega}\! r_i(x)u_i(x)\diff x \\
&\mkern25mu % select spacing adjustment to suit your page parameters
+ \frac{\gamma}{2} \sum_{i=1}^{N}\int_{\Omega}\! \bigl( u_i(x)-m(x) \bigr)^2\diff x
+ \frac{\mu}{2}\int_{\Omega}\! \bigl( u_i(x)-m(x) \bigr)^2\diff x
\Biggr\},
\end{aligned}\\
&f'(x_{0})=0 \text{ : $z=f(x_{0})$ is de horizontale raaklijn.}\\
&\lim_{\mathclap{x\to x_{0}}} \ f'(x)=\pm\infty \text{ : $x=x_{0}$ is de verticale raaklijn.}\\
&g(x_{0}){R}_{0} \text{ : $z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})$ is de raaklijn.}
\end{aligned}
\right.
\end{equation}
\end{document}
附录回答 OP 的后续问题,即如何将方程编号放在方程的底部:在这种情况下,我首先要努力缩短环境中的一条或多条线。例如,可以通过重新排列控制前两条线dcases
的环境结构来实现。multlined
在此过程中,您可能还想确保前两行的分子和分母中的材料是以显示样式数学模式排版的,而不是默认的文本样式数学模式。
\documentclass{article}
\usepackage{mathtools} % for 'dcases' and 'multlined' environments
\newcommand{\diff}{\mathop{}\!d}
% Variant form of \dfrac macro, which places both the numerator
% and the denominator in display math style
\newcommand\ddfrac[2]{\dfrac{\displaystyle#1}{\displaystyle#2}}
\begin{document}
\begin{equation}
\begin{dcases}
\begin{multlined} % let the 'multlined' environment encase both lines fully
u_i^{k+1}(x)
=\ddfrac{-\lambda r_i(x)+\gamma \bigl( r_i(x)+b_i(x)\bigr) +\gamma \bigl( \alpha-\beta\bigr)}{\theta}\\[2ex]
-\ddfrac{\sigma \biggl[ -\lambda\int_{i=1}^N r_i(x) \diff x + \sigma\sum_{i=1}^N \bigl( r_i(x)-b_i(x)\bigr) +\gamma N \bigl( 1-r_i(x)\bigr)\biggr]}{\gamma\bigl( \sigma N -1\bigr)}\,,
\end{multlined}
\\[1ex]
f'(x_{0})=0 : z=f(x_{0}) \text{ is de horizontale raaklijn,}
\\[1ex]
\lim_{x\to x_{0}} f'(x)=\pm\infty : x=x_{0} \text{ is de verticale raaklijn,}
\\[0.5ex]
g(x_{0}){R}_{0} : z-f(x_{0})=f'(x_{0})\cdot(x-x_{0})
\text{ is de raaklijn.}
\end{dcases}
\end{equation}
This is text \dots
\end{document}