# How can I draw a box around a picture plus text?

Right now I am struggling with getting a box around some text with a figure. The idea is that I have a small picture on the lefthand-side with some text right next to it. And then draw a box around the whole thing.

I tried messing around with tikzpicture. But my tikz-solution needs the text to be only one line long otherwise I have to set manual line-breaks every time. Since this will be a recurring element I need to use, I would much rather have an elegant solution (if there is one).

How it looks without the box:

\begin{wrapfigure}{l}{0.05\textwidth}
\centering
\includegraphics[width=0.05\textwidth]{Icon}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

• Should the text be able to flow around the image if the text is longer than the place needed by the picture? May 21 at 10:13

If I understood your question correctly, you are after the following:

\documentclass{article}
\usepackage{lipsum}
\usepackage[skins]{tcolorbox}
\tcbset{boxrule=1pt, colframe=red,
colback=white,
left=3pt, right=3pt, sidebyside gap=8pt,
sidebyside, lefthand width=0.1\linewidth,
lower separated=false
}

\begin{document}
\begin{tcolorbox}
\tcblower
\lipsum[66]
\end{tcolorbox}
\end{document}


Or more likely to @Tom answer (+1). It can be (slightly) modified as follows:

\documentclass{article}
\usepackage{wrapfig}
\usepackage[skins]{tcolorbox}
\tcbset{boxrule=1pt, colframe=red,
colback=white,
left=3pt, right=3pt
}
\usepackage{lipsum}

\begin{document}
\begin{tcolorbox}
\begin{wrapfigure}[3]{l}{0.1\textwidth}
\vspace{-\baselineskip}
\end{wrapfigure}
\lipsum[66]
\end{tcolorbox}
\end{document}


• This is perfect. Thanks alot! What really is the upside of the part you wrote after "It can be (slightly) modified"? I do not see a dfference in the result. May 25 at 10:08
• @TomGöbel, I do not understand you. Differences in results are very obvious to me. Please clarify! BTW, you receive two answers on your question. It is time to select one of them, which on the best ways solve problem and accept it (by clicking on check mark at top left side of answer). SO far you not accept any of answer got on your questions. Are no one of them fulfil your expectations? May 25 at 10:25

This may be what you want:

\documentclass{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{tcolorbox}

\begin{document}
\begin{tcolorbox}[standard jigsaw,opacityback=0,colframe=red]
\begin{wrapfigure}{l}{0.05\textwidth}
\centering
\includegraphics[width=0.05\textwidth]{example-image}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\end{tcolorbox}

\end{document}