
¿Cómo puedo mantener una figura de título dentro de un tcolorbox? Quiero poner el pastel en un tcb pero cuando elimino
\begin{figure}[h]
y \end{figure}
, se elimina el título. ¿Alguna solución? Gracias.
Ilustración:
\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}
Respuesta1
¡Bienvenido! tcolorbox
le permite tener flotadores como figuras en (o, más precisamente, como) tcolorbox
es. Necesitas definir a tcolorbox
para eso.
\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}
Además, considere para el futuro proporcionarnos documentos completos que comiencen con \documentclass
y terminen con \end{document}
, sean mínimos y puedan compilarse.