
Ich möchte eine benutzerdefinierte Tcolorbox erstellen, die oben links ein Symbol hat. Der Einfachheit halber werde ich einige Tikz-Bilder verwenden, um zu veranschaulichen, was ich meine. Aber im Tcolorbox-Handbuch kann ich keine Möglichkeit finden, den Text in der Box so einzustellen, dass er die Abbildung umschließt. Die einzige Möglichkeit, die Abbildung in die Box einzupassen, besteht darin, den gesamten Inhalt der Box über „leftupper=[length]“ einzurücken.
\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
%%% My custom box
\newtcolorbox{mybox}{%
breakable,
fonttitle=\bfseries,
colback=red!5!white,
enhanced jigsaw,
colframe=red!50!black,
colbacktitle=red!50!black,
colframe=red!50!black,
opacityback=0.35,
leftupper=16mm,
title=test}
%%% The command for the image
\newcommand{\test}{\begin{tikzpicture}
\path[use as bounding box] (-.1,1.6) rectangle +(0.3,.3);
\draw[fill=black] (0,0) circle (.5cm);
\end{tikzpicture}}
\begin{document}
\test
\begin{mybox}This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text. This is some random text.
\end{mybox}
\end{document}
Antwort1
Etwas wie das?
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{wrapfig}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}
\begin{wrapfigure}[11]{L}{5cm}
\includegraphics[width=\linewidth]{example-image}
\end{wrapfigure}%
\lipsum[1-2]
\end{tcolorbox}
\end{document}