Search code examples
unicodenumbersglyph

Are there Unicode Symbols for unary numerals (|, ||, ... , |̶|̶|̶|̶)?


I searched the unicode names for occurrences of "FOUR" and "FIVE" but didn't find anything. Nothing also when googling "unicode unary numbers".

Does anyone know unicode symbols for these?


Solution

  • Rods

    For characters with multiple strokes in one, you can use counting rod numerals (U+1D360 through U+1D371) and Roman numerals (U+2160 through U+2186).

    Unicode   Surrogate Pair  UTF-8         Description                     Sample
    ———————   ——————————————  —————         ———————————                     ——————
    U+1D360   U+D834 U+DF60   F0 9D 8D A0   COUNTING ROD UNIT DIGIT ONE     𝍠
    U+1D361   U+D834 U+DF61   F0 9D 8D A1   COUNTING ROD UNIT DIGIT TWO     𝍡
    U+1D362   U+D834 U+DF62   F0 9D 8D A2   COUNTING ROD UNIT DIGIT THREE   𝍢
    .......   ...... ......   .. .. .. ..   ........ ... .... ..... .....   .
    U+1D371   U+D834 U+DF71   F0 9D 8D B1   COUNTING ROD TENS DIGIT NINE    𝍱
    

    Unicode  UTF-8      Description                      Sample
    ———————  —————      ———————————                      ——————
    U+2160   E2 85 A0   ROMAN NUMERAL ONE                Ⅰ
    U+2161   E2 85 A1   ROMAN NUMERAL TWO                Ⅱ
    U+2162   E2 85 A2   ROMAN NUMERAL THREE              Ⅲ
    ......   .. .. ..   ..... ....... .....              .
    U+2186   E2 86 86   ROMAN NUMERAL FIFTY EARLY FORM   ↆ
    

    Slashes

    You can use a combining mark to place a slash through any multi-stroke character. They should work with the counting rods and Roman numerals, but as with all fancy Unicode, browser and OS support may vary.

    Unicode  UTF-8      Description                             Sample
    ———————  —————      ———————————                             ——————
    U+0335   CC B5      COMBINING SHORT STROKE OVERLAY          ̵
    U+0336   CC B6      COMBINING LONG STROKE OVERLAY           ̶
    U+0337   CC B7      COMBINING SHORT SOLIDUS OVERLAY         ̷
    U+0338   CC B8      COMBINING LONG SOLIDUS OVERLAY          ̸
    U+20D2   E2 83 92   COMBINING LONG VERTICAL LINE OVERLAY    ⃒ 
    U+20D3   E2 83 93   COMBINING SHORT VERTICAL LINE OVERLAY   ⃓
    

    Here are the counting rods with the various combining stroke marks. They may or may not render in your browser. For me, only COMBINING LONG SOLIDUS OVERLAY seems to work well, even though they all display (Firefox 47 Mac).

    𝍠 𝍡 𝍢 𝍣 𝍣̵
    𝍠 𝍡 𝍢 𝍣 𝍣̶
    𝍠 𝍡 𝍢 𝍣 𝍣̷
    𝍠 𝍡 𝍢 𝍣 𝍣̸
    𝍩 𝍪 𝍫 𝍬 𝍬⃒
    𝍩 𝍪 𝍫 𝍬 𝍬⃓
    𝍩 𝍪 𝍫 𝍬 𝍬̷
    𝍩 𝍪 𝍫 𝍬 𝍬̸

    Unfortunately, combining marks aren't always an option depending on the application. And many fonts lack them, though the OS will usually try to use whichever font has an otherwise missing Unicode character. Arial Unicode MS, Courier, Courier New, Geneva, Helvetica, Helvetica Neue, Tahoma, and Times New Roman are good bets for finding natively-included oddball glyphs like this.

    Tick Marks in HTML

    Here's a quick hack to get tick marks in pure HTML and CSS.

    <style>
    x-1::before, x-2::before, x-3::before, x-4::before, x-5::before {
        letter-spacing: 0.1pt; margin: 0.25em;
    }
    x-1::before { content: "|"; }
    x-2::before { content: "||"; }
    x-3::before { content: "|||"; }
    x-4::before { content: "||||"; }
    x-5::before { content: "|||||"; }
    x-5::after  { content: "╱"; margin-left: -1.5em; }
    </style>
    <x-1/><x-2/><x-3/><x-4/><x-5/>
    

    https://jsfiddle.net/b7z1mLj4/

    Unary versus Quintary

    As a side note, Unary numbers by definition have only one numeral, which is traditionally a vertical line. If you use single characters to represent the numbers 1 𝍠, 2 𝍡, 3 𝍢, 4 𝍣, and 5 𝍤, then what you have is a quintary (base-5) numeral system. Four-with-slash is not really a unary digit, but just a convenience for readability. It's akin to a space or comma when writing decimal numbers like 1,000,000.

    That said, Unicode does have the comma symbol (and other flourishes), so you raise a great point over why there's no four-with-slash character. Especially since they have the counting rods.