bugGNU roff - Bugs: bug #59604, [ms] IP indents using wrong type...

 
 

bug #59604: [ms] IP indents using wrong type size after GROWPS-ed heading

Submitter:  T. Kurt Bond <tkurtbond>
Submitted:  Wed 02 Dec 2020 08:50:42 PM UTC
   
 
Category:  Macro ms Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 11 Jun 2021 05:35:54 AM UTC, comment #6: 


commit 6a505946b5036f2b149d3a3e5c86f5ceb9f1c3fc
Author: Tadziu Hoffmann <hoffmann@usm.uni-muenchen.de>
Date:   Sat Aug 18 04:23:00 2018 +1000

    [ms]: Fix Savannah #59604.

    Indent an IP paragraph based on the type size of the paragraph text, not
    a preceding heading.  We have to delay evaluating IP's argument until
    the font size has been reset, which I've attempted to do by simply
    passing the argument unevaluated down the call hierarchy, instead of
    saving it in a number register right away, as appears customary in this
    ms implementation.

    However, par@reset is called from a great number of places, and these
    usually set the indent registers beforehand.  I've left this as it is,
    so now two ways of setting the indents exist: via register and
    optionally via argument.

    * tmac/s.tmac (par@reset): Move font-size setting stuff before
      indent-setting stuff; set registers from optional arguments with
      default "n" scaling indicator before setting indents.

      (par*start, par@finish): Don't set registers, but instead pass
      arguments to par@reset.

      (@IP): Pass argument unevaluated to par*start.

    [Thanks to T. Kurt Bond for updating the patch and championing the
    resolution of this bug!  --GBR]

commit a109785fc41243a9f38cdbaa33b6e420b776e372
Author: Tadziu Hoffmann <hoffmann@usm.uni-muenchen.de>
Date:   Sat Aug 18 04:23:00 2018 +1000

    tmac/s.tmac: Use "u" scaling indicator more.

    * tmac/s.tmac (@QP, @XP): Be more scrupulous about using "u" scaling
      indicator.

commit fa19dfc9f3a072255257f497f393613bae2fe1cd
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Fri Jun 11 14:42:01 2021 +1000

    Add regression test for Savannah #59604.

    * tmac/tests/s_IP-indents-using-paragraph-type-size.sh: Add it.
    * tmac/tmac.am (tmac_TEST): Run it.

    Test fails at this commit.


G. Branden Robinson <gbranden>
Group administrator
Fri 11 Jun 2021 04:07:56 AM UTC, comment #5: 

This bug applies to headings generally, not just unnumbered ones.


.nr PSINCR 3p
.nr GROWPS 3
.NH 1
Text
.IP 1. 4
Filling
.IP 2. 4
Sentences



G. Branden Robinson <gbranden>
Group administrator
Fri 11 Jun 2021 03:56:12 AM UTC, comment #4: 

I first encountered this bug in the ms output of pandoc, which generates the specific .IP forms I used in the example.  Thanks for coming up with a simplified reproducing case.

T. Kurt Bond <tkurtbond>
Fri 11 Jun 2021 03:43:00 AM UTC, comment #3: 

Here's a more minimal reproducing case.

An additional ingredient is required to make the bug obvious; an explicit indentation argument is required on multiple .IP paragraphs after the .SH.

You can leave out the explicit indentation argument to the second .IP call, and good style would suggest that you do, since it's redundant--.IP indentation amounts are reused until a sectioning or a different paragraph macro is called (as recently explicitly noted in our ms documentation; see commits f40318205 and 021ba0e71).

However, exercising good style makes the bug harder to see; in that case, groff ms does indeed re-use the indentation amount--the wrongly-computed computed one based on the type size of the heading instead of that of the paragraph text.  groff ms has, therefore, been consistently incorrect, and it takes a style faux pas to reveal the problem.

This confluence of factors might explain why this bug went unreported for many years (I guess since the introduction of the PSINCR/GROWPS feature in 2004).


.nr PSINCR 3p
.nr GROWPS 3
.SH 1
Text
.IP 1. 4
Filling
.IP 2. 4
Sentences


G. Branden Robinson <gbranden>
Group administrator
Wed 09 Jun 2021 09:54:18 PM UTC, comment #2: 

file #51531:  odd-ip-with-growps.s.tmac.patch was the original patch provided by Tadziu Hoffmann in https://lists.gnu.org/archive/html/groff/2018-08/msg00035.html

file #51531:  odd-ip-with-growps.s.tmac.patch is a version of that patch reworked with to work with Reworked patch to work with groff git HEAD as of commit 8b9dd62b0416c154ec6694e85b36560111f1a6ff

It seems to work, as far as I can from using this patch with several of my documents.

T. Kurt Bond <tkurtbond>
Fri 30 Apr 2021 03:01:24 PM UTC, comment #1: 
G. Branden Robinson <gbranden>
Group administrator
Wed 02 Dec 2020 08:50:42 PM UTC, original submission:  

If you use PSINC and GROWPS and then use .IP directly after .SH 1 or .SH 2 the indentation for the first indented paragraphs are larger than the indentation for the second indented paragraphs.

Here's source for an example:

.nr PSINCR 3p
.nr GROWPS 3
.nr PD 0v
.SH 1
Locations
.IP " 1." 4
Ruin/Lost City/Temple \[em] I\[aq]m thinking a ruined temple on the
outskirts of the city that predated the current city, the one that was
destroyed when the Sorcerer-King was overthrown.
.IP " 2." 4
Exotic Land
.IP " 3." 4
Settlement
.SH 2
Example of level 2 SH
.IP " A." 4
Item.
.IP " B." 4
Item.
.SH 3
Example of level 3 SH
.IP " A." 4
Item.
.IP " B." 4
Item.
.\" Local Variables:
.\" compile-command: "groff -Tpdf -ms odd-indent-ip-after-sh-with-psinc-3p-GROWPS-2.ms >odd-indent-ip-after-sh-with-psinc-3p-GROWPS-2.pdf"
.\" End:


T. Kurt Bond <tkurtbond>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51535:  newer-old-ip-with-growps.s.tmac.patch added by tkurtbond (2KiB - application/octet-stream - Reworked patch to work with groff git HEAD as of commit 8b9dd62b0416c154ec6694e85b36560111f1a6ff)
file #51531:  odd-ip-with-growps.s.tmac.patch added by tkurtbond (2KiB - application/octet-stream - Extracted from the 2018-08 mbox archive of the groff mailing list: https://lists.gnu.org/archive/mbox/groff/2018-08)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Updated the item)
  • -email is unavailable- added by tkurtbond (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-11 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2021-06-11 gbranden Summary[ms] wrong .IP indentation after .SH 1 with .nr PSINCR 3p, .nr GROWPS 3 [ms] IP indents using wrong type size after GROWPS-ed heading
    2021-06-11 gbranden StatusNone In Progress
        Assigned toNone gbranden
        Summary[ms] odd .IP indentation after .SH 1 with .nr PSINCR 3p .nr GROWPS 3 [ms] wrong .IP indentation after .SH 1 with .nr PSINCR 3p, .nr GROWPS 3
    2021-06-09 tkurtbond Attached File- Added newer-old-ip-with-growps.s.tmac.patch, #51535
    2021-06-09 tkurtbond Attached File- Added odd-ip-with-growps.s.tmac.patch, #51531
    2021-04-30 gbranden SummaryOdd indentation in -ms using .IP after .SH 1 with .nr PSINC 3p .nr GROWPS 3 [ms] odd .IP indentation after .SH 1 with .nr PSINCR 3p .nr GROWPS 3
    2021-04-19 gbranden CategoryCore Macro ms

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code