Box half filled color
I am trying kinda to make this figure in tikz but I do not know how it works.
I tried with
tcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
But I can not fill both sides with color.
tikz-pgf draw fill
New contributor
add a comment |
I am trying kinda to make this figure in tikz but I do not know how it works.
I tried with
tcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
But I can not fill both sides with color.
tikz-pgf draw fill
New contributor
Box half filled with white.
– Dylan
2 days ago
disregard the white thing. Start from the black borders.
– Geo
yesterday
It was a pun on pessimism: en.wikipedia.org/wiki/Is_the_glass_half_empty_or_half_full%3F
– Dylan
yesterday
add a comment |
I am trying kinda to make this figure in tikz but I do not know how it works.
I tried with
tcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
But I can not fill both sides with color.
tikz-pgf draw fill
New contributor
I am trying kinda to make this figure in tikz but I do not know how it works.
I tried with
tcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
But I can not fill both sides with color.
tikz-pgf draw fill
tikz-pgf draw fill
New contributor
New contributor
New contributor
asked 2 days ago
GeoGeo
383
383
New contributor
New contributor
Box half filled with white.
– Dylan
2 days ago
disregard the white thing. Start from the black borders.
– Geo
yesterday
It was a pun on pessimism: en.wikipedia.org/wiki/Is_the_glass_half_empty_or_half_full%3F
– Dylan
yesterday
add a comment |
Box half filled with white.
– Dylan
2 days ago
disregard the white thing. Start from the black borders.
– Geo
yesterday
It was a pun on pessimism: en.wikipedia.org/wiki/Is_the_glass_half_empty_or_half_full%3F
– Dylan
yesterday
Box half filled with white.
– Dylan
2 days ago
Box half filled with white.
– Dylan
2 days ago
disregard the white thing. Start from the black borders.
– Geo
yesterday
disregard the white thing. Start from the black borders.
– Geo
yesterday
It was a pun on pessimism: en.wikipedia.org/wiki/Is_the_glass_half_empty_or_half_full%3F
– Dylan
yesterday
It was a pun on pessimism: en.wikipedia.org/wiki/Is_the_glass_half_empty_or_half_full%3F
– Dylan
yesterday
add a comment |
2 Answers
2
active
oldest
votes
If you prefer tcolorbox
:
documentclass{article}
usepackage[most]{tcolorbox}
begin{document}
begin{tcolorbox}[
sharp corners, boxsep=5mm, boxrule=.5mm,
colback=brown, width=5cm,
halign upper=left, valign upper=top,
halign lower=right, valign lower=bottom,
enhanced, segmentation empty,
underlay = {
begin{tcbclipinterior}
filldraw[fill=orange, draw=tcbcolframe, line width=.5mm] (frame.south west)--++(90:1cm) to [out=5, in=185] ([yshift=-1cm]frame.north east)|-cycle;
end{tcbclipinterior}
}]
A
tcblower
B
end{tcolorbox}
end{document}
I approved this one since it is closer to my original question. I do not know though how to change position of A and B or add more text to different position inside the box.
– Geo
2 days ago
1
@Geotcolorbox
allows to have two different paragraphsupper
andlower
. But these paragraphs are formatted as normal paragraphs, they won't adjust to upper or lower designs unless you useparshape
. About adding more text in different positions, you could always use anoverlay
but this is another question and we need more information to be able to solve it.
– Ignasi
2 days ago
I meant add more text in brown or orange section. Like add "Hello" on either section but on a different position say up right or bottom left.
– Geo
2 days ago
2
@Geo replace A or B for the text you want and play with{v|h}align {upper|lower}
options. And take a look attcolorbox
documentation.
– Ignasi
2 days ago
add a comment |
Welcome to TeX.SE. From the next time try adding a compilable MWE, so that it will attract more users to answer your question.
You can start with (borders):
documentclass{standalone}
usepackage{tikz}
begin{document}
begin{tikzpicture}
filldraw [black] (3, 2) --(3,0)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
filldraw [red] (3, 2) --(0,2)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
draw[yellow, thick] (0,0)--(0,2)--(3,2)--(3,0)--cycle;
end{tikzpicture}
end{document}
to get:
and I leave the rest of customisation for you to do ;)
.
this has no borders and if I dofilldraw [fill = red, draw=black] (0,0) rectangle (5,5);
Then the borders are different than tcbox where I havetcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
– Geo
2 days ago
@Geo you can manually draw the borders around them :) see my updated answer;)
– Raaja
2 days ago
1
thanks, I also didfilldraw [fill = red, draw=black] [sharp corners,line width=.5mm, inner sep=5mm] (0,0) rectangle (5,5);
What I do not understand is the coordinates, in order to change the shape{ (0,0) (1,1) (2, 1) (3, 2)}
Can you point me where can I read more about it?
– Geo
2 days ago
@GeoTikzpgf
manual.
– Raaja
2 days ago
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
});
}
});
Geo is a new contributor. Be nice, and check out our Code of Conduct.
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%2f480219%2fbox-half-filled-color%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
If you prefer tcolorbox
:
documentclass{article}
usepackage[most]{tcolorbox}
begin{document}
begin{tcolorbox}[
sharp corners, boxsep=5mm, boxrule=.5mm,
colback=brown, width=5cm,
halign upper=left, valign upper=top,
halign lower=right, valign lower=bottom,
enhanced, segmentation empty,
underlay = {
begin{tcbclipinterior}
filldraw[fill=orange, draw=tcbcolframe, line width=.5mm] (frame.south west)--++(90:1cm) to [out=5, in=185] ([yshift=-1cm]frame.north east)|-cycle;
end{tcbclipinterior}
}]
A
tcblower
B
end{tcolorbox}
end{document}
I approved this one since it is closer to my original question. I do not know though how to change position of A and B or add more text to different position inside the box.
– Geo
2 days ago
1
@Geotcolorbox
allows to have two different paragraphsupper
andlower
. But these paragraphs are formatted as normal paragraphs, they won't adjust to upper or lower designs unless you useparshape
. About adding more text in different positions, you could always use anoverlay
but this is another question and we need more information to be able to solve it.
– Ignasi
2 days ago
I meant add more text in brown or orange section. Like add "Hello" on either section but on a different position say up right or bottom left.
– Geo
2 days ago
2
@Geo replace A or B for the text you want and play with{v|h}align {upper|lower}
options. And take a look attcolorbox
documentation.
– Ignasi
2 days ago
add a comment |
If you prefer tcolorbox
:
documentclass{article}
usepackage[most]{tcolorbox}
begin{document}
begin{tcolorbox}[
sharp corners, boxsep=5mm, boxrule=.5mm,
colback=brown, width=5cm,
halign upper=left, valign upper=top,
halign lower=right, valign lower=bottom,
enhanced, segmentation empty,
underlay = {
begin{tcbclipinterior}
filldraw[fill=orange, draw=tcbcolframe, line width=.5mm] (frame.south west)--++(90:1cm) to [out=5, in=185] ([yshift=-1cm]frame.north east)|-cycle;
end{tcbclipinterior}
}]
A
tcblower
B
end{tcolorbox}
end{document}
I approved this one since it is closer to my original question. I do not know though how to change position of A and B or add more text to different position inside the box.
– Geo
2 days ago
1
@Geotcolorbox
allows to have two different paragraphsupper
andlower
. But these paragraphs are formatted as normal paragraphs, they won't adjust to upper or lower designs unless you useparshape
. About adding more text in different positions, you could always use anoverlay
but this is another question and we need more information to be able to solve it.
– Ignasi
2 days ago
I meant add more text in brown or orange section. Like add "Hello" on either section but on a different position say up right or bottom left.
– Geo
2 days ago
2
@Geo replace A or B for the text you want and play with{v|h}align {upper|lower}
options. And take a look attcolorbox
documentation.
– Ignasi
2 days ago
add a comment |
If you prefer tcolorbox
:
documentclass{article}
usepackage[most]{tcolorbox}
begin{document}
begin{tcolorbox}[
sharp corners, boxsep=5mm, boxrule=.5mm,
colback=brown, width=5cm,
halign upper=left, valign upper=top,
halign lower=right, valign lower=bottom,
enhanced, segmentation empty,
underlay = {
begin{tcbclipinterior}
filldraw[fill=orange, draw=tcbcolframe, line width=.5mm] (frame.south west)--++(90:1cm) to [out=5, in=185] ([yshift=-1cm]frame.north east)|-cycle;
end{tcbclipinterior}
}]
A
tcblower
B
end{tcolorbox}
end{document}
If you prefer tcolorbox
:
documentclass{article}
usepackage[most]{tcolorbox}
begin{document}
begin{tcolorbox}[
sharp corners, boxsep=5mm, boxrule=.5mm,
colback=brown, width=5cm,
halign upper=left, valign upper=top,
halign lower=right, valign lower=bottom,
enhanced, segmentation empty,
underlay = {
begin{tcbclipinterior}
filldraw[fill=orange, draw=tcbcolframe, line width=.5mm] (frame.south west)--++(90:1cm) to [out=5, in=185] ([yshift=-1cm]frame.north east)|-cycle;
end{tcbclipinterior}
}]
A
tcblower
B
end{tcolorbox}
end{document}
edited 2 days ago
answered 2 days ago
IgnasiIgnasi
95.1k4175318
95.1k4175318
I approved this one since it is closer to my original question. I do not know though how to change position of A and B or add more text to different position inside the box.
– Geo
2 days ago
1
@Geotcolorbox
allows to have two different paragraphsupper
andlower
. But these paragraphs are formatted as normal paragraphs, they won't adjust to upper or lower designs unless you useparshape
. About adding more text in different positions, you could always use anoverlay
but this is another question and we need more information to be able to solve it.
– Ignasi
2 days ago
I meant add more text in brown or orange section. Like add "Hello" on either section but on a different position say up right or bottom left.
– Geo
2 days ago
2
@Geo replace A or B for the text you want and play with{v|h}align {upper|lower}
options. And take a look attcolorbox
documentation.
– Ignasi
2 days ago
add a comment |
I approved this one since it is closer to my original question. I do not know though how to change position of A and B or add more text to different position inside the box.
– Geo
2 days ago
1
@Geotcolorbox
allows to have two different paragraphsupper
andlower
. But these paragraphs are formatted as normal paragraphs, they won't adjust to upper or lower designs unless you useparshape
. About adding more text in different positions, you could always use anoverlay
but this is another question and we need more information to be able to solve it.
– Ignasi
2 days ago
I meant add more text in brown or orange section. Like add "Hello" on either section but on a different position say up right or bottom left.
– Geo
2 days ago
2
@Geo replace A or B for the text you want and play with{v|h}align {upper|lower}
options. And take a look attcolorbox
documentation.
– Ignasi
2 days ago
I approved this one since it is closer to my original question. I do not know though how to change position of A and B or add more text to different position inside the box.
– Geo
2 days ago
I approved this one since it is closer to my original question. I do not know though how to change position of A and B or add more text to different position inside the box.
– Geo
2 days ago
1
1
@Geo
tcolorbox
allows to have two different paragraphs upper
and lower
. But these paragraphs are formatted as normal paragraphs, they won't adjust to upper or lower designs unless you use parshape
. About adding more text in different positions, you could always use an overlay
but this is another question and we need more information to be able to solve it.– Ignasi
2 days ago
@Geo
tcolorbox
allows to have two different paragraphs upper
and lower
. But these paragraphs are formatted as normal paragraphs, they won't adjust to upper or lower designs unless you use parshape
. About adding more text in different positions, you could always use an overlay
but this is another question and we need more information to be able to solve it.– Ignasi
2 days ago
I meant add more text in brown or orange section. Like add "Hello" on either section but on a different position say up right or bottom left.
– Geo
2 days ago
I meant add more text in brown or orange section. Like add "Hello" on either section but on a different position say up right or bottom left.
– Geo
2 days ago
2
2
@Geo replace A or B for the text you want and play with
{v|h}align {upper|lower}
options. And take a look at tcolorbox
documentation.– Ignasi
2 days ago
@Geo replace A or B for the text you want and play with
{v|h}align {upper|lower}
options. And take a look at tcolorbox
documentation.– Ignasi
2 days ago
add a comment |
Welcome to TeX.SE. From the next time try adding a compilable MWE, so that it will attract more users to answer your question.
You can start with (borders):
documentclass{standalone}
usepackage{tikz}
begin{document}
begin{tikzpicture}
filldraw [black] (3, 2) --(3,0)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
filldraw [red] (3, 2) --(0,2)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
draw[yellow, thick] (0,0)--(0,2)--(3,2)--(3,0)--cycle;
end{tikzpicture}
end{document}
to get:
and I leave the rest of customisation for you to do ;)
.
this has no borders and if I dofilldraw [fill = red, draw=black] (0,0) rectangle (5,5);
Then the borders are different than tcbox where I havetcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
– Geo
2 days ago
@Geo you can manually draw the borders around them :) see my updated answer;)
– Raaja
2 days ago
1
thanks, I also didfilldraw [fill = red, draw=black] [sharp corners,line width=.5mm, inner sep=5mm] (0,0) rectangle (5,5);
What I do not understand is the coordinates, in order to change the shape{ (0,0) (1,1) (2, 1) (3, 2)}
Can you point me where can I read more about it?
– Geo
2 days ago
@GeoTikzpgf
manual.
– Raaja
2 days ago
add a comment |
Welcome to TeX.SE. From the next time try adding a compilable MWE, so that it will attract more users to answer your question.
You can start with (borders):
documentclass{standalone}
usepackage{tikz}
begin{document}
begin{tikzpicture}
filldraw [black] (3, 2) --(3,0)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
filldraw [red] (3, 2) --(0,2)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
draw[yellow, thick] (0,0)--(0,2)--(3,2)--(3,0)--cycle;
end{tikzpicture}
end{document}
to get:
and I leave the rest of customisation for you to do ;)
.
this has no borders and if I dofilldraw [fill = red, draw=black] (0,0) rectangle (5,5);
Then the borders are different than tcbox where I havetcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
– Geo
2 days ago
@Geo you can manually draw the borders around them :) see my updated answer;)
– Raaja
2 days ago
1
thanks, I also didfilldraw [fill = red, draw=black] [sharp corners,line width=.5mm, inner sep=5mm] (0,0) rectangle (5,5);
What I do not understand is the coordinates, in order to change the shape{ (0,0) (1,1) (2, 1) (3, 2)}
Can you point me where can I read more about it?
– Geo
2 days ago
@GeoTikzpgf
manual.
– Raaja
2 days ago
add a comment |
Welcome to TeX.SE. From the next time try adding a compilable MWE, so that it will attract more users to answer your question.
You can start with (borders):
documentclass{standalone}
usepackage{tikz}
begin{document}
begin{tikzpicture}
filldraw [black] (3, 2) --(3,0)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
filldraw [red] (3, 2) --(0,2)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
draw[yellow, thick] (0,0)--(0,2)--(3,2)--(3,0)--cycle;
end{tikzpicture}
end{document}
to get:
and I leave the rest of customisation for you to do ;)
.
Welcome to TeX.SE. From the next time try adding a compilable MWE, so that it will attract more users to answer your question.
You can start with (borders):
documentclass{standalone}
usepackage{tikz}
begin{document}
begin{tikzpicture}
filldraw [black] (3, 2) --(3,0)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
filldraw [red] (3, 2) --(0,2)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)};
draw[yellow, thick] (0,0)--(0,2)--(3,2)--(3,0)--cycle;
end{tikzpicture}
end{document}
to get:
and I leave the rest of customisation for you to do ;)
.
edited 2 days ago
answered 2 days ago
RaajaRaaja
5,18421542
5,18421542
this has no borders and if I dofilldraw [fill = red, draw=black] (0,0) rectangle (5,5);
Then the borders are different than tcbox where I havetcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
– Geo
2 days ago
@Geo you can manually draw the borders around them :) see my updated answer;)
– Raaja
2 days ago
1
thanks, I also didfilldraw [fill = red, draw=black] [sharp corners,line width=.5mm, inner sep=5mm] (0,0) rectangle (5,5);
What I do not understand is the coordinates, in order to change the shape{ (0,0) (1,1) (2, 1) (3, 2)}
Can you point me where can I read more about it?
– Geo
2 days ago
@GeoTikzpgf
manual.
– Raaja
2 days ago
add a comment |
this has no borders and if I dofilldraw [fill = red, draw=black] (0,0) rectangle (5,5);
Then the borders are different than tcbox where I havetcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
– Geo
2 days ago
@Geo you can manually draw the borders around them :) see my updated answer;)
– Raaja
2 days ago
1
thanks, I also didfilldraw [fill = red, draw=black] [sharp corners,line width=.5mm, inner sep=5mm] (0,0) rectangle (5,5);
What I do not understand is the coordinates, in order to change the shape{ (0,0) (1,1) (2, 1) (3, 2)}
Can you point me where can I read more about it?
– Geo
2 days ago
@GeoTikzpgf
manual.
– Raaja
2 days ago
this has no borders and if I do
filldraw [fill = red, draw=black] (0,0) rectangle (5,5);
Then the borders are different than tcbox where I have tcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
– Geo
2 days ago
this has no borders and if I do
filldraw [fill = red, draw=black] (0,0) rectangle (5,5);
Then the borders are different than tcbox where I have tcbox[sharp corners, boxsep=5mm, boxrule=.5mm]
– Geo
2 days ago
@Geo you can manually draw the borders around them :) see my updated answer
;)
– Raaja
2 days ago
@Geo you can manually draw the borders around them :) see my updated answer
;)
– Raaja
2 days ago
1
1
thanks, I also did
filldraw [fill = red, draw=black] [sharp corners,line width=.5mm, inner sep=5mm] (0,0) rectangle (5,5);
What I do not understand is the coordinates, in order to change the shape { (0,0) (1,1) (2, 1) (3, 2)}
Can you point me where can I read more about it?– Geo
2 days ago
thanks, I also did
filldraw [fill = red, draw=black] [sharp corners,line width=.5mm, inner sep=5mm] (0,0) rectangle (5,5);
What I do not understand is the coordinates, in order to change the shape { (0,0) (1,1) (2, 1) (3, 2)}
Can you point me where can I read more about it?– Geo
2 days ago
@Geo
Tikzpgf
manual.– Raaja
2 days ago
@Geo
Tikzpgf
manual.– Raaja
2 days ago
add a comment |
Geo is a new contributor. Be nice, and check out our Code of Conduct.
Geo is a new contributor. Be nice, and check out our Code of Conduct.
Geo is a new contributor. Be nice, and check out our Code of Conduct.
Geo is a new contributor. Be nice, and check out our Code of Conduct.
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%2f480219%2fbox-half-filled-color%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
Box half filled with white.
– Dylan
2 days ago
disregard the white thing. Start from the black borders.
– Geo
yesterday
It was a pun on pessimism: en.wikipedia.org/wiki/Is_the_glass_half_empty_or_half_full%3F
– Dylan
yesterday