# TikZ: is there a better way to represent the following node content

Consider the code below:

\documentclass[convert = false, border = 1cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[font = \scriptsize] at (-3.5, 4) {Position of $S_2$ when};
\node[font = \scriptsize] at (-3.5, 3.7) {$S_1$ reaches $C$};
\end{tikzpicture}
\end{document}


I used two nodes to write short explanation of a point in a figure I am constructing. However, I had to play around with the set up so they weren't spaced vertically too far a part and the second node was centered on the content of the first node. Is there a better way to this?

-
Yes, \node […,align=center] at (…) {Position of $S_2$ when \\ $S_1$ reaches $C$};. –  Qrrbrbirlbel Jul 11 '13 at 22:55
@Qrrbrbirlbel thanks. I didn't know I could use \\ in a node. –  dustin Jul 11 '13 at 23:00

As Qrrbrbirlbel pointed, you can use \\ to break lines inside a node if you also use align option. Without it, \\ has no effect as is shown in top node below.

If you don't want to insert \\ every time, you can combine text width and align options. With them, latex will break lines according its rules. You'll find some examples below.

\documentclass[tikz]{standalone}

\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}

\node[draw] (a) {Position of $S_2$ when \\ $S_1$ reaches $C$};

\node[draw,text width=3cm, below=of a] (b) {Position of $S_2$ when \\ $S_1$ reaches $C$};

\node[draw,align=center, below=of b] (c) {Position of $S_2$ when \\ $S_1$ reaches $C$};

\node[draw,text width=3cm, align=right, below=of c] (d) {Position of $S_2$ when $S_1$ reaches $C$};

\end{tikzpicture}
\end{document}


-

It is sad that PSTricks cannot do it without parbox or its variants. The following is with PSTricks.

\documentclass[pstricks,border=12pt]{standalone}