
我有以下程式碼:
\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}
這會產生:
我想要這個,但沒有空白方程式 2.23。我究竟做錯了什麼?
答案1
\\
在第一個方程式之後你有一個虛假的額外內容。把它去掉,多餘的線就會消失。
對於第二個方程,請考慮使用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}