Hi Branden,

I never received a copy of
<https://lists.gnu.org/archive/html/groff/2025-08/msg00028.html>.
I guess you only sent it to the list?  Or maybe it got lost...

Anyway, below goes my updated opinion.  See at the bottom.

On Sun, Sep 07, 2025 at 09:05:33AM +0200, Alejandro Colomar wrote:
> Hi Branden,
> 
> On Sat, Aug 23, 2025 at 10:02:05PM +0200, Alejandro Colomar wrote:
> > Hi Branden,
> > 
> > I was going to replace some unmatched double quote as argument to a
> > man(7) macro, which was used as a literal double quote in the output, by
> > the more readable (less ambiguous in source code) \[dq].
> > 
> > However, I've realized that groff(1) seems to treat them slightly
> > differently.  Is this intentional, or a bug?
> 
> Ping.  Here's a small reproducer:
> 
>       alx@debian:~/tmp$ cat quote.man 
>       .TH a s d f
>       .SH quote
>       There's a weird difference with quotes.
>       Here's some
>       .BR quote ()?"
>       and here's another
>       .BR quote ()?\[dq]
>       but I don't know.
>       Why they don't have the same amount of space after them?
>       alx@debian:~/tmp$ mandoc -man -Tutf8 quote.man 
>       a(s)                                                                    
>   a(s)
> 
>       quote
>              There's a weird difference with quotes.  Here's some quote()?" 
> and
>              here's another quote()?" but I don't know.  Why they don't have 
> the
>              same amount of space after them?
> 
>       f                                      d                                
>   a(s)
>       alx@debian:~/tmp$ diff -u <(mandoc -man -Tutf8 <quote.man) <(sed 
> 's/"/\\[dq]/' <quote.man | mandoc -man -Tutf8)
>       alx@debian:~/tmp$ groff -man -Tutf8 quote.man 
>       a(s)                                                                    
>   a(s)
> 
>       quote
>              There's  a  weird  difference  with quotes.  Here's some 
> quote()?"  and
>              here's another quote()?" but I don't know.  Why  they  don't  
> have  the
>              same amount of space after them?
> 
>       f                                      d                                
>   a(s)
>       alx@debian:~/tmp$ diff -u <(groff -man -Tutf8 <quote.man) <(sed 
> 's/"/\\[dq]/' <quote.man | groff -man -Tutf8)
>       --- /dev/fd/63  2025-09-07 09:03:51.078805690 +0200
>       +++ /dev/fd/62  2025-09-07 09:03:51.082804673 +0200
>       @@ -1,7 +1,7 @@
>        a(s)                                                                   
>    a(s)
>        
>        quote
>       -       There's  a  weird  difference  with quotes.  Here's some 
> quote()?"  and
>       +       There's  a  weird  difference  with  quotes.  Here's some 
> quote()?" and
>               here's another quote()?" but I don't know.  Why  they  don't  
> have  the
>               same amount of space after them?
>        
> 
> 
> mandoc(1) does the right thing, but groff(1) acts weirdly.
> 
> Have a lovely day!
> Alex
> 
> > 
> > Here are the source-code diff, and the formatted diff:
> > 
> >     $ git diff;
> >     diff --git i/man/man3/cfree.3 w/man/man3/cfree.3
> >     index 55008e9a7..1698ab6e3 100644
> >     --- i/man/man3/cfree.3
> >     +++ w/man/man3/cfree.3
> >     @@ -80,7 +80,7 @@ .SS 3-arg cfree
> >      to free memory allocated with
> >      .BR calloc (3),
> >      or do I need
> >     -.BR cfree ()?"
> >     +.BR cfree ()?\[dq]
> >      Answer: use
> >      .BR free (3).
> >      .P
> > 
> > 
> >     $ MANWIDTH=64 diffman-git;
> >     --- HEAD:man/man3/cfree.3
> >     +++ ./man/man3/cfree.3
> >     @@ -58,7 +58,7 @@ DESCRIPTION
> >      
> >             A frequently asked question is "Can I use free(3) to
> >             free memory allocated with calloc(3), or do I need
> >     -       cfree()?"  Answer: use free(3).
> >     +       cfree()?" Answer: use free(3).
> >      
> >             An SCO manual writes: "The cfree routine is provided for
> >             compliance to the iBCSe2 standard and simply calls free.
> > 
> > 
> > I think the behavior with '"' makes more sense than with '\[dq]'.  Maybe
> > some conditional within groff(1) checks for '"' but forgets to check for
> > the synonymous '\[dq]'?

I have changed my mind.  I think the behavior of mandoc(1), and that of
\[dq], is the one I like.

The '?' within quotation marks does not end the sentence, and is just
part of the quoted text.  The enclosing sentence was missing an
end-of-sentence punctuator.

I've fixed that with:

        $ git show ddb26eb2011a
        commit ddb26eb2011a498ece999aa44e501e0ed7fddb09
        Author: Alejandro Colomar <[email protected]>
        Date:   Sun Sep 7 10:06:47 2025 +0200

            man/man3/cfree.3: pfix
            
            Signed-off-by: Alejandro Colomar <[email protected]>

        diff --git a/man/man3/cfree.3 b/man/man3/cfree.3
        index b117539be..dfa2b5a13 100644
        --- a/man/man3/cfree.3
        +++ b/man/man3/cfree.3
        @@ -81,7 +81,7 @@ .SS 3-arg cfree
         to free memory allocated with
         .BR calloc (3),
         or do I need
        -.BR cfree ()?"
        +.BR cfree ()?\[dq].
         Answer: use
         .BR free (3).
         .P

Which formats as:

        $ MANWIDTH=72 diffman-git ddb26eb2011a
        --- ddb26eb2011a^:man/man3/cfree.3
        +++ ddb26eb2011a:man/man3/cfree.3
        @@ -54,7 +54,7 @@ DESCRIPTION
                to your file.
         
                A frequently asked question is "Can I use free(3) to free memory
        -       allocated with calloc(3), or do I need cfree()?"  Answer: use
        +       allocated with calloc(3), or do I need cfree()?".  Answer: use
                free(3).
         
                An SCO manual writes: "The cfree routine is provided for compli‐


This is anti-American, I know, but Americans are not reasonable
regarding quoting.


Cheers,
Alex

-- 
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).

Attachment: signature.asc
Description: PGP signature

          • ... G. Branden Robinson
          • ... Russ Allbery
            • ... G. Branden Robinson
              • ... Russ Allbery
              • ... G. Branden Robinson
              • ... Russ Allbery
              • ... G. Branden Robinson
          • ... Russ Allbery
  • Re: " vs... Alejandro Colomar via GNU roff typesetting system discussion
    • Re: &quo... G. Branden Robinson
    • Re: &quo... Alejandro Colomar
      • Re: ... G. Branden Robinson
        • ... Alejandro Colomar

Reply via email to