Let $X$ a compact Riemann surface and $D$ a divisor with $\operatorname{Deg} D=0$ and $\dim L(D)=1$. Why is then $D$ principal?
I already have seen the comments to this answer, but somehow I don't get it.
My attempt so far: If $\dim L(D)=1$, then there is some meromorphic function $f$ such that $\operatorname{div} f \ge -D$, and every other element of $L(D)$ is a multiple of it.
Probably, $D=\operatorname{div} \frac 1 f$, which would follow if $\operatorname{div} f = -D$, but why is that?
If $f\ne 0\in L(D)$, then $\operatorname{div}f + D\ge 0$. However, both $\operatorname{div}f$ and $D$ have degree 0, so this implies that in fact $\operatorname{div}f+D=0$, or $\operatorname{div}f = -D$. Then since $X$ is compact, meromorphic functions are determined up to scaling by their divisors on $X$, so $L(D)=\langle f\rangle$. In particular, this implies that $L(D)$ is one dimensional if it is nonzero.
Summarizing, when $\deg D=0$, if $L(D)\ne 0$, then for any $f\ne 0\in L(D)$, $D=\operatorname{div} 1/f$, and $f$ is a basis for $L(D)$.