bugGNU roff - Bugs: bug #63739, [mm] make nP work more like DWB mm

 
 

bug #63739: [mm] make nP work more like DWB mm

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Thu 02 Feb 2023 03:25:23 AM UTC
   
 
Category:  Macro package mm Severity:  1 - Wish
Item Group:  Feature change Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.24.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 12 Oct 2024 04:16:00 PM UTC, comment #6: 


commit dcfe27e3de446fe411626a132246d5b5a13afe90
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sat Oct 12 05:06:07 2024 -0500

    [mm] Regression-test Savannah #63739.

    Unit-test `nP` macro.

    * tests/nP-works.sh: Add unit test.
    * mm.am (mm_TESTS): Run test.

    Test fails at this commit.

commit bcda17efad5d996b089553d226599619acb5c4b7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sat Oct 12 04:31:50 2024 -0500

    [mm]: Fix Savannah #63739.

    Handle `nP` paragraphs more compatibly with DWB 3.3 mm.

    * contrib/mm/m.tmac (nP): Apply a temporary indentation to the second
      output line of a paragraph to align it with the start of the paragraph
      text (not the tag/label) in the first.

      (H): Reset the `nP` paragraph counter when the first- or second-level
      section heading number increments.

    * contrib/mm/groff_mm.7.man (Description): Drop notice of difference
      between DWB 3.3 and groff mm `nP` behavior.

      (Macros <H>, Registers <Hb>): Document interaction of `nP` and `Np`
      features with run-in headings.

    Fixes <https://savannah.gnu.org/bugs/?63739>.

    NEWS: Add item.


G. Branden Robinson <gbranden>
Group administrator
Sat 12 Oct 2024 02:24:39 PM UTC, comment #5: 

At 2024-10-12T04:57:58-0400, G. Branden Robinson wrote:

>        1.1.1  Siegesbeckia_orientalis  1.03  Quis autem vel eum
>              iure reprehenderit, qui inea voluptate velit esse,
>        quam nihil molestiae consequatur, vel illum, qui dolorem eum
>        fugiat, quo voluptas nulla pariatur?


> D.  DWB mm has a bug when starting a sectioning level deeper than
> the second, failing to break the line when the next `nP` paragraph
> starts.  Heirloom Doctools mm does not fix this bug.  We do not want
> to emulate it.


On second thought, this is probably not a bug but an underspecification
of how certain features of the package compose.  The numbered paragraph
feature is colliding with another--support for run-in headings and a
threshold register for same.

groff_mm(7):

     Hb       sets the threshold for breaking the line after formatting
              a heading.  Text after headings at levels above this value
              is set on the same output line if possible; see H (2).

(This is not a GNU mm extension.)

So, where should the second line's indentation be?

Here (DWB/Heirloom mm)?

>        1.1.1  Siegesbeckia_orientalis  1.03  Quis autem vel eum
>              iure reprehenderit, qui inea voluptate velit esse,


Pretty ugly.  By a strict interpretation of "alignment", probably this:

(hypothetical mm)

>        1.1.1  Siegesbeckia_orientalis  1.03  Quis autem vel eum
>                                              iure reprehenderit,


Pretty weird.

I think it's better to just let groff mm work as I've got it patched,
effectively disregarding `Hb` for numbered paragraphs, and document this
limitation in the man pages.

Time will tell if this wins me any condemnation from the champions of
"extreme conservatism", as a recent groff at gnu dot org mailing list
thread put it.  :)

G. Branden Robinson <gbranden>
Group administrator
Sat 12 Oct 2024 09:16:36 AM UTC, comment #4: 

And sure enough the bug in comment #3 gets as bad as you might expect.


       1.98  [redacted]

       1.99  [redacted]

       1.100  Malleus_Maleficarum

       100.01Ut enim ad minima veniam, quis nostrum exercitationem
             ullam corporis suscipitlaboriosam, nisi ut aliquid ex
       ea commodi consequatur?


G. Branden Robinson <gbranden>
Group administrator
Sat 12 Oct 2024 09:10:04 AM UTC, comment #3: 

