I want to style my figures and I found a way to do so with tcolorbox.
\newtcolorbox[blend into=figures]{myfigure}[2][]{float=htb,capture=hbox,blend before title=colon hang,title={#2},every float=\centering,#1,sharp corners,colback=white,colbacktitle=blue!30!black}
\begin{myfigure}{Title}
\includegraphics[width=0.6\textwidth]{Graphic}
\end{myfigure}
Is there a possibility to add some text besides the graphic?
Thank you for your answers.
So here's the MWE showing one standard figure with a subtext and a tcolorbox-figure. What I want to do is adding some text inside the tcolorbox, too. This text should be under (maybe the best way) or on one side the graphic – but inside the colorbox.
\documentclass{article}
\usepackage{graphicx}
\usepackage{ngerman}
\usepackage[theorems,skins,breakable]{tcolorbox}
\newtcolorbox[blend into=figures]{myfigure}[2][]{float=htb,capture=hbox, blend before title=colon hang,title={#2},every float=\centering,#1,sharp corners,colback=white,colbacktitle=blue!30!black}
\begin{document}
\begin{figure}[h]
\centering \includegraphics[width=0.6\textwidth]{Graphic}
\caption{Title}
\footnotesize{Subtext Line 1 \\ Subtext Line 2}
\end{figure}
\begin{myfigure}{Title}
\includegraphics[width=0.6\textwidth]{Graphic}
\end{myfigure}
\end{document}
Best Answer
There's no problem adding any text to a
myfigure
contents. So OP could use something like:but the result is not as desired because OP's
myfigure
contains optioncapture=hbox
which means:We have two solutions, use
capture=hbox
and include and manually format image and contents or change tocapture=minipage
(the default mode) and lettcolorbox
do the work for us. With the second solution,width=...
lower
part of atcolorbox
for commentssidebyside
moves comments from lower part to figure sideFollowing code shows a possible declaration for
myfigure
and how particular options change the defined behaviour.