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 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)};
share|improve this question
    
Add align=center to the node's options. –  Qrrbrbirlbel Feb 15 '13 at 2:14
    
Or specify text width=<length> –  Harish Kumar Feb 15 '13 at 2:17
    
i think there's a duplicate round here somewhere... –  cmhughes Feb 15 '13 at 3:46
add comment

1 Answer 1

up vote 7 down vote accepted

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.

share|improve this answer
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.