Different sized loops in tikzcd matrix









up vote
4
down vote

favorite












I have a matrix of numbers with arrows and loops. The trouble i'm having is some loops are of different sizes depending on which way the loop is oriented. Loops are defined with 60 degrees difference between the in and out position (with midpoint of the loop corresponding to 0,90,180,270).



In the image included, the loop size differences can be seen from those in the middle column where loops above the matrix element are larger than the loops below the matrix element. Also the loops of corner elements are smaller than those of the side elements.



Can anyone point out what I'm doing wrong, or how to make the loops look the same size but `rotated'? MWE and its output given below.



documentclass[tikz]standalone
usepackagetikz-cd
usetikzlibraryfit,backgrounds

begindocument

newcommandaUarrow[bend left]u
newcommandaDarrow[bend left]d
newcommandaLarrowl
newcommandaRarrowr
newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

begintikzcd[nodes=inner sep=1pt,minimum size=3ex,cramped,column sep=scriptsize, row sep=scriptsize,
every matrix/.append style=name=m,execute at end picture=
beginscope[on background layer]
node[rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
endscope;
]
2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
endtikzcd
enddocument


enter image description here










share|improve this question



























    up vote
    4
    down vote

    favorite












    I have a matrix of numbers with arrows and loops. The trouble i'm having is some loops are of different sizes depending on which way the loop is oriented. Loops are defined with 60 degrees difference between the in and out position (with midpoint of the loop corresponding to 0,90,180,270).



    In the image included, the loop size differences can be seen from those in the middle column where loops above the matrix element are larger than the loops below the matrix element. Also the loops of corner elements are smaller than those of the side elements.



    Can anyone point out what I'm doing wrong, or how to make the loops look the same size but `rotated'? MWE and its output given below.



    documentclass[tikz]standalone
    usepackagetikz-cd
    usetikzlibraryfit,backgrounds

    begindocument

    newcommandaUarrow[bend left]u
    newcommandaDarrow[bend left]d
    newcommandaLarrowl
    newcommandaRarrowr
    newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
    newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
    newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

    begintikzcd[nodes=inner sep=1pt,minimum size=3ex,cramped,column sep=scriptsize, row sep=scriptsize,
    every matrix/.append style=name=m,execute at end picture=
    beginscope[on background layer]
    node[rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
    endscope;
    ]
    2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
    6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
    10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
    14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
    endtikzcd
    enddocument


    enter image description here










    share|improve this question

























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I have a matrix of numbers with arrows and loops. The trouble i'm having is some loops are of different sizes depending on which way the loop is oriented. Loops are defined with 60 degrees difference between the in and out position (with midpoint of the loop corresponding to 0,90,180,270).



      In the image included, the loop size differences can be seen from those in the middle column where loops above the matrix element are larger than the loops below the matrix element. Also the loops of corner elements are smaller than those of the side elements.



      Can anyone point out what I'm doing wrong, or how to make the loops look the same size but `rotated'? MWE and its output given below.



      documentclass[tikz]standalone
      usepackagetikz-cd
      usetikzlibraryfit,backgrounds

      begindocument

      newcommandaUarrow[bend left]u
      newcommandaDarrow[bend left]d
      newcommandaLarrowl
      newcommandaRarrowr
      newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
      newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
      newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

      begintikzcd[nodes=inner sep=1pt,minimum size=3ex,cramped,column sep=scriptsize, row sep=scriptsize,
      every matrix/.append style=name=m,execute at end picture=
      beginscope[on background layer]
      node[rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
      endscope;
      ]
      2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
      6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
      10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
      14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
      endtikzcd
      enddocument


      enter image description here










      share|improve this question















      I have a matrix of numbers with arrows and loops. The trouble i'm having is some loops are of different sizes depending on which way the loop is oriented. Loops are defined with 60 degrees difference between the in and out position (with midpoint of the loop corresponding to 0,90,180,270).



      In the image included, the loop size differences can be seen from those in the middle column where loops above the matrix element are larger than the loops below the matrix element. Also the loops of corner elements are smaller than those of the side elements.



      Can anyone point out what I'm doing wrong, or how to make the loops look the same size but `rotated'? MWE and its output given below.



      documentclass[tikz]standalone
      usepackagetikz-cd
      usetikzlibraryfit,backgrounds

      begindocument

      newcommandaUarrow[bend left]u
      newcommandaDarrow[bend left]d
      newcommandaLarrowl
      newcommandaRarrowr
      newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
      newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
      newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

      begintikzcd[nodes=inner sep=1pt,minimum size=3ex,cramped,column sep=scriptsize, row sep=scriptsize,
      every matrix/.append style=name=m,execute at end picture=
      beginscope[on background layer]
      node[rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
      endscope;
      ]
      2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
      6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
      10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
      14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
      endtikzcd
      enddocument


      enter image description here







      tikz-cd






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 7:34

























      asked Nov 8 at 7:18









      Dunk the Lunk

      38529




      38529




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          It looks like the center of the nodes isn't positioned at the center of the numbers themselves. And the loops are constructed around the centers of the nodes. Also, the rectangular node shape
          doesn't help in making loops equal. As a workaround you could use the circle node shape (notice that I had to increase the minimum node size to 3.5ex as well to get all circles equal):



          usepackagetikz-cd
          usetikzlibraryfit,backgrounds

          begindocument

          newcommandaUarrow[bend left]u
          newcommandaDarrow[bend left]d
          newcommandaLarrowl
          newcommandaRarrowr
          newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
          newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
          newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

          begintikzcd[nodes=inner sep=1pt,minimum size=3.5ex,circle,cramped,column sep=scriptsize, row sep=scriptsize,
          every matrix/.append style=name=m,execute at end picture=
          beginscope[on background layer]
          node[rectangle,rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
          endscope;
          ]
          2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
          6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
          10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
          14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
          endtikzcd
          enddocument


          The result:



          enter image description here






          share|improve this answer




















          • Thanks for your help. I will use your solution.
            – Dunk the Lunk
            Nov 8 at 10:50










          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: 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%2f458921%2fdifferent-sized-loops-in-tikzcd-matrix%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote



          accepted










          It looks like the center of the nodes isn't positioned at the center of the numbers themselves. And the loops are constructed around the centers of the nodes. Also, the rectangular node shape
          doesn't help in making loops equal. As a workaround you could use the circle node shape (notice that I had to increase the minimum node size to 3.5ex as well to get all circles equal):



          usepackagetikz-cd
          usetikzlibraryfit,backgrounds

          begindocument

          newcommandaUarrow[bend left]u
          newcommandaDarrow[bend left]d
          newcommandaLarrowl
          newcommandaRarrowr
          newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
          newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
          newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

          begintikzcd[nodes=inner sep=1pt,minimum size=3.5ex,circle,cramped,column sep=scriptsize, row sep=scriptsize,
          every matrix/.append style=name=m,execute at end picture=
          beginscope[on background layer]
          node[rectangle,rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
          endscope;
          ]
          2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
          6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
          10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
          14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
          endtikzcd
          enddocument


          The result:



          enter image description here






          share|improve this answer




















          • Thanks for your help. I will use your solution.
            – Dunk the Lunk
            Nov 8 at 10:50














          up vote
          5
          down vote



          accepted










          It looks like the center of the nodes isn't positioned at the center of the numbers themselves. And the loops are constructed around the centers of the nodes. Also, the rectangular node shape
          doesn't help in making loops equal. As a workaround you could use the circle node shape (notice that I had to increase the minimum node size to 3.5ex as well to get all circles equal):



          usepackagetikz-cd
          usetikzlibraryfit,backgrounds

          begindocument

          newcommandaUarrow[bend left]u
          newcommandaDarrow[bend left]d
          newcommandaLarrowl
          newcommandaRarrowr
          newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
          newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
          newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

          begintikzcd[nodes=inner sep=1pt,minimum size=3.5ex,circle,cramped,column sep=scriptsize, row sep=scriptsize,
          every matrix/.append style=name=m,execute at end picture=
          beginscope[on background layer]
          node[rectangle,rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
          endscope;
          ]
          2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
          6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
          10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
          14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
          endtikzcd
          enddocument


          The result:



          enter image description here






          share|improve this answer




















          • Thanks for your help. I will use your solution.
            – Dunk the Lunk
            Nov 8 at 10:50












          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted






          It looks like the center of the nodes isn't positioned at the center of the numbers themselves. And the loops are constructed around the centers of the nodes. Also, the rectangular node shape
          doesn't help in making loops equal. As a workaround you could use the circle node shape (notice that I had to increase the minimum node size to 3.5ex as well to get all circles equal):



          usepackagetikz-cd
          usetikzlibraryfit,backgrounds

          begindocument

          newcommandaUarrow[bend left]u
          newcommandaDarrow[bend left]d
          newcommandaLarrowl
          newcommandaRarrowr
          newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
          newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
          newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

          begintikzcd[nodes=inner sep=1pt,minimum size=3.5ex,circle,cramped,column sep=scriptsize, row sep=scriptsize,
          every matrix/.append style=name=m,execute at end picture=
          beginscope[on background layer]
          node[rectangle,rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
          endscope;
          ]
          2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
          6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
          10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
          14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
          endtikzcd
          enddocument


          The result:



          enter image description here






          share|improve this answer












          It looks like the center of the nodes isn't positioned at the center of the numbers themselves. And the loops are constructed around the centers of the nodes. Also, the rectangular node shape
          doesn't help in making loops equal. As a workaround you could use the circle node shape (notice that I had to increase the minimum node size to 3.5ex as well to get all circles equal):



          usepackagetikz-cd
          usetikzlibraryfit,backgrounds

          begindocument

          newcommandaUarrow[bend left]u
          newcommandaDarrow[bend left]d
          newcommandaLarrowl
          newcommandaRarrowr
          newcommandaS[2]arrow[loop, out=#1, in=#2,looseness=4]
          newcommandaSc[1]arrow[loop, out=#1+30, in=#1-30,looseness=4]%Self, clockwise
          newcommandaSa[1]arrow[loop, out=#1-30, in=#1+30,looseness=4]%Self, anti-clockwise

          begintikzcd[nodes=inner sep=1pt,minimum size=3.5ex,circle,cramped,column sep=scriptsize, row sep=scriptsize,
          every matrix/.append style=name=m,execute at end picture=
          beginscope[on background layer]
          node[rectangle,rounded corners,fill=black!10,minimum width=1cm, fit=(m-1-2) (m-4-2)](c1) ;
          endscope;
          ]
          2aDaSc135 & 1aLaSc90 & 0aLaDaSc45 \
          6aUaDaSa180 & 5aLaSc90 & 4aLaUaDaSc0 \
          10aUaDaSc180 & 9aLaSa270 & 8aLaUaDaSc0 \
          14aUaSc225 & 13aLaSa270 & 12aLaUaSc315
          endtikzcd
          enddocument


          The result:



          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 8 at 9:18









          Sergei Golovan

          3,8851413




          3,8851413











          • Thanks for your help. I will use your solution.
            – Dunk the Lunk
            Nov 8 at 10:50
















          • Thanks for your help. I will use your solution.
            – Dunk the Lunk
            Nov 8 at 10:50















          Thanks for your help. I will use your solution.
          – Dunk the Lunk
          Nov 8 at 10:50




          Thanks for your help. I will use your solution.
          – Dunk the Lunk
          Nov 8 at 10:50

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458921%2fdifferent-sized-loops-in-tikzcd-matrix%23new-answer', 'question_page');

          );

          Post as a guest














































































          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Crossroads (UK TV series)

          ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế