How to draw an diagram with arrows?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












enter image description hereI want to draw the following diagram in LaTeX:



enter image description here










share|improve this question























  • You could youre the TikZ package, you will find a short tutorial at the begin of the documentation.
    – omisson
    Sep 25 at 11:04














up vote
2
down vote

favorite












enter image description hereI want to draw the following diagram in LaTeX:



enter image description here










share|improve this question























  • You could youre the TikZ package, you will find a short tutorial at the begin of the documentation.
    – omisson
    Sep 25 at 11:04












up vote
2
down vote

favorite









up vote
2
down vote

favorite











enter image description hereI want to draw the following diagram in LaTeX:



enter image description here










share|improve this question















enter image description hereI want to draw the following diagram in LaTeX:



enter image description here







diagrams arrows draw






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 26 at 17:25

























asked Sep 25 at 11:01









Fatma Erol Kaynarca

394




394











  • You could youre the TikZ package, you will find a short tutorial at the begin of the documentation.
    – omisson
    Sep 25 at 11:04
















  • You could youre the TikZ package, you will find a short tutorial at the begin of the documentation.
    – omisson
    Sep 25 at 11:04















You could youre the TikZ package, you will find a short tutorial at the begin of the documentation.
– omisson
Sep 25 at 11:04




You could youre the TikZ package, you will find a short tutorial at the begin of the documentation.
– omisson
Sep 25 at 11:04










4 Answers
4






active

oldest

votes

















up vote
8
down vote



accepted










It's quite easy with tikz-cd:




enter image description here




