3

enter image description here

I intend to generate this sketch using tikz, but was unable to do so. I was trying to fiddle with the following code:

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

\begin{document}
\begin{tikzcd}
 A \arrow[rd] \arrow[r, "\phi"] & B \\
& C
\end{tikzcd}
\end{document}

I need some help here. Also a good reference for tikz would be appreciated, specifically, I am not able to understand the function of "&" in tikz environment.

0
8

tikz-cd documentation

You have to think on your diagram as an array, with rows and columns. In your case, 2 rows and 4 columns.

So, at position (i,j) you can start an arrow pointing to another position (k,l), where you specify if the ending position is left, right, up or down, or even combinations of those.

In your example, and arrow from B to E should be rd (right and down).

Observe that to create cells in the array you change columns with & and change rows with \\.

As usual, it is easy to change colours also, for example, \arrow[rd, red].

enter image description here

\documentclass{article}
%\usepackage{amsmath,mathtools}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}
 A  \arrow[r, "\phi"] & B \arrow[rd] \arrow[r] & C \arrow[r] & D \\
 & & E
\end{tikzcd}
\end{document}
1
  • 2
    Complete, concise and exhaustive answer. – Sebastiano Dec 4 '18 at 16:21

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.