Search code examples
latextikz

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


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

Solution

  • 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.