[Top][All Lists]

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

Re: [Groff] End-of-line whitespace.

From: Ted Harding
Subject: Re: [Groff] End-of-line whitespace.
Date: Sat, 08 May 2010 13:31:55 +0100 (BST)

Ralph has given a nice example. In any case, there is at least one
good concrete reason for avoiding trailing spaces, namely that it
is not obvious what groff will do with them, and they serve no
purpose that you can not achieve by other means.

I hit such a case not long ago, inadvertently, after "mouse-pasting"
some groff input into a posting to the groff list (thereby adding
spaces at the ends of lines without knowing I had done it).
See Werner's comment, 2009/12/29, in the thread "A little Greetings
card", at

I had been using "\" for line continuation of long lines, since
"\" immediately followed by newline hides the newline. Unfortunately
the extra trailing spaces converted this into "\ " followed by
newline, which defeated the purpose.

Using the 'vim' editor, I can easily strip trailing spaces from a
file I am editing with the command

  :1,$s/ [ ]*$//

(which I could have done with that posting to the list, if I had
been alert to the possible presence of trailing spaces).


On 08-May-10 12:00:36, Ralph Corderoy wrote:
> Hi Kristaps,
>> Are there any concrete reasons for avoiding trailing eoln whitespace
>> in roff files (specifically -man and/or -mdoc)?  These are stripped
>> from input anyway "foo    " followed by "bar" outputs "foo bar", so
>> I'm hard up for providing a reason beyond "Do It".
> It's generally a good idea in all text files since it isn't obvious to
> the reader it's present and may sometimes have significance.  In troff,
> end-of-line whitespace is significant.
>     $ cat -A
>     .ds s foo $
>     "\*s"$
>     $ nroff | grep .
>     "foo "
>     $ 
> Here, GNU cat's -A option is appending `$' to the end of the lines,
> showing `foo' on the first line of has a trailing space. 
> That
> makes it into the definition of string `s' as can be see in the output
> of nroff.
> Cheers,
> Ralph.

E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 08-May-10                                       Time: 13:31:50
------------------------------ XFMail ------------------------------

reply via email to

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