Creating a number pyramid with tabularx

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











up vote
1
down vote

favorite












I am trying to create a simple number pyramid like this one using a tabularx table with six columns and `multicolumn' commands.



I tried



begintabularx0.5linewidthXXXXXX
cline3-4
multicolumn2c&multicolumn2c&multicolumn2c\
cline2-5
multicolumn1c&multicolumn2c&multicolumn2c&multicolumn1c\
hline
multicolumn2c$frac32$&multicolumn2c$frac13$&multicolumn2c$frac12$\
hline
endtabularx


.. which gives me a very distorted table.



However if I add a simple empty line to the table with



&&&&&&


everything looks perfect. My only issue now is that the table is too long, because of that extra empty line.



Is there a way to get a pretty pyramid without adding that extra line?










share|improve this question

























    up vote
    1
    down vote

    favorite












    I am trying to create a simple number pyramid like this one using a tabularx table with six columns and `multicolumn' commands.



    I tried



    begintabularx0.5linewidthXXXXXX
    cline3-4
    multicolumn2c&multicolumn2c&multicolumn2c\
    cline2-5
    multicolumn1c&multicolumn2c&multicolumn2c&multicolumn1c\
    hline
    multicolumn2c$frac32$&multicolumn2c$frac13$&multicolumn2c$frac12$\
    hline
    endtabularx


    .. which gives me a very distorted table.



    However if I add a simple empty line to the table with



    &&&&&&


    everything looks perfect. My only issue now is that the table is too long, because of that extra empty line.



    Is there a way to get a pretty pyramid without adding that extra line?










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am trying to create a simple number pyramid like this one using a tabularx table with six columns and `multicolumn' commands.



      I tried



      begintabularx0.5linewidthXXXXXX
      cline3-4
      multicolumn2c&multicolumn2c&multicolumn2c\
      cline2-5
      multicolumn1c&multicolumn2c&multicolumn2c&multicolumn1c\
      hline
      multicolumn2c$frac32$&multicolumn2c$frac13$&multicolumn2c$frac12$\
      hline
      endtabularx


      .. which gives me a very distorted table.



      However if I add a simple empty line to the table with



      &&&&&&


      everything looks perfect. My only issue now is that the table is too long, because of that extra empty line.



      Is there a way to get a pretty pyramid without adding that extra line?










      share|improve this question













      I am trying to create a simple number pyramid like this one using a tabularx table with six columns and `multicolumn' commands.



      I tried



      begintabularx0.5linewidthXXXXXX
      cline3-4
      multicolumn2c&multicolumn2c&multicolumn2c\
      cline2-5
      multicolumn1c&multicolumn2c&multicolumn2c&multicolumn1c\
      hline
      multicolumn2c$frac32$&multicolumn2c$frac13$&multicolumn2c$frac12$\
      hline
      endtabularx


      .. which gives me a very distorted table.



      However if I add a simple empty line to the table with



      &&&&&&


      everything looks perfect. My only issue now is that the table is too long, because of that extra empty line.



      Is there a way to get a pretty pyramid without adding that extra line?







      tables tabularx






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      user1583209

      25516




      25516




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote













          drawing this number pyramid is much simpler than write it as table. especially if you like to use tabularx table environment. by use of the tikz package you can obtain:



          enter image description here



          documentclass[tikz, border=3mm]standalone
          usetikzlibrarypositioning

          begindocument
          begintikzpicture[
          node distance = 0pt,
          every node/.style = draw, minimum size=7mm, inner sep=0pt, outer sep=0pt
          ]
          node (n1) ;
          %
          node (n11) [below left=of n1.south] ;
          node (n12) [right=of n11] ;
          %
          node (n21) [below left=of n11.south] $frac13$;
          node (n22) [right=of n21] $frac13$;
          node (n23) [right=of n22] $frac12$;
          endtikzpicture
          enddocument





          share|improve this answer



























            up vote
            2
            down vote













            With some low level programming:



            documentclassarticle
            usepackageamsmath
            usepackagevarwidth

            newcommandblock[1]%
            begingroup
            setlengthfboxsep0pt%
            vrule width0pt height blockdim
            ooalign%
            framebox[blockdim]rule0ptblockdimcr
            hidewidthraisebox0.5dimexprblockdim-heightraiseboxdepth#1hidewidthcr
            %
            endgroup

            newcommandjoinblocksunskipkern-fboxruleignorespaces
            newenvironmentblocks[1][1cm]
            beginvarwidthtextwidthsetlengthblockdim#1makeblocks
            endvarwidth
            newcommandmakeblocks%
            begingrouplccode`~=`&lowercaseendgrouplet~joinblocks
            catcode`&=active
            baselineskip=0pt
            lineskiplimit=maxdimen
            lineskip=0pt
            centering

            newlengthblockdim

            begindocument

            A pyramid
            beginblocks
            block1\
            block2 & block3 \
            block4 & block5 & block$dfrac366$
            endblocks
            in context

            bigskip

            A pyramid
            beginblocks[1.5cm]
            block1\
            block2 & block3 \
            block4 & block5 & block$dfrac366$
            endblocks
            in context

            enddocument


            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',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f451446%2fcreating-a-number-pyramid-with-tabularx%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote













              drawing this number pyramid is much simpler than write it as table. especially if you like to use tabularx table environment. by use of the tikz package you can obtain:



              enter image description here



              documentclass[tikz, border=3mm]standalone
              usetikzlibrarypositioning

              begindocument
              begintikzpicture[
              node distance = 0pt,
              every node/.style = draw, minimum size=7mm, inner sep=0pt, outer sep=0pt
              ]
              node (n1) ;
              %
              node (n11) [below left=of n1.south] ;
              node (n12) [right=of n11] ;
              %
              node (n21) [below left=of n11.south] $frac13$;
              node (n22) [right=of n21] $frac13$;
              node (n23) [right=of n22] $frac12$;
              endtikzpicture
              enddocument





              share|improve this answer
























                up vote
                3
                down vote













                drawing this number pyramid is much simpler than write it as table. especially if you like to use tabularx table environment. by use of the tikz package you can obtain:



                enter image description here



                documentclass[tikz, border=3mm]standalone
                usetikzlibrarypositioning

                begindocument
                begintikzpicture[
                node distance = 0pt,
                every node/.style = draw, minimum size=7mm, inner sep=0pt, outer sep=0pt
                ]
                node (n1) ;
                %
                node (n11) [below left=of n1.south] ;
                node (n12) [right=of n11] ;
                %
                node (n21) [below left=of n11.south] $frac13$;
                node (n22) [right=of n21] $frac13$;
                node (n23) [right=of n22] $frac12$;
                endtikzpicture
                enddocument





                share|improve this answer






















                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  drawing this number pyramid is much simpler than write it as table. especially if you like to use tabularx table environment. by use of the tikz package you can obtain:



                  enter image description here



                  documentclass[tikz, border=3mm]standalone
                  usetikzlibrarypositioning

                  begindocument
                  begintikzpicture[
                  node distance = 0pt,
                  every node/.style = draw, minimum size=7mm, inner sep=0pt, outer sep=0pt
                  ]
                  node (n1) ;
                  %
                  node (n11) [below left=of n1.south] ;
                  node (n12) [right=of n11] ;
                  %
                  node (n21) [below left=of n11.south] $frac13$;
                  node (n22) [right=of n21] $frac13$;
                  node (n23) [right=of n22] $frac12$;
                  endtikzpicture
                  enddocument





                  share|improve this answer












                  drawing this number pyramid is much simpler than write it as table. especially if you like to use tabularx table environment. by use of the tikz package you can obtain:



                  enter image description here



                  documentclass[tikz, border=3mm]standalone
                  usetikzlibrarypositioning

                  begindocument
                  begintikzpicture[
                  node distance = 0pt,
                  every node/.style = draw, minimum size=7mm, inner sep=0pt, outer sep=0pt
                  ]
                  node (n1) ;
                  %
                  node (n11) [below left=of n1.south] ;
                  node (n12) [right=of n11] ;
                  %
                  node (n21) [below left=of n11.south] $frac13$;
                  node (n22) [right=of n21] $frac13$;
                  node (n23) [right=of n22] $frac12$;
                  endtikzpicture
                  enddocument






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 43 mins ago









                  Zarko

                  113k861150




                  113k861150




















                      up vote
                      2
                      down vote













                      With some low level programming:



                      documentclassarticle
                      usepackageamsmath
                      usepackagevarwidth

                      newcommandblock[1]%
                      begingroup
                      setlengthfboxsep0pt%
                      vrule width0pt height blockdim
                      ooalign%
                      framebox[blockdim]rule0ptblockdimcr
                      hidewidthraisebox0.5dimexprblockdim-heightraiseboxdepth#1hidewidthcr
                      %
                      endgroup

                      newcommandjoinblocksunskipkern-fboxruleignorespaces
                      newenvironmentblocks[1][1cm]
                      beginvarwidthtextwidthsetlengthblockdim#1makeblocks
                      endvarwidth
                      newcommandmakeblocks%
                      begingrouplccode`~=`&lowercaseendgrouplet~joinblocks
                      catcode`&=active
                      baselineskip=0pt
                      lineskiplimit=maxdimen
                      lineskip=0pt
                      centering

                      newlengthblockdim

                      begindocument

                      A pyramid
                      beginblocks
                      block1\
                      block2 & block3 \
                      block4 & block5 & block$dfrac366$
                      endblocks
                      in context

                      bigskip

                      A pyramid
                      beginblocks[1.5cm]
                      block1\
                      block2 & block3 \
                      block4 & block5 & block$dfrac366$
                      endblocks
                      in context

                      enddocument


                      enter image description here






                      share|improve this answer
























                        up vote
                        2
                        down vote













                        With some low level programming:



                        documentclassarticle
                        usepackageamsmath
                        usepackagevarwidth

                        newcommandblock[1]%
                        begingroup
                        setlengthfboxsep0pt%
                        vrule width0pt height blockdim
                        ooalign%
                        framebox[blockdim]rule0ptblockdimcr
                        hidewidthraisebox0.5dimexprblockdim-heightraiseboxdepth#1hidewidthcr
                        %
                        endgroup

                        newcommandjoinblocksunskipkern-fboxruleignorespaces
                        newenvironmentblocks[1][1cm]
                        beginvarwidthtextwidthsetlengthblockdim#1makeblocks
                        endvarwidth
                        newcommandmakeblocks%
                        begingrouplccode`~=`&lowercaseendgrouplet~joinblocks
                        catcode`&=active
                        baselineskip=0pt
                        lineskiplimit=maxdimen
                        lineskip=0pt
                        centering

                        newlengthblockdim

                        begindocument

                        A pyramid
                        beginblocks
                        block1\
                        block2 & block3 \
                        block4 & block5 & block$dfrac366$
                        endblocks
                        in context

                        bigskip

                        A pyramid
                        beginblocks[1.5cm]
                        block1\
                        block2 & block3 \
                        block4 & block5 & block$dfrac366$
                        endblocks
                        in context

                        enddocument


                        enter image description here






                        share|improve this answer






















                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          With some low level programming:



                          documentclassarticle
                          usepackageamsmath
                          usepackagevarwidth

                          newcommandblock[1]%
                          begingroup
                          setlengthfboxsep0pt%
                          vrule width0pt height blockdim
                          ooalign%
                          framebox[blockdim]rule0ptblockdimcr
                          hidewidthraisebox0.5dimexprblockdim-heightraiseboxdepth#1hidewidthcr
                          %
                          endgroup

                          newcommandjoinblocksunskipkern-fboxruleignorespaces
                          newenvironmentblocks[1][1cm]
                          beginvarwidthtextwidthsetlengthblockdim#1makeblocks
                          endvarwidth
                          newcommandmakeblocks%
                          begingrouplccode`~=`&lowercaseendgrouplet~joinblocks
                          catcode`&=active
                          baselineskip=0pt
                          lineskiplimit=maxdimen
                          lineskip=0pt
                          centering

                          newlengthblockdim

                          begindocument

                          A pyramid
                          beginblocks
                          block1\
                          block2 & block3 \
                          block4 & block5 & block$dfrac366$
                          endblocks
                          in context

                          bigskip

                          A pyramid
                          beginblocks[1.5cm]
                          block1\
                          block2 & block3 \
                          block4 & block5 & block$dfrac366$
                          endblocks
                          in context

                          enddocument


                          enter image description here






                          share|improve this answer












                          With some low level programming:



                          documentclassarticle
                          usepackageamsmath
                          usepackagevarwidth

                          newcommandblock[1]%
                          begingroup
                          setlengthfboxsep0pt%
                          vrule width0pt height blockdim
                          ooalign%
                          framebox[blockdim]rule0ptblockdimcr
                          hidewidthraisebox0.5dimexprblockdim-heightraiseboxdepth#1hidewidthcr
                          %
                          endgroup

                          newcommandjoinblocksunskipkern-fboxruleignorespaces
                          newenvironmentblocks[1][1cm]
                          beginvarwidthtextwidthsetlengthblockdim#1makeblocks
                          endvarwidth
                          newcommandmakeblocks%
                          begingrouplccode`~=`&lowercaseendgrouplet~joinblocks
                          catcode`&=active
                          baselineskip=0pt
                          lineskiplimit=maxdimen
                          lineskip=0pt
                          centering

                          newlengthblockdim

                          begindocument

                          A pyramid
                          beginblocks
                          block1\
                          block2 & block3 \
                          block4 & block5 & block$dfrac366$
                          endblocks
                          in context

                          bigskip

                          A pyramid
                          beginblocks[1.5cm]
                          block1\
                          block2 & block3 \
                          block4 & block5 & block$dfrac366$
                          endblocks
                          in context

                          enddocument


                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 19 mins ago









                          egreg

                          683k8418183064




                          683k8418183064



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f451446%2fcreating-a-number-pyramid-with-tabularx%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              Installing NextGIS Connect into QGIS 3?

                              One-line joke