1

I am trying to get the boxed title box environment from the Peter Atkins Physical Chemistry book which looks like this, screenshot2

After reading documentation of tcolorbox pacakge I have found out that in Manual for the tcolorbox package, in section '10.2.3 Options for the Boxed Title Box' there is one customized tcolorbox style.

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{varwidth}
\newtcolorbox{mybox}[2][]{enhanced,
before skip=2mm,after skip=2mm, colback=black!5,colframe=black!50,boxrule=0.2mm,
attach boxed title to top left={xshift=1cm,yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
boxed title style={frame code={
            \path[fill=tcbcolback!30!black]
              ([yshift=-1mm,xshift=-1mm]frame.north west)
                arc[start angle=0,end angle=180,radius=1mm]
              ([yshift=-1mm,xshift=1mm]frame.north east)
                arc[start angle=180,end angle=0,radius=1mm];
            \path[left color=tcbcolback!60!black,right color=tcbcolback!60!black,
              middle color=tcbcolback!80!black]
              ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
              [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
              -- (frame.south east) -- (frame.south west)
              -- ([xshift=-1mm,yshift=-1mm]frame.north west)
              [sharp corners]-- cycle;
            },interior engine=empty,
          },
          fonttitle=\bfseries,
          title={#2},#1}

\begin{document}

        \begin{mybox}[colbacktitle=green]{Lorem Ipsum}
        \lipsum[1]
        \end{mybox}

\end{document}

which looks bit similar to the Atkins one is given, but I am unable to achieve the Atkins box style screenshot

Any help is appreciated.

Edit: After some efforts I have got this resultscreenshot3 using tcolorbox package,

\documentclass{article}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}


\definecolor{mygreen}{HTML}{07a56d}

\newtcbtheorem{briefillus}{Brief Illustration}{
  enhanced,
  sharp corners,
  attach boxed title to top left={
    xshift=0pt, 
    yshift=-\tcboxedtitleheight, 
    yshifttext=-\tcboxedtitleheight/2
  },
  colback=white,
  colframe=mygreen,
  fonttitle=\bfseries,
  coltitle=white,
  boxed title style={
    rounded corners,
    arc=2pt,
    size=small,
    colback=mygreen,
    colframe=mygreen,
  },
  leftrule=0pt, 
  rightrule=0pt, 
}{thm}

\begin{document}

\begin{briefillus}{Lorem Ipsum}{}
  \lipsum[1]
\end{briefillus}

\end{document}

But I am still not able to achieve that inverted isoceles trapezium for title box with rounded corners on lower side.

1
  • So, what changes do you need? E.g. removing the gray frame and gray background? Etc. ?
    – MS-SPO
    May 31 at 14:21

2 Answers 2

2

This is a possible solution. You just need to define a frame code for the title frame:

\documentclass{article}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{xcolor}


\definecolor{mygreen}{HTML}{07a56d}

\newtcbtheorem{briefillus}{Brief Illustration}{
  enhanced,
  sharp corners,
  attach boxed title to top left={
    xshift=5pt, 
    yshift*=-\tcboxedtitleheight-0.5mm, 
%    yshifttext=-\tcboxedtitleheight/2
  },
  colback=white,
  colframe=mygreen,
  fonttitle=\bfseries,
  coltitle=white,
  boxed title style={
     frame code={\fill[tcbcolback]([xshift=-5pt]frame.north west) [rounded corners=2pt]--(frame.south west)--(frame.south east)[sharp corners]--([xshift=5pt]frame.north east)--cycle;},
%    rounded corners,
%    arc=2pt,
    size=small,
    colback=mygreen,
    colframe=mygreen,
  },
  leftrule=0pt, 
  rightrule=0pt, 
}{thm}

\begin{document}

\begin{briefillus}{Lorem Ipsum}{}
  \lipsum[1]
\end{briefillus}

\end{document}

enter image description here

0

Some alternative ideas for you, following the same pattern:

  • put 2 horizontal rules
  • put either some (short) tikz-code or a fbox, raised
  • alter: hrule-box vs. box-hrule
  • have some vertical adjustment (here: simply \bigskip)

As you can see, adjusting the amount to raise is critical. For simplicty I used predefined \baselineskip. I also replaced the lipsum package by some shorter text to have it all on one page for the screenshot.

The advantage of using tikz over fbox is:

  • you can change colors of lines, fills and fonts easily within the tikz environment
  • you can draw whatever shape you like (here I just use the default rectangle)

Outlook:

  • define a simple \newcommand, which executes your favorite solution, allowing a call like \yourBox{Brief illustration 5A.3}

result

\documentclass[10pt,a4paper]{article}
\usepackage{tikz}

\newcommand\blindtext[0]{Lorem ipsum dolor sit amet consectetuer laoreet nibh tristique wisi sem. Augue Suspendisse tortor leo hendrerit vel Vestibulum lorem Curabitur elit sapien. Euismod quis In nunc tincidunt sed purus nibh sed dolor Vivamus. Adipiscing.}

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}

\section{Alternative 1}
Puts some tikz-code above a hrule.

\raisebox{-\baselineskip}{
    \tikz{
        \node[draw=gray!20,fill=gray!10] {Brief illustration 4B.3};
    }
}
\hrule
\bigskip

\blindtext

\bigskip
\hrule

\bigskip

\section{Alternative 2}
Puts some tikz-code below a hrule.\bigskip

\hrule
\raisebox{-\baselineskip}{
    \tikz{
        \node[draw=gray!20,fill=gray!10] {Brief illustration 4B.3};
    }
}
\bigskip

\blindtext

\bigskip
\hrule


\section{Alternative 1b}

Same idea, just with fbox.\bigskip

\raisebox{-\baselineskip}{
    \fbox{Brief illustration 4B.3}
}
\hrule
\bigskip

\blindtext

\bigskip
\hrule

\section{Alternative 2b}

Same idea, just with fbox.

\hrule
\raisebox{-\baselineskip}{
    \fbox{Brief illustration 4B.3}
}
\bigskip

\blindtext

\bigskip
\hrule

\end{document}

You must log in to answer this question.

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