documentclassarticle
usepackagetikz-cd
begindocument
begintikzcd
1 ar[r,"a"] ar[rr,bend right,"c"'] & 2 ar[r,"b"] & 3
endtikzcd
enddocument


But, in my humble opinion, I'd vote for picture-mode, for its far more user-friendly syntax:




enter image description here




documentclassarticle
usepackagepict2e
begindocument
setlengthunitlength1cm
beginpicture(2.1,0.75)(0,-0.45)
put(0,0)1
put(0.2,0.1)vector(1,0)0.75
put(0.5,0.15)footnotesize$a$
put(1,0)2
put(1.2,0.1)vector(1,0)0.75
put(1.5,0.15)footnotesize$b$
put(2,0)3
qbezier(0.2,-0.05)(1.05,-0.7)(1.9,-0.05)
put(1.9,-0.05)vector(4,3)0.0001
put(1.0,-0.55)footnotesize$c$
endpicture
enddocument



Update: tikz-cd solution for the second diagram:




enter image description here




documentclassarticle
usepackagetikz-cd
begindocument
begintikzcd
1 ar[r,"a_1"]
ar[rrrrr,bend right=50,looseness=0.3,"b"']
& 2 ar[r,"a_2"]
& 3 ar[r,"a_3"]
& cdots
ar[r,"a_n-2"] % This arrow isn't in the picture, but I chose to add it. Feel free to remove.
& n-1 ar[r,"a_n-1"]
& n
endtikzcd
enddocument





share|improve this answer


















  • 1




    Actually, it's also very easy with plain TikZ (without tikz-cd), but +1 for picture mode ;)
    – TeXnician
    Sep 25 at 11:28










  • @TeXnician The tikz-cd answer is so that people can't say I posted a picture mode answer just to gain more rep. I honestly don't know why people think that ;P
    – Phelype Oleinik
    Sep 25 at 11:42










  • Your first suggestion is very practical but when I get n points (1, 2, 3, ..., n-1, n) I could not print a_1, a_2,...a_n-1 on each arrow and I couldn't print b on below arrow from 1 to n. Can you help me?
    – Fatma Erol Kaynarca
    Sep 26 at 18:36










  • @FatmaErolKaynarca The first method can certainly be adapted to do what you want. Can you please upload a picture of what you want, I couldn't understand from your description.
    – Phelype Oleinik
    Sep 26 at 18:40










  • Okay, I am sorry:( I made correction in the first part I asked the question, can you see from there? If you don't see I upload a picture again, thank you:)
    – Fatma Erol Kaynarca
    Sep 26 at 18:48

















up vote
8
down vote













For the sake of completeness, here it is a plain TikZ approach



documentclassarticle
usepackagetikz
usetikzlibrarypositioning
begindocument
begintikzpicture[node distance = 2cm, thick]%
node (1) 1;
node (2) [right=of 1] 2;
node (3) [right=of 2] 3;
draw[->] (1) -- node [midway,above] a (2);
draw[->] (1) to [bend right] node [midway,below]c (3);
draw[->] (2) -- node [midway,above] b (3);
endtikzpicture%
enddocument


enter image description here



documentclassarticle
usepackagetikz
usetikzlibrarypositioning
begindocument
begintikzpicture[node distance = 2cm, thick]%
node (1) 1;
node (2) [right=of 1] 2;
node (3) [right=of 2] 3;
node (dots) [right=of 3] $cdots$;
node (n1) [right=of dots] $n-1$;
node (n) [right=of n1] $n$;
%
draw[->] (1) -- node [midway,above] $a_1$ (2);
draw[->] (1) to [bend right=15cm] node [midway,below]b (n);
draw[->] (2) -- node [midway,above] $a_2$ (3);
draw[->] (3) -- node [midway,above] $a_3$ (dots);
draw[->] (dots) -- node [midway,above] $a_n-2$ (n1);
draw[->] (n1) -- node [midway,above] $a_n-1$ (n);
endtikzpicture%
enddocument


enter image description here






share|improve this answer






















  • I can't print letters indexed on arrows ?
    – Fatma Erol Kaynarca
    Sep 26 at 17:24










  • @FatmaErolKaynarca could you explain more? Doesn't my code work with you?
    – Diaa
    Sep 26 at 18:58










  • Your typed code works very well, but I wanted to do something else, I couldn't fit what I wanted to do with your code.
    – Fatma Erol Kaynarca
    Sep 26 at 19:02










  • @FatmaErolKaynarca does my answer update get what you want?
    – Diaa
    Sep 26 at 19:16






  • 1




    Thank you very much
    – Fatma Erol Kaynarca
    Sep 26 at 19:29

















up vote
4
down vote













A pstrickssolution: the three numbers are defined as nodes, and we link them by node connections.



documentclass[12pt]article
usepackagepst-node, auto-pst-pdf

begindocument

[
Rnode11 hspace3em Rnode22 hspace3em Rnode33
pssetlinewidth=0.6pt, arrows=->, arrowinset=0.12, nodesep=0.6ex, labelsep=2pt, shortput=nab
everypsboxscriptstyle
ncline12^ancline23^b
ncarc[arcangle=-30]13_c
]

enddocument


enter image description here






share|improve this answer





























    up vote
    0
    down vote













    With tikz, it is possible to use the chain concept of the graphs library.



    chains are a series of nodes whose syntax is abbreviated compared to their normal syntax. A chain ends with a semicolon. The nodes and their text are identical by default as in the first figure. Nodes and text are the number 1, 2 and 3.



    This first figure is composed of 2 chains: the first 1->2->3 and the second which goes directly from 1 to 3.



    To add text to the arrow (that is called edge by tikz), simply place the option edge label or edge label' depending on whether the text is above or below the arrow. In reality, this places the text to the left or right when walking in the direction of the chain.



    In the second example, to avoid having to draw an arrow, we write -!- instead of -> (see p 265 of the manual).
    To make the node text different from its name, simply separate the name from the text with a slash. For example : 5/$n-1$ means that node 5 displays the n-1 text.



    chaine-tikz



    documentclass[a4paper,12pt]article
    usepackagetikz
    usetikzlibrarygraphs
    begindocument

    tikz graph[grow right=30mm]
    1 ->[edge label=a] 2 ->[edge label=b] 3;
    1 -> [bend right,edge label'=c] 3;
    ;


    tikz graph[grow right=20mm]
    1 ->[edge label=$a_1$] 2 ->[edge label=$a_2$] 3->[edge label=$a_3$] 4/$cdots$ -!- 5/$n-1$->[edge label=$a_n-1$] n ;
    1 -> [bend right,edge label'=b] n;
    ;

    enddocument


    Edit:



    Using the quotes library, the syntax for writing labels is even shorter:
    "a" instead of edge label=a
    "c"' instead of edge label' =c
    You can customize the colors as below:



    chaine



    documentclass[a4paper,12pt]article
    usepackagetikz
    usetikzlibrarygraphs,quotes
    begindocument

    tikz[thick,gray] graph[grow right=30mm]
    1 ->["a"] 2 ->["b"] 3;
    1 -> [bend right,"c"'] 3;
    ;

    General case:
    smallskip

    tikz[thick,every edge/.style=red,draw,every node/.style=blue] graph[grow right=20mm,edge quotes=black,auto]
    1 ->["$a_1$"] 2 ->["$a_2$"] 3->["$a_3$"] 4/$cdots$ -!- 5/$n-1$->["$a_n-1$"] n ;
    1 -> [bend right,"b"'] n;
    ;

    enddocument


    Translated with www.DeepL.com/Translator






    share|improve this answer






















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "85"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452415%2fhow-to-draw-an-diagram-with-arrows%23new-answer', 'question_page');

      );

      Post as a guest






























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      8
      down vote



      accepted










      It's quite easy with tikz-cd:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a"] ar[rr,bend right,"c"'] & 2 ar[r,"b"] & 3
      endtikzcd
      enddocument


      But, in my humble opinion, I'd vote for picture-mode, for its far more user-friendly syntax:




      enter image description here




      documentclassarticle
      usepackagepict2e
      begindocument
      setlengthunitlength1cm
      beginpicture(2.1,0.75)(0,-0.45)
      put(0,0)1
      put(0.2,0.1)vector(1,0)0.75
      put(0.5,0.15)footnotesize$a$
      put(1,0)2
      put(1.2,0.1)vector(1,0)0.75
      put(1.5,0.15)footnotesize$b$
      put(2,0)3
      qbezier(0.2,-0.05)(1.05,-0.7)(1.9,-0.05)
      put(1.9,-0.05)vector(4,3)0.0001
      put(1.0,-0.55)footnotesize$c$
      endpicture
      enddocument



      Update: tikz-cd solution for the second diagram:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a_1"]
      ar[rrrrr,bend right=50,looseness=0.3,"b"']
      & 2 ar[r,"a_2"]
      & 3 ar[r,"a_3"]
      & cdots
      ar[r,"a_n-2"] % This arrow isn't in the picture, but I chose to add it. Feel free to remove.
      & n-1 ar[r,"a_n-1"]
      & n
      endtikzcd
      enddocument





      share|improve this answer


















      • 1




        Actually, it's also very easy with plain TikZ (without tikz-cd), but +1 for picture mode ;)
        – TeXnician
        Sep 25 at 11:28










      • @TeXnician The tikz-cd answer is so that people can't say I posted a picture mode answer just to gain more rep. I honestly don't know why people think that ;P
        – Phelype Oleinik
        Sep 25 at 11:42










      • Your first suggestion is very practical but when I get n points (1, 2, 3, ..., n-1, n) I could not print a_1, a_2,...a_n-1 on each arrow and I couldn't print b on below arrow from 1 to n. Can you help me?
        – Fatma Erol Kaynarca
        Sep 26 at 18:36










      • @FatmaErolKaynarca The first method can certainly be adapted to do what you want. Can you please upload a picture of what you want, I couldn't understand from your description.
        – Phelype Oleinik
        Sep 26 at 18:40










      • Okay, I am sorry:( I made correction in the first part I asked the question, can you see from there? If you don't see I upload a picture again, thank you:)
        – Fatma Erol Kaynarca
        Sep 26 at 18:48














      up vote
      8
      down vote



      accepted










      It's quite easy with tikz-cd:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a"] ar[rr,bend right,"c"'] & 2 ar[r,"b"] & 3
      endtikzcd
      enddocument


      But, in my humble opinion, I'd vote for picture-mode, for its far more user-friendly syntax:




      enter image description here




      documentclassarticle
      usepackagepict2e
      begindocument
      setlengthunitlength1cm
      beginpicture(2.1,0.75)(0,-0.45)
      put(0,0)1
      put(0.2,0.1)vector(1,0)0.75
      put(0.5,0.15)footnotesize$a$
      put(1,0)2
      put(1.2,0.1)vector(1,0)0.75
      put(1.5,0.15)footnotesize$b$
      put(2,0)3
      qbezier(0.2,-0.05)(1.05,-0.7)(1.9,-0.05)
      put(1.9,-0.05)vector(4,3)0.0001
      put(1.0,-0.55)footnotesize$c$
      endpicture
      enddocument



      Update: tikz-cd solution for the second diagram:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a_1"]
      ar[rrrrr,bend right=50,looseness=0.3,"b"']
      & 2 ar[r,"a_2"]
      & 3 ar[r,"a_3"]
      & cdots
      ar[r,"a_n-2"] % This arrow isn't in the picture, but I chose to add it. Feel free to remove.
      & n-1 ar[r,"a_n-1"]
      & n
      endtikzcd
      enddocument





      share|improve this answer


















      • 1




        Actually, it's also very easy with plain TikZ (without tikz-cd), but +1 for picture mode ;)
        – TeXnician
        Sep 25 at 11:28










      • @TeXnician The tikz-cd answer is so that people can't say I posted a picture mode answer just to gain more rep. I honestly don't know why people think that ;P
        – Phelype Oleinik
        Sep 25 at 11:42










      • Your first suggestion is very practical but when I get n points (1, 2, 3, ..., n-1, n) I could not print a_1, a_2,...a_n-1 on each arrow and I couldn't print b on below arrow from 1 to n. Can you help me?
        – Fatma Erol Kaynarca
        Sep 26 at 18:36










      • @FatmaErolKaynarca The first method can certainly be adapted to do what you want. Can you please upload a picture of what you want, I couldn't understand from your description.
        – Phelype Oleinik
        Sep 26 at 18:40










      • Okay, I am sorry:( I made correction in the first part I asked the question, can you see from there? If you don't see I upload a picture again, thank you:)
        – Fatma Erol Kaynarca
        Sep 26 at 18:48












      up vote
      8
      down vote



      accepted







      up vote
      8
      down vote



      accepted






      It's quite easy with tikz-cd:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a"] ar[rr,bend right,"c"'] & 2 ar[r,"b"] & 3
      endtikzcd
      enddocument


      But, in my humble opinion, I'd vote for picture-mode, for its far more user-friendly syntax:




      enter image description here




      documentclassarticle
      usepackagepict2e
      begindocument
      setlengthunitlength1cm
      beginpicture(2.1,0.75)(0,-0.45)
      put(0,0)1
      put(0.2,0.1)vector(1,0)0.75
      put(0.5,0.15)footnotesize$a$
      put(1,0)2
      put(1.2,0.1)vector(1,0)0.75
      put(1.5,0.15)footnotesize$b$
      put(2,0)3
      qbezier(0.2,-0.05)(1.05,-0.7)(1.9,-0.05)
      put(1.9,-0.05)vector(4,3)0.0001
      put(1.0,-0.55)footnotesize$c$
      endpicture
      enddocument



      Update: tikz-cd solution for the second diagram:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a_1"]
      ar[rrrrr,bend right=50,looseness=0.3,"b"']
      & 2 ar[r,"a_2"]
      & 3 ar[r,"a_3"]
      & cdots
      ar[r,"a_n-2"] % This arrow isn't in the picture, but I chose to add it. Feel free to remove.
      & n-1 ar[r,"a_n-1"]
      & n
      endtikzcd
      enddocument





      share|improve this answer














      It's quite easy with tikz-cd:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a"] ar[rr,bend right,"c"'] & 2 ar[r,"b"] & 3
      endtikzcd
      enddocument


      But, in my humble opinion, I'd vote for picture-mode, for its far more user-friendly syntax:




      enter image description here




      documentclassarticle
      usepackagepict2e
      begindocument
      setlengthunitlength1cm
      beginpicture(2.1,0.75)(0,-0.45)
      put(0,0)1
      put(0.2,0.1)vector(1,0)0.75
      put(0.5,0.15)footnotesize$a$
      put(1,0)2
      put(1.2,0.1)vector(1,0)0.75
      put(1.5,0.15)footnotesize$b$
      put(2,0)3
      qbezier(0.2,-0.05)(1.05,-0.7)(1.9,-0.05)
      put(1.9,-0.05)vector(4,3)0.0001
      put(1.0,-0.55)footnotesize$c$
      endpicture
      enddocument



      Update: tikz-cd solution for the second diagram:




      enter image description here




      documentclassarticle
      usepackagetikz-cd
      begindocument
      begintikzcd
      1 ar[r,"a_1"]
      ar[rrrrr,bend right=50,looseness=0.3,"b"']
      & 2 ar[r,"a_2"]
      & 3 ar[r,"a_3"]
      & cdots
      ar[r,"a_n-2"] % This arrow isn't in the picture, but I chose to add it. Feel free to remove.
      & n-1 ar[r,"a_n-1"]
      & n
      endtikzcd
      enddocument






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Sep 26 at 18:58

























      answered Sep 25 at 11:23









      Phelype Oleinik

      17.5k43771




      17.5k43771







      • 1




        Actually, it's also very easy with plain TikZ (without tikz-cd), but +1 for picture mode ;)
        – TeXnician
        Sep 25 at 11:28










      • @TeXnician The tikz-cd answer is so that people can't say I posted a picture mode answer just to gain more rep. I honestly don't know why people think that ;P
        – Phelype Oleinik
        Sep 25 at 11:42










      • Your first suggestion is very practical but when I get n points (1, 2, 3, ..., n-1, n) I could not print a_1, a_2,...a_n-1 on each arrow and I couldn't print b on below arrow from 1 to n. Can you help me?
        – Fatma Erol Kaynarca
        Sep 26 at 18:36










      • @FatmaErolKaynarca The first method can certainly be adapted to do what you want. Can you please upload a picture of what you want, I couldn't understand from your description.
        – Phelype Oleinik
        Sep 26 at 18:40










      • Okay, I am sorry:( I made correction in the first part I asked the question, can you see from there? If you don't see I upload a picture again, thank you:)
        – Fatma Erol Kaynarca
        Sep 26 at 18:48












      • 1




        Actually, it's also very easy with plain TikZ (without tikz-cd), but +1 for picture mode ;)
        – TeXnician
        Sep 25 at 11:28










      • @TeXnician The tikz-cd answer is so that people can't say I posted a picture mode answer just to gain more rep. I honestly don't know why people think that ;P
        – Phelype Oleinik
        Sep 25 at 11:42










      • Your first suggestion is very practical but when I get n points (1, 2, 3, ..., n-1, n) I could not print a_1, a_2,...a_n-1 on each arrow and I couldn't print b on below arrow from 1 to n. Can you help me?
        – Fatma Erol Kaynarca
        Sep 26 at 18:36










      • @FatmaErolKaynarca The first method can certainly be adapted to do what you want. Can you please upload a picture of what you want, I couldn't understand from your description.
        – Phelype Oleinik
        Sep 26 at 18:40










      • Okay, I am sorry:( I made correction in the first part I asked the question, can you see from there? If you don't see I upload a picture again, thank you:)
        – Fatma Erol Kaynarca
        Sep 26 at 18:48







      1




      1




      Actually, it's also very easy with plain TikZ (without tikz-cd), but +1 for picture mode ;)
      – TeXnician
      Sep 25 at 11:28




      Actually, it's also very easy with plain TikZ (without tikz-cd), but +1 for picture mode ;)
      – TeXnician
      Sep 25 at 11:28












      @TeXnician The tikz-cd answer is so that people can't say I posted a picture mode answer just to gain more rep. I honestly don't know why people think that ;P
      – Phelype Oleinik
      Sep 25 at 11:42




      @TeXnician The tikz-cd answer is so that people can't say I posted a picture mode answer just to gain more rep. I honestly don't know why people think that ;P
      – Phelype Oleinik
      Sep 25 at 11:42












      Your first suggestion is very practical but when I get n points (1, 2, 3, ..., n-1, n) I could not print a_1, a_2,...a_n-1 on each arrow and I couldn't print b on below arrow from 1 to n. Can you help me?
      – Fatma Erol Kaynarca
      Sep 26 at 18:36




      Your first suggestion is very practical but when I get n points (1, 2, 3, ..., n-1, n) I could not print a_1, a_2,...a_n-1 on each arrow and I couldn't print b on below arrow from 1 to n. Can you help me?
      – Fatma Erol Kaynarca
      Sep 26 at 18:36












      @FatmaErolKaynarca The first method can certainly be adapted to do what you want. Can you please upload a picture of what you want, I couldn't understand from your description.
      – Phelype Oleinik
      Sep 26 at 18:40




      @FatmaErolKaynarca The first method can certainly be adapted to do what you want. Can you please upload a picture of what you want, I couldn't understand from your description.
      – Phelype Oleinik
      Sep 26 at 18:40












      Okay, I am sorry:( I made correction in the first part I asked the question, can you see from there? If you don't see I upload a picture again, thank you:)
      – Fatma Erol Kaynarca
      Sep 26 at 18:48




      Okay, I am sorry:( I made correction in the first part I asked the question, can you see from there? If you don't see I upload a picture again, thank you:)
      – Fatma Erol Kaynarca
      Sep 26 at 18:48










      up vote
      8
      down vote













      For the sake of completeness, here it is a plain TikZ approach



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      draw[->] (1) -- node [midway,above] a (2);
      draw[->] (1) to [bend right] node [midway,below]c (3);
      draw[->] (2) -- node [midway,above] b (3);
      endtikzpicture%
      enddocument


      enter image description here



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      node (dots) [right=of 3] $cdots$;
      node (n1) [right=of dots] $n-1$;
      node (n) [right=of n1] $n$;
      %
      draw[->] (1) -- node [midway,above] $a_1$ (2);
      draw[->] (1) to [bend right=15cm] node [midway,below]b (n);
      draw[->] (2) -- node [midway,above] $a_2$ (3);
      draw[->] (3) -- node [midway,above] $a_3$ (dots);
      draw[->] (dots) -- node [midway,above] $a_n-2$ (n1);
      draw[->] (n1) -- node [midway,above] $a_n-1$ (n);
      endtikzpicture%
      enddocument


      enter image description here






      share|improve this answer






















      • I can't print letters indexed on arrows ?
        – Fatma Erol Kaynarca
        Sep 26 at 17:24










      • @FatmaErolKaynarca could you explain more? Doesn't my code work with you?
        – Diaa
        Sep 26 at 18:58










      • Your typed code works very well, but I wanted to do something else, I couldn't fit what I wanted to do with your code.
        – Fatma Erol Kaynarca
        Sep 26 at 19:02










      • @FatmaErolKaynarca does my answer update get what you want?
        – Diaa
        Sep 26 at 19:16






      • 1




        Thank you very much
        – Fatma Erol Kaynarca
        Sep 26 at 19:29














      up vote
      8
      down vote













      For the sake of completeness, here it is a plain TikZ approach



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      draw[->] (1) -- node [midway,above] a (2);
      draw[->] (1) to [bend right] node [midway,below]c (3);
      draw[->] (2) -- node [midway,above] b (3);
      endtikzpicture%
      enddocument


      enter image description here



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      node (dots) [right=of 3] $cdots$;
      node (n1) [right=of dots] $n-1$;
      node (n) [right=of n1] $n$;
      %
      draw[->] (1) -- node [midway,above] $a_1$ (2);
      draw[->] (1) to [bend right=15cm] node [midway,below]b (n);
      draw[->] (2) -- node [midway,above] $a_2$ (3);
      draw[->] (3) -- node [midway,above] $a_3$ (dots);
      draw[->] (dots) -- node [midway,above] $a_n-2$ (n1);
      draw[->] (n1) -- node [midway,above] $a_n-1$ (n);
      endtikzpicture%
      enddocument


      enter image description here






      share|improve this answer






















      • I can't print letters indexed on arrows ?
        – Fatma Erol Kaynarca
        Sep 26 at 17:24










      • @FatmaErolKaynarca could you explain more? Doesn't my code work with you?
        – Diaa
        Sep 26 at 18:58










      • Your typed code works very well, but I wanted to do something else, I couldn't fit what I wanted to do with your code.
        – Fatma Erol Kaynarca
        Sep 26 at 19:02










      • @FatmaErolKaynarca does my answer update get what you want?
        – Diaa
        Sep 26 at 19:16






      • 1




        Thank you very much
        – Fatma Erol Kaynarca
        Sep 26 at 19:29












      up vote
      8
      down vote










      up vote
      8
      down vote









      For the sake of completeness, here it is a plain TikZ approach



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      draw[->] (1) -- node [midway,above] a (2);
      draw[->] (1) to [bend right] node [midway,below]c (3);
      draw[->] (2) -- node [midway,above] b (3);
      endtikzpicture%
      enddocument


      enter image description here



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      node (dots) [right=of 3] $cdots$;
      node (n1) [right=of dots] $n-1$;
      node (n) [right=of n1] $n$;
      %
      draw[->] (1) -- node [midway,above] $a_1$ (2);
      draw[->] (1) to [bend right=15cm] node [midway,below]b (n);
      draw[->] (2) -- node [midway,above] $a_2$ (3);
      draw[->] (3) -- node [midway,above] $a_3$ (dots);
      draw[->] (dots) -- node [midway,above] $a_n-2$ (n1);
      draw[->] (n1) -- node [midway,above] $a_n-1$ (n);
      endtikzpicture%
      enddocument


      enter image description here






      share|improve this answer














      For the sake of completeness, here it is a plain TikZ approach



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      draw[->] (1) -- node [midway,above] a (2);
      draw[->] (1) to [bend right] node [midway,below]c (3);
      draw[->] (2) -- node [midway,above] b (3);
      endtikzpicture%
      enddocument


      enter image description here



      documentclassarticle
      usepackagetikz
      usetikzlibrarypositioning
      begindocument
      begintikzpicture[node distance = 2cm, thick]%
      node (1) 1;
      node (2) [right=of 1] 2;
      node (3) [right=of 2] 3;
      node (dots) [right=of 3] $cdots$;
      node (n1) [right=of dots] $n-1$;
      node (n) [right=of n1] $n$;
      %
      draw[->] (1) -- node [midway,above] $a_1$ (2);
      draw[->] (1) to [bend right=15cm] node [midway,below]b (n);
      draw[->] (2) -- node [midway,above] $a_2$ (3);
      draw[->] (3) -- node [midway,above] $a_3$ (dots);
      draw[->] (dots) -- node [midway,above] $a_n-2$ (n1);
      draw[->] (n1) -- node [midway,above] $a_n-1$ (n);
      endtikzpicture%
      enddocument


      enter image description here







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Sep 26 at 19:15

























      answered Sep 25 at 11:47









      Diaa

      2,34511643




      2,34511643











      • I can't print letters indexed on arrows ?
        – Fatma Erol Kaynarca
        Sep 26 at 17:24










      • @FatmaErolKaynarca could you explain more? Doesn't my code work with you?
        – Diaa
        Sep 26 at 18:58










      • Your typed code works very well, but I wanted to do something else, I couldn't fit what I wanted to do with your code.
        – Fatma Erol Kaynarca
        Sep 26 at 19:02










      • @FatmaErolKaynarca does my answer update get what you want?
        – Diaa
        Sep 26 at 19:16






      • 1




        Thank you very much
        – Fatma Erol Kaynarca
        Sep 26 at 19:29
















      • I can't print letters indexed on arrows ?
        – Fatma Erol Kaynarca
        Sep 26 at 17:24










      • @FatmaErolKaynarca could you explain more? Doesn't my code work with you?
        – Diaa
        Sep 26 at 18:58










      • Your typed code works very well, but I wanted to do something else, I couldn't fit what I wanted to do with your code.
        – Fatma Erol Kaynarca
        Sep 26 at 19:02










      • @FatmaErolKaynarca does my answer update get what you want?
        – Diaa
        Sep 26 at 19:16






      • 1




        Thank you very much
        – Fatma Erol Kaynarca
        Sep 26 at 19:29















      I can't print letters indexed on arrows ?
      – Fatma Erol Kaynarca
      Sep 26 at 17:24




      I can't print letters indexed on arrows ?
      – Fatma Erol Kaynarca
      Sep 26 at 17:24












      @FatmaErolKaynarca could you explain more? Doesn't my code work with you?
      – Diaa
      Sep 26 at 18:58




      @FatmaErolKaynarca could you explain more? Doesn't my code work with you?
      – Diaa
      Sep 26 at 18:58












      Your typed code works very well, but I wanted to do something else, I couldn't fit what I wanted to do with your code.
      – Fatma Erol Kaynarca
      Sep 26 at 19:02




      Your typed code works very well, but I wanted to do something else, I couldn't fit what I wanted to do with your code.
      – Fatma Erol Kaynarca
      Sep 26 at 19:02












      @FatmaErolKaynarca does my answer update get what you want?
      – Diaa
      Sep 26 at 19:16




      @FatmaErolKaynarca does my answer update get what you want?
      – Diaa
      Sep 26 at 19:16




      1




      1




      Thank you very much
      – Fatma Erol Kaynarca
      Sep 26 at 19:29




      Thank you very much
      – Fatma Erol Kaynarca
      Sep 26 at 19:29










      up vote
      4
      down vote













      A pstrickssolution: the three numbers are defined as nodes, and we link them by node connections.



      documentclass[12pt]article
      usepackagepst-node, auto-pst-pdf

      begindocument

      [
      Rnode11 hspace3em Rnode22 hspace3em Rnode33
      pssetlinewidth=0.6pt, arrows=->, arrowinset=0.12, nodesep=0.6ex, labelsep=2pt, shortput=nab
      everypsboxscriptstyle
      ncline12^ancline23^b
      ncarc[arcangle=-30]13_c
      ]

      enddocument


      enter image description here






      share|improve this answer


























        up vote
        4
        down vote













        A pstrickssolution: the three numbers are defined as nodes, and we link them by node connections.



        documentclass[12pt]article
        usepackagepst-node, auto-pst-pdf

        begindocument

        [
        Rnode11 hspace3em Rnode22 hspace3em Rnode33
        pssetlinewidth=0.6pt, arrows=->, arrowinset=0.12, nodesep=0.6ex, labelsep=2pt, shortput=nab
        everypsboxscriptstyle
        ncline12^ancline23^b
        ncarc[arcangle=-30]13_c
        ]

        enddocument


        enter image description here






        share|improve this answer
























          up vote
          4
          down vote










          up vote
          4
          down vote









          A pstrickssolution: the three numbers are defined as nodes, and we link them by node connections.



          documentclass[12pt]article
          usepackagepst-node, auto-pst-pdf

          begindocument

          [
          Rnode11 hspace3em Rnode22 hspace3em Rnode33
          pssetlinewidth=0.6pt, arrows=->, arrowinset=0.12, nodesep=0.6ex, labelsep=2pt, shortput=nab
          everypsboxscriptstyle
          ncline12^ancline23^b
          ncarc[arcangle=-30]13_c
          ]

          enddocument


          enter image description here






          share|improve this answer














          A pstrickssolution: the three numbers are defined as nodes, and we link them by node connections.



          documentclass[12pt]article
          usepackagepst-node, auto-pst-pdf

          begindocument

          [
          Rnode11 hspace3em Rnode22 hspace3em Rnode33
          pssetlinewidth=0.6pt, arrows=->, arrowinset=0.12, nodesep=0.6ex, labelsep=2pt, shortput=nab
          everypsboxscriptstyle
          ncline12^ancline23^b
          ncarc[arcangle=-30]13_c
          ]

          enddocument


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 25 at 12:17









          Phelype Oleinik

          17.5k43771




          17.5k43771










          answered Sep 25 at 12:07









          Bernard

          157k764190




          157k764190




















              up vote
              0
              down vote













              With tikz, it is possible to use the chain concept of the graphs library.



              chains are a series of nodes whose syntax is abbreviated compared to their normal syntax. A chain ends with a semicolon. The nodes and their text are identical by default as in the first figure. Nodes and text are the number 1, 2 and 3.



              This first figure is composed of 2 chains: the first 1->2->3 and the second which goes directly from 1 to 3.



              To add text to the arrow (that is called edge by tikz), simply place the option edge label or edge label' depending on whether the text is above or below the arrow. In reality, this places the text to the left or right when walking in the direction of the chain.



              In the second example, to avoid having to draw an arrow, we write -!- instead of -> (see p 265 of the manual).
              To make the node text different from its name, simply separate the name from the text with a slash. For example : 5/$n-1$ means that node 5 displays the n-1 text.



              chaine-tikz



              documentclass[a4paper,12pt]article
              usepackagetikz
              usetikzlibrarygraphs
              begindocument

              tikz graph[grow right=30mm]
              1 ->[edge label=a] 2 ->[edge label=b] 3;
              1 -> [bend right,edge label'=c] 3;
              ;


              tikz graph[grow right=20mm]
              1 ->[edge label=$a_1$] 2 ->[edge label=$a_2$] 3->[edge label=$a_3$] 4/$cdots$ -!- 5/$n-1$->[edge label=$a_n-1$] n ;
              1 -> [bend right,edge label'=b] n;
              ;

              enddocument


              Edit:



              Using the quotes library, the syntax for writing labels is even shorter:
              "a" instead of edge label=a
              "c"' instead of edge label' =c
              You can customize the colors as below:



              chaine



              documentclass[a4paper,12pt]article
              usepackagetikz
              usetikzlibrarygraphs,quotes
              begindocument

              tikz[thick,gray] graph[grow right=30mm]
              1 ->["a"] 2 ->["b"] 3;
              1 -> [bend right,"c"'] 3;
              ;

              General case:
              smallskip

              tikz[thick,every edge/.style=red,draw,every node/.style=blue] graph[grow right=20mm,edge quotes=black,auto]
              1 ->["$a_1$"] 2 ->["$a_2$"] 3->["$a_3$"] 4/$cdots$ -!- 5/$n-1$->["$a_n-1$"] n ;
              1 -> [bend right,"b"'] n;
              ;

              enddocument


              Translated with www.DeepL.com/Translator






              share|improve this answer


























                up vote
                0
                down vote













                With tikz, it is possible to use the chain concept of the graphs library.



                chains are a series of nodes whose syntax is abbreviated compared to their normal syntax. A chain ends with a semicolon. The nodes and their text are identical by default as in the first figure. Nodes and text are the number 1, 2 and 3.



                This first figure is composed of 2 chains: the first 1->2->3 and the second which goes directly from 1 to 3.



                To add text to the arrow (that is called edge by tikz), simply place the option edge label or edge label' depending on whether the text is above or below the arrow. In reality, this places the text to the left or right when walking in the direction of the chain.



                In the second example, to avoid having to draw an arrow, we write -!- instead of -> (see p 265 of the manual).
                To make the node text different from its name, simply separate the name from the text with a slash. For example : 5/$n-1$ means that node 5 displays the n-1 text.



                chaine-tikz



                documentclass[a4paper,12pt]article
                usepackagetikz
                usetikzlibrarygraphs
                begindocument

                tikz graph[grow right=30mm]
                1 ->[edge label=a] 2 ->[edge label=b] 3;
                1 -> [bend right,edge label'=c] 3;
                ;


                tikz graph[grow right=20mm]
                1 ->[edge label=$a_1$] 2 ->[edge label=$a_2$] 3->[edge label=$a_3$] 4/$cdots$ -!- 5/$n-1$->[edge label=$a_n-1$] n ;
                1 -> [bend right,edge label'=b] n;
                ;

                enddocument


                Edit:



                Using the quotes library, the syntax for writing labels is even shorter:
                "a" instead of edge label=a
                "c"' instead of edge label' =c
                You can customize the colors as below:



                chaine



                documentclass[a4paper,12pt]article
                usepackagetikz
                usetikzlibrarygraphs,quotes
                begindocument

                tikz[thick,gray] graph[grow right=30mm]
                1 ->["a"] 2 ->["b"] 3;
                1 -> [bend right,"c"'] 3;
                ;

                General case:
                smallskip

                tikz[thick,every edge/.style=red,draw,every node/.style=blue] graph[grow right=20mm,edge quotes=black,auto]
                1 ->["$a_1$"] 2 ->["$a_2$"] 3->["$a_3$"] 4/$cdots$ -!- 5/$n-1$->["$a_n-1$"] n ;
                1 -> [bend right,"b"'] n;
                ;

                enddocument


                Translated with www.DeepL.com/Translator






                share|improve this answer
























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  With tikz, it is possible to use the chain concept of the graphs library.



                  chains are a series of nodes whose syntax is abbreviated compared to their normal syntax. A chain ends with a semicolon. The nodes and their text are identical by default as in the first figure. Nodes and text are the number 1, 2 and 3.



                  This first figure is composed of 2 chains: the first 1->2->3 and the second which goes directly from 1 to 3.



                  To add text to the arrow (that is called edge by tikz), simply place the option edge label or edge label' depending on whether the text is above or below the arrow. In reality, this places the text to the left or right when walking in the direction of the chain.



                  In the second example, to avoid having to draw an arrow, we write -!- instead of -> (see p 265 of the manual).
                  To make the node text different from its name, simply separate the name from the text with a slash. For example : 5/$n-1$ means that node 5 displays the n-1 text.



                  chaine-tikz



                  documentclass[a4paper,12pt]article
                  usepackagetikz
                  usetikzlibrarygraphs
                  begindocument

                  tikz graph[grow right=30mm]
                  1 ->[edge label=a] 2 ->[edge label=b] 3;
                  1 -> [bend right,edge label'=c] 3;
                  ;


                  tikz graph[grow right=20mm]
                  1 ->[edge label=$a_1$] 2 ->[edge label=$a_2$] 3->[edge label=$a_3$] 4/$cdots$ -!- 5/$n-1$->[edge label=$a_n-1$] n ;
                  1 -> [bend right,edge label'=b] n;
                  ;

                  enddocument


                  Edit:



                  Using the quotes library, the syntax for writing labels is even shorter:
                  "a" instead of edge label=a
                  "c"' instead of edge label' =c
                  You can customize the colors as below:



                  chaine



                  documentclass[a4paper,12pt]article
                  usepackagetikz
                  usetikzlibrarygraphs,quotes
                  begindocument

                  tikz[thick,gray] graph[grow right=30mm]
                  1 ->["a"] 2 ->["b"] 3;
                  1 -> [bend right,"c"'] 3;
                  ;

                  General case:
                  smallskip

                  tikz[thick,every edge/.style=red,draw,every node/.style=blue] graph[grow right=20mm,edge quotes=black,auto]
                  1 ->["$a_1$"] 2 ->["$a_2$"] 3->["$a_3$"] 4/$cdots$ -!- 5/$n-1$->["$a_n-1$"] n ;
                  1 -> [bend right,"b"'] n;
                  ;

                  enddocument


                  Translated with www.DeepL.com/Translator






                  share|improve this answer














                  With tikz, it is possible to use the chain concept of the graphs library.



                  chains are a series of nodes whose syntax is abbreviated compared to their normal syntax. A chain ends with a semicolon. The nodes and their text are identical by default as in the first figure. Nodes and text are the number 1, 2 and 3.



                  This first figure is composed of 2 chains: the first 1->2->3 and the second which goes directly from 1 to 3.



                  To add text to the arrow (that is called edge by tikz), simply place the option edge label or edge label' depending on whether the text is above or below the arrow. In reality, this places the text to the left or right when walking in the direction of the chain.



                  In the second example, to avoid having to draw an arrow, we write -!- instead of -> (see p 265 of the manual).
                  To make the node text different from its name, simply separate the name from the text with a slash. For example : 5/$n-1$ means that node 5 displays the n-1 text.



                  chaine-tikz



                  documentclass[a4paper,12pt]article
                  usepackagetikz
                  usetikzlibrarygraphs
                  begindocument

                  tikz graph[grow right=30mm]
                  1 ->[edge label=a] 2 ->[edge label=b] 3;
                  1 -> [bend right,edge label'=c] 3;
                  ;


                  tikz graph[grow right=20mm]
                  1 ->[edge label=$a_1$] 2 ->[edge label=$a_2$] 3->[edge label=$a_3$] 4/$cdots$ -!- 5/$n-1$->[edge label=$a_n-1$] n ;
                  1 -> [bend right,edge label'=b] n;
                  ;

                  enddocument


                  Edit:



                  Using the quotes library, the syntax for writing labels is even shorter:
                  "a" instead of edge label=a
                  "c"' instead of edge label' =c
                  You can customize the colors as below:



                  chaine



                  documentclass[a4paper,12pt]article
                  usepackagetikz
                  usetikzlibrarygraphs,quotes
                  begindocument

                  tikz[thick,gray] graph[grow right=30mm]
                  1 ->["a"] 2 ->["b"] 3;
                  1 -> [bend right,"c"'] 3;
                  ;

                  General case:
                  smallskip

                  tikz[thick,every edge/.style=red,draw,every node/.style=blue] graph[grow right=20mm,edge quotes=black,auto]
                  1 ->["$a_1$"] 2 ->["$a_2$"] 3->["$a_3$"] 4/$cdots$ -!- 5/$n-1$->["$a_n-1$"] n ;
                  1 -> [bend right,"b"'] n;
                  ;

                  enddocument


                  Translated with www.DeepL.com/Translator







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 27 at 19:39

























                  answered Sep 26 at 20:34









                  AndréC

                  3,376729




                  3,376729



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452415%2fhow-to-draw-an-diagram-with-arrows%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay