groff
[Top][All Lists]
Advanced

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

Re: .CW usage by a new user


From: G. Branden Robinson
Subject: Re: .CW usage by a new user
Date: Thu, 5 Sep 2024 02:34:52 -0500

Hi Jordán,

At 2024-09-04T21:46:28-0400, isf (Jordán) wrote:
> I am using the MS macro in groff and with the .CW I saw that I could
> not add a phrase with quotes, well I could write .CW “test” but I
> can't do something like: .CW “”test“” what should I do so that the
> quotes can be seen with .CW?

I'm assuming your input used neutral quotation marks, not the "smart"
[sic] ones I see in this email.  (_Icedove_ does that?!)

Neutral double quotes are special in macro calls.

groff(7):
       "   The neutral double quote can be used to enclose arguments to
           macros and strings, and is required if those arguments
           contain space or tab characters.  In the .ds, .ds1, .as, and
           .as1 requests, an initial neutral double quote in the second
           argument is stripped off to allow embedding of leading
           spaces.  To include a double quote inside a quoted argument,
           use the \[dq] special character escape sequence (which also
           serves to typeset the glyph in text).

For completeness, here's groff_ms(7) on `CW` macro usage.

       .B [text [post [pre]]]
              Style text in bold, followed by post in the previous font
              style without intervening space, and preceded by pre
              similarly.  Without arguments, ms styles subsequent text
              in bold until the next paragraphing, heading, or no‐
              argument typeface macro call.
...
       .CW [text [post [pre]]]
              As .B, but use a constant‐width (monospaced) roman
              typeface instead of bold.  This is a Tenth Edition
              Research Unix extension.

Here's an example I just tried.

$ nroff -ms <<EOF | cat -s
.LP
You won't be able to tell on a terminal device,
but
.CW "this phrase is spicy with Courier powder" .
EOF

And here's the output:

You  won’t  be able to tell on a terminal device, but this phrase
is spicy with Courier powder.

At a more technical level, we can demonstrate that the Courier roman
("CR") font really is being selected by formatting for a typesetting
device (the groff default, "ps") and grepping the device-independent
output, looking for 'f' (font selection) and 't' (text output) commands.

$ groff -ms -Z <<EOF | grep -C2 '^f'
.LP
You won't be able to tell on a terminal device,
but
.CW "this phrase is spicy with Courier powder" .
EOF
p1
x font 5 TR
f5
s10000
V84000
--
tut
wx font 6 CR
f6
h2500
tthis
--
wh6000
tpowder
f5
t.
n12000 0

Does this help?

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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