Tcolorbox :: sidebyside option gives poor resultHow to use x coordinate of a point and y coordinate of other...
Easy code troubleshooting in wordpress
Auto Insert date into Notepad
How to deny access to SQL Server to certain login over SSMS, but allow over .Net SqlClient Data Provider
Did Amazon pay $0 in taxes last year?
Non-Italian European mafias in USA?
Are small insurances worth it
Is there any relevance to Thor getting his hair cut other than comedic value?
When was drinking water recognized as crucial in marathon running?
Replacement ford fiesta radiator has extra hose
You'll find me clean when something is full
A "strange" unit radio astronomy
Where is the fallacy here?
Logistics of a hovering watercraft in a fantasy setting
Difference between 小吃 and 零食
Where is this triangular-shaped space station from?
Pure Functions: Does "No Side Effects" Imply "Always Same Output, Given Same Input"?
Is there a German word for “analytics”?
What is a term for a function that when called repeatedly, has the same effect as calling once?
Six real numbers so that product of any five is the sixth one
How can I be pwned if I'm not registered on that site?
Compare four integers, return word based on maximum
What if I store 10TB on azure servers and then keep the vm powered off?
Can you use a beast's innate abilities while polymorphed?
The change directory (cd) command is not working with a USB drive
Tcolorbox :: sidebyside option gives poor result
How to use x coordinate of a point and y coordinate of other point?tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environmenttabularx option in tcolorboxTcolorbox sidebyside right side “top align” problemrefstepcounter in tcolorbox optiontcolorbox: `height fill` as option to `tcbraster`tcolorbox: Breakable option not workingtcolorbox disable blank optionMacro as option of tcolorboxDefinition of tcolorbox multi option style in one timetcolorbox: unset or overrule option “listing side text”tcolorbox newtcbtheorem “label separator” option
sidebyside option gives poor result...
without sidebyside, code works well.
documentclass[10pt,xcolor={usenames,dvipsnames,svgnames}]{beamer}
usepackage[most]{tcolorbox}
definecolor{linen}{HTML}{FAF0E6}
definecolor{sandybrown}{rgb}{0.96, 0.64, 0.38}
begin{document}
begin{frame}
begin{tcolorbox}[title=Formulas,
%sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation style={dashed, red},
segmentation code={
path[color=red,draw]
(segmentation.west) -- (segmentation.east);}
]
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
%
tcblower
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
end{tcolorbox}
end{frame}
end{document}
WITHOUT sidebyside...
WITH sidebyside...
tcolorbox
add a comment |
sidebyside option gives poor result...
without sidebyside, code works well.
documentclass[10pt,xcolor={usenames,dvipsnames,svgnames}]{beamer}
usepackage[most]{tcolorbox}
definecolor{linen}{HTML}{FAF0E6}
definecolor{sandybrown}{rgb}{0.96, 0.64, 0.38}
begin{document}
begin{frame}
begin{tcolorbox}[title=Formulas,
%sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation style={dashed, red},
segmentation code={
path[color=red,draw]
(segmentation.west) -- (segmentation.east);}
]
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
%
tcblower
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
end{tcolorbox}
end{frame}
end{document}
WITHOUT sidebyside...
WITH sidebyside...
tcolorbox
add a comment |
sidebyside option gives poor result...
without sidebyside, code works well.
documentclass[10pt,xcolor={usenames,dvipsnames,svgnames}]{beamer}
usepackage[most]{tcolorbox}
definecolor{linen}{HTML}{FAF0E6}
definecolor{sandybrown}{rgb}{0.96, 0.64, 0.38}
begin{document}
begin{frame}
begin{tcolorbox}[title=Formulas,
%sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation style={dashed, red},
segmentation code={
path[color=red,draw]
(segmentation.west) -- (segmentation.east);}
]
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
%
tcblower
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
end{tcolorbox}
end{frame}
end{document}
WITHOUT sidebyside...
WITH sidebyside...
tcolorbox
sidebyside option gives poor result...
without sidebyside, code works well.
documentclass[10pt,xcolor={usenames,dvipsnames,svgnames}]{beamer}
usepackage[most]{tcolorbox}
definecolor{linen}{HTML}{FAF0E6}
definecolor{sandybrown}{rgb}{0.96, 0.64, 0.38}
begin{document}
begin{frame}
begin{tcolorbox}[title=Formulas,
%sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation style={dashed, red},
segmentation code={
path[color=red,draw]
(segmentation.west) -- (segmentation.east);}
]
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
%
tcblower
Some Text bfseries{Some text}
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
tcbline
begin{equation*}
a = b + c
end{equation*}
end{tcolorbox}
end{frame}
end{document}
WITHOUT sidebyside...
WITH sidebyside...
tcolorbox
tcolorbox
edited Feb 20 at 5:26
sandu
asked Feb 20 at 5:19
sandusandu
3,50842855
3,50842855
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
In this case, why not use just a tabularx
inside the tcolorbox
?
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
rowcolors{1}{linen}{linen!70!DarkRed}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, fontupper=sffamily,%
coltext=DarkRed,
tabularx*={arrayrulecolor{DarkRed}}{>{centeringarraybackslash}X|%
>{centeringarraybackslash}X}]
Some Text bfseries{Some text} &
Some Text bfseries{Some text} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
Update:
OP images show a left aligned text on first line. In my original answer I couldn't reproduce this behaviour due to a problem when a multicolumn
command is introduced in first cell of a tabularx tcolorbox. This problem is shown in tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environment. Now, thank you to Thomas F. Sturm (tcolorbox
author) there's a provisional solution for this problem.
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
makeatletter
tcbset{%
hackfortabularx/.code={%
deftcb@saveupperbox{%
begin{tcb@savebox}{tcb@upperbox}{tcb@w@upper}
kvtcb@fontupperkvtcb@halignupperkvtcb@before@upper}}
}
makeatother
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, hackfortabularx,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
2nd update:
The problem with multicolumn
command on left column of top most rule has been solved in tcolorbox v4.20
. There's no need for previous pacth. Seond figure can be obtained with:
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
add a comment |
The problem arises because the sidebyside
option appears to modify the segmentation node so that tcblower
can produce a vertical line between the two units instead of the usual horizontal one. Consequently, tcbline
does not work as expected, since it uses the same segmentation code which relies on the segmentation node.
I can't find any examples in the package documentation of using tcbline
with the sidebyside
option, so it is not clear doing so is supported.
You can get a box reasonably close to your intended result with a solid, vertical line by setting your segmentation style to solid (red) and removing the segmentation code (Which is causing problems). Dashed horizontal lines are not present, however.
The changes
segmentation style={solid, red}
% segmentation code={
% path[color=red,draw]
% (segmentation.west) -- (segmentation.east);}
produces
The only workaround I can see is to manually draw the segmentation lines using the overlay
option (disabling the in-built ones with the segmentation hidden
key). You can do this somewhat pragmatically using the frame
node and the tikizlibrary calc
library:
% usetikzlibrary{calc} % Preamble
% Box options
[title=Formulas,
sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation hidden, % Hide the inbuilt segmentation - we're drawing our own
overlay={
coordinate (FL) at (frame.west);
coordinate (FT) at (frame.north);
coordinate (FR) at (frame.east);
coordinate (FB) at (frame.south);
coordinate (L1) at (frame.center); % Center of frame is about right height
coordinate (L2) at (0,1.1); % Second dashed line at height of 1.1
defborderthickness{2} % Offset due to borders of box
deftitlethickness{15} % Offset due to box title
draw [red,dashed] let p{FT}=(FT),p{FB}=(FB) in (x{FB},y{FB}+borderthickness) -- (x{FT},y{FT}-titlethickness);
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L1}=(L1) in (x{FL}+borderthickness,y{L1}) -- (x{FR}-borderthickness,y{L1});
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L2}=(L2) in (x{FL}+borderthickness,y{L2}) -- (x{FR}-borderthickness,y{L2});
}
]
For use of let
in draw
commands, see, for example, this answer. When constructing future boxes, you should hopefully only have to edit the coordinates L1
and L2
to get the height of the horizontal lines correct (note that only the y-component of these coordinates is used).
Output:
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%2f475768%2ftcolorbox-sidebyside-option-gives-poor-result%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
In this case, why not use just a tabularx
inside the tcolorbox
?
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
rowcolors{1}{linen}{linen!70!DarkRed}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, fontupper=sffamily,%
coltext=DarkRed,
tabularx*={arrayrulecolor{DarkRed}}{>{centeringarraybackslash}X|%
>{centeringarraybackslash}X}]
Some Text bfseries{Some text} &
Some Text bfseries{Some text} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
Update:
OP images show a left aligned text on first line. In my original answer I couldn't reproduce this behaviour due to a problem when a multicolumn
command is introduced in first cell of a tabularx tcolorbox. This problem is shown in tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environment. Now, thank you to Thomas F. Sturm (tcolorbox
author) there's a provisional solution for this problem.
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
makeatletter
tcbset{%
hackfortabularx/.code={%
deftcb@saveupperbox{%
begin{tcb@savebox}{tcb@upperbox}{tcb@w@upper}
kvtcb@fontupperkvtcb@halignupperkvtcb@before@upper}}
}
makeatother
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, hackfortabularx,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
2nd update:
The problem with multicolumn
command on left column of top most rule has been solved in tcolorbox v4.20
. There's no need for previous pacth. Seond figure can be obtained with:
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
add a comment |
In this case, why not use just a tabularx
inside the tcolorbox
?
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
rowcolors{1}{linen}{linen!70!DarkRed}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, fontupper=sffamily,%
coltext=DarkRed,
tabularx*={arrayrulecolor{DarkRed}}{>{centeringarraybackslash}X|%
>{centeringarraybackslash}X}]
Some Text bfseries{Some text} &
Some Text bfseries{Some text} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
Update:
OP images show a left aligned text on first line. In my original answer I couldn't reproduce this behaviour due to a problem when a multicolumn
command is introduced in first cell of a tabularx tcolorbox. This problem is shown in tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environment. Now, thank you to Thomas F. Sturm (tcolorbox
author) there's a provisional solution for this problem.
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
makeatletter
tcbset{%
hackfortabularx/.code={%
deftcb@saveupperbox{%
begin{tcb@savebox}{tcb@upperbox}{tcb@w@upper}
kvtcb@fontupperkvtcb@halignupperkvtcb@before@upper}}
}
makeatother
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, hackfortabularx,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
2nd update:
The problem with multicolumn
command on left column of top most rule has been solved in tcolorbox v4.20
. There's no need for previous pacth. Seond figure can be obtained with:
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
add a comment |
In this case, why not use just a tabularx
inside the tcolorbox
?
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
rowcolors{1}{linen}{linen!70!DarkRed}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, fontupper=sffamily,%
coltext=DarkRed,
tabularx*={arrayrulecolor{DarkRed}}{>{centeringarraybackslash}X|%
>{centeringarraybackslash}X}]
Some Text bfseries{Some text} &
Some Text bfseries{Some text} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
Update:
OP images show a left aligned text on first line. In my original answer I couldn't reproduce this behaviour due to a problem when a multicolumn
command is introduced in first cell of a tabularx tcolorbox. This problem is shown in tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environment. Now, thank you to Thomas F. Sturm (tcolorbox
author) there's a provisional solution for this problem.
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
makeatletter
tcbset{%
hackfortabularx/.code={%
deftcb@saveupperbox{%
begin{tcb@savebox}{tcb@upperbox}{tcb@w@upper}
kvtcb@fontupperkvtcb@halignupperkvtcb@before@upper}}
}
makeatother
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, hackfortabularx,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
2nd update:
The problem with multicolumn
command on left column of top most rule has been solved in tcolorbox v4.20
. There's no need for previous pacth. Seond figure can be obtained with:
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
In this case, why not use just a tabularx
inside the tcolorbox
?
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
rowcolors{1}{linen}{linen!70!DarkRed}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, fontupper=sffamily,%
coltext=DarkRed,
tabularx*={arrayrulecolor{DarkRed}}{>{centeringarraybackslash}X|%
>{centeringarraybackslash}X}]
Some Text bfseries{Some text} &
Some Text bfseries{Some text} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
Update:
OP images show a left aligned text on first line. In my original answer I couldn't reproduce this behaviour due to a problem when a multicolumn
command is introduced in first cell of a tabularx tcolorbox. This problem is shown in tcolorbox, tabularx: first line with a multicolumn does not work in tcolorbox environment. Now, thank you to Thomas F. Sturm (tcolorbox
author) there's a provisional solution for this problem.
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
makeatletter
tcbset{%
hackfortabularx/.code={%
deftcb@saveupperbox{%
begin{tcb@savebox}{tcb@upperbox}{tcb@w@upper}
kvtcb@fontupperkvtcb@halignupperkvtcb@before@upper}}
}
makeatother
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper, hackfortabularx,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
2nd update:
The problem with multicolumn
command on left column of top most rule has been solved in tcolorbox v4.20
. There's no need for previous pacth. Seond figure can be obtained with:
documentclass[10pt,xcolor={table, usenames, dvipsnames, svgnames}]{beamer}
usepackage[T1]{fontenc}
usepackage{array,tabularx}
usepackage[most]{tcolorbox}
definecolor{sandybrown}{rgb}{0.96,0.64,0.38}
definecolor{linen}{HTML}{FAF0E6}
begin{document}
begin{frame}
begin{tcolorbox}[enhanced, colback=linen, colframe=sandybrown,
title=Formulas, coltitle=white, fonttitle=smallbfseries,
clip upper,
fontupper=sffamily, coltext=DarkRed,
tabularx*={rowcolors{1}{linen}{linen!70!DarkRed}arrayrulecolor{DarkRed}}%
{>{centeringarraybackslash}X|>{centeringarraybackslash}X}]
multicolumn{1}{l|}{Some Text bfseries{Some text}} &
multicolumn{1}{l}{Some Text bfseries{Some text}} \hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$\hline
$a= b+c$ & $a= b+c$
end{tcolorbox}
end{frame}
end{document}
edited 17 hours ago
answered Feb 20 at 9:33
IgnasiIgnasi
93.9k4170312
93.9k4170312
add a comment |
add a comment |
The problem arises because the sidebyside
option appears to modify the segmentation node so that tcblower
can produce a vertical line between the two units instead of the usual horizontal one. Consequently, tcbline
does not work as expected, since it uses the same segmentation code which relies on the segmentation node.
I can't find any examples in the package documentation of using tcbline
with the sidebyside
option, so it is not clear doing so is supported.
You can get a box reasonably close to your intended result with a solid, vertical line by setting your segmentation style to solid (red) and removing the segmentation code (Which is causing problems). Dashed horizontal lines are not present, however.
The changes
segmentation style={solid, red}
% segmentation code={
% path[color=red,draw]
% (segmentation.west) -- (segmentation.east);}
produces
The only workaround I can see is to manually draw the segmentation lines using the overlay
option (disabling the in-built ones with the segmentation hidden
key). You can do this somewhat pragmatically using the frame
node and the tikizlibrary calc
library:
% usetikzlibrary{calc} % Preamble
% Box options
[title=Formulas,
sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation hidden, % Hide the inbuilt segmentation - we're drawing our own
overlay={
coordinate (FL) at (frame.west);
coordinate (FT) at (frame.north);
coordinate (FR) at (frame.east);
coordinate (FB) at (frame.south);
coordinate (L1) at (frame.center); % Center of frame is about right height
coordinate (L2) at (0,1.1); % Second dashed line at height of 1.1
defborderthickness{2} % Offset due to borders of box
deftitlethickness{15} % Offset due to box title
draw [red,dashed] let p{FT}=(FT),p{FB}=(FB) in (x{FB},y{FB}+borderthickness) -- (x{FT},y{FT}-titlethickness);
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L1}=(L1) in (x{FL}+borderthickness,y{L1}) -- (x{FR}-borderthickness,y{L1});
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L2}=(L2) in (x{FL}+borderthickness,y{L2}) -- (x{FR}-borderthickness,y{L2});
}
]
For use of let
in draw
commands, see, for example, this answer. When constructing future boxes, you should hopefully only have to edit the coordinates L1
and L2
to get the height of the horizontal lines correct (note that only the y-component of these coordinates is used).
Output:
add a comment |
The problem arises because the sidebyside
option appears to modify the segmentation node so that tcblower
can produce a vertical line between the two units instead of the usual horizontal one. Consequently, tcbline
does not work as expected, since it uses the same segmentation code which relies on the segmentation node.
I can't find any examples in the package documentation of using tcbline
with the sidebyside
option, so it is not clear doing so is supported.
You can get a box reasonably close to your intended result with a solid, vertical line by setting your segmentation style to solid (red) and removing the segmentation code (Which is causing problems). Dashed horizontal lines are not present, however.
The changes
segmentation style={solid, red}
% segmentation code={
% path[color=red,draw]
% (segmentation.west) -- (segmentation.east);}
produces
The only workaround I can see is to manually draw the segmentation lines using the overlay
option (disabling the in-built ones with the segmentation hidden
key). You can do this somewhat pragmatically using the frame
node and the tikizlibrary calc
library:
% usetikzlibrary{calc} % Preamble
% Box options
[title=Formulas,
sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation hidden, % Hide the inbuilt segmentation - we're drawing our own
overlay={
coordinate (FL) at (frame.west);
coordinate (FT) at (frame.north);
coordinate (FR) at (frame.east);
coordinate (FB) at (frame.south);
coordinate (L1) at (frame.center); % Center of frame is about right height
coordinate (L2) at (0,1.1); % Second dashed line at height of 1.1
defborderthickness{2} % Offset due to borders of box
deftitlethickness{15} % Offset due to box title
draw [red,dashed] let p{FT}=(FT),p{FB}=(FB) in (x{FB},y{FB}+borderthickness) -- (x{FT},y{FT}-titlethickness);
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L1}=(L1) in (x{FL}+borderthickness,y{L1}) -- (x{FR}-borderthickness,y{L1});
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L2}=(L2) in (x{FL}+borderthickness,y{L2}) -- (x{FR}-borderthickness,y{L2});
}
]
For use of let
in draw
commands, see, for example, this answer. When constructing future boxes, you should hopefully only have to edit the coordinates L1
and L2
to get the height of the horizontal lines correct (note that only the y-component of these coordinates is used).
Output:
add a comment |
The problem arises because the sidebyside
option appears to modify the segmentation node so that tcblower
can produce a vertical line between the two units instead of the usual horizontal one. Consequently, tcbline
does not work as expected, since it uses the same segmentation code which relies on the segmentation node.
I can't find any examples in the package documentation of using tcbline
with the sidebyside
option, so it is not clear doing so is supported.
You can get a box reasonably close to your intended result with a solid, vertical line by setting your segmentation style to solid (red) and removing the segmentation code (Which is causing problems). Dashed horizontal lines are not present, however.
The changes
segmentation style={solid, red}
% segmentation code={
% path[color=red,draw]
% (segmentation.west) -- (segmentation.east);}
produces
The only workaround I can see is to manually draw the segmentation lines using the overlay
option (disabling the in-built ones with the segmentation hidden
key). You can do this somewhat pragmatically using the frame
node and the tikizlibrary calc
library:
% usetikzlibrary{calc} % Preamble
% Box options
[title=Formulas,
sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation hidden, % Hide the inbuilt segmentation - we're drawing our own
overlay={
coordinate (FL) at (frame.west);
coordinate (FT) at (frame.north);
coordinate (FR) at (frame.east);
coordinate (FB) at (frame.south);
coordinate (L1) at (frame.center); % Center of frame is about right height
coordinate (L2) at (0,1.1); % Second dashed line at height of 1.1
defborderthickness{2} % Offset due to borders of box
deftitlethickness{15} % Offset due to box title
draw [red,dashed] let p{FT}=(FT),p{FB}=(FB) in (x{FB},y{FB}+borderthickness) -- (x{FT},y{FT}-titlethickness);
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L1}=(L1) in (x{FL}+borderthickness,y{L1}) -- (x{FR}-borderthickness,y{L1});
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L2}=(L2) in (x{FL}+borderthickness,y{L2}) -- (x{FR}-borderthickness,y{L2});
}
]
For use of let
in draw
commands, see, for example, this answer. When constructing future boxes, you should hopefully only have to edit the coordinates L1
and L2
to get the height of the horizontal lines correct (note that only the y-component of these coordinates is used).
Output:
The problem arises because the sidebyside
option appears to modify the segmentation node so that tcblower
can produce a vertical line between the two units instead of the usual horizontal one. Consequently, tcbline
does not work as expected, since it uses the same segmentation code which relies on the segmentation node.
I can't find any examples in the package documentation of using tcbline
with the sidebyside
option, so it is not clear doing so is supported.
You can get a box reasonably close to your intended result with a solid, vertical line by setting your segmentation style to solid (red) and removing the segmentation code (Which is causing problems). Dashed horizontal lines are not present, however.
The changes
segmentation style={solid, red}
% segmentation code={
% path[color=red,draw]
% (segmentation.west) -- (segmentation.east);}
produces
The only workaround I can see is to manually draw the segmentation lines using the overlay
option (disabling the in-built ones with the segmentation hidden
key). You can do this somewhat pragmatically using the frame
node and the tikizlibrary calc
library:
% usetikzlibrary{calc} % Preamble
% Box options
[title=Formulas,
sidebyside,
enhanced,
colback=linen,
colframe=sandybrown,
coltext=DarkRed,
coltitle=white,
fonttitle=smallbfseries,
fontupper=noindent,
segmentation hidden, % Hide the inbuilt segmentation - we're drawing our own
overlay={
coordinate (FL) at (frame.west);
coordinate (FT) at (frame.north);
coordinate (FR) at (frame.east);
coordinate (FB) at (frame.south);
coordinate (L1) at (frame.center); % Center of frame is about right height
coordinate (L2) at (0,1.1); % Second dashed line at height of 1.1
defborderthickness{2} % Offset due to borders of box
deftitlethickness{15} % Offset due to box title
draw [red,dashed] let p{FT}=(FT),p{FB}=(FB) in (x{FB},y{FB}+borderthickness) -- (x{FT},y{FT}-titlethickness);
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L1}=(L1) in (x{FL}+borderthickness,y{L1}) -- (x{FR}-borderthickness,y{L1});
draw [red,dashed] let p{FR}=(FR),p{FL}=(FL),p{L2}=(L2) in (x{FL}+borderthickness,y{L2}) -- (x{FR}-borderthickness,y{L2});
}
]
For use of let
in draw
commands, see, for example, this answer. When constructing future boxes, you should hopefully only have to edit the coordinates L1
and L2
to get the height of the horizontal lines correct (note that only the y-component of these coordinates is used).
Output:
edited Feb 20 at 8:46
answered Feb 20 at 7:36
Pippip19Pippip19
1,5388
1,5388
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%2f475768%2ftcolorbox-sidebyside-option-gives-poor-result%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