0

I have the following code:

\begin{tikzcd}
    A \arrow{r}{f} \arrow[swap]{dr}{g\circ f} & B \arrow{d}{g} \\
     & C
  \end{tikzcd}

but I need to have a curved arrow from A to C, any help with this will be greatly appreciated!

1
  • 1
    Welcome to TeX.SE! You only need to add option bend left or bend right option to arrow which you like to make "curved". BTW, here is very desired, that you provide MWE (Minimal Working Example), a small but complete document beginning with \documentclass and ending with \end{document}, which reproduce your problem.
    – Zarko
    Commented May 28, 2021 at 11:01

2 Answers 2

3

I don't see any reason that you like to have bended the arrow. Original straight is just fine. Anyway, you only need to add option bend right (or bend left) to arrow, which you like to bend.

MWE below gives result of your original code (left image) and with bended arrow (right image). For the right image are used tikz-cd syntax described in section 1.4 Alternative syntax for arrows on page 4:

\documentclass[border=3.141592]{standalone}
\usepackage{tikz-cd}

\begin{document}
    \begin{tikzcd}
 A \arrow{r}{f} \arrow[swap]{dr}{g\circ f} 
        & B \arrow{d}{g} \\
        & C
    \end{tikzcd}

    \begin{tikzcd}
A \rar{f} \drar[bend right, "g\circ f" ']
        & B \dar{g} \\
        & C
  \end{tikzcd}
\end{document}

enter image description here

3
  • is there a code with documentclass{article}?
    – mathmusic
    Commented May 28, 2021 at 16:49
  • @mathmusic, code for diagram is the same for any document class. You only need to replace [border=3.141592]{standalone} with {article}.
    – Zarko
    Commented May 28, 2021 at 16:51
  • Ok. Thank you very much!
    – mathmusic
    Commented May 28, 2021 at 16:52
1

In the tikzcd documentation, they have the following examples, I hope this helps:

\begin{tikzcd}
  T
  \arrow[drr, bend left, "x"]
  \arrow[ddr, bend right, "y"]
  \arrow[dr, dotted, "{(x,y)}" description] & & \\
    & X \times_Z Y \arrow[r, "p"] \arrow[d, "q"]
      & X \arrow[d, "f"] \\
& Y \arrow[r, "g"] &Z
\end{tikzcd}

enter image description here

2
  • 1
    No it is a complicated example, I just need a solution in my case please.
    – mathmusic
    Commented May 28, 2021 at 9:59
  • True, it's quite complicated to read by a human.
    – hola
    Commented May 28, 2021 at 18:19

You must log in to answer this question.

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