[Tex/LaTex] Framed box, over framed text with image

boxesgraphicsmdframedtcolorbox

Hi all,
I'm a newby in LaTeX but after researching online, I have seen that it is possible to create boxes and frames adjusted to text and images. I am trying to achieve something like the image, what would you recommend? I have seen you can use \ovalbox, mdframed, beamer, TiKZ… My main issue is framing the title in the position required and insert image.
Thanks a lot! 🙂

Best Answer

with tcolorbox and tikz

\documentclass{article}
\usepackage{tikz}
    \usetikzlibrary{shadows}
\usepackage{tcolorbox}
    \tcbuselibrary{skins}

\definecolor{mygreen}{rgb}{0.61,0.73,0.35}


\newcommand{\mytitle}[1]{
    \node[fill=mygreen,
        rounded corners,
        draw=white,
        line width=2pt,
        drop shadow,
        text width=4cm,
        inner sep=8pt,
        xshift=-2cm]
    at (frame.north){\bfseries\textcolor{white}{#1}};
}

\newtcolorbox{mybox}[2][]{
    enhanced,
    overlay={\mytitle{#2}},
    borderline={2pt}{0mm}{mygreen},
    borderline={.7pt}{1mm}{mygreen},
    frame hidden,
    arc=3mm,
    sidebyside,
    lefthand width=2.5cm,
    segmentation hidden,
    top=15pt,
    #1
}

\begin{document}

\begin{mybox}{Political Factors}
    \includegraphics[scale=.1]{lion.jpg}
    \tcblower
    Analyses to what degree the government intervenes
\end{mybox}

\end{document}

enter image description here

The optional argument in the newtcolorbox is there in case you need to apply different customizations to specific boxes (e.g., you could have the same box with a different background color with \begin{mybox}[colback=red]{Political Factors}. It is ignored otherwise, as in the given MWE.