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)};
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityFrom 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.
align=center
to the node's options.text width=<length>