Box half filled color












7















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.



enter image description here










share|improve this question







New contributor




Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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
















7















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.



enter image description here










share|improve this question







New contributor




Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • 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














7












7








7


0






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.



enter image description here










share|improve this question







New contributor




Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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.



enter image description here







tikz-pgf draw fill






share|improve this question







New contributor




Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









GeoGeo

383




383




New contributor




Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Geo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • 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











  • 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










2 Answers
2






active

oldest

votes


















7














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}


enter image description here






share|improve this answer


























  • 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





    @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






  • 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



















8














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:



enter image description here



and I leave the rest of customisation for you to do ;).






share|improve this answer


























  • 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








  • 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











  • @Geo Tikzpgf manual.

    – Raaja
    2 days ago











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.










draft saved

draft discarded


















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









7














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}


enter image description here






share|improve this answer


























  • 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





    @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






  • 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
















7














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}


enter image description here






share|improve this answer


























  • 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





    @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






  • 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














7












7








7







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}


enter image description here






share|improve this answer















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}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








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





    @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






  • 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



















  • 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





    @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






  • 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

















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











8














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:



enter image description here



and I leave the rest of customisation for you to do ;).






share|improve this answer


























  • 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








  • 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











  • @Geo Tikzpgf manual.

    – Raaja
    2 days ago
















8














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:



enter image description here



and I leave the rest of customisation for you to do ;).






share|improve this answer


























  • 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








  • 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











  • @Geo Tikzpgf manual.

    – Raaja
    2 days ago














8












8








8







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:



enter image description here



and I leave the rest of customisation for you to do ;).






share|improve this answer















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:



enter image description here



and I leave the rest of customisation for you to do ;).







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered 2 days ago









RaajaRaaja

5,18421542




5,18421542













  • 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








  • 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











  • @Geo Tikzpgf 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













  • @Geo you can manually draw the borders around them :) see my updated answer ;)

    – Raaja
    2 days ago








  • 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











  • @Geo Tikzpgf 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










Geo is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















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.




draft saved


draft discarded














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





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa