6

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

3

2 Answers 2

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

4
  • 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
    Mar 19, 2019 at 15:28
  • 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
    Mar 19, 2019 at 15:37
  • 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
    Mar 19, 2019 at 16:07
  • 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
    Mar 19, 2019 at 16:10
6

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 ;).

4
  • 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
    Mar 19, 2019 at 9:34
  • @Geo you can manually draw the borders around them :) see my updated answer ;) Mar 19, 2019 at 9:35
  • 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
    Mar 19, 2019 at 9:44
  • @Geo Tikzpgf manual. Mar 19, 2019 at 10:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .