Topology diagrams (labelled edges)

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












10















What is the best way to create diagrams like these in LaTeX? Is Tikz the way to go?





(Code for these specific instances would be useful but is not absolutely required, since I'll be needing to make diagrams similar in spirit but not identical. Also, this has almost certainly been asked before, so I would equally appreciate a link to a previous asking -- I'm just unsure what terms to search to find such a post.)



edit: looked at some old code and came up with



begintikzpicture

draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,1) -- (0,0);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,1) -- (0,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,0) -- (1,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,0) -- (1,0);

node at (.5,-.2) $a$;

endtikzpicture


although this seems rather clunky.










share|improve this question
























  • What have you tried?

    – Henri Menke
    Jan 7 at 21:57











  • I thought about doing something with tikzpicture and explicitly stating the parametrization of each length but it seems that there ought to be a more elegant way to do it.

    – zjs
    Jan 7 at 21:59






  • 1





    @zjs Just post what you have got. It will be much easier to see what you want if you post a code example.

    – Henri Menke
    Jan 7 at 22:04















10















What is the best way to create diagrams like these in LaTeX? Is Tikz the way to go?





(Code for these specific instances would be useful but is not absolutely required, since I'll be needing to make diagrams similar in spirit but not identical. Also, this has almost certainly been asked before, so I would equally appreciate a link to a previous asking -- I'm just unsure what terms to search to find such a post.)



edit: looked at some old code and came up with



begintikzpicture

draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,1) -- (0,0);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,1) -- (0,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,0) -- (1,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,0) -- (1,0);

node at (.5,-.2) $a$;

endtikzpicture


although this seems rather clunky.










share|improve this question
























  • What have you tried?

    – Henri Menke
    Jan 7 at 21:57











  • I thought about doing something with tikzpicture and explicitly stating the parametrization of each length but it seems that there ought to be a more elegant way to do it.

    – zjs
    Jan 7 at 21:59






  • 1





    @zjs Just post what you have got. It will be much easier to see what you want if you post a code example.

    – Henri Menke
    Jan 7 at 22:04













10












10








10


3






What is the best way to create diagrams like these in LaTeX? Is Tikz the way to go?





(Code for these specific instances would be useful but is not absolutely required, since I'll be needing to make diagrams similar in spirit but not identical. Also, this has almost certainly been asked before, so I would equally appreciate a link to a previous asking -- I'm just unsure what terms to search to find such a post.)



edit: looked at some old code and came up with



begintikzpicture

draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,1) -- (0,0);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,1) -- (0,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,0) -- (1,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,0) -- (1,0);

node at (.5,-.2) $a$;

endtikzpicture


although this seems rather clunky.










share|improve this question
















What is the best way to create diagrams like these in LaTeX? Is Tikz the way to go?





(Code for these specific instances would be useful but is not absolutely required, since I'll be needing to make diagrams similar in spirit but not identical. Also, this has almost certainly been asked before, so I would equally appreciate a link to a previous asking -- I'm just unsure what terms to search to find such a post.)



edit: looked at some old code and came up with



begintikzpicture

draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,1) -- (0,0);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,1) -- (0,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (1,0) -- (1,1);
draw[ultra thick,domain=0:1,samples=100, postaction=decorate, decoration=markings, mark=at position 0.5 with arrowstealth] (0,0) -- (1,0);

node at (.5,-.2) $a$;

endtikzpicture


although this seems rather clunky.







tikz-pgf diagrams






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 7 at 22:42









Henri Menke

71.5k8158266




71.5k8158266










asked Jan 7 at 21:54









zjszjs

606




606












  • What have you tried?

    – Henri Menke
    Jan 7 at 21:57











  • I thought about doing something with tikzpicture and explicitly stating the parametrization of each length but it seems that there ought to be a more elegant way to do it.

    – zjs
    Jan 7 at 21:59






  • 1





    @zjs Just post what you have got. It will be much easier to see what you want if you post a code example.

    – Henri Menke
    Jan 7 at 22:04

















  • What have you tried?

    – Henri Menke
    Jan 7 at 21:57











  • I thought about doing something with tikzpicture and explicitly stating the parametrization of each length but it seems that there ought to be a more elegant way to do it.

    – zjs
    Jan 7 at 21:59






  • 1





    @zjs Just post what you have got. It will be much easier to see what you want if you post a code example.

    – Henri Menke
    Jan 7 at 22:04
















What have you tried?

– Henri Menke
Jan 7 at 21:57





What have you tried?

– Henri Menke
Jan 7 at 21:57













I thought about doing something with tikzpicture and explicitly stating the parametrization of each length but it seems that there ought to be a more elegant way to do it.

– zjs
Jan 7 at 21:59





I thought about doing something with tikzpicture and explicitly stating the parametrization of each length but it seems that there ought to be a more elegant way to do it.

– zjs
Jan 7 at 21:59




1




1





@zjs Just post what you have got. It will be much easier to see what you want if you post a code example.

– Henri Menke
Jan 7 at 22:04





@zjs Just post what you have got. It will be much easier to see what you want if you post a code example.

– Henri Menke
Jan 7 at 22:04










6 Answers
6






active

oldest

votes


















11














Welcome to TeX.SE! This answer makes use of this answer.



documentclass[tikz,border=3.14mm]standalone
usetikzlibrarydecorations.markings

begindocument
tikzsetlab dis/.store in=LabDis,
lab dis=0.3,
->-/.style args=at #1 with label #2decoration=
markings,
mark=at position #1 with arrow>; node at (0,LabDis) #2;,postaction=decorate,
-<-/.style args=at #1 with label #2decoration=
markings,
mark=at position #1 with arrow<; node at (0,LabDis)
#2;,postaction=decorate,
-*-/.style=decoration=
markings,
mark=at position #1 with fill (0,0) circle (1.5pt);,postaction=decorate,


begintikzpicture[>=latex]
draw[->-=at 0.125 with label $b$,
->-=at 0.375 with label $a$,
-<-=at 0.625 with label $b$,
-<-=at 0.875 with label $a$] (0,0) rectangle (4,4);

draw[lab dis=-0.3,
-*-=0,->-=at 0.125 with label $b$,
-*-=0.25,->-=at 0.375 with label $a$,
-*-=0.5,-<-=at 0.625 with label $b$,
-*-=0.75,-<-=at 0.875 with label $a$] (2,-4) circle (2.5);
endtikzpicture
enddocument


enter image description here






share|improve this answer























  • I'm not convinced by the ->- and -*- notation. It's pretty hard to read. Now there are dashes everywhere.

    – Henri Menke
    Jan 7 at 22:33






  • 7





    @HenriMenke Well, everyone can rename these things as they wish. I do not think this is a fair criticism. And if you really feel you need to make this comment, make it here, where this notation has been proposed. This answer got 69 upvotes without anyone complaining about the notation.

    – marmot
    Jan 7 at 23:05


















5














You can place nodes on a path which should simplify the node positioning a lot. You might also want to factor out the arrow business into a style.



documentclassarticle
usepackagetikz
usetikzlibrarydecorations.markings
begindocument

begintikzpicture[
arrow inside/.style =
postaction=decorate,
decoration=markings, mark=at position 0.5 with arrowstealth

]

draw[arrow inside] (0,0) -- node [below] $a$ (1,0);
draw[arrow inside] (0,1) -- node [above] $a$ (1,1);
draw[arrow inside] (0,0) -- node [left] $b$ (0,1);
draw[arrow inside] (1,0) -- node [left] $b$ (1,1);

endtikzpicture

enddocument


enter image description here






share|improve this answer


















  • 2





    Maybe move right b outside?! :-)

    – Sigur
    Jan 7 at 23:05


















