Hline length not filling width of the table

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











up vote
4
down vote

favorite
1












I used siunitx package to align numbers as suggested here.



documentclassarticle
usepackage[utf8]inputenc
usepackagesiunitx

titleTest
dateAugust 2018

begindocument

maketitle

sectionIntroduction

begintabularrS[table-format=8.2]
hline
True sigma used & 9.117647 \
True pixel value & 67.000000 \
hline
Pixel Value & 67.025372 \
Error & 0.025372 \
Squared Error & 0.000643 \
Predicted Sigma & 8.787887 \
Iteration Number & text87/100 \
hline
endtabular

enddocument


However, the hlines do not go well with this I guess:



enter image description here



How do I fix this? Also, how do center align 87/100 or anything that's not a number?




Update : After @egreg 's comment, I noticed that changing table-format=8.2 to table-format=8.6 or table-format=x.6 (telling it to expect 6 digits after the decimal and x before it), hline alignment is gone :) Thanks.



enter image description here



I still have centering the text issue :/










share|improve this question























  • Could you please add a compilable MWE?
    – sporc
    Aug 15 at 9:37






  • 4




    Well, you're asking to reserve space for three digits in the integral part and two for the fractional part, but then use six for the latter.
    – egreg
    Aug 15 at 9:41











  • @sporc updated the code
    – Saravanabalagi Ramachandran
    Aug 15 at 9:43











  • @egreg gotcha, thanks :)
    – Saravanabalagi Ramachandran
    Aug 15 at 9:51










  • If you want the text to be centered just change r to c: begintabularcS[table-format=8.2]
    – sporc
    Aug 15 at 10:13














up vote
4
down vote

favorite
1












I used siunitx package to align numbers as suggested here.



documentclassarticle
usepackage[utf8]inputenc
usepackagesiunitx

titleTest
dateAugust 2018

begindocument

maketitle

sectionIntroduction

begintabularrS[table-format=8.2]
hline
True sigma used & 9.117647 \
True pixel value & 67.000000 \
hline
Pixel Value & 67.025372 \
Error & 0.025372 \
Squared Error & 0.000643 \
Predicted Sigma & 8.787887 \
Iteration Number & text87/100 \
hline
endtabular

enddocument


However, the hlines do not go well with this I guess:



enter image description here



How do I fix this? Also, how do center align 87/100 or anything that's not a number?




Update : After @egreg 's comment, I noticed that changing table-format=8.2 to table-format=8.6 or table-format=x.6 (telling it to expect 6 digits after the decimal and x before it), hline alignment is gone :) Thanks.



enter image description here



I still have centering the text issue :/










share|improve this question























  • Could you please add a compilable MWE?
    – sporc
    Aug 15 at 9:37






  • 4




    Well, you're asking to reserve space for three digits in the integral part and two for the fractional part, but then use six for the latter.
    – egreg
    Aug 15 at 9:41











  • @sporc updated the code
    – Saravanabalagi Ramachandran
    Aug 15 at 9:43











  • @egreg gotcha, thanks :)
    – Saravanabalagi Ramachandran
    Aug 15 at 9:51










  • If you want the text to be centered just change r to c: begintabularcS[table-format=8.2]
    – sporc
    Aug 15 at 10:13












up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





I used siunitx package to align numbers as suggested here.



documentclassarticle
usepackage[utf8]inputenc
usepackagesiunitx

titleTest
dateAugust 2018

begindocument

maketitle

sectionIntroduction

begintabularrS[table-format=8.2]
hline
True sigma used & 9.117647 \
True pixel value & 67.000000 \
hline
Pixel Value & 67.025372 \
Error & 0.025372 \
Squared Error & 0.000643 \
Predicted Sigma & 8.787887 \
Iteration Number & text87/100 \
hline
endtabular

enddocument


However, the hlines do not go well with this I guess:



enter image description here



How do I fix this? Also, how do center align 87/100 or anything that's not a number?




