# Problem with a commutative diagram

I want to draw this diagram: And I have tried out the following code which is not working:

$\begin{tikzcd} & E \arrow{r}{u} \arrow{dr}{\pi} & {E^'}\arrow{dl}{\pi^'}\\ & X \end{tikzcd}$


Any help is appreciated.

Edit: There should be a u over the arrow from E to E' in the picture.

• Note that E^{'} is wrong; it should be E'. Also the arguments to \arrow are already in math mode, so \$ should not be used in them. – egreg Oct 14 at 20:42

You need three columns. But also to vertically align \pi and \pi'.

With \setheight{x}{y} we typeset x, but as if its vertical dimensions were those of y.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\newcommand{\setheight}{\smash{#1}\vphantom{#2}}

\begin{document}

\begin{tikzcd}[column sep=small]
E \arrow[rd, "\pi"'] \arrow[rr, "u"] &   & E' \arrow[ld, "\setheight{\pi'}{\pi}"] \\
& X
\end{tikzcd}

\end{document} • A concise solution which just goes the extra mile to look a little bit cleaner; great answer! – Peiffap Oct 14 at 20:45
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
$\begin{tikzcd} E \arrow[rr,"u"] \arrow[dr,"\pi"'] & & {E'}\arrow[dl,"\pi'"]\\ & X & \\ \end{tikzcd}$
\end{document} Here there is my proposal. \documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[row sep=2 em,column sep=1em]
E \arrow[rd, "\pi"'] \arrow[rr, "u"] &   & E' \arrow[ld, "\pi'"] \\
& x &
\end{tikzcd}
\end{document}


## ADDENDUM: a variant with xy package.

It is possible to have \pi and \pi' on the same horizontal line (nearly by eye - see the distances .46 and .4) using xy package with the same tips (see option cmtip) of tikz-cd package. \documentclass[a4paper,12pt]{article}
\pagestyle{empty}
\usepackage[all,cmtip]{xy}
\begin{document}
\xymatrix{
E \ar[rr]^{u}
\ar[dr]_(.46){\pi}
&& E'\ar[dl]^(.4){\pi'} \\
& X }
\end{document} \documentclass{article}
\usepackage{tikz-cd}

\begin{document}
$\begin{tikzcd}[row sep=huge] E \ar[rr,"u"] \ar[dr,"\pi" '] & & E'\ar[dl, "\pi'"] \\ & x & \end{tikzcd}$
\end{document}


or \documentclass{article}
\usepackage{tikz-cd}

\begin{document}
$\begin{tikzcd}[row sep=huge] E \ar[rr,"u"] \ar[dr, "\pi", sloped] & & E'\ar[dl, "\pi'",sloped] \\ & x & \end{tikzcd}$
\end{document}