ietf-tools / xml2rfc

Generate RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies
https://ietf-tools.github.io/xml2rfc/
BSD 3-Clause "New" or "Revised" License
65 stars 38 forks source link

Superscripts and definition lists - misaligned terms and defs #578

Open ietf-svn-bot opened 3 years ago

ietf-svn-bot commented 3 years ago

type_defect | by mahoney@nostrum.com


When superscript formatting is applied to text in a definition entry (

) of a definition list (
), the baseline of the term text (
) is raised above the baseline of the
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


Issue migrated from trac:578 at 2022-02-08 07:11:38 +0000

ietf-svn-bot commented 3 years ago

@henrik@levkowetz.com commented


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

and
elements aren't inline elements.

ietf-svn-bot commented 3 years ago

@mahoney@nostrum.com commented


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

to improve the list formatting.

ietf-svn-bot commented 3 years ago

@henrik@levkowetz.com commented


This would force extra line height on all instances of

, so I'd call it a cludge or workaround rather than a fix. A proper fix will address the proper baseline alignment of
pairs, irrespective of the presence of , (which will have a similar effect as , but will not be addressed by the workaround above) and other cases, such as nested superscripts (xy) 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

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

ietf-svn-bot commented 3 years ago

@rjsparks@nostrum.com changed status from new to accepted