Hyphens in man pages
lists.debian.org
lists.debian.org
* U+002D: Hyphen-minus "-": The old ASCII character that appears when you press the key on your keyboard, at least on a US keyboard. Per Unicode, "used generically for hyphen, minus sign or en dash". Recall that ASCII had only ~96 'codepoints', as we now call them, available for characters, so many characters were designed for multiple uses, such as quotes, used for open and close quotes; carot '^', tilde '~', etc. used also as diacritics; and the uber-flexible hyphen-minus-en dash (and unofficially em dash, half-em dash ('--'), and univeral horizontal line). Also, recall that typewriters only had one hyphen-dash-minus character.
* U+2010: Hyphen: "‐": Specifically a hyphen and nothing else. Typographically, hyphens are just a bit shorter than en dashes. Grammatically, a hyphen demarcates a boundary within a term, such as compound words ('editor‐in‐chief'), phone numbers (555‐555‐5555), etc.
* U+2013: En dash: "–": Typographically, half an em dash, slightly longer than a hyphen. Grammatically, en dashes show a continuous range, e.g.: 'October–December', 'pages 15–93', and, if I don't misunderstand, 'London–Paris train', etc. It's also used in some grammatical and typographical edge case circumstances. Also, of interest only on HN: "typographers sometimes use U+2013 en dash to represent the minus sign, particularly a unary minus"
* U+2014: Em Dash "—": Typographically, twice the length of an en dash, reputedly the width of a capital 'M'. Grammatically, em dashes show a break: '"No, no, not the—" ("Yes—the Spanish Inquisition!")'. Also commonly used for parenthetical-style breaks in sentences: 'The Spanish Inquisition—ubiquitous, omniscient, or so they say—was always unexpected.' Finally, used for attribution: '"The only thing we have to fear is fear itself." — Eisenhower'. Also some odd, edge case uses. And because you asked, "In older mathematical typography, U+2014 em dash may also used to indicate a binary minus sign."
* U+2212: Minus sign: "−"
There are many more—Double Oblique Hyphen anyone? Search around Unicode, for example, for 'dash'.
Sources: Unicode documentation, Chicago Manual of Style, maybe other similar sources. The summaries of their functions, based on those sources, are mine.
* In my experience, the hyphen is usually very short in most fonts, the en dash is significantly longer, and the em dash can be much less than double the en dash (some of this may be a result of poor font design though. Monospace fonts have it rough!).
* It's widely recommended to avoid writing U+2010 and just use U+002D for hyphens. Hyphens are by far the most common of these punctuation symbols, so it's ludicrous that `man` pages to map them by default; most man pages will never want any kind of dash.
* Soft hyphen support sucks.
* For different reasons, it's rare to manually write U+2212, since you should generally tell your typesetting engine to switch to math mode (which also takes care of inserting the right obscure kinds of spaces).
* En dash is also used as a higher-level hyphen, when the inputs are already compound (not necessarily with hyphens!).
* En dash with spaces around it is an alternate style equivalent to em dash without spaces, for uses like a comma/colon/reverse-colon/parenthesis. A given work should only use one for consistency. In casually written text, space-asciidash-space is almost always intended as an en dash.
* Em dash is also the thing to use for interruption; there are several subcases here. This is the only time an em dash can potentially touch a space, though except for self-interruption they're generally inside quotes so won't actually.
* When there's a parenthetical interruption by the narrator, the em dash goes outside the quotes (“Foo”—bar—“baz”).
* Em dashes are also used for attribution after a quote, or for signatures. This is supposed to always be the start of a line, but if you're sloppy I guess it might be preceded by a space here too.
* U+2012 figure dash is probably the only other dash worth knowing; use it with digits. There's also a "figure space" you should use for monospace-like padding in a non-monospace font.
I believe the correct code point for quotation attribution is U+2015 HORIZONTAL BAR:
> The Unicode standard introduced a separate character U+2015 ― HORIZONTAL BAR to be used as a quotation dash. It may be the same length as an em-dash, which is often used instead. Some software will insert a line break after an em-dash, but not after a quotation dash.
― https://en.m.wikipedia.org/wiki/Quotation_mark#Quotation_das...
—o11c
> Em-dash, an alternative to the quotation dash
You confidently asserted the em-dash as the correct choice for quotation attribution which, if not outright incorrect, is certainly not the most or the only canonical choice. Nothing obscure in style about it!
An em-dash is an alternative to a proper quotation dash when used to precede a quotation, but is generally itself considered the proper dash for attribution [0].
[0] https://en.wikipedia.org/wiki/Dash#Attribution_of_quote_sour...
I would be a little bit less repulsed by them if they took up the right amount of space, but they’d still be an abomination.
Windows doesn't do that.
Mac also changes quotes, like
let magic = "MAGIC";
to let magic = “MAGIC”;It will fuck the code up so bad that Ctrl+Z and starting over is your only option.
If your search function/engine doesn't find all the horizontal lines characters when the user types ASCII hyphen-minus, you're generating false-negatives.
Isn't there some open source code that takes care of this universal problem? It's not just hyphen/minus/dashes. There are quotation marks, diacritics, and more.
For dashes, if done right, it could be useful to be able to search the separate ones too - i.e. search for flag dashes but not ones in prose.
For reference, the ‘match diacritics’ option on Firefox toggles this behaviour.
(It’s slightly misnamed, actually, since it’s more expansive than just diacritics: it also matches things like Unicode dashes for ASCII dashes, and so on.)
No, that's not it; there are some further issues mentioned in the thread and the linked bug reports, like man pages containing command line options that can't be copy/pasted into a terminal (because they consist of Unicode hyphens).
If I'm reading a man page via `less`, I want find the next option with a simple search function i.e. /-
How exactly it got to be a dash is not really the problem. What it should show is a character 39 apostrophe, because that's exactly what it should be showing there! Ironically, the character 45 dash is shown for me as a character 45 dash, just as it should.
Funny at that, too: https://lists.debian.org/debian-devel/2023/10/msg00085.html
> Mapping all hyphens and minus signs to a single character, as people whose blood pressure spikes over this issue tend to promote as a first resort, is an ineluctably information-discarding operation. In my opinion, man page source documents are not the correct place to discard that information.
Treating all dashes as minus signs within the context of man pages sounds perfectly fine to me (even though it can be unacceptable in other situations). I see man pages as a sort of an extension of code, be it shell code or C code. If hyphens started to creep into my code I'd be furious.
At a technical level, yes, okay. At a human level? No.
To a human reading the man page, these characters look basically identical on screen. Sure, one is sometimes, in some fonts, a bit bolder and/or a bit of a different length - but even when that’s true it’s hard to discern without context. So an actual _reader_ of these characters depends on context to know what one they’re seeing anyway. Literally no information is lost between the source text and the reader by using either.
Just use minus signs in the man pages. Trying to force everyone to care about the difference between dash/hyphen/minus sign is an unwinnable battle. There’s only one key on their keyboard, and that’s what they’re going to press. And there’s not enough context to do anything automatic to correct it.
You could maybe make an argument about accessibility for screen readers - but I’m pretty sure they’re always going to have to cope with minus-sign-as-dash for ever too (see argument about humans using keyboards, and the inability to do anything automatic to correct it).
The only actual, real-world, outcome _worth caring about_ of treating these differently is that, if they are treated differently, people can’t search for or copy/paste command line arguments.
Using minus signs is the better choice for most people.
So for some people, rewriting all of them into '-' would be information-discarding.
(However, I'd not be surprised if there are more "incorrect" hyphen/dash/minus issues in many code bases than "correct" ones...)
... $ echo -n "-" | hexdump -C
I get 2d. That's ASCII. It's minus sign.Case closed. Anyone arguing for Unicode hyphen should be shot dead on the spot, no trial.
P.S: I hope it's not lost on people that both echo and hexdump took a parameter here, and that that parameter was passed preceded by the ASCII minus sign. Which is the whole point.
- Wrapping the lines to terminal window width
- Indenting blocks
- _Basic_ formatting (bold, underline - OK, colors - NO)
- Common blocks (like option descriptions) which apply consistent combination of rules above
Everything else should be plain text, just like the the computer code or shell commands.
(There is an interesting question of why is bold text accessible in manpage but not in code.. I think the answer for that is code's equivalent is syntax highlighter. Computer languages are regular enough that we can have computer highlight various syntaxical elements; while human languages are not, so we need to ask manpage authors to highlight them for us)
Unicode, unlike typewriters and ASCII, but following half a millenium of book printing tradition, encodes a hyphen and a minus separately. (Also a number of dashes, though perhaps fewer than medieval printers used.) The weird thing it resorts to calling HYPHEN-MINUS also has to be encoded and will probably persist in computer code (including Unix program arguments) forever, but in texts targeted at humans it has no place. The inadequacy of your (and my) keyboard is regrettable, but doesn’t really make for a great argument here.
let us not judge
In fact, I would guess that anything else than 2d as a command-line parameter prefix is a bug (bar using a /).
That said, normalization when searching is useful.
It's preposterous that we have to resort to such primitive text search methods just to find the information for command line arguments. We've had hypertext for 3 decades now; why aren't they just listed in a table of contents and then you can follow the links to the detailed descriptions? I always seek out HTML documentation whenever I can; man pages are a last resort.