groff
[Top][All Lists]
Advanced

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

Re: [Groff] ASCII dash in UTF-8 locale


From: Anthony J. Bentley
Subject: Re: [Groff] ASCII dash in UTF-8 locale
Date: Fri, 23 Jan 2015 08:39:20 -0700

Hi Carsten,

Carsten Kunze writes:
> is there a way (except \N'45') to output an ASCII dash (0x2d) with
> nroff in an UTF-8 locale (i.e. without -T or with -Tutf8)?
> 
> I want to copy command lines from nroff output into a xterm, but the
> shell complains about the '-' which is not 0x2d.
> 
> E.g. mandoc(1) does output 0x2d for '\-' and even '-' which IMHO is
> better for manpages (to allow copiing text into the shell).

Ooh, what a question!

Back in the day, nroff only output ASCII, and encoding of troff output
was irrelevant. So \- became - in nroff, and a minus/en dash in troff
(there was no visual distinction).

In Unicode, minus and en dash are distinct (U+2212 vs U+2013). And
nroff can output more encodings than just ASCII. And encoding of
typeset output matters now because copy/paste is now a thing.

Heirloom troff and groff both render \- as en dash, not minus sign,
in PDF output. Groff renders \- as minus in HTML output. Mandoc
renders \- as ASCII '-' in all outputs. Clearly there is no consistency
here.

Personally I avoid \- entirely, and use \(mi and \(en instead. I only
ever mark up command flags in -mdoc, so I just type Fl for those. I
wish Fl became ASCII '-', but we're talking about changing decades of
historical practice here.

-- 
Anthony J. Bentley



reply via email to

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