[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: opposite of \c?
From: |
G. Branden Robinson |
Subject: |
Re: opposite of \c? |
Date: |
Fri, 6 Sep 2024 22:15:25 -0500 |
Hi népéta,
At 2024-09-07T12:14:47+1000, nepeta@canaglie.net wrote:
> is there functionality that acts as the reverse of the \c sequence?
> i'm trying to write macros that surround a block of text in quotes,
> such
>
> .q(
> wow wow the text is quoted
> .q)
>
> becomes
>
> 'wow wow the text is quoted'
>
> (pretend those are fancy quotes)
>
> the opening macro is just
> \oq\c
> and it works fine, but i can't figure out how to inhibit the
> space for the end quote inside the macro, so it ends up like
>
> 'wow wow the text is quoted '
>
> is there an escape or a request that allows for this?
I don't think this is easy to do, the way you're trying to do it.
I would probably define one macro for "inline" quotations and another
for "displayed" ones. Make the inline one accept arguments.
But what if you _want_ space after the end of the quote, as you likely
will sometimes? You can put it there with the `\~` escape sequence.
$ cat ATTIC/nepeta.groff
.de Q
\(lq\\$*\(rq\c
..
Hey, look\(em\c
.Q this is quoted
\&.
And stuff after
.Q this
\~is not.
$ nroff ATTIC/nepeta.groff | cat -s
Hey, look——“this is quoted”. And stuff after “this” is not.
Another approach would be to have Q optionally accept a second argument
for trailing punctuation. This means you'll need to remember to quote
the first one, if it comprises multiple words.
$ cat ATTIC/nepeta2.groff
.de Q
\(lq\\$1\(rq\\$2
..
Hey, look\(em\c
.Q "this is quoted" .
And stuff after
.Q this
is not.
$ nroff ATTIC/nepeta2.groff | cat -s
Hey, look——“this is quoted”. And stuff after “this” is not.
Does this help?
Regards,
Branden
signature.asc
Description: PGP signature