2

I have a problem with Tikz as follows: I want to draw a curve connecting the node $H_q(X_1)$ and $H_q(X_1,A)$. I used the command \draw[bend right,->] (-2) to node [anchor=north]{$H_{n-1}(Id)$} (10); in the last line of my code below but the result is not good. The curve drawn is above letters as shown:

enter image description here

How can I make this curve bend more to the left? This is the code of my diagram:

    \begin{center}
\begin{tikzpicture}[every node/.style={midway}]
  \matrix[column sep={10em,between origins}, row sep={2.9em}] at (0,0) {
   \node(-14) {}; & \node (-13) {};&\node(-12) {};\\
  \node(-11){} ; & \node(-10) {$H_{q+1}(X,A)$};&\node(-9) {}; \\
 \node(-8) {$H_{q+1}(X_2,A)$}; & \node (-7) {};&\node(-6) {$H_{q+1}(X_1,A)$};\\
  \node(-5){} ; & \node(-4) {$H_q(A)$};&\node(-3) {}; \\
 \node(-2) {$H_q(X_1)$}; & \node (-1) {};&\node(0) {$H_q(X_2)$};\\
   \node(1){} ; & \node(2) {$H_q(X)$};&\node(3) {}; \\
 \node(4) {$H_q(X,X_2)$}; & \node (5) {};&\node(6) {$H_q(X,X_1)$};\\
     \node(7) {}; & \node (8) {$H_q(X,A)$};&\node(9) {};\\
     \node(10){$H_q(X_1,A)$} ; & \node(11) {};&\node(12) {$H_q(X_1,A)$}; \\
    \node(13) {}; & \node (14) {$H_{q-1}(A)$};&\node(15) {};\\
    \node(16){$H_{q-1}(X_2)$} ; & \node(17) {};&\node(18) {$H_{q-1}(X_1)$}; \\
    \node(19) {}; & \node (20) {$H_{q-1}(X)$};&\node(21) {};\\
    \node(22){} ; & \node(23) {};&\node(24) {}; \\
     };

      \draw[->] (-14) -- (-10) node[anchor=south]  {};
      \draw[->] (-13) -- (-10) node[anchor=south]  {};
      \draw[->] (-12) -- (-10) node[anchor=south]  {};

     \draw[->] (-4) -- (-6) node[anchor=north]  {$\partial_{(q+1)_1}^*$};
  \draw[->] (-4) -- (-8) node[anchor=north]  {$\partial_{(q+1)_2}^*$};
  \draw[->] (-6) -- (-10) node[anchor=south]  {$H_q(l_1)$};
  \draw[->] (-8) -- (-10) node[anchor=south]  {$H_q(l_2)$};

  \draw[<-] (-2) -- (-4) node[anchor=south]  {$H_q(m_1)$};
  \draw[<-] (0) -- (-4) node[anchor=south]  {$H_q(m_2)$};
  \draw[->] (-2) -- (2) node[anchor=north]  {$H_q(i_1)$};
  \draw[->][red] (0) -- (2) node[anchor=north]  {$H_q(i_2)$};


  \draw[->] (2) -- (4) node[anchor=south]  {$H_q(s_2)$};
  \draw[->] (2) -- (6) node[anchor=south]  {$H_q(s_1)$};
  \draw[<-] (4) -- (8) node[anchor=north] {$H_q(j_2)$};
  \draw[<-] (6) -- (8) node[anchor=north] {$H_q(j_1)$};

  \draw[<-] (8) -- (10) node[anchor=north]  {$H_q(l_1)$};
  \draw[<-] (8) -- (12) node[anchor=north]  {$H_q(l_2)$};
  \draw[->] (10) -- (14) node[anchor=north] {$\partial_{q_1}^*$};
  \draw[->] (12) -- (14) node[anchor=north] {$\partial_{q_2}^*$};

  \draw[->] (14) -- (16) node[anchor=south]  {$H_{q-1}(m_2)$};
  \draw[->] (14) -- (18) node[anchor=south]  {$H_{q-1}(m_1)$};
  \draw[->] (16) -- (20) node[anchor=north] {$H_{q-1}(i_2)$};
  \draw[->] (18) -- (20) node[anchor=north] {$H_{q-1}(i_1)$};

   \draw[<-][thick][green] (4) -- (10) node[anchor=east] {$H_q(k_1)$};
   \draw[<-] (6) -- (12) node[anchor=west] {$H_q(k_2)$};


    \draw[->] (-10) -- (-4) node[anchor=west]  {$\partial_{q+1}^*$};
   \draw[->] (-4) -- (2) node[anchor=west]  {$H_{q}(m)$};
    \draw[->] (2) -- (8) node[anchor=west]  {$H_{q}(n)$};
    \draw[->] (8) -- (14) node[anchor=west]  {$\partial_{q}^*$};
     \draw[->] (14) -- (20) node[anchor=west]  {$H_q(m)$};

      \draw[->] (20) -- (22) node[anchor=west]  {};
        \draw[->] (20) -- (23) node[anchor=west]  {};
          \draw[->] (20) -- (24) node[anchor=west]  {};


      \draw[bend right=75,->]  (-2) to node [anchor=east]{$H_{q}(n_1)$} (10);   
      \draw[bend right=75,->]  (4) to node [anchor=east]{$\partial_{q_2}^*$} (16);   

       \draw[bend left=75,->]  (0) to node [anchor=west]{$\partial_{q_2}^*$} (12);   
       \draw[bend left=75,->]  (6) to node [anchor=west]{$\partial_{q_2}^*$} (18);   

