shortstack in table throwing Compile Error












0















I am trying to put some cell text such as "Measurement type" and "Event labels" into multirow cells of two lines, where the aforementioned names would be split into two lines.



   begin{table*}[t]
caption{Summary of high-frequency datasets specific for electricity disaggregation}
label{tab:datasets}
begin{minipage}[c]{textwidth}
begin{center}
begin{tabular}{llllcllll}
toprule
multirow{2}{*}{textbf{Dataset}} & multirow{2}{*}{textbf{Year}} & multirow{2}{*}{shortstack{textbf{Measurement\type}}} & multirow{2}{*}{textbf{Duration}} & multirow{2}{*}{shortstack{textbf{ADC\resolution}}} & multicolumn{2}{c}{textbf{Sampling frequency}} & textbf{Features} & multirow{2}{*}{shortstack{textbf{Event\labels}}}\
&&&&&textbf{WP}&textbf{IL}&&\
REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24bit & 15kHz & 1/3-1/4Hz & I,V,P & NO\
bottomrule
end{tabular}
end{center}
end{minipage}
end{table*}


Although I found a solution that revolves around the use of shortstack, it does not work and I get a Compiler Error!



Errors found when using shortstack



Am I doing something wrong? Thank you in advance.










share|improve this question


















  • 1





    Welcome! Could you post a complete code, please?

    – Bernard
    Feb 12 at 21:22











  • Use shortstack inside of textbf not the other way around or switch to the makecell package or use m type columns for automatic linebreaks.

    – leandriis
    Feb 12 at 21:35











  • This is more a guess than an answer, because I can't test at the moment. I thi nk that the \ in the shortstack can't be inside a brace pair {..}. Tr y this: shortstack{textbf{Measurement}\ textbf{type}}.

    – barbara beeton
    Feb 12 at 21:39











  • Thank you all. As you mentioned, the problem was with the textbf{type}. Giving each word its specific textbf{type} solved the problem!

    – Med Aymane Ahajjam
    Feb 12 at 22:12








  • 1





    Don't use shortstack, see tex.stackexchange.com/a/350278/4427. Also the minipage with a center environment is not the best idea; just use centering inside the table* environment.

    – egreg
    Feb 12 at 22:24
















0















I am trying to put some cell text such as "Measurement type" and "Event labels" into multirow cells of two lines, where the aforementioned names would be split into two lines.



   begin{table*}[t]
caption{Summary of high-frequency datasets specific for electricity disaggregation}
label{tab:datasets}
begin{minipage}[c]{textwidth}
begin{center}
begin{tabular}{llllcllll}
toprule
multirow{2}{*}{textbf{Dataset}} & multirow{2}{*}{textbf{Year}} & multirow{2}{*}{shortstack{textbf{Measurement\type}}} & multirow{2}{*}{textbf{Duration}} & multirow{2}{*}{shortstack{textbf{ADC\resolution}}} & multicolumn{2}{c}{textbf{Sampling frequency}} & textbf{Features} & multirow{2}{*}{shortstack{textbf{Event\labels}}}\
&&&&&textbf{WP}&textbf{IL}&&\
REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24bit & 15kHz & 1/3-1/4Hz & I,V,P & NO\
bottomrule
end{tabular}
end{center}
end{minipage}
end{table*}


Although I found a solution that revolves around the use of shortstack, it does not work and I get a Compiler Error!



Errors found when using shortstack



Am I doing something wrong? Thank you in advance.










share|improve this question


















  • 1





    Welcome! Could you post a complete code, please?

    – Bernard
    Feb 12 at 21:22











  • Use shortstack inside of textbf not the other way around or switch to the makecell package or use m type columns for automatic linebreaks.

    – leandriis
    Feb 12 at 21:35











  • This is more a guess than an answer, because I can't test at the moment. I thi nk that the \ in the shortstack can't be inside a brace pair {..}. Tr y this: shortstack{textbf{Measurement}\ textbf{type}}.

    – barbara beeton
    Feb 12 at 21:39











  • Thank you all. As you mentioned, the problem was with the textbf{type}. Giving each word its specific textbf{type} solved the problem!

    – Med Aymane Ahajjam
    Feb 12 at 22:12








  • 1





    Don't use shortstack, see tex.stackexchange.com/a/350278/4427. Also the minipage with a center environment is not the best idea; just use centering inside the table* environment.

    – egreg
    Feb 12 at 22:24














0












0








0








I am trying to put some cell text such as "Measurement type" and "Event labels" into multirow cells of two lines, where the aforementioned names would be split into two lines.



   begin{table*}[t]
