5

How would I be able to create the following using a tcolorbox?

enter image description here

Everytime I try, the best I can manage to get is this:

enter image description here

MWE:

    \documentclass[12pt]{article}

\usepackage[many]{tcolorbox}
\usepackage{tikz}
\usepackage[margin=2cm,includefoot,bottom=2.55cm,top=2.025cm,headsep=0.5cm,footskip=0.65cm]{geometry}

\definecolor{myblue}{RGB}{0,46,142}
\newtcolorbox[auto counter]{mytheorem}[1][]{
  enhanced jigsaw,colback=white,colframe=myblue,coltitle=myblue,
  fonttitle=\bfseries,
  sharp corners,
  detach title,
  leftrule=18mm,
  underlay unbroken and first={\node[above,text=white,font=\bfseries,align=center]
    at ([xshift=-9mm,yshift=0mm]interior.west) {\thetcbcounter};},
  breakable,pad at break=1mm,
  #1,
  code={\ifdefempty{\tcbtitletext}{}{\tcbset{before upper={\tcbtitle\par\medskip}}}},
}

\begin{document}\raggedright

  \begin{mytheorem}[title=Important Note]
    Important content. A body remains in a state of rest or continuous uniform motion unless acted on by an unbalanced external force.
      \begin{align*}
        45x^2-4x  & =75x
        \end{align*}
  \end{mytheorem}


\end{document}

Also wondering what would be required to have the box number in the centre of its column, or alternatively at the top of the column in line with the heading.

Many thanks

2

1 Answer 1

5

Instead of the increased rule width, I would increase the left margin and place the number there.

\documentclass[12pt]{article}

\usepackage[many]{tcolorbox}
\usepackage[%
    margin=2cm,
    includefoot,
    bottom=2.55cm,
    top=2.025cm,
    headsep=0.5cm,
    footskip=0.65cm
]{geometry}

\definecolor{myblue}{RGB}{0,46,142}

\newtcolorbox[auto counter]{mytheorem}[1][]{%
    enhanced jigsaw,
    colback=white,
    colframe=myblue,
    coltitle=myblue,
    fonttitle=\bfseries,
    sharp corners,
    detach title,
    enlarge left by=18mm,
    width=\linewidth-18mm,
    underlay unbroken and first={%
       \node[above,text=myblue,font=\bfseries,align=center] at ([xshift=-.5\textwidth,yshift=-7mm]interior.north) {\thetcbcounter};
    },
    breakable,
    pad at break=1mm,
    #1,
    code={\ifdefempty{\tcbtitletext}{}{\tcbset{before upper={\tcbtitle\par\medskip}}}},
}

\begin{document}\raggedright

  \begin{mytheorem}[title=Important Note]
    Important content. A body remains in a state of rest or continuous uniform motion unless acted on by an unbalanced external force.
      \begin{align*}
        45x^2-4x  & =75x
        \end{align*}
  \end{mytheorem}


\end{document}

enter image description here

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.