How do I draw the following matrix in LaTeX?

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











up vote
2
down vote

favorite
1












I want to draw the following matrix in LaTeX:



Enter image description here



I found that I should use the TikZ package, and I have spent a lot of time looking at the package. However, I have no experience of using the package before, and I do not know how to draw it. How can I do it?










share|improve this question









New contributor




Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    2
    down vote

    favorite
    1












    I want to draw the following matrix in LaTeX:



    Enter image description here



    I found that I should use the TikZ package, and I have spent a lot of time looking at the package. However, I have no experience of using the package before, and I do not know how to draw it. How can I do it?










    share|improve this question









    New contributor




    Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      I want to draw the following matrix in LaTeX:



      Enter image description here



      I found that I should use the TikZ package, and I have spent a lot of time looking at the package. However, I have no experience of using the package before, and I do not know how to draw it. How can I do it?










      share|improve this question









      New contributor




      Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I want to draw the following matrix in LaTeX:



      Enter image description here



      I found that I should use the TikZ package, and I have spent a lot of time looking at the package. However, I have no experience of using the package before, and I do not know how to draw it. How can I do it?







      tikz-matrix






      share|improve this question









      New contributor




      Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 19 at 6:07









      Peter Mortensen

      52736




      52736






      New contributor




      Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 18 at 21:42









      Sherry

      1225




      1225




      New contributor




      Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Sherry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          16
          down vote



          accepted










          Just arrays:



          documentclassarticle
          usepackageamsmath,array

          begindocument

          [
          newcommandblocke
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 & hphantom0 \
          \ \
          endmatrix

          newcommandblockr
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 &
          hatNsmash[b]vphantomBig \ &&& vdots \ &&& 2 \ &&& 1
          endmatrix

          newcommandblockl
          beginmatrix
          1 & hphantom0 & hphantom0 & hphantom0 \
          2 \ vdots \ hatNsmash[b]vphantomBig
          endmatrix

          newcommanddddots
          beginmatrix
          hphantom0 & hphantom0 & ddots \
          \
          \
          ddots
          endmatrix

          beginpmatrix
          hspace*0.3em
          beginarray
          hline
          & blockl & & & blocke \
          hline
          blockr & & blockl & & \
          hline
          & blockr & & blockl & \
          hline
          & & & dddots & \
          hline
          & & & blockr & \
          hline
          endarray
          hspace*0.3em
          endpmatrix
          ]

          enddocument


          I locally defined a few commands to ease input.



          enter image description here






          share|improve this answer




















          • Is it possible to make the parentheses curver/more curve?
            – Ooker
            Nov 19 at 1:51


















          up vote
          9
          down vote













          Welcome to TeX.SE! Actually, you do not need TikZ for this.



          documentclassarticle
          usepackageamsmath
          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & 2 & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & 2 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 2 & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & 2 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 2 & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & 2 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          enddocument


          enter image description here



          However, you could use TikZ to improve the appearance.



          documentclassarticle
          usepackageamsmath
          usepackagetikz
          usetikzlibrarytikzmark
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknode212 & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknodeN1widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & tikzmarknodeN2widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & & & & & & & tikzmarknode232 & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & tikzmarknode222 & & & & & & & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & tikzmarknodeN3widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & tikzmarknodeN4widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & & & & & & & tikzmarknode252 & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & tikzmarknode242 & & & & & & & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & tikzmarknodeN5widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & tikzmarknodeN6widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & tikzmarknode262 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          begintikzpicture[overlay,remember picture]
          foreach X in 1,...,6
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt] (2X) -- (NX);
          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: In an attempt to make Ryan Reich a bit happy, here is a version in which you only have to specify the nonempty entries of this sparse array. These entries are determined by the list 6/1/1,6/2/2,6/5/widehatN,... , where each entry has the structure <X>/<Y>/<entry> with X and Y specifying the position. Notice that one could shorten this further if you really have only one type of columns, but the point here is to allow to build arbitrary sparse matrices of that type. This code uses this answer.



          documentclassarticle
          usepackagetikz
          usetikzlibrarymatrix,calc
          usepackageetoolbox
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          edefmylist6/1/1,6/2/2,6/5/widehatN,%
          5/6/widehatN,5/9/2,5/10/1,%
          11/6/1,11/7/2,11/10/widehatN,%
          10/11/widehatN,10/12/2,10/15/1,%
          16/11/1,16/12/2,16/15/widehatN,%
          20/21/widehatN,20/22/2,20/25/1%

          begintikzpicture
          letmymatrixcontentempty
          foreach Y in 1,...,25%
          foreach X in 1,...,25
          xdeftmp
          foreach XX/YY/ZZ in mylist
          ifnumXX=X
          ifnumYY=Y
          xdeftmpZZ
          fi
          fi
          ifnumX=25
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace\%
          else
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace&space%
          fi


          matrix [matrix of math nodes,ampersand replacement=&,left delimiter=(,
          right delimiter=),draw,row sep=3pt] (mat)
          mymatrixcontent
          ;
          foreach X [evaluate=X as Y using int(X+1)]in 5,10,...,20
          aux1) -- (mat.south -
          foreach X/Y [evaluate=Y as Z using int(Y+3)] in
          6/2,5/6,11/7,10/12,16/12,20/22
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt]
          (mat-Y-X) -- (mat-Z-X);
          draw[line width=1.2mm, dots=4 per 1cm]
          (mat-16-18.center) -- (mat-18-20.center)
          (mat-18-16.center) -- (mat-20-18.center);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • I don't want to be a jerk, but filling a page with ampersands that require careful counting is not a very helpful answer.
            – Ryan Reich
            Nov 19 at 1:06










          • @RyanReich Are you really typing them one by one? If so, then I agree. But of course if you just do copy and paste, then it is not that cumbersome. Well, and if you like phantoms better (and make sure that none of the entries exceeds the size of those), I'd say this is a matter of taste, but otherwise it is a bit nontrivial to bet things aligned across different blocks. So that is just to say that I definitely did not have to count here.
            – marmot
            Nov 19 at 2:16






          • 1




            What if I make a mistake? What if I need to make a change? There may technically be a programmatic avenue into this gigantic expression but it's fragile and not apparent on the finished product. It doesn't say what it does, it just is.
            – Ryan Reich
            Nov 19 at 3:48










          • @RyanReich If you make a mistake, you will not get what you want. However, this is not specific to this matrix. You seem not to like this answer, which is fine. However, I do not really see the purpose of your comments. I believe to have told you why I did what I did. If you have a better solution post it. (And yes, I do now how to typeset a matrix programmatically. Do you want me to post such a solution? The OP has already made her choice...) And yes, the matrix is gigantic.
            – marmot
            Nov 19 at 3:57










          • @RyanReich In an attempt to remove the tension in our exchange of opinions, I added a version in which you only need to specify the nontrivial entries.
            – marmot
            Nov 19 at 5:11










          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
          );



          );






          Sherry is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460659%2fhow-do-i-draw-the-following-matrix-in-latex%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          16
          down vote



          accepted










          Just arrays:



          documentclassarticle
          usepackageamsmath,array

          begindocument

          [
          newcommandblocke
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 & hphantom0 \
          \ \
          endmatrix

          newcommandblockr
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 &
          hatNsmash[b]vphantomBig \ &&& vdots \ &&& 2 \ &&& 1
          endmatrix

          newcommandblockl
          beginmatrix
          1 & hphantom0 & hphantom0 & hphantom0 \
          2 \ vdots \ hatNsmash[b]vphantomBig
          endmatrix

          newcommanddddots
          beginmatrix
          hphantom0 & hphantom0 & ddots \
          \
          \
          ddots
          endmatrix

          beginpmatrix
          hspace*0.3em
          beginarray
          hline
          & blockl & & & blocke \
          hline
          blockr & & blockl & & \
          hline
          & blockr & & blockl & \
          hline
          & & & dddots & \
          hline
          & & & blockr & \
          hline
          endarray
          hspace*0.3em
          endpmatrix
          ]

          enddocument


          I locally defined a few commands to ease input.



          enter image description here






          share|improve this answer




















          • Is it possible to make the parentheses curver/more curve?
            – Ooker
            Nov 19 at 1:51















          up vote
          16
          down vote



          accepted










          Just arrays:



          documentclassarticle
          usepackageamsmath,array

          begindocument

          [
          newcommandblocke
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 & hphantom0 \
          \ \
          endmatrix

          newcommandblockr
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 &
          hatNsmash[b]vphantomBig \ &&& vdots \ &&& 2 \ &&& 1
          endmatrix

          newcommandblockl
          beginmatrix
          1 & hphantom0 & hphantom0 & hphantom0 \
          2 \ vdots \ hatNsmash[b]vphantomBig
          endmatrix

          newcommanddddots
          beginmatrix
          hphantom0 & hphantom0 & ddots \
          \
          \
          ddots
          endmatrix

          beginpmatrix
          hspace*0.3em
          beginarray
          hline
          & blockl & & & blocke \
          hline
          blockr & & blockl & & \
          hline
          & blockr & & blockl & \
          hline
          & & & dddots & \
          hline
          & & & blockr & \
          hline
          endarray
          hspace*0.3em
          endpmatrix
          ]

          enddocument


          I locally defined a few commands to ease input.



          enter image description here






          share|improve this answer




















          • Is it possible to make the parentheses curver/more curve?
            – Ooker
            Nov 19 at 1:51













          up vote
          16
          down vote



          accepted







          up vote
          16
          down vote



          accepted






          Just arrays:



          documentclassarticle
          usepackageamsmath,array

          begindocument

          [
          newcommandblocke
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 & hphantom0 \
          \ \
          endmatrix

          newcommandblockr
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 &
          hatNsmash[b]vphantomBig \ &&& vdots \ &&& 2 \ &&& 1
          endmatrix

          newcommandblockl
          beginmatrix
          1 & hphantom0 & hphantom0 & hphantom0 \
          2 \ vdots \ hatNsmash[b]vphantomBig
          endmatrix

          newcommanddddots
          beginmatrix
          hphantom0 & hphantom0 & ddots \
          \
          \
          ddots
          endmatrix

          beginpmatrix
          hspace*0.3em
          beginarray
          hline
          & blockl & & & blocke \
          hline
          blockr & & blockl & & \
          hline
          & blockr & & blockl & \
          hline
          & & & dddots & \
          hline
          & & & blockr & \
          hline
          endarray
          hspace*0.3em
          endpmatrix
          ]

          enddocument


          I locally defined a few commands to ease input.



          enter image description here






          share|improve this answer












          Just arrays:



          documentclassarticle
          usepackageamsmath,array

          begindocument

          [
          newcommandblocke
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 & hphantom0 \
          \ \
          endmatrix

          newcommandblockr
          beginmatrix
          hphantom0 & hphantom0 & hphantom0 &
          hatNsmash[b]vphantomBig \ &&& vdots \ &&& 2 \ &&& 1
          endmatrix

          newcommandblockl
          beginmatrix
          1 & hphantom0 & hphantom0 & hphantom0 \
          2 \ vdots \ hatNsmash[b]vphantomBig
          endmatrix

          newcommanddddots
          beginmatrix
          hphantom0 & hphantom0 & ddots \
          \
          \
          ddots
          endmatrix

          beginpmatrix
          hspace*0.3em
          beginarray
          hline
          & blockl & & & blocke \
          hline
          blockr & & blockl & & \
          hline
          & blockr & & blockl & \
          hline
          & & & dddots & \
          hline
          & & & blockr & \
          hline
          endarray
          hspace*0.3em
          endpmatrix
          ]

          enddocument


          I locally defined a few commands to ease input.



          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 18 at 22:12









          egreg

          699k8518583127




          699k8518583127











          • Is it possible to make the parentheses curver/more curve?
            – Ooker
            Nov 19 at 1:51

















          • Is it possible to make the parentheses curver/more curve?
            – Ooker
            Nov 19 at 1:51
















          Is it possible to make the parentheses curver/more curve?
          – Ooker
          Nov 19 at 1:51





          Is it possible to make the parentheses curver/more curve?
          – Ooker
          Nov 19 at 1:51











          up vote
          9
          down vote













          Welcome to TeX.SE! Actually, you do not need TikZ for this.



          documentclassarticle
          usepackageamsmath
          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & 2 & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & 2 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 2 & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & 2 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 2 & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & 2 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          enddocument


          enter image description here



          However, you could use TikZ to improve the appearance.



          documentclassarticle
          usepackageamsmath
          usepackagetikz
          usetikzlibrarytikzmark
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknode212 & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknodeN1widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & tikzmarknodeN2widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & & & & & & & tikzmarknode232 & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & tikzmarknode222 & & & & & & & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & tikzmarknodeN3widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & tikzmarknodeN4widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & & & & & & & tikzmarknode252 & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & tikzmarknode242 & & & & & & & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & tikzmarknodeN5widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & tikzmarknodeN6widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & tikzmarknode262 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          begintikzpicture[overlay,remember picture]
          foreach X in 1,...,6
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt] (2X) -- (NX);
          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: In an attempt to make Ryan Reich a bit happy, here is a version in which you only have to specify the nonempty entries of this sparse array. These entries are determined by the list 6/1/1,6/2/2,6/5/widehatN,... , where each entry has the structure <X>/<Y>/<entry> with X and Y specifying the position. Notice that one could shorten this further if you really have only one type of columns, but the point here is to allow to build arbitrary sparse matrices of that type. This code uses this answer.



          documentclassarticle
          usepackagetikz
          usetikzlibrarymatrix,calc
          usepackageetoolbox
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          edefmylist6/1/1,6/2/2,6/5/widehatN,%
          5/6/widehatN,5/9/2,5/10/1,%
          11/6/1,11/7/2,11/10/widehatN,%
          10/11/widehatN,10/12/2,10/15/1,%
          16/11/1,16/12/2,16/15/widehatN,%
          20/21/widehatN,20/22/2,20/25/1%

          begintikzpicture
          letmymatrixcontentempty
          foreach Y in 1,...,25%
          foreach X in 1,...,25
          xdeftmp
          foreach XX/YY/ZZ in mylist
          ifnumXX=X
          ifnumYY=Y
          xdeftmpZZ
          fi
          fi
          ifnumX=25
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace\%
          else
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace&space%
          fi


          matrix [matrix of math nodes,ampersand replacement=&,left delimiter=(,
          right delimiter=),draw,row sep=3pt] (mat)
          mymatrixcontent
          ;
          foreach X [evaluate=X as Y using int(X+1)]in 5,10,...,20
          aux1) -- (mat.south -
          foreach X/Y [evaluate=Y as Z using int(Y+3)] in
          6/2,5/6,11/7,10/12,16/12,20/22
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt]
          (mat-Y-X) -- (mat-Z-X);
          draw[line width=1.2mm, dots=4 per 1cm]
          (mat-16-18.center) -- (mat-18-20.center)
          (mat-18-16.center) -- (mat-20-18.center);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • I don't want to be a jerk, but filling a page with ampersands that require careful counting is not a very helpful answer.
            – Ryan Reich
            Nov 19 at 1:06










          • @RyanReich Are you really typing them one by one? If so, then I agree. But of course if you just do copy and paste, then it is not that cumbersome. Well, and if you like phantoms better (and make sure that none of the entries exceeds the size of those), I'd say this is a matter of taste, but otherwise it is a bit nontrivial to bet things aligned across different blocks. So that is just to say that I definitely did not have to count here.
            – marmot
            Nov 19 at 2:16






          • 1




            What if I make a mistake? What if I need to make a change? There may technically be a programmatic avenue into this gigantic expression but it's fragile and not apparent on the finished product. It doesn't say what it does, it just is.
            – Ryan Reich
            Nov 19 at 3:48










          • @RyanReich If you make a mistake, you will not get what you want. However, this is not specific to this matrix. You seem not to like this answer, which is fine. However, I do not really see the purpose of your comments. I believe to have told you why I did what I did. If you have a better solution post it. (And yes, I do now how to typeset a matrix programmatically. Do you want me to post such a solution? The OP has already made her choice...) And yes, the matrix is gigantic.
            – marmot
            Nov 19 at 3:57










          • @RyanReich In an attempt to remove the tension in our exchange of opinions, I added a version in which you only need to specify the nontrivial entries.
            – marmot
            Nov 19 at 5:11














          up vote
          9
          down vote













          Welcome to TeX.SE! Actually, you do not need TikZ for this.



          documentclassarticle
          usepackageamsmath
          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & 2 & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & 2 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 2 & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & 2 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 2 & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & 2 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          enddocument


          enter image description here



          However, you could use TikZ to improve the appearance.



          documentclassarticle
          usepackageamsmath
          usepackagetikz
          usetikzlibrarytikzmark
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknode212 & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknodeN1widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & tikzmarknodeN2widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & & & & & & & tikzmarknode232 & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & tikzmarknode222 & & & & & & & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & tikzmarknodeN3widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & tikzmarknodeN4widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & & & & & & & tikzmarknode252 & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & tikzmarknode242 & & & & & & & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & tikzmarknodeN5widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & tikzmarknodeN6widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & tikzmarknode262 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          begintikzpicture[overlay,remember picture]
          foreach X in 1,...,6
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt] (2X) -- (NX);
          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: In an attempt to make Ryan Reich a bit happy, here is a version in which you only have to specify the nonempty entries of this sparse array. These entries are determined by the list 6/1/1,6/2/2,6/5/widehatN,... , where each entry has the structure <X>/<Y>/<entry> with X and Y specifying the position. Notice that one could shorten this further if you really have only one type of columns, but the point here is to allow to build arbitrary sparse matrices of that type. This code uses this answer.



          documentclassarticle
          usepackagetikz
          usetikzlibrarymatrix,calc
          usepackageetoolbox
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          edefmylist6/1/1,6/2/2,6/5/widehatN,%
          5/6/widehatN,5/9/2,5/10/1,%
          11/6/1,11/7/2,11/10/widehatN,%
          10/11/widehatN,10/12/2,10/15/1,%
          16/11/1,16/12/2,16/15/widehatN,%
          20/21/widehatN,20/22/2,20/25/1%

          begintikzpicture
          letmymatrixcontentempty
          foreach Y in 1,...,25%
          foreach X in 1,...,25
          xdeftmp
          foreach XX/YY/ZZ in mylist
          ifnumXX=X
          ifnumYY=Y
          xdeftmpZZ
          fi
          fi
          ifnumX=25
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace\%
          else
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace&space%
          fi


          matrix [matrix of math nodes,ampersand replacement=&,left delimiter=(,
          right delimiter=),draw,row sep=3pt] (mat)
          mymatrixcontent
          ;
          foreach X [evaluate=X as Y using int(X+1)]in 5,10,...,20
          aux1) -- (mat.south -
          foreach X/Y [evaluate=Y as Z using int(Y+3)] in
          6/2,5/6,11/7,10/12,16/12,20/22
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt]
          (mat-Y-X) -- (mat-Z-X);
          draw[line width=1.2mm, dots=4 per 1cm]
          (mat-16-18.center) -- (mat-18-20.center)
          (mat-18-16.center) -- (mat-20-18.center);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • I don't want to be a jerk, but filling a page with ampersands that require careful counting is not a very helpful answer.
            – Ryan Reich
            Nov 19 at 1:06










          • @RyanReich Are you really typing them one by one? If so, then I agree. But of course if you just do copy and paste, then it is not that cumbersome. Well, and if you like phantoms better (and make sure that none of the entries exceeds the size of those), I'd say this is a matter of taste, but otherwise it is a bit nontrivial to bet things aligned across different blocks. So that is just to say that I definitely did not have to count here.
            – marmot
            Nov 19 at 2:16






          • 1




            What if I make a mistake? What if I need to make a change? There may technically be a programmatic avenue into this gigantic expression but it's fragile and not apparent on the finished product. It doesn't say what it does, it just is.
            – Ryan Reich
            Nov 19 at 3:48










          • @RyanReich If you make a mistake, you will not get what you want. However, this is not specific to this matrix. You seem not to like this answer, which is fine. However, I do not really see the purpose of your comments. I believe to have told you why I did what I did. If you have a better solution post it. (And yes, I do now how to typeset a matrix programmatically. Do you want me to post such a solution? The OP has already made her choice...) And yes, the matrix is gigantic.
            – marmot
            Nov 19 at 3:57










          • @RyanReich In an attempt to remove the tension in our exchange of opinions, I added a version in which you only need to specify the nontrivial entries.
            – marmot
            Nov 19 at 5:11












          up vote
          9
          down vote










          up vote
          9
          down vote









          Welcome to TeX.SE! Actually, you do not need TikZ for this.



          documentclassarticle
          usepackageamsmath
          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & 2 & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & 2 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 2 & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & 2 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 2 & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & 2 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          enddocument


          enter image description here



          However, you could use TikZ to improve the appearance.



          documentclassarticle
          usepackageamsmath
          usepackagetikz
          usetikzlibrarytikzmark
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknode212 & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknodeN1widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & tikzmarknodeN2widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & & & & & & & tikzmarknode232 & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & tikzmarknode222 & & & & & & & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & tikzmarknodeN3widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & tikzmarknodeN4widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & & & & & & & tikzmarknode252 & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & tikzmarknode242 & & & & & & & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & tikzmarknodeN5widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & tikzmarknodeN6widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & tikzmarknode262 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          begintikzpicture[overlay,remember picture]
          foreach X in 1,...,6
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt] (2X) -- (NX);
          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: In an attempt to make Ryan Reich a bit happy, here is a version in which you only have to specify the nonempty entries of this sparse array. These entries are determined by the list 6/1/1,6/2/2,6/5/widehatN,... , where each entry has the structure <X>/<Y>/<entry> with X and Y specifying the position. Notice that one could shorten this further if you really have only one type of columns, but the point here is to allow to build arbitrary sparse matrices of that type. This code uses this answer.



          documentclassarticle
          usepackagetikz
          usetikzlibrarymatrix,calc
          usepackageetoolbox
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          edefmylist6/1/1,6/2/2,6/5/widehatN,%
          5/6/widehatN,5/9/2,5/10/1,%
          11/6/1,11/7/2,11/10/widehatN,%
          10/11/widehatN,10/12/2,10/15/1,%
          16/11/1,16/12/2,16/15/widehatN,%
          20/21/widehatN,20/22/2,20/25/1%

          begintikzpicture
          letmymatrixcontentempty
          foreach Y in 1,...,25%
          foreach X in 1,...,25
          xdeftmp
          foreach XX/YY/ZZ in mylist
          ifnumXX=X
          ifnumYY=Y
          xdeftmpZZ
          fi
          fi
          ifnumX=25
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace\%
          else
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace&space%
          fi


          matrix [matrix of math nodes,ampersand replacement=&,left delimiter=(,
          right delimiter=),draw,row sep=3pt] (mat)
          mymatrixcontent
          ;
          foreach X [evaluate=X as Y using int(X+1)]in 5,10,...,20
          aux1) -- (mat.south -
          foreach X/Y [evaluate=Y as Z using int(Y+3)] in
          6/2,5/6,11/7,10/12,16/12,20/22
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt]
          (mat-Y-X) -- (mat-Z-X);
          draw[line width=1.2mm, dots=4 per 1cm]
          (mat-16-18.center) -- (mat-18-20.center)
          (mat-18-16.center) -- (mat-20-18.center);
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer














          Welcome to TeX.SE! Actually, you do not need TikZ for this.



          documentclassarticle
          usepackageamsmath
          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & 2 & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & vdots & & & & & & & & & & & & & & & & & & & \
          & & & & & widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & 2 & & & & & & & & & & & & & & \
          & & & & vdots & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 2 & & & & & & vdots & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & 2 & & & & & & & & & \
          & & & & & & & & & vdots & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 2 & & & & & & vdots & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & vdots & & & & & \
          & & & & & & & & & & & & & & & & & & & 2 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          enddocument


          enter image description here



          However, you could use TikZ to improve the appearance.



          documentclassarticle
          usepackageamsmath
          usepackagetikz
          usetikzlibrarytikzmark
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          [left(beginarray*5ccccc
          hline
          & & & & & 1 & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknode212 & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & tikzmarknodeN1widehatN & & & & & & & & & & & & & & & & & & & \
          hline
          & & & & tikzmarknodeN2widehatN & & & & & & 1 & & & & & & & & & & & & & & \
          & & & & & & & & & & tikzmarknode232 & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & tikzmarknode222 & & & & & & & & & & & & & & & & & & & & \
          & & & & 1 & & & & & & tikzmarknodeN3widehatN & & & & & & & & & & & & & & \
          hline
          & & & & & & & & & tikzmarknodeN4widehatN & & & & & & 1 & & & & & & & & & \
          & & & & & & & & & & & & & & & tikzmarknode252 & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & tikzmarknode242 & & & & & & & & & & & & & & & \
          & & & & & & & & & 1 & & & & & & tikzmarknodeN5widehatN & & & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          & & & & & & & & & & & & & & & & & & bullet & & & & & & \
          & & & & & & & & & & & & & & & bullet & & & & bullet & & & & & \
          & & & & & & & & & & & & & & & & bullet & & & & & & & & \
          & & & & & & & & & & & & & & & & & bullet & & & & & & & \
          hline
          & & & & & & & & & & & & & & & & & & & tikzmarknodeN6widehatN & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & & & & & & \
          & & & & & & & & & & & & & & & & & & & tikzmarknode262 & & & & & \
          & & & & & & & & & & & & & & & & & & & 1 & & & & & \
          hline
          endarrayright)]
          begintikzpicture[overlay,remember picture]
          foreach X in 1,...,6
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt] (2X) -- (NX);
          endtikzpicture
          enddocument


          enter image description here



          ADDENDUM: In an attempt to make Ryan Reich a bit happy, here is a version in which you only have to specify the nonempty entries of this sparse array. These entries are determined by the list 6/1/1,6/2/2,6/5/widehatN,... , where each entry has the structure <X>/<Y>/<entry> with X and Y specifying the position. Notice that one could shorten this further if you really have only one type of columns, but the point here is to allow to build arbitrary sparse matrices of that type. This code uses this answer.



          documentclassarticle
          usepackagetikz
          usetikzlibrarymatrix,calc
          usepackageetoolbox
          tikzset% https://tex.stackexchange.com/a/156990/121799
          dots/.style args=#1per #2%
          line cap=round,
          dash pattern=on 0 off #2/#1


          begindocument
          edefmylist6/1/1,6/2/2,6/5/widehatN,%
          5/6/widehatN,5/9/2,5/10/1,%
          11/6/1,11/7/2,11/10/widehatN,%
          10/11/widehatN,10/12/2,10/15/1,%
          16/11/1,16/12/2,16/15/widehatN,%
          20/21/widehatN,20/22/2,20/25/1%

          begintikzpicture
          letmymatrixcontentempty
          foreach Y in 1,...,25%
          foreach X in 1,...,25
          xdeftmp
          foreach XX/YY/ZZ in mylist
          ifnumXX=X
          ifnumYY=Y
          xdeftmpZZ
          fi
          fi
          ifnumX=25
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace\%
          else
          expandaftergapptoexpandaftermymatrixcontentexpandaftertmpspace&space%
          fi


          matrix [matrix of math nodes,ampersand replacement=&,left delimiter=(,
          right delimiter=),draw,row sep=3pt] (mat)
          mymatrixcontent
          ;
          foreach X [evaluate=X as Y using int(X+1)]in 5,10,...,20
          aux1) -- (mat.south -
          foreach X/Y [evaluate=Y as Z using int(Y+3)] in
          6/2,5/6,11/7,10/12,16/12,20/22
          draw[very thick, dots=8 per 1cm,shorten >=3pt,shorten <=3pt]
          (mat-Y-X) -- (mat-Z-X);
          draw[line width=1.2mm, dots=4 per 1cm]
          (mat-16-18.center) -- (mat-18-20.center)
          (mat-18-16.center) -- (mat-20-18.center);
          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 19 at 5:10

























          answered Nov 18 at 22:11









          marmot

          77.1k487162




          77.1k487162











          • I don't want to be a jerk, but filling a page with ampersands that require careful counting is not a very helpful answer.
            – Ryan Reich
            Nov 19 at 1:06










          • @RyanReich Are you really typing them one by one? If so, then I agree. But of course if you just do copy and paste, then it is not that cumbersome. Well, and if you like phantoms better (and make sure that none of the entries exceeds the size of those), I'd say this is a matter of taste, but otherwise it is a bit nontrivial to bet things aligned across different blocks. So that is just to say that I definitely did not have to count here.
            – marmot
            Nov 19 at 2:16






          • 1




            What if I make a mistake? What if I need to make a change? There may technically be a programmatic avenue into this gigantic expression but it's fragile and not apparent on the finished product. It doesn't say what it does, it just is.
            – Ryan Reich
            Nov 19 at 3:48










          • @RyanReich If you make a mistake, you will not get what you want. However, this is not specific to this matrix. You seem not to like this answer, which is fine. However, I do not really see the purpose of your comments. I believe to have told you why I did what I did. If you have a better solution post it. (And yes, I do now how to typeset a matrix programmatically. Do you want me to post such a solution? The OP has already made her choice...) And yes, the matrix is gigantic.
            – marmot
            Nov 19 at 3:57










          • @RyanReich In an attempt to remove the tension in our exchange of opinions, I added a version in which you only need to specify the nontrivial entries.
            – marmot
            Nov 19 at 5:11
















          • I don't want to be a jerk, but filling a page with ampersands that require careful counting is not a very helpful answer.
            – Ryan Reich
            Nov 19 at 1:06










          • @RyanReich Are you really typing them one by one? If so, then I agree. But of course if you just do copy and paste, then it is not that cumbersome. Well, and if you like phantoms better (and make sure that none of the entries exceeds the size of those), I'd say this is a matter of taste, but otherwise it is a bit nontrivial to bet things aligned across different blocks. So that is just to say that I definitely did not have to count here.
            – marmot
            Nov 19 at 2:16






          • 1




            What if I make a mistake? What if I need to make a change? There may technically be a programmatic avenue into this gigantic expression but it's fragile and not apparent on the finished product. It doesn't say what it does, it just is.
            – Ryan Reich
            Nov 19 at 3:48










          • @RyanReich If you make a mistake, you will not get what you want. However, this is not specific to this matrix. You seem not to like this answer, which is fine. However, I do not really see the purpose of your comments. I believe to have told you why I did what I did. If you have a better solution post it. (And yes, I do now how to typeset a matrix programmatically. Do you want me to post such a solution? The OP has already made her choice...) And yes, the matrix is gigantic.
            – marmot
            Nov 19 at 3:57










          • @RyanReich In an attempt to remove the tension in our exchange of opinions, I added a version in which you only need to specify the nontrivial entries.
            – marmot
            Nov 19 at 5:11















          I don't want to be a jerk, but filling a page with ampersands that require careful counting is not a very helpful answer.
          – Ryan Reich
          Nov 19 at 1:06




          I don't want to be a jerk, but filling a page with ampersands that require careful counting is not a very helpful answer.
          – Ryan Reich
          Nov 19 at 1:06












          @RyanReich Are you really typing them one by one? If so, then I agree. But of course if you just do copy and paste, then it is not that cumbersome. Well, and if you like phantoms better (and make sure that none of the entries exceeds the size of those), I'd say this is a matter of taste, but otherwise it is a bit nontrivial to bet things aligned across different blocks. So that is just to say that I definitely did not have to count here.
          – marmot
          Nov 19 at 2:16




          @RyanReich Are you really typing them one by one? If so, then I agree. But of course if you just do copy and paste, then it is not that cumbersome. Well, and if you like phantoms better (and make sure that none of the entries exceeds the size of those), I'd say this is a matter of taste, but otherwise it is a bit nontrivial to bet things aligned across different blocks. So that is just to say that I definitely did not have to count here.
          – marmot
          Nov 19 at 2:16




          1




          1




          What if I make a mistake? What if I need to make a change? There may technically be a programmatic avenue into this gigantic expression but it's fragile and not apparent on the finished product. It doesn't say what it does, it just is.
          – Ryan Reich
          Nov 19 at 3:48




          What if I make a mistake? What if I need to make a change? There may technically be a programmatic avenue into this gigantic expression but it's fragile and not apparent on the finished product. It doesn't say what it does, it just is.
          – Ryan Reich
          Nov 19 at 3:48












          @RyanReich If you make a mistake, you will not get what you want. However, this is not specific to this matrix. You seem not to like this answer, which is fine. However, I do not really see the purpose of your comments. I believe to have told you why I did what I did. If you have a better solution post it. (And yes, I do now how to typeset a matrix programmatically. Do you want me to post such a solution? The OP has already made her choice...) And yes, the matrix is gigantic.
          – marmot
          Nov 19 at 3:57




          @RyanReich If you make a mistake, you will not get what you want. However, this is not specific to this matrix. You seem not to like this answer, which is fine. However, I do not really see the purpose of your comments. I believe to have told you why I did what I did. If you have a better solution post it. (And yes, I do now how to typeset a matrix programmatically. Do you want me to post such a solution? The OP has already made her choice...) And yes, the matrix is gigantic.
          – marmot
          Nov 19 at 3:57












          @RyanReich In an attempt to remove the tension in our exchange of opinions, I added a version in which you only need to specify the nontrivial entries.
          – marmot
          Nov 19 at 5:11




          @RyanReich In an attempt to remove the tension in our exchange of opinions, I added a version in which you only need to specify the nontrivial entries.
          – marmot
          Nov 19 at 5:11










          Sherry is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Sherry is a new contributor. Be nice, and check out our Code of Conduct.












          Sherry is a new contributor. Be nice, and check out our Code of Conduct.











          Sherry is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460659%2fhow-do-i-draw-the-following-matrix-in-latex%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?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay