
Как мне сохранить подпись внутри 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
Welcome! tcolorbox
позволяет вам иметь плавающие элементы, такие как цифры в (или, точнее, как) tcolorbox
es. Вам нужно определить tcolorbox
для этого.
\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}
, являются минимальными и могут быть скомпилированы.