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?

2
  • 2
    \\ does not work in TikZ nodes by default too. You need to supply the PGF key align=center to those labels somehow. Jan 4, 2013 at 18:37
  • Maybe you be more specific?
    – Mazzy
    Jan 4, 2013 at 18:38

2 Answers 2

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

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}
1
  • yeah it works great....
    – Mazzy
    Jan 4, 2013 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .