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...?



Local versus global embedding dimension
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.


