3

I wrote the following diagram:

\documentclass{amsart}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
& D \arrow[d,"f"] \arrow[dl, dashrightarrow, "F"] \\
M \arrow[r,"\phi"] & N
\end{tikzcd}

\end{document}

I want to know if there's a way to put the function $F$ above the dashrightarrow.

1

Just swap:

\documentclass{amsart}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
& D \arrow[d,"f"] \arrow[dl, dashrightarrow, "F"] \\
M \arrow[r,"\phi"] & N
\end{tikzcd}

\begin{tikzcd}
& D \arrow[d,"f"] \arrow[dl, dashrightarrow, swap, "F"] \\
M \arrow[r,"\phi"] & N
\end{tikzcd}

\end{document}

enter image description here

Imagine an arrow like a river, with the arrow tip being the mouth; then by default the label is placed along the left bank; with swap you put it along the right bank.

  • @MiguelRomán You can even have two labels: \arrow[d,"a",swap,"b"] – egreg Oct 7 '15 at 22:31
2

Try

\documentclass{amsart}
\usepackage{tikz-cd}

    \begin{document}
\begin{tikzcd}
& D \arrow[d,"f"] \arrow[dl,dashrightarrow, "F"'] \\
M \arrow[r,"\phi"] & N
\end{tikzcd}
    \end{document}

Trick is use "F"'.

enter image description here

  • @egreg, it is shown in the example on the bottom of the second page of package documentation (probably is mentioned also later but till to now I didn't read it further :-) ). – Zarko Oct 7 '15 at 22:36
  • Yes, I saw it by searching for "’ and not "'. Nice trick, but I still think swap to be more readable. I'll upvote tomorrow (votes ended for the day). – egreg Oct 7 '15 at 22:41

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.