Wonky diagrams in tikz

I'm trying to make a commutative diagram (without the package tikz-cd) with nodes of different sizes.

I'm skipping nodes like this

  &   & A &   &   \\
& B &   & C &   \\
D &   & E &   & F \\


and would like to add diagonal arrow e.g. A -- B -- D, but for some reason they don't run in a straight line.

I'm already using column sep = [fixed value] to straighten it up, but the diagonal arrows a still a little wonky.

What should I do to straighten them out?

Here's my full code:

\begin{tikzpicture}[baseline=-2.6pt,description/.style={fill=white,inner sep=2pt}]
\matrix (m) [matrix of math nodes, column sep=3em]
{
&& A_1 && \\
& A_1 && A_1 \oplus A_2 & \\
A_1 && A_1 \oplus A_2 && A_2 \\
};
\path[-stealth,line width=.5pt,font=\scriptsize]
(m-1-3) edge node[above] {$id$} (m-2-2)
(m-1-3) edge node[above] {$i_1$} (m-2-4)
(m-2-2) edge node[above] {$id$} (m-3-1)
(m-2-2) edge node[above] {$i_1$} (m-3-3)
(m-2-4) edge node[above] {$id$} (m-3-3)
(m-2-4) edge node[above] {$p_2$} (m-3-5)
;
\end{tikzpicture}

• Why not tikz-cd? – egreg May 12 '14 at 20:27
• @egreg I just managed to do everything I needed without it and never bothered to learn the syntax. Is it not an issue with tikz-cd? – Earthliŋ May 12 '14 at 20:30
• @Earthliŋ Yes, it is too, because it uses the same engine. I managed to get arrows almost on a straight line by pretending A_1 to occupy the same space as A_1\oplus A_2. – egreg May 12 '14 at 20:35

\documentclass[tikz,margin=5pt]{standalone}
\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}[baseline=-2.6pt,description/.style={fill=white,inner sep=2pt}]
\matrix (m) [matrix of math nodes, column sep=3em, row sep=2em,minimum width=4em]
{
&& A_1 && \\
& A_1 && A_1 \oplus A_2 & \\
A_1 && A_1 \oplus A_2 && A_2 \\
};
\path[-stealth,line width=.5pt,font=\scriptsize]
(m-1-3) edge node[above] {$id$} (m-2-2)
(m-1-3) edge node[above] {$i_1$} (m-2-4)
(m-2-2) edge node[above] {$id$} (m-3-1)
(m-2-2) edge node[above] {$i_1$} (m-3-3)
(m-2-4) edge node[above] {$id$} (m-3-3)
(m-2-4) edge node[above] {$p_2$} (m-3-5)
;
\end{tikzpicture}

\end{document}

• Nice. Is there a way to make the arrows on the smaller nodes not stop short? – Earthliŋ May 12 '14 at 20:41
• Add inner sep=2pt after minimum width=4em ? – Tarass May 12 '14 at 20:44
• That works perfectly and resolves a question I had for a very long time. Thank you! – Earthliŋ May 15 '14 at 12:27