# Does pushout of schemes along formal neighborhoods exist in the category of schemes?

I have a question about gluing specific types of schemes which doesn't fit into any well-known gluing situation. Assume $$C$$ is an algebraic curve and $$p$$ a point on it. The formal completion of $$C$$ at that point is $$k[[t]]$$. Now imagine $$\text{Spec}(k[[t]])\times C \times C$$, $$C\times \text{Spec}(k[[t]]) \times C$$ and $$C\times C \times \text{Spec}(k[[t]])$$. We want to glue these in the obvious way i.e. glue the first and the second one along $$\text{Spec}(k[[t]])\times \text{Spec}(k[[t]])\times C$$, glue the first and the third one along $$\text{Spec}(k[[t]])\times C \times \text{Spec}(k[[t]])$$ and in the similar way glue the second and third one. I wonder whether the outcome is an scheme?

Intuitively the formal completion should behave like an open neighborhood but obviously it is not an open immersion.

I will give a counterexample in a slightly simpler situation (two copies of $$C$$ instead of three) but the same argument can be made for your case.
Write $$\operatorname{Sch}$$ (resp. $$\operatorname{Set}$$) for the category of schemes (resp. sets). Pick $$C=\operatorname{Spec} \mathbb C[t]$$, call $$p$$ the origin in $$C$$ and put $$C_p=\operatorname{Spec} \mathbb C[[t]]$$. Suppose that there is a colimit $$X$$ in the category of schemes for the diagram $$D$$ formed by the two maps $$C_p \times C_p \to C_p \times C$$ and $$C_p \times C_p \to C \times C_p$$. We will derive a contradiction. There is a natural map $$X \to C\times C$$ by definition of the colimit. I claim that the functor of points of $$X$$ is the (Zariski) sheafification of the presheaf taking a scheme $$T$$ to the subset of $$(C\times C)(T)$$ consisting of morphisms $$(f,g)$$ such that either $$f$$ or $$g$$ factors through $$C_p$$. To prove this claim, call $$X'$$ this sheafification. Then $$X'$$ is the colimit of our diagram $$D$$ in the category of Zariski sheaves $$\operatorname{Sch}^{op} \to \operatorname{Set}$$. In particular, there is a natural map $$X' \to X$$ in this category (since $$X$$ is the colimit in a smaller category). Conversely, a morphism of schemes $$T \to X$$ gives a morphism $$T \to C\times C$$, which factors through $$X'$$ since $$C_p \times C$$ and $$C \times C_p$$ jointly surject onto $$X$$. So, we have $$X=X'$$, which proves the claim.
Now, pick an affine neighbourhood $$U=\operatorname{Spec} A$$ of $$(p,p)$$ in $$X$$. We can choose an affine neighbourhood $$V=\operatorname{spec} B$$ of $$p$$ in $$C$$ which is small enough so that $$C_p \times V \to X$$ and $$V \times C_p \to X$$ both factor through $$U$$. Identifying $$C\times C$$ with $$\mathbb A^2_k=\operatorname{Spec}\mathbb C[t_1,t_2]$$, we find that $$A$$ is a sub-$$\mathbb C[t_1,t_2]$$-algebra of $$\mathbb C[[t_1,t_2]]$$ which factors through both $$\mathbb C[[t_1]]\otimes_\mathbb C B$$ and $$B \otimes_\mathbb C \mathbb C[[t_2]]$$. Since $$B$$ is obtained from $$\mathbb C[t]$$ by inverting finitely many polynomials, $$U=\operatorname{Spec} A$$ is an open subscheme of $$C \times C=\mathbb A^2_k$$. This is incompatible with $$U$$ being contained in $$X$$, so we have our contradiction (for example because such an $$U$$ will contain many closed points which do not lie on one of the coordinate axes).