
如何將標題圖保留在 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
歡迎!tcolorbox
允許您使用浮點數,例如tcolorbox
es 中的數字(或更準確地說,as 中的數字)。您需要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}
,內容最少且可編譯。