My simple question is how to set some text using tikz in a column e.g.

| A |
| B |
| C |

I do not want to rotate the text so I can not use the rotate option or the set text along path method. Can give me a hint how to do it right?

  • Using a matrix and populating the rows with letters maybe? – percusse Aug 18 '11 at 13:08
  • Then I need the size and position of the whole matrix. – Christian Wolf Aug 18 '11 at 13:24
  • 3
    Just about anything can go in a \node text so you could achieve this with \node[align=center] {A \\ B \\ C}; (the align is needed to ensure that the `\\` are taken note of). – Andrew Stacey Aug 18 '11 at 13:25
  • 3
    @Christian: Do you need a way of writing long strings of text that way, or would a "manual" approach like the one Andrew mentioned work for your application? – Jake Aug 18 '11 at 13:50
  • The strings are some characters long. Single words like entry, vip or staff. I'll try these days. Thanks – Christian Wolf Aug 18 '11 at 23:09

As I said in the comments, just about anything is allowed in a node; in particular, multi-line text. The only thing is that the node needs to know how to vertically align the text. This is controlled by the align key (Section 16.4.3 in the PGF manual (PGF2.10)). In the following, I've chosen center. Getting the size of the node after is simple using the anchors. To ensure that the anchors are big enough that the resulting shape will be clear of the text, I chose an ellipse as the node shape. As you say, it may not be worth designing a whole new shape just for one symbol, so I've drawn something vaguely like what you describe manually. In order to get the arc right, I wrote a little helper macro that measures the distance between two points. This is because arcs are specified using radii, but we want to draw an arc between certain points. So we measure the points first and use the measurements to specify the radii.


  \advance\pgf@x by \pgf@xa\relax
  \advance\pgf@y by \pgf@ya\relax

\node[align=center,ellipse] (a) {this\\is\\some\\text\\arranged\\vertically};
\draw (a.east) |- (a.north) -| (a.west) arc[x radius=\xdistance, y radius=\ydistance, start angle=-180, end angle=0];


vertical text in a node

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.