Why adding `multicolumn` makes my column to disappear?How to align subfigures in this specific grid?

Why no Iridium-level flares from other satellites?

Tikz picture of two mathematical functions

What is the significance behind "40 days" that often appears in the Bible?

How do you talk to someone whose loved one is dying?

Book about superhumans hiding among normal humans

Problem with FindRoot

"of which" is correct here?

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how?

How do I hide Chekhov's Gun?

combinatorics floor summation

What do you call the act of removing a part of a word and replacing it with an apostrophe

Instead of a Universal Basic Income program, why not implement a "Universal Basic Needs" program?

Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?

Employee lack of ownership

PTIJ: Who should I vote for? (21st Knesset Edition)

Have the tides ever turned twice on any open problem?

Shortcut for setting origin to vertex

Violin - Can double stops be played when the strings are not next to each other?

How to make healing in an exploration game interesting

Is there a place to find the pricing for things not mentioned in the PHB? (non-magical)

Fastest way to pop N items from a large dict

Why is the President allowed to veto a cancellation of emergency powers?



Why adding `multicolumn` makes my column to disappear?


How to align subfigures in this specific grid?













0















The original question is about placing figures inside a tabular and trying to adjust them like this:



2



with a code similar to this:



documentclass{article}
usepackage{graphicx}
usepackage{array}
begin{document}
begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


That for some reason gives this output:



3



Why this happens?




Of course there are better options for placing the figures like that and the answer in the linked question is one of them. But trying to develop the code with the tabular will help as to understand some things about the additional cell that if will be used in compination with multicolumn command will reduce our columns and this can be unexpected!










share























  • I would ask to reviewers to scroll down and read the PS before flagging/recommending deletion because I think it is a useful post and that if one (of double) answers should be deleted... the linked answer is sure less useful at that place. Thanks.

    – koleygr
    1 min ago
















0















The original question is about placing figures inside a tabular and trying to adjust them like this:



2



with a code similar to this:



documentclass{article}
usepackage{graphicx}
usepackage{array}
begin{document}
begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


That for some reason gives this output:



3



Why this happens?




Of course there are better options for placing the figures like that and the answer in the linked question is one of them. But trying to develop the code with the tabular will help as to understand some things about the additional cell that if will be used in compination with multicolumn command will reduce our columns and this can be unexpected!










share























  • I would ask to reviewers to scroll down and read the PS before flagging/recommending deletion because I think it is a useful post and that if one (of double) answers should be deleted... the linked answer is sure less useful at that place. Thanks.

    – koleygr
    1 min ago














0












0








0








The original question is about placing figures inside a tabular and trying to adjust them like this:



2



with a code similar to this:



documentclass{article}
usepackage{graphicx}
usepackage{array}
begin{document}
begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


That for some reason gives this output:



3



Why this happens?




Of course there are better options for placing the figures like that and the answer in the linked question is one of them. But trying to develop the code with the tabular will help as to understand some things about the additional cell that if will be used in compination with multicolumn command will reduce our columns and this can be unexpected!










share














The original question is about placing figures inside a tabular and trying to adjust them like this:



2



with a code similar to this:



documentclass{article}
usepackage{graphicx}
usepackage{array}
begin{document}
begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


That for some reason gives this output:



3



Why this happens?




Of course there are better options for placing the figures like that and the answer in the linked question is one of them. But trying to develop the code with the tabular will help as to understand some things about the additional cell that if will be used in compination with multicolumn command will reduce our columns and this can be unexpected!








tables multicolumn cell





share












share










share



share










asked 3 mins ago









koleygrkoleygr

12.8k11038




12.8k11038













  • I would ask to reviewers to scroll down and read the PS before flagging/recommending deletion because I think it is a useful post and that if one (of double) answers should be deleted... the linked answer is sure less useful at that place. Thanks.

    – koleygr
    1 min ago



















  • I would ask to reviewers to scroll down and read the PS before flagging/recommending deletion because I think it is a useful post and that if one (of double) answers should be deleted... the linked answer is sure less useful at that place. Thanks.

    – koleygr
    1 min ago

















I would ask to reviewers to scroll down and read the PS before flagging/recommending deletion because I think it is a useful post and that if one (of double) answers should be deleted... the linked answer is sure less useful at that place. Thanks.

– koleygr
1 min ago





I would ask to reviewers to scroll down and read the PS before flagging/recommending deletion because I think it is a useful post and that if one (of double) answers should be deleted... the linked answer is sure less useful at that place. Thanks.

