[Tex/LaTex] Alignment of image in tcolorbox

tcolorbox

Many times we see in books, some significant points, some tips and tricks are put in an attractive box with an image in it (usually the text will be in italics). I would like to achieve the same effect. I have referred this link : Adding an Image inside tcolorbox. And this is what I have achieved :

\documentclass[12pt]{article}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[
%      breakable,
      left=0pt,
      right=0pt,
      top=8pt,
      bottom=8pt,
      colback=white,
      colframe=red,
      width=\textwidth,
      enlarge left by=0mm,
      boxsep=5pt,
      arc=4pt,
      outer arc=4pt,
    ]
    \Large
  \smash{\raisebox{-11pt}{\includegraphics[width=1cm,height=1cm]{colorbox}}}\hfill
\end{tcolorbox}
\end{document} 

Output:

enter image description here

Now, my question is, How to align that image and add a text not at the center but as a paragraph.

What I want to achieve is :

enter image description here

Best Answer

Adjust the settings according to your needs:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\usetikzlibrary{calc}

\newtcolorbox{mybox}{
  enhanced,
  left=0pt,
  right=0pt,
  top=8pt,
  bottom=8pt,
  colback=white,
  colframe=red,
  width=\textwidth,
  enlarge left by=0mm,
  boxsep=5pt,
  fontupper=\itshape\small,
  arc=4pt,
  outer arc=4pt,
  leftupper=1.5cm,
  overlay={
    \node[anchor=west] 
      at ([xshift=10pt] $ (frame.north west)!0.5!(frame.south west) $ )
       {\includegraphics[width=1cm,height=1cm]{example-image-a}};}
}
\begin{document}
\begin{mybox}
\lipsum[4]
\end{mybox}
\end{document}

enter image description here

Or with a different vertical alignment for the image:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{mybox}{
  enhanced,
  left=0pt,
  right=0pt,
  top=8pt,
  bottom=8pt,
  colback=white,
  colframe=red,
  width=\textwidth,
  enlarge left by=0mm,
  boxsep=5pt,
  fontupper=\itshape\small,
  arc=4pt,
  outer arc=4pt,
  leftupper=1.5cm,
  overlay={
    \node[anchor=north west] 
      at ([xshift=10pt,yshift=-.65\baselineskip]frame.north west)
       {\includegraphics[width=1cm,height=1cm]{example-image-a}};}
}
\begin{document}
\begin{mybox}
\lipsum[4]
\end{mybox}
\end{document}

enter image description here

Related Question