[go: up one dir, main page]

HTML-like labels: vertical alignment of nested tables

Created by: gghh

Hello,

the following dot code

strict graph  {
    node [label="\N",shape=none];
    pack [label=<

<table color="red">
  <tr>
    <td>
      <table color="blue"
                 valign="bottom"
                 fixedsize="true" height="50" width="150">
        <tr><td></td></tr>
      </table>
    </td>
    <td>
      <table color="blue" 
                 valign="bottom" 
                 fixedsize="true" height="250" width="150">
        <tr><td></td></tr>
      </table>
    </td>
  </tr>
</table>

        >];
}

compiled with dot -Tpng g.dot -o g.png produces this output, as expected:

g 5

but if I try to have the two nested tables top aligned, i.e. with

strict graph  {
    node [label="\N",shape=none];
    pack [label=<

<table color="red">
  <tr>
    <td>
      <table color="blue"
                 valign="top"
                 fixedsize="true" height="50" width="150">
        <tr><td></td></tr>
      </table>
    </td>
    <td>
      <table color="blue"
                 valign="top"
                 fixedsize="true" height="250" width="150">
        <tr><td></td></tr>
      </table>
    </td>
  </tr>
</table>

        >];
}

I get this unexpected result (the table on the left somehow gets off the outermost table, the small squared cell disappears):

g 6

what I am trying to do: the innermost tables represent some records I have. They can be of an arbitrary number of rows, so I want to pack them into the outer table to keep them somehow together. I want them all to be part of the same node, and all top aligned. I produce this programmatically, so fitting tables into tables is simpler than managing the layout of a single, top-level table.