4

I have trouble making a tikz picture label break into couple lines. Here is specific MWE:

    \documentclass{article}

    \usepackage[latin1]{inputenc}
    \usepackage{tikz}
    \usetikzlibrary{shapes,arrows}
    \begin{document}
    \tikzstyle{action} = [
                        rectangle, draw, 
                        fill=blue!20,
                        text width=6em,
                        node distance=3cm, 
                        text centered
                        ]

    \begin{tikzpicture}[scale=2, auto]
    % Place nodes
    \node [
            action, 
            label=below:Computer: (0 min)
            ] 
            (Receive) {Receive Order};
    \node [
            action, 
            left of=Receive,
            text width=10em,
            node distance=4cm,
            label=below: hey this is a big\\label; what should i do to break it? 
            ] 
            (identify) {I am a big process name};
    \end{tikzpicture}
\end{document}

As you can see, tikz doesn't break the line. Am I missing something?

3
  • 3
    The label behaves like a normal node: Line wrapping only works if you specify the alignment option (like align=center). In this case, you can use label={[align=center]below: hey this is a big\\label; what should i do to break it?}, or you can set the alignment option for all of your labels using every label/.append style={align=center}
    – Jake
    Dec 30, 2012 at 20:58
  • 1
    @Jake sounds like an answer :)
    – cmhughes
    Dec 30, 2012 at 21:22
  • yeah, can you please write it as an answer? It works thank you :)
    – N Nik
    Dec 30, 2012 at 21:29

1 Answer 1

3

The label behaves like normal nodes: Line wrapping only works if you specify the alignment option (like align=center), in which case you can manually break the lines using \\, or by specifying a text width, in which case the text will automatically wrap around.

For labels, you can use label={[align=center]below: hey this is a big\\label; what should i do to break it?}, or you can set the alignment option for all of your labels using every label/.append style={align=center}.

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