如果我比較下面的兩個方程,大括號和案例第一行之間的空間
(-f_{0}) 不同。我知道如果我把 \hspace{-0.1cm} 放在 \left{ 之前
第二個方程,我可以調整額外的空間,但有什麼基本方法可以消除空間
當我開始時alignedat
製作&
?
或者,您可能會建議一種完全不同的方法來輸入我想要的方程式。
\begin{equation*}
(G^{*} \vec{x}^{*})(\vec{w}^{*})=
\left\{
\begin{alignedat}{3}
&-f_{0}^{*}(\vec{x}_{0}^{*})&&-(f_{1}^{*} \upsilon_{1}^{*})(\vec{x}_{1}^{*})-\cdots-(f_{m}^{*} \upsilon_{m}^{*})(\vec{x}_{m}^{*}) \\
&&&\text {if } \vec{u}^{*} \geq \vec{0} \text { and } \vec{x}_{0}^{*}+\cdots+\vec{x}_{m}^{*}=\vec{x}^{*}, \\
&-\infty &&\text {otherwise}.
\end{alignedat}\right.
\end{equation*}
\begin{equation*}
(G^{*} \vec{x}^{*})(\vec{w}^{*})=
\left\{
\begin{alignedat}{3}
-f_{0}^{*}(\vec{x}_{0}^{*})&&-(f_{1}^{*} \upsilon_{1}^{*})(\vec{x}_{1}^{*})-\cdots-(f_{m}^{*} \upsilon_{m}^{*})(\vec{x}_{m}^{*}) \\
&&\text {if } \vec{u}^{*} \geq \vec{0} \text { and } \vec{x}_{0}^{*}+\cdots+\vec{x}_{m}^{*}=\vec{x}^{*}, \\
-\infty &&\text {otherwise}.
\end{alignedat}\right.
\end{equation*}
答案1
由於無論如何您都需要選擇對齊點,因此我提出了一種不同的方法,您可以在其中指定物件的所需寬度(預設為 3em):
\documentclass{article}
\usepackage{amsmath}
\renewcommand{\vec}[1]{\mathbf{#1}}
\newcommand{\splitcase}[2][3em]{%
\makebox[#1][l]{$\displaystyle#2$} &
\settowidth{\dimen0}{$\displaystyle#2$}%
\addtolength{\dimen0}{-1em}%
\hspace*{\dimen0}%
\\
}
\begin{document}
\begin{equation*}
(G^{*} \vec{x}^{*})(\vec{w}^{*})=
\begin{cases}
\splitcase{
-f_{0}^{*}(\vec{x}_{0}^{*})
-(f_{1}^{*} \upsilon_{1}^{*})(\vec{x}_{1}^{*})
-\dots
-(f_{m}^{*} \upsilon_{m}^{*})(\vec{x}_{m}^{*})
}
&\text{if $\vec{u}^{*} \geq \vec{0}$ and
$\vec{x}_{0}^{*}+\dots+\vec{x}_{m}^{*}=\vec{x}^{*}$},
\\
-\infty &\text{otherwise}.
\end{cases}
\end{equation*}
\begin{equation*}
(G^{*} \vec{x}^{*})(\vec{w}^{*})=
\begin{cases}
\splitcase[5em]{
-f_{0}^{*}(\vec{x}_{0}^{*})
-(f_{1}^{*} \upsilon_{1}^{*})(\vec{x}_{1}^{*})
-\dots
-(f_{m}^{*} \upsilon_{m}^{*})(\vec{x}_{m}^{*})
}
&\text{if $\vec{u}^{*} \geq \vec{0}$ and
$\vec{x}_{0}^{*}+\dots+\vec{x}_{m}^{*}=\vec{x}^{*}$},
\\
-\infty &\text{otherwise}.
\end{cases}
\end{equation*}
\end{document}
答案2
我不會對第一個方程式的設定做太多改變,除了(a)確保-
數學行開頭的符號被排版為一元符號,(b)更改\begin{alignedat}{3}
為\begin{alignedat}{2}
,以及(c)留下更多的空白在第2行與第3 行之間。如果使用箭頭方式,一定要在上標前留一點空格*
。
\begin{cases} ... \end{cases}
如果使用而不是,花括號周圍的間距不會改變\left\{ ... \right.
\documentclass{article}
\usepackage{amsmath} % for 'alignedat' env and '\text' macro
\usepackage{bm} % for '\bm' macro
\begin{document}
\begin{align*}
(G^{*} \vec{x}^{\mkern1.5mu*})(\vec{w}^{\mkern1.5mu*})
&= \left\{
\begin{alignedat}{2}
&{-}f_{0}^{*}(\vec{x}_{0}^{\mkern1.5mu*})
&&-(f_{1}^{*} \upsilon_{1}^{*})(\vec{x}_{1}^{\mkern1.5mu*})
-\dots-(f_{m}^{*} \upsilon_{m}^{*})(\vec{x}_{m}^{\mkern1.5mu*}) \\
&&&\text{if $\vec{u}^{\mkern1.5mu*} \geq \vec{0}$ and
$\vec{x}_{0}^{\mkern1.5mu*}+\dots+\vec{x}_{m}^{\mkern1.5mu*}
=\vec{x}^{\mkern1.5mu*}$}, \\[1ex]
&{-}\infty
&&\text{otherwise}.
\end{alignedat}
\right. \\ % end of first equation
(G^{*} \bm{x}^{*})(\bm{w}^{*})
&= \left\{
\begin{alignedat}{2}
&{-}f_{0}^{*}(\bm{x}_{0}^{*})
&&-(f_{1}^{*} \upsilon_{1}^{*})(\bm{x}_{1}^{*})
-\dots-(f_{m}^{*} \upsilon_{m}^{*})(\bm{x}_{m}^{*}) \\
&&&\text{if $\bm{u}^{*} \geq \bm{0}$ and
$\bm{x}_{0}^{*}+\dots+\bm{x}_{m}^{*}
=\bm{x}^{*}$}, \\[1ex]
&{-}\infty
&&\text{otherwise}.
\end{alignedat}
\right. % end of second equation
(G^{*} \bm{x}^{*})(\bm{w}^{*})
&= \begin{cases}
\begin{alignedat}{2}
&{-}f_{0}^{*}(\bm{x}_{0}^{*})
&&-(f_{1}^{*} \upsilon_{1}^{*})(\bm{x}_{1}^{*})
-\dots-(f_{m}^{*} \upsilon_{m}^{*})(\bm{x}_{m}^{*}) \\
&&&\text{if $\bm{u}^{*} \geq \bm{0}$ and
$\bm{x}_{0}^{*}+\dots+\bm{x}_{m}^{*}
=\bm{x}^{*}$}, \\[1ex]
&{-}\infty
&&\text{otherwise}.
\end{alignedat}
\end{cases}
\end{align*}
\end{document}