Wrapfigure と tcolorbox

Wrapfigure と tcolorbox

次のように、tcolorbox を wrapfigure に配置したいと思います。

\begin{wrapfigure}{r}{0.4\textwidth}
    \vspace{-8mm}
    \begin{tcolorbox}[width=\linewidth,
        colback=cyan!10!white,
        colframe=white,
        colbacktitle=cyan!30!white,
        fonttitle=\bfseries,
        coltitle=black!20!black,
        title= \vspace{1mm}My title,
        titlerule=1mm,
        titlerule style=cyan
        segmentation style={cyan, line width=1.5pt, solid}
        ]
        Just some text, but the titlerule is not working :(
        \tcblower
        More text, but the segmentation style is not working neither.
    \end{tcolorbox}
\end{wrapfigure}

残念ながら、タイトルルールが機能しません (白いタイトルルールのみが表示されます)。 誰か理由を説明してもらえますか?

このMWEも試してみました:

\documentclass[12pt,a4paper, xcolor=dvipsnames]{scrartcl}
\PassOptionsToPackage{svgnames}{xcolor}

\usepackage[ngerman]{babel}             
\usepackage[T1]{fontenc}            
\usepackage[utf8]{inputenc} 

\usepackage{tcolorbox}
\usepackage{blindtext}
\usepackage{wrapfig}

\begin{document}
    \begin{wrapfigure}{r}{0.4\textwidth}
        \begin{tcolorbox}[width=\linewidth,
            %enhanced jigsaw,
            colback=cyan!10!white,
            colframe=white,
            colbacktitle=cyan!30!white,
            fonttitle=\bfseries,
            coltitle=black!20!black,
            title= \vspace{1mm}My title,
            titlerule=3mm,
            titlerule style=red,
            segmentation style={cyan, line width=1.5pt, solid}
            ]
            Just some text, but the titlerule is not working :(
            \tcblower
            More text, but the segmentation style is not working neither.
        \end{tcolorbox}
    \end{wrapfigure}
\blindtext

\end{document}

しかしtitlerule stylesegmentation styleまだ動作していません...。

答え1

オプションを使用できるようにするには、コードに追加する必要があるものが 2 つありますtitlerule style。1 )プリアンブルにsegmentation style追加し、2)スタイル オプションに追加する必要があります。\tcbuselibrary{skins}enhanced

したがって、完全なコードは次のようになります。

\documentclass[12pt]{article}

\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{wrapfig}

\usepackage{blindtext}

\begin{document}

\begin{wrapfigure}{r}{0.4\textwidth}
    \begin{tcolorbox}[
        width=\linewidth,
        enhanced,
        colback=cyan!10!white,
        colframe=white,
        colbacktitle=cyan!30!white,
        fonttitle=\bfseries,
        coltitle=black!20!black,
        title={\vspace{1mm}My title},
        titlerule=3mm,
        titlerule style=cyan,
        segmentation style={cyan, line width=1.5pt, solid}
    ]
        Just some text, now the titlerule is working :)
        \tcblower
        More text, and the segmentation style is also working.
    \end{tcolorbox}
\end{wrapfigure}

\blindtext

\end{document}

ここに画像の説明を入力してください

申し訳ありませんが、最初はあなたのコードの問題に気づきませんでした。

関連情報