2

from this topic: Inspired beautiful box from Indesign. Now, i want create page layout with differentboxes like attachment image. Use tcbposter if possible or other solution. Thanks This boxes code: enter image description here

\documentclass[a4paper]{article}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{MnSymbol,wasysym}
\usepackage{tikzsymbols} 
\usepackage{caption}
\usepackage{adjustbox}
\input{insbox}
\makeatletter
\tcbset{
    myhbox/.style 2 args={%
        enhanced, 
        breakable,
        colback=white,
        colframe=blue!30!black,
        attach boxed title to top left={yshift*=-\tcboxedtitleheight}, 
        title={#2},
        boxed title size=title,
        boxed title style={%
            sharp corners, 
            rounded corners=northwest, 
            colback=tcbcol@frame, 
            boxrule=0pt,
        },
        underlay boxed title={%
            \path[fill=tcbcol@frame] (title.south west)--(title.south east) 
                to[out=0, in=180] ([xshift=5mm]title.east)--
                (title.center-|frame.east)
                [rounded corners=\kvtcb@arc] |- 
                (frame.north) -| cycle; 
        },
        #1
    },
    myvbox/.style 2 args={%
        enhanced, 
        colback=white,
        colframe=blue!30!black,
        left=8mm,
        overlay={
            \node[rotate=90, anchor=north west, inner sep=2mm, text=white] (title@aux) at (frame.south west) {#2};
            \path[fill=tcbcol@frame] (title@aux.south west)--(title@aux.south east) 
                to[out=90, in=270] ([yshift=5mm]title@aux.east)--
                (title@aux.center|-frame.north)
                [rounded corners=\kvtcb@arc] -| 
                (frame.west) |- (title@aux.west)[sharp corners] -- cycle;   
            \node[rotate=90, inner sep=2mm, text=white] at (title@aux) {#2};
        },
        #1
    },  
}   

\makeatother

\newtcolorbox{myhbox}[2][]{%
    myhbox={#1}{#2}
}

\newtcolorbox{myvbox}[2][]{%
    myvbox={#1}{#2}
}
\begin{document}



\begin{myhbox}[colframe=blue!80!black,height=3cm,width =7cm]{AAA}{

def
}
\end{myhbox}

\begin{myhbox}[colframe=blue!80!black,height=3cm,width =7cm]
{BBB }{
abc
}
\end{myhbox}


  \begin{myvbox}[colframe=red!80!black,height=6cm,width =4cm,before=\adjustbox{valign=t}\bgroup,after=\egroup]{CCC}


    { 
   abcdef
    }% 

\end{myvbox}
\begin{myvbox}[colframe=red!80!black,height=6cm,width =4cm,before=\adjustbox{valign=t}\bgroup,after=\egroup]{DDD}


    { 
   abcdef
    }% 

\end{myvbox}

\begin{tcbposter}[
poster = {
%       showframe, 
        columns = 2,
        rows = 2,
        height = .5\textheight, 
        width = .5\textwidth, 
        spacing=3mm},
    boxes = {colback=red}
    ]
    \begin{posterbox}{column=1, row=1}[colframe=red!80!black,height=6cm,width =4cm]{ABCD}
   \end{posterbox}
  \end{tcbposter}%
\end{document}
  • Have a look at tcbraster. The example on page 281 of the tcolorbox manual might be helpful – user36296 Sep 19 '18 at 11:19
1

It seems that BVOT wants boxes with specific dimensions:

Ex: A4 paper width size = 29.7 cm and i want total (all column boxes = 27 cm) and box CCC width = 15 cm, AAA width = 5 cm and BBB width = 7 cm.

In this case it's easier to use tcbposter. A tcbposter is an initial regular distribution of columns and rows over which place boxes with reference to columns, rows and other boxes.

As desired boxes widths are not proportional, I've used a tcbposter with just two columns. Left box will be aligned to left and right boxes to the right. The middle box on first row will be placed xshifted from the left border.

Proposed dimensions don't allow space between columns, therefore I've reduced left box and first column right box get some separation between columns.

\documentclass[a4paper, landscape]{article}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage[textwidth=27cm]{geometry}

\makeatletter
\tcbset{
    myhbox/.style 2 args={%
        enhanced, 
        breakable,
        colback=white,
        colframe=blue!30!black,
        attach boxed title to top left={yshift*=-\tcboxedtitleheight}, 
        title={#2},
        boxed title size=title,
        boxed title style={%
            sharp corners, 
            rounded corners=northwest, 
            colback=tcbcolframe, 
            boxrule=0pt,
        },
        underlay boxed title={%
            \path[fill=tcbcolframe] (title.south west)--(title.south east) 
                to[out=0, in=180] ([xshift=5mm]title.east)--
                (title.center-|frame.east)
                [rounded corners=\kvtcb@arc] |- 
                (frame.north) -| cycle; 
        },
        #1
    },
    myvbox/.style 2 args={%
        enhanced, 
        colback=white,
        colframe=blue!30!black,
        left=8mm,
        overlay={
            \node[rotate=90, anchor=north west, inner sep=2mm, text=white] (title@aux) at (frame.south west) {#2};
            \path[fill=tcbcolframe] (title@aux.south west)--(title@aux.south east) 
                to[out=90, in=270] ([yshift=5mm]title@aux.east)--
                (title@aux.center|-frame.north)
                [rounded corners=\kvtcb@arc] -| 
                (frame.west) |- (title@aux.west)[sharp corners] -- cycle;   
            \node[rotate=90, inner sep=2mm, text=white] at (title@aux) {#2};
        },
        #1
    },  
}   
\makeatother

\begin{document}
\thispagestyle{empty}
\noindent%
\begin{tcbposter}[
    poster = {columns=2, rows=2, width=\textwidth, height=\textheight}]
\posterbox[width=15cm-\tcbpostercolspacing, myvbox={colframe=red!80!black}{CCC}]{column=1, row=1, rowspan=2}{CCC}
\posterbox[width=5cm, myhbox={}{AAA}]{column=1, row=1, xshift=15cm}{AAA}
\posterbox[width=7cm-\tcbpostercolspacing, myhbox={}{BBB}]{column*=2, row=1}{BBB}
\posterbox[width=12cm, myhbox={}{DDD}]{column*=2, row=2}{DDD}

\end{tcbposter}
\end{document}

enter image description here

Note Previous code has been updated for compatibility with tcolorbox v4.20. If you're using previous versions, rename colors with form tcbcol... to older form tcbcol@....

2

This distributions are also possible with tcbraster. Here you have some examples. More information in tcolorbox documentation

\documentclass[a4paper]{article}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\makeatletter
\tcbset{
    myhbox/.style 2 args={%
        enhanced, 
        breakable,
        colback=white,
        colframe=blue!30!black,
        attach boxed title to top left={yshift*=-\tcboxedtitleheight}, 
        title={#2},
        boxed title size=title,
        boxed title style={%
            sharp corners, 
            rounded corners=northwest, 
            colback=tcbcolframe, 
            boxrule=0pt,
        },
        underlay boxed title={%
            \path[fill=tcbcolframe] (title.south west)--(title.south east) 
                to[out=0, in=180] ([xshift=5mm]title.east)--
                (title.center-|frame.east)
                [rounded corners=\kvtcb@arc] |- 
                (frame.north) -| cycle; 
        },
        #1
    },
    myvbox/.style 2 args={%
        enhanced, 
        colback=white,
        colframe=blue!30!black,
        left=8mm,
        overlay={
            \node[rotate=90, anchor=north west, inner sep=2mm, text=white] (title@aux) at (frame.south west) {#2};
            \path[fill=tcbcolframe] (title@aux.south west)--(title@aux.south east) 
                to[out=90, in=270] ([yshift=5mm]title@aux.east)--
                (title@aux.center|-frame.north)
                [rounded corners=\kvtcb@arc] -| 
                (frame.west) |- (title@aux.west)[sharp corners] -- cycle;   
            \node[rotate=90, inner sep=2mm, text=white] at (title@aux) {#2};
        },
        #1
    },  
}   
\makeatother

\newtcolorbox{myhbox}[2][]{%
    myhbox={#1}{#2}
}

\newtcolorbox{myvbox}[2][]{%
    myvbox={#1}{#2}
}

\begin{document}

\begin{tcbitemize}[%
    raster columns=2, 
    raster rows=2, 
    raster equal height=rows,
    ]
    \tcbitem[blankest]
        \begin{tcbitemize}[raster columns=1]
            \tcbitem[myhbox={}{AAA}]    First box with horizontal title
            \tcbitem[myhbox={}{AAA}]    Second box with horizontal title
        \end{tcbitemize}
    \tcbitem[myvbox={colframe=red!70!black}{CCC}]Box with vertical title
\end{tcbitemize}
\vspace{1cm}

\begin{tcbitemize}[%
    raster columns=5, 
    raster rows=2, 
    raster equal height=rows,
    ]
    \tcbitem[raster multirow=2, raster multicolumn=3, blankest]
        \begin{tcbitemize}[raster columns=1]
            \tcbitem[myhbox={}{AAA}]    First box with horizontal title
            \tcbitem[myhbox={}{AAA}]    Second box with horizontal title
        \end{tcbitemize}
    \tcbitem[raster multicolumn=2, myvbox={colframe=red!70!black}{CCC}]Box with vertical title
\end{tcbitemize}
\vspace{1cm}

\begin{tcbitemize}[%
    raster columns=3, 
    raster rows=2, 
    raster equal height=rows,
    ]
    \tcbitem[raster multirow=2, myvbox={colframe=red!70!black}{CCC}]Box with vertical title
    \tcbitem[raster multicolumn=2, blankest]
        \begin{tcbitemize}[raster columns=2]
            \tcbitem[myhbox={}{AAA}]    First box with horizontal title
            \tcbitem[myhbox={}{BBB}]    Second box with horizontal title
            \tcbitem[raster multicolumn=2, myhbox={}{BBB}] Double horizontal box
        \end{tcbitemize}
\end{tcbitemize}

\end{document}

enter image description here

Note Previous code has been updated for compatibility with tcolorbox v4.20. If you're using previous versions, rename colors with form tcbcol... to older form tcbcol@....

  • How can i use dimension ưith mm, cm for each box height, box width? Thanks – latexforti Sep 19 '18 at 23:26
  • Ex: A4 paper width size = 29.7 cm and i want total (all column boxes = 27 cm) and box CCC width = 15 cm, AAA width = 5 cm and BBB width = 7 cm. Thanks – latexforti Sep 20 '18 at 0:02
  • @BVOT Receiving a thanks message is nice, but some upvote and/or even some accepted answer are also welcome. By the way, I've written another answer with tcbposter and boxes with specific dimensions. – Ignasi Sep 20 '18 at 8:48
  • thanks. tcbposter with your new code is easier. – latexforti Sep 20 '18 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.