caption{Summary of high-frequency datasets specific for electricity disaggregation}
label{tab:datasets}
begin{minipage}[c]{textwidth}
begin{center}
begin{tabular}{llllcllll}
toprule
multirow{2}{*}{textbf{Dataset}} & multirow{2}{*}{textbf{Year}} & multirow{2}{*}{shortstack{textbf{Measurement\type}}} & multirow{2}{*}{textbf{Duration}} & multirow{2}{*}{shortstack{textbf{ADC\resolution}}} & multicolumn{2}{c}{textbf{Sampling frequency}} & textbf{Features} & multirow{2}{*}{shortstack{textbf{Event\labels}}}\
&&&&&textbf{WP}&textbf{IL}&&\
REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24bit & 15kHz & 1/3-1/4Hz & I,V,P & NO\
bottomrule
end{tabular}
end{center}
end{minipage}
end{table*}


Although I found a solution that revolves around the use of shortstack, it does not work and I get a Compiler Error!



Errors found when using shortstack



Am I doing something wrong? Thank you in advance.










share|improve this question














I am trying to put some cell text such as "Measurement type" and "Event labels" into multirow cells of two lines, where the aforementioned names would be split into two lines.



   begin{table*}[t]
caption{Summary of high-frequency datasets specific for electricity disaggregation}
label{tab:datasets}
begin{minipage}[c]{textwidth}
begin{center}
begin{tabular}{llllcllll}
toprule
multirow{2}{*}{textbf{Dataset}} & multirow{2}{*}{textbf{Year}} & multirow{2}{*}{shortstack{textbf{Measurement\type}}} & multirow{2}{*}{textbf{Duration}} & multirow{2}{*}{shortstack{textbf{ADC\resolution}}} & multicolumn{2}{c}{textbf{Sampling frequency}} & textbf{Features} & multirow{2}{*}{shortstack{textbf{Event\labels}}}\
&&&&&textbf{WP}&textbf{IL}&&\
REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24bit & 15kHz & 1/3-1/4Hz & I,V,P & NO\
bottomrule
end{tabular}
end{center}
end{minipage}
end{table*}


Although I found a solution that revolves around the use of shortstack, it does not work and I get a Compiler Error!



Errors found when using shortstack



Am I doing something wrong? Thank you in advance.







tables errors compiling multirow shortstack






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 12 at 21:16









Med Aymane AhajjamMed Aymane Ahajjam

224




224








  • 1





    Welcome! Could you post a complete code, please?

    – Bernard
    Feb 12 at 21:22











  • Use shortstack inside of textbf not the other way around or switch to the makecell package or use m type columns for automatic linebreaks.

    – leandriis
    Feb 12 at 21:35











  • This is more a guess than an answer, because I can't test at the moment. I thi nk that the \ in the shortstack can't be inside a brace pair {..}. Tr y this: shortstack{textbf{Measurement}\ textbf{type}}.

    – barbara beeton
    Feb 12 at 21:39











  • Thank you all. As you mentioned, the problem was with the textbf{type}. Giving each word its specific textbf{type} solved the problem!

    – Med Aymane Ahajjam
    Feb 12 at 22:12








  • 1





    Don't use shortstack, see tex.stackexchange.com/a/350278/4427. Also the minipage with a center environment is not the best idea; just use centering inside the table* environment.

    – egreg
    Feb 12 at 22:24














  • 1





    Welcome! Could you post a complete code, please?

    – Bernard
    Feb 12 at 21:22











  • Use shortstack inside of textbf not the other way around or switch to the makecell package or use m type columns for automatic linebreaks.

    – leandriis
    Feb 12 at 21:35











  • This is more a guess than an answer, because I can't test at the moment. I thi nk that the \ in the shortstack can't be inside a brace pair {..}. Tr y this: shortstack{textbf{Measurement}\ textbf{type}}.

    – barbara beeton
    Feb 12 at 21:39











  • Thank you all. As you mentioned, the problem was with the textbf{type}. Giving each word its specific textbf{type} solved the problem!

    – Med Aymane Ahajjam
    Feb 12 at 22:12








  • 1





    Don't use shortstack, see tex.stackexchange.com/a/350278/4427. Also the minipage with a center environment is not the best idea; just use centering inside the table* environment.

    – egreg
    Feb 12 at 22:24








1




1





Welcome! Could you post a complete code, please?

– Bernard
Feb 12 at 21:22





Welcome! Could you post a complete code, please?

– Bernard
Feb 12 at 21:22













