Change column specification for single specific cells












2















Say I have a table with some data, a header row and a summary. The table has specific column specifications, like below



documentclass{article}

setlengthparskip{1em}
begin{document}
% Consider this table:
begin{tabular}{l@{~--~}l}%<- Makes a dash between columns
NODASH1 & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
Sum & NODASH!
end{tabular}

Below, a possible workaround that I don't really fancy

defnodash#1{multicolumn{1}{l}{#1}}
% Now using the nodash to remove the dashes that I don't want
begin{tabular}{l@{~--~}l}
nodash{NODASH1} & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
nodash{Sum} & NODASH!
end{tabular}

end{document}


Which produces the following output:
enter image description here



So I'm looking for a more canonical way to produce the bottom table.
Any ideas?










share|improve this question




















  • 2





    Your write-up and code are slightly confusing. E.g., what is the purpose of the third column in both tabular environments?

    – Mico
    yesterday











  • @Mico yup - that was very confusing, and there wasn't supposed to be a third column! Is it clear now?

    – Andreas Storvik Strauman
    yesterday











  • Another issue with your posting is that the title contains the qualifier "for only one single row". However, a careful reading of your posting suggests that you actually wish to change the column specification for two cells, not for one row. You may want to edit your posting to eliminate the need for people to guess as to what you really want to achieve...

    – Mico
    yesterday
















2















Say I have a table with some data, a header row and a summary. The table has specific column specifications, like below



documentclass{article}

setlengthparskip{1em}
begin{document}
% Consider this table:
begin{tabular}{l@{~--~}l}%<- Makes a dash between columns
NODASH1 & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
Sum & NODASH!
end{tabular}

Below, a possible workaround that I don't really fancy

defnodash#1{multicolumn{1}{l}{#1}}
% Now using the nodash to remove the dashes that I don't want
begin{tabular}{l@{~--~}l}
nodash{NODASH1} & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
nodash{Sum} & NODASH!
end{tabular}

end{document}


Which produces the following output:
enter image description here



So I'm looking for a more canonical way to produce the bottom table.
Any ideas?










share|improve this question




















  • 2





    Your write-up and code are slightly confusing. E.g., what is the purpose of the third column in both tabular environments?

    – Mico
    yesterday











  • @Mico yup - that was very confusing, and there wasn't supposed to be a third column! Is it clear now?

    – Andreas Storvik Strauman
    yesterday











  • Another issue with your posting is that the title contains the qualifier "for only one single row". However, a careful reading of your posting suggests that you actually wish to change the column specification for two cells, not for one row. You may want to edit your posting to eliminate the need for people to guess as to what you really want to achieve...

    – Mico
    yesterday














2












2








2








Say I have a table with some data, a header row and a summary. The table has specific column specifications, like below



documentclass{article}

setlengthparskip{1em}
begin{document}
% Consider this table:
begin{tabular}{l@{~--~}l}%<- Makes a dash between columns
NODASH1 & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
Sum & NODASH!
end{tabular}

Below, a possible workaround that I don't really fancy

defnodash#1{multicolumn{1}{l}{#1}}
% Now using the nodash to remove the dashes that I don't want
begin{tabular}{l@{~--~}l}
nodash{NODASH1} & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
nodash{Sum} & NODASH!
end{tabular}

end{document}


Which produces the following output:
enter image description here



So I'm looking for a more canonical way to produce the bottom table.
Any ideas?










share|improve this question
















Say I have a table with some data, a header row and a summary. The table has specific column specifications, like below



documentclass{article}

setlengthparskip{1em}
begin{document}
% Consider this table:
begin{tabular}{l@{~--~}l}%<- Makes a dash between columns
NODASH1 & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
Sum & NODASH!
end{tabular}

Below, a possible workaround that I don't really fancy

defnodash#1{multicolumn{1}{l}{#1}}
% Now using the nodash to remove the dashes that I don't want
begin{tabular}{l@{~--~}l}
nodash{NODASH1} & NODASH2 \hline
beforedash & afterdash \
beforedash & afterdash \hline
nodash{Sum} & NODASH!
end{tabular}

end{document}


Which produces the following output:
enter image description here



So I'm looking for a more canonical way to produce the bottom table.
Any ideas?







tables multicolumn columns






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







Andreas Storvik Strauman

















asked yesterday









Andreas Storvik StraumanAndreas Storvik Strauman

2,612418




2,612418








  • 2





    Your write-up and code are slightly confusing. E.g., what is the purpose of the third column in both tabular environments?

    – Mico
    yesterday











  • @Mico yup - that was very confusing, and there wasn't supposed to be a third column! Is it clear now?

    – Andreas Storvik Strauman
    yesterday











  • Another issue with your posting is that the title contains the qualifier "for only one single row". However, a careful reading of your posting suggests that you actually wish to change the column specification for two cells, not for one row. You may want to edit your posting to eliminate the need for people to guess as to what you really want to achieve...

    – Mico
    yesterday














  • 2





    Your write-up and code are slightly confusing. E.g., what is the purpose of the third column in both tabular environments?

    – Mico
    yesterday











  • @Mico yup - that was very confusing, and there wasn't supposed to be a third column! Is it clear now?

    – Andreas Storvik Strauman
    yesterday











  • Another issue with your posting is that the title contains the qualifier "for only one single row". However, a careful reading of your posting suggests that you actually wish to change the column specification for two cells, not for one row. You may want to edit your posting to eliminate the need for people to guess as to what you really want to achieve...

    – Mico
    yesterday








2




2





Your write-up and code are slightly confusing. E.g., what is the purpose of the third column in both tabular environments?

– Mico
yesterday





Your write-up and code are slightly confusing. E.g., what is the purpose of the third column in both tabular environments?

– Mico
yesterday













@Mico yup - that was very confusing, and there wasn't supposed to be a third column! Is it clear now?

– Andreas Storvik Strauman
yesterday





@Mico yup - that was very confusing, and there wasn't supposed to be a third column! Is it clear now?

– Andreas Storvik Strauman
yesterday













Another issue with your posting is that the title contains the qualifier "for only one single row". However, a careful reading of your posting suggests that you actually wish to change the column specification for two cells, not for one row. You may want to edit your posting to eliminate the need for people to guess as to what you really want to achieve...

– Mico
yesterday





Another issue with your posting is that the title contains the qualifier "for only one single row". However, a careful reading of your posting suggests that you actually wish to change the column specification for two cells, not for one row. You may want to edit your posting to eliminate the need for people to guess as to what you really want to achieve...

– Mico
yesterday










1 Answer
1






active

oldest

votes


















3














Using multicolumn{1} is the intended interface to specifying a different layout for heading or other rows. Note that you can get away with the simple



multicolumn{1}{l}{...}


here as it is a left-aligned column.



For a right (or center) aligned column you would need



multicolumn{1}{r@{phantom{~--~}}{#1}}


so that the alignment didn't spread into the inter-column space generated by the @ expression in the main tabular preamble.






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',
    autoActivateHeartbeat: false,
    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f484775%2fchange-column-specification-for-single-specific-cells%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









    3














    Using multicolumn{1} is the intended interface to specifying a different layout for heading or other rows. Note that you can get away with the simple



    multicolumn{1}{l}{...}


    here as it is a left-aligned column.



    For a right (or center) aligned column you would need



    multicolumn{1}{r@{phantom{~--~}}{#1}}


    so that the alignment didn't spread into the inter-column space generated by the @ expression in the main tabular preamble.






    share|improve this answer




























      3














      Using multicolumn{1} is the intended interface to specifying a different layout for heading or other rows. Note that you can get away with the simple



      multicolumn{1}{l}{...}


      here as it is a left-aligned column.



      For a right (or center) aligned column you would need



      multicolumn{1}{r@{phantom{~--~}}{#1}}


      so that the alignment didn't spread into the inter-column space generated by the @ expression in the main tabular preamble.






      share|improve this answer


























        3












        3








        3







        Using multicolumn{1} is the intended interface to specifying a different layout for heading or other rows. Note that you can get away with the simple



        multicolumn{1}{l}{...}


        here as it is a left-aligned column.



        For a right (or center) aligned column you would need



        multicolumn{1}{r@{phantom{~--~}}{#1}}


        so that the alignment didn't spread into the inter-column space generated by the @ expression in the main tabular preamble.






        share|improve this answer













        Using multicolumn{1} is the intended interface to specifying a different layout for heading or other rows. Note that you can get away with the simple



        multicolumn{1}{l}{...}


        here as it is a left-aligned column.



        For a right (or center) aligned column you would need



        multicolumn{1}{r@{phantom{~--~}}{#1}}


        so that the alignment didn't spread into the inter-column space generated by the @ expression in the main tabular preamble.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        David CarlisleDavid Carlisle

        499k4111451895




        499k4111451895






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f484775%2fchange-column-specification-for-single-specific-cells%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

            Category:香港粉麵

            List *all* the tuples!

            Channel [V]