Re: '-' vs '\-' in TH (man(7))

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

 



Hi Alex,

I have divided feelings about this issue.

At 2023-08-20T21:10:52+0200, Alejandro Colomar wrote:
> I just noticed that the Linux man-pages use '-' in TH.  That's
> surprising to me, as Michael was careful to use '\-' correctly.
> 
> In the documentation, I couldn't find anything that says TH
> should be different than anywhere else, and so I'd expect he
> would have used it there.
> 
> $ grep -rn '^\.TH [^ ]*-' man* | wc -l
> 30
> $ grep -rn '^\.TH [^ ]*\\-' man* | wc -l
> 0
> 
> Was it just an oversight, or are there any obscure reasons to do
> that?

At 2023-08-20T15:51:04-0600, Brian Inglis wrote:
> Those are just normal *hyphens* *within* the page title command

...not a command.  When a Unix command name has a hyphen-minus in it's
name, that's certainly what you want to get when you cut and paste from
the page title.

'Course, back in the days of screaming capitalized page
titles, it was easier to not take those literally.  And most of the
examples on _my_ system seem to have both hard-coded screaming caps and
Unicode-General-Punctuation-Block-destined hyphens.

And whatever its representation in the man page sources, that character
is going to be represented on the _file system_ as U+002D hyphen-minus.

> /function/...  name; perhaps you are thinking of '\-' used as a
> *dash*(/minus) after the page title command/function/... name
> following .SH NAME in all 1111 files?

Naw, he wasn't.

> See groff_char(7):
> 
> "For best results in roff systems, use the “−” character in input
> outside an escape sequence only to mean a hyphen, as in the phrase
> “long-term”. For a minus sign in running text or a Unix command-line
> option dash, use \− (or \[−] in groff if you find it helps the clarity
> of the source document)."...

I stand by this advice, but it doesn't reach the question of how "-"
characters in Unix file names should be represented.

At 2023-08-21T00:41:29+0200, Alejandro Colomar wrote:
> Are they all?  I see they are all in man7 (there's one in man5, which
> is my bad, actually), so it's more likely that the names don't
> represent some identifier that has a minus sign in it, however, I
> still have doubts.
[many examples snipped]
> See for example time_namespaces.7 and session-keyring.7.  Any reason
> to prefer a hyphen for one thing but an underscore for the other?

An underscore would seem to wriggle free of _this_ problem.

At 2023-08-21T00:59:56+0000, Lennart Jablonka wrote:
> > Should the '-' in e.g. UTF-8 be hyphen, or should it be a minus?
> > Are all of these hyphens?  And if so, why would a hyphen belong
> > there?
> 
> It should be a hyphen.   All of these are hyphens.   A minus sign
> would belong if it was math stuff.

Your perspective is consistent with troff's design until man pages enter
the fray.

> A “Unix dash” (being the same character as a minus sign),

In small character encodings, yes.  In Unicode?  No.

> would belong if those were not names for use in prose but names to be
> interpreted by the software, that requires the use of hyphen-minus.
> Your programs won’t accept command line options introduced by U+2010 ‐
> HYPHEN.   Your program called fun-program won’t be executed when
> typing fun‐program with U+2010.   Otherwise (and beside its use in
> NAME),

My understanding is that other dashes are accepted there by
makewhatis(8) and mandb(8) programs.  lexgrog(1), which is used by
man-db mandb(8), in particular parses them fine.

> there is hardly any reason to use \-.

In man pages, especially of Unix commands, the exception seems to nearly
swallow the rule.

> Perhaps an argument could be made about the copypastability of man
> page titles.   I don’t want to make it and would disagree with it.
> Unless the thing you describe explicitly contains a hyphen-minus,
> don’t use \-.

Here's an exercise for the reader.

$ (cd /usr/share/man/man1 && ls -c *-*)

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux