tcolorbox 中的文字換行圖像

tcolorbox 中的文字換行圖像

我想創建一個自訂 tcolorbox,其左上角有一個圖示。為了簡單起見,我將使用一些 tikzpicture 來說明我的意思。但是閱讀 tcolorbox 手冊我找不到一種方法使框中的文字包裹圖形。將圖形放入框中的唯一方法是透過「leftupper=[length]」縮排整個框內容。

在此輸入影像描述

\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}

答案1

像這樣的東西嗎?

\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}

在此輸入影像描述

相關內容