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 have two questions. There must be an easy way for the diagram that I am trying to draw, but I am totally new to drawing diagrams in tex. Xy-pic package seems too complicated, thus I am trying TikZ-package.

  1. How do I change the arrows in my matrix to simply to $\Rightarrows$, I solved it by [double], but it does not look nice and the color of arrows are somehow different.

  2. How can I add two arrows between two nodes. Simply, I want to write $A \Rightarrow B$ and $B \nLightarrow A$ between my two nodes A and B. I could not also solve the bending problem yet.

Here is my code up to now.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=3em, column sep=3em, text
            height=1.5ex, text depth=0.25ex] 
            {   & X & & \\
              A & B & C & D \\
              E & F & G & H \\
                  & I & & \\};
            \path[->] (m-1-2) edge [double] (m-2-3)
                               edge [double,bend left=90] (m-4-2);
             \path[->] (m-2-1) edge [double] (m-2-2)
                               edge [double] (m-3-1)
                               edge [double] (m-1-2);
             \path[->] (m-2-2) edge  [double] (m-2-3)
                               edge  [double] (m-3-2);
             \path[->] (m-2-3) edge [double] (m-2-4)
                               edge [double] (m-3-3);
             \path[->] (m-2-4) edge [double] (m-3-4);
             \path[->] (m-3-1) edge [double] (m-3-2)
                               edge [double] (m-4-2);
             \path[->] (m-3-2) edge [double](m-3-3); 
             \path[->] (m-3-3) edge [double] (m-3-4); 
             \path[->] (m-4-2) edge [double] (m-3-3);
             \end{tikzpicture}
             \end{document}
share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

Here's one option using the tikz-cd package which facilitates the creation of commutative diagrams:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
& X\arrow[Rightarrow]{dr}{}\arrow[Rightarrow,to path={..controls +(-2.5,0.7) and +(-2.5,-0.7).. (\tikztotarget)}]{ddd}{}    \\
A \arrow[Rightarrow]{ur}{}\arrow{r}{}\arrow{d} & B \arrow{r}{}\arrow{d} & C\arrow{r}{}\arrow{d} & D\arrow{d}\\
E \arrow[Rightarrow]{dr}{} \arrow{r}{} & F \arrow{r}{} & G\arrow{r}[color=red]{} & H\\
& I\arrow[Rightarrow]{ur}{}\\
\end{tikzcd}

\end{document}

enter image description here

If all the arrows should be given the style of \Rightarrow, it's enough to use the arrows=Rightarrow option:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[arrows=Rightarrow]
& X\arrow{dr}{}\arrow[to path={..controls +(-2.5,0.7) and +(-2.5,-0.7).. (\tikztotarget)}]{ddd}{} \\
A \arrow{ur}{}\arrow{r}{}\arrow{d} & B \arrow{r}{}\arrow{d} & C\arrow{r}{}\arrow{d} &    D\arrow{d} \\
E \arrow{dr}{} \arrow{r}{} & F \arrow{r}{} & G\arrow{r}[color=red]{} & H \\
& I\arrow{ur}{}
\end{tikzcd}

\end{document}

enter image description here

I initially forgot question 2. You can use the in=, out= keys to bend the arrows:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[arrows=Rightarrow]
& X\arrow{dr}{}\arrow[to path={..controls +(-2.5,0.7) and +(-2.5,-0.7).. (\tikztotarget)}]{ddd}{} \\
A \arrow{ur}{}\arrow[out=30,in=150]{r}{}\arrow{d} & B \arrow[out=210,in=330]{l}{}\arrow{r}{}\arrow{d} & C\arrow{r}{}\arrow{d} &    D\arrow{d} \\
E \arrow{dr}{} \arrow{r}{} & F \arrow{r}{} & G\arrow{r}[color=red]{} & H \\
& I\arrow{ur}{}
\end{tikzcd}

\end{document}

enter image description here

share|improve this answer
    
Thank you very much! –  Derya Apr 6 '12 at 9:03
1  
@Derya: You're welcome! Since my response seems to have answered your question, please consider marking it as ‘Accepted’ by clicking on the tickmark below its vote count. –  Gonzalo Medina Apr 6 '12 at 17:34
1  
@Derya I think you got the wrong answer accepted since this is much more elaborate. :) –  percusse Apr 6 '12 at 18:17
    
@percusse:lol.I tried accepting both, just saw I cant do that.. –  Derya Apr 6 '12 at 18:56
add comment

This is a little bit of a simplification and I've put the drawing commands into a foreach loop. It's a little hard to understand what the end product should look like. Moreover, the coloring seems to be a PDF viewer issue since SumatraPDF doesn't exhibit this problem. The reqired arrow name is implies and can be found in arrows library documentation. I didn't want to make it too terse for the sake of simplification but it's certainly possible.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[>=implies]
\matrix (m) [matrix of math nodes, nodes in empty cells, row sep=3em, column sep=3em, 
text height=1.5ex, text depth=0.25ex] 
        {   & X & &     \\
          A & B & C & D \\
          E & F & G & H \\
              & I & &   \\};

\foreach[remember=\x as \lastx (initially 1)] \x in {2,...,4}{
    \draw[double,->] (m-2-\lastx) -- (m-2-\x);
    \draw[double,->] (m-3-\lastx) -- (m-3-\x);
}

\foreach \x in {1,...,4}{\draw[double,->] (m-2-\x) -- (m-3-\x);}

\draw[double,->] (m-1-2) -- (m-2-3);
\draw[double,->] (m-2-1) -- (m-1-2);
\draw[double,->] (m-4-2) -- (m-3-3);
\draw[double,->] (m-3-1) -- (m-4-2);
\draw[double,->] (m-1-2) .. controls ([xshift=-1.2cm]m-1-1) and ([xshift=-1.2cm]m-4-1) .. (m-4-2);
\end{tikzpicture}
\end{document}

enter image description here

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.