Update : After @egreg 's comment, I noticed that changing table-format=8.2 to table-format=8.6 or table-format=x.6 (telling it to expect 6 digits after the decimal and x before it), hline alignment is gone :) Thanks.



enter image description here



I still have centering the text issue :/










share|improve this question















I used siunitx package to align numbers as suggested here.



documentclassarticle
usepackage[utf8]inputenc
usepackagesiunitx

titleTest
dateAugust 2018

begindocument

maketitle

sectionIntroduction

begintabularrS[table-format=8.2]
hline
True sigma used & 9.117647 \
True pixel value & 67.000000 \
hline
Pixel Value & 67.025372 \
Error & 0.025372 \
Squared Error & 0.000643 \
Predicted Sigma & 8.787887 \
Iteration Number & text87/100 \
hline
endtabular

enddocument


However, the hlines do not go well with this I guess:



enter image description here



How do I fix this? Also, how do center align 87/100 or anything that's not a number?




Update : After @egreg 's comment, I noticed that changing table-format=8.2 to table-format=8.6 or table-format=x.6 (telling it to expect 6 digits after the decimal and x before it), hline alignment is gone :) Thanks.



enter image description here



I still have centering the text issue :/







tables hhline






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 15 at 9:54

























asked Aug 15 at 9:35









Saravanabalagi Ramachandran

1235




1235











  • Could you please add a compilable MWE?
    – sporc
    Aug 15 at 9:37






  • 4




    Well, you're asking to reserve space for three digits in the integral part and two for the fractional part, but then use six for the latter.
    – egreg
    Aug 15 at 9:41











  • @sporc updated the code
    – Saravanabalagi Ramachandran
    Aug 15 at 9:43











  • @egreg gotcha, thanks :)
    – Saravanabalagi Ramachandran
    Aug 15 at 9:51










  • If you want the text to be centered just change r to c: begintabularcS[table-format=8.2]
    – sporc
    Aug 15 at 10:13
















  • Could you please add a compilable MWE?
    – sporc
    Aug 15 at 9:37






  • 4




    Well, you're asking to reserve space for three digits in the integral part and two for the fractional part, but then use six for the latter.
    – egreg
    Aug 15 at 9:41











  • @sporc updated the code
    – Saravanabalagi Ramachandran
    Aug 15 at 9:43











  • @egreg gotcha, thanks :)
    – Saravanabalagi Ramachandran
    Aug 15 at 9:51










  • If you want the text to be centered just change r to c: begintabularcS[table-format=8.2]
    – sporc
    Aug 15 at 10:13















Could you please add a compilable MWE?
– sporc
Aug 15 at 9:37




Could you please add a compilable MWE?
– sporc
Aug 15 at 9:37




4




4




Well, you're asking to reserve space for three digits in the integral part and two for the fractional part, but then use six for the latter.
– egreg
Aug 15 at 9:41





Well, you're asking to reserve space for three digits in the integral part and two for the fractional part, but then use six for the latter.
– egreg
Aug 15 at 9:41













@sporc updated the code
– Saravanabalagi Ramachandran
Aug 15 at 9:43





@sporc updated the code
– Saravanabalagi Ramachandran
Aug 15 at 9:43













@egreg gotcha, thanks :)
– Saravanabalagi Ramachandran
Aug 15 at 9:51




@egreg gotcha, thanks :)
– Saravanabalagi Ramachandran
Aug 15 at 9:51












If you want the text to be centered just change r to c: begintabularcS[table-format=8.2]
– sporc
Aug 15 at 10:13




If you want the text to be centered just change r to c: begintabularcS[table-format=8.2]
– sporc
Aug 15 at 10:13










2 Answers
2






active

oldest

votes

















up vote
4
down vote



accepted










You can center align the column by inserting a multicolumn command.



Changing the format specifier to table-format=8.6 resolves the problem with the hline lenght:



