Opened 21 months ago

Last modified 19 months ago

#578 accepted defect

Superscripts and definition lists - misaligned terms and defs

Reported by: mahoney@nostrum.com Owned by:
Priority: medium Milestone:
Component: v3 vocabulary Version:
Keywords: Cc: rfc-editor@rfc-editor.org

Description

When superscript formatting is applied to text in a definition entry (<dd>) of a definition list (<dl>), the baseline of the term text (<dt>) is raised above the baseline of the <dd> text in the output. This is more noticeable in the PDF than the HTML. See the first two entries in Section 3.1 of RFC 8949:

https://www.rfc-editor.org/in-notes/v3test/rfc8949.pdf
https://www.rfc-editor.org/in-notes/v3test/rfc8949.html#name-major-types

Change History (4)

comment:1 Changed 21 months ago by henrik@levkowetz.com

I consider this a bug, but my CSS-foo is insufficient to come up with a good fix. I've looked at using 'vertical-align: baseline'; but that doesn't work here since the <dt> and <dd> elements aren't inline elements.

comment:2 Changed 21 months ago by mahoney@nostrum.com

Carsten Bormann suggests the following fix:

:not(.dlNewline) > dt::after {
     content: "\200B";
     vertical-align: super;
     font-size: smaller;
}

:not(.dlNewline) > dd:not(.break)::before {
     content: "\200B";
     vertical-align: super;
     font-size: smaller;
}

He says, "(The thing in the quotes is CSS notation for an U+200B, ZERO WIDTH SPACE — you can also put that there verbatim, if you want to confuse generations of people looking at this.)"

The workaround is to use <dl newline=“true”> to improve the list formatting.

comment:3 Changed 21 months ago by henrik@levkowetz.com

This would force extra line height on all instances of <dt><dd>, so I'd call it a cludge or workaround rather than a fix. A proper fix will address the proper baseline alignment of <dt><dd> pairs, irrespective of the presence of <sup>, <sub> (which will have a similar effect as <sup>, but will not be addressed by the workaround above) and other cases, such as nested superscripts (<sup>x<sup>y</sup></sup>) which also will not be addressed by the workaround.

I do, however, suggest using the &zwsp; workaround in the source XML in order to align the <dt> and <dd> correctly in the example case, i.e.:

  <dt>Major type 0<sup>&zwsp;</sup>:</dt>

until a better CSS-based solution that aligns the baselines is available.

comment:4 Changed 19 months ago by rjsparks@nostrum.com

  • Status changed from new to accepted
Note: See TracTickets for help on using tickets.