Use shortstack inside of textbf not the other way around or switch to the makecell package or use m type columns for automatic linebreaks.

– leandriis
Feb 12 at 21:35





Use shortstack inside of textbf not the other way around or switch to the makecell package or use m type columns for automatic linebreaks.

– leandriis
Feb 12 at 21:35













This is more a guess than an answer, because I can't test at the moment. I thi nk that the \ in the shortstack can't be inside a brace pair {..}. Tr y this: shortstack{textbf{Measurement}\ textbf{type}}.

– barbara beeton
Feb 12 at 21:39





This is more a guess than an answer, because I can't test at the moment. I thi nk that the \ in the shortstack can't be inside a brace pair {..}. Tr y this: shortstack{textbf{Measurement}\ textbf{type}}.

– barbara beeton
Feb 12 at 21:39













Thank you all. As you mentioned, the problem was with the textbf{type}. Giving each word its specific textbf{type} solved the problem!

– Med Aymane Ahajjam
Feb 12 at 22:12







Thank you all. As you mentioned, the problem was with the textbf{type}. Giving each word its specific textbf{type} solved the problem!

– Med Aymane Ahajjam
Feb 12 at 22:12






1




1





Don't use shortstack, see tex.stackexchange.com/a/350278/4427. Also the minipage with a center environment is not the best idea; just use centering inside the table* environment.

– egreg
Feb 12 at 22:24





Don't use shortstack, see tex.stackexchange.com/a/350278/4427. Also the minipage with a center environment is not the best idea; just use centering inside the table* environment.

– egreg
Feb 12 at 22:24










1 Answer
1






active

oldest

votes


















2














As suggested in @leandriis' comment, you'll have a simpler code which compiles (no multirow, no shortstack) with makecell, which allows for line breaks and a common formatting in standard cells, with themakecell and thead commands. I added caption to have a decent spacing between caption and table, used the small size and reduced the value of tabcolsep to make the table fit the text width:



documentclass{article}
usepackage{array, booktabs, makecell, caption}
usepackage{geometry}
setlength{extrarowheight}{2pt}
renewcommand{theadfont}{normalsizebfseries}
usepackage{nccmath}

begin{document}

begin{table*}[t]
smallsetlength{tabcolsep}{3pt}
caption{Summary of high-frequency datasets specific for electricity disaggregation}
label{tab:datasets}
begin{minipage}[c]{textwidth}
centering
begin{tabular}{llllcllll}
toprule
thead{Dataset} & thead{Year} & thead{ Measurement\type} & thead{Duration} & thead{ADC\resolution} & multicolumn{2}{c}{thead{Sampling\ frequency}} & thead{Features} & thead{Event\labels}\
cline{6-7}
&&&&&thead{WP}&thead{IL}&&\
REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24,bit & 15,kHz & $ mfrac{1}{3} $--$ mfrac{1}{4} $,Hz & I,V,P & NO\
bottomrule
end{tabular}
end{minipage}
end{table*}

end{document}


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',
    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%2f474583%2fshortstack-in-table-throwing-compile-error%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









    2














    As suggested in @leandriis' comment, you'll have a simpler code which compiles (no multirow, no shortstack) with makecell, which allows for line breaks and a common formatting in standard cells, with themakecell and thead commands. I added caption to have a decent spacing between caption and table, used the small size and reduced the value of tabcolsep to make the table fit the text width:



    documentclass{article}
    usepackage{array, booktabs, makecell, caption}
    usepackage{geometry}
    setlength{extrarowheight}{2pt}
    renewcommand{theadfont}{normalsizebfseries}
    usepackage{nccmath}

    begin{document}

    begin{table*}[t]
    smallsetlength{tabcolsep}{3pt}
    caption{Summary of high-frequency datasets specific for electricity disaggregation}
    label{tab:datasets}
    begin{minipage}[c]{textwidth}
    centering
    begin{tabular}{llllcllll}
    toprule
    thead{Dataset} & thead{Year} & thead{ Measurement\type} & thead{Duration} & thead{ADC\resolution} & multicolumn{2}{c}{thead{Sampling\ frequency}} & thead{Features} & thead{Event\labels}\
    cline{6-7}
    &&&&&thead{WP}&thead{IL}&&\
    REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24,bit & 15,kHz & $ mfrac{1}{3} $--$ mfrac{1}{4} $,Hz & I,V,P & NO\
    bottomrule
    end{tabular}
    end{minipage}
    end{table*}

    end{document}


    enter image description here






    share|improve this answer






























      2














      As suggested in @leandriis' comment, you'll have a simpler code which compiles (no multirow, no shortstack) with makecell, which allows for line breaks and a common formatting in standard cells, with themakecell and thead commands. I added caption to have a decent spacing between caption and table, used the small size and reduced the value of tabcolsep to make the table fit the text width:



      documentclass{article}
      usepackage{array, booktabs, makecell, caption}
      usepackage{geometry}
      setlength{extrarowheight}{2pt}
      renewcommand{theadfont}{normalsizebfseries}
      usepackage{nccmath}

      begin{document}

      begin{table*}[t]
      smallsetlength{tabcolsep}{3pt}
      caption{Summary of high-frequency datasets specific for electricity disaggregation}
      label{tab:datasets}
      begin{minipage}[c]{textwidth}
      centering
      begin{tabular}{llllcllll}
      toprule
      thead{Dataset} & thead{Year} & thead{ Measurement\type} & thead{Duration} & thead{ADC\resolution} & multicolumn{2}{c}{thead{Sampling\ frequency}} & thead{Features} & thead{Event\labels}\
      cline{6-7}
      &&&&&thead{WP}&thead{IL}&&\
      REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24,bit & 15,kHz & $ mfrac{1}{3} $--$ mfrac{1}{4} $,Hz & I,V,P & NO\
      bottomrule
      end{tabular}
      end{minipage}
      end{table*}

      end{document}


      enter image description here






      share|improve this answer




























        2












        2








        2







        As suggested in @leandriis' comment, you'll have a simpler code which compiles (no multirow, no shortstack) with makecell, which allows for line breaks and a common formatting in standard cells, with themakecell and thead commands. I added caption to have a decent spacing between caption and table, used the small size and reduced the value of tabcolsep to make the table fit the text width:



        documentclass{article}
        usepackage{array, booktabs, makecell, caption}
        usepackage{geometry}
        setlength{extrarowheight}{2pt}
        renewcommand{theadfont}{normalsizebfseries}
        usepackage{nccmath}

        begin{document}

        begin{table*}[t]
        smallsetlength{tabcolsep}{3pt}
        caption{Summary of high-frequency datasets specific for electricity disaggregation}
        label{tab:datasets}
        begin{minipage}[c]{textwidth}
        centering
        begin{tabular}{llllcllll}
        toprule
        thead{Dataset} & thead{Year} & thead{ Measurement\type} & thead{Duration} & thead{ADC\resolution} & multicolumn{2}{c}{thead{Sampling\ frequency}} & thead{Features} & thead{Event\labels}\
        cline{6-7}
        &&&&&thead{WP}&thead{IL}&&\
        REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24,bit & 15,kHz & $ mfrac{1}{3} $--$ mfrac{1}{4} $,Hz & I,V,P & NO\
        bottomrule
        end{tabular}
        end{minipage}
        end{table*}

        end{document}


        enter image description here






        share|improve this answer















        As suggested in @leandriis' comment, you'll have a simpler code which compiles (no multirow, no shortstack) with makecell, which allows for line breaks and a common formatting in standard cells, with themakecell and thead commands. I added caption to have a decent spacing between caption and table, used the small size and reduced the value of tabcolsep to make the table fit the text width:



        documentclass{article}
        usepackage{array, booktabs, makecell, caption}
        usepackage{geometry}
        setlength{extrarowheight}{2pt}
        renewcommand{theadfont}{normalsizebfseries}
        usepackage{nccmath}

        begin{document}

        begin{table*}[t]
        smallsetlength{tabcolsep}{3pt}
        caption{Summary of high-frequency datasets specific for electricity disaggregation}
        label{tab:datasets}
        begin{minipage}[c]{textwidth}
        centering
        begin{tabular}{llllcllll}
        toprule
        thead{Dataset} & thead{Year} & thead{ Measurement\type} & thead{Duration} & thead{ADC\resolution} & multicolumn{2}{c}{thead{Sampling\ frequency}} & thead{Features} & thead{Event\labels}\
        cline{6-7}
        &&&&&thead{WP}&thead{IL}&&\
        REDD (US) cite{REDD2011}& 2011 & WP(10), IC, IL(8) & 3-119D & 24,bit & 15,kHz & $ mfrac{1}{3} $--$ mfrac{1}{4} $,Hz & I,V,P & NO\
        bottomrule
        end{tabular}
        end{minipage}
        end{table*}

        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 16 at 13:26

























        answered Feb 12 at 22:43









        BernardBernard

        170k773200




        170k773200






























            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%2f474583%2fshortstack-in-table-throwing-compile-error%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?