Table with correct hline



MWE:



documentclassarticle
usepackage[utf8]inputenc
usepackagesiunitx

titleTest
dateAugust 2018

begindocument

maketitle

sectionIntroduction

begintabularrS[table-format=8.6]
hline
True sigma used & 9.117647 \
True pixel value & 67.000000 \
hline
Pixel Value & 67.025372 \
Error & 0.025372 \
Squared Error & 0.000643 \
Predicted Sigma & 8.787887 \
Iteration Number & 87/100 \
hline
endtabular

enddocument


Better spacing



Changing the format specifier to table-format=2.6 removes unnecessary white space. Adding renewcommandarraystretch1.3 adds some more spacing between the row of the table:



table with better spacing



MWE:



documentclassarticle
usepackage[utf8]inputenc
usepackagesiunitx

begindocument

% for spacing in the table
renewcommandarraystretch1.3

begintabularrS[table-format=2.6]
hline
True sigma used & 9.117647 \
True pixel value & 67.000000 \
hline
Pixel Value & 67.025372 \
Error & 0.025372 \
Squared Error & 0.000643 \
Predicted Sigma & 8.787887 \
Iteration Number & 87/100 \
hline
endtabular
enddocument





share|improve this answer






















  • Why using 8.6? 2.6 should be enough. You get a lot of unnecessary white space
    – sporc
    Aug 15 at 9:58











  • @sporc In a heat wave, Tom likes white space resembling an area covered with snow. ;-)
    – Przemysław Scherwentke
    Aug 15 at 10:04










  • I did not want to change more than neccessary. Sure, it may not look very nice. But then, I also think that the line spacing is not 'nice' and I didn't change it either. But I can change it.
    – Tom
    Aug 15 at 10:09

















up vote
3
down vote













With table-format=8.2 you reserve space for 8 digits before the dot and 2 after the dot, you need to change it to table-format=2.8, but for your given numbers 2.6 is enough



documentclassarticle
usepackage[utf8]inputenc
usepackagesiunitx

titleTest
dateAugust 2018

begindocument

maketitle

sectionIntroduction

