Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
2  
\\ does not work in TikZ nodes by default too. You need to supply the PGF key align=center to those labels somehow. –  Qrrbrbirlbel Jan 4 '13 at 18:37
    
Maybe you be more specific? –  Mazzy Jan 4 '13 at 18:38
add comment

2 Answers

up vote 5 down vote accepted

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

share|improve this answer
add comment

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}
share|improve this answer
    
yeah it works great.... –  Mazzy Jan 4 '13 at 19:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.