4

I wish to add the new line character in the node, however, I tried several ways, all cannot work.

\node[draw, minimum width = 2em, minimum height=1em] (a) {get \\ flight(gf)};
3
  • Add align=center to the node's options. Feb 15, 2013 at 2:14
  • Or specify text width=<length>
    – user11232
    Feb 15, 2013 at 2:17
  • i think there's a duplicate round here somewhere...
    – cmhughes
    Feb 15, 2013 at 3:46

1 Answer 1

7

From the manual for TikZ and pgf, version 2.10:

In Section 16.4.3 Text Parameters: Alignment and Width for Multi-Line Text

You use \\ inside your node to mark the end of lines and then request TikZ to arrange these lines in some manner. This will only be done, however, if the align option has been given.

and later

You can request that TikZ does an automatic line-breaking for you inside the node by specifying a fixed text width for the node. In this case, you can still use \\ to enforce a line-break. Note that when you specify a text width, the node will have this width, independently of whether the text actually “reaches the end” of the node.

You must log in to answer this question.

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