Hacker News new | past | comments | ask | show | jobs | submit login

Tabular numerals are such a valuable feature. It's a bummer they're not more prevalent.



I like tabular numerals. But you really need a small set of other glyphs to be tabular to really make them work. In particular, you need the plus and minus signs to be the same width, so that in a table like:

  gold +1.2%
  oil  -6.4%
  corn +5.2%
everything lines up and looks nice. At the moment, with CSS, there's no way to make that happen, and in normal typefaces the hyphen-minus is too narrow. You can replace the minus signs with a wider dash, but that is semantically wrong and also a pain in the arse.

It occurs to me that contextual alternates could make this Just Work. I haven't used any typefaces expensive enough to do that though!


> the hyphen-minus is too narrow. You can replace the minus signs with a wider dash, but that is semantically wrong and also a pain in the arse.

In this case, an alternative to "-", U+002D HYPHEN-MINUS, is "−", U+2212 MINUS SIGN. On Linux, I considered mapping the keypad substract key to it, but instead I configured a xcompose alias.

  gold +1.2%
  oil  −6.4%
  corn +5.2%


It vexes me that almost no one uses the real minus sign. But you also can't blame them since it's never been made readily-available. So you really have to be pedantic and spend time going to get it if you want to use it.


Most people aren't even aware there's a "real" (or rather, fake) minus sign. I didn't know until reading this thread. The hyphen is right next to the +/= key, so it's not unreasonable at all to think the _/- key is minus.


That's hyphen-minus, which is both a hyphen AND a minus:

https://en.wikipedia.org/wiki/Hyphen-minus


Yeah I had no idea either, but I'm sorry to say it's going in the same bucket as using a real em-dash vs a double hypen--if it's not on my keyboard it's not gonna happen.


Mac OS has option+- for en dash and option+shift+- for em dash. I used to add similar bindings on Windows via AutoHotkey (which is an amazing app all around...)

There's also option+space for   and other goodies. I recently added option+x for "checkmark x" and option+v for "checkmark v" since I like dropping those around more often than I should...


This. Em dashes are—as punctuation goes—downright sexy, so I committed shift+opt+- to muscle memory long ago. And it's arguably less work than a bucked-toothed double hyphen.

Btw, if you haven't already, check out Karabiner on macOS for AutoHotkey-esque functionality.


Re “configured”—what's your locale? In en_US.UTF-8 on my Arch system it's in the system file (/usr/share/X11/locale/en_US.UTF-8/Compose) as <Multi_key> <minus> <underscore>.


Back in the days of HTML 4.01 there was the idea of an align attribute where possible numerical data could auto-align on a specified character:

  <td align="char" char=".">€ 1.20</td>
https://www.w3.org/TR/html401/struct/tables.html#h-11.3.2

HTML 4 was still in this weird in-between time where there were styling attributes in HTML coexisting with the upcoming CSS. Afair no browser ever implemented character alignment and in Google’s HTML it is only written up as obsolete:

https://html.spec.whatwg.org/multipage/obsolete.html#dom-tab...

Styling in general is of course a CSS thing – but thinking about it arranging alignment in multiple interdependent elements is a problem which not just need a property but a layout algorithm which browsers then need to implement. So we still don’t have nice things.

> It occurs to me that contextual alternates could make this Just Work.

The replacement mechanism in OpenType fonts is surprisingly useful. I remember Apple’s San Francisco font switches between different variants of the colon if it follows text characters ("my proposal: nuke it from the orbit") or if it exists between numbers as in a time ("23:52"); in the latter it is more centered.


I hear you. Back when I was in Investment Banking, I was guilty of replacing hyphens with en dashes in all sorts of labels to make them line up properly in a table... It wasn't perfect, but it was a decent improvement

Generally, numbers were right-aligned in cells, so the % at the end was consistent (when present) and the plus/minus before the numbers didn't make a difference because of the alignment. But labels on the left like in some P&L or Cash Flow statement were always annoying


It's an improvement until someone wants to copy and paste a negative number, then suddenly the closest heavy object to the user is travelling rapidly towards your head.


I suppose one way to make it work in CSS would be to split the numbers on the decimal points, and align the parts as necessary. Though there's no way to get around the <td>/<span> soup, unfortunately.


The easiest solution is to make a custom font with all the glyphs you want to be tabularized given the same advance width. Then you aren't subject to the vagaries of getting advanced font rendering to work.


>you need the plus and minus signs to be the same width

I've never thought about it, but that is somewhat annoying that the math symbols aren't a consistent width with each other.


chuckle

Now throw in inline vs block equations into the mix.


Any font without tabular numbers is buggy, because it can't support U+2007 FIGURE SPACE &numsp;


Also U+2012 FIGURE DASH (for things like phone numbers), and probably U+2212 MINUS SIGN (aligned with plus). Everyone usually defaults to hyphen-minus though, and all bets are off.


Pretty sure most browsers render <ol><li> with tabular nums if available.


Bookman Old Style (my favorite font) seems to do this.


Tabular numerals are very useful in certain cases, but I find even more useful the old-style numerals.

By default, I always use old-style numerals, because they are much easier to read, especially for big numbers, for the same reason why the lowercase letters are easier to read, by having ascenders and descenders that break the uniformity of the characters.

I use lining numerals only in the same places where I would use uppercase letters, e.g. in titles or when a sentence begins with a number.


>I find even more useful the old-style numerals

A font of antiquated faſhion doth boaſt moſt excellent and ſubſtantious qualities, yet prithee, what of olde ſtyle figures doſt thou deem hath benefit that I, in mine own diſcretion, might chooſeth?


Set thy eyes on this excellent Font, for Inſtance: https://en.m.wikipedia.org/wiki/Georgia_(typeface)#/media/Fi...

As can be moſt clearly ſeen, the Numerals are not of equale Height, but poſſeſs Deſcendants, like the 4, and Aſcendants, like the 6.

Shouldſt thou deſire to embelliſh thy Layout with ſuch a Rendition of Numerals, thou canst: https://developer.mozilla.org/en-US/docs/Web/CSS/font-varian...

This Feature requireth though that the Font ſo employed containéd the proper Variants of the numeral Glyphs. Many a diſtinguished Font do.

(Pray note that the -th Ending of Verbs is for Singular Third Perſon Form, not to be uſed with "thou". I do, thou dost, he doth.)


You must be Welsh!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: