Algebraic(!!) version of the Riemann existence theorem In Appendix B to Hartshorne's Algebraic Geometry, Hartshorne claims that one can prove that compact Riemann surfaces are algebraic in the following way.  First show there exists a nonconstant meromorphic function from $X$ to $\mathbb{P}^1$, which realizes $X$ as a ramified covering over $\mathbb{P}^1$.  Second, use the Riemann existence theorem to show this gives $X$ the structure of a nonsingular algebraic curve.
I am asking about this second step.  Everything I've seen about the Riemann existence theorem has been about the existence of things related to Riemann surfaces, not algebraic curves a priori.  For example, one statement is that the meromorphic functions on a compact Riemann surface separate points, and another is that if we prescribe certain ramification data over some $Y$ - $d$ points, then we can find a corresponding map of Riemann surfaces $X\rightarrow Y$.  Anyways, I don't see any statement that says that $X$ must then be an algebraic curve (i.e. a complex projective variety of dim 1), and I would appreciate it if anybody gave me a reference or a proof of this particular step.
And just to be clear: I know there are other proofs that $X$ is algebraic, but I am looking for the one Hartshorne is referring to here.  And of course I see the generalized Riemann existence theorem he states right after which is much more high-powered, but I'd like the elementary argument Hartshorne refers to.
 A: Just to get this off the unanswered list, let me address directly the question you pose in your above comment. As I mentioned this result itself is non-trivial, but you seem to happy to understand the implication which I now explain.
Let us first establish some terminology (which I’ve entirely made up).
The first is the result you are saying is contained in Donaldson’s text.

Theorem (“functorial Riemann existence theorem”): The functor
$$\left\{\begin{matrix}\text{Compact Riemann}\\
\text{surfaces}\end{matrix}\right\}\to
 \left\{\begin{matrix}\text{Finitely generated extensions }K/\mathbb{C}\\\text{with
}\mathrm{tr.deg}(K/\mathbb{C})=1\end{matrix}\right\}$$
given by $S\mapsto \mathcal{M}(S)$ is an equivalence.

Here

*

*$\mathcal{M}(S)$ is the field of meromorphic functions on $S$,

*‘finitely generated’ means that there exists finitely many elements $x_1,\ldots,x_n\in K$ such that $K=\mathbb{C}(x_1,\ldots,x_n)$ (where $\mathbb{C}(x_1,\ldots,x_n)$ is the smallest subfield of $K$ containing $\mathbb{C}$ and $x_1,\ldots,x_n$),

*and $\mathrm{tr.deg}$ stands for transcendence degree.

Equivalently, one can describe the finitely generated extensions $K/\mathbb{C}$ with transcendence degree $1$ as the fraction fields of finitely generated $\mathbb{C}$-algebras $A$ which are a) domains, b) have Krull dimension $1$.
Th second is your target theorem.

Theorem (“Riemann existence theorem”): Every compact Riemann surface $S$ is algebraizable (i.e. there exists a smooth projective
algebraic curve $X$ over $\mathbb{C}$ and an isomorphism
$X^\mathrm{an}\cong S$).

What you then want is the following.

Proposition: The functorial Riemann existence theorem implies the Riemann existence theorem.

Proof: By the functorial Riemann existence theorem it suffices to show that if $K/\mathbb{C}$ is a finitely generated extension with transcendence degree $1$ then there exists a smooth projective algebraic curve $X$ over $\mathbb{C}$ such that $\mathcal{M}(X^\mathrm{an})=K$.
Let us fix such a smooth projective curve $X$ though. Let us note though that $\mathcal{M}(X^\mathrm{an})$ is precisely the set of morphisms of compact Riemann surfaces $X^\mathrm{an}\to\mathbb{P}^{1,\mathrm{an}}_\mathbb{C}$. We then know by the basic version of Serre’s GAGA (or even the functorial Riemann existence theorem itself!) that these correspond precisely to the set of algebraic morphisms $X\to\mathbb{P}^1_\mathbb{C}$ which, in turn, corresponds to the (algebraic) function field $K(X)$.
Thus, we have reduced ourselves to showing that there exists a smooth projective algebraic curve $X$ over $\mathbb{C}$ with $K(X)=K$. But, this is a classical result (e.g. see [Vakil, Theorem 17.4.3]). $\blacksquare$
Some additional commentary
You may be aware of this, but in some sense the actual hard part of the Riemann existence theorem is hidden in your functorial Riemann existence theorem. Indeed, let us begin by recalling the following fact.

Theorem (Siegel, [Huybrechts, Proposition 2.1.9]): Let $X$ be a compact complex manifold, then $\mathrm{tr.deg}(\mathcal{M}(X)/\mathbb{C})\leqslant \dim(X)$.

Let us call a compact complex manifold $X$ Moishezon if $\mathrm{tr.deg}(\mathcal{M}(X)/\mathbb{C})=\dim(X)$.
Let us then note that hidden in the functorial Riemann existence theorem is the following.

Theorem (“weak analytic Riemann existence theorem”): Let $X$ be a compact Riemann surface. Then, $X$ is Moishezon.

To understand how this “weak analytic Riemann existence theorem” relates to the various ‘analytic’ forms of the Riemann existence theorem you mentioned in your question, let us note that by Siegel’s theorem that for a compact Riemann surface $X$ one has that
$$\begin{aligned} X\text{ is Moishezon}&\Longleftrightarrow \mathbb{C}\ne \mathcal{M}(X)\\ &\Longleftrightarrow \text{There exists a non-constant meromorphic function }X\to\mathbb{P}^{1,\mathrm{an}}_\mathbb{C}\end{aligned}$$
Thus, for instance, the statements

“For example, one statement is that the meromorphic functions on a compact Riemann surface separate points, and another is that if we prescribe certain ramification data over some $Y$ - $d$ points, then we can find a corresponding map of Riemann surfaces $X\rightarrow Y$. “

are both strictly stronger than this weak analytic Riemann existence theorem.
Why do I call the existence of a non-constant meromorphic function $X\to\mathbb{P}^{1,\mathrm{an}}_\mathbb{C}$ the analytic Riemann existence theorem? Well, it’s because it’s an essentially analytic result requiring some form of Hodge theory (about harmonic forms), or even using results about potential theory (e.g. see [Varolin], which is where I first learned this stuff).
As a last point, I can’t help but point out the following vast generalization of the Riemann existence theorem (in the format stated here) due to Moishezon and Artin.

Theorem (Moishezon and M. Artin): Let $M$ be a proper complex analytic space. Then, there exists a proper algebraic space $X$ over
$\mathbb{C}$ such that $M\cong X^\mathrm{an}$ and only if for each
irreducible component $M_i$ of $M$ one has that
$\mathrm{tr.deg}(\mathcal{M}(M_i)/\mathbb{C})=\dim(M_i)$ (i.e. $M_i$
is Moishezon).

I won’t explain the exact meaning of these terms here (see the introduction of [Conrad] for a nice summary of the historical literature leading to this result), but let me just say the following:

*

*a complex analytic space is something like a complex manifold where one allows ‘singularities’ (see [GR])),

*an algebraic over $\mathbb{C}$ is a generalization of variety which results from allowing to glue affine varieties together in a topology finer than the Zariski topology, namely the etale/fppf topology (see [Knutson], or [Olsson]).

So, if one is willing to enlarge your category of algebraic spaces slightly (from varieties to algebraic spaces) then basically the only obstruction to being algebraizable is the Moishezon property.
References:
[Conrad] Conrad, B. 2010. Moishezon spaces in rigid geometry. https://math.stanford.edu/~conrad/papers/moish.pdf
[GR] Grauert, H. and Remmert, R., 2012. Coherent analytic sheaves (Vol. 265). Springer Science & Business Media.
[Huybrechts] Huybrechts, D., 2005. Complex geometry: an introduction. Springer Science & Business Media.
[Knutson] Knutson, D., 1971. Algebraic spaces. In Algebraic Spaces (pp. 91-152). Springer, Berlin, Heidelberg.
[Olsson] Olsson, M., 2016. Algebraic spaces and stacks (Vol. 62). American Mathematical Soc..
[Vakil] Vakil, R., 2017. The rising sea: Foundations of algebraic geometry. preprint.
[Varolin] Varolin, D., 2011. Riemann surfaces by way of complex analytic geometry (Vol. 125). American Mathematical Soc..
