Let $X$ be a scheme locally of finite type over a field $k$, and let $p \in X$ be a $k$-point with ${\rm dim}\; {\Omega_{X}}_{|p}={\rm dim}\; \mathfrak{m}_{p}/\mathfrak{m}^{2}_{p}=m$ (the 'embedding dimension' of the local ring at $p$).

Then a paper that I'm reading asserts that there is a Zariski open neighbourhood $ p \in U \subseteq X$ and a closed immersion $ U \hookrightarrow M$, where $M$ is a regular (maybe even smooth) scheme over $k$ of dimension $m$. (Clearly $m$ is the minimal dimension for which such an embedding is possible.)

I would like a reference or explanation for this fact, which I have not been able to find in standard commutative algebra books (though it is probably there somewhere). Presumably this is the reason that ${\rm dim}\;\mathfrak{m}_{p}/\mathfrak{m}^{2}_{p}$ is called the embedding dimension of a local ring.

I would also like a reference or explanation showing that one cannot always take $M=\mathbb{A}^{m}$.

notalways a quotient of an $(\text{emb dim} R)$-dimensional regular local ring, unless $R$ is complete (the latter positive statement is in Matsumura somehwere if I recall correctly). In particular, formal neighborhoods are always ok. $\endgroup$