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 am drawing a diagram with tikzpicture. The main idea is to draw several boxes of texts framed, and link them with lines...

What I know is using \filldraw to draw boxes, \node to write one line of text, and \draw to make a line. But I have to adjust every coordinator of every element... So my question is:

1) Is it possible to write a text of several lines?

2) Is it possible to frame a text of serveral lines?

Could anyone help? Thank you very much!

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

A \node can contain several lines of text; you can use the align= key and manually change lines with \\, or you can specify a width for the text:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
  \node[draw,align=center] (A) at (0,0) {some\\ text \\ spanning \\ several \\ lines};
  \node[draw,align=center,text width=1.5cm] at (3,0) {some text spanning several lines};
\end{tikzpicture}

\end{document}

enter image description here

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.