Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 25 November 2011, Hans Hagen [pra...@wxs.nl] wrote: > I uploaded a new beta. > ... > - Hz, dB (actually deci + bel so megabel also works), lx, permille, t, > k, Da added Actually decibel is an odd one, a logarithmic unit, so prefixes other than "deci" are never used. However the implementation is no problem. > - ad 2: no looking back (would demand an extra correction pass > elsewhere, maybe some day) Here I meant just space within the argument to \unit{}. It seems to be handled correctly now ... > - ad 8: manipulating the input this way is somewhat beyond the purpose > of a typesetting system (Normalisation of numbers and unit prefixes). OK, just seeing where the line was to be drawn. However, in the code a comment notes the possibility of automatic conversions to imperial units, which is a step even further, actually. Personally I don't think it's a good idea. [Or the b-grade movies]. > - ad 9: much will be configureable; see mkiv file for an example of > defining extra units (\registerunit [units] [point=pt, basepoint=bp]); Works, although > - I myself am not going to look in all kind of other tex stuff that lays > around as it's up to users/usage what is added, given that it fits into > the model of context; we have the old units modules as starting point That was a note to self, but any takers ... I attach a (much shorter) bunch of test cases (source and pdf again). Thanks, Robin units2.tex Description: units2.tex units2.pdf Description: units2.pdf ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
Am 25.11.2011 um 09:18 schrieb Hans Hagen: > On 24-11-2011 21:18, Pontus Lurcock wrote: >> On Thu 24 Nov 2011, Romain Diss wrote: >> >>> - again in french, the liter symbol is lowercase l (althought the >>> uppercase L is also temporarly accepted). >> >> Not only in French, but in most of Europe, I think: >> http://en.wikipedia.org/wiki/Litre#Symbol . Should probably be >> explicitly configurable. > > there is already some basic mechanism fro that > > \startluacode >languages.data.labels.units.foo = { >Liter = "l" >} >languages.data.labels.units.bar = { >Liter = "L" >} > \stopluacode > > \starttext > > \defineunits[lunit]\lunit{10 l/s}\par > \defineunits[funit][label=foo] \funit{10 l/s}\par > \defineunits[bunit][label=bar] \bunit{10 l/s}\par > > \stoptext Maybe better: \definelabelclass[unit] … \setupunittext[liter=l] Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 25-11-2011 10:29, Ian Lawrence wrote: Maybe it’s possible with MkIV to check if the text before the \unit command was a number but of the number is part of the unit them put in the command, such things are always tricky with TeX and it’s better to force users to use proper input. Within \type{phys-dim.lua} all the units and all the prefixes seem to have capitalised names; in fact, they should be all lowercase (even when they are named after some person). The exception is Celsius. I suggested a list to Hans some time ago, so more than one person has this opinion... The list is just an internal one. The reason for capatilzation is that in the old module we had \Bla \Foo etc an dI want to keep that property and it's easier to lowercase a string than to selectively uppercase it. Also, for some cases Capitalization gives more robust parsing as we can have collapsed units. Anyway, users can use lowercase so they can avoid it. I think this is a feature because Hans saves also a lowercase version of all keywords and you can use both as input. I wonder whether \tex{unit} should only parse and format units, and have another macro \tex{quan} or \tex{quantity} to handle number+unit combinations (obviously using \tex{digit} and \tex{unit}). I put my solution to this (expressing physical quantities) on the wiki a while ago…. First we need to get the parsing right, then we can look into other features and cultural issues. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
> > Maybe it’s possible with MkIV to check if the text before the \unit command > was > a number but of the number is part of the unit them put in the command, such > things are always tricky with TeX and it’s better to force users to use > proper input. > >Within \type{phys-dim.lua} all the units and all the prefixes seem to have >capitalised names; in fact, they should be all lowercase (even when they >are named after some person). The exception is Celsius. I suggested a list to Hans some time ago, so more than one person has this opinion... > > I think this is a feature because Hans saves also a lowercase version of all > keywords and you can use both as input. > >I wonder whether \tex{unit} should only parse and format units, and have >another macro \tex{quan} or \tex{quantity} to handle number+unit > combinations >(obviously using \tex{digit} and \tex{unit}). > I put my solution to this (expressing physical quantities) on the wiki a while ago…. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 24-11-2011 13:36, robin.kirk...@csiro.au wrote: On Monday, 21 November 2011 20:52, Hans Hagen wrote: Over the weekend I've discovered a couple more problems with \unit so I'll make up some test cases and desired output and post it in a few days. ok, I'll wait for that then Hans, all, I attach a document (source and PDF) with some \unit test cases that don't currently work (even with the most recent beta). It also has a number of suggestions for improvement. Some of this should be construed as personal opinion, but hopefully it isn't too controversial. I uploaded a new beta. - degrees fixed (special category as it can be standalone or in combination). - per fixed - Hz, dB (actually deci + bel so megabel also works), lx, permille, t, k, Da added - eV, m, \mu m, root added - ad 1: should normally work out ok - ad 2: no looking back (would demand an extra correction pass elsewhere, maybe some day) - ad 3: see remark WS - ad 4: see remark WS (also, the existing module was starting point) - ad 5: depends on what users want - ad 6: see remark WS - ad 7: the old modules had that, maybe this one will have it too; in that case we need a list of descriptions too (for different languages) for units that make sense to be mentioned in such a list - ad 8: manipulating the input this way is somewhat beyond the purpose of a typesetting system - ad 9: much will be configureable; see mkiv file for an example of defining extra units (\registerunit [units] [point=pt, basepoint=bp]); - I myself am not going to look in all kind of other tex stuff that lays around as it's up to users/usage what is added, given that it fits into the model of context; we have the old units modules as starting point - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 24-11-2011 21:18, Pontus Lurcock wrote: On Thu 24 Nov 2011, Romain Diss wrote: - again in french, the liter symbol is lowercase l (althought the uppercase L is also temporarly accepted). Not only in French, but in most of Europe, I think: http://en.wikipedia.org/wiki/Litre#Symbol . Should probably be explicitly configurable. there is already some basic mechanism fro that \startluacode languages.data.labels.units.foo = { Liter = "l" } languages.data.labels.units.bar = { Liter = "L" } \stopluacode \starttext \defineunits[lunit]\lunit{10 l/s}\par \defineunits[funit][label=foo] \funit{10 l/s}\par \defineunits[bunit][label=bar] \bunit{10 l/s}\par \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On Thu 24 Nov 2011, Romain Diss wrote: > - again in french, the liter symbol is lowercase l (althought the > uppercase L is also temporarly accepted). Not only in French, but in most of Europe, I think: http://en.wikipedia.org/wiki/Litre#Symbol . Should probably be explicitly configurable. Pont ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
Le jeudi 24 novembre 2011, robin.kirk...@csiro.au a écrit : > I attach a document (source and PDF) with some \unit test cases that don't > currently work (even with the most recent beta). It also has a number of > suggestions for improvement. Some of this should be construed as personal > opinion, but hopefully it isn't too controversial. As Wolfgang said, it's a nice summary and I agree with most of the suggestions. However. this points out some conventions which are specific to certain languages: - for example, in french, the percent symbol is preceded by a space. - again in french, the liter symbol is lowercase l (althought the uppercase L is also temporarly accepted). All the best. -- Romain Diss ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
Am 24.11.2011 um 13:36 schrieb : > On Monday, 21 November 2011 20:52, Hans Hagen wrote: > >>> Over the weekend I've discovered a couple more problems with \unit so I'll >>> make up some test cases and desired output and post it in a few days. >> >> ok, I'll wait for that then > > Hans, all, > > I attach a document (source and PDF) with some \unit test cases that don't > currently work > (even with the most recent beta). It also has a number of suggestions for > improvement. > Some of this should be construed as personal opinion, but hopefully it isn't > too controversial. Nice summary, you should write a My Way about units once this things are fixed. A few comments from me: \type{1234}\tex{unit}\arg{m} should print equivalently to \tex{unit}\arg{1234m} and \tex{unit}\arg{1234 m}. (I have a lot of text that uses a \tex{unit} macro like that.) Maybe it’s possible with MkIV to check if the text before the \unit command was a number but of the number is part of the unit them put in the command, such things are always tricky with TeX and it’s better to force users to use proper input. Within \type{phys-dim.lua} all the units and all the prefixes seem to have capitalised names; in fact, they should be all lowercase (even when they are named after some person). The exception is Celsius. I think this is a feature because Hans saves also a lowercase version of all keywords and you can use both as input. I wonder whether \tex{unit} should only parse and format units, and have another macro \tex{quan} or \tex{quantity} to handle number+unit combinations (obviously using \tex{digit} and \tex{unit}). Please don’t suggest this, one of the nice features is that you don’t have to care which command you need but it would be nice to drop the old formatting options for \digits in the \unit command. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 21-11-2011 02:00, Robin Kirkham wrote: Over the weekend I've discovered a couple more problems with \unit so I'll make up some test cases and desired output and post it in a few days. ok, I'll wait for that then - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 18/11/2011, at 10:00 PM, Pontus Lurcock wrote: > On Fri 18 Nov 2011, Hans Hagen wrote: >> so, best is that those asking for it come up with a list of issues: >> which symbols need this option, is it language related or whatever, >> so that i can do them all at once. We can already have different >> mapping sets so spacing could be part of that. > > I don't personally have a need for units in the foreseeable future (I > was just nitpicking with Robin about spacing) so feel free to ignore > any of my suggestions, but I think the summary so far would be: > > 1. Spacing for almost all SI units should be the same and doesn't > need special cases. > > 2. Geographical degrees/minutes/seconds should have no spaces. > > 3. Spacing for degrees temperature varies according to different style > guides -- both before and after the ° -- so ideally it would be > possible to set these independently of the rest of the units. > > For my own part I would add: > > 4. SI unit abbreviations are mostly capital letters, and look (to me) > strange with old-style figures. I have seen books which used > old-style figures for page numbers, years, etc. but switched to > lining figures when a unit was involved; this is also what I did > in my thesis. So I think it would be useful to allow an automatic > switch to lining figures to be configured when typesetting a unit. > > Pont I agree on points 1 and 2 (although it seems arcminute and arcsecond are not implemented anyway). Point 3, yes, but I'm dubious about space after ° for the temperature units °C or °F as it breaks the rule about unit ambiguity ("° C" is a degree-Coulomb -- although I can't image a physical situation that would need such a unit). Point 4 is a bit beyond the scope of the SI units scheme but sounds like a potential need. Over the weekend I've discovered a couple more problems with \unit so I'll make up some test cases and desired output and post it in a few days. Robin___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On Fri 18 Nov 2011, Hans Hagen wrote: > so, best is that those asking for it come up with a list of issues: > which symbols need this option, is it language related or whatever, > so that i can do them all at once. We can already have different > mapping sets so spacing could be part of that. I don't personally have a need for units in the foreseeable future (I was just nitpicking with Robin about spacing) so feel free to ignore any of my suggestions, but I think the summary so far would be: 1. Spacing for almost all SI units should be the same and doesn't need special cases. 2. Geographical degrees/minutes/seconds should have no spaces. 3. Spacing for degrees temperature varies according to different style guides -- both before and after the ° -- so ideally it would be possible to set these independently of the rest of the units. For my own part I would add: 4. SI unit abbreviations are mostly capital letters, and look (to me) strange with old-style figures. I have seen books which used old-style figures for page numbers, years, etc. but switched to lining figures when a unit was involved; this is also what I did in my thesis. So I think it would be useful to allow an automatic switch to lining figures to be configured when typesetting a unit. Pont ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 18-11-2011 04:31, Pontus Lurcock wrote: On Fri 18 Nov 2011, Robin Kirkham wrote: Conventions for setting the degrees of temperature symbol vary; see http://en.wikipedia.org/wiki/Degree_symbol#Typography and references therein. In most professionally published works that I've seen, there is no space between the number and the °, or between the ° and the C. I agree they vary, and no space before the °C is quite common (and frequently my own practice too). However in setting default behaviour for Context I am inclined to favour conforming to international standards, where they exist (but a \setupunits override it probably called for). I have no opinion as to what the default behaviour should be, but it would certainly be useful to have spacing for ° temperature configurable separately from that for other units. so, best is that those asking for it come up with a list of issues: which symbols need this option, is it language related or whatever, so that i can do them all at once. We can already have different mapping sets so spacing could be part of that. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On Fri 18 Nov 2011, Robin Kirkham wrote: > > Conventions for setting the degrees of temperature symbol vary; see > > http://en.wikipedia.org/wiki/Degree_symbol#Typography and references > > therein. In most professionally published works that I've seen, there > > is no space between the number and the °, or between the ° and the C. > > I agree they vary, and no space before the °C is quite common (and > frequently my own practice too). However in setting default > behaviour for Context I am inclined to favour conforming to > international standards, where they exist (but a \setupunits > override it probably called for). I have no opinion as to what the default behaviour should be, but it would certainly be useful to have spacing for ° temperature configurable separately from that for other units. Pont ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 18/11/2011, Pontus Lurcock wrote: >>> Degrees, minutes and seconds of arc (also degrees Celsius) are an >>> exception and are not supposed to have any space between the >>> digits and the degree symbol [1], so to be correct, I think >>> Context should by default veto any space between digits and >>> numbers, in these cases only. >> >> Correction, I should have written "(but not degrees Celsius)", >> apologies. > > Conventions for setting the degrees of temperature symbol vary; see > http://en.wikipedia.org/wiki/Degree_symbol#Typography and references > therein. In most professionally published works that I've seen, there > is no space between the number and the °, or between the ° and the C. Pont, I agree they vary, and no space before the °C is quite common (and frequently my own practice too). However in setting default behaviour for Context I am inclined to favour conforming to international standards, where they exist (but a \setupunits override it probably called for). Robin___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On Fri 18 Nov 2011, Robin Kirkham wrote: > > Degrees, minutes and seconds of arc (also degrees Celsius) are an > > exception and are not supposed to have any space between the > > digits and the degree symbol [1], so to be correct, I think > > Context should by default veto any space between digits and > > numbers, in these cases only. > > Correction, I should have written "(but not degrees Celsius)", > apologies. Conventions for setting the degrees of temperature symbol vary; see http://en.wikipedia.org/wiki/Degree_symbol#Typography and references therein. In most professionally published works that I've seen, there is no space between the number and the °, or between the ° and the C. Pont ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
On 18/11/2011, at 1:05 PM, I wrote: > Degrees, minutes and seconds of arc (also degrees Celsius) are an exception > and are not supposed to have any space between the digits and the degree > symbol [1], so to be correct, I think Context should by default veto any > space between digits and numbers, in these cases only. Correction, I should have written "(but not degrees Celsius)", apologies. Robin ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
Dear Hans, Many thanks for implementing space=small in \setupunits. It works nicely for me. However in the latest beta, Hertz is typeset as hz not Hz. It looks like the problem is line 154 of phys-dim.lua (it was typeset correctly a couple of days ago). Also the symbol for lux (line 198) should be lx [2]. Degrees, minutes and seconds of arc (also degrees Celsius) are an exception and are not supposed to have any space between the digits and the degree symbol [1], so to be correct, I think Context should by default veto any space between digits and numbers, in these cases only. BTW, NIST has a handy reference for anyone typesetting physical quantities [1], although the BIPM documentation is the canonical reference. Robin \starttext \unit{1 Hz} (should be Hz)\par \unit{180 deg} (should be no space)\par \stoptext [1] http://www.bipm.org/en/si/si_brochure/chapter5/5-3-2.html [2] http://physics.nist.gov/cuu/Units/ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___