Hi Jan,

Jan Stary wrote on Wed, Nov 29, 2017 at 09:05:48PM +0100:

> the manpage below does not go through mandoc -Tlint -Wstyle, because
> 
>   mandoc -Tlint -Wstyle *.1
>   mandoc: ecurve.1:48:1: STYLE: whitespace at end of input line
>   mandoc: ecurve.1:49:7: STYLE: whitespace at end of input line
>   mandoc: ecurve.1:50:7: STYLE: whitespace at end of input line
>   mandoc: ecurve.1:51:6: STYLE: whitespace at end of input line
>   mandoc: ecurve.1:52:7: STYLE: whitespace at end of input line
>   mandoc: ecurve.1:53:6: STYLE: whitespace at end of input line
>   mandoc: ecurve.1:54:6: STYLE: whitespace at end of input line
> 
> The offending portion is:
> 
> .Bd -literal
> $ ecurve 7 0 3
>        
>   *  * 
>   *  * 
>    **  
>   *  * 
>    **  
>    **  
> .Ed
> 
> I can just delete the trailing whitespace

Probably not ideal because ...

> and the reader will see the same, but the whitespace actually has
> a meaning here: it's a 7x7 ascii bitmap
> of an elliptic curve (y^2 = x^3 + 3 over Z_7).

 ... you make a reasoanble argument that you actually want to
display the trailing whitespace because it is meaningful.

> Is it intended that trailing whitespace is an offence even in -literal?

Yes, because trailing blanks are not semantically significant in the
roff(7) language in general.  They are stripped from the input before
even starting the formatter, and that's why the warning is adequate,
not only because trailing blanks are hard to see in output.

Actually, if you have trailing blanks in a file which you display
with less(1) in an xterm(1), you *can* see them when you mark them
with the mouse.  Try that with the input to, and with the output
from mandoc.  You can see them in the input file, but they are not
present in the output.

> Not that I really need it, but is there an environment in mdoc(7)
> that explicitly permits whitespace, for situations such as this?

There is no other environment for that purpose and you don't need
any, but you have three options, sorted by increasing intrusiveness
and rigorousness:

 1. Escape the trailing blanks such that they actually get
    displayed:

--- tmp.mdoc.orig       Wed Nov 29 21:38:54 2017
+++ tmp.mdoc    Wed Nov 29 21:32:02 2017
@@ -45,13 +45,13 @@
 is the column.
 .Bd -literal
 $ ecurve 7 0 3
-       
-  *  * 
-  *  * 
-   **  
-  *  * 
-   **  
-   **  
+      \ \&
+  *  *\ \&
+  *  *\ \&
+   ** \ \&
+  *  *\ \&
+   ** \ \&
+   ** \ \&
 .Ed
 .Sh BUGS
 .Nm

    Two downsides: They are still hard to see when the manual is
    displayed, and they become U+00A0 NO-BREAK SPACE in -Tutf8.

 2. Use the example command

      $ ecurve 7 0 3 | sed 's/$/./'

    instead of the one you show now.

    One downside: The tool itself still writes trailing blanks,
    which are still hard to see, assuming that most users will
    not usually pipe their output through sed(1).

 3. If you think the trailing blanks really matter for users
    and commonly occur in practice, change the tool itself to
    write a dedicated character at line ends to show where the
    end of each line is.  Of course, that would be a user interface
    change for the tool.

Yours,
  Ingo

Reply via email to