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]'?
> 
> 
> Have a lovely night!
> Alex
> 
> -- 
> <https://www.alejandro-colomar.es/>



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

Attachment: signature.asc
Description: PGP signature

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

Reply via email to