7

I want to draw this diagram:

here

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.

1
  • 1
    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
    Commented Oct 14, 2019 at 20:42

4 Answers 4

11

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}[2]{\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}

enter image description here

1
  • 5
    A concise solution which just goes the extra mile to look a little bit cleaner; great answer!
    – Peiffap
    Commented Oct 14, 2019 at 20:45
8
\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}

enter image description here

6

Here there is my proposal.

enter image description here

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

enter image description here

\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}
6

enter image description here

\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

enter image description here

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .