Horizontal alignment in table with siunitx package

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











up vote
1
down vote

favorite












I'm doing some tables but I can't find the right alignment using siunitx. I believe that the first and last column numbers should be more to the left and the second column numbers more to the right. I can't find a way to adjust this.



Here is a minimum working example:



documentclassarticle

usepackagebooktabs
usepackagesiunitx

begindocument

begintable[ht]
centering
begintabularSSS
toprule
Coefficient & Iterations & Spectral condition\midrule
1e0 & 112 & 2e3 \
1e-2 & 768 & 1.7e4 \
1e-4 & 2961 & 3.8e5 \
1e-6 & 7760 & 3.7e7 \
bottomrule
endtabular
captionFirst experiment.
labeltab:firstexperiment
endtable%

enddocument


It looks like the first table, but I want it to look like the table below.










share|improve this question



















  • 1




    Your column heads (in S columns) should simply be between braces – text should be removed.
    – Bernard
    2 hours ago










  • Thanks, I fixed it. It doesn't change alignment.
    – Migue
    2 hours ago














up vote
1
down vote

favorite












I'm doing some tables but I can't find the right alignment using siunitx. I believe that the first and last column numbers should be more to the left and the second column numbers more to the right. I can't find a way to adjust this.



Here is a minimum working example:



documentclassarticle

usepackagebooktabs
usepackagesiunitx

begindocument

begintable[ht]
centering
begintabularSSS
toprule
Coefficient & Iterations & Spectral condition\midrule
1e0 & 112 & 2e3 \
1e-2 & 768 & 1.7e4 \
1e-4 & 2961 & 3.8e5 \
1e-6 & 7760 & 3.7e7 \
bottomrule
endtabular
captionFirst experiment.
labeltab:firstexperiment
endtable%

enddocument


It looks like the first table, but I want it to look like the table below.










share|improve this question



















  • 1




    Your column heads (in S columns) should simply be between braces – text should be removed.
    – Bernard
    2 hours ago










  • Thanks, I fixed it. It doesn't change alignment.
    – Migue
    2 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm doing some tables but I can't find the right alignment using siunitx. I believe that the first and last column numbers should be more to the left and the second column numbers more to the right. I can't find a way to adjust this.



Here is a minimum working example:



documentclassarticle

usepackagebooktabs
usepackagesiunitx

begindocument

begintable[ht]
centering
begintabularSSS
toprule
Coefficient & Iterations & Spectral condition\midrule
1e0 & 112 & 2e3 \
1e-2 & 768 & 1.7e4 \
1e-4 & 2961 & 3.8e5 \
1e-6 & 7760 & 3.7e7 \
bottomrule
endtabular
captionFirst experiment.
labeltab:firstexperiment
endtable%

enddocument


It looks like the first table, but I want it to look like the table below.










share|improve this question















I'm doing some tables but I can't find the right alignment using siunitx. I believe that the first and last column numbers should be more to the left and the second column numbers more to the right. I can't find a way to adjust this.



Here is a minimum working example:



documentclassarticle

usepackagebooktabs
usepackagesiunitx

begindocument

begintable[ht]
centering
begintabularSSS
toprule
Coefficient & Iterations & Spectral condition\midrule
1e0 & 112 & 2e3 \
1e-2 & 768 & 1.7e4 \
1e-4 & 2961 & 3.8e5 \
1e-6 & 7760 & 3.7e7 \
bottomrule
endtabular
captionFirst experiment.
labeltab:firstexperiment
endtable%

enddocument


It looks like the first table, but I want it to look like the table below.







tables horizontal-alignment siunitx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago

























asked 2 hours ago









Migue

1839




1839







  • 1




    Your column heads (in S columns) should simply be between braces – text should be removed.
    – Bernard
    2 hours ago










  • Thanks, I fixed it. It doesn't change alignment.
    – Migue
    2 hours ago












  • 1




    Your column heads (in S columns) should simply be between braces – text should be removed.
    – Bernard
    2 hours ago










  • Thanks, I fixed it. It doesn't change alignment.
    – Migue
    2 hours ago







1




1




Your column heads (in S columns) should simply be between braces – text should be removed.
– Bernard
2 hours ago




Your column heads (in S columns) should simply be between braces – text should be removed.
– Bernard
2 hours ago












Thanks, I fixed it. It doesn't change alignment.
– Migue
2 hours ago




Thanks, I fixed it. It doesn't change alignment.
– Migue
2 hours ago










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










Centring heads in S columns depends on the formats of the numbers in the column, so I specified the format in each column. Does this code produce what you want?



documentclassarticle

usepackagebooktabs
usepackagesiunitx

begindocument


begintable[!htb]
centeringsisetuptable-number-alignment=center
begintabularS[table-format=1e-1]S[table-format=4.0]S[table-format=1.1e1]
toprule
Coefficient & Iterations & Spectral condition\midrule
1e0 & 112 & 2e3 \
1e-2 & 768 & 1.7e4 \
1e-4 & 2961 & 3.8e5 \
1e-6 & 7760 & 3.7e7 \
bottomrule
endtabular
captionFirst experiment.
labeltab:firstexperiment
endtable%

enddocument


enter image description here






share|improve this answer





























    up vote
    1
    down vote













    Welcome to TeX.SE! It is not too surprising that the alignment is not what you want since you are using the S column also for the headers. There are certainly more advanced options (there seems to be an almost infinite number of options when it comes to design tables, the pgfmanual is short in comparison), but to very first approximation I'd do



    documentclassarticle

    usepackagebooktabs
    usepackagesiunitx

    begindocument

    begintable[ht]
    centering
    begintabularSSS
    toprule
    multicolumn1rCoefficient & multicolumn1lIterations & multicolumn1rSpectral condition\
    midrule
    1e0 & 112 & 2e3 \
    1e-2 & 768 & 1.7e4 \
    1e-4 & 2961 & 3.8e5 \
    1e-6 & 7760 & 3.7e7 \
    bottomrule
    endtabular
    captionFirst experiment.
    labeltab:firstexperiment
    endtable%
    enddocument


    enter image description here






    share|improve this answer




















    • Thanks, the first column looks better. But sadly multicolumn doesn't seem to fix the second and third column alignment.
      – Migue
      2 hours ago






    • 1




      @Migue Without a crystal ball it is impossible to guess what you want. If you make a details description of what you want to achieve I will have a look at it (but only in a few hours, will be leaving know).
      – marmot
      2 hours ago










    • I added an image that might clarify things.
      – Migue
      2 hours ago










    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%2f454296%2fhorizontal-alignment-in-table-with-siunitx-package%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
    1
    down vote



    accepted










    Centring heads in S columns depends on the formats of the numbers in the column, so I specified the format in each column. Does this code produce what you want?



    documentclassarticle

    usepackagebooktabs
    usepackagesiunitx

    begindocument


    begintable[!htb]
    centeringsisetuptable-number-alignment=center
    begintabularS[table-format=1e-1]S[table-format=4.0]S[table-format=1.1e1]
    toprule
    Coefficient & Iterations & Spectral condition\midrule
    1e0 & 112 & 2e3 \
    1e-2 & 768 & 1.7e4 \
    1e-4 & 2961 & 3.8e5 \
    1e-6 & 7760 & 3.7e7 \
    bottomrule
    endtabular
    captionFirst experiment.
    labeltab:firstexperiment
    endtable%

    enddocument


    enter image description here






    share|improve this answer


























      up vote
      1
      down vote



      accepted










      Centring heads in S columns depends on the formats of the numbers in the column, so I specified the format in each column. Does this code produce what you want?



      documentclassarticle

      usepackagebooktabs
      usepackagesiunitx

      begindocument


      begintable[!htb]
      centeringsisetuptable-number-alignment=center
      begintabularS[table-format=1e-1]S[table-format=4.0]S[table-format=1.1e1]
      toprule
      Coefficient & Iterations & Spectral condition\midrule
      1e0 & 112 & 2e3 \
      1e-2 & 768 & 1.7e4 \
      1e-4 & 2961 & 3.8e5 \
      1e-6 & 7760 & 3.7e7 \
      bottomrule
      endtabular
      captionFirst experiment.
      labeltab:firstexperiment
      endtable%

      enddocument


      enter image description here






      share|improve this answer
























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        Centring heads in S columns depends on the formats of the numbers in the column, so I specified the format in each column. Does this code produce what you want?



        documentclassarticle

        usepackagebooktabs
        usepackagesiunitx

        begindocument


        begintable[!htb]
        centeringsisetuptable-number-alignment=center
        begintabularS[table-format=1e-1]S[table-format=4.0]S[table-format=1.1e1]
        toprule
        Coefficient & Iterations & Spectral condition\midrule
        1e0 & 112 & 2e3 \
        1e-2 & 768 & 1.7e4 \
        1e-4 & 2961 & 3.8e5 \
        1e-6 & 7760 & 3.7e7 \
        bottomrule
        endtabular
        captionFirst experiment.
        labeltab:firstexperiment
        endtable%

        enddocument


        enter image description here






        share|improve this answer














        Centring heads in S columns depends on the formats of the numbers in the column, so I specified the format in each column. Does this code produce what you want?



        documentclassarticle

        usepackagebooktabs
        usepackagesiunitx

        begindocument


        begintable[!htb]
        centeringsisetuptable-number-alignment=center
        begintabularS[table-format=1e-1]S[table-format=4.0]S[table-format=1.1e1]
        toprule
        Coefficient & Iterations & Spectral condition\midrule
        1e0 & 112 & 2e3 \
        1e-2 & 768 & 1.7e4 \
        1e-4 & 2961 & 3.8e5 \
        1e-6 & 7760 & 3.7e7 \
        bottomrule
        endtabular
        captionFirst experiment.
        labeltab:firstexperiment
        endtable%

        enddocument


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago

























        answered 2 hours ago









        Bernard

        158k764190




        158k764190




















            up vote
            1
            down vote













            Welcome to TeX.SE! It is not too surprising that the alignment is not what you want since you are using the S column also for the headers. There are certainly more advanced options (there seems to be an almost infinite number of options when it comes to design tables, the pgfmanual is short in comparison), but to very first approximation I'd do



            documentclassarticle

            usepackagebooktabs
            usepackagesiunitx

            begindocument

            begintable[ht]
            centering
            begintabularSSS
            toprule
            multicolumn1rCoefficient & multicolumn1lIterations & multicolumn1rSpectral condition\
            midrule
            1e0 & 112 & 2e3 \
            1e-2 & 768 & 1.7e4 \
            1e-4 & 2961 & 3.8e5 \
            1e-6 & 7760 & 3.7e7 \
            bottomrule
            endtabular
            captionFirst experiment.
            labeltab:firstexperiment
            endtable%
            enddocument


            enter image description here






            share|improve this answer




















            • Thanks, the first column looks better. But sadly multicolumn doesn't seem to fix the second and third column alignment.
              – Migue
              2 hours ago






            • 1




              @Migue Without a crystal ball it is impossible to guess what you want. If you make a details description of what you want to achieve I will have a look at it (but only in a few hours, will be leaving know).
              – marmot
              2 hours ago










            • I added an image that might clarify things.
              – Migue
              2 hours ago














            up vote
            1
            down vote













            Welcome to TeX.SE! It is not too surprising that the alignment is not what you want since you are using the S column also for the headers. There are certainly more advanced options (there seems to be an almost infinite number of options when it comes to design tables, the pgfmanual is short in comparison), but to very first approximation I'd do



            documentclassarticle

            usepackagebooktabs
            usepackagesiunitx

            begindocument

            begintable[ht]
            centering
            begintabularSSS
            toprule
            multicolumn1rCoefficient & multicolumn1lIterations & multicolumn1rSpectral condition\
            midrule
            1e0 & 112 & 2e3 \
            1e-2 & 768 & 1.7e4 \
            1e-4 & 2961 & 3.8e5 \
            1e-6 & 7760 & 3.7e7 \
            bottomrule
            endtabular
            captionFirst experiment.
            labeltab:firstexperiment
            endtable%
            enddocument


            enter image description here






            share|improve this answer




















            • Thanks, the first column looks better. But sadly multicolumn doesn't seem to fix the second and third column alignment.
              – Migue
              2 hours ago






            • 1




              @Migue Without a crystal ball it is impossible to guess what you want. If you make a details description of what you want to achieve I will have a look at it (but only in a few hours, will be leaving know).
              – marmot
              2 hours ago










            • I added an image that might clarify things.
              – Migue
              2 hours ago












            up vote
            1
            down vote










            up vote
            1
            down vote









            Welcome to TeX.SE! It is not too surprising that the alignment is not what you want since you are using the S column also for the headers. There are certainly more advanced options (there seems to be an almost infinite number of options when it comes to design tables, the pgfmanual is short in comparison), but to very first approximation I'd do



            documentclassarticle

            usepackagebooktabs
            usepackagesiunitx

            begindocument

            begintable[ht]
            centering
            begintabularSSS
            toprule
            multicolumn1rCoefficient & multicolumn1lIterations & multicolumn1rSpectral condition\
            midrule
            1e0 & 112 & 2e3 \
            1e-2 & 768 & 1.7e4 \
            1e-4 & 2961 & 3.8e5 \
            1e-6 & 7760 & 3.7e7 \
            bottomrule
            endtabular
            captionFirst experiment.
            labeltab:firstexperiment
            endtable%
            enddocument


            enter image description here






            share|improve this answer












            Welcome to TeX.SE! It is not too surprising that the alignment is not what you want since you are using the S column also for the headers. There are certainly more advanced options (there seems to be an almost infinite number of options when it comes to design tables, the pgfmanual is short in comparison), but to very first approximation I'd do



            documentclassarticle

            usepackagebooktabs
            usepackagesiunitx

            begindocument

            begintable[ht]
            centering
            begintabularSSS
            toprule
            multicolumn1rCoefficient & multicolumn1lIterations & multicolumn1rSpectral condition\
            midrule
            1e0 & 112 & 2e3 \
            1e-2 & 768 & 1.7e4 \
            1e-4 & 2961 & 3.8e5 \
            1e-6 & 7760 & 3.7e7 \
            bottomrule
            endtabular
            captionFirst experiment.
            labeltab:firstexperiment
            endtable%
            enddocument


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 hours ago









            marmot

            63.5k468136




            63.5k468136











            • Thanks, the first column looks better. But sadly multicolumn doesn't seem to fix the second and third column alignment.
              – Migue
              2 hours ago






            • 1




              @Migue Without a crystal ball it is impossible to guess what you want. If you make a details description of what you want to achieve I will have a look at it (but only in a few hours, will be leaving know).
              – marmot
              2 hours ago










            • I added an image that might clarify things.
              – Migue
              2 hours ago
















            • Thanks, the first column looks better. But sadly multicolumn doesn't seem to fix the second and third column alignment.
              – Migue
              2 hours ago






            • 1




              @Migue Without a crystal ball it is impossible to guess what you want. If you make a details description of what you want to achieve I will have a look at it (but only in a few hours, will be leaving know).
              – marmot
              2 hours ago










            • I added an image that might clarify things.
              – Migue
              2 hours ago















            Thanks, the first column looks better. But sadly multicolumn doesn't seem to fix the second and third column alignment.
            – Migue
            2 hours ago




            Thanks, the first column looks better. But sadly multicolumn doesn't seem to fix the second and third column alignment.
            – Migue
            2 hours ago




            1




            1




            @Migue Without a crystal ball it is impossible to guess what you want. If you make a details description of what you want to achieve I will have a look at it (but only in a few hours, will be leaving know).
            – marmot
            2 hours ago




            @Migue Without a crystal ball it is impossible to guess what you want. If you make a details description of what you want to achieve I will have a look at it (but only in a few hours, will be leaving know).
            – marmot
            2 hours ago












            I added an image that might clarify things.
            – Migue
            2 hours ago




            I added an image that might clarify things.
            – Migue
            2 hours ago

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454296%2fhorizontal-alignment-in-table-with-siunitx-package%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery