Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle text nodes that contain text that goes below baseline?

Tags:

latex

tikz

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
like image 479
ziggystar Avatar asked Mar 22 '10 16:03

ziggystar


2 Answers

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.

like image 182
ziggystar Avatar answered Nov 10 '22 13:11

ziggystar


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.

like image 24
AVB Avatar answered Nov 10 '22 13:11

AVB