0

How can I draw the following diagram using tikz-cd?

enter image description here

I've seen a lot of examples on the internet, but none of them helped (actually, they confused me more).

1 Answer 1

1

You can use tikz-cd.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}
 & A\arrow[d] \arrow[ddl,bend right]\arrow[ddr,bend left] & \\
 & B \arrow[dr] \arrow[dl]& \\
C \arrow[rr]&  & D \\ 
\end{tikzcd}\]
\end{document}

enter image description here

Or with some smaller column sep.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[column sep=1em]
 & A\arrow[d] \arrow[ddl,bend right]\arrow[ddr,bend left] & \\
 & B \arrow[dr] \arrow[dl]& \\
C \arrow[rr]&  & D \\ 
\end{tikzcd}\]
\end{document}

enter image description here

2
  • Can you explain how the ampersands work here (how many do I need, where do I need them etc)? I couldn't figure it out.
    – rmdmc89
    Feb 21, 2020 at 21:41
  • 2
    @rmdmc89 tikz-cd is basically an extension of the matrix library of tikz. So you may think of A, B, C and D as being arranged in a matrix, and connected by appropriate arrows. The columns of the matrix get separated by &, and the rows by \\ . In the case at hand, we may want to use a 3x3 matrix. The distances between rows and columns can be changed with column sep and row sep, respectively.
    – user194703
    Feb 21, 2020 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.