bugGNU troff - Bugs: bug #61437, [PATCH] Fix definition of...

 
 

bug #61437: [PATCH] Fix definition of movements '\d' and '\r'

Submitted by:  Bjarni Ingi Gislason <bjarniig>
Submitted on:  Sun 07 Nov 2021 12:17:03 AM UTC
 
Category:  Core Severity:  3 - Normal
Item Group:  Documentation Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

( Jump to the original submission )

Wed 24 Nov 2021 07:36:23 AM UTC, comment #9: 

Yes, it turns out it was bug #60602 that was invalid (I already took care of that).  Thanks, Dave.

G. Branden Robinson <gbranden>
Project Administrator
Wed 24 Nov 2021 07:25:57 AM UTC, comment #8: 

Addressed by commit c709a70a.

While the patch posted here was incomplete (omitting \u, and changing only one of the two places the units of \d and \r were documented), the underlying problem it reported was valid, so changing this bug's status from Invalid to Fixed.

Dave <barx>
Project Member
Thu 11 Nov 2021 11:00:10 PM UTC, comment #7: 

Okay, Bjarni convinced me to go convince myself.

I find his assertion that Dave's wrong because he wants the documentation to be consistent to be ludicrous, however.

If we apply Bjarni's patch, all will be correct and we should leave our Texinfo manual claiming that the \d and \r motions are in vees?  Werner originally added this language in 2002 and he knows a bit about groff and typography.

That said, I took the time to go to PostScript since Bjarni apparently won't.

This is with groff 1.22.4.

Input:

$ cat EXPERIMENTS/vertical-motions.roff
.sp 2v
\l'\n(.l]'\h'|0'
foo\dbar\rbaz\dqux
foo\dbar\u\ubaz\dqux
foo\v'0.5v'bar\v'-1v'baz\dqux
foo\v'0.5m'bar\v'-1m'baz\dqux

I'm attaching a zoomed-in cropped screenshot of the PostScript output, viewed with evince(1).  There's a G in it for reasons you'll see later.

Observe the following features:
1. After the third "foo", the "bar" is dropped farther below the baseline than in the first two cases.
2. After the third "bar", the "baz" is elevated higher, both relative to the preceding "foo" and to the baseline, than in the first two cases.
3. The vertical motion after the third "baz" does not return to the baseline to print "qux" as happened in the first two cases.
4. The baseline itself has drifted upwards, as is made plain by the horizontal rule drawn by the \l escape sequence at the beginning of the input.

Since that surprised me, I tried the same example with Heirloom.

Great news--Heirloom appears to measure things slightly differently so it's not an apples-to-apples comparison.  They also seem to have different ideas about where, exactly, the baseline should be.  I'm attaching a screenshot of it as well; it's identified with an H.

What is more correct?  To move in vees or ems?

I'm taking this issue to the mailing list; this is a behavior/correctness issue and, if a change is warranted, will merit a different ticket.


G. Branden Robinson <gbranden>
Project Administrator
Thu 11 Nov 2021 09:22:52 PM UTC, comment #6: 

  Your conclusions are generally wrong

  Fact is, that the data Branden provided in his e-mail, proof that the
current (that is changed) documentation is wrong.

  These data are just buried in too many other irrelevant data.

Bjarni Ingi Gislason <bjarniig>
Thu 11 Nov 2021 04:36:37 PM UTC, comment #5: 

comment #3:

>   My patch is not invalid


Even if you are correct about the units \d and \r use, the patch is invalid because it changes the units to m's in man/groff.7.man but leaves them as v's in doc/groff.texi, making the documentation inconsistent.

Additionally, the patch changes the units for \d and \r but not for \u.  Are you claiming that \d moves down 1/2 m, but \u moves up 1/2 v?

Dave <barx>
Project Member
Wed 10 Nov 2021 10:55:18 PM UTC, comment #4: 

comment #3:

>   My patch is not invalid, but the invalidation is.


You don't say how.

>   The current documentation claims for troff:
>
> 1) \d means \v'0.5v'
>
> 2) \r means \v'-1v'
>
>   How does the example proof that?


