方程式の分割条件

方程式の分割条件

条件を一連の方程式に分割しようとしています。図を参照してください。

ここに画像の説明を入力してください

これが私のコードです:

\begin{align*}
\rho(X,Y)&=1&
\begin{split}
\text{if and only if }\mathbb P(Y=\alpha X+\beta)=1\\
\text{for some real $\alpha$ and $\beta$ with }\alpha>0,
\end{split}\\
\rho(X,Y)&=-1&
\begin{split}
\text{if and only if }\mathbb P(Y=\alpha X+\beta)=1\\
\text{for some real $\alpha$ and $\beta$ with }\alpha<0.
\end{split}
\end{align*}

しかし、条件の最初の行が方程式と同じレベルではありません。条件の配置が気に入りません。

これを修正する方法、または他にどのような環境を使用すればよいか知っている人はいますか?

答え1

断片ではなく完全な文書を投稿してください。parboxまたはalignedを使用します。

ここに画像の説明を入力してください

\documentclass{article}

\usepackage{amsmath,amsfonts}

\begin{document}

a
\begin{align*}
\rho(X,Y)&=1&&
\parbox[t]{5cm}{
if and only if $\mathbb P(Y=\alpha X+\beta)=1$\\
for some real $\alpha$ and $\beta$ with $\alpha>0$,}
\\[\jot]
\rho(X,Y)&=-1&&
\parbox[t]{5cm}{if and only if $\mathbb P(Y=\alpha X+\beta)=1$\\
for some real $\alpha$ and $\beta$ with $\alpha<0$.}
\end{align*}

or
\begin{align*}
\rho(X,Y)&=1&&
\begin{aligned}[t]\text{if and only if }\mathbb P(Y=\alpha X+\beta)=1\\
\text{for some real $\alpha$ and $\beta$ with }\alpha>0,
\end{aligned}\\[\jot]
\rho(X,Y)&=-1&&
\begin{aligned}[t]\text{if and only if }\mathbb P(Y=\alpha X+\beta)=1\\
\text{for some real $\alpha$ and $\beta$ with }\alpha<0.
\end{aligned}
\end{align*}
\end{document}

答え2

amsmath環境はどうでしょうかcases?こんな感じです:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\begin{equation*}
\rho(X,Y)=
\begin{cases}
\phantom{-}1 & \text{if and only if $\mathbb{P}(Y=\alpha X+\beta)=1$}
       \\
       &\text{for some real $\alpha$ and $\beta$ with $\alpha >0$,}
\\[4pt]
    -1 & \text{if and only if $\mathbb{P}(Y=\alpha X+\beta)=1$}
       \\
       &\text{for some real $\alpha$ and $\beta$ with $\alpha < 0$.}
\end{cases}
\end{equation*}

\end{document}

ケース付きの複数行条件

必要に応じて、各2行条件の行間の行間隔を、たとえば、\\[-2pt]最初の行と3番目の行の代わりに、次のようにして少し狭くすることができます。\\

答え3

他の回答では言及されていない、 を使用する変種ですtabular

幅を推測する必要がなく\parbox、扱いにくい\textマクロを回避できるという利点があります。指定子は、@{}l@{}両側にパディングのない左揃えの列 1 つを意味します。

alignat2 つの部分間のスペースをより細かく制御できます。

\documentclass{article}
\usepackage{amsmath,amssymb}

\renewcommand{\Pr}{\operatorname{\mathbb{P}}} % probability operator

\begin{document}

\begin{alignat*}{2}
\rho(X,Y) &= 1  &\qquad& \begin{tabular}[t]{@{}l@{}}
                         if and only if $\Pr(Y=\alpha X+\beta)=1$ \\
                         for some real $\alpha$ and $\beta$ with $\alpha>0$,
                         \end{tabular}
\\[1ex]
\rho(X,Y) &= -1 &&       \begin{tabular}[t]{@{}l@{}}
                         if and only if $\Pr(Y=\alpha X+\beta)=1$ \\
                         for some real $\alpha$ and $\beta$ with $\alpha<0$.
                         \end{tabular}
\end{alignat*}

\end{document}

ここに画像の説明を入力してください

答え4

dcases環境 (パッケージ提供mathtools) を使用し、\parboxes を使用して条件付け情報を格納することをお勧めします。

ここに画像の説明を入力してください

parbox を上揃えにしたい場合は、[t]("top") 配置指定子を追加するだけです。

ここに画像の説明を入力してください


\documentclass{article}
\usepackage{amsfonts,mathtools}
\let\Pr\relax
\DeclareMathOperator{\Pr}{\mathbb{P}} % probability operator
\begin{document}
\[
\rho(X,Y) =
\begin{dcases} % optional: '[t]' ("top") specifiers for the parboxes
1 & \parbox[t]{5.5cm}{if and only if $\Pr(Y=\alpha X+\beta)=1$ for some real $\alpha$ and $\beta$ with $\alpha>0$,}\\[1ex]
-1 & \parbox[t]{5.5cm}{if and only if $\Pr(Y=\alpha X+\beta)=1$ for some real $\alpha$ and $\beta$ with $\alpha<0$.}
\end{dcases}
\]
\end{document}

関連情報