– koleygr
1 min ago










1 Answer
1






active

oldest

votes


















0
















  1. First step...



    Ok, I have 5 figures and I need 3 on top and two on bottom, I want to control their placement... A tabular seems a good solution to me...




Let's think:



Three on top: {ccc}
First row normal centered and I will split cells via multicolumn in second to share the space... But...



begin{tabular}{ccc}
include..&include..&include..\
multicolumn{2}{c}&multicolumn{2}{c}
end{tabular}


Oh! writing the second multicolumn I realized that they became 4 columns...
Don't even compiling...



Seems I need a fourth column:



Let's try:





  1. Second step... four columns:


I will split the top middle columns with multicolumn:



begin{tabular}{cccc}
include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
end{tabular}


4 in the up row 4 in the next... perfect! Let's compile



enter image description here



Seems I didn't count correct... Lets count...




  • Above row 4 cells middle 2 merged

  • Below row 2 & 2 cells...


Why first cell of second row doesn't merge with the second? This should give the fourth figure centered in two first columns like fifth... Why?



Do I need to add a fifth column?



Lets see:



begin{tabular}{cccc}
1&2&3&4\
include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
end{tabular}


enter image description here



Fourth image stops before 2nd column... Lets think... Do I need 5 columns?





  1. Third step... Let's see the vertical lines there? before reporting a bug... But I should!


Full code:



documentclass{article}
usepackage{graphicx}
usepackage{xcolor}
begin{document}
begin{tabular}{|c|c|c|c|}
1&2&3&4\
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


enter image description here



They need the bug report... But...



Ok... I think I got it:



The second column has no the width of the third... Of course... No width needed there... Lets add a width:



... Ok I will add centered 17.5mm in both the middle columns:



documentclass{article}
usepackage{graphicx}
usepackage{array}
begin{document}
begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


enter image description here



Why me??? Let's ask at stackexchange... I am out of here!




  1. No more steps: Some explanation:


Let's add the 1&2&3&4 row back there:



documentclass{article}
usepackage{graphicx}
usepackage{array}
begin{document}
begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
1&2&3&4\
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


enter image description here



Perfect... But what happened?



LaTeX used just 3 columns since the maximum of the cells needed there was 3 per row... So, the first column was a single column and not really a multicolumn... By adding these help numbers... we are actually lucky and found out what happened... So, adding a full row with empty cells (but all the cells) can solve the problem... Then remove the extra vertical space of the line with [-1em] ... Also, with some simple thoughts the second row cells should not be centered because of the extra width of the first and last column... May be r and l is a better choice ... and a tabcolsep fixed width would help... same distance too (as tabcolsep between rows) and:



