# Need help adding arrows to my comutative diagram

I am trying to draw a commutative diagram using Tikz, and am having a bit of trouble adding arrowheads between all of the functions I found some code for this online,and I have modified it, but am only getting an arrow between X and Y, and not any of the other functions. Here is what I have:

\begin{document}
\documentclass[12pt,a4paper,oneside]{report}
\usepackage[left=2.00cm,right=2.00cm,top=2.45cm,bottom=2.5cm]{geometry}
\usepackage{amsmath,amssymb,amscd,amstext}
\usepackage{color,epsfig,fancyhdr,latexsym,slashed}
\usepackage[thmmarks]{ntheorem}
\usepackage{tikz, subfig}
\usepackage{verbatim}
\usetikzlibrary{matrix,arrows}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=3em,
column sep=2.5em, text height=1.5ex, text depth=0.25ex]
{ X & & Y \\
& Z & \\ };
%\draw[->] (m-1-1) – (m-1-3);
\path[->,font=\normalsize]
(m-1-1) edge node[auto] {$f$} (m-1-3)
edge node[auto] {$h$} (m-2-2)
(m-1-3) edge node[auto] {$g$} (m-2-2);
\end{tikzpicture}

Thanks.

-

Why not using tikz-cd?

\documentclass[a4paper]{report}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
X \arrow{rr}{f} \arrow{rd}[swap]{h}  && Y \arrow{dl}{g} \\
& Z
\end{tikzcd}

\end{document}

The swap key puts the label on the opposite side as the default.

Another approach is with Xy-pic

\documentclass[a4paper]{report}
\usepackage[all,cmtip]{xy}

\begin{document}
\xymatrix{
X \ar[rr]^f \ar[dr]_h && Y \ar[dl]^g \\
& Z
}
\end{document}

which gives

-
Thanks for all the help. I was not aware of tikz-cd at all when I posted this as I am very new to tikz; but that is what I was looking for. Thanks again. –  Michael Dykes May 20 '12 at 16:18

Your mwe has some mistakes like \begin{document and \end{document}. Once corrected I get this.

\documentclass[12pt,a4paper,oneside]{report}
\usepackage[left=2.00cm,right=2.00cm,top=2.45cm,bottom=2.5cm]{geometry}
\usepackage{amsmath,amssymb,amscd,amstext}
\usepackage{color,epsfig,fancyhdr,latexsym,slashed}
\usepackage[thmmarks]{ntheorem}
\usepackage{tikz, subfig}
\usepackage{verbatim}
\usetikzlibrary{matrix,arrows}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=3em,
column sep=2.5em, text height=1.5ex, text depth=0.25ex]
{ X & & Y \\
& Z & \\ };
% \draw[->] (m-1-1) -- (m-1-3);
\path[->,font=\normalsize]
(m-1-1) edge node[above] {$f$} (m-1-3)
edge node[left] {$h$} (m-2-2)
(m-1-3) edge node[right] {$g$} (m-2-2);
\end{tikzpicture}
\end{document}

It is not clear from your question whether you need any more arrows. Some clarification may be needed here.

-