metanorma / metanorma-itu

Metanorma for ITU-T Recommendations
BSD 2-Clause "Simplified" License
4 stars 4 forks source link

(URGENT, PDF) Definition lists inconsistent in column alignments #473

Closed ronaldtse closed 7 months ago

ronaldtse commented 11 months ago

Reported by @taddhar in https://github.com/openitu/X.icd-schemas/issues/21 :

Screenshot 2023-11-04 at 12 36 21 PM
Intelligent2013 commented 11 months ago

@ronaldtse these lists are independent lists (the tables actually in the terms of XSL-FO). The auto-layout table width algorithm in mn2pdf applies independently for each table:

The columns widths calculated for the 9.10.2.1:

<fo:table-column column-width="proportional-column-width(620)"/>
<fo:table-column column-width="proportional-column-width(1142)"/>

The columns widths calculated for the 9.10.2.2 are:

<fo:table-column column-width="proportional-column-width(620)"/>
<fo:table-column column-width="proportional-column-width(1678)"/>

@opoudjis I don't remember exactly, but looks like we have the feature for definition list columns width for another SDOs. Do you remember it?

opoudjis commented 10 months ago

@opoudjis I don't remember exactly, but looks like we have the feature for definition list columns width for another SDOs. Do you remember it?

It was indeed felt desirable, because some SDOs did in fact implement definition lists as tables in Word. NIST certainly does it, for terms as well as definitions.

opoudjis commented 10 months ago

I can't find any other examples, although I'm convinced this has come up with ISO in the past...

ronaldtse commented 7 months ago

@opoudjis so is the solution to use a manual table (instead of a definition list) that includes manually set column widths?

This is key to fixing https://github.com/openitu/X.icd-schemas/issues/21

opoudjis commented 7 months ago

That is one way of solving it, but it would need to be done in Presentation XML if so, so that it carries across to all formats.

This use of interrupted tables to render definition lists is a malfeature on the part of the organisation, as they need to manually tweak all their tables to line up, but we are stuck with it.

opoudjis commented 7 months ago

ITU want definition lists rendered as tables. The approach I had taken here was to leave the definition list in the Presentation XML as dl/dt, dl/dd, and leave the rendering as a Table downstream, as a PDF auto-table, a CSS grid in HTML, and a table in Word.

The supposed problem is that this means the definition list columns won't line up with each other.

Addressing this by imposing a uniform width on definition list tables is inevitably going to lead sooner or later to someone on ITU whining about some exception. When that time comes, they will be told the stock Metanorma answer to requests by SDOs to perpetuate formatting inconsistencies: if they want to keep authoring documents in Word, they know where to find it.

I am going to turn all definition lists in ITU into tables of class "dl", with 20% width for terms, in Presentation XML.

opoudjis commented 7 months ago

Note that definition lists are left alone if they are the children of tables, figures, or formulas (so we do not get intractable nesting of tables.)

Intelligent2013 commented 7 months ago

Now, ITU XSLT renders so: image

Issues:

Presentation XML:

<table id="_1552205f-c9f1-d661-4863-f429d21f7a93" class="dl">
    <tbody>
        <tr>
            <th width="20%">Description</th>
            <td width="80%">
                <p id="_2439a912-2533-8ffe-b47a-c62db3378761">The name of the entity</p>
            </td>
        </tr>
        <tr>
            <th width="20%">Requirement</th>
            <td width="80%">
                <p id="_fae9297d-7fd5-51b3-681f-f83ec47129e9">
                    <tt>recommended</tt>
                </p>
            </td>
        </tr>
    </tbody>
</table>

I have to fix ITU XSLT.

Intelligent2013 commented 7 months ago

ITU XSLT updated: image

opoudjis commented 7 months ago

My turn to fix this: