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: Jordán
Subject: Re: .CW usage by a new user
Date: Thu, 5 Sep 2024 13:14:42 -0400
User-agent: Icedove Mail

En 5/9/2024 12:41, Russ Allbery escribió:
> It may help to go through this step by step, or at least that's the way
> that I think about it (probably because I mostly write code to generate
> *roff rather than write it directly).
> 
> Please note that all the intermediate steps here are, by themselves,
> invalid, and are just being shown as steps in the process.  Only the final
> step is the correct input.
> 
> You want that string to all be in a fixed-width font.  So to start with,
> you put .CW in front of it:
> 
> .CW $ echo "foo   bar"
> 
> But the .CW macro takes a single argument and without any surrounding
> quotes that argument is going to end with the first space, so you need to
> enclose the entire argument in double quotes so that it's one argument:
> 
> .CW "$ echo "foo   bar""
> 
> Now you have the problem that the interior double quotes that should be
> part of the argument are going to be interpreted as ending the quoted
> string that comprises the argument.  All of those double quotes inside the
> quoted argument have to be escaped.  The way to do that is to replace each
> interior double quote with two consecutive double quotes:
> 
> .CW "$ echo ""foo  bar"""
> 
> This looks like the string ends with three double quotes, but it's better
> to think of it as one escaped double quote, which is written as "", and
> then the double quote that ends the argument.
> 
> This should then produce the output that you want.

Wow but what a solid and clear answer, Russ Allbery you helped me a lot,
I am translating to Spanish the book “Introduction to the command line”
and I decided to work with groff. Thank you all very much for helping me
and answering in such a hurry.

Attached is an image showing that I made it.
-- 
Jordán
Distribuidor de software libre y miembro de la Free Software Foundation.
Mi sitio web: https://libertysoftware.cl

A menos que adoptes el uso de criptografía, nuestra comunicación estará
absolutamente comprometida. Defiende tu privacidad e informate en
https://emailselfdefense.fsf.org/es/infographic.html o escríbeme al
respecto.

Attachment: Captura de pantalla -2024-09-05 13-13-36.png
Description: PNG image

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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