Hyphen-minus

The hyphen-minus, -, is a character used in digital documents and computing to represent a hyphen , a minus sign , or a dash .[1] Typewriter keyboards and computer encodings had only one character that looked like this, so its design had to be a compromise between the different typographical appearances. It is almost always called (incorrectly) a dash or minus when computer documents are read aloud.

It is present in Unicode as code point U+002D - HYPHEN-MINUS; it is also in ASCII with the same value.

Description

The glyph for the hyphen-minus is not as wide as that of the plus sign.

The use of a single character for both hyphen and minus was a compromise made in the early days of fixed-width (monospaced font) typewriters and computer displays.[2] However, in proper typesetting and graphic design, there are distinct characters for hyphens, dashes, and the minus sign. Usage of the hyphen-minus nonetheless persists in many contexts, as it is well known, easy to enter on keyboards, and in the same location in all common character sets.

In proportional fonts the hyphen-minus is usually the size of, or slightly bigger than, a hyphen, and smaller than a minus sign (which is usually the same width as a plus sign). This results in an unattractive appearance when mixed with plus signs. Also many word processors will allow a word wrap after a hyphen-minus, unlike the minus sign proper which is treated as a mathematical symbol no different (typographically) from a number or letter. These differences make its use undesirable in professional typography.

Uses

Typing

This character is almost always typed when a hyphen or minus sign is wanted. It can also be used for an en dash, such as The Los Angeles-London flight. Some style manuals recommend putting spaces on each side to indicate it is a dash (2000 - 2004 is a range, while 2000-2004 is a math expression that equals −4). It is conventional to use a pair -- to represent an em dash ,[3] and some word processors automatically convert this pair to an em dash. The character can also be used to simulate a horizontal line, or alternated with spaces to make a "dashed" line that indicates where paper is to be cut.

Programming languages

Most programming languages use the hyphen-minus for denoting subtraction and negation.[4][5] It is almost never used to indicate a range, due to ambiguity with subtraction. Generally other characters, such as the Unicode U+2212 MINUS SIGN are not recognized.

In some programming languages -- marks beginning of a comment. Likewise, it can occasionally start the signature block. YAML uses a triple dash --- to end a section.

Command line

The character is often used when specifying command-line options, a convention mostly started by Unix. Options might be -x or -y, a user can specify both by using -xy. Various implementations of the getopt function allow two hyphen-minuses to specify "long" option names as --description, which are much easier to read while being much harder to memorize and write (recent software does not care about the number of hyphen-minuses, and either doesn't allow combinations of single-letter options or require the user to rearrange them so they don't match a long option). A double hyphen-minus by itself (followed by a space) indicates that there are no more options, which is useful when one needs to specify a filename that starts with a hyphen-minus. An option of just a hyphen-minus (followed by a space) may be recognized in lieu of a filename and indicates that stdin is to be read.

See also

Notes

    References

    1. Jukka K. Korpela (2006). Unicode explained. O'Reilly. p. 382. ISBN 978-0-596-10121-3.
    2. Fischer, Eric. "The Evolution of Character Codes, 1874-1968". CiteSeerX 10.1.1.96.678. Cite journal requires |journal= (help)
    3. "Hyphens, En Dashes, Em Dashes". The Chicago Manual of Style Online. Retrieved 25 January 2017.
    4. Ritchie, Dennis (c. 1975). "C Reference Manual" (PDF). Bell Labs. Retrieved 7 December 2016.
    5. Marlow, Simon (ed.). Haskell 2010 Language Report (PDF). Retrieved 7 December 2016.
    This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.