![「收集」環境中的虛假空白方程式行](https://rvso.com/image/327817/%E3%80%8C%E6%94%B6%E9%9B%86%E3%80%8D%E7%92%B0%E5%A2%83%E4%B8%AD%E7%9A%84%E8%99%9B%E5%81%87%E7%A9%BA%E7%99%BD%E6%96%B9%E7%A8%8B%E5%BC%8F%E8%A1%8C.png)
我有以下程式碼:
\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}