siunitx in tabularx











up vote
2
down vote

favorite
1












I have a tabularx-table with a lot of SI values. For this, I wanted to define a new column type u which places the contents of the column into a SI{XXX}{cm} expression.



newcolumntype{u}{>{SIbegingroup}{X}<{endgroup{cm}}}


Using this in a tabularx-table throws me an "Illegal pream token X" and "invalid-token-in-number" exception. Replacing X with c leaves me with only the "invalid-token"-exception.
What can I do to make this work?










share|improve this question







New contributor




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
















  • 2




    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. In particular, please add a minimal working example (MWE) which reproduces your error.
    – CarLaTeX
    Nov 14 at 18:02















up vote
2
down vote

favorite
1












I have a tabularx-table with a lot of SI values. For this, I wanted to define a new column type u which places the contents of the column into a SI{XXX}{cm} expression.



newcolumntype{u}{>{SIbegingroup}{X}<{endgroup{cm}}}


Using this in a tabularx-table throws me an "Illegal pream token X" and "invalid-token-in-number" exception. Replacing X with c leaves me with only the "invalid-token"-exception.
What can I do to make this work?










share|improve this question







New contributor




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
















  • 2




    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. In particular, please add a minimal working example (MWE) which reproduces your error.
    – CarLaTeX
    Nov 14 at 18:02













up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





I have a tabularx-table with a lot of SI values. For this, I wanted to define a new column type u which places the contents of the column into a SI{XXX}{cm} expression.



newcolumntype{u}{>{SIbegingroup}{X}<{endgroup{cm}}}


Using this in a tabularx-table throws me an "Illegal pream token X" and "invalid-token-in-number" exception. Replacing X with c leaves me with only the "invalid-token"-exception.
What can I do to make this work?










share|improve this question







New contributor




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











I have a tabularx-table with a lot of SI values. For this, I wanted to define a new column type u which places the contents of the column into a SI{XXX}{cm} expression.



newcolumntype{u}{>{SIbegingroup}{X}<{endgroup{cm}}}


Using this in a tabularx-table throws me an "Illegal pream token X" and "invalid-token-in-number" exception. Replacing X with c leaves me with only the "invalid-token"-exception.
What can I do to make this work?







tables tabularx siunitx






share|improve this question







New contributor




KreMaster 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




KreMaster 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






New contributor




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









asked Nov 14 at 17:45









KreMaster

112




112




New contributor




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





New contributor





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






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








  • 2




    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. In particular, please add a minimal working example (MWE) which reproduces your error.
    – CarLaTeX
    Nov 14 at 18:02














  • 2




    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. In particular, please add a minimal working example (MWE) which reproduces your error.
    – CarLaTeX
    Nov 14 at 18:02








2




2




Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. In particular, please add a minimal working example (MWE) which reproduces your error.
– CarLaTeX
Nov 14 at 18:02




Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. In particular, please add a minimal working example (MWE) which reproduces your error.
– CarLaTeX
Nov 14 at 18:02










1 Answer
1






active

oldest

votes

















up vote
4
down vote













One way to do what you desire is to use the collcell package:



enter image description here



Code:



documentclass{article}
usepackage{booktabs}
usepackage{siunitx}
usepackage{collcell}

newcommand{MyCommand}[1]{SI{#1}{cm}}

newcolumntype{u}{>{collectcellMyCommand}{l}<{endcollectcell}}

begin{document}
begin{tabular}{l u}
toprule
1 inch & 2.54 \
1 meter & 100 \
bottomrule
end{tabular}
end{document}





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


    }
    });






    KreMaster 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%2f459987%2fsiunitx-in-tabularx%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    4
    down vote













    One way to do what you desire is to use the collcell package:



    enter image description here



    Code:



    documentclass{article}
    usepackage{booktabs}
    usepackage{siunitx}
    usepackage{collcell}

    newcommand{MyCommand}[1]{SI{#1}{cm}}

    newcolumntype{u}{>{collectcellMyCommand}{l}<{endcollectcell}}

    begin{document}
    begin{tabular}{l u}
    toprule
    1 inch & 2.54 \
    1 meter & 100 \
    bottomrule
    end{tabular}
    end{document}





    share|improve this answer

























      up vote
      4
      down vote













      One way to do what you desire is to use the collcell package:



      enter image description here



      Code:



      documentclass{article}
      usepackage{booktabs}
      usepackage{siunitx}
      usepackage{collcell}

      newcommand{MyCommand}[1]{SI{#1}{cm}}

      newcolumntype{u}{>{collectcellMyCommand}{l}<{endcollectcell}}

      begin{document}
      begin{tabular}{l u}
      toprule
      1 inch & 2.54 \
      1 meter & 100 \
      bottomrule
      end{tabular}
      end{document}





      share|improve this answer























        up vote
        4
        down vote










        up vote
        4
        down vote









        One way to do what you desire is to use the collcell package:



        enter image description here



        Code:



        documentclass{article}
        usepackage{booktabs}
        usepackage{siunitx}
        usepackage{collcell}

        newcommand{MyCommand}[1]{SI{#1}{cm}}

        newcolumntype{u}{>{collectcellMyCommand}{l}<{endcollectcell}}

        begin{document}
        begin{tabular}{l u}
        toprule
        1 inch & 2.54 \
        1 meter & 100 \
        bottomrule
        end{tabular}
        end{document}





        share|improve this answer












        One way to do what you desire is to use the collcell package:



        enter image description here



        Code:



        documentclass{article}
        usepackage{booktabs}
        usepackage{siunitx}
        usepackage{collcell}

        newcommand{MyCommand}[1]{SI{#1}{cm}}

        newcolumntype{u}{>{collectcellMyCommand}{l}<{endcollectcell}}

        begin{document}
        begin{tabular}{l u}
        toprule
        1 inch & 2.54 \
        1 meter & 100 \
        bottomrule
        end{tabular}
        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 at 18:21









        Peter Grill

        163k24432740




        163k24432740






















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










             

            draft saved


            draft discarded


















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













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












            KreMaster 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%2f459987%2fsiunitx-in-tabularx%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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?