metanorma / metanorma-iso

Metanorma processor for ISO standards
BSD 2-Clause "Simplified" License
13 stars 5 forks source link

PDF: Table "units statement" should be placed at the table header and repeated #1151

Closed ronaldtse closed 3 months ago

ronaldtse commented 3 months ago

From metanorma/iso-2533#23

According to ISO DIR 2 29.3:

Screenshot 2024-04-01 at 12 43 30

It doesn't say "how" the "units statement" is rendered but in practice here's an example from ISO 2533/Add 2:1997:

Table first page:

Screenshot 2024-04-01 at 12 46 22

Table continuation:

Screenshot 2024-04-01 at 12 45 32

Right now, the units statement is treated as a normal note only appearing at the bottom of the table, which is not ideal when the reader is looking at a middle page of the table.

Screenshot 2024-04-01 at 12 48 41
Intelligent2013 commented 3 months ago

<note id="_" type="units"> currently supported in PDF for the figures only. I don't know why I've missed for tables... Will fix it.

Intelligent2013 commented 3 months ago

XSLT updated (not merged yet) for table's units notes rendering: image

But strange indents occur at right edge: image

Presentation XML:

<note id="_13cdc74f-6506-2104-fb72-c57410649328" type="units"><p id="_1ed82fa5-25b3-d2b8-4911-e6d461c40135">Values in terms of geometrical altitude.<br/>
Valeurs en fonction de l’altitude géométrique.<br/>
Значения величин в функции геометрической высоты.</p>
</note>

XSL-FO:

<fo:block text-align="right">Values in terms of geometrical altitude.&#8232;
Valeurs en fonction de l’altitude géométrique.&#8232;
Значения величин в функции геометрической высоты.
</fo:block>

Without line breaks:

<note id="_13cdc74f-6506-2104-fb72-c57410649328" type="units"><p id="_1ed82fa5-25b3-d2b8-4911-e6d461c40135">Values in terms of geometrical altitude.<br/>Valeurs en fonction de l’altitude géométrique.<br/>Значения величин в функции геометрической высоты.</p>
</note>

XSL-FO:

<fo:block text-align="right">Values in terms of geometrical altitude.&#8232;Valeurs en fonction de l’altitude géométrique.&#8232;Значения величин в функции геометрической высоты.
</fo:block>

PDF renders ok: image

Looks like Apache FOP doesn't process correctly the sequence &#8232;+linebreak. But first line renders correctly...

So I'll remove linebreak immediately after <br/> via XSLT on fly specially for note[@type = 'units'] (right-aligned text).

ronaldtse commented 3 months ago

@Intelligent2013 Thanks! I also wonder why there’s an empty header row below the units note?

Intelligent2013 commented 3 months ago

Thanks! I also wonder why there’s an empty header row below the units note?

Presentation XML has only one row with spanned columns in the table header:

<thead><tr><th colspan="8" valign="top" align="right"/></tr></thead>

The first tr in tbody contains the table header.

I think the wrong markup in table_header.liquid:

{{ table_title }}
[cols="{{ row_size }}*^"]
|===
{{ row_size }}+>|

Issues:

I've manually moved the 1st row from tbody instead row in the thead in the XML and PDF renders properly: image

Intelligent2013 commented 3 months ago

ISO XSLT updated. Issue with units statement fixed in PDF. image