I am trying to draw the commutative graph below in LaTeX. I have looked up and know the most effective way to do this is to load \usepackage{tikz-cd}
but I can't figure how to write the code. I would greatly appreciate any help.
1 Answer
\documentclass[10pt,a4paper]{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
& A \arrow[d,red,]
\arrow[dl, bend right]
\arrow[dr, bend left] & \\
X & P \arrow[r, green]\arrow[l, green] & Y
\end{tikzcd}
\end{document}
edit for label
\documentclass[10pt,a4paper]{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
& A \arrow[d,red,]
\arrow[dl, bend right]
\arrow[dr, bend left] & \\
X & P \arrow[r, green, "x1"']\arrow[l, green, "x2"] & Y
\end{tikzcd}
\end{document}
edit for scaling
\documentclass[10pt,a4paper]{article}
\usepackage{tikz-cd}
\usepackage{adjustbox}
\begin{document}
\adjustbox{scale=4, center}{
\begin{tikzcd}[sep=huge]
& A \arrow[d,red,]
\arrow[dl, bend right]
\arrow[dr, bend left] & \\
X & P \arrow[r, green, "x1"']\arrow[l, green, "x2"] & Y
\end{tikzcd}
}
\end{document}
-
Hiya, Thank you for all your help. I was able to label the graph. I just have 2 questions if you don't mind answering them. Is there a command to get the labels on the axis on the same side of the arrow. For example when I labelled the x_1 and x_2 arrows I got one above the arrow and one below the arrow. I used the command "x_1" to label them. Secondly, is there any command I can use to make the diagram bigger? Thank you.– EliseDec 4, 2020 at 13:48
-
-
for the scaling part you can refer here -- tex.stackexchange.com/a/270285/197451– js bibraDec 4, 2020 at 13:57
-
-
@Elise using adjustbox to scale as defined here -- tex.stackexchange.com/a/325309/197451– js bibraDec 4, 2020 at 14:00
tikz-cd
manual. Especially thebend left
etc