Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm somewhat familiar with the array environment, but I'm not sure what the best approach would be to produce this diagram:

enter image description here

How would I make this, or diagrams similar to this? The slanted arrows and the positioning are what mainly throw me off.

share|improve this question
add comment

5 Answers

up vote 16 down vote accepted

I'd use TikZ to draw that diagram

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[>=latex]
    \def\radius{2cm} % change to an appropriate value
    \node (h0A) at (60:\radius)   {$H^0(A)$};
    \node (h0C) at (0:\radius)    {$H^0(C)$};
    \node (h1B) at (-60:\radius)  {$H^1(B)$};
    \node (h1A) at (-120:\radius) {$H^1(A)$};
    \node (h1C) at (180:\radius)  {$H^1(C)$};
    \node (h0B) at (120:\radius)  {$H^0(B)$};

    \path[->,font=\small]
        (h0A) edge node[auto] {$g_0$} (h0C)
        (h0C) edge node[auto] {$\delta_0$} (h1B)
        (h1B) edge node[auto] {$f_1$} (h1A)
        (h1A) edge node[auto] {$g_1$} (h1C)
        (h1C) edge node[auto] {$\delta_1$} (h0B)
        (h0B) edge node[auto] {$f_0$} (h0A);
\end{tikzpicture}
\end{document}

First the 6 vertices are defined (as nodes in TikZ-speak) using polar coordinates. They are named (h0A) to (h0B). Then the arrows are drawn using edge paths ((start) edge (finish)) and the descriptions (again nodes) are placed beside them with node[auto] {text}.

result

A nice introduction to drawing commutative diagrams with TikZ is Commutative Diagrams with TikZ.

share|improve this answer
    
Is there a way to produce "proper" arrow tips? These arrows don't mix well with \to, at least with CM fonts. –  egreg Sep 21 '11 at 22:04
    
@egreg: Maybe you like it better without >=latex. –  Caramdir Sep 21 '11 at 22:05
    
These both look very nice, thanks. Thanks for the pdf, I need to get around to learning TikZ soon. –  yunone Sep 21 '11 at 22:13
add comment

Run with xelatex

\documentclass{article}
\usepackage{pst-node}

\begin{document}

\def\R{2.5}
\begin{pspicture}(-3,-3)(3,3)
\psframe*[linecolor=red!10](-3,-3)(3,3)
\psset{nodesep=3pt,arrows=->,shortput=nab}\degrees[6]
\psnode(\R;0){P0}{$H^0(C)$} \psnode(\R;1){P1}{$H^0(B)$}
\psnode(\R;2){P2}{$H^0(B)$} \psnode(\R;3){P3}{$H^1(C)$}
\psnode(\R;4){P4}{$H^1(A)$} \psnode(\R;5){P5}{$H^1(B)$}
\ncline{P0}{P5}^{$\delta_0$}\ncline{P5}{P4}^{$f_1$}
\ncline{P4}{P3}^{$g_1$}     \ncline{P3}{P2}^{$\delta_1$}
\ncline{P2}{P1}^{$f_0$}     \ncline{P1}{P0}^{$g_0$}
\end{pspicture}

\end{document}

enter image description here

share|improve this answer
add comment

I fear I have been beaten...

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{matrix,arrows}

\begin{document}

\begin{tikzpicture}

% define matrix
\matrix (m) [matrix of nodes, column sep=3em, row sep=3em]
{  & $H^{0}(B)$ & $H^{0}(A)$ &\\
$H^{1}(C)$ &  &  &  $H^{0}(C)$ \\
 & $H^{1}(A)$ & $H^{1}(B)$ & \\};

\path[->, font=\scriptsize]
(m-2-1) edge node[above] {$\delta_{1}$} (m-1-2);

\path[->, font=\scriptsize]
(m-1-2) edge node[above] {$f_{0}$} (m-1-3);

\path[->, font=\scriptsize]
(m-1-3) edge node[above] {$g_{0}$} (m-2-4);

\path[->, font=\scriptsize]
(m-3-3) edge node[below] {$f_{0}$} (m-3-2);

\path[->, font=\scriptsize]
(m-2-4) edge node[below] {$\delta_{0}$} (m-3-3);

\path[->, font=\scriptsize]
(m-3-2) edge node[below] {$g_{1}$} (m-2-1);

\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
The solution from Caramdir is much nicer than mine! –  scitexter Sep 21 '11 at 22:31
2  
Please crop your image -- all that extra white space is not adding any information. –  Peter Grill Sep 21 '11 at 22:37
    
Done – sorry for not cropping –  scitexter Sep 21 '11 at 23:55
add comment

Another option is to use PSTricks, see below. As always, there's more than way to do this!

See the pst-node documentation for more details and plenty of examples.

\documentclass{article}

\usepackage{pst-node}

\begin{document}

$ \psmatrix[colsep=1.5cm,rowsep=1.5cm]
        &  H^0(B)   & H^0(B)    &     \\
H^1(C)   &           &           & H^0(C)     \\
        &  H^1(A)   & H^1(B)    &     
\endpsmatrix
\psset{nodesep=3pt,arrows=->}
\ncline{2,1}{1,2}\naput{\delta_1}
\ncline{1,2}{1,3}\naput{f_0}
\ncline{1,3}{2,4}\naput{g_0}
\ncline{2,4}{3,3}\naput{\delta_0}
\ncline{3,3}{3,2}\naput{f_1}
\ncline{3,2}{2,1}\naput{g_1}
$

\end{document}

enter image description here

share|improve this answer
    
I like this, i like how you can see in the text how it's going to look when compiled. Pretty cool. –  Matt Sep 22 '11 at 5:36
add comment

Here's a way with Xy-pic

\documentclass[a4paper]{article}
\usepackage[all,cmtip,pdf]{xy}
\usepackage{amsmath}
\begin{document}

\begin{equation}
\begin{gathered}
\xymatrix@C-1em{
& H^0(B) \ar[rr]^{f_0} && H^0(A) \ar[dr]^{g_0} \\
H^1(C) \ar[ur]^{\delta_1} &&&& H^0(C) \ar[dl]^{\delta_0} \\
& H^1(A) \ar[ul]^{g_1} && H^1(B) \ar[ll]^{f_1}
}
\end{gathered}
\end{equation}
\end{document}

Remember to put the \xymatrix inside a gathered environment if you need an equation number next to it. Otherwise discard the gathered environment.

enter image description here

I've reduced the column distance and doubled the middle arrow across an empty column to keep uniform the arrow lengths.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.