5














This can be an option



documentclass[tikz, border = 10pt]standalone

usepackagepgfplots
pgfplotssetcompat=newest
usetikzlibrarydecorations.markings

defnframes30
defframe0

begindocument

foreach frame in 0,0,0,0,1,...,nframes


pgfmathsetmacrotimeframe / nframes
pgfmathsetmacroc20 + (3 - 20) / (1 + exp(-10 * (time - 0.6)))
pgfmathsetmacroa20 + (1 - 20) / (1 + exp(-8 * (time - 0.3)))
pgfmathsetmacroxrange3 + (180 - 3) / (1 + exp(-14 * (time - 0.6)))
pgfmathsetmacroyrange3 + (180 - 3) / (1 + exp(-10 * (time - 0.3)))
pgfmathsetmacrotheta90 + (45 - 90) * time
pgfmathsetmacrophi0 + (25 - 0) * time

pgfplotsset
border one/.style=
thick,
red,
samples y = 0,
variable = t,
domain = -xrange:xrange,
postaction = decorate,
decoration = markings,
mark = at position 0.48 with arrowstealth,
mark = at position 0.52 with arrowstealth
,
border two/.style=
thick,
green,
samples y = 0,
variable = t,
domain = -yrange:yrange,
postaction = decorate,
decoration = markings, mark = at position 0.5 with arrowstealth





begintikzpicture
useasboundingbox (0, 0) rectangle (6, 6);
beginaxis [
hide axis,
view = thetaphi,
domain = -xrange:xrange,
y domain = -yrange:yrange,
samples = 20,
samples y = 20,
unit vector ratio = 1 1 1,
declare function =
u(x,y) = (c + a * cos(y)) * cos(x);
v(x,y) = (c + a * cos(y)) * sin(x);
w(x,y) = a * sin(y);

]

addplot3 [
surf,
color = blue,
opacity = 0.01,
faceted color = white,
z buffer = sort,
fill opacity = 0.5] (u(x, y), v(x, y), w(x, y));

addplot3 [border one] (u(t, yrange), v(t, yrange), w(t, yrange));
addplot3 [border one] (u(t, -yrange), v(t, -yrange), w(t, -yrange));
addplot3 [border two] (u(xrange, t), v(xrange, t), w(xrange, t));
addplot3 [border two] (u(-xrange, t), v(-xrange, t), w(-xrange, t));


endaxis
endtikzpicture

enddocument


enter image description here



DISCLAIMER Just a fun animation, I'm aware it is not exactly what the OP asked for






share|improve this answer

























  • Are you sure you answered the right question?

    – mickep
    Jan 8 at 12:06






  • 3





    @mickep Just a fun animation

    – caverac
    Jan 8 at 12:08











  • now is your turn, just only for show off. :-)

    – God Must Be Crazy
    Jan 8 at 12:31












  • just for a reference. of course +1

    – God Must Be Crazy
    Jan 8 at 12:41







  • 1





    @GodMustBeCrazy Well, thank you :) Yours pstricks implementations never cease to amaze me

    – caverac
    Jan 9 at 13:56


















3














A PSTricks solution just for fun purposes.



documentclass[pstricks,12pt]standalone
usepackagepstricks-add

begindocument
pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
curvepnodes[plotpoints=5]03603.5 t 45 add PtoCI
foreach i/l/a in 0/a/<,1/b/<,2/a/>,3/b/>%
pcline[ArrowInside=-a](Ii)(Ithenumexpri+1)nbput$l$
endpspicture
pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
pnode(0,0)O
curvepnodes[plotpoints=5]03603.5 t 135 add PtoCI
foreach i/l in 0/a,1/b,2/a,3/b%
qdisk([nodesep=3.5,angle=-45]IiO)2pt
psarc->(0,0)3.5(Ii)(Ithenumexpri+1)
uput8pt[(Ii)](>Ii)$l$
endpspicture
enddocument


enter image description here



enter image description here



Note: ArrowInside is not available for psarc. I don't know why.






