groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: opposite of \c?


From: népéta mew
Subject: Re: opposite of \c?
Date: Sat, 07 Sep 2024 14:52:33 +1000
User-agent: mblaze/1.2

"G. Branden Robinson" <g.branden.robinson@gmail.com> wrote:
> 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

hi

yeah, i did also create an inline version of the macro,
i mostly wanted a .q( .q) version just to make it easier to do
things like nested quotes, but making that work seems like probably
more trouble than it's worth.

thanks,
népéta



reply via email to

[Prev in Thread] Current Thread [Next in Thread]