tags:

views:

176

answers:

2

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.

alt text

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

What I'd like to have:

  • draw the box around the offending text just as around text that doesn't reach below the baseline. This means there is not enough space between the 'gyj' etc. characters and the bottom edge of the box. That's ok for me.
+1  A: 

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
I'll try these two tomorrow.
ziggystar
A: 

There's a tikz property for nodes: text depth
One can simply set it to 0pt for the offending (or all) nodes.

ziggystar