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}
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}
You need to use two different environments: one (new) for footnotes outside and the default for footnotes inside.
\documentclass[10pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{tcolorbox}
\usepackage{footnote}
\usepackage{environ}% added <<<<<<<<<<<<
\NewEnviron{TCBx}{ % footnotes ouside the box
\begin{savenotes}
\begin{tcolorbox}
\BODY
\end{tcolorbox}
\end{savenotes}
}
\begin{document}
\begin{TCBx}
This is text\footnote{First footnote outside the box.} text...
\end{TCBx}
\begin{tcolorbox}
This is text\footnote{footnote inside the box.} bla bla bla
This is text\footnote{again footnote inside the box.} bla bla bla
\end{tcolorbox}
\begin{TCBx}
This is text\footnote{Second footnote outside the box.} text...
\end{TCBx}
\begin{TCBx}
This is text\footnote{Third footnote outside the box.} text...
\end{TCBx}
\end{document}
Best Answer
It can be done by setting a hook at the beginning of the
tcolorbox
environment with the aid ofetoolbox
package. See the following:new solution based on comment
As you mentioned, previous solution makes all boxes' font size small, but with
fontupper
option you can set font size for upper part oftcolorbox
and withfontlower
for the lower part.