begintabularrS[table-format=2.6]
hline
True sigma used & 9.117647 \
True pixel value & 67.000000 \
hline
Pixel Value & 67.025372 \
Error & 0.025372 \
Squared Error & 0.000643 \
Predicted Sigma & 8.787887 \
Iteration Number & text87/100 \
hline
endtabular

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%2f446105%2fhline-length-not-filling-width-of-the-table%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
    4
    down vote



    accepted










    You can center align the column by inserting a multicolumn command.



    Changing the format specifier to table-format=8.6 resolves the problem with the hline lenght:



    Table with correct hline



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    titleTest
    dateAugust 2018

    begindocument

    maketitle

    sectionIntroduction

    begintabularrS[table-format=8.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular

    enddocument


    Better spacing



    Changing the format specifier to table-format=2.6 removes unnecessary white space. Adding renewcommandarraystretch1.3 adds some more spacing between the row of the table:



    table with better spacing



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    begindocument

    % for spacing in the table
    renewcommandarraystretch1.3

    begintabularrS[table-format=2.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular
    enddocument





    share|improve this answer






















    • Why using 8.6? 2.6 should be enough. You get a lot of unnecessary white space
      – sporc
      Aug 15 at 9:58











    • @sporc In a heat wave, Tom likes white space resembling an area covered with snow. ;-)
      – Przemysław Scherwentke
      Aug 15 at 10:04










    • I did not want to change more than neccessary. Sure, it may not look very nice. But then, I also think that the line spacing is not 'nice' and I didn't change it either. But I can change it.
      – Tom
      Aug 15 at 10:09














    up vote
    4
    down vote



    accepted










    You can center align the column by inserting a multicolumn command.



    Changing the format specifier to table-format=8.6 resolves the problem with the hline lenght:



    Table with correct hline



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    titleTest
    dateAugust 2018

    begindocument

    maketitle

    sectionIntroduction

    begintabularrS[table-format=8.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular

    enddocument


    Better spacing



    Changing the format specifier to table-format=2.6 removes unnecessary white space. Adding renewcommandarraystretch1.3 adds some more spacing between the row of the table:



    table with better spacing



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    begindocument

    % for spacing in the table
    renewcommandarraystretch1.3

    begintabularrS[table-format=2.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular
    enddocument





    share|improve this answer






















    • Why using 8.6? 2.6 should be enough. You get a lot of unnecessary white space
      – sporc
      Aug 15 at 9:58











    • @sporc In a heat wave, Tom likes white space resembling an area covered with snow. ;-)
      – Przemysław Scherwentke
      Aug 15 at 10:04










    • I did not want to change more than neccessary. Sure, it may not look very nice. But then, I also think that the line spacing is not 'nice' and I didn't change it either. But I can change it.
      – Tom
      Aug 15 at 10:09












    up vote
    4
    down vote



    accepted







    up vote
    4
    down vote



    accepted






    You can center align the column by inserting a multicolumn command.



    Changing the format specifier to table-format=8.6 resolves the problem with the hline lenght:



    Table with correct hline



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    titleTest
    dateAugust 2018

    begindocument

    maketitle

    sectionIntroduction

    begintabularrS[table-format=8.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular

    enddocument


    Better spacing



    Changing the format specifier to table-format=2.6 removes unnecessary white space. Adding renewcommandarraystretch1.3 adds some more spacing between the row of the table:



    table with better spacing



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    begindocument

    % for spacing in the table
    renewcommandarraystretch1.3

    begintabularrS[table-format=2.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular
    enddocument





    share|improve this answer














    You can center align the column by inserting a multicolumn command.



    Changing the format specifier to table-format=8.6 resolves the problem with the hline lenght:



    Table with correct hline



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    titleTest
    dateAugust 2018

    begindocument

    maketitle

    sectionIntroduction

    begintabularrS[table-format=8.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular

    enddocument


    Better spacing



    Changing the format specifier to table-format=2.6 removes unnecessary white space. Adding renewcommandarraystretch1.3 adds some more spacing between the row of the table:



    table with better spacing



    MWE:



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    begindocument

    % for spacing in the table
    renewcommandarraystretch1.3

    begintabularrS[table-format=2.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & 87/100 \
    hline
    endtabular
    enddocument






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 15 at 11:26

























    answered Aug 15 at 9:52









    Tom

    906115




    906115











    • Why using 8.6? 2.6 should be enough. You get a lot of unnecessary white space
      – sporc
      Aug 15 at 9:58











    • @sporc In a heat wave, Tom likes white space resembling an area covered with snow. ;-)
      – Przemysław Scherwentke
      Aug 15 at 10:04










    • I did not want to change more than neccessary. Sure, it may not look very nice. But then, I also think that the line spacing is not 'nice' and I didn't change it either. But I can change it.
      – Tom
      Aug 15 at 10:09
















    • Why using 8.6? 2.6 should be enough. You get a lot of unnecessary white space
      – sporc
      Aug 15 at 9:58











    • @sporc In a heat wave, Tom likes white space resembling an area covered with snow. ;-)
      – Przemysław Scherwentke
      Aug 15 at 10:04










    • I did not want to change more than neccessary. Sure, it may not look very nice. But then, I also think that the line spacing is not 'nice' and I didn't change it either. But I can change it.
      – Tom
      Aug 15 at 10:09















    Why using 8.6? 2.6 should be enough. You get a lot of unnecessary white space
    – sporc
    Aug 15 at 9:58





    Why using 8.6? 2.6 should be enough. You get a lot of unnecessary white space
    – sporc
    Aug 15 at 9:58













    @sporc In a heat wave, Tom likes white space resembling an area covered with snow. ;-)
    – Przemysław Scherwentke
    Aug 15 at 10:04




    @sporc In a heat wave, Tom likes white space resembling an area covered with snow. ;-)
    – Przemysław Scherwentke
    Aug 15 at 10:04












    I did not want to change more than neccessary. Sure, it may not look very nice. But then, I also think that the line spacing is not 'nice' and I didn't change it either. But I can change it.
    – Tom
    Aug 15 at 10:09




    I did not want to change more than neccessary. Sure, it may not look very nice. But then, I also think that the line spacing is not 'nice' and I didn't change it either. But I can change it.
    – Tom
    Aug 15 at 10:09










    up vote
    3
    down vote













    With table-format=8.2 you reserve space for 8 digits before the dot and 2 after the dot, you need to change it to table-format=2.8, but for your given numbers 2.6 is enough



    documentclassarticle
    usepackage[utf8]inputenc
    usepackagesiunitx

    titleTest
    dateAugust 2018

    begindocument

    maketitle

    sectionIntroduction

    begintabularrS[table-format=2.6]
    hline
    True sigma used & 9.117647 \
    True pixel value & 67.000000 \
    hline
    Pixel Value & 67.025372 \
    Error & 0.025372 \
    Squared Error & 0.000643 \
    Predicted Sigma & 8.787887 \
    Iteration Number & text87/100 \
    hline
    endtabular

    enddocument


    enter image description here






    share|improve this answer
























      up vote
      3
      down vote













      With table-format=8.2 you reserve space for 8 digits before the dot and 2 after the dot, you need to change it to table-format=2.8, but for your given numbers 2.6 is enough



      documentclassarticle
      usepackage[utf8]inputenc
      usepackagesiunitx

      titleTest
      dateAugust 2018

      begindocument

      maketitle

      sectionIntroduction

      begintabularrS[table-format=2.6]
      hline
      True sigma used & 9.117647 \
      True pixel value & 67.000000 \
      hline
      Pixel Value & 67.025372 \
      Error & 0.025372 \
      Squared Error & 0.000643 \
      Predicted Sigma & 8.787887 \
      Iteration Number & text87/100 \
      hline
      endtabular

      enddocument


      enter image description here






      share|improve this answer






















        up vote
        3
        down vote










        up vote
        3
        down vote









        With table-format=8.2 you reserve space for 8 digits before the dot and 2 after the dot, you need to change it to table-format=2.8, but for your given numbers 2.6 is enough



        documentclassarticle
        usepackage[utf8]inputenc
        usepackagesiunitx

        titleTest
        dateAugust 2018

        begindocument

        maketitle

        sectionIntroduction

        begintabularrS[table-format=2.6]
        hline
        True sigma used & 9.117647 \
        True pixel value & 67.000000 \
        hline
        Pixel Value & 67.025372 \
        Error & 0.025372 \
        Squared Error & 0.000643 \
        Predicted Sigma & 8.787887 \
        Iteration Number & text87/100 \
        hline
        endtabular

        enddocument


        enter image description here






        share|improve this answer












        With table-format=8.2 you reserve space for 8 digits before the dot and 2 after the dot, you need to change it to table-format=2.8, but for your given numbers 2.6 is enough



        documentclassarticle
        usepackage[utf8]inputenc
        usepackagesiunitx

        titleTest
        dateAugust 2018

        begindocument

        maketitle

        sectionIntroduction

        begintabularrS[table-format=2.6]
        hline
        True sigma used & 9.117647 \
        True pixel value & 67.000000 \
        hline
        Pixel Value & 67.025372 \
        Error & 0.025372 \
        Squared Error & 0.000643 \
        Predicted Sigma & 8.787887 \
        Iteration Number & text87/100 \
        hline
        endtabular

        enddocument


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 15 at 9:53









        sporc

        473214




        473214



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f446105%2fhline-length-not-filling-width-of-the-table%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

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

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?