我正在使用 minipage 将图形分成两个位置,左边是一个用 pgf-pie 制作的图形,我希望大文本能够写在外面,而对于文本,我希望它位于中心(请参见图片)
\documentclass[12pt,a4paper]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{pgf-pie}
\begin{document}
\section{example}
\hrule
\begin{figure}[!h]
\begin{minipage}[b]{0.3\textwidth}
\caption{Example}\label{fig:ex1}
\begin{tikzpicture}[scale=0.7]
\pie[/tikz/nodes={text=white, font=\footnotesize\bfseries},
text=inside,
explode={0.1,0.1,0.1,0.1},color={blue!70,cyan!70,red!70,orange!50}]{9.3/Cedro\\rojo, 19.45/Café, 30.4/Cacao, 40.43/Tornillo }
\end{tikzpicture}
\end{minipage}\hfill\vrule\hfill
\begin{minipage}[b]{0.6\textwidth}
vallis augue. Etiam facilisis. Nunc elementum fermen-
tum wisi. Aenean placerat. Ut imperdiet, enim sed
gravida sollicitudin, felis odio placerat quam, ac pul-
vinar elit purus eget enim. Nunc vitae tortor. Proin
tempus nibh sit amet nisl. Vivamus quis tortor vitae
risus porta vehicula.
\end{minipage}
\end{figure}
\hrule
\end{document}
记得检查论坛上的其他答案,它似乎不受支持。论坛
答案1
使用该
[b]
选项可以强制迷你页面底部对齐。如果这不是您想要的,请不要使用此选项您可以使用普通的 tikz 节点手动将文本添加到饼图之外
\documentclass[12pt,a4paper]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{pgf-pie}
\begin{document}
\section{example}
\hrule
\begin{figure}[!h]
\begin{minipage}{0.45\textwidth}
\caption{Example}\label{fig:ex1}
\centering
\begin{tikzpicture}[scale=0.7]
\pie[/tikz/nodes={text=white, font=\footnotesize\bfseries},
text=inside,
explode={0.1,0.1,0.1,0.1},color={blue!70,cyan!70,red!70,orange!50}]{9.3/, 19.45/Café, 30.4/Cacao, 40.43/Tornillo }
\node[align=center,font=\footnotesize] at (4.2,0.8) {Cedro\\rojo};
\end{tikzpicture}%
\end{minipage}\hfill\vrule\hfill
\begin{minipage}{0.5\textwidth}
vallis augue. Etiam facilisis. Nunc elementum fermen-
tum wisi. Aenean placerat. Ut imperdiet, enim sed
gravida sollicitudin, felis odio placerat quam, ac pul-
vinar elit purus eget enim. Nunc vitae tortor. Proin
tempus nibh sit amet nisl. Vivamus quis tortor vitae
risus porta vehicula.
\end{minipage}%
\end{figure}
\hrule
\end{document}