Let $f: X\to B$ be a family of curves, i.e. $f$ is flat, surjective and of relative dimension 1. If each fiber is an affine curve, can we conclude that $f$ is an affine morphism? If it is not true, what additional conditions should we impose to make sure we get an affine morphism? Thanks.


Actually my real question is: given a family of proper curves $f:X\to B$, and given a collection of sections $p\_1,p\_2,⋯,p\_s$. If we know $X\_b\backslash \{ p\_1(b),⋯,p\_s(b)\}$ is affine for each $b\in B$, then is $f:X \backslash p\_1(B)\cup \cdots \cup p\_s(B)\to B$ an affine morphism?



when a family of curve is an affine morphism
**Lemma.** Let $f \colon X \to B$ is a proper, flat family of relative dimension $1$ with geometrically connected fibres. Let $\sigma\_1,\ldots,\sigma\_r$ for $r \geq 1$ be sections landing in the locus where $f$ is smooth. If all fibres $X\_b \setminus \{\sigma\_1(b),\ldots,\sigma\_r(b)\}$ are affine, then $X \setminus \sigma\_1(B) \cup \ldots \cup \sigma\_r(B) \to B$ is affine.


*Proof.* The question is local on $B$, so we may assume $B = \operatorname{Spec} A$ is affine. For every $b \in B$ and every $i \in \{1,\ldots,r\}$, the point $\sigma\_i(b) \in X\_b$ is a Cartier divisor, since it sits in the smooth locus of $X\_b$. Hence, $\sigma\_i(B)$ is a relative effective Cartier divisor [Stacks, [Tag 062Y](https://stacks.math.columbia.edu/tag/062Y)]; in particular it is a Cartier divisor. Write $\mathscr L\_i = \mathcal O\_X(\sigma\_i(B))$, and
$$\mathscr L = \bigotimes\_{i=1}^r \mathscr L\_i.$$
For any $b \in B$, we have $\deg((\mathscr L\_i)\_b) > 0$ on the component of $X\_b$ containing $\sigma\_i(b)$. Since $X\_b \setminus\{\sigma\_1(b),\ldots,\sigma\_r(b)\}$ is affine, every component of $X\_b$ contains at least one marked point. Hence, $\deg(\mathscr L\_b) > 0$ on each component of $X\_b$, so $\mathscr L\_b$ is ample [Stacks, Tag [0B5Y](https://stacks.math.columbia.edu/tag/0B5Y)].


Therefore, $\mathscr L$ is ample [Stacks, Tag [02DN](https://stacks.math.columbia.edu/tag/0D2N)], using that $B$ is affine (see [Stacks, Tag [01VK](https://stacks.math.columbia.edu/tag/01VK)]). Then some multiple $\mathscr L^d$ for $d \gg 0$ is very ample and defines a closed immersion $X \to \mathbb P^N\_B$ for some $N$. Then
$$d \sum\_{i=1}^r \sigma\_i(B) \in |\mathscr L^d|$$
is the intersection of $X \subseteq \mathbb P^N\_B$ with a hyperplane, hence the complement $X \cap \mathbb A^N\_B$ is affine. $\square$.




---


**References.**


[Stacks] A.J. de Jong et al, [*The stacks project*](http://stacks.math.columbia.edu).


