[Top][All Lists]

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

Re: [groff] hyphen, minus sign and hyphen-minus

From: Ingo Schwarze
Subject: Re: [groff] hyphen, minus sign and hyphen-minus
Date: Fri, 25 May 2018 15:18:18 +0200
User-agent: Mutt/1.8.0 (2017-02-23)


Pali Rohar wrote on Fri, May 25, 2018 at 09:54:59AM +0200:

> I would like to ask, how to print hyphen-minus character in groff?
> I mean classic ASCII "-" which has Unicode code point U+002D.

This has been discussed at great length on this list recently.
Search the archives.

The short answer is:
There is no solution.

There are two reasons why there isn't:

 1) An output glyph "hyphen-minus" doesn't even exist for all
    output devices.  For example, devps/TR provides "45 hyphen",
    "137 endash", and "173 minus", but there is no such thing
    as "hyphen-minus", at least not as a separate glyph.
    In that sense, your question is not even meaningful.

 2) All existing roff input characters, in particular -, \-,
    \(hy, \(mi, \(en already have a well-established meanings,
    and none of them means "hyphen-minus".  Changing the meaning
    of any of them would break existing documents, so that is
    not an option.

Theoretically, it would of course be possible to define a new
input character to mean "hyphen-minus".  But nobody wants to go
into that direction, for two reasons:  On the one hand, nobody
wants to edit the many thousands of existing manual pages to clean
usage up afterwards.  On the other hand, and even more importantly,
writing manuals should be easy, so nobody wants to make it more
complicated for novice authors by requiring a new rule that
needs paying attention to.

For manual pages, the long-established workaround is to use \-.
All manual page macro sets map that to the U+002D output glyph,
for output devices that support it.

For other documents, there is no standard recommendation.
I'd suggest to also use \-, but you have to make sure yourself
that you have the right .char request to map it as desired,
similar to what the manual page macros do.

> I see that in lot of manpages is used \-\-local\-file which leads to
> minus signs on (html) output

It doesn't with mandoc(1), it yields ASCII hyphen-minus there.
It also doesn't with groff -Tascii and -Tutf8 output.

So i'd call that a bug in the manual page to HTML processing of
groff (groff HTML output is notoriously buggy in general).
Don't worry too much about groff HTML output, it is of little

> and then trying to call program with two
> minus signs obviously ends with incorrect argument error.
> So it is for sure wrong.

No.  It is best practice and clearly recommended.


reply via email to

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