1

I would like to make a frame using the package mdframed around a text and inside the frame I would like to integrate a small figure. I attached an example created with another program (the figure is the picture of a small clock). I know how to do frames with latex but I do not know how to integrate the figure. enter image description here

Thank you very much for your help!

  • 5
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Stefan Pinnow Sep 11 '18 at 16:52
  • 1
    You should be able to do this with tcolorbox. – user121799 Sep 11 '18 at 17:40
3

I just made a quick search for tcolorboxes, found this one by cfr, replaced the title text by some graphics and it immediately worked. Of course, you may drop the shadow, but I believe the shadow is unimportant for this to work. Generally, it is a good idea to do a google picture search with site:tex.stackexchange.com in it, very often you find an answer to your question almost immediately.

\documentclass[12pt]{article}
\usepackage[papersize={5.5in,8.5in},margin=1.5cm]{geometry}
\usepackage[many]{tcolorbox}
\usetikzlibrary{calc,shadows.blur}
\tcbuselibrary{skins}
\newtcolorbox{resp}[1][]{%
  enhanced jigsaw,
  colback=gray!20!white,%
  colframe=gray!80!black,
  size=small,
  boxrule=1pt,
  title={\includegraphics[width=2.5cm]{example-image-duck}},
  halign title=flush center,
  coltitle=black,
  breakable,
  drop shadow=black!50!white,
  attach boxed title to top left={xshift=1cm,yshift=-\tcboxedtitleheight/2,yshifttext=-\tcboxedtitleheight/2},
  minipage boxed title=3cm,
  boxed title style={%
    colback=white,
    size=fbox,
    boxrule=1pt,
    boxsep=2pt,
    underlay={%
      \coordinate (dotA) at ($(interior.west) + (-0.5pt,0)$);
      \coordinate (dotB) at ($(interior.east) + (0.5pt,0)$);
      \begin{scope}
        \clip (interior.north west) rectangle ([xshift=3ex]interior.east);
        \filldraw [white, blur shadow={shadow opacity=60, shadow yshift=-.75ex}, rounded corners=2pt] (interior.north west) rectangle (interior.south east);
      \end{scope}
      \begin{scope}[gray!80!black]
        \fill (dotA) circle (2pt);
        \fill (dotB) circle (2pt);
      \end{scope}
    },
  },
  #1,
}

\begin{document}
\begin{resp}
  A cfr--made box with a shadow and some graphics as title.
\end{resp}
\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.