6

I'm using pgf-pie. It is not a standard package. I found it on google code. As its name, it is used to create pie chart.

\begin{figure}[htp]
\centering
    \begin{tikzpicture}[scale=0.9]
        \pie[text=pin,style=drop shadow,rotate=240,
             explode=0.2,
             color={blue!70,cyan!70,red!70,orange!50}]{65/Amplificatori di potenza, 10/Elaborazione del segnale, 17.5/Sistemi di raffreddamento, 7.5/Alimentazione}
    \end{tikzpicture}
\end{figure}

I would start a new line in label. In latex the command is \\ but it doesn't work. Any idea?

Count Zero
  • 17,424
Mazzy
  • 7,642

2 Answers2

9

The \\ macro doesn’t work normally in a TikZ node at all unless a text width or an alignment is set.

As you specified that the texts are in fact text=pin you will need to use

/tikz/every pin/.style={align=center},

The reason that the /tikz/ tree must be prepended is that the first (optional) argument of \pie is forwarded to \pgfkeys and not \tikzset.

Code

\documentclass[tikz]{standalone}
\usepackage{pgf-pie}
\begin{document}
\begin{tikzpicture}[scale=0.9]
    \pie[
        /tikz/every pin/.style={align=center},
        text=pin,
        rotate=240,
        explode=0.2,
        color={blue!70,cyan!70,red!70,orange!50},
        ]
        {
            65/Amplificatori di\\potenza,
            10/Elaborazione\\del segnale,
          17.5/Sistemi di\\raffreddamento,
           7.5/Alimentazione
        }
    \end{tikzpicture}
\end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821
5

As in @Qrrbrbirlbel's comment, you can't break lines by default in TikZ nodes. In this answer it is also said, you will have to set the parameters of the node text to be able to break a line. The \pie command, however, won't like that, so you need to specify it globally for the whole tikzpicture:

\documentclass{article}

\usepackage{tikz} 
\usepackage{pgf-pie}
\usetikzlibrary{shadows}

\begin{document}
\begin{figure}[htp]
\centering
    \begin{tikzpicture}[scale=0.9,align=center]
        \pie[text=label,style=drop shadow,rotate=240,
             explode=0.2,
             color={blue!70,cyan!70,red!70,orange!50}]{65/Amplificatori\\di potenza, 10/Elaborazione\\del segnale, 17.5/Sistemi di\\raffreddamento, 7.5/Alimentazione}
    \end{tikzpicture}
\end{figure}
\end{document}
Count Zero
  • 17,424