# How to draw the commutative diagram of binary products in LaTeX?

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.

• Isn't this just an adaptation of the example at the top if page 3 in the tikz-cd manual. Especially the bend left etc Dec 4, 2020 at 11:57
• Yeah, I have looked at that I am struggling to get the arrows x and y used in the example in the manual to go to different objects. Dec 4, 2020 at 12:04
• Note that you are more likely to get help if you provide the code you have so far (as a full but minimal example that others can try as is) Dec 4, 2020 at 12:14
• @Elise please see the answer below - I have not done the labeling -- hope you can complete that part Dec 4, 2020 at 13:20
• @Elise would you like to accept the answer and /or upvote Dec 4, 2020 at 15:57

## 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. Dec 4, 2020 at 13:48
• @Elise please see the edit above Dec 4, 2020 at 13:54
• for the scaling part you can refer here -- tex.stackexchange.com/a/270285/197451 Dec 4, 2020 at 13:57
• Got it, once again thank you very much for your help. Dec 4, 2020 at 13:59
• @Elise using adjustbox to scale as defined here -- tex.stackexchange.com/a/325309/197451 Dec 4, 2020 at 14:00