[Top][All Lists]

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

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

From: Pali Rohár
Subject: Re: [groff] hyphen, minus sign and hyphen-minus
Date: Fri, 25 May 2018 16:59:50 +0200
User-agent: NeoMutt/20170113 (1.7.2)


On Friday 25 May 2018 15:18:18 Ingo Schwarze wrote:
> Hi,
> 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.

Yes, for output devices which do not have that glyph is best option to
choose one which is the most similar. But question is for output devices
which supports it (basically everything with Unicode; including PDF and

>  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.

I understand. Changing existing meaning is not an option. For printed
documents it is really needed to have ability to show difference between
these typographical characters/glyphs.

> 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 \-.

Can be this information documented somewhere? I was really not able to
find it in any groff documentation. Probably it should be in

You wrote that it should be easy to write manual page, but then it is
really bad if after reading groff_char(7) documentation I was not able
to find out what how to print command line arguments...

> All manual page macro sets map that to the U+002D output glyph,
> for output devices that support it.

That is not truth. Otherwise I would not ask my question (see below).

> 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.

As opposite to above "long-established workaround" in manpages I think
that it makes sense for other documents to define a new input character
for hyphen-minus. There is no need to edit existing documents and usage
of this new character is optional (nobody is forced to use it). It just
helps to standardize a way how to print it.

> > 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.

Happens for: man -Tps and man -Tdvi

And I think that the best readable output is by grodvi driver. So would
really like to have working copy+paste from the dvi output (converted to
PDF viewer).

> 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
> relevance.

HTML output for manpages is relevant. Lot of manpages are available on
internet and therefore in HTML format. I saw lot of HTMLized manpages
where parameters had two minues instead of ascii hyphen-minus and it
lead to situation that copy+paste did not work. I do not know if it was
output of groff's html or other tool, but it was the fact.

What is then preferred tool to generates HTML output from manpage if
groff is notoriously buggy?

> > 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.

So usage of mathematical minus sign (\-) is recommended as 0x2D
character for describing command line options in manpage?

> Yours,
>   Ingo

Pali Rohár

reply via email to

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