\end{tikzpicture}
\end{center}

Thank you in advance.

Edit: How can we avoid the case that for example, $H_q(s_2)$ is overwritten the line connecting $H_q(X)$ and $H_q(X,X_2)$?

PS: I solved the bending problem.

Second edit: I use Tikz-Cd as recommended by Egreg. The code is:

\[
\begin{tikzcd}
& {H_q(A)}  \arrow[dl,swap,"H_q(m_1)"] \arrow[dd,"H_q(m)"] \arrow[dr,"H_q(m_2)"] \\
H_q(X_1) \arrow[dr,swap,"H_q(i_1)"]
  \arrow[dddd,bend right=50,swap,"H_{n-1}(\mathit{Id})"] &&
  H_q(X_2) \arrow[dddd,bend left=50,"H_{n-1}(\mathit{Id})"]  \arrow[red,dl,"H_q(i_2)"] \\
& H_q(X) \arrow[dl,swap,"H_q(s_1)"] \arrow[dd,"H_q(n)"] \arrow[dr,"H_q(s_2)"] \\
H_q(X,X_2)\arrow[dddd,bend right=50,swap,"H_{n-1}(\mathit{Id})"]  && H_q(X,X_1)\arrow[dddd,bend left=50,"H_{n-1}(\mathit{Id})"]  \\
& H_q(X,A) \arrow[ul,"H_q(j_2)"] \arrow[ur,swap,"H_q(j_1)"] \arrow[dd,"\partial_q^*"] \\
H_q(X_1,A) \arrow[uu,"H_q(k_1)"] \arrow[ur,swap,"H_q(l_1)"] \arrow[dr,swap,"\partial^*_{q_1}"] &&
  H_q(X_1,A) \arrow[ul,"H_q(l_2)"] \arrow[uu,swap,"H_q(k_2)"] \arrow[dl,"\partial^*_{q_2}"] \\
& H_{q-1}(A) \arrow[dl,swap,"H_{q-1}(m_2)"] \arrow[dd,"H_{q-1}(m)"] \arrow[dr,"H_{q-1}(m_1)"] \\
H_{q-1}(X_2) \arrow[dr,swap,"H_{q-1}(i_1)"]
  &&
  H_{q-1}(X_1) \arrow[red,dl,"H_{q-1}(i_2)"] \\
& H_{q-1}(X)
\end{tikzcd}
\]

The result is:

enter image description here

The problem now is that I can't draw the tail and the head exactly like my original picture. It always shows error? How can I do that?

3

You can use tikz-cd:

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

\begin{document}

\[
\begin{tikzcd}
& {} \arrow[dl] \arrow[dd,swap,"n"] \arrow[dr] \\
H_q(X_1) \arrow[dr,swap,"H_q(i_1)"]
  \arrow[dddd,bend right=50,swap,"H_{n-1}(\mathit{Id})"] &&
  H_q(X_2) \arrow[red,dl,"H_q(i_2)"] \\
& H_q(X) \arrow[dl,swap,"H_q(s_1)"] \arrow[dd,swap,"n"] \arrow[dr,"H_q(s_2)"] \\
H_q(X,X_2) && H_q(X,X_1) \\
& H_q(X,A) \arrow[ul,"H_q(j_2)"] \arrow[ur,swap,"H_q(j_1)"] \arrow[dd,"\partial"] \\
H_q(X_1,A) \arrow[uu,"H_q(k_1)"] \arrow[ur,swap,"H_q(l_1)"] \arrow[dr,swap,"\partial^*_q"] &&
  H_q(X_1,A) \arrow[ul,"H_q(l_2)"] \arrow[uu,swap,"H_q(k_2)"] \arrow[dl,"\partial^*_q"] \\
& {}
\end{tikzcd}
\]

\end{document}

enter image description here

  • Hi Egreg, Thank you so much. But I am not familiar with this package, I added a new picture and new code into my post. Could you fix the overwriting problem for me? – An Khuong Doan Apr 17 '17 at 10:26
  • What does it mean by dl, dr, uu? – An Khuong Doan Apr 17 '17 at 10:37
  • 1
    @AnKhuongDoan My recommendation: Familiarize yourself with tikz-cd, it is really easy to use. dl means down-left, dr means down-right, uu means up-up. – gernot Apr 17 '17 at 10:39
  • 1
    @AnKhuongDoan Go down by four rows – egreg Apr 17 '17 at 10:44
  • 1
    dl means down-left, dr means down-right, uu means up-up, so dddd means ....? – gernot Apr 17 '17 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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