Let $X$ be a projective surface. A pencil of curves with base $B$ is a dominant rational map $\pi: X \dashrightarrow B$ such that $k(B)$ is algebraically closed in $k(X)$.
But we also have a definition that a pencil is a one dimensional linear system. I want to know if these two definitions compatible?
My guess is that the first definition is the generalization of $\mathbb P^1$ to arbitrary $B$. But I have no idea how to prove this.
They are related, but not the same. Given a one dimensional linear system, you get a rational map from $X\to \mathbb{P}^1$, which becomes a morphism only after blowing up the base points of the linear system. Given a non-constant morphism $f:X\to\mathbb{P}^1$ (so $X$ may have been replaced with a blow-up), you can use Stein factorization to factorize and get $X\stackrel{\pi}{\to} B\stackrel{h}{\to}\mathbb{P}^1$ with $h\circ \pi=f$ and $\pi$ as in your first situation.