tcolorbox로 그림 캡션을 유지하는 방법

tcolorbox로 그림 캡션을 유지하는 방법

여기에 이미지 설명을 입력하세요 tcolorbox 안에 캡션 그림을 어떻게 보관할 수 있습니까? 파이를 tcb에 넣고 싶지만 \begin{figure}[h]및 을 삭제하면 \end{figure}캡션이 제거됩니다. 어떤 해결책이 있습니까? 감사해요.

삽화:

 \begin{figure}[h]
 \centering 
 \begin{tikzpicture}
   \pie [polar]{10/Excellentes, 20/Bonnes, 30/Moyennes, 40/Mauvaises}
 \end{tikzpicture}
 \caption{ Présentation  }
 \label{fig: Question}
 \end{figure}

 \\

 \begin{tcolorbox}[colback=white]

 \centering 
 \begin{tikzpicture}
   \pie [polar]{10/Excellentes, 20/Bonnes, 30/Moyennes, 40/Mauvaises}
 \end{tikzpicture}
 \caption{ Présentation  ghjghjghjg }
 \label{fig: Qp}
 \end{tcolorbox}

답변1

환영! es tcolorbox의 숫자(또는 더 정확하게는 as)와 같은 부동 소수점을 가질 수 있습니다 tcolorbox. tcolorbox이를 위해서는 a를 정의해야 합니다 .

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{pgf-pie}
\begin{document}
 \begin{figure}[h]
 \centering 
 \begin{tikzpicture}
   \pie [polar]{10/Excellentes, 20/Bonnes, 30/Moyennes, 40/Mauvaises}
 \end{tikzpicture}
 \caption{ Pr\'esentation  }
 \label{fig: Question}
 \end{figure}

% define a tcolorbox version of figures, see p. 115 of the manual
\newtcolorbox[blend into=figures]{myfigure}[2][]{float=htb,capture=hbox,
title={#2},every float=\centering,#1}


\begin{myfigure}[label={fig:Qp},% <- label goes here
    colback=white]{Another pr\'esentation.}% <- caption goes here
 \begin{tikzpicture}
   \pie [polar]{10/Excellentes, 20/Bonnes, 30/Moyennes, 40/Mauvaises}
 \end{tikzpicture}
 \end{myfigure}

As shown in figure~\ref{fig:Qp}, one can have floats in (or, more precisely, as)
\verb|tcolorbox|es.
\end{document}

여기에 이미지 설명을 입력하세요

또한, 향후에 로 시작 \documentclass하고 끝나며 \end{document}최소한이고 컴파일할 수 있는 완전한 문서를 제공하는 것을 고려해 주시기 바랍니다.

관련 정보