Reputation: 319
I have a rectangular box in latex. I want to introduce line breaks in the text that appears in the rectangular shape. Can anybody guide me in this regard. I have tried the following statement but it does not work.
\draw[solid] (7,-4) rectangle (11,-3) node[ pos=.5] {abc \\ def };
Upvotes: 2
Views: 3758
Reputation: 38768
If your node has a specified width, you can use line breaks
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (7,-4) rectangle (11,-3) node[ pos=.5,text width=4cm,align=center] {abc \linebreak def };
\end{tikzpicture}
\end{document}
Upvotes: 1