答案1
使用简单的 tikz 命令的答案:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{pgf}
\newcommand*{\makedonut}[4][1]{%
\pgfmathsetmacro\pertoarc{#3*3.6}%
\begin{tikzpicture}[scale=#1]%
\node at (0,0.5) {#3 \%};%
\node at (0,-.5) {#4};%
\draw[#2,line width=0.5cm] (0,3) arc (90:{90-\pertoarc}:3cm) coordinate (B);%
\draw[#2!20!gray,line width=0.5cm] (B) arc ({90-\pertoarc}:-270:3cm);%
\end{tikzpicture}%
}
\begin{document}
\noindent text before the donut:
\makedonut{cyan}{64}{\Large text here}
another one :
\makedonut[0.4]{red}{89}{something}
a final:
\makedonut[0.6]{green!40!blue}{32}{nothing}
\end{document}
输出: