tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environmentTcolorbox ::...
How to avoid being sexist when trying to employ someone to function in a very sexist environment?
Avoiding unpacking an array when altering its dimension
Easy code troubleshooting in wordpress
Is there a frame of reference in which I was born before I was conceived?
What are these green text/line displays shown during the livestream of Crew Dragon's approach to dock with the ISS?
Where is this triangular-shaped space station from?
Is there a low-level alternative to Animate Objects?
Must a tritone substitution use a dominant seventh chord?
Has the Isbell–Freyd criterion ever been used to check that a category is concretisable?
Skis versus snow shoes - when to choose which for travelling the backcountry?
Make me a metasequence
I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?
How can I be pwned if I'm not registered on that site?
Does music exist in Panem? And if so, what kinds of music?
Logistics of a hovering watercraft in a fantasy setting
How to properly claim credit for peer review?
Whom do I have to contact for a ticket refund in case of denied boarding (in the EU)?
How would we write a misogynistic character without offending people?
How to count occurrences of Friday 13th
You'll find me clean when something is full
What can I substitute for soda pop in a sweet pork recipe?
How do ISS astronauts "get their stripes"?
Second-rate spelling
What type of postprocessing gives the effect of people standing out
tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environment
Tcolorbox :: sidebyside option gives poor resultmulticolumn command with tabularx environmenttcolorbox overlay app does not worktcolorbox `interior titled code app` does not workTabularx option in tcolorbox: how to colored the first row?tcolorbox breakable raster does not work if a cell breaksCentering in Tabularx does not worktabularx with multicolumn and multirowmulticolumn not working with pgfplotstabletypeset and tabularxEnvironment with multiple parts does not worktabularx inside tcolorbox not centered properly
I have a problem with tabularx
in a tcolorbox
environment, here is the code:
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
In a regular tabularx
environment, the table is okay (see 2nd table). However, if I do the same in a tcolorbox
environment (1st table), the first line, which contains a multicolumn
, does not work, whereas the other 5 show up, if one passes all the errors.
The error is (appears 6x):
! Misplaced omit.
multispan ->omit
@multispan
l.31 end{tcolorbox}
?
I tried to play with the 'size' of the first multicolumn but did not succeed.
Any help is highly appreciated. Thanks.
tabularx tcolorbox
add a comment |
I have a problem with tabularx
in a tcolorbox
environment, here is the code:
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
In a regular tabularx
environment, the table is okay (see 2nd table). However, if I do the same in a tcolorbox
environment (1st table), the first line, which contains a multicolumn
, does not work, whereas the other 5 show up, if one passes all the errors.
The error is (appears 6x):
! Misplaced omit.
multispan ->omit
@multispan
l.31 end{tcolorbox}
?
I tried to play with the 'size' of the first multicolumn but did not succeed.
Any help is highly appreciated. Thanks.
tabularx tcolorbox
unrelated to the error but youribs
heading is wrong , you have 3 X columns so the total width should be 3hsize and 1+.005+.15 is not 3, tabularx will most likely fail to converge to sensible size given that input.
– David Carlisle
Jan 30 '17 at 11:09
David: If I use 2.845+.005+.15 = 3, everything is put to the left of the table.
– Krumpel
Jan 30 '17 at 11:23
I do not know your intended design but any output made by tabularx given widths of 1+.005+.15 is entirely accidental , there is only one rule in the tabularx documentation and that is, don't do that:-)
– David Carlisle
Jan 30 '17 at 11:29
I agree since I found your example below ... . Sorry, I couldn't wait. ;-)
– Krumpel
Jan 30 '17 at 11:38
add a comment |
I have a problem with tabularx
in a tcolorbox
environment, here is the code:
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
In a regular tabularx
environment, the table is okay (see 2nd table). However, if I do the same in a tcolorbox
environment (1st table), the first line, which contains a multicolumn
, does not work, whereas the other 5 show up, if one passes all the errors.
The error is (appears 6x):
! Misplaced omit.
multispan ->omit
@multispan
l.31 end{tcolorbox}
?
I tried to play with the 'size' of the first multicolumn but did not succeed.
Any help is highly appreciated. Thanks.
tabularx tcolorbox
I have a problem with tabularx
in a tcolorbox
environment, here is the code:
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
In a regular tabularx
environment, the table is okay (see 2nd table). However, if I do the same in a tcolorbox
environment (1st table), the first line, which contains a multicolumn
, does not work, whereas the other 5 show up, if one passes all the errors.
The error is (appears 6x):
! Misplaced omit.
multispan ->omit
@multispan
l.31 end{tcolorbox}
?
I tried to play with the 'size' of the first multicolumn but did not succeed.
Any help is highly appreciated. Thanks.
tabularx tcolorbox
tabularx tcolorbox
asked Jan 30 '17 at 10:39
KrumpelKrumpel
873
873
unrelated to the error but youribs
heading is wrong , you have 3 X columns so the total width should be 3hsize and 1+.005+.15 is not 3, tabularx will most likely fail to converge to sensible size given that input.
– David Carlisle
Jan 30 '17 at 11:09
David: If I use 2.845+.005+.15 = 3, everything is put to the left of the table.
– Krumpel
Jan 30 '17 at 11:23
I do not know your intended design but any output made by tabularx given widths of 1+.005+.15 is entirely accidental , there is only one rule in the tabularx documentation and that is, don't do that:-)
– David Carlisle
Jan 30 '17 at 11:29
I agree since I found your example below ... . Sorry, I couldn't wait. ;-)
– Krumpel
Jan 30 '17 at 11:38
add a comment |
unrelated to the error but youribs
heading is wrong , you have 3 X columns so the total width should be 3hsize and 1+.005+.15 is not 3, tabularx will most likely fail to converge to sensible size given that input.
– David Carlisle
Jan 30 '17 at 11:09
David: If I use 2.845+.005+.15 = 3, everything is put to the left of the table.
– Krumpel
Jan 30 '17 at 11:23
I do not know your intended design but any output made by tabularx given widths of 1+.005+.15 is entirely accidental , there is only one rule in the tabularx documentation and that is, don't do that:-)
– David Carlisle
Jan 30 '17 at 11:29
I agree since I found your example below ... . Sorry, I couldn't wait. ;-)
– Krumpel
Jan 30 '17 at 11:38
unrelated to the error but your
ibs
heading is wrong , you have 3 X columns so the total width should be 3hsize and 1+.005+.15 is not 3, tabularx will most likely fail to converge to sensible size given that input.– David Carlisle
Jan 30 '17 at 11:09
unrelated to the error but your
ibs
heading is wrong , you have 3 X columns so the total width should be 3hsize and 1+.005+.15 is not 3, tabularx will most likely fail to converge to sensible size given that input.– David Carlisle
Jan 30 '17 at 11:09
David: If I use 2.845+.005+.15 = 3, everything is put to the left of the table.
– Krumpel
Jan 30 '17 at 11:23
David: If I use 2.845+.005+.15 = 3, everything is put to the left of the table.
– Krumpel
Jan 30 '17 at 11:23
I do not know your intended design but any output made by tabularx given widths of 1+.005+.15 is entirely accidental , there is only one rule in the tabularx documentation and that is, don't do that:-)
– David Carlisle
Jan 30 '17 at 11:29
I do not know your intended design but any output made by tabularx given widths of 1+.005+.15 is entirely accidental , there is only one rule in the tabularx documentation and that is, don't do that:-)
– David Carlisle
Jan 30 '17 at 11:29
I agree since I found your example below ... . Sorry, I couldn't wait. ;-)
– Krumpel
Jan 30 '17 at 11:38
I agree since I found your example below ... . Sorry, I couldn't wait. ;-)
– Krumpel
Jan 30 '17 at 11:38
add a comment |
2 Answers
2
active
oldest
votes
It's easiest to just put the multicolumn
in the second row, leaving an empty first row that you can back up with a negative vspace. I also fixed your ibs
definitions.
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{>{hsize=2.8hsize}X}
newcolumntype{i}{>{hsize=.05hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
errorcontextlines400
tracingonline2
%tracingall
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]%
\
noalign{vspace{-normalbaselineskip}}
multicolumn{2}{b}{Number}
& 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
Excellent, thanks a lot, it works! Q: Why must one insert first an empty row? Is that due to a 'bug'?
– Krumpel
Jan 30 '17 at 11:39
1
@Krumpelmulticolumn
has to be the first thing in the cell otherwise the cell template gets added and it is too late to substitute the spanning information. even invisible stuff likerelax
or{}
is enough to break it. So somewhere in the many lines of tcolorbox keyval processing it is is constructing a call to tabularx with{}
orrelax
or something:-) after the{ibs}
argument. I could spend a day tracing where but it's easier to write off that row and start again on the next row:-) (it may be worth giving the tcolorbox author a link to this, would be easier for him to trace)
– David Carlisle
Jan 30 '17 at 11:47
1
@Krumpel This is a tcolorbox bug, which has been reported today. By the moment, Thomas F. Sturm has provided a provisional hack to solve the problem. You can see how to use it in the update section of this answer
– Ignasi
Feb 20 at 16:00
add a comment |
This problem has been solved with tcolorbox v4.20
. Now, multicolumn
option can be used in top most row without problems.
OP's code
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
produces the expected result without any error message
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%2f351170%2ftcolorbox-tabularx-first-line-with-a-multicolumn-does-not-work-in-tcolorbox-en%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's easiest to just put the multicolumn
in the second row, leaving an empty first row that you can back up with a negative vspace. I also fixed your ibs
definitions.
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{>{hsize=2.8hsize}X}
newcolumntype{i}{>{hsize=.05hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
errorcontextlines400
tracingonline2
%tracingall
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]%
\
noalign{vspace{-normalbaselineskip}}
multicolumn{2}{b}{Number}
& 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
Excellent, thanks a lot, it works! Q: Why must one insert first an empty row? Is that due to a 'bug'?
– Krumpel
Jan 30 '17 at 11:39
1
@Krumpelmulticolumn
has to be the first thing in the cell otherwise the cell template gets added and it is too late to substitute the spanning information. even invisible stuff likerelax
or{}
is enough to break it. So somewhere in the many lines of tcolorbox keyval processing it is is constructing a call to tabularx with{}
orrelax
or something:-) after the{ibs}
argument. I could spend a day tracing where but it's easier to write off that row and start again on the next row:-) (it may be worth giving the tcolorbox author a link to this, would be easier for him to trace)
– David Carlisle
Jan 30 '17 at 11:47
1
@Krumpel This is a tcolorbox bug, which has been reported today. By the moment, Thomas F. Sturm has provided a provisional hack to solve the problem. You can see how to use it in the update section of this answer
– Ignasi
Feb 20 at 16:00
add a comment |
It's easiest to just put the multicolumn
in the second row, leaving an empty first row that you can back up with a negative vspace. I also fixed your ibs
definitions.
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{>{hsize=2.8hsize}X}
newcolumntype{i}{>{hsize=.05hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
errorcontextlines400
tracingonline2
%tracingall
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]%
\
noalign{vspace{-normalbaselineskip}}
multicolumn{2}{b}{Number}
& 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
Excellent, thanks a lot, it works! Q: Why must one insert first an empty row? Is that due to a 'bug'?
– Krumpel
Jan 30 '17 at 11:39
1
@Krumpelmulticolumn
has to be the first thing in the cell otherwise the cell template gets added and it is too late to substitute the spanning information. even invisible stuff likerelax
or{}
is enough to break it. So somewhere in the many lines of tcolorbox keyval processing it is is constructing a call to tabularx with{}
orrelax
or something:-) after the{ibs}
argument. I could spend a day tracing where but it's easier to write off that row and start again on the next row:-) (it may be worth giving the tcolorbox author a link to this, would be easier for him to trace)
– David Carlisle
Jan 30 '17 at 11:47
1
@Krumpel This is a tcolorbox bug, which has been reported today. By the moment, Thomas F. Sturm has provided a provisional hack to solve the problem. You can see how to use it in the update section of this answer
– Ignasi
Feb 20 at 16:00
add a comment |
It's easiest to just put the multicolumn
in the second row, leaving an empty first row that you can back up with a negative vspace. I also fixed your ibs
definitions.
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{>{hsize=2.8hsize}X}
newcolumntype{i}{>{hsize=.05hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
errorcontextlines400
tracingonline2
%tracingall
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]%
\
noalign{vspace{-normalbaselineskip}}
multicolumn{2}{b}{Number}
& 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
It's easiest to just put the multicolumn
in the second row, leaving an empty first row that you can back up with a negative vspace. I also fixed your ibs
definitions.
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{>{hsize=2.8hsize}X}
newcolumntype{i}{>{hsize=.05hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
errorcontextlines400
tracingonline2
%tracingall
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]%
\
noalign{vspace{-normalbaselineskip}}
multicolumn{2}{b}{Number}
& 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
answered Jan 30 '17 at 11:27
David CarlisleDavid Carlisle
493k4111371885
493k4111371885
Excellent, thanks a lot, it works! Q: Why must one insert first an empty row? Is that due to a 'bug'?
– Krumpel
Jan 30 '17 at 11:39
1
@Krumpelmulticolumn
has to be the first thing in the cell otherwise the cell template gets added and it is too late to substitute the spanning information. even invisible stuff likerelax
or{}
is enough to break it. So somewhere in the many lines of tcolorbox keyval processing it is is constructing a call to tabularx with{}
orrelax
or something:-) after the{ibs}
argument. I could spend a day tracing where but it's easier to write off that row and start again on the next row:-) (it may be worth giving the tcolorbox author a link to this, would be easier for him to trace)
– David Carlisle
Jan 30 '17 at 11:47
1
@Krumpel This is a tcolorbox bug, which has been reported today. By the moment, Thomas F. Sturm has provided a provisional hack to solve the problem. You can see how to use it in the update section of this answer
– Ignasi
Feb 20 at 16:00
add a comment |
Excellent, thanks a lot, it works! Q: Why must one insert first an empty row? Is that due to a 'bug'?
– Krumpel
Jan 30 '17 at 11:39
1
@Krumpelmulticolumn
has to be the first thing in the cell otherwise the cell template gets added and it is too late to substitute the spanning information. even invisible stuff likerelax
or{}
is enough to break it. So somewhere in the many lines of tcolorbox keyval processing it is is constructing a call to tabularx with{}
orrelax
or something:-) after the{ibs}
argument. I could spend a day tracing where but it's easier to write off that row and start again on the next row:-) (it may be worth giving the tcolorbox author a link to this, would be easier for him to trace)
– David Carlisle
Jan 30 '17 at 11:47
1
@Krumpel This is a tcolorbox bug, which has been reported today. By the moment, Thomas F. Sturm has provided a provisional hack to solve the problem. You can see how to use it in the update section of this answer
– Ignasi
Feb 20 at 16:00
Excellent, thanks a lot, it works! Q: Why must one insert first an empty row? Is that due to a 'bug'?
– Krumpel
Jan 30 '17 at 11:39
Excellent, thanks a lot, it works! Q: Why must one insert first an empty row? Is that due to a 'bug'?
– Krumpel
Jan 30 '17 at 11:39
1
1
@Krumpel
multicolumn
has to be the first thing in the cell otherwise the cell template gets added and it is too late to substitute the spanning information. even invisible stuff like relax
or {}
is enough to break it. So somewhere in the many lines of tcolorbox keyval processing it is is constructing a call to tabularx with {}
or relax
or something:-) after the {ibs}
argument. I could spend a day tracing where but it's easier to write off that row and start again on the next row:-) (it may be worth giving the tcolorbox author a link to this, would be easier for him to trace)– David Carlisle
Jan 30 '17 at 11:47
@Krumpel
multicolumn
has to be the first thing in the cell otherwise the cell template gets added and it is too late to substitute the spanning information. even invisible stuff like relax
or {}
is enough to break it. So somewhere in the many lines of tcolorbox keyval processing it is is constructing a call to tabularx with {}
or relax
or something:-) after the {ibs}
argument. I could spend a day tracing where but it's easier to write off that row and start again on the next row:-) (it may be worth giving the tcolorbox author a link to this, would be easier for him to trace)– David Carlisle
Jan 30 '17 at 11:47
1
1
@Krumpel This is a tcolorbox bug, which has been reported today. By the moment, Thomas F. Sturm has provided a provisional hack to solve the problem. You can see how to use it in the update section of this answer
– Ignasi
Feb 20 at 16:00
@Krumpel This is a tcolorbox bug, which has been reported today. By the moment, Thomas F. Sturm has provided a provisional hack to solve the problem. You can see how to use it in the update section of this answer
– Ignasi
Feb 20 at 16:00
add a comment |
This problem has been solved with tcolorbox v4.20
. Now, multicolumn
option can be used in top most row without problems.
OP's code
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
produces the expected result without any error message
add a comment |
This problem has been solved with tcolorbox v4.20
. Now, multicolumn
option can be used in top most row without problems.
OP's code
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
produces the expected result without any error message
add a comment |
This problem has been solved with tcolorbox v4.20
. Now, multicolumn
option can be used in top most row without problems.
OP's code
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
produces the expected result without any error message
This problem has been solved with tcolorbox v4.20
. Now, multicolumn
option can be used in top most row without problems.
OP's code
documentclass[]{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[most]{tcolorbox}
usepackage{tabularx}
usepackage{array}
usepackage{colortbl}
tcbuselibrary{skins}
begin{document}
newcolumntype{b}{X}
newcolumntype{i}{>{hsize=.005hsize}X}
newcolumntype{s}{>{hsize=.15hsize}X}
begin{table}
begin{center}
begin{tcolorbox}[colback=black!0.8!white,colframe=black!4!white,
colbacktitle=gray!40!white, coltitle=black,width=1.0linewidth,tabularx={ibs}]
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367
end{tcolorbox}
end{center}
end{table}
vspace{3cm}
begin{center}
begin{tabularx}{1.0linewidth}{ibs}
multicolumn{2}{b}{Number} & 11 \hline
& part a & 38 \hline
& part b & 4 \hline
& part c & 2 \hlinehline
multicolumn{2}{l}{Blabla 1} & 217 \hline
multicolumn{2}{l}{Blabla 2} & 20 \hline
multicolumn{2}{l}{Blabla 1} & 105 \hline
multicolumn{2}{l}{Blabla 1} & 3100 \hline
multicolumn{2}{l}{Blabla 1} & 367end{tabularx}
end{center}
vspace{3cm}
end{document}
produces the expected result without any error message
answered 17 hours ago
IgnasiIgnasi
93.9k4170312
93.9k4170312
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%2f351170%2ftcolorbox-tabularx-first-line-with-a-multicolumn-does-not-work-in-tcolorbox-en%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
unrelated to the error but your
ibs
heading is wrong , you have 3 X columns so the total width should be 3hsize and 1+.005+.15 is not 3, tabularx will most likely fail to converge to sensible size given that input.– David Carlisle
Jan 30 '17 at 11:09
David: If I use 2.845+.005+.15 = 3, everything is put to the left of the table.
– Krumpel
Jan 30 '17 at 11:23
I do not know your intended design but any output made by tabularx given widths of 1+.005+.15 is entirely accidental , there is only one rule in the tabularx documentation and that is, don't do that:-)
– David Carlisle
Jan 30 '17 at 11:29
I agree since I found your example below ... . Sorry, I couldn't wait. ;-)
– Krumpel
Jan 30 '17 at 11:38