「gather」環境における誤った空白の式行

「gather」環境における誤った空白の式行

次のコードがあります:

\begin{gather}
 u(x,t) = 0 \ \mathrm{ si\ } x = 0,  x = 1\\
\label{ex1bc}
\\
u(x,0) = \left\{
       \begin{array}{ll}
     2x,      & \mathrm{si\ } 0 \le x \le 1/2 \\
     2(1-x) & \mathrm{si\ } 1/2 \le x \le 1 \\
       \end{array}
     \right.
   \label{ex1inicial}
\end{gather}

これにより、次のようになります。

1つの

空白の方程式 2.23 なしでそれを実現したいのですが、何が間違っているのでしょうか?

答え1

最初の式の後に不必要な余分な部分があります\\。それを削除すると、余分な線は消えます。

2 番目の方程式では、cases環境の使用を検討してください。たとえば、左側の中括弧が少し大きくなります。

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

\documentclass{article}
\usepackage{amsmath} % for 'cases' env. and `\text` macro
\numberwithin{equation}{section} % just for this example
\setcounter{section}{2}          % just for this example
\setcounter{equation}{21}
\begin{document}
\begin{gather}
u(x,t) = 0 \text{ si } x = 0,  x = 1 \label{ex1bc}\\
u(x,0) = \begin{cases}
            2x     & \text{si } 0   \le x \le 1/2 \\
            2(1-x) & \text{si } 1/2 \le x \le 1 \\
         \end{cases} \label{ex1inicial}
\end{gather}
\end{document}

答え2

負荷amsmath

\begin{document}
\begin{equation}
u(x,t) = 0 \text{ si } x = 0,  x = 1\label{ex1bc}
\end{equation}
\begin{equation}
u(x,0)=\begin{cases}
x,      & \text{si  $0 \le x \le 1/2$}, \\
2(1-x),  & \text{si  $1/2 \le x \le 1$.} \\
\end{cases}
\end{equation}
\end{document}

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

関連情報