# How to use \`\<sub\>\`/\`\<sup\>\` in record shape?

**URL:** <https://forum.graphviz.org/t/how-to-use-sub-sup-in-record-shape/385>\
**Category:** Help\
**Created:** [October 19, 2020, 12:31pm UTC](https://forum.graphviz.org/t/how-to-use-sub-sup-in-record-shape/385 "2020-10-19T12:31:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_book](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@The\_book](https://forum.graphviz.org/u/The_book)\
**Post date:** [October 19, 2020, 12:31pm UTC](https://forum.graphviz.org/t/how-to-use-sub-sup-in-record-shape/385/1 "2020-10-19T12:31:31Z")

</div>

How to use `<sub>`/`<sup>` in record shape?  
Or, how to ensure a smallest height and weight for html node?  
I am drawing a b+-tree with like Pn-1.  
In record with “” I cannot use `<sub>`/`<sup>`.  
In html empty node is too small. And it is hard to make shapes in the same height.

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [October 20, 2020, 12:02am UTC](https://forum.graphviz.org/t/how-to-use-sub-sup-in-record-shape/385/2 "2020-10-20T00:02:31Z")

</div>

[The docs](https://graphviz.org/doc/info/shapes.html#html) say `<sub>` and `<sup>` are supported. Do they not work? Could you post your input file?

---

<div class="post-metadata">

**Author:** ![The\_book](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@The\_book](https://forum.graphviz.org/u/The_book)\
**Post date:** [October 20, 2020, 3:06am UTC](https://forum.graphviz.org/t/how-to-use-sub-sup-in-record-shape/385/3 "2020-10-20T03:06:01Z")

</div>

```auto
digraph g1 {

node [shape=record];
root[label="<f0> P<sub>n-1</sub>|<f1>"];
}

```

`dot -Tsvg test.dot -o test.svg`  
`Error: bad label format <f0> P<sub>n-1</sub>`

---

<div class="post-metadata">

**Author:** ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)\
**Post date:** [October 20, 2020, 9:12am UTC](https://forum.graphviz.org/t/how-to-use-sub-sup-in-record-shape/385/4 "2020-10-20T09:12:18Z")

</div>

`<sub>` and `<sup>` are only supported for [HTML-like labels](https://graphviz.org/doc/info/shapes.html#html), not for [record-based nodes](https://graphviz.org/doc/info/shapes.html#record).

Here is how to write your example to use HTML-like labels:  
[dot verbose=true]

```auto
digraph g1 {
    node [shape=plaintext]
    root [label=<
            <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
                <TR>
                    <TD port="f0">P<SUB>n-1</SUB></TD>
                    <TD port="f1"></TD>
                </TR>
            </TABLE>
        >]
}

```

[/dot]

**NOTE:** This renders incorrectly using Firefox, but correctly with Chrome.

In case you are not using Chrome, here is a png image generated offline:

![tmp](https://global.discourse-cdn.com/graphviz/original/1X/d741002ccb5f74bf7bf736ea89cea51b00147279.png)

---

<div class="post-metadata">

**Author:** ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)\
**Post date:** [October 20, 2020, 9:37am UTC](https://forum.graphviz.org/t/how-to-use-sub-sup-in-record-shape/385/5 "2020-10-20T09:37:18Z")

</div>

See also:

> **[\[Dot\] Subscriptions not works with SVG (#1168) · Issues · graphviz / graphviz...](https://gitlab.com/graphviz/graphviz/-/issues/1168)**
>
> Created by: borneq I have in dot PS \[label = S\>\] or PS \[label = S\>\]. If I generate png is ok but on svg is...
