
Wie kann ich eine Bildunterschrift in einer Farbbox behalten? Ich möchte das Kreisdiagramm in eine Farbbox einfügen, aber wenn ich es lösche
\begin{figure}[h]
, \end{figure}
wird die Bildunterschrift entfernt. Gibt es irgendwelche Lösungen? Danke.
Illustration:
\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}
Antwort1
Willkommen! tcolorbox
ermöglicht es Ihnen, Gleitkommazahlen wie Zahlen in (oder genauer gesagt als) tcolorbox
es zu haben. Sie müssen tcolorbox
dafür ein definieren.
\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}
Bitte beachten Sie auch in Zukunft, dass Sie uns nur vollständige Unterlagen zur Verfügung stellen, die mit beginnen \documentclass
und enden \end{document}
, minimal sind und sich zusammenstellen lassen.