Did you interpret it, or convert it to PostScript and inspect the result?

> a) To make things clear, explanation should have been added
> to the output of each line


I'm working on a rewrite of groff_out(5), but even in its existing state, it can be followed.  If you want to argue over the magnitude of small movements in *roff, at some point you're going to have to familiarize yourself with the device-independent ("intermediate") output format.

> b) A third case is missing, showing the choice the patch makes.


I didn't see any reason to do so.  Vertical motions are generally not made in ems in typography, as I understand it.

If you won't look at the output, look at the source.

https://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/input.cpp#n2029

https://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/input.cpp#n2159

G. Branden Robinson <gbranden>
Project Administrator
Wed 10 Nov 2021 10:46:24 PM UTC, comment #3: 

  My patch is not invalid, but the invalidation is.

  The current documentation claims for troff:

1) \d means \v'0.5v'

2) \r means \v'-1v'

  How does the example proof that?

a) To make things clear, explanation should have been added
to the output of each line

b) A third case is missing, showing the choice the patch makes.

Bjarni Ingi Gislason <bjarniig>
Mon 08 Nov 2021 08:25:12 AM UTC, comment #2: 

Thanks, Dave.

Yes, Bjarni's patch would indeed regress the documentation and make it inaccurate.

I don't have a lengthy, boilerplate quotation from Dijkstra to patronizingly offer.  Instead I'll have to settle for a concrete illustration.

Input:

$ cat EXPERIMENTS/backslash-d-and-r.roff
A
.sp
B\v'1m'C\v'-0.5m'D
.sp 2v
E\dF\rG

troff output:

x T ps
x res 72000 1 1
x init
p1
x font 5 TR
f5
s10000
V12000
H72000
md
DFd
tA
n12000 0
V36000
H72000
tB
v10000
tC
V41000
tD
n12000 0
V72000
H72000
tE
v5000
tF
V67000
tG
n12000 0
x trailer
V792000
x stop

I trust the reader to generate PostScript from either of the above and further confirm the difference in measurements by visual inspection.

G. Branden Robinson <gbranden>
Project Administrator
Mon 08 Nov 2021 06:11:17 AM UTC, comment #1: 

This patch partially undoes the change made for bug #60602.  See that bug's comments for a detailed explanation of why the units were changed from m's to v's for these motion escapes.

(And if you want to make a case for changing them back, that change needs to be made everywhere, not just in man/groff.7.man.  So if it's valid at all, this patch is still incomplete.)

Dave <barx>
Project Member
Sun 07 Nov 2021 12:17:03 AM UTC, original submission:  

From 55761e0a9e0ebf12a57481873364b5b83a15e2e6 Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Sun, 7 Nov 2021 00:11:22 +0000
Subject: [PATCH] Fix definition of movements '\d' and '\r'

  For "troff" '\d' is downwards 1/2 em and for '\r' it is upwards 1 em.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 man/groff.7.man | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

  Patch is in the attachment.

Bjarni Ingi Gislason <bjarniig>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #52242:  vert-groff.png added by gbranden (10KiB - image/png)
file #52243:  vert-heirloom.png added by gbranden (10KiB - image/png)
file #52213:  0001-Fix-definition-of-movements-d-and-r.txt added by bjarniig (885B - text/plain - Project groff, fix \d and \r)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by barx (Posted a comment)
  • -email is unavailable- added by bjarniig (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-03-05 gbranden CategoryNone => Core
    2021-11-24 barx StatusInvalid => Fixed
        Planned ReleaseNone => 1.23.0
    2021-11-11 gbranden Attached File- => Added vert-groff.png, #52242
        Attached File- => Added vert-heirloom.png, #52243
    2021-11-08 gbranden StatusNone => Invalid
        Assigned toNone => gbranden
        Open/ClosedOpen => Closed
    2021-11-07 bjarniig Attached File- => Added 0001-Fix-definition-of-movements-d-and-r.txt, #52213

    Back to the top


    Powered by Savane 3.9