12

I have the following problem with Tikz/Latex:

I have some nodes that contain text. Most text doesn't have letters that reach below the baseline. But for those nodes where it happens, the ratio and placement of node height and text/baseline is off. Have a look at the example image.

enter image description here

Solutions I know of:

  • make the nodes' minimum height bigger. This results in the nodes being sized the same, but the baseline is still at different heights
  • use struts. This results in all nodes being laid out like the ones containing the offending text. This results in too much space between the baseline of the text and the surrounding box for most nodes
ziggystar
  • 28,410
  • 9
  • 72
  • 124

2 Answers2

10

There's a property for nodes: text depth

One can simply set it to 0pt for the offending (or all) nodes.

Note

Of course this is well documented in the pgfmanual.

Community
  • 1
  • 1
ziggystar
  • 28,410
  • 9
  • 72
  • 124
1

This is more of a pointer (can't get TikZ at the moment), but since you are not getting anything else, there are two things to try:

1) There is the $\smash[b]{\text{my text y}}$ (you need amsmath for this).

2) Maybe \raisebox{0pt}[0pt]{my text y} is what you want.

AVB
  • 3,994
  • 22
  • 21