I'm a recent convert to TikZ from xy-pic, and am still trying to get a hang for it. I see that one can add labels to the end of arrows and the like using \node. Is there a way to add an arbitrary piece of text at a given position in the text, regardless of whether there is a shape there, a line there, or nothing at all? Thanks very much for your insight.

  • What do you mean with an arbitrary position in the text? Do you mean at an arbitrary position in your drawing, specified using a coordinate system? Or do you mean at a certain place in your LaTeX document?
    – Jake
    Sep 23, 2011 at 0:09
  • Sorry, I mean at an arbitrary position within the drawing itself, preferably specified by coordinates. Many thanks.
    – Skeptic
    Sep 23, 2011 at 0:12
  • 2
    No problem. Yeah, then using the \node at (<x>,<y>) {<text>} syntax as in Gonzalo's answer is the way to go.
    – Jake
    Sep 23, 2011 at 0:13

1 Answer 1


In TikZ you can use nodes to place almost anything (in particular, text) in the position you want. In the following example I used the at construct to specify the exact position of the nodes using explicit coordinates:



\node[draw] at (0,0) {some text};
\node[draw,align=left] at (3,0) {some text\\ spanning three lines\\ with manual line breaks};
\node[draw,text width=4cm] at (2,-2) {some text spanning three lines with automatic line breaks};


I only used the draw option to make the nodes visible. Notice that in the second \node I used the align= key and then used the \\ command to enforce the line breaks at the desired positions. In the third \node, instead of specifying the line breaks "manually", I specified a width for the text and now the line breaking was made automatically.

enter image description here

  • 1
    This is great, many thanks. For some reason, though, I get an error in trying to compile across the line containing "align=left". Any ideas on why this is? If I remove that, the picture compiles fine, although the line breaks are ignored. Hmm...
    – Skeptic
    Sep 23, 2011 at 0:17
  • @Skeptic: Seems that you are using an outdated version of PGF. Add \pgfversion to your code, and after compilation, you will see in your document the PGF version that your system is using. If your version number is less than 2.10 then you should update it. Sep 23, 2011 at 0:21
  • 3
    Is it possible to somehow calculate the coordinates of a point on the edge of the boxes, maybe in percents or some other relative units, a point like the center of the "right border" of some box? I want to create arrows with it from one box to the next. Apr 16, 2017 at 22:24
  • 15
    +1. If I do not want to add the box around the text, I can use "\node[] at (0,0) {some text};" instead. Yes? Thanks
    – wonderich
    Nov 23, 2018 at 18:55
  • 3
    @user1700890 Just change \node[draw to \node[ (i.e. remove the draw). See explanation here.
    – Peter K.
    Mar 26, 2020 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.