- From: Belov, Charles <Charles.Belov@sfmta.com>
- Date: Thu, 9 Sep 2010 13:40:41 -0700
- To: "www-style list" <www-style@w3.org>
- Cc: "fantasai" <fantasai.lists@inkedblade.net>, "Tab Atkins Jr." <jackalmage@gmail.com>, "Behdad Esfahbod" <behdad@behdad.org>
Tab Atkins Jr. wrote on Thursday, September 09, 2010 1:22 PM > On Thu, Sep 9, 2010 at 1:02 PM, Behdad Esfahbod > <behdad@behdad.org> wrote: > > On 09/08/10 20:52, fantasai wrote: > >> > On 09/08/2010 05:33 PM, Behdad Esfahbod wrote: > >>> >> On 09/08/10 19:51, fantasai wrote: > >>>> >>> > >>>> >>> - I agree with Charles about having a 'prefix' parameter in > >>>> >>> addition to 'suffix'; that seems useful. Not so > sure about > >>>> >>> the need for 'infix'. > >>> >> > >>> >> Infix would be useful with additive to do most > language-based numberings. > >>> >> Think of an infix of " and ". > >> > > >> > I'm failing to come up with the example you're thinking of. > >> > > >> > If you want to *write out* numbers, it gets complicated fast. > >> > But that's not really something one uses for list numbering. > > Yes, that's what I was thinking about. I thought that's what > > language-based numbering refers to? > > > > At any rate, such numbering is useful to have for section / chapter > > numbering as well as page numbering, maybe not for lists. > I know I've > > had to implement it in Persian LaTeX implementations more than once. > > You can do one form of written English as a plain additive list-type. > This omits the "and", but that's okay for many cases. > > @list written-english { > type: additive; > range: 1-199; > additive-glyphs: "one hundred " 100, "ninety " 90, "eighty > " 80, "seventy " 70, "sixty " 60, "fifty " 50, "fourty " 40, > "thirty " 30, "twenty " 20, "nineteen" 19, "eighteen" 18, > "seventeen" 17, "sixteen" > 16, "fifteen" 15, "fourteen" 14, "thirteen" 13, "twelve" 12, "eleven" > 11, "ten" 10, "nine" 9, "eight" 8, "seven" 7, "six" 6, "five" > 5, "four" 4, "three" 3, "two" 2, "one" 1; } > > For example, for the value 123, the algorithm will work as follows: > > 1. Walk the list to find the first item with a weight less > than or equal to the current value. This is the ("one > hundred" 100) value. > Append "one hundred" to the current marker string, and > subtract 100 from the current value. Current value is now 23. > > 2. Walk the list. Next value leq than 23 is ("twenty" 20). > Append "twenty ", decrement by 20. Current value is now 3. > > 3. Walk the list. Next value leq than 3 is ("three" 3). > Append "three", decrement by 3. Since the current value is > now 0, stop the algorithm. > > The final marker string is "one hundred twenty three". > > There are several additional features I could add that might > make this better, but I'd probably want to see some > written-number patterns in other languages to see if it's > worthwhile enough to do so. If a feature only allows a > single additional language to be written, it's not worth it. I'm assuming one of those additional features would allow me to get the hyphen into "one hundred twenty-three" without getting it into "one hundred twenty" or into "three". I can appreciate the robustness concern, but if someone using this scheme is going to be fussy, it's nice to have even a non-robust method available as a fallback. The only difference is between being able to do it easily and fully robustly and being able to do it with some extra work. And if these are at all useful, it will eventually be just a matter of copy-and-paste from someone else's work. So, my vote is that it's not worth it, unless, as you say, there are more use cases. Thank you, however, for the illustration of additive. This makes it much clearer for me. Hope this helps, Charles Belov SFMTA Webmaster
Received on Thursday, 9 September 2010 20:47:02 UTC