
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
。そのためには を定義する必要があります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}
、最小限でコンパイル可能な完全なドキュメントを提供することを検討してください。