Another DWB/Heirloom mm `nP` observation/bug.

F.  If the second-level heading number grows beyond a single digit, the `nP` paragraph indentation does not increase to accommodate it.

I've updated the specimen to better illustrate this.  Here's DWB/Heirloom output in part.


       1.2  Eternalii_famishiis

       2.01  At vero eos et accusamus et iusto odio dignissimos
             ducimus, qui blanditiis praesentium voluptatum
       deleniti atque corrupti, quos dolores et quas molestias
       excepturi sint, obcaecati cupiditate non-provident,
       similique sunt in culpa, qui officia deserunt mollitia
       animi, id est laborum et dolorum fuga.
...
       1.10  Malleus_Maleficarum

       10.01 Ut enim ad minima veniam, quis nostrum exercitationem
             ullam corporis suscipitlaboriosam, nisi ut aliquid ex
       ea commodi consequatur?


G. Branden Robinson <gbranden>
Group administrator
Sat 12 Oct 2024 08:58:55 AM UTC, comment #2: 

Forgot to mention...

Heirloom Doctools mm doesn't fix observation "E" in comment #1, either.

G. Branden Robinson <gbranden>
Group administrator
Sat 12 Oct 2024 08:57:53 AM UTC, comment #1: 

Specimen:


$ cat ATTIC/nP.mm
.H 1 Opus
.H 2 "De Redrum Unnatura"
.nP
Sed ut perspiciatis,
unde omnis iste natus error sit voluptatem accusantium doloremque
laudantium,
totam rem aperiam eaque ipsa,
quae ab illo inventore veritatis et quasi architecto beatae vitae dicta
sunt,
explicabo.
.nP
Nemo enim ipsam voluptatem,
quia voluptas sit,
aspernatur aut odit aut fugit,
sed quia consequuntur magni dolores eos,
qui ratione voluptatem sequi nesciunt,
neque porro quisquam est,
qui dolorem ipsum,
quia dolor sit amet consectetur adipiscivelit,
sed quia non-numquam eius modi tempora incidunt,
ut labore et dolore magnam aliquam quaerat voluptatem.
.H 3 "Siegesbeckia orientalis"
.nP
Quis autem vel eum iure reprehenderit,
qui inea voluptate velit esse,
quam nihil molestiae consequatur,
vel illum,
qui dolorem eum fugiat,
quo voluptas nulla pariatur?
.H 1 [redacted]
.H 1 [redacted]
.H 1 [redacted]
.H 1 [redacted]
.H 1 [redacted]
.H 1 [redacted]
.H 1 [redacted]
.H 1 [redacted]
.H 1 [redacted]
.H 2 "Malleus Maleficarum"
.nP
Ut enim ad minima veniam,
quis nostrum exercitationem ullam corporis suscipitlaboriosam,
nisi ut aliquid ex ea commodi consequatur?


DWB mm and nroff output:


$ DWBHOME=~/dwb ~/dwb/bin/nroff -mm ATTIC/nP.mm | col -b | cat -s

                                  - 1 -

       1.  Opus

       1.1  De_Redrum_Unnatura

       1.01  Sed ut perspiciatis, unde omnis iste natus error sit
             voluptatem accusantium doloremque laudantium, totam
       rem aperiam eaque ipsa, quae ab illo inventore veritatis et
       quasi architecto beatae vitae dicta sunt, explicabo.

       1.02  Nemo enim ipsam voluptatem, quia voluptas sit,
             aspernatur aut odit aut fugit, sed quia consequuntur
       magni dolores eos, qui ratione voluptatem sequi nesciunt,
       neque porro quisquam est, qui dolorem ipsum, quia dolor sit
       amet consectetur adipiscivelit, sed quia non-numquam eius
       modi tempora incidunt, ut labore et dolore magnam aliquam
       quaerat voluptatem.

       1.1.1  Siegesbeckia_orientalis  1.03  Quis autem vel eum
             iure reprehenderit, qui inea voluptate velit esse,
       quam nihil molestiae consequatur, vel illum, qui dolorem eum
       fugiat, quo voluptas nulla pariatur?

       2.  [redacted]

       3.  [redacted]

       4.  [redacted]

       5.  [redacted]

       6.  [redacted]

       7.  [redacted]

       8.  [redacted]

       9.  [redacted]

                                  - 2 -

       10.  [redacted]

       10.1  Malleus_Maleficarum

       1.01  Ut enim ad minima veniam, quis nostrum exercitationem
             ullam corporis suscipitlaboriosam, nisi ut aliquid ex
       ea commodi consequatur?


