Local versus global embedding dimension Fix a complex projective scheme $X$ and a closed point $x\in X$.
Let $d_x$ denote the dimension of the Zariski tangent space at $x$.
This is the local embedding dimension of $X$ at $x$ -- the minimal dimension of a smooth scheme containing an open neighbourhood of $x$.
In a paper I blithely asserted that $d(X):=\max_{x\in X}d_x$ is the global embedding dimension -- the minimal dimension of a smooth scheme containing $X$.
I had assumed we could embed $X\subset\mathbb P^N$ and then take an intersection of $N-d(X)$ generic sufficiently positive hypersurfaces containing $X$.
But since a troublesome referee has quite unreasonably asked me for a proof (I'm joking) I checked more carefully and saw this construction does not work everywhere at once (even when $N-d(X)=1$ and $X$ is smooth!).
Can anyone suggest another construction, maybe by suitable projections, or a reference, or...?
 A: It seems there is a counterexample. This is based on Jason Starr's suggestion in the comments.
If we have a surface $S$ with two smooth disjoint curves $C_1$ and $C_2$, which are isomorphic, and let $X$ be obtained by gluing $C_1$ and $C_2$ along that isomorphism $i: C_1\to C_2$, then $X$ is projective if there is an ample line bundle on $X$ whose restrictions to $C_1$ and $C_2$ are equal (under $i$). 
$X$ has singularities locally isomorphic to a nodal curve cross a smooth curve, thus has local embedding dimension $3$. Can $X$ be embedded as a hypersurface in a smooth $3$-fold? If so, then by (part of) Jason Starr's obstruction, the sheaf
$$\mathcal{Ext}^1_{\mathcal O_X} (\Omega_{X/k}, \mathcal I)= \mathcal{Ext}^1_{\mathcal O_X} (\Omega_{X/k}, \mathcal O_X) \otimes \mathcal I$$
must be globally generated, where $\mathcal I$ is the conormal line bundle. This sheaf is clearly supported on the glued curve $C$, and we can calculate that it is isomorphic to $\mathcal I $ tensored with the normal bundle of $C_1$ and the normal bundle of $C_2$ there. (It suffices to work, carefully, locally in $k[x,y]/xy$, where $\Omega$ is generated by $dx$ and $dy$ with relation $xdy+ ydx=0$ and the generator of the $\mathcal{Ext}^1$ is precisely the linear map that sends $xdy+ydx$ to $1$, which the automorphism group acts on the same way it acts on the tensor rpoduct of the normal bundles.)
So for this sheaf to have a nonvanishing section, the conormal bundle $\mathcal I$ of $X$, restricted to $C$ must be isomorphic to the tensor product of the conormal bundle of $C_1$ to the conormal bundle of $C_2$.  
So here's what we're going to do. We will take $E_1$ and $E_2$ two distinct, but isomorphic, elliptic curves in $\mathbb P^1$. In fact, we will take them to be two isomorphic curves appearing in the Dwork family, so their intersection points will be $3$-torsion. We will blow up all $9$ intersection points, plus two points $P_1, Q_1$ on $E_1$ and two points $P_2, Q_2$ on $E_2$. We choose $P_1, Q_1, P_2, Q_2$ very general, subject to the condition that $i(P_1) + 2i(Q_1) = P_2 + 2 Q_2$ in the group law on $E_2$.
To make our ample class, we'll just take a sufficiently high multiple of the hyperplane class, minus the sum of the exceptional divisors at all $9$ intersection points, minus the exceptional divisors over $P_1$ and $P_2$, minus twice the exceptional divisors over $Q_1$ and $Q_2$. Because of our assumption on the group law, this restricts to the same line bundle on $E_1$ and $E_2$, as each exceptional divisor corresponds to that point in the Picard group. 
However, the Picard class of the tensor product of the two conormal bundles on $E_2$ will be some multiple of the hyperplane class, plus twice the sum of all the $3$-torsion points, plus $i(P_1) + i(Q_1) + P_2 + Q_2$. If this class comes from a global line bundle, then it must come from a sum of hyperplane classes and exceptional divisors, which means (projecting to Pic) it must come from a sum of $3$-torsion points, $P_2$ and $Q_2$. The exceptional divisors over $P_1$ and $Q_1$ don't contribute because they don't intersect $E_2$. Thus, it can only happen if we have some relation that $i(P_1) + i(Q_2) = a P_2 + b Q_2$ for $a,b\in \mathbb Z$, up to $3$-torsion. But there are countably many such relations, and none of them is forced by our condition on $P_1,P_2, Q_1,Q_2$, so none of them will hold for our very general choice.
A: I wonder if the following example, adapted from section 18 of Kollár's Links of complex analytic singularities, would also work: Let $E_i := V(x_i^3 + y_i^3 + z_i^3) \subset \mathbb{P}_i^2$ for $i = 1, 2$, let $\tau: E_1 \to E_2$ be an isomorphism corresponding to a translation of the elliptic curve $V(x^3 + y^3 + z^3)$ and use it to glue the 2 copies of $\mathbb{P}^2$, to get $X(\tau) := \mathbb{P}_1^2 \cup_{\tau} \mathbb{P}_2^2$. Let $E \subset X$ denote the common image of $E_1, E_2$.
Then using $\mathcal{O}_{\mathbb{P}_1^2}(1)|_{E}$ as a basepoint, we can make the identification $\mathrm{Pic}^3(E) \simeq \mathrm{Pic}^0(E) \simeq E$. Under this identification $\mathcal{O}_{\mathbb{P}_2^2}(1)|_{E} = \tau^*(\mathcal{O}_{\mathbb{P}_1^2}(1)|_{E} = \tau \in \mathrm{Pic}^3(E)$, and more generally $\mathcal{O}_{\mathbb{P}_2^2}(d)|_{E} = \tau^d \in \mathrm{Pic}^{3d}(E)$ for $d \in \mathbb{Z}$. So $X(\tau)$ is projective if and only if $\tau$ is torsion, in which case $\mathcal{O}_{\mathbb{P}_1^2}(d), \mathcal{O}_{\mathbb{P}_2^2}(d)$ glue to form a line bundle on $X(\tau)$ if and only if $\tau^d = 1$.
On the other hand, $N_{E \subset \mathbb{P}_i^2}^\vee = \mathcal{O}_{\mathbb{P}_i^2}(-3)|_E$ for $i = 1, 2$ so that $N_{E \subset \mathbb{P}_1^2}^\vee \otimes N_{E \subset \mathbb{P}_2^2}^\vee = \mathcal{O}_{\mathbb{P}_1^2}(-3)|_E \otimes \mathcal{O}_{\mathbb{P}_2^2}(-3)|_E$, corresponding to $\tau^{-3}\in \mathrm{Pic}^{-18}(E)\simeq E$. Hence $X(\tau)$ is an snc divisor if and only if $\tau^3=1$.
