Why adding one more `multicolumn` disappears my extra column?How to align subfigures in this specific grid?
Why no Iridium-level flares from other satellites?
Bacteria contamination inside a thermos bottle
Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible
Bach's Toccata and Fugue in D minor breaks the "no parallel octaves" rule?
Do I need to be arrogant to get ahead?
How to terminate ping <dest> &
Meme-controlled people
Professor being mistaken for a grad student
Are Roman Catholic priests ever addressed as pastor
Are ETF trackers fundamentally better than individual stocks?
I got the following comment from a reputed math journal. What does it mean?
Python if-else code style for reduced code for rounding floats
Describing a chess game in a novel
How do I hide Chekhov's Gun?
Math equation in non italic font
How to pronounce "I ♥ Huckabees"?
This word with a lot of past tenses
Why does energy conservation give me the wrong answer in this inelastic collision problem?
What options are left, if Britain cannot decide?
Examples of transfinite towers
Official degrees of earth’s rotation per day
Are all passive ability checks floors for active ability checks?
Violin - Can double stops be played when the strings are not next to each other?
Problem with FindRoot
Why adding one more `multicolumn` disappears my extra column?
How to align subfigures in this specific grid?
The original question is about placing figures inside a tabular and trying to adjust them like this:
with a code similar to this:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
That for some reason gives this output:
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
add a comment |
The original question is about placing figures inside a tabular and trying to adjust them like this:
with a code similar to this:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
That for some reason gives this output:
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
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
38 secs ago
add a comment |
The original question is about placing figures inside a tabular and trying to adjust them like this:
with a code similar to this:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
That for some reason gives this output:
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
The original question is about placing figures inside a tabular and trying to adjust them like this:
with a code similar to this:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
That for some reason gives this output:
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
tables multicolumn cell
asked 2 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
38 secs ago
add a comment |
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
38 secs 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
38 secs 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
38 secs ago
add a comment |
1 Answer
1
active
oldest
votes
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...
begintabularccc
include..&include..&include..\
multicolumn2c&multicolumn2c
endtabular
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:
Second step... four columns:
I will split the top middle columns with multicolumn
:
begintabularcccc
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
4 in the up row 4 in the next... perfect! Let's compile
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:
begintabularcccc
1&2&3&4\
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
Fourth image stops before 2nd column... Lets think... Do I need 5 columns?
Third step... Let's see the vertical lines there? before reporting a bug... But I should!
Full code:
documentclassarticle
usepackagegraphicx
usepackagexcolor
begindocument
begintabularc
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
Why me??? Let's ask at stackexchange... I am out of here!
- No more steps: Some explanation:
Let's add the 1&2&3&4 row back there:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
setlengthtabcolsep1mm
begintabularc>centeringarraybackslashp17.5mm>centeringarraybackslashp17.5mmc
&&&\[-1em]
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \[1mm]
multicolumn2rincludegraphics[width=35mm]example-image-a & multicolumn2lincludegraphics[width=35mm]example-image-b
endtabular
enddocument
But why didn't made it in a simpler tabular (of 3 columns)?
documentclassarticle
usepackagegraphicx
begindocument
setlengthtabcolsep1mm
begintabularccc
includegraphics[width=35mm]example-image-a& includegraphics[width=35mm]example-image-b&includegraphics[width=35mm]example-image-c\[1mm]
multicolumn3cincludegraphics[width=35mm]example-image-ahspace2mmincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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
withmulticolumn
... 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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479863%2fwhy-adding-one-more-multicolumn-disappears-my-extra-column%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
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...
begintabularccc
include..&include..&include..\
multicolumn2c&multicolumn2c
endtabular
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:
Second step... four columns:
I will split the top middle columns with multicolumn
:
begintabularcccc
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
4 in the up row 4 in the next... perfect! Let's compile
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:
begintabularcccc
1&2&3&4\
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
Fourth image stops before 2nd column... Lets think... Do I need 5 columns?
Third step... Let's see the vertical lines there? before reporting a bug... But I should!
Full code:
documentclassarticle
usepackagegraphicx
usepackagexcolor
begindocument
begintabularc
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
Why me??? Let's ask at stackexchange... I am out of here!
- No more steps: Some explanation:
Let's add the 1&2&3&4 row back there:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
setlengthtabcolsep1mm
begintabularc>centeringarraybackslashp17.5mm>centeringarraybackslashp17.5mmc
&&&\[-1em]
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \[1mm]
multicolumn2rincludegraphics[width=35mm]example-image-a & multicolumn2lincludegraphics[width=35mm]example-image-b
endtabular
enddocument
But why didn't made it in a simpler tabular (of 3 columns)?
documentclassarticle
usepackagegraphicx
begindocument
setlengthtabcolsep1mm
begintabularccc
includegraphics[width=35mm]example-image-a& includegraphics[width=35mm]example-image-b&includegraphics[width=35mm]example-image-c\[1mm]
multicolumn3cincludegraphics[width=35mm]example-image-ahspace2mmincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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
withmulticolumn
... 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.
add a comment |
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...
begintabularccc
include..&include..&include..\
multicolumn2c&multicolumn2c
endtabular
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:
Second step... four columns:
I will split the top middle columns with multicolumn
:
begintabularcccc
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
4 in the up row 4 in the next... perfect! Let's compile
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:
begintabularcccc
1&2&3&4\
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
Fourth image stops before 2nd column... Lets think... Do I need 5 columns?
Third step... Let's see the vertical lines there? before reporting a bug... But I should!
Full code:
documentclassarticle
usepackagegraphicx
usepackagexcolor
begindocument
begintabularc
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
Why me??? Let's ask at stackexchange... I am out of here!
- No more steps: Some explanation:
Let's add the 1&2&3&4 row back there:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
setlengthtabcolsep1mm
begintabularc>centeringarraybackslashp17.5mm>centeringarraybackslashp17.5mmc
&&&\[-1em]
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \[1mm]
multicolumn2rincludegraphics[width=35mm]example-image-a & multicolumn2lincludegraphics[width=35mm]example-image-b
endtabular
enddocument
But why didn't made it in a simpler tabular (of 3 columns)?
documentclassarticle
usepackagegraphicx
begindocument
setlengthtabcolsep1mm
begintabularccc
includegraphics[width=35mm]example-image-a& includegraphics[width=35mm]example-image-b&includegraphics[width=35mm]example-image-c\[1mm]
multicolumn3cincludegraphics[width=35mm]example-image-ahspace2mmincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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
withmulticolumn
... 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.
add a comment |
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...
begintabularccc
include..&include..&include..\
multicolumn2c&multicolumn2c
endtabular
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:
Second step... four columns:
I will split the top middle columns with multicolumn
:
begintabularcccc
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
4 in the up row 4 in the next... perfect! Let's compile
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:
begintabularcccc
1&2&3&4\
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
Fourth image stops before 2nd column... Lets think... Do I need 5 columns?
Third step... Let's see the vertical lines there? before reporting a bug... But I should!
Full code:
documentclassarticle
usepackagegraphicx
usepackagexcolor
begindocument
begintabularc
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
Why me??? Let's ask at stackexchange... I am out of here!
- No more steps: Some explanation:
Let's add the 1&2&3&4 row back there:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
setlengthtabcolsep1mm
begintabularc>centeringarraybackslashp17.5mm>centeringarraybackslashp17.5mmc
&&&\[-1em]
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \[1mm]
multicolumn2rincludegraphics[width=35mm]example-image-a & multicolumn2lincludegraphics[width=35mm]example-image-b
endtabular
enddocument
But why didn't made it in a simpler tabular (of 3 columns)?
documentclassarticle
usepackagegraphicx
begindocument
setlengthtabcolsep1mm
begintabularccc
includegraphics[width=35mm]example-image-a& includegraphics[width=35mm]example-image-b&includegraphics[width=35mm]example-image-c\[1mm]
multicolumn3cincludegraphics[width=35mm]example-image-ahspace2mmincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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
withmulticolumn
... 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.
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...
begintabularccc
include..&include..&include..\
multicolumn2c&multicolumn2c
endtabular
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:
Second step... four columns:
I will split the top middle columns with multicolumn
:
begintabularcccc
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
4 in the up row 4 in the next... perfect! Let's compile
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:
begintabularcccc
1&2&3&4\
include...&multicolumn2cinclude...&include...\ %Nice... Let's finish with the next row
multicolumn2cinclude...&multicolumn2cinclude
endtabular
Fourth image stops before 2nd column... Lets think... Do I need 5 columns?
Third step... Let's see the vertical lines there? before reporting a bug... But I should!
Full code:
documentclassarticle
usepackagegraphicx
usepackagexcolor
begindocument
begintabularc
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
Why me??? Let's ask at stackexchange... I am out of here!
- No more steps: Some explanation:
Let's add the 1&2&3&4 row back there:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
begintabular
1&2&3&4\
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \
multicolumn2includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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:
documentclassarticle
usepackagegraphicx
usepackagearray
begindocument
setlengthtabcolsep1mm
begintabularc>centeringarraybackslashp17.5mm>centeringarraybackslashp17.5mmc
&&&\[-1em]
includegraphics[width=35mm]example-image-a & multicolumn2cincludegraphics[width=35mm]example-image-b & includegraphics[width=35mm]example-image-c \[1mm]
multicolumn2rincludegraphics[width=35mm]example-image-a & multicolumn2lincludegraphics[width=35mm]example-image-b
endtabular
enddocument
But why didn't made it in a simpler tabular (of 3 columns)?
documentclassarticle
usepackagegraphicx
begindocument
setlengthtabcolsep1mm
begintabularccc
includegraphics[width=35mm]example-image-a& includegraphics[width=35mm]example-image-b&includegraphics[width=35mm]example-image-c\[1mm]
multicolumn3cincludegraphics[width=35mm]example-image-ahspace2mmincludegraphics[width=35mm]example-image-b
endtabular
enddocument
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
withmulticolumn
... 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.
answered 2 mins ago
koleygrkoleygr
12.8k11038
12.8k11038
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479863%2fwhy-adding-one-more-multicolumn-disappears-my-extra-column%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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
38 secs ago