share|improve this answer
































    3














    Another alternative approach using Metapost. Compile this one with lualatex.



    enter image description here



    documentclass[border=5mm]standalone
    usepackageluatex85
    usepackageluamplib
    begindocument
    mplibtextextlabelenable
    beginmplibcode
    beginfig(1);
    path S, C;

    S = unitsquare shifted -(1/2, 1/2) scaled 100;
    C = fullcircle scaled 84 rotated 16 shifted 140 right;

    interim ahangle := 30; % slimmer arrows...

    drawarrow subpath(0, 5/8) of S;
    drawarrow subpath(5/8, 13/8) of S;
    drawarrow subpath(4, 4-5/8) of S;
    drawarrow subpath(4-5/8, 4-13/8) of S;
    draw subpath(13/8, 4-13/8) of S;

    label.top("$a$", point 1/2 of S);
    label.top("$a$", point 5/2 of S);
    label.lft("$b$", point 3/2 of S);
    label.lft("$b$", point 7/2 of S);

    for t=0 upto 3:
    drawarrow subpath 2(t, t+1) of C;
    drawdot point 2t+3/4 of C withpen pencircle scaled 3;
    label(if odd t: "$b$" else: "$a$" fi, 9/8[center C, point 2t+7/4 of C]);
    endfor

    endfig;
    endmplibcode
    enddocument





    share|improve this answer






























      3














      a variation of nice Henry Menke answer with use of quotes library:



      documentclassarticle
      usepackagetikz
      usetikzlibrarydecorations.markings, quotes

      begindocument

      begintikzpicture[auto=right,
      arrow inside/.style =
      decoration=markings, mark=at position 0.5 with arrowstealth,
      postaction=decorate,

      ]
      draw[arrow inside] (0,0) to ["$a$"] (1,0);
      draw[arrow inside] (0,1) to ["$a$" '] (1,1);
      draw[arrow inside] (0,0) to ["$b$" '] (0,1);
      draw[arrow inside] (1,0) to ["$b$"] (1,1);
      endtikzpicture


      enter image description here






      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',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        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%2f469051%2ftopology-diagrams-labelled-edges%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        6 Answers
        6






        active

        oldest

        votes








        6 Answers
        6






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        11














        Welcome to TeX.SE! This answer makes use of this answer.



        documentclass[tikz,border=3.14mm]standalone
        usetikzlibrarydecorations.markings

        begindocument
        tikzsetlab dis/.store in=LabDis,
        lab dis=0.3,
        ->-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow>; node at (0,LabDis) #2;,postaction=decorate,
        -<-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow<; node at (0,LabDis)
        #2;,postaction=decorate,
        -*-/.style=decoration=
        markings,
        mark=at position #1 with fill (0,0) circle (1.5pt);,postaction=decorate,


        begintikzpicture[>=latex]
        draw[->-=at 0.125 with label $b$,
        ->-=at 0.375 with label $a$,
        -<-=at 0.625 with label $b$,
        -<-=at 0.875 with label $a$] (0,0) rectangle (4,4);

        draw[lab dis=-0.3,
        -*-=0,->-=at 0.125 with label $b$,
        -*-=0.25,->-=at 0.375 with label $a$,
        -*-=0.5,-<-=at 0.625 with label $b$,
        -*-=0.75,-<-=at 0.875 with label $a$] (2,-4) circle (2.5);
        endtikzpicture
        enddocument


        enter image description here






        share|improve this answer























        • I'm not convinced by the ->- and -*- notation. It's pretty hard to read. Now there are dashes everywhere.

          – Henri Menke
          Jan 7 at 22:33






        • 7





          @HenriMenke Well, everyone can rename these things as they wish. I do not think this is a fair criticism. And if you really feel you need to make this comment, make it here, where this notation has been proposed. This answer got 69 upvotes without anyone complaining about the notation.

          – marmot
          Jan 7 at 23:05















        11














        Welcome to TeX.SE! This answer makes use of this answer.



        documentclass[tikz,border=3.14mm]standalone
        usetikzlibrarydecorations.markings

        begindocument
        tikzsetlab dis/.store in=LabDis,
        lab dis=0.3,
        ->-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow>; node at (0,LabDis) #2;,postaction=decorate,
        -<-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow<; node at (0,LabDis)
        #2;,postaction=decorate,
        -*-/.style=decoration=
        markings,
        mark=at position #1 with fill (0,0) circle (1.5pt);,postaction=decorate,


        begintikzpicture[>=latex]
        draw[->-=at 0.125 with label $b$,
        ->-=at 0.375 with label $a$,
        -<-=at 0.625 with label $b$,
        -<-=at 0.875 with label $a$] (0,0) rectangle (4,4);

        draw[lab dis=-0.3,
        -*-=0,->-=at 0.125 with label $b$,
        -*-=0.25,->-=at 0.375 with label $a$,
        -*-=0.5,-<-=at 0.625 with label $b$,
        -*-=0.75,-<-=at 0.875 with label $a$] (2,-4) circle (2.5);
        endtikzpicture
        enddocument


        enter image description here






        share|improve this answer























        • I'm not convinced by the ->- and -*- notation. It's pretty hard to read. Now there are dashes everywhere.

          – Henri Menke
          Jan 7 at 22:33






        • 7





          @HenriMenke Well, everyone can rename these things as they wish. I do not think this is a fair criticism. And if you really feel you need to make this comment, make it here, where this notation has been proposed. This answer got 69 upvotes without anyone complaining about the notation.

          – marmot
          Jan 7 at 23:05













        11












        11








        11







        Welcome to TeX.SE! This answer makes use of this answer.



        documentclass[tikz,border=3.14mm]standalone
        usetikzlibrarydecorations.markings

        begindocument
        tikzsetlab dis/.store in=LabDis,
        lab dis=0.3,
        ->-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow>; node at (0,LabDis) #2;,postaction=decorate,
        -<-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow<; node at (0,LabDis)
        #2;,postaction=decorate,
        -*-/.style=decoration=
        markings,
        mark=at position #1 with fill (0,0) circle (1.5pt);,postaction=decorate,


        begintikzpicture[>=latex]
        draw[->-=at 0.125 with label $b$,
        ->-=at 0.375 with label $a$,
        -<-=at 0.625 with label $b$,
        -<-=at 0.875 with label $a$] (0,0) rectangle (4,4);

        draw[lab dis=-0.3,
        -*-=0,->-=at 0.125 with label $b$,
        -*-=0.25,->-=at 0.375 with label $a$,
        -*-=0.5,-<-=at 0.625 with label $b$,
        -*-=0.75,-<-=at 0.875 with label $a$] (2,-4) circle (2.5);
        endtikzpicture
        enddocument


        enter image description here






        share|improve this answer













        Welcome to TeX.SE! This answer makes use of this answer.



        documentclass[tikz,border=3.14mm]standalone
        usetikzlibrarydecorations.markings

        begindocument
        tikzsetlab dis/.store in=LabDis,
        lab dis=0.3,
        ->-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow>; node at (0,LabDis) #2;,postaction=decorate,
        -<-/.style args=at #1 with label #2decoration=
        markings,
        mark=at position #1 with arrow<; node at (0,LabDis)
        #2;,postaction=decorate,
        -*-/.style=decoration=
        markings,
        mark=at position #1 with fill (0,0) circle (1.5pt);,postaction=decorate,


        begintikzpicture[>=latex]
        draw[->-=at 0.125 with label $b$,
        ->-=at 0.375 with label $a$,
        -<-=at 0.625 with label $b$,
        -<-=at 0.875 with label $a$] (0,0) rectangle (4,4);

        draw[lab dis=-0.3,
        -*-=0,->-=at 0.125 with label $b$,
        -*-=0.25,->-=at 0.375 with label $a$,
        -*-=0.5,-<-=at 0.625 with label $b$,
        -*-=0.75,-<-=at 0.875 with label $a$] (2,-4) circle (2.5);
        endtikzpicture
        enddocument


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 7 at 22:25









        marmotmarmot

        93.5k4109208




        93.5k4109208












        • I'm not convinced by the ->- and -*- notation. It's pretty hard to read. Now there are dashes everywhere.

          – Henri Menke
          Jan 7 at 22:33






        • 7





          @HenriMenke Well, everyone can rename these things as they wish. I do not think this is a fair criticism. And if you really feel you need to make this comment, make it here, where this notation has been proposed. This answer got 69 upvotes without anyone complaining about the notation.

          – marmot
          Jan 7 at 23:05

















        • I'm not convinced by the ->- and -*- notation. It's pretty hard to read. Now there are dashes everywhere.

          – Henri Menke
          Jan 7 at 22:33






        • 7





          @HenriMenke Well, everyone can rename these things as they wish. I do not think this is a fair criticism. And if you really feel you need to make this comment, make it here, where this notation has been proposed. This answer got 69 upvotes without anyone complaining about the notation.

          – marmot
          Jan 7 at 23:05
















        I'm not convinced by the ->- and -*- notation. It's pretty hard to read. Now there are dashes everywhere.

        – Henri Menke
        Jan 7 at 22:33





        I'm not convinced by the ->- and -*- notation. It's pretty hard to read. Now there are dashes everywhere.

        – Henri Menke
        Jan 7 at 22:33




        7




        7





        @HenriMenke Well, everyone can rename these things as they wish. I do not think this is a fair criticism. And if you really feel you need to make this comment, make it here, where this notation has been proposed. This answer got 69 upvotes without anyone complaining about the notation.

        – marmot
        Jan 7 at 23:05





        @HenriMenke Well, everyone can rename these things as they wish. I do not think this is a fair criticism. And if you really feel you need to make this comment, make it here, where this notation has been proposed. This answer got 69 upvotes without anyone complaining about the notation.

        – marmot
        Jan 7 at 23:05











        5














        You can place nodes on a path which should simplify the node positioning a lot. You might also want to factor out the arrow business into a style.



        documentclassarticle
        usepackagetikz
        usetikzlibrarydecorations.markings
        begindocument

        begintikzpicture[
        arrow inside/.style =
        postaction=decorate,
        decoration=markings, mark=at position 0.5 with arrowstealth

        ]

        draw[arrow inside] (0,0) -- node [below] $a$ (1,0);
        draw[arrow inside] (0,1) -- node [above] $a$ (1,1);
        draw[arrow inside] (0,0) -- node [left] $b$ (0,1);
        draw[arrow inside] (1,0) -- node [left] $b$ (1,1);

        endtikzpicture

        enddocument


        enter image description here






        share|improve this answer


















        • 2





          Maybe move right b outside?! :-)

          – Sigur
          Jan 7 at 23:05















        5














        You can place nodes on a path which should simplify the node positioning a lot. You might also want to factor out the arrow business into a style.



        documentclassarticle
        usepackagetikz
        usetikzlibrarydecorations.markings
        begindocument

        begintikzpicture[
        arrow inside/.style =
        postaction=decorate,
        decoration=markings, mark=at position 0.5 with arrowstealth

        ]

        draw[arrow inside] (0,0) -- node [below] $a$ (1,0);
        draw[arrow inside] (0,1) -- node [above] $a$ (1,1);
        draw[arrow inside] (0,0) -- node [left] $b$ (0,1);
        draw[arrow inside] (1,0) -- node [left] $b$ (1,1);

        endtikzpicture

        enddocument


        enter image description here






        share|improve this answer


















        • 2





          Maybe move right b outside?! :-)

          – Sigur
          Jan 7 at 23:05













        5












        5








        5







        You can place nodes on a path which should simplify the node positioning a lot. You might also want to factor out the arrow business into a style.



        documentclassarticle
        usepackagetikz
        usetikzlibrarydecorations.markings
        begindocument

        begintikzpicture[
        arrow inside/.style =
        postaction=decorate,
        decoration=markings, mark=at position 0.5 with arrowstealth

        ]

        draw[arrow inside] (0,0) -- node [below] $a$ (1,0);
        draw[arrow inside] (0,1) -- node [above] $a$ (1,1);
        draw[arrow inside] (0,0) -- node [left] $b$ (0,1);
        draw[arrow inside] (1,0) -- node [left] $b$ (1,1);

        endtikzpicture

        enddocument


        enter image description here






        share|improve this answer













        You can place nodes on a path which should simplify the node positioning a lot. You might also want to factor out the arrow business into a style.



        documentclassarticle
        usepackagetikz
        usetikzlibrarydecorations.markings
        begindocument

        begintikzpicture[
        arrow inside/.style =
        postaction=decorate,
        decoration=markings, mark=at position 0.5 with arrowstealth

        ]

        draw[arrow inside] (0,0) -- node [below] $a$ (1,0);
        draw[arrow inside] (0,1) -- node [above] $a$ (1,1);
        draw[arrow inside] (0,0) -- node [left] $b$ (0,1);
        draw[arrow inside] (1,0) -- node [left] $b$ (1,1);

        endtikzpicture

        enddocument


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 7 at 22:32









        Henri MenkeHenri Menke

        71.5k8158266




        71.5k8158266







        • 2





          Maybe move right b outside?! :-)

          – Sigur
          Jan 7 at 23:05












        • 2





          Maybe move right b outside?! :-)

          – Sigur
          Jan 7 at 23:05







        2




        2





        Maybe move right b outside?! :-)

        – Sigur
        Jan 7 at 23:05





        Maybe move right b outside?! :-)

        – Sigur
        Jan 7 at 23:05











        5














        This can be an option



        documentclass[tikz, border = 10pt]standalone

        usepackagepgfplots
        pgfplotssetcompat=newest
        usetikzlibrarydecorations.markings

        defnframes30
        defframe0

        begindocument

        foreach frame in 0,0,0,0,1,...,nframes


        pgfmathsetmacrotimeframe / nframes
        pgfmathsetmacroc20 + (3 - 20) / (1 + exp(-10 * (time - 0.6)))
        pgfmathsetmacroa20 + (1 - 20) / (1 + exp(-8 * (time - 0.3)))
        pgfmathsetmacroxrange3 + (180 - 3) / (1 + exp(-14 * (time - 0.6)))
        pgfmathsetmacroyrange3 + (180 - 3) / (1 + exp(-10 * (time - 0.3)))
        pgfmathsetmacrotheta90 + (45 - 90) * time
        pgfmathsetmacrophi0 + (25 - 0) * time

        pgfplotsset
        border one/.style=
        thick,
        red,
        samples y = 0,
        variable = t,
        domain = -xrange:xrange,
        postaction = decorate,
        decoration = markings,
        mark = at position 0.48 with arrowstealth,
        mark = at position 0.52 with arrowstealth
        ,
        border two/.style=
        thick,
        green,
        samples y = 0,
        variable = t,
        domain = -yrange:yrange,
        postaction = decorate,
        decoration = markings, mark = at position 0.5 with arrowstealth





        begintikzpicture
        useasboundingbox (0, 0) rectangle (6, 6);
        beginaxis [
        hide axis,
        view = thetaphi,
        domain = -xrange:xrange,
        y domain = -yrange:yrange,
        samples = 20,
        samples y = 20,
        unit vector ratio = 1 1 1,
        declare function =
        u(x,y) = (c + a * cos(y)) * cos(x);
        v(x,y) = (c + a * cos(y)) * sin(x);
        w(x,y) = a * sin(y);

        ]

        addplot3 [
        surf,
        color = blue,
        opacity = 0.01,
        faceted color = white,
        z buffer = sort,
        fill opacity = 0.5] (u(x, y), v(x, y), w(x, y));

        addplot3 [border one] (u(t, yrange), v(t, yrange), w(t, yrange));
        addplot3 [border one] (u(t, -yrange), v(t, -yrange), w(t, -yrange));
        addplot3 [border two] (u(xrange, t), v(xrange, t), w(xrange, t));
        addplot3 [border two] (u(-xrange, t), v(-xrange, t), w(-xrange, t));


        endaxis
        endtikzpicture

        enddocument


        enter image description here



        DISCLAIMER Just a fun animation, I'm aware it is not exactly what the OP asked for






        share|improve this answer

























        • Are you sure you answered the right question?

          – mickep
          Jan 8 at 12:06






        • 3





          @mickep Just a fun animation

          – caverac
          Jan 8 at 12:08











        • now is your turn, just only for show off. :-)

          – God Must Be Crazy
          Jan 8 at 12:31












        • just for a reference. of course +1

          – God Must Be Crazy
          Jan 8 at 12:41







        • 1





          @GodMustBeCrazy Well, thank you :) Yours pstricks implementations never cease to amaze me

          – caverac
          Jan 9 at 13:56















        5














        This can be an option



        documentclass[tikz, border = 10pt]standalone

        usepackagepgfplots
        pgfplotssetcompat=newest
        usetikzlibrarydecorations.markings

        defnframes30
        defframe0

        begindocument

        foreach frame in 0,0,0,0,1,...,nframes


        pgfmathsetmacrotimeframe / nframes
        pgfmathsetmacroc20 + (3 - 20) / (1 + exp(-10 * (time - 0.6)))
        pgfmathsetmacroa20 + (1 - 20) / (1 + exp(-8 * (time - 0.3)))
        pgfmathsetmacroxrange3 + (180 - 3) / (1 + exp(-14 * (time - 0.6)))
        pgfmathsetmacroyrange3 + (180 - 3) / (1 + exp(-10 * (time - 0.3)))
        pgfmathsetmacrotheta90 + (45 - 90) * time
        pgfmathsetmacrophi0 + (25 - 0) * time

        pgfplotsset
        border one/.style=
        thick,
        red,
        samples y = 0,
        variable = t,
        domain = -xrange:xrange,
        postaction = decorate,
        decoration = markings,
        mark = at position 0.48 with arrowstealth,
        mark = at position 0.52 with arrowstealth
        ,
        border two/.style=
        thick,
        green,
        samples y = 0,
        variable = t,
        domain = -yrange:yrange,
        postaction = decorate,
        decoration = markings, mark = at position 0.5 with arrowstealth





        begintikzpicture
        useasboundingbox (0, 0) rectangle (6, 6);
        beginaxis [
        hide axis,
        view = thetaphi,
        domain = -xrange:xrange,
        y domain = -yrange:yrange,
        samples = 20,
        samples y = 20,
        unit vector ratio = 1 1 1,
        declare function =
        u(x,y) = (c + a * cos(y)) * cos(x);
        v(x,y) = (c + a * cos(y)) * sin(x);
        w(x,y) = a * sin(y);

        ]

        addplot3 [
        surf,
        color = blue,
        opacity = 0.01,
        faceted color = white,
        z buffer = sort,
        fill opacity = 0.5] (u(x, y), v(x, y), w(x, y));

        addplot3 [border one] (u(t, yrange), v(t, yrange), w(t, yrange));
        addplot3 [border one] (u(t, -yrange), v(t, -yrange), w(t, -yrange));
        addplot3 [border two] (u(xrange, t), v(xrange, t), w(xrange, t));
        addplot3 [border two] (u(-xrange, t), v(-xrange, t), w(-xrange, t));


        endaxis
        endtikzpicture

        enddocument


        enter image description here



        DISCLAIMER Just a fun animation, I'm aware it is not exactly what the OP asked for






        share|improve this answer

























        • Are you sure you answered the right question?

          – mickep
          Jan 8 at 12:06






        • 3





          @mickep Just a fun animation

          – caverac
          Jan 8 at 12:08











        • now is your turn, just only for show off. :-)

          – God Must Be Crazy
          Jan 8 at 12:31












        • just for a reference. of course +1

          – God Must Be Crazy
          Jan 8 at 12:41







        • 1





          @GodMustBeCrazy Well, thank you :) Yours pstricks implementations never cease to amaze me

          – caverac
          Jan 9 at 13:56













        5












        5








        5







        This can be an option



        documentclass[tikz, border = 10pt]standalone

        usepackagepgfplots
        pgfplotssetcompat=newest
        usetikzlibrarydecorations.markings

        defnframes30
        defframe0

        begindocument

        foreach frame in 0,0,0,0,1,...,nframes


        pgfmathsetmacrotimeframe / nframes
        pgfmathsetmacroc20 + (3 - 20) / (1 + exp(-10 * (time - 0.6)))
        pgfmathsetmacroa20 + (1 - 20) / (1 + exp(-8 * (time - 0.3)))
        pgfmathsetmacroxrange3 + (180 - 3) / (1 + exp(-14 * (time - 0.6)))
        pgfmathsetmacroyrange3 + (180 - 3) / (1 + exp(-10 * (time - 0.3)))
        pgfmathsetmacrotheta90 + (45 - 90) * time
        pgfmathsetmacrophi0 + (25 - 0) * time

        pgfplotsset
        border one/.style=
        thick,
        red,
        samples y = 0,
        variable = t,
        domain = -xrange:xrange,
        postaction = decorate,
        decoration = markings,
        mark = at position 0.48 with arrowstealth,
        mark = at position 0.52 with arrowstealth
        ,
        border two/.style=
        thick,
        green,
        samples y = 0,
        variable = t,
        domain = -yrange:yrange,
        postaction = decorate,
        decoration = markings, mark = at position 0.5 with arrowstealth





        begintikzpicture
        useasboundingbox (0, 0) rectangle (6, 6);
        beginaxis [
        hide axis,
        view = thetaphi,
        domain = -xrange:xrange,
        y domain = -yrange:yrange,
        samples = 20,
        samples y = 20,
        unit vector ratio = 1 1 1,
        declare function =
        u(x,y) = (c + a * cos(y)) * cos(x);
        v(x,y) = (c + a * cos(y)) * sin(x);
        w(x,y) = a * sin(y);

        ]

        addplot3 [
        surf,
        color = blue,
        opacity = 0.01,
        faceted color = white,
        z buffer = sort,
        fill opacity = 0.5] (u(x, y), v(x, y), w(x, y));

        addplot3 [border one] (u(t, yrange), v(t, yrange), w(t, yrange));
        addplot3 [border one] (u(t, -yrange), v(t, -yrange), w(t, -yrange));
        addplot3 [border two] (u(xrange, t), v(xrange, t), w(xrange, t));
        addplot3 [border two] (u(-xrange, t), v(-xrange, t), w(-xrange, t));


        endaxis
        endtikzpicture

        enddocument


        enter image description here



        DISCLAIMER Just a fun animation, I'm aware it is not exactly what the OP asked for






        share|improve this answer















        This can be an option



        documentclass[tikz, border = 10pt]standalone

        usepackagepgfplots
        pgfplotssetcompat=newest
        usetikzlibrarydecorations.markings

        defnframes30
        defframe0

        begindocument

        foreach frame in 0,0,0,0,1,...,nframes


        pgfmathsetmacrotimeframe / nframes
        pgfmathsetmacroc20 + (3 - 20) / (1 + exp(-10 * (time - 0.6)))
        pgfmathsetmacroa20 + (1 - 20) / (1 + exp(-8 * (time - 0.3)))
        pgfmathsetmacroxrange3 + (180 - 3) / (1 + exp(-14 * (time - 0.6)))
        pgfmathsetmacroyrange3 + (180 - 3) / (1 + exp(-10 * (time - 0.3)))
        pgfmathsetmacrotheta90 + (45 - 90) * time
        pgfmathsetmacrophi0 + (25 - 0) * time

        pgfplotsset
        border one/.style=
        thick,
        red,
        samples y = 0,
        variable = t,
        domain = -xrange:xrange,
        postaction = decorate,
        decoration = markings,
        mark = at position 0.48 with arrowstealth,
        mark = at position 0.52 with arrowstealth
        ,
        border two/.style=
        thick,
        green,
        samples y = 0,
        variable = t,
        domain = -yrange:yrange,
        postaction = decorate,
        decoration = markings, mark = at position 0.5 with arrowstealth





        begintikzpicture
        useasboundingbox (0, 0) rectangle (6, 6);
        beginaxis [
        hide axis,
        view = thetaphi,
        domain = -xrange:xrange,
        y domain = -yrange:yrange,
        samples = 20,
        samples y = 20,
        unit vector ratio = 1 1 1,
        declare function =
        u(x,y) = (c + a * cos(y)) * cos(x);
        v(x,y) = (c + a * cos(y)) * sin(x);
        w(x,y) = a * sin(y);

        ]

        addplot3 [
        surf,
        color = blue,
        opacity = 0.01,
        faceted color = white,
        z buffer = sort,
        fill opacity = 0.5] (u(x, y), v(x, y), w(x, y));

        addplot3 [border one] (u(t, yrange), v(t, yrange), w(t, yrange));
        addplot3 [border one] (u(t, -yrange), v(t, -yrange), w(t, -yrange));
        addplot3 [border two] (u(xrange, t), v(xrange, t), w(xrange, t));
        addplot3 [border two] (u(-xrange, t), v(-xrange, t), w(-xrange, t));


        endaxis
        endtikzpicture

        enddocument


        enter image description here



        DISCLAIMER Just a fun animation, I'm aware it is not exactly what the OP asked for







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 8 at 22:18

























        answered Jan 8 at 11:32









        caveraccaverac

        6,4471827




        6,4471827












        • Are you sure you answered the right question?

          – mickep
          Jan 8 at 12:06






        • 3





          @mickep Just a fun animation

          – caverac
          Jan 8 at 12:08











        • now is your turn, just only for show off. :-)

          – God Must Be Crazy
          Jan 8 at 12:31












        • just for a reference. of course +1

          – God Must Be Crazy
          Jan 8 at 12:41







        • 1





          @GodMustBeCrazy Well, thank you :) Yours pstricks implementations never cease to amaze me

          – caverac
          Jan 9 at 13:56

















        • Are you sure you answered the right question?

          – mickep
          Jan 8 at 12:06






        • 3





          @mickep Just a fun animation

          – caverac
          Jan 8 at 12:08











        • now is your turn, just only for show off. :-)

          – God Must Be Crazy
          Jan 8 at 12:31












        • just for a reference. of course +1

          – God Must Be Crazy
          Jan 8 at 12:41







        • 1





          @GodMustBeCrazy Well, thank you :) Yours pstricks implementations never cease to amaze me

          – caverac
          Jan 9 at 13:56
















        Are you sure you answered the right question?

        – mickep
        Jan 8 at 12:06





        Are you sure you answered the right question?

        – mickep
        Jan 8 at 12:06




        3




        3





        @mickep Just a fun animation

        – caverac
        Jan 8 at 12:08





        @mickep Just a fun animation

        – caverac
        Jan 8 at 12:08













        now is your turn, just only for show off. :-)

        – God Must Be Crazy
        Jan 8 at 12:31






        now is your turn, just only for show off. :-)

        – God Must Be Crazy
        Jan 8 at 12:31














        just for a reference. of course +1

        – God Must Be Crazy
        Jan 8 at 12:41






        just for a reference. of course +1

        – God Must Be Crazy
        Jan 8 at 12:41





        1




        1





        @GodMustBeCrazy Well, thank you :) Yours pstricks implementations never cease to amaze me

        – caverac
        Jan 9 at 13:56





        @GodMustBeCrazy Well, thank you :) Yours pstricks implementations never cease to amaze me

        – caverac
        Jan 9 at 13:56











        3














        A PSTricks solution just for fun purposes.



        documentclass[pstricks,12pt]standalone
        usepackagepstricks-add

        begindocument
        pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
        curvepnodes[plotpoints=5]03603.5 t 45 add PtoCI
        foreach i/l/a in 0/a/<,1/b/<,2/a/>,3/b/>%
        pcline[ArrowInside=-a](Ii)(Ithenumexpri+1)nbput$l$
        endpspicture
        pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
        pnode(0,0)O
        curvepnodes[plotpoints=5]03603.5 t 135 add PtoCI
        foreach i/l in 0/a,1/b,2/a,3/b%
        qdisk([nodesep=3.5,angle=-45]IiO)2pt
        psarc->(0,0)3.5(Ii)(Ithenumexpri+1)
        uput8pt[(Ii)](>Ii)$l$
        endpspicture
        enddocument


        enter image description here



        enter image description here



        Note: ArrowInside is not available for psarc. I don't know why.






        share|improve this answer





























          3














          A PSTricks solution just for fun purposes.



          documentclass[pstricks,12pt]standalone
          usepackagepstricks-add

          begindocument
          pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
          curvepnodes[plotpoints=5]03603.5 t 45 add PtoCI
          foreach i/l/a in 0/a/<,1/b/<,2/a/>,3/b/>%
          pcline[ArrowInside=-a](Ii)(Ithenumexpri+1)nbput$l$
          endpspicture
          pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
          pnode(0,0)O
          curvepnodes[plotpoints=5]03603.5 t 135 add PtoCI
          foreach i/l in 0/a,1/b,2/a,3/b%
          qdisk([nodesep=3.5,angle=-45]IiO)2pt
          psarc->(0,0)3.5(Ii)(Ithenumexpri+1)
          uput8pt[(Ii)](>Ii)$l$
          endpspicture
          enddocument


          enter image description here



          enter image description here



          Note: ArrowInside is not available for psarc. I don't know why.






          share|improve this answer



























            3












            3








            3







            A PSTricks solution just for fun purposes.



            documentclass[pstricks,12pt]standalone
            usepackagepstricks-add

            begindocument
            pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
            curvepnodes[plotpoints=5]03603.5 t 45 add PtoCI
            foreach i/l/a in 0/a/<,1/b/<,2/a/>,3/b/>%
            pcline[ArrowInside=-a](Ii)(Ithenumexpri+1)nbput$l$
            endpspicture
            pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
            pnode(0,0)O
            curvepnodes[plotpoints=5]03603.5 t 135 add PtoCI
            foreach i/l in 0/a,1/b,2/a,3/b%
            qdisk([nodesep=3.5,angle=-45]IiO)2pt
            psarc->(0,0)3.5(Ii)(Ithenumexpri+1)
            uput8pt[(Ii)](>Ii)$l$
            endpspicture
            enddocument


            enter image description here



            enter image description here



            Note: ArrowInside is not available for psarc. I don't know why.






            share|improve this answer















            A PSTricks solution just for fun purposes.



            documentclass[pstricks,12pt]standalone
            usepackagepstricks-add

            begindocument
            pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
            curvepnodes[plotpoints=5]03603.5 t 45 add PtoCI
            foreach i/l/a in 0/a/<,1/b/<,2/a/>,3/b/>%
            pcline[ArrowInside=-a](Ii)(Ithenumexpri+1)nbput$l$
            endpspicture
            pspicture[arrowinset=0,arrowscale=2](-4,-4)(4,4)
            pnode(0,0)O
            curvepnodes[plotpoints=5]03603.5 t 135 add PtoCI
            foreach i/l in 0/a,1/b,2/a,3/b%
            qdisk([nodesep=3.5,angle=-45]IiO)2pt
            psarc->(0,0)3.5(Ii)(Ithenumexpri+1)
            uput8pt[(Ii)](>Ii)$l$
            endpspicture
            enddocument


            enter image description here



            enter image description here



            Note: ArrowInside is not available for psarc. I don't know why.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 7 at 23:04

























            answered Jan 7 at 22:55









            God Must Be CrazyGod Must Be Crazy

            5,11511039




            5,11511039





















                3














                Another alternative approach using Metapost. Compile this one with lualatex.



                enter image description here



                documentclass[border=5mm]standalone
                usepackageluatex85
                usepackageluamplib
                begindocument
                mplibtextextlabelenable
                beginmplibcode
                beginfig(1);
                path S, C;

                S = unitsquare shifted -(1/2, 1/2) scaled 100;
                C = fullcircle scaled 84 rotated 16 shifted 140 right;

                interim ahangle := 30; % slimmer arrows...

                drawarrow subpath(0, 5/8) of S;
                drawarrow subpath(5/8, 13/8) of S;
                drawarrow subpath(4, 4-5/8) of S;
                drawarrow subpath(4-5/8, 4-13/8) of S;
                draw subpath(13/8, 4-13/8) of S;

                label.top("$a$", point 1/2 of S);
                label.top("$a$", point 5/2 of S);
                label.lft("$b$", point 3/2 of S);
                label.lft("$b$", point 7/2 of S);

                for t=0 upto 3:
                drawarrow subpath 2(t, t+1) of C;
                drawdot point 2t+3/4 of C withpen pencircle scaled 3;
                label(if odd t: "$b$" else: "$a$" fi, 9/8[center C, point 2t+7/4 of C]);
                endfor

                endfig;
                endmplibcode
                enddocument





                share|improve this answer



























                  3














                  Another alternative approach using Metapost. Compile this one with lualatex.



                  enter image description here



                  documentclass[border=5mm]standalone
                  usepackageluatex85
                  usepackageluamplib
                  begindocument
                  mplibtextextlabelenable
                  beginmplibcode
                  beginfig(1);
                  path S, C;

                  S = unitsquare shifted -(1/2, 1/2) scaled 100;
                  C = fullcircle scaled 84 rotated 16 shifted 140 right;

                  interim ahangle := 30; % slimmer arrows...

                  drawarrow subpath(0, 5/8) of S;
                  drawarrow subpath(5/8, 13/8) of S;
                  drawarrow subpath(4, 4-5/8) of S;
                  drawarrow subpath(4-5/8, 4-13/8) of S;
                  draw subpath(13/8, 4-13/8) of S;

                  label.top("$a$", point 1/2 of S);
                  label.top("$a$", point 5/2 of S);
                  label.lft("$b$", point 3/2 of S);
                  label.lft("$b$", point 7/2 of S);

                  for t=0 upto 3:
                  drawarrow subpath 2(t, t+1) of C;
                  drawdot point 2t+3/4 of C withpen pencircle scaled 3;
                  label(if odd t: "$b$" else: "$a$" fi, 9/8[center C, point 2t+7/4 of C]);
                  endfor

                  endfig;
                  endmplibcode
                  enddocument





                  share|improve this answer

























                    3












                    3








                    3







                    Another alternative approach using Metapost. Compile this one with lualatex.



                    enter image description here



                    documentclass[border=5mm]standalone
                    usepackageluatex85
                    usepackageluamplib
                    begindocument
                    mplibtextextlabelenable
                    beginmplibcode
                    beginfig(1);
                    path S, C;

                    S = unitsquare shifted -(1/2, 1/2) scaled 100;
                    C = fullcircle scaled 84 rotated 16 shifted 140 right;

                    interim ahangle := 30; % slimmer arrows...

                    drawarrow subpath(0, 5/8) of S;
                    drawarrow subpath(5/8, 13/8) of S;
                    drawarrow subpath(4, 4-5/8) of S;
                    drawarrow subpath(4-5/8, 4-13/8) of S;
                    draw subpath(13/8, 4-13/8) of S;

                    label.top("$a$", point 1/2 of S);
                    label.top("$a$", point 5/2 of S);
                    label.lft("$b$", point 3/2 of S);
                    label.lft("$b$", point 7/2 of S);

                    for t=0 upto 3:
                    drawarrow subpath 2(t, t+1) of C;
                    drawdot point 2t+3/4 of C withpen pencircle scaled 3;
                    label(if odd t: "$b$" else: "$a$" fi, 9/8[center C, point 2t+7/4 of C]);
                    endfor

                    endfig;
                    endmplibcode
                    enddocument





                    share|improve this answer













                    Another alternative approach using Metapost. Compile this one with lualatex.



                    enter image description here



                    documentclass[border=5mm]standalone
                    usepackageluatex85
                    usepackageluamplib
                    begindocument
                    mplibtextextlabelenable
                    beginmplibcode
                    beginfig(1);
                    path S, C;

                    S = unitsquare shifted -(1/2, 1/2) scaled 100;
                    C = fullcircle scaled 84 rotated 16 shifted 140 right;

                    interim ahangle := 30; % slimmer arrows...

                    drawarrow subpath(0, 5/8) of S;
                    drawarrow subpath(5/8, 13/8) of S;
                    drawarrow subpath(4, 4-5/8) of S;
                    drawarrow subpath(4-5/8, 4-13/8) of S;
                    draw subpath(13/8, 4-13/8) of S;

                    label.top("$a$", point 1/2 of S);
                    label.top("$a$", point 5/2 of S);
                    label.lft("$b$", point 3/2 of S);
                    label.lft("$b$", point 7/2 of S);

                    for t=0 upto 3:
                    drawarrow subpath 2(t, t+1) of C;
                    drawdot point 2t+3/4 of C withpen pencircle scaled 3;
                    label(if odd t: "$b$" else: "$a$" fi, 9/8[center C, point 2t+7/4 of C]);
                    endfor

                    endfig;
                    endmplibcode
                    enddocument






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 8 at 13:07









                    ThrustonThruston

                    26.1k24290




                    26.1k24290





















                        3














                        a variation of nice Henry Menke answer with use of quotes library:



                        documentclassarticle
                        usepackagetikz
                        usetikzlibrarydecorations.markings, quotes

                        begindocument

                        begintikzpicture[auto=right,
                        arrow inside/.style =
                        decoration=markings, mark=at position 0.5 with arrowstealth,
                        postaction=decorate,

                        ]
                        draw[arrow inside] (0,0) to ["$a$"] (1,0);
                        draw[arrow inside] (0,1) to ["$a$" '] (1,1);
                        draw[arrow inside] (0,0) to ["$b$" '] (0,1);
                        draw[arrow inside] (1,0) to ["$b$"] (1,1);
                        endtikzpicture


                        enter image description here






                        share|improve this answer





























                          3














                          a variation of nice Henry Menke answer with use of quotes library:



                          documentclassarticle
                          usepackagetikz
                          usetikzlibrarydecorations.markings, quotes

                          begindocument

                          begintikzpicture[auto=right,
                          arrow inside/.style =
                          decoration=markings, mark=at position 0.5 with arrowstealth,
                          postaction=decorate,

                          ]
                          draw[arrow inside] (0,0) to ["$a$"] (1,0);
                          draw[arrow inside] (0,1) to ["$a$" '] (1,1);
                          draw[arrow inside] (0,0) to ["$b$" '] (0,1);
                          draw[arrow inside] (1,0) to ["$b$"] (1,1);
                          endtikzpicture


                          enter image description here






                          share|improve this answer



























                            3












                            3








                            3







                            a variation of nice Henry Menke answer with use of quotes library:



                            documentclassarticle
                            usepackagetikz
                            usetikzlibrarydecorations.markings, quotes

                            begindocument

                            begintikzpicture[auto=right,
                            arrow inside/.style =
                            decoration=markings, mark=at position 0.5 with arrowstealth,
                            postaction=decorate,

                            ]
                            draw[arrow inside] (0,0) to ["$a$"] (1,0);
                            draw[arrow inside] (0,1) to ["$a$" '] (1,1);
                            draw[arrow inside] (0,0) to ["$b$" '] (0,1);
                            draw[arrow inside] (1,0) to ["$b$"] (1,1);
                            endtikzpicture


                            enter image description here






                            share|improve this answer















                            a variation of nice Henry Menke answer with use of quotes library:



                            documentclassarticle
                            usepackagetikz
                            usetikzlibrarydecorations.markings, quotes

                            begindocument

                            begintikzpicture[auto=right,
                            arrow inside/.style =
                            decoration=markings, mark=at position 0.5 with arrowstealth,
                            postaction=decorate,

                            ]
                            draw[arrow inside] (0,0) to ["$a$"] (1,0);
                            draw[arrow inside] (0,1) to ["$a$" '] (1,1);
                            draw[arrow inside] (0,0) to ["$b$" '] (0,1);
                            draw[arrow inside] (1,0) to ["$b$"] (1,1);
                            endtikzpicture


                            enter image description here







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jan 8 at 15:16

























                            answered Jan 8 at 12:25









                            ZarkoZarko

                            123k865161




                            123k865161



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f469051%2ftopology-diagrams-labelled-edges%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown






                                Popular posts from this blog

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

                                Displaying single band from multi-band raster using QGIS

                                How many registers does an x86_64 CPU actually have?