# Spurious blank equation line in a 'gather' environment

I have the following code:

\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}


That produces:

I would like to have that but without the blank equation 2.23. What am I doing wrong?

• What you need is 2 equations with cases in the second one. – Sigur Feb 9 '16 at 1:43
• Just remove the double-backslash after x = 0, x = 1. – Mico Feb 9 '16 at 1:45

You have a spurious extra \\ after the first equation. Remove it, and the extra line will disappear.

For the second equation, do consider using a cases environment; for one, the left-hand curly brace will be a bit larger.

\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}


Load amsmath.

\begin{document}
$$u(x,t) = 0 \text{ si } x = 0, x = 1\label{ex1bc}$$
$$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{document}


• Since the OP uses a gather environment, he must have loaded the amsmath package (or the mathtools package) already. – Mico Feb 9 '16 at 1:56
• @Mico, yes, I agree. But in case someone simply read the answer... – Sigur Feb 9 '16 at 1:59
• You may want to state explicitly somewhere that your solution to the OP's problem is to replace the gather environment with two consecutive equation environments. – Mico Feb 9 '16 at 2:01