Observe:

A.  The first component of the numeric paragraph label tracks the second-level heading number.  (That's been documented for ages.)

B.  Introducing a deeper sectioning level does not alter the monotone increase of the second component.

C.  The second output line of a paragraph is indented the same as the first (disregarding the label).

D.  DWB mm has a bug when starting a sectioning level deeper than the second, failing to break the line when the next `nP` paragraph starts.  Heirloom Doctools mm does not fix this bug.  We do not want to emulate it.

E.  DWB mm in nroff mode has a bug where the length of the third output line in an `nP` paragraph is too long and misaligned with the others.  We don't want to emulate that, either.

groff 1.22.4, 1.23.0, and Git HEAD render the specimen as follows.



                                   ‐ 1 ‐

       1.  Opus

       1.1  De Redrum Unnatura

       1.01  Sed  ut  perspiciatis, unde omnis iste natus error sit
       voluptatem  accusantium  doloremque  laudantium,  totam  rem
       aperiam  eaque  ipsa,  quae  ab  illo inventore veritatis et
       quasi architecto beatae vitae dicta sunt, explicabo.

       1.02  Nemo  enim  ipsam  voluptatem,  quia   voluptas   sit,
       aspernatur  aut  odit aut fugit, sed quia consequuntur magni
       dolores eos, qui ratione voluptatem  sequi  nesciunt,  neque
       porro  quisquam  est, qui dolorem ipsum, quia dolor sit amet
       consectetur adipiscivelit, sed quia  non‐numquam  eius  modi
       tempora incidunt, ut labore et dolore magnam aliquam quaerat
       voluptatem.

       1.1.1  Siegesbeckia orientalis

       1.03  Quis  autem  vel  eum  iure  reprehenderit,  qui  inea
       voluptate  velit esse, quam nihil molestiae consequatur, vel
       illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?

       2.  [redacted]

       3.  [redacted]

       4.  [redacted]

       5.  [redacted]

       6.  [redacted]

       7.  [redacted]

       8.  [redacted]

       9.  [redacted]

       10.  [redacted]

       10.1  Malleus Maleficarum

       1.04  Ut enim ad minima veniam, quis nostrum  exercitationem
       ullam  corporis  suscipitlaboriosam,  nisi  ut aliquid ex ea

                                   ‐ 2 ‐

       commodi consequatur?


Observe the failure to reset the second component of the paragraph label after the second-level section heading resets.

Observe the lack of further indentation of the second output lines of `nP` paragraphs.

Fix these.

G. Branden Robinson <gbranden>
Group administrator
Thu 02 Feb 2023 03:25:23 AM UTC, original submission:  

A difference between DWB mm and groff mm has been around for as long as groff mm itself, but seems never to have been documented or commented upon, as far as I can tell.  In Git it is now documented.


.IP \[bu]
DWB
.IR mm 's
.B nP
macro indented the second line of a paragraph to align it with the start
of the text of the first
(after the paragraph number);
.IR "groff mm" 's
does not.


There is no output line count argument to the `ti` request, so I suppose this would be done with with a diversion and a diversion trap to set a temporary indent for the second output line.

This ticket is to gather views on whether this would be worth implementing.

G. Branden Robinson <gbranden>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-10-12 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.24.0
    2024-10-12 gbranden StatusNone In Progress
        Assigned toNone gbranden
        Summary[mm] make nP work more like DWB mm? [mm] make nP work more like DWB mm

    Back to the top

    Powered by Savane 3.14-962f.
    Corresponding source code