documentclass{article}
usepackage{graphicx}
usepackage{array}
begin{document}
setlength{tabcolsep}{1mm}
begin{tabular}{c>{centeringarraybackslash}p{17.5mm}>{centeringarraybackslash}p{17.5mm}c}
&&&\[-1em]
includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \[1mm]
multicolumn{2}{r}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{l}{includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


enter image description here



But why didn't made it in a simpler tabular (of 3 columns)?



documentclass{article}
usepackage{graphicx}
begin{document}
setlength{tabcolsep}{1mm}
begin{tabular}{ccc}
includegraphics[width=35mm]{example-image-a}& includegraphics[width=35mm]{example-image-b}&includegraphics[width=35mm]{example-image-c}\[1mm]
multicolumn{3}{c}{includegraphics[width=35mm]{example-image-a}hspace{2mm}includegraphics[width=35mm]{example-image-b}}
end{tabular}
end{document}


Nice... Clever!



But @egreg's answer is more clever!!! At least I found the problem!




PS: My "double post" needs moderator attention ... but I think it is an exception and have to offer to this site since the first question was about placing figures and I just found out I have something to say here that didn't found somewhere else and it is useful and about tabulars with multicolumn... If one of the two posts should be deleted I suppose that deleting the first one (my answer on the original question) would be a better choice because here seems more useful for me. So, please (reviewers) add a comment before flagging for deletion.






share























    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%2f479863%2fwhy-adding-multicolumn-makes-my-column-to-disappear%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









    0
















    1. First step...



      Ok, I have 5 figures and I need 3 on top and two on bottom, I want to control their placement... A tabular seems a good solution to me...




    Let's think:



    Three on top: {ccc}
    First row normal centered and I will split cells via multicolumn in second to share the space... But...



    begin{tabular}{ccc}
    include..&include..&include..\
    multicolumn{2}{c}&multicolumn{2}{c}
    end{tabular}


    Oh! writing the second multicolumn I realized that they became 4 columns...
    Don't even compiling...



    Seems I need a fourth column:



    Let's try:





    1. Second step... four columns:


    I will split the top middle columns with multicolumn:



    begin{tabular}{cccc}
    include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
    multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
    end{tabular}


    4 in the up row 4 in the next... perfect! Let's compile



    enter image description here



    Seems I didn't count correct... Lets count...




    • Above row 4 cells middle 2 merged

    • Below row 2 & 2 cells...


    Why first cell of second row doesn't merge with the second? This should give the fourth figure centered in two first columns like fifth... Why?



    Do I need to add a fifth column?



    Lets see:



    begin{tabular}{cccc}
    1&2&3&4\
    include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
    multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
    end{tabular}


    enter image description here



    Fourth image stops before 2nd column... Lets think... Do I need 5 columns?





    1. Third step... Let's see the vertical lines there? before reporting a bug... But I should!


    Full code:



    documentclass{article}
    usepackage{graphicx}
    usepackage{xcolor}
    begin{document}
    begin{tabular}{|c|c|c|c|}
    1&2&3&4\
    includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
    multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
    end{tabular}
    end{document}


    enter image description here



    They need the bug report... But...



    Ok... I think I got it:



    The second column has no the width of the third... Of course... No width needed there... Lets add a width:



    ... Ok I will add centered 17.5mm in both the middle columns:



    documentclass{article}
    usepackage{graphicx}
    usepackage{array}
    begin{document}
    begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
    includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
    multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
    end{tabular}
    end{document}


    enter image description here



    Why me??? Let's ask at stackexchange... I am out of here!




    1. No more steps: Some explanation:


    Let's add the 1&2&3&4 row back there:



    documentclass{article}
    usepackage{graphicx}
    usepackage{array}
    begin{document}
    begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
    1&2&3&4\
    includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
    multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
    end{tabular}
    end{document}


    enter image description here



    Perfect... But what happened?



    LaTeX used just 3 columns since the maximum of the cells needed there was 3 per row... So, the first column was a single column and not really a multicolumn... By adding these help numbers... we are actually lucky and found out what happened... So, adding a full row with empty cells (but all the cells) can solve the problem... Then remove the extra vertical space of the line with [-1em] ... Also, with some simple thoughts the second row cells should not be centered because of the extra width of the first and last column... May be r and l is a better choice ... and a tabcolsep fixed width would help... same distance too (as tabcolsep between rows) and:



    documentclass{article}
    usepackage{graphicx}
    usepackage{array}
    begin{document}
    setlength{tabcolsep}{1mm}
    begin{tabular}{c>{centeringarraybackslash}p{17.5mm}>{centeringarraybackslash}p{17.5mm}c}
    &&&\[-1em]
    includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \[1mm]
    multicolumn{2}{r}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{l}{includegraphics[width=35mm]{example-image-b}}
    end{tabular}
    end{document}


    enter image description here



    But why didn't made it in a simpler tabular (of 3 columns)?



    documentclass{article}
    usepackage{graphicx}
    begin{document}
    setlength{tabcolsep}{1mm}
    begin{tabular}{ccc}
    includegraphics[width=35mm]{example-image-a}& includegraphics[width=35mm]{example-image-b}&includegraphics[width=35mm]{example-image-c}\[1mm]
    multicolumn{3}{c}{includegraphics[width=35mm]{example-image-a}hspace{2mm}includegraphics[width=35mm]{example-image-b}}
    end{tabular}
    end{document}


    Nice... Clever!



    But @egreg's answer is more clever!!! At least I found the problem!




    PS: My "double post" needs moderator attention ... but I think it is an exception and have to offer to this site since the first question was about placing figures and I just found out I have something to say here that didn't found somewhere else and it is useful and about tabulars with multicolumn... If one of the two posts should be deleted I suppose that deleting the first one (my answer on the original question) would be a better choice because here seems more useful for me. So, please (reviewers) add a comment before flagging for deletion.






    share




























      0
















      1. First step...



        Ok, I have 5 figures and I need 3 on top and two on bottom, I want to control their placement... A tabular seems a good solution to me...




      Let's think:



      Three on top: {ccc}
      First row normal centered and I will split cells via multicolumn in second to share the space... But...



      begin{tabular}{ccc}
      include..&include..&include..\
      multicolumn{2}{c}&multicolumn{2}{c}
      end{tabular}


      Oh! writing the second multicolumn I realized that they became 4 columns...
      Don't even compiling...



      Seems I need a fourth column:



      Let's try:





      1. Second step... four columns:


      I will split the top middle columns with multicolumn:



      begin{tabular}{cccc}
      include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
      multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
      end{tabular}


      4 in the up row 4 in the next... perfect! Let's compile



      enter image description here



      Seems I didn't count correct... Lets count...




      • Above row 4 cells middle 2 merged

      • Below row 2 & 2 cells...


      Why first cell of second row doesn't merge with the second? This should give the fourth figure centered in two first columns like fifth... Why?



      Do I need to add a fifth column?



      Lets see:



      begin{tabular}{cccc}
      1&2&3&4\
      include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
      multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
      end{tabular}


      enter image description here



      Fourth image stops before 2nd column... Lets think... Do I need 5 columns?





      1. Third step... Let's see the vertical lines there? before reporting a bug... But I should!


      Full code:



      documentclass{article}
      usepackage{graphicx}
      usepackage{xcolor}
      begin{document}
      begin{tabular}{|c|c|c|c|}
      1&2&3&4\
      includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
      multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
      end{tabular}
      end{document}


      enter image description here



      They need the bug report... But...



      Ok... I think I got it:



      The second column has no the width of the third... Of course... No width needed there... Lets add a width:



      ... Ok I will add centered 17.5mm in both the middle columns:



      documentclass{article}
      usepackage{graphicx}
      usepackage{array}
      begin{document}
      begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
      includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
      multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
      end{tabular}
      end{document}


      enter image description here



      Why me??? Let's ask at stackexchange... I am out of here!




      1. No more steps: Some explanation:


      Let's add the 1&2&3&4 row back there:



      documentclass{article}
      usepackage{graphicx}
      usepackage{array}
      begin{document}
      begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
      1&2&3&4\
      includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
      multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
      end{tabular}
      end{document}


      enter image description here



      Perfect... But what happened?



      LaTeX used just 3 columns since the maximum of the cells needed there was 3 per row... So, the first column was a single column and not really a multicolumn... By adding these help numbers... we are actually lucky and found out what happened... So, adding a full row with empty cells (but all the cells) can solve the problem... Then remove the extra vertical space of the line with [-1em] ... Also, with some simple thoughts the second row cells should not be centered because of the extra width of the first and last column... May be r and l is a better choice ... and a tabcolsep fixed width would help... same distance too (as tabcolsep between rows) and:



      documentclass{article}
      usepackage{graphicx}
      usepackage{array}
      begin{document}
      setlength{tabcolsep}{1mm}
      begin{tabular}{c>{centeringarraybackslash}p{17.5mm}>{centeringarraybackslash}p{17.5mm}c}
      &&&\[-1em]
      includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \[1mm]
      multicolumn{2}{r}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{l}{includegraphics[width=35mm]{example-image-b}}
      end{tabular}
      end{document}


      enter image description here



      But why didn't made it in a simpler tabular (of 3 columns)?



      documentclass{article}
      usepackage{graphicx}
      begin{document}
      setlength{tabcolsep}{1mm}
      begin{tabular}{ccc}
      includegraphics[width=35mm]{example-image-a}& includegraphics[width=35mm]{example-image-b}&includegraphics[width=35mm]{example-image-c}\[1mm]
      multicolumn{3}{c}{includegraphics[width=35mm]{example-image-a}hspace{2mm}includegraphics[width=35mm]{example-image-b}}
      end{tabular}
      end{document}


      Nice... Clever!



      But @egreg's answer is more clever!!! At least I found the problem!




      PS: My "double post" needs moderator attention ... but I think it is an exception and have to offer to this site since the first question was about placing figures and I just found out I have something to say here that didn't found somewhere else and it is useful and about tabulars with multicolumn... If one of the two posts should be deleted I suppose that deleting the first one (my answer on the original question) would be a better choice because here seems more useful for me. So, please (reviewers) add a comment before flagging for deletion.






      share


























        0












        0








        0









        1. First step...



          Ok, I have 5 figures and I need 3 on top and two on bottom, I want to control their placement... A tabular seems a good solution to me...




        Let's think:



        Three on top: {ccc}
        First row normal centered and I will split cells via multicolumn in second to share the space... But...



        begin{tabular}{ccc}
        include..&include..&include..\
        multicolumn{2}{c}&multicolumn{2}{c}
        end{tabular}


        Oh! writing the second multicolumn I realized that they became 4 columns...
        Don't even compiling...



        Seems I need a fourth column:



        Let's try:





        1. Second step... four columns:


        I will split the top middle columns with multicolumn:



        begin{tabular}{cccc}
        include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
        multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
        end{tabular}


        4 in the up row 4 in the next... perfect! Let's compile



        enter image description here



        Seems I didn't count correct... Lets count...




        • Above row 4 cells middle 2 merged

        • Below row 2 & 2 cells...


        Why first cell of second row doesn't merge with the second? This should give the fourth figure centered in two first columns like fifth... Why?



        Do I need to add a fifth column?



        Lets see:



        begin{tabular}{cccc}
        1&2&3&4\
        include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
        multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
        end{tabular}


        enter image description here



        Fourth image stops before 2nd column... Lets think... Do I need 5 columns?





        1. Third step... Let's see the vertical lines there? before reporting a bug... But I should!


        Full code:



        documentclass{article}
        usepackage{graphicx}
        usepackage{xcolor}
        begin{document}
        begin{tabular}{|c|c|c|c|}
        1&2&3&4\
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
        multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        They need the bug report... But...



        Ok... I think I got it:



        The second column has no the width of the third... Of course... No width needed there... Lets add a width:



        ... Ok I will add centered 17.5mm in both the middle columns:



        documentclass{article}
        usepackage{graphicx}
        usepackage{array}
        begin{document}
        begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
        multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        Why me??? Let's ask at stackexchange... I am out of here!




        1. No more steps: Some explanation:


        Let's add the 1&2&3&4 row back there:



        documentclass{article}
        usepackage{graphicx}
        usepackage{array}
        begin{document}
        begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
        1&2&3&4\
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
        multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        Perfect... But what happened?



        LaTeX used just 3 columns since the maximum of the cells needed there was 3 per row... So, the first column was a single column and not really a multicolumn... By adding these help numbers... we are actually lucky and found out what happened... So, adding a full row with empty cells (but all the cells) can solve the problem... Then remove the extra vertical space of the line with [-1em] ... Also, with some simple thoughts the second row cells should not be centered because of the extra width of the first and last column... May be r and l is a better choice ... and a tabcolsep fixed width would help... same distance too (as tabcolsep between rows) and:



        documentclass{article}
        usepackage{graphicx}
        usepackage{array}
        begin{document}
        setlength{tabcolsep}{1mm}
        begin{tabular}{c>{centeringarraybackslash}p{17.5mm}>{centeringarraybackslash}p{17.5mm}c}
        &&&\[-1em]
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \[1mm]
        multicolumn{2}{r}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{l}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        But why didn't made it in a simpler tabular (of 3 columns)?



        documentclass{article}
        usepackage{graphicx}
        begin{document}
        setlength{tabcolsep}{1mm}
        begin{tabular}{ccc}
        includegraphics[width=35mm]{example-image-a}& includegraphics[width=35mm]{example-image-b}&includegraphics[width=35mm]{example-image-c}\[1mm]
        multicolumn{3}{c}{includegraphics[width=35mm]{example-image-a}hspace{2mm}includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        Nice... Clever!



        But @egreg's answer is more clever!!! At least I found the problem!




        PS: My "double post" needs moderator attention ... but I think it is an exception and have to offer to this site since the first question was about placing figures and I just found out I have something to say here that didn't found somewhere else and it is useful and about tabulars with multicolumn... If one of the two posts should be deleted I suppose that deleting the first one (my answer on the original question) would be a better choice because here seems more useful for me. So, please (reviewers) add a comment before flagging for deletion.






        share















        1. First step...



          Ok, I have 5 figures and I need 3 on top and two on bottom, I want to control their placement... A tabular seems a good solution to me...




        Let's think:



        Three on top: {ccc}
        First row normal centered and I will split cells via multicolumn in second to share the space... But...



        begin{tabular}{ccc}
        include..&include..&include..\
        multicolumn{2}{c}&multicolumn{2}{c}
        end{tabular}


        Oh! writing the second multicolumn I realized that they became 4 columns...
        Don't even compiling...



        Seems I need a fourth column:



        Let's try:





        1. Second step... four columns:


        I will split the top middle columns with multicolumn:



        begin{tabular}{cccc}
        include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
        multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
        end{tabular}


        4 in the up row 4 in the next... perfect! Let's compile



        enter image description here



        Seems I didn't count correct... Lets count...




        • Above row 4 cells middle 2 merged

        • Below row 2 & 2 cells...


        Why first cell of second row doesn't merge with the second? This should give the fourth figure centered in two first columns like fifth... Why?



        Do I need to add a fifth column?



        Lets see:



        begin{tabular}{cccc}
        1&2&3&4\
        include...&multicolumn{2}{c}{include...}&include...\ %Nice... Let's finish with the next row
        multicolumn{2}{c}{include...}&multicolumn{2}{c}{include}
        end{tabular}


        enter image description here



        Fourth image stops before 2nd column... Lets think... Do I need 5 columns?





        1. Third step... Let's see the vertical lines there? before reporting a bug... But I should!


        Full code:



        documentclass{article}
        usepackage{graphicx}
        usepackage{xcolor}
        begin{document}
        begin{tabular}{|c|c|c|c|}
        1&2&3&4\
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
        multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        They need the bug report... But...



        Ok... I think I got it:



        The second column has no the width of the third... Of course... No width needed there... Lets add a width:



        ... Ok I will add centered 17.5mm in both the middle columns:



        documentclass{article}
        usepackage{graphicx}
        usepackage{array}
        begin{document}
        begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
        multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        Why me??? Let's ask at stackexchange... I am out of here!




        1. No more steps: Some explanation:


        Let's add the 1&2&3&4 row back there:



        documentclass{article}
        usepackage{graphicx}
        usepackage{array}
        begin{document}
        begin{tabular}{|c|>{centeringarraybackslash}p{17.5mm}|>{centeringarraybackslash}p{17.5mm}|c|}
        1&2&3&4\
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c|}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \
        multicolumn{2}{|c}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{|c|}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        Perfect... But what happened?



        LaTeX used just 3 columns since the maximum of the cells needed there was 3 per row... So, the first column was a single column and not really a multicolumn... By adding these help numbers... we are actually lucky and found out what happened... So, adding a full row with empty cells (but all the cells) can solve the problem... Then remove the extra vertical space of the line with [-1em] ... Also, with some simple thoughts the second row cells should not be centered because of the extra width of the first and last column... May be r and l is a better choice ... and a tabcolsep fixed width would help... same distance too (as tabcolsep between rows) and:



        documentclass{article}
        usepackage{graphicx}
        usepackage{array}
        begin{document}
        setlength{tabcolsep}{1mm}
        begin{tabular}{c>{centeringarraybackslash}p{17.5mm}>{centeringarraybackslash}p{17.5mm}c}
        &&&\[-1em]
        includegraphics[width=35mm]{example-image-a} & multicolumn{2}{c}{includegraphics[width=35mm]{example-image-b}} & includegraphics[width=35mm]{example-image-c} \[1mm]
        multicolumn{2}{r}{includegraphics[width=35mm]{example-image-a}} & multicolumn{2}{l}{includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        enter image description here



        But why didn't made it in a simpler tabular (of 3 columns)?



        documentclass{article}
        usepackage{graphicx}
        begin{document}
        setlength{tabcolsep}{1mm}
        begin{tabular}{ccc}
        includegraphics[width=35mm]{example-image-a}& includegraphics[width=35mm]{example-image-b}&includegraphics[width=35mm]{example-image-c}\[1mm]
        multicolumn{3}{c}{includegraphics[width=35mm]{example-image-a}hspace{2mm}includegraphics[width=35mm]{example-image-b}}
        end{tabular}
        end{document}


        Nice... Clever!



        But @egreg's answer is more clever!!! At least I found the problem!




        PS: My "double post" needs moderator attention ... but I think it is an exception and have to offer to this site since the first question was about placing figures and I just found out I have something to say here that didn't found somewhere else and it is useful and about tabulars with multicolumn... If one of the two posts should be deleted I suppose that deleting the first one (my answer on the original question) would be a better choice because here seems more useful for me. So, please (reviewers) add a comment before flagging for deletion.







        share











        share


        share










        answered 3 mins ago









        koleygrkoleygr

        12.8k11038




        12.8k11038






























            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%2f479863%2fwhy-adding-multicolumn-makes-my-column-to-disappear%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

            Installing LyX: “No textclass is found.”LyX installation error- text class not found- 'Reconfigure' or...

            (1602) Indiana Índice Designación y nombre Características orbitales Véase...

            Universidad Autónoma de Occidente Índice Historia Campus Facultades Programas Académicos Medios de...