1

i see code in this forum and have a box "AAAA". now i want create box BBBB & CCCC with other style and same curve. BBBB box: add B1/B2/B3 box CCCC box: rotate "header" but don't rotate text Please see image and original code. Please help this code: Thanks enter image description here

\documentclass[a4paper]{book}
\usepackage{amsmath,amssymb}%      pour les maths
\usepackage{enumitem}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{MnSymbol,wasysym}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{framed}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{vietnam}
%\usepackage[utf8]{english}
\usepackage[english]{babel}
\usepackage[format=plain,
            labelfont={bf,it},
            textfont=it]{caption}

%\newcommand\captionof[2]{\def\@captype{#1}\caption}

\usepackage{tikzsymbols} 
\newtcbtheorem{myLemma}{Long text here without counter }{lemmastyle}{thm}

\usetikzlibrary{calc, fit, backgrounds}
\usepackage{varwidth}

\newcommand{\mybox}[4][\textwidth-\pgfkeysvalueof{/pgf/inner xsep}-2mm]{%

\centering
\begin{tikzpicture}
\node[line width=0.5mm, inner ysep=10pt, text width=#1, outer sep=0] (text) {\begin{varwidth}{\textwidth}#4\end{varwidth}};
\node[text=white, above right, align=left] (title) at (text.north west) {#3};
\node[fit=(title) (text), line width=0.5mm, rounded corners, draw=#2, inner sep=0pt] (box){};
\begin{scope}[on background layer]
\fill[#2] (title.south west) -- (title.south east) to[out=0, in=180] ([xshift=1.5cm]title.east) -- (title.east-|box.north east) [rounded corners] -- (box.north east) -- (box.north west) [sharp corners] -- cycle;
\end{scope}
\end{tikzpicture} 
}

\newcommand{\myboxa}[4][\textwidth-\pgfkeysvalueof{/pgf/inner xsep}-2mm]{%

\centering
\begin{tikzpicture}
\node[line width=0.5mm, inner ysep=10pt, text width=#1, outer sep=0] (text) {\begin{varwidth}{\textwidth}#4\end{varwidth}};
\node[text=white, above right, align=left] (title) at (text.west north) {#3};
\node[fit=(title) (text), line width=0.5mm, rounded corners, draw=#2, inner sep=0pt] (box){};
\begin{scope}[on background layer]
\fill[#2] (title.west south) -- (title.west south) to[out=0, in=180] ([xshift=1.5cm]title.east) -- (title.east-|box.east north) [rounded corners] -- (box.east north) -- (box.west north) [sharp corners] -- cycle;
\end{scope}
\end{tikzpicture} 
}
\usepackage{pifont}

\begin{document}

\tcbset{sidebyside,
  size=minimal,
  colback=white,
  lower separated=false,
  halign upper=flush center,
  halign lower=flush left,
  lefthand width=2.5cm, 
  frame empty,
}


\mybox[10cm]{green!70!black}{AAAA }{
\begin{enumerate}
\item ....................................................\hspace*{1cm}..........................

\item ....................................................\hspace*{1cm}..........................

\end{enumerate}

}
\end{document}
3

This is a possible solution. It's based on my own answer code to Inspired beautiful box from Indesign which uses tcolorbox for these boxes design. With this solution it's easy to define a tcboxedraster or tcboxeditemize to include three boxes inside another one.

\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{myhbox}{Long fancy title}
\begin{enumerate}
\item Show that 
\[D_2f(x,y) = \frac{\partial{}}{\partial{y}} \left ( \int_0^xg_1 (t,0)\ dt + \int_0^y g_2(x,s)\ ds \right)\]
\item Prove that 
\[\left(\forall x\in\mathbb{R}  \right)\left(\forall y \in \mathbb{R} \right) x\neq y\, \text{and} \, x+y \neq 2 \implies x^{2}-2x \neq y^2-2y\] 
\end{enumerate}
\end{myhbox}

\begin{myvbox}[colframe=red!80!black]{Long fancy title}
\begin{enumerate}
\item Show that 
\[D_2f(x,y) = \frac{\partial{}}{\partial{y}} \left ( \int_0^xg_1 (t,0)\ dt + \int_0^y g_2(x,s)\ ds \right)\]
\item Prove that 
\[\left(\forall x\in\mathbb{R}  \right)\left(\forall y \in \mathbb{R} \right) x\neq y\, \text{and} \, x+y \neq 2 \implies x^{2}-2x \neq y^2-2y\] 
\end{enumerate}
\end{myvbox}

\begin{tcboxeditemize}[raster columns=3, myhbox={colback=yellow!10, colframe=red!70!black}{Box \# \thetcbrasternum} ]{myhbox={colback=red!10}{External box}}
\tcbitem A
\tcbitem[notitle, myvbox={colback=green!70!black, height=4cm}{Box \# \thetcbrasternum}] B
\tcbitem C
\end{tcboxeditemize}

\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@....

  • awesome, thank @Ignasi. i want put one image with caption (without label) inside the box. i use macros insbox. Here is my code, but don't work. \begin{myhbox}[colframe=blue!80!black,height=5cm,width =10cm]{Daily quote} \leavevmode {\InsertBoxR{0}{\includegraphics[width=2.5cm]{Image/Winston_Churchill.jpg} \caption*{\textcolor{red} {Winston}} }[1] "Attitude is a little thing that makes a BIG difference - A B C D E } \end{myhbox} – latexforti Sep 18 '18 at 12:35
  • @BVOT This is a different question you can write it with reference to this one. In any case, you can use \includegraphics without any problem with tcolorbox. Look at its documentation, – Ignasi Sep 18 '18 at 16:42

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.