[Top][All Lists]

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

[groff] hyphen, minus sign and hyphen-minus

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


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

In groff_char(7) documentation is written:

  - the ISO latin1 ‘Hyphen, Minus Sign’ (code 45) prints as a hyphen
  (Unicode u2010). The same output glyph can be requested explicitly
  with ‘\(hy’. A minus sign can be obtained with ‘\-’ (Unicode u2212).

  And then groff_char(7) contains table:

  Output   Input   Code   PostScript     Unicode   Notes
  ‐        -       45     hyphen         u2010     hyphen
  -        \-             minus          u2212     minus sign

  Output   Input   PostScript     Unicode   Notes
  —        \[em]   emdash         u2014     em-dash symbol +
  –        \[en]   endash         u2013     en-dash symbol
  ‐        \[hy]   hyphen         u2010     hyphen symbol +

So ASCII "-" prints U+2010 hyphen character and \- prints U+2212
mathematical minus character.

For typographic purposes it is really nice to have ability to
distinguish between hyphen, mathematical minus and en-dash.

But in some cases I need to print hyphen-minus 0x2D character. And there
is absolutely no information in groff_char(7) documentation. So what is
the correct way to do it? As the quick hack I think that \N'45' is
working, but it is no so nice. I tried also \[char45], but it lead to

The main case when it is needed to print ASCII "-" and not Unicode
U+2010 is in source code examples. And also in manpages for switches.
E.g. --local-file in manpage should contain two hyphen-minuses (0x2D)
and not hyphens (U+2010) or mathematical minus signs (U+2212).

I see that in lot of manpages is used \-\-local\-file which leads to
minus signs on (html) output and then trying to call program with two
minus signs obviously ends with incorrect argument error. So it is for
sure wrong. For same reason is writing --local-file in manpage wrong

Pali Rohár

reply via email to

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