[NTG-context] Re: \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected

2023-12-05 Thread Marco Patzer
On Tue, 5 Dec 2023 20:06:46 +0100
Wolfgang Schuster  wrote:

> > That doesn't make sense, inch and mm are different units. I'd rather
> > add:
> >
> >\registerunit
> >  [inHg=inchmercury]
> >
> >\setupunittext
> >  [en]
> >  [inchmercury=inHg]  
> 
> It's just a stupid example to show how to set the label value.

Ok, got it. Thanks for your quick help, as usual!

Marco
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected

2023-12-05 Thread Wolfgang Schuster

Marco Patzer schrieb am 05.12.2023 um 19:58:

\setupunittext[en][millimetermercury=inHg]
That doesn't make sense, inch and mm are different units. I'd rather
add:

   \registerunit
 [inHg=inchmercury]

   \setupunittext
 [en]
 [inchmercury=inHg]


It's just a stupid example to show how to set the label value.

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected

2023-12-05 Thread Marco Patzer
On Tue, 5 Dec 2023 17:27:59 +0100
Wolfgang Schuster  wrote:

> None of your examples work because millimetermercury and mercury are
> the names for the labels
> and the units are accessed with hg and mmhg.

Ok, that makes sense. And it works, thanks for the explanation and
the quick reply.

> \setupunittext[en][millimetermercury=inHg]

That doesn't make sense, inch and mm are different units. I'd rather
add:

  \registerunit
[inHg=inchmercury]

  \setupunittext
[en]
[inchmercury=inHg]

Marco
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected

2023-12-05 Thread Wolfgang Schuster

Marco Patzer schrieb am 05.12.2023 um 15:19:

Hi!

I'm struggling with the rendering of a particular liquid metal:

   %% renders as m (meter), not as Hg
   \unit{mercury}

   %% renders as mm·m, not as mmHg
   \unit{millimetermercury}

This is strange, since both “mercury” and “millimetermercury” are
defined in phys-dim.lua. To get mercury recognised as a unit this
can be used:

   \registerunitshortcut [mercury=mercury]

Now \unit{mercury} renders correctly as Hg.

Why is that \registerunitshortcut necessary? Is it even correct to
use it like this? However, even then millimetermercury doesn't
render correctly:

   %% renders as mm·Hg, not as mmHg
   \unit{millimetermercury}

How to get millimetermercury render as mmHg? And “inch mercury”
render as inHg? I can't find “inchmercury” in phys-dim.lua, only
“millimetermercury”, should it be added?

Example:

%% \enabletrackers [physics.units]

%% inch should render as “in”
%% \setupunittext [inch=in]

\starttext
   \unit{mercury}\crlf  %% renders: mm · m

   \unit{12 millimetermercury}\crlf  %% renders: mm · m
   \unit{12 inchmercury}\crlf%% renders: in · m

   %% why is this necessary to get mercury rendered as Hg?
   \registerunitshortcut [mercury=mercury]

   \unit{12 millimetermercury}\crlf  %% renders: mm · Hg
   \unit{12 inch mercury}\crlf   %% renders: in · Hg
\stoptext

Questions:

1) Why is \unit{mercury} not working, although it's listed in
phys-dim.lua?
2) Is the call \registerunitshortcut [mercury=mercury]
necessary/correct?
3) How to make \unit{millimetermercury} render as mmHg and
\unit{inch mercury} render as inHg?


None of your examples work because millimetermercury and mercury are the 
names for the labels

and the units are accessed with hg and mmhg.

\setupunittext[en][millimetermercury=inHg]

\starttext

\unit{mmhg}

\stoptext

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] \unit{mercury} renders as m (meter) and \unit{millimetermercury} doesn't work as expected

2023-12-05 Thread Marco Patzer
Hi!

I'm struggling with the rendering of a particular liquid metal:

  %% renders as m (meter), not as Hg
  \unit{mercury}

  %% renders as mm·m, not as mmHg
  \unit{millimetermercury}

This is strange, since both “mercury” and “millimetermercury” are
defined in phys-dim.lua. To get mercury recognised as a unit this
can be used:

  \registerunitshortcut [mercury=mercury]

Now \unit{mercury} renders correctly as Hg.

Why is that \registerunitshortcut necessary? Is it even correct to
use it like this? However, even then millimetermercury doesn't
render correctly:

  %% renders as mm·Hg, not as mmHg
  \unit{millimetermercury}

How to get millimetermercury render as mmHg? And “inch mercury”
render as inHg? I can't find “inchmercury” in phys-dim.lua, only
“millimetermercury”, should it be added?

Example:

%% \enabletrackers [physics.units]

%% inch should render as “in”
%% \setupunittext [inch=in]

\starttext
  \unit{mercury}\crlf  %% renders: mm · m

  \unit{12 millimetermercury}\crlf  %% renders: mm · m
  \unit{12 inchmercury}\crlf%% renders: in · m

  %% why is this necessary to get mercury rendered as Hg?
  \registerunitshortcut [mercury=mercury]

  \unit{12 millimetermercury}\crlf  %% renders: mm · Hg
  \unit{12 inch mercury}\crlf   %% renders: in · Hg
\stoptext

Questions:

1) Why is \unit{mercury} not working, although it's listed in
   phys-dim.lua?
2) Is the call \registerunitshortcut [mercury=mercury]
   necessary/correct?
3) How to make \unit{millimetermercury} render as mmHg and
   \unit{inch mercury} render as inHg?

Marco
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Using Farad with \unit messes up feet, µ not recognised as prefix

2023-10-03 Thread Marco Patzer
On Tue, 3 Oct 2023 16:27:22 +0200
Marco Patzer  wrote:

> What about:
> 
> \unit{10 um}
> \unit{10 µm}
> 
> Can I assign µ to mean micro (prefix)?

Found it:

\registerunit [prefix] [µ=micro]

\starttext
  \unit{10 micro meter} \crlf
  \unit{10 µm}
\stoptext

Should this be the default (µ assigned to micro)?

Marco
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Using Farad with \unit messes up feet, µ not recognised as prefix

2023-10-03 Thread Marco Patzer
On Tue, 3 Oct 2023 15:42:57 +0200
Wolfgang Schuster  wrote:

> Marco Patzer schrieb am 03.10.2023 um 12:31:
> > Hi!
> >
> > I struggle using the unit Farad (unit of capacitance):  
> 
> The unit "farad" exists.

You're right \unit{10 Farad} works.

> The unit for feet is "foot" and "ft" is a combination of a prefix 
> (femto) and a unit (tonne).

Makes sense if you think about it. Never crossed my mind that ft not
meaning feet in this instance and also never contemplated the
existence of a “femto tonne”.

> You can list the individual parts in the log file with the 
> "physics.units" tracker.

That gives some insight, indeed. Thanks.

What about:

\unit{10 um}
\unit{10 µm}

Can I assign µ to mean micro (prefix)?

Marco
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Re: Using Farad with \unit messes up feet, µ not recognised as prefix

2023-10-03 Thread Wolfgang Schuster

Marco Patzer schrieb am 03.10.2023 um 12:31:

Hi!

I struggle using the unit Farad (unit of capacitance):


The unit "farad" exists.


\starttext

%% prints 10 10 ft
\unit{10 F}
\unit{20 ft}

\registerunit  [F=Farad]
\setupunittext [Farad=F]

%% prints 10 F 20 F⋅t
\unit{10 F}
\unit{20 ft}

\stoptext

When registering Farad as new unit it messes up feet. This looks
like a bug to me, since “20 ft” does not contain a capital “F” and
units are case-sensitive. How to use Farad correctly without messing
up other units?


The unit for feet is "foot" and "ft" is a combination of a prefix 
(femto) and a unit (tonne).


You can list the individual parts in the log file with the 
"physics.units" tracker.


To get a short unit you have to use the following method (it works 
because farad exists):


    \registerunitshortcut [F=farad]

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

[NTG-context] Using Farad with \unit messes up feet, µ not recognised as prefix

2023-10-03 Thread Marco Patzer
Hi!

I struggle using the unit Farad (unit of capacitance):

\starttext

%% prints 10 10 ft
\unit{10 F}
\unit{20 ft}

\registerunit  [F=Farad]
\setupunittext [Farad=F]

%% prints 10 F 20 F⋅t
\unit{10 F}
\unit{20 ft}

\stoptext

When registering Farad as new unit it messes up feet. This looks
like a bug to me, since “20 ft” does not contain a capital “F” and
units are case-sensitive. How to use Farad correctly without messing
up other units?

2nd issue: The prefix “µ” is not recognised:

\starttext
%% prints 10 nm 20 30 µm
\unit{10 nm}
\unit{20 µm}
\unit{30 um}
\stoptext

I would expect “20 µm” to produce the correct result. Can we make
“µm” also produce the same result as “um”?

Marco

LMTX 2023.09.04 19:15
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___

Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
On Mar 14, 2023, at 3:32 PM, Hans Hagen via ntg-context  
wrote:
> On 3/14/2023 7:14 PM, Alan Braslau via ntg-context wrote:
>> On Tue, 14 Mar 2023 12:03:23 -0600
>> Gavin  wrote:
>>> I’d really like one of the acceptable forms to be the form prescribed
>>> by Le Système international d'unités
> 
> Maybe the french title is one of the reasons for the USA not picking up on 
> these units? (So let me threaten once again to kick the "in" unit out of 
> context.)
> 
>> I believe that this point is essential,….

Alan and I will come up with a scheme that fastidiously follows the SI, and 
release it as a “North American localization.” That should leave everyone 
sufficiently puzzled, annoyed, or amused.

Signing off of this subject until 27 May. Thanks for all your help!

Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/14/2023 7:14 PM, Alan Braslau via ntg-context wrote:

On Tue, 14 Mar 2023 12:03:23 -0600
Gavin  wrote:


I’d really like one of the acceptable forms to be the form prescribed
by Le Système international d'unités


Maybe the french title is one of the reasons for the USA not picking up 
on these units? (So let me threaten once again to kick the "in" unit out 
of context.)



I believe that this point is essential, regardless of history of use of
the \unit{} command. Non-standard use of units can be *tolerated* as
long as they do not conflict with the SI and do not impose non-standard
syntax.

Alan

P.S. It is our guarded secret that the weather is nice here in
Colorado. I do not know of any other place that has real seasons AND
where it is (almost) always sunny! :-)
Here it fluctuates from zero to 15 (and behind the single pane glass in 
the office room with sun on it then 18 or more). Now of course, given 
units, you have to guess how much that is becuase you're with your 
French foot in Celsius, and the English one in Farhenheit and with both 
feet in Kelvin (for your book).


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/14/2023 7:03 PM, Gavin via ntg-context wrote:


I’d like to better understand how the \unit{} command works and why those 
choices were made. Some of the choices seem to be “asking for troubles,” but 
perhaps they are essential for some users.


I wonder if Alan was using context when the first unit module showed up 
in (what wasn't even call;ed mkii) because it is one of the oldest 
context modules and we use(d) for typesetting education related 
documents. Among the reasons for it was that in the pre-unicode times 
one had to compromise on a math / text mixture due to the way fonts and 
input was handled.



I’m happy to have the unit command accept a variety of different forms for the 
unit, but I’d really like one of the acceptable forms to be the form prescribed 
by Le Système international d'unités, so that “m s” is a meter second and “ms” 
is a millisecond. However, I’m not sure if this goal conflicts with other 
important goals.

Would you like to explore \unit{} this summer to see if we can find a 
consistent solution? Perhaps we can produce a plan for \unit{} that does not 
conflict with other \unit{} features, or perhaps we can make a module that 
lacks some of the features of \unit{} but conforms to the SI for input as well 
as output. I would be happy with either.


In principle one can think of different schemes (for different purposes 
even), after all everything is in tables; that is probably easier than 
tring to come up with some complex compromise. There can be instances of 
unit with different properties.


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Alan Braslau via ntg-context
On Tue, 14 Mar 2023 12:03:23 -0600
Gavin  wrote:

> I’d really like one of the acceptable forms to be the form prescribed
> by Le Système international d'unités

I believe that this point is essential, regardless of history of use of
the \unit{} command. Non-standard use of units can be *tolerated* as
long as they do not conflict with the SI and do not impose non-standard
syntax.

Alan

P.S. It is our guarded secret that the weather is nice here in
Colorado. I do not know of any other place that has real seasons AND
where it is (almost) always sunny! :-)
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
On Mar 14, 2023, at 10:08 AM, Alan Braslau via ntg-context  
wrote:
> Right now, \unit{1 mm-1} and \unit{1 m m-1} give the same result:
> inverse millimeters (whereas the second should be m•m^{-1}…)
> 
> Alan

Alan,

I’d like to better understand how the \unit{} command works and why those 
choices were made. Some of the choices seem to be “asking for troubles,” but 
perhaps they are essential for some users.

I’m happy to have the unit command accept a variety of different forms for the 
unit, but I’d really like one of the acceptable forms to be the form prescribed 
by Le Système international d'unités, so that “m s” is a meter second and “ms” 
is a millisecond. However, I’m not sure if this goal conflicts with other 
important goals.

Would you like to explore \unit{} this summer to see if we can find a 
consistent solution? Perhaps we can produce a plan for \unit{} that does not 
conflict with other \unit{} features, or perhaps we can make a module that 
lacks some of the features of \unit{} but conforms to the SI for input as well 
as output. I would be happy with either.

I’d also like to work on the luagraph module this summer. I’m getting a lot 
better at MetaPost programming!

I can’t approach either issue in a comprehensive way until the summer, because 
I have a lot of content to produce for our physics class. This year we kept on 
schedule – for the first time ever! – and that means we will be studying a 
couple of topics that I haven’t prepared yet. 

Obviously, anyone else interested in \unit{} or luagraph would be welcome to 
join us, either remotely or here in sunny Fort Collins, Colorado. (School ends 
here on May 26.)

Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/14/2023 5:33 PM, Gavin via ntg-context wrote:


Hi Alan, Hans, and List,


On Mar 13, 2023, at 8:10 PM, Alan Braslau via ntg-context  
wrote:
On Mon, 13 Mar 2023 15:55:50 -0600 Gavin via ntg-context  
wrote:

you can look at phys-dim and see plenty of short and long keys and
making all case insensitive is asking for troubles


Indeed, I would like to make NONE of them case insensitive. But
currently, when I register an upper case key (C=coulomb) it messes up
the lower case prefix (“cm" gets typeset as C•m). I was expecting the
parser to distinguish between the “C” and “c”, but it doesn’t. Is
that intended?


Indeed, \unit{} should allow (and presently does not) K, C, etc.


I agree. I added the following lines to phys-dim.lua, following line 461

 C  = "coulomb",
 K  = "kelvin",
 N  = "newton",

This provided the desired capital shortcuts without compromising the lowercase 
prefixes. Hans, could we get those added to phys-dim.lua in the distribution? I 
would be happy to do a more comprehensive search for shortcuts to add, but 
those are the three I and my collaborators are using now.


maybe, when there are no conflicts


Looking at why my \registerunit attempt failed, I found that when you register 
a unit, both your capitalization, and an all lowercase version are registered. 
Here is an example, where I register “ReTeM” but \unit{1 retem} also works.

\starttext

\registerunit[unit][ReTeM=myunit]
\setupunittext[myunit=reTeM]

\startformula
   \unit{1 ReTeM} = \unit{1 retem} \neq \unit{1 reteM}
\stopformula

\stoptext

The results are case sensitive, so \unit{1 reteM} does not work. The lowercase 
version is produced for all “long” units, but not for shortcuts. (See phys-dim.lua, 
lines 766-771 where the Lua string function “lower” is used.) Perhaps we could use a 
\registershortcut command that does not get the “lower" treatment. I will look 
into it some more.


see previous mail, i already added that but no upload yet


P.S. I think there is a spelling error in phys-dim.lua, lines 974-981.

local mapping = {
 prefix   = "prefixes",
 unit = "units",
 operator = "operators",
 suffixe  = "suffixes",
 symbol   = "symbols",
 packaged = "packaged",
}

The key “suffixe” should probably be “suffix”.

indeed, i noticed that when extending

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context
I wrote 

> Perhaps we could use a \registershortcut command that does not get the 
> “lower" treatment.

without seeing that Hans had already read my mind and provided:

\registerunitshortcut
[unit]
[C=coulomb]

That should work great.

Thanks!
Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Gavin via ntg-context

Hi Alan, Hans, and List,

> On Mar 13, 2023, at 8:10 PM, Alan Braslau via ntg-context 
>  wrote:
> On Mon, 13 Mar 2023 15:55:50 -0600 Gavin via ntg-context  
> wrote:
>>> you can look at phys-dim and see plenty of short and long keys and
>>> making all case insensitive is asking for troubles  
>> 
>> Indeed, I would like to make NONE of them case insensitive. But
>> currently, when I register an upper case key (C=coulomb) it messes up
>> the lower case prefix (“cm" gets typeset as C•m). I was expecting the
>> parser to distinguish between the “C” and “c”, but it doesn’t. Is
>> that intended?
> 
> Indeed, \unit{} should allow (and presently does not) K, C, etc.

I agree. I added the following lines to phys-dim.lua, following line 461

C  = "coulomb",
K  = "kelvin",
N  = "newton",

This provided the desired capital shortcuts without compromising the lowercase 
prefixes. Hans, could we get those added to phys-dim.lua in the distribution? I 
would be happy to do a more comprehensive search for shortcuts to add, but 
those are the three I and my collaborators are using now.

Looking at why my \registerunit attempt failed, I found that when you register 
a unit, both your capitalization, and an all lowercase version are registered. 
Here is an example, where I register “ReTeM” but \unit{1 retem} also works.

\starttext

\registerunit[unit][ReTeM=myunit]
\setupunittext[myunit=reTeM]

\startformula
  \unit{1 ReTeM} = \unit{1 retem} \neq \unit{1 reteM}
\stopformula

\stoptext

The results are case sensitive, so \unit{1 reteM} does not work. The lowercase 
version is produced for all “long” units, but not for shortcuts. (See 
phys-dim.lua, lines 766-771 where the Lua string function “lower” is used.) 
Perhaps we could use a \registershortcut command that does not get the “lower" 
treatment. I will look into it some more.

Thanks!
Gavin


P.S. I think there is a spelling error in phys-dim.lua, lines 974-981.

local mapping = {
prefix   = "prefixes",
unit = "units",
operator = "operators",
suffixe  = "suffixes",
symbol   = "symbols",
packaged = "packaged",
}

The key “suffixe” should probably be “suffix”.

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Alan Braslau via ntg-context
On Tue, 14 Mar 2023 15:36:37 +0100
Hans Hagen via ntg-context  wrote:

> > Indeed, I would like to make NONE of them case insensitive. But
> > currently, when I register an upper case key (C=coulomb) it messes
> > up the lower case prefix (“cm" gets typeset as C•m). I was
> > expecting the parser to distinguish between the “C” and “c”, but it
> > doesn’t. Is that intended?  
> I added an option and an extra registers but it's up to you to decide 
> hwo to use it (and how to deal with conflicts in definitions).

There should not be conflicts, for, formally,
c should be 1/100
C should be Coulomb

k should be 1000
K should be Kelvin

n should be 10^{-9}
N should be Newton

m should be meter
M should be 10^6
(but m also means 10^{-3})

etc.

The problems arise as \unit{} presently accepts

Kelvin and kelvin
Newton and newton
Coulomb and coulomb
Watt and watt
etc.

also, mm could be millimeters, or it could be m•m (m^2).

Right now, \unit{1 mm-1} and \unit{1 m m-1} give the same result:
inverse millimeters (whereas the second should be m•m^{-1}, also known
as radians! ;-)

I suggest that it be limited to formal (and well-defined) unit names,
respecting casing.

I also suggest that unrecognized units either give an error message in
stdout and in the log file and show up in the output (as {\tt } to
be coherent with other subsystems), rather than to be simply ignored.

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-14 Thread Hans Hagen via ntg-context

On 3/13/2023 10:55 PM, Gavin wrote:




On Mar 13, 2023, at 3:44 PM, Hans Hagen via ntg-context  
wrote:

On 3/9/2023 2:04 PM, Gavin via ntg-context wrote:

\startformula
   \unit{3 meter} \qquad
   \unit{6 Meter} \qquad
   \unit{3 mEtEr} \qquad
\stopformula
Units with lowercase prefixes (c, k, n).
\startformula
   \unit{3cm} \qquad
   \unit{6kg} \qquad
   \unit{3ns} \qquad
\stopformula
Units with capital letters, called with names (coulomb, kelvin, newton).
\startformula
   \unit{3 coulomb} \qquad
   \unit{6 kelvin} \qquad
   \unit{3 newton} \qquad
\stopformula


you can look at phys-dim and see plenty of short and long keys and making all 
case insensitive is asking for troubles


Indeed, I would like to make NONE of them case insensitive. But currently, when I 
register an upper case key (C=coulomb) it messes up the lower case prefix (“cm" 
gets typeset as C•m). I was expecting the parser to distinguish between the “C” and 
“c”, but it doesn’t. Is that intended?
I added an option and an extra registers but it's up to you to decide 
hwo to use it (and how to deal with conflicts in definitions).


\registerunit
  [unit]
  [Point=PT,
   point=pt,
   Basepoint=BP,
 % basepoint=bp,
   ]

\registerunitshortcut
  [unit]
  [C=coulomb]

\startlines
10 \unit {square meter per second}
10 \unit {square Meter per Second}
10 \unit {point}
10 \unit {Point}
10 \unit {basepoint}
10 \unit {Basepoint}
10 \unit {C}
\stoplines

\setupunit[unit][option=keep]

\startlines
10 \unit {square meter per second}
10 \unit {square Meter per Second}
10 \unit {point}
10 \unit {Point}
10 \unit {basepoint}
10 \unit {Basepoint}
10 \unit {C}
\stoplines


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-13 Thread Alan Braslau via ntg-context
On Mon, 13 Mar 2023 15:55:50 -0600
Gavin via ntg-context  wrote:

> > you can look at phys-dim and see plenty of short and long keys and
> > making all case insensitive is asking for troubles  
> 
> Indeed, I would like to make NONE of them case insensitive. But
> currently, when I register an upper case key (C=coulomb) it messes up
> the lower case prefix (“cm" gets typeset as C•m). I was expecting the
> parser to distinguish between the “C” and “c”, but it doesn’t. Is
> that intended?

Indeed, \unit{} should allow (and presently does not) K, C, etc.

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-13 Thread Gavin via ntg-context


> On Mar 13, 2023, at 3:44 PM, Hans Hagen via ntg-context  
> wrote:
> 
> On 3/9/2023 2:04 PM, Gavin via ntg-context wrote:
>> \startformula
>>   \unit{3 meter} \qquad
>>   \unit{6 Meter} \qquad
>>   \unit{3 mEtEr} \qquad
>> \stopformula
>> Units with lowercase prefixes (c, k, n).
>> \startformula
>>   \unit{3cm} \qquad
>>   \unit{6kg} \qquad
>>   \unit{3ns} \qquad
>> \stopformula
>> Units with capital letters, called with names (coulomb, kelvin, newton).
>> \startformula
>>   \unit{3 coulomb} \qquad
>>   \unit{6 kelvin} \qquad
>>   \unit{3 newton} \qquad
>> \stopformula
> 
> you can look at phys-dim and see plenty of short and long keys and making all 
> case insensitive is asking for troubles

Indeed, I would like to make NONE of them case insensitive. But currently, when 
I register an upper case key (C=coulomb) it messes up the lower case prefix 
(“cm" gets typeset as C•m). I was expecting the parser to distinguish between 
the “C” and “c”, but it doesn’t. Is that intended?

Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \unit parser ignoring case, in some cases.

2023-03-13 Thread Hans Hagen via ntg-context

On 3/9/2023 2:04 PM, Gavin via ntg-context wrote:

\startformula
   \unit{3 meter} \qquad
   \unit{6 Meter} \qquad
   \unit{3 mEtEr} \qquad
\stopformula

Units with lowercase prefixes (c, k, n).
\startformula
   \unit{3cm} \qquad
   \unit{6kg} \qquad
   \unit{3ns} \qquad
\stopformula

Units with capital letters, called with names (coulomb, kelvin, newton).
\startformula
   \unit{3 coulomb} \qquad
   \unit{6 kelvin} \qquad
   \unit{3 newton} \qquad
\stopformula


you can look at phys-dim and see plenty of short and long keys and 
making all case insensitive is asking for troubles


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] \unit parser ignoring case, in some cases.

2023-03-09 Thread Gavin via ntg-context
Hello list,

I continue to work with the \unit command, and found some behavior very 
surprising. When I try to register units with capital letter names, it breaks 
lowercase metric prefixes. For example, registering C=coulomb, K=kelvin and 
N=newton breaks metric units cm, kg, and ns. The file below demonstrates the 
behavior.

Obviously, I can use full names in my document. However, I would like the 
standard SI symbols, which are single capital letters, to work for me and my 
less TeX-savvy colaborators.

Thanks!
Gavin


\starttext

Units does not completely ignore case.

\startformula
  \unit{3 meter} \qquad
  \unit{6 Meter} \qquad
  \unit{3 mEtEr} \qquad
\stopformula

Units with lowercase prefixes (c, k, n).
\startformula
  \unit{3cm} \qquad
  \unit{6kg} \qquad
  \unit{3ns} \qquad
\stopformula

Units with capital letters, called with names (coulomb, kelvin, newton).
\startformula
  \unit{3 coulomb} \qquad
  \unit{6 kelvin} \qquad
  \unit{3 newton} \qquad
\stopformula

Units with capital letters, called with the capital letter (C, K, N) fail.
\startformula
  \unit{3 C} \qquad
  \unit{6 K} \qquad
  \unit{3 N} \qquad
\stopformula

Now I register some units with capital letter names: C=coulomb, K=kelvin, 
N=newton.

\registerunit[unit][
  C=coulomb,
  K=kelvin,
  N=newton]

Units called by capital letter (C, K, N) now work.
\startformula
  \unit{3 C} \qquad
  \unit{6 K} \qquad
  \unit{3 N} \qquad
\stopformula

However, units with lowercase prefixes (c, k, n) are broken.
\startformula
  \unit{3cm} \qquad
  \unit{6kg} \qquad
  \unit{3ns} \qquad
\stopformula

\stoptext
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-21 Thread Gavin via ntg-context
Hans,

I made a small mistake in the phys-dim.mkxl file I sent you. I removed a % at 
the end of lines 469 and 485. Without the %, using alternative=text causes 
extra space before the unit. A corrected phys-dim.mkxl is attached.

Gavin



phys-dim.mkxl
Description: application/applefile
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-21 Thread Gavin via ntg-context
Hi Hans,

> I'll look into it (with Mikael as some relates to math) once you're done 
> playing and provide suggestions and tests.

I’m done playing. Below are tests and suggestions. Sorry it has taken so long 
for me to put this together.


Tests
I attached two test files. The first, units-spacing.tex, is for testing spacing 
for \unit used in text, inline math, and display math. The second, 
units-linebreaks.tex, tests line breaks when \unit. is used in text or in 
inline math. Line breaks were not my primary interest, but Max and Alan were 
quite interested. My proposed fixes for spacing also fix their concerns about 
line breaks.I tried to make these tests match the style of the Test Suite. They 
could be included there if they are useful.


Suggestions
I attached my my modified phys-dim.mkxl. All of my changes are commented and 
signed with -GP to make them easy to find. Below are comments on the five 
issues I addressed (not including line breaks). The first four of these are 
fixes.I don’t think any of these fixes are controversial or require new 
options. The fifth, regarding the space around the \times in scientific 
notation, might be an appropriate option, rather than a universal fix.


1. The \cdot in units should not have space around it.
These lines produce the \cdot between units, one is for the default \cdot, the 
other when the separator=cdot option is used. I’m not entirely sure why they 
are separate. Now, in math mode, the \cdot is changed to an ord. (ll. 392-393)

\protected\def\phys_units_separator
 
{\ifcsname\??unitseparator\unitparameter\c!separator\endcsname\lastnamedcs\else\ifmmode\mathord\cdot\else\cdot\fi\fi}
 % Made \cdot an "ord" in math mode -GP

\installunitsseparator\v!normal{\ifmmode\mathord\cdot\else\cdot\fi}  % Made 
\cdot an "ord" in math mode -GP


2. Space is needed between number and units
To get the thin space between the number and the units (ll.412-418)

\protected\def\phys_units_space
 {\ifmmode
\thinspace % let the atoms do the work. Right now atoms aren't doing the 
work, so I put in a \thinspace -GP
  \else
\unskip % weird, why is unskip needed

\ifcsname\??unitspace\unitparameter\c!space\endcsname\lastnamedcs\else\unitsmediumspace\fi
  \fi}


3. Space is needed after the units, before the next relation, binary operator, 
etc. Right now there seems to be no space added between the new dimension class 
and the relation and binary operator class. Until the space around the 
dimension class is fixed, The units should not be assigned to the dimension 
class, which means removing the code that sets units to this class. (ll. 
618-623)

\def\phys_units_start
 {\ifmmode
\dostarttagged\t!maction\t!unit
% \mathatom % I removed this because the correct spaces after dim haven't 
been set (e.g. dimbin, dimrel) -GP
%\s!leftclass  \mathdimensioncode
%\s!rightclass \mathdimensioncode
\bgroup
  \else
\dostarttagged\t!unit\empty
  \fi
  \let\phys_units_finish\phys_units_stop
  \let\phys_units_start\relax}


4. Remove hardcoded backspace before the solidus in units. (If this space 
should be tighter, it probably should be dealt with for every solidus, not just 
the solidus in \unit the unit command.) (ll.412-418)

\permanent\protected\def\unitsSOLIDUS
 {%\ifnum\c_phys_units_state=\plusone % suffix  % Removed three lines to 
eliminate backspace before / -GP
  %  \unitsbackspace
  %\fi
  {/}%
  }%\unitsbackspace}


5. I think the \times in scientific notation should not have extra space. 
Everyone who commented on the mailing list agreed. However, I’m not sure that 
this is a universal desire, so it might be good to add an options, like 
scispace=normal for the usual binop space around the \times and scispace=tight 
for no extra space around \times. The changed line in phys-dime.mkxl used to 
add space around the \times in text. Now, instead, it removes the space around 
the \times in math by making the \times an ord. (ll. 170-172)

\permanent\protected\def\digitstextbinop#1% assumes preceding
 {\ifmmode\mathord#1\else\nobreak#1\fi} % Removed space around binop (\times or 
\cdot) in \units -GP
 %{\ifmmode#1\else\fourperemspace\nobreak#1\fourperemspace\fi} % This is the 
old line with spaces -GP


Those are my five suggestions. Thanks for looking at spacing in \units!

Gavin




units-spacing.tex
Description: Binary data


units-linebreaks.tex
Description: Binary data


phys-dim.mkxl
Description: Binary data


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-14 Thread Hans Hagen via ntg-context

On 10/13/2022 1:52 PM, Gavin via ntg-context wrote:

Hi Oli,


Thank four your effort. I found out, that the following definition of a new 
unit, i called it SI, results also in a correct spaceing in the math 
environment:

\defineunit[SI][alternative=text]

It seems, that the option alternative=text solves the problem with no spaces 
between value and unit in the math environment.


That is a terrific solution that doesn’t require any messing with 
phys-dim.mkxl. You do not need to define a new unit. I got your result using 
this line:

\setupunits[alternative=text]

This fixed the most significant problems with \unit in most situations. I’m 
still applying some of my solutions as well.
I'll look into it (with Mikael as some relates to math) once you're done 
playing and provide suggestions and tests.


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - degrees

2022-10-13 Thread Alan Braslau via ntg-context
On Wed, 12 Oct 2022 21:14:52 -0600
Gavin  wrote:

> As a recovering string theorist, I cannot help but speculate that
> this rule extends to spherical coordinates in any number of
> dimensions. However, if you don’t want the space, you can use
> 135\unit{℃}, which does not add a space.

Will 135\unit{℃} ever break between the digits 135 and the "unit"?
I agree that \unit should probably use an \mbox to prevent unwanted
breaks.

The other role of \unit, I understand, is to uniformize the
representation of numbers (digits).

> > Related,
> > \unit{90°} does not seem to introduce a space, as indeed it should
> > not.  

So ℃ needs to be registered as a degree and prevent any spacing.

> Also related, using \unit for just the units, and not the number, is
> useful when they follow something that is not a number, like a
> vector: $ \vec v = (4.0, -3.2, 1.5)\unit{m/s} $. You frequently do
> not want a space in that situation.

Why would one not want a (small) space before m/s in the above
example?

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-13 Thread Gavin via ntg-context
Hi Oli,

> Thank four your effort. I found out, that the following definition of a new 
> unit, i called it SI, results also in a correct spaceing in the math 
> environment:
> 
> \defineunit[SI][alternative=text]
> 
> It seems, that the option alternative=text solves the problem with no spaces 
> between value and unit in the math environment.

That is a terrific solution that doesn’t require any messing with 
phys-dim.mkxl. You do not need to define a new unit. I got your result using 
this line:

\setupunits[alternative=text]

This fixed the most significant problems with \unit in most situations. I’m 
still applying some of my solutions as well.

Thanks!
Gavin

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-13 Thread Oliver Sieber via ntg-context
Hi Gavin

Thank four your effort. I found out, that the following definition of a new 
unit, i called it SI, results also in a correct spaceing in the math 
environment:

\defineunit[SI][alternative=text]

It seems, that the option alternative=text solves the problem with no spaces 
between value and unit in the math environment.

Maybe this can be used to solve it easier in the code. I will have a look at 
phys-dim to solve it directly, if I find the time.

Best regards
Oli

> Am 12.10.2022 um 23:54 schrieb Gavin via ntg-context - ntg-context at ntg.nl 
> :
> 
> Hi Max, Alan, Bruce, Hans, et.al
> 
> I solved my four issues with \unit spacing. In the process, I prevented 
> unwanted line breaks and removed an overzealous backspace before division 
> symbols. Below is a MWE that shows all of these issues, as well as pictures 
> of the result with the unmodified phys-dim.mkxl and with my modified 
> phys-dim.mkxl. The final result is exactly what I wanted.
> 
> If anyone wants my changes, either for their own use or to improve the 
> distributed phys-dim.mkxl, I’m happy to share.
> 
> Thanks for all of your comments!
> Gavin
> 
> 
> MWE:
> 
> \setuppapersize[A5]
> 
> \starttext
> 
> The \type{\unit} command in text produces \unit{1.23e5 kg m^2/s^2}.
> 
> Inline math \type{$\unit$} produces $\unit{1.23e5 kg m^2/s^2}$.
> 
> Display math produces
> \startformula
> \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule}
> \stopformula
> 
> Line breaking in math:
> 
> {\hsize=0pt $G = \unit{6.6743e-11 m3 kg-1 s-2}$}
> 
> \blank
> Line breaking in text:
> 
> {\hsize=0pt \unit{6.6743e-11 m3 kg-1 s-2}}
> 
> \stoptext
> 
> Output with unmodified phys-dim.mkxl:
> 
> 
> Output with my modified phys-dim.mkxl:
> 
> 
> 
> 
>> On Oct 10, 2022, at 12:15 AM, Max Chernoff via ntg-context 
>>  wrote:
>> 
>> Hi Alan,
>> 
>>> I would very strongly argue that the space between the number and the
>>> following units be UNBREAKABLE. Perhaps a thin space (preference), but
>>> most certainly non-breakable.
>>> 
>>> Similarly around the times in scientific notation.
>>> 
>>> I further cannot imagine that a line break be acceptable around a \cdot
>>> in composite units.
>>> 
>>> This can possibly lead to overfill and underfill, something that I find
>>> *infinitely* more acceptable then breaking numbers and units.
>> 
>> Yes, I agree completely here.
>> 
>>> I do not know or use the \units command. Maybe it uses unbreakable
>>> spaces, maybe not. I would never use it unless it could be configured
>>> to only use nonbreakable spaces.
>> 
>> The current behaviour doesn't break the unit from the number, but it
>> does split the scientific notation.
>> 
>> This test file:
>> 
>>  \starttext
>>  \hsize=0pt Math: $G = \unit{6.6743e-11 m3 kg-1 s-2}$
>> 
>>  \hsize=0pt Text: \unit{6.6743e-11 m3 kg-1 s-2}
>>  \stoptext
>> 
>> gives:
>> 
>>  Math:
>>  퐺=
>>  6.6743×
>>  10–11m3⋅kg–1⋅s–2
>>  Text:
>>  6.6743
>>  ×
>>  10−11 m3⋅kg−1⋅s−2
>> 
>> which isn't great. In my opinion, the \unit command should be typeset in an
>> \hbox (or similar) since I can't think of any circumstances where breaking
>> it would be reasonable.
>> 
>> Thanks,
>> -- Max
>> ___
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : ntg-context@ntg.nl / 
>> https://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : https://contextgarden.net
>> ___
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___



signature.asc
Description: Message signed with OpenPGP
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - degrees

2022-10-12 Thread Gavin via ntg-context
Hi Alan

> On Oct 12, 2022, at 5:55 PM, Alan Braslau via ntg-context 
>  wrote:
> 
> \unit{135℃} adds a space after the digits 135.
> I do not believe that this is correct
> (for ℃ is *not* a "real" unit, unlike \unit{408.15 K} which *is* a real
> unit).

According to “Scientific Style and Format: The CSE Manual for Authors, Editors, 
and Publishers, 8th Ed.” by the Council of Science Editors:

> The symbol for degrees Celsius, ℃ (not simply C), is separated from the 
> number on its left by one space, whereas the degree symbol for a plane angle 
> (e.g. a 45° angle) and for longitude and latitude (e.g. 45°30’N) is not 
> separated from the numeral by a space. [§12.2.1.1 SI Rules, pp.169-170]

As a recovering string theorist, I cannot help but speculate that this rule 
extends to spherical coordinates in any number of dimensions. However, if you 
don’t want the space, you can use 135\unit{℃}, which does not add a space.

> Also,
> \unit{135°C} drops the "C". Is this a parsing bug?

It is not a parsing bug; it is a limitation. In general, units must be spelled 
out (newton, joule, etc.) which produces the correct SI symbol (N, J, etc.). 
Some units are also recognized by their symbols (m, s, kg,…). Celsius is 
recognized by the single character “℃” and by the name “celsius”, but not by 
the two character combination “°C”. Probably, the parser could be expanded to 
recognize the two character combination. That requires mucking around in 
phys-dim.lua, which I’m not going to touch.

Use \unit{135 celsius} if you want the space, and 135\unit{celsius} if you 
don’t. Or you can add your favorite abbreviations:

\registerunit[
  °C=°C,
  ]
\setupunittext[
  °C=℃,
  ]

Then use \unit{135°C} if you want the space and 135\unit{°C} if you don’t.

> Related,
> \unit{90°} does not seem to introduce a space, as indeed it should not.

Also related, using \unit for just the units, and not the number, is useful 
when they follow something that is not a number, like a vector: $ \vec v = 
(4.0, -3.2, 1.5)\unit{m/s} $. You frequently do not want a space in that 
situation.

Now that I’ve had this success messing with other people’s code, I’ve got your 
luagraph module on my mind.

Gavin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-12 Thread Gavin via ntg-context
Hi Max and Rik

> On Oct 12, 2022, at 4:49 PM, Max Chernoff  wrote:
> 
> This new output looks *much* better than the old one, thanks! 

Thank you!

> My only comment is that the spacing around the multiplication sign looks
> a little too tight to me. The original spacing was probably too large,
> but I think that a little more space than you currently have would be
> better.

I haven’t adjusted the space directly. I just changed the \times and \cdot from 
class binom to class ord. I’m not going to tweak the space. I don’t even use 
this font. With proportional numbers in Libertinus, I think the \times looks 
great.



PastedGraphic-5.pdf
Description: Adobe PDF document


With tabular numbers, the \times looks a bit off center due to the extra space 
around the following 1.

>> If anyone wants my changes, either for their own use or to improve the
>> distributed phys-dim.mkxl, I’m happy to share.
> 
> Yes, can you please share that to the list?

See below for comments, and the full modified phys-dim.mkxl is attached

> Hi Rik,
> 
>> It does look like you have introduced additional space before the 
>> solidus. Was that intentional?
> 
> I believe that that is intentional. From the earlier email:
> 
>> removed an overzealous backspace before division symbols.
> 
> This new spacing looks much more even to me, especially around the
> exponents.

It was intentional. I didn’t add space. I removed a backspace in the \unit code.

Below I list all of my changes to the phys-dim.mkxl code, with some commentary. 
I have added comments in the code everywhere I made a change, and I signed the 
changes with -GP, so they are easy to find.

Thanks for your encouragement, because my high school physics students 
certainly do not give a s#!t.

I hope some people find this useful!

Gavin



This used to add space around the \times in text. Now, instead, it removes the 
space around the \times in math by making the \times an ord. (ll. 170-172)

\permanent\protected\def\digitstextbinop#1% assumes preceding
  {\ifmmode\mathord#1\else\nobreak#1\fi} % Removed space around binop (\times 
or \cdot) in \units -GP
  %{\ifmmode#1\else\fourperemspace\nobreak#1\fourperemspace\fi} % This is the 
old line with spaces -GP


These lines produce the \cdot between units, one is for the default \cdot, the 
other when the separator=cdot option is used. I’m not entirely sure why they 
are separate. Now, in math mode, the \cdot is changed to an ord. (ll. 392-393

\protected\def\phys_units_separator
  
{\ifcsname\??unitseparator\unitparameter\c!separator\endcsname\lastnamedcs\else\ifmmode\mathord\cdot\else\cdot\fi\fi}
 % Made \cdot an "ord" in math mode -GP

\installunitsseparator\v!normal{\ifmmode\mathord\cdot\else\cdot\fi}  % Made 
\cdot an "ord" in math mode -GP


To get the thin space between the number and the units (ll.412-418)

\protected\def\phys_units_space
  {\ifmmode
 \thinspace % let the atoms do the work. Right now atoms aren't doing the 
work, so I put in a \thinspace -GP
   \else
 \unskip % weird, why is unskip needed
 
\ifcsname\??unitspace\unitparameter\c!space\endcsname\lastnamedcs\else\unitsmediumspace\fi
   \fi}


This had a hardcoded backspace before the solidus. I think it looks better 
without. Even if this space should be tighter, it probably should be dealt with 
for every solidus, not just the solidus in \unit the unit command. (ll.412-418)

\permanent\protected\def\unitsSOLIDUS
  {%\ifnum\c_phys_units_state=\plusone % suffix  % Removed three lines to 
eliminate backspace before / -GP
   %  \unitsbackspace
   %\fi
   {/}%
   }%\unitsbackspace}


Finally, until the space around the dimension class is fixed, I’m just removing 
the code that sets units to this class. (ll. 618-623)

\def\phys_units_start
  {\ifmmode
 \dostarttagged\t!maction\t!unit
% \mathatom % I removed this because the correct spaces after dim haven't 
been set (e.g. dimbin, dimrel) -GP
%\s!leftclass  \mathdimensioncode
%\s!rightclass \mathdimensioncode
 \bgroup
   \else
 \dostarttagged\t!unit\empty
   \fi
   \let\phys_units_finish\phys_units_stop
   \let\phys_units_start\relax}




phys-dim.mkxl
Description: Binary data

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - degrees

2022-10-12 Thread Alan Braslau via ntg-context
Further \unit question(s):

\unit{135℃} adds a space after the digits 135.
I do not believe that this is correct
(for ℃ is *not* a "real" unit, unlike \unit{408.15 K} which *is* a real
unit).

Also,
\unit{135°C} drops the "C". Is this a parsing bug?

Related,
\unit{90°} does not seem to introduce a space, as indeed it should not.

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-12 Thread Max Chernoff via ntg-context
Hi Gavin,

On Wed, 2022-10-12 at 15:54 -0600, Gavin wrote:
> Hi Max, Alan, Bruce, Hans, et.al
> 
> I solved my four issues with \unit spacing. In the process, I
> prevented unwanted line breaks and removed an overzealous backspace
> before division symbols. Below is a MWE that shows all of these
> issues, as well as pictures of the result with the unmodified phys-
> dim.mkxl and with my modified phys-dim.mkxl. The final result is
> exactly what I wanted.

This new output looks *much* better than the old one, thanks! 

My only comment is that the spacing around the multiplication sign looks
a little too tight to me. The original spacing was probably too large,
but I think that a little more space than you currently have would be
better.

> If anyone wants my changes, either for their own use or to improve the
> distributed phys-dim.mkxl, I’m happy to share.

Yes, can you please share that to the list?

Hi Rik,

> It does look like you have introduced additional space before the 
> solidus. Was that intentional?

I believe that that is intentional. From the earlier email:

> removed an overzealous backspace before division symbols.

This new spacing looks much more even to me, especially around the
exponents.

Thanks,
-- Max
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-12 Thread Rik Kabel via ntg-context


On 2022-10-12 17:54, Gavin via ntg-context wrote:

Hi Max, Alan, Bruce, Hans, et.al

I solved my four issues with \unit spacing. In the process, I prevented 
unwanted line breaks and removed an overzealous backspace before division 
symbols. Below is a MWE that shows all of these issues, as well as pictures of 
the result with the unmodified phys-dim.mkxl and with my modified 
phys-dim.mkxl. The final result is exactly what I wanted.

If anyone wants my changes, either for their own use or to improve the 
distributed phys-dim.mkxl, I’m happy to share.

Thanks for all of your comments!
Gavin


MWE:

\setuppapersize[A5]

\starttext

The \type{\unit} command in text produces \unit{1.23e5 kg m^2/s^2}.

Inline math \type{$\unit$} produces $\unit{1.23e5 kg m^2/s^2}$.

Display math produces
\startformula
  \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule}
\stopformula

Line breaking in math:

{\hsize=0pt $G = \unit{6.6743e-11 m3 kg-1 s-2}$}

\blank
Line breaking in text:

{\hsize=0pt \unit{6.6743e-11 m3 kg-1 s-2}}

\stoptext

Output with unmodified phys-dim.mkxl:


Output with my modified phys-dim.mkxl:





On Oct 10, 2022, at 12:15 AM, Max Chernoff via ntg-context  
wrote:

Hi Alan,


I would very strongly argue that the space between the number and the
following units be UNBREAKABLE. Perhaps a thin space (preference), but
most certainly non-breakable.

Similarly around the times in scientific notation.

I further cannot imagine that a line break be acceptable around a \cdot
in composite units.

This can possibly lead to overfill and underfill, something that I find
*infinitely* more acceptable then breaking numbers and units.

Yes, I agree completely here.


I do not know or use the \units command. Maybe it uses unbreakable
spaces, maybe not. I would never use it unless it could be configured
to only use nonbreakable spaces.

The current behaviour doesn't break the unit from the number, but it
does split the scientific notation.

This test file:

   \starttext
   \hsize=0pt Math: $G = \unit{6.6743e-11 m3 kg-1 s-2}$

   \hsize=0pt Text: \unit{6.6743e-11 m3 kg-1 s-2}
   \stoptext

gives:

   Math:
   퐺=
   6.6743×
   10–11m3⋅kg–1⋅s–2
   Text:
   6.6743
   ×
   10−11 m3⋅kg−1⋅s−2

which isn't great. In my opinion, the \unit command should be typeset in an
\hbox (or similar) since I can't think of any circumstances where breaking
it would be reasonable.

Thanks,
-- Max
___


It does look like you have introduced additional space before the 
solidus. Was that intentional?


--
Rik

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit - SOLVED

2022-10-12 Thread Gavin via ntg-context
Hi Max, Alan, Bruce, Hans, et.al

I solved my four issues with \unit spacing. In the process, I prevented 
unwanted line breaks and removed an overzealous backspace before division 
symbols. Below is a MWE that shows all of these issues, as well as pictures of 
the result with the unmodified phys-dim.mkxl and with my modified 
phys-dim.mkxl. The final result is exactly what I wanted.

If anyone wants my changes, either for their own use or to improve the 
distributed phys-dim.mkxl, I’m happy to share.

Thanks for all of your comments!
Gavin


MWE:

\setuppapersize[A5]

\starttext

The \type{\unit} command in text produces \unit{1.23e5 kg m^2/s^2}.

Inline math \type{$\unit$} produces $\unit{1.23e5 kg m^2/s^2}$.

Display math produces
\startformula
 \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule}
\stopformula

Line breaking in math:

{\hsize=0pt $G = \unit{6.6743e-11 m3 kg-1 s-2}$}

\blank
Line breaking in text:

{\hsize=0pt \unit{6.6743e-11 m3 kg-1 s-2}}

\stoptext

Output with unmodified phys-dim.mkxl:


PastedGraphic-3.pdf
Description: Adobe PDF document


Output with my modified phys-dim.mkxl:


PastedGraphic-2.pdf
Description: Adobe PDF document




> On Oct 10, 2022, at 12:15 AM, Max Chernoff via ntg-context 
>  wrote:
> 
> Hi Alan,
> 
>> I would very strongly argue that the space between the number and the
>> following units be UNBREAKABLE. Perhaps a thin space (preference), but
>> most certainly non-breakable.
>> 
>> Similarly around the times in scientific notation.
>> 
>> I further cannot imagine that a line break be acceptable around a \cdot
>> in composite units.
>> 
>> This can possibly lead to overfill and underfill, something that I find
>> *infinitely* more acceptable then breaking numbers and units.
> 
> Yes, I agree completely here.
> 
>> I do not know or use the \units command. Maybe it uses unbreakable
>> spaces, maybe not. I would never use it unless it could be configured
>> to only use nonbreakable spaces. 
> 
> The current behaviour doesn't break the unit from the number, but it
> does split the scientific notation.
> 
> This test file:
> 
>   \starttext
>   \hsize=0pt Math: $G = \unit{6.6743e-11 m3 kg-1 s-2}$
> 
>   \hsize=0pt Text: \unit{6.6743e-11 m3 kg-1 s-2}
>   \stoptext
> 
> gives:
> 
>   Math:
>   퐺=
>   6.6743×
>   10–11m3⋅kg–1⋅s–2
>   Text:
>   6.6743
>   ×
>   10−11 m3⋅kg−1⋅s−2
> 
> which isn't great. In my opinion, the \unit command should be typeset in an
> \hbox (or similar) since I can't think of any circumstances where breaking
> it would be reasonable.
> 
> Thanks,
> -- Max
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Dimension atom in math? (was: Spacing in \unit)

2022-10-12 Thread Gavin via ntg-context
Hi List,

I am trying to improve the spacing produced by the \unit command. I have solved 
three of my four issues by modifying phys-dim.mkxl, but the fourth issue has me 
stumped. Consider this example:

\showmakeup[mathglue] \mathspacingmode=1

\starttext
\startformula
 \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 newton m} = \unit{987,000 joule}
\stopformula
\stoptext

There is no space between the units and the following + or =. The \showmakeup 
reveals that this is the space between a “dim” and a “bin” or a “dim” and a 
“rel”. I am guessing that “dim” refers to a new “dimension” atom class, and it 
appears that the table determining the spacing between atoms does not include 
space between this dimension class and the binary or relation classes. I don’t 
know that this is the problem, but this is my best guess.

If this is the problem, is there a way I can add this space to the necessary 
table? If this is not the problem, I’m open to any other insight or advice.

Thanks,
Gavin


> On Oct 8, 2022, at 11:59 AM, Gavin  wrote:
> 
> Hi list,
> 
> I made a small example with all of the issues I am trying to fix for the 
> \units command. The first formula below uses the \unit command, but produces 
> strange spacing. The second formula produces the desired spacing, without 
> using the \unit command.
> 
> \showmakeup[mathglue] %\mathspacingmode=1
> 
> \starttext
> \startformula
> \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 W s} = \unit{9.87e5 newton m}
> \stopformula
> \startformula
> 1.23\mathord\times10^5\,{\rm kg\mathord\cdot m^2/s^2} + 
> 8.64\mathord\times10^5\,{\rm W\mathord{\cdot}s} = 
> 9.87\mathord\times10^5\,{\rm N\mathord{\cdot}m}
> \stopformula
> \stoptext
> 
> I’m trying to fix four issues:
>  - No space between the number and the following units. Should be a thin 
> space.
>  - No space between the units and the following symbol (+ and = above). 
> Should be appropriate “bin" or “rel" space.
>  - Too much space around the \cdot in the units. Should be treated like an 
> “ord" when used to separate units.
>  - Too much space around the \times in the scientific notation. Should be 
> treated like an "ord" when used in scientific notation. (I'm not sure there 
> is consensus on this.)
> 
> Some of these seemed like things I could fix myself, so I dug into 
> phys-dim.mkxl to see what I could do. The good news is that I didn’t break 
> anything. The bad news is that nothing I did seemed to have any effect – 
> including deleting phys-dim.mkxl entirely! I double checked that I was 
> working on the same installation used for typesetting. Is the code used for 
> \unit now somewhere else?
> 
> These issues only occur in math mode, and \unit handles comma separators 
> correctly, unlike \digit.
> 
> I’d like to get some sort of temporary patch for at least some of these 
> issues, even if I need to write it myself. I use \unit everywhere in physics 
> problems sets for students and in keys that I share other teachers.
> 
> Any guidance is appreciated!
> 
> Gavin
> 
> P.S. I’m working on a more comprehensive test file, but its not ready yet.

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit

2022-10-10 Thread Max Chernoff via ntg-context
Hi Alan,

> I would very strongly argue that the space between the number and the
> following units be UNBREAKABLE. Perhaps a thin space (preference), but
> most certainly non-breakable.
> 
> Similarly around the times in scientific notation.
> 
> I further cannot imagine that a line break be acceptable around a \cdot
> in composite units.
> 
> This can possibly lead to overfill and underfill, something that I find
> *infinitely* more acceptable then breaking numbers and units.

Yes, I agree completely here.

> I do not know or use the \units command. Maybe it uses unbreakable
> spaces, maybe not. I would never use it unless it could be configured
> to only use nonbreakable spaces. 

The current behaviour doesn't break the unit from the number, but it
does split the scientific notation.

This test file:

   \starttext
   \hsize=0pt Math: $G = \unit{6.6743e-11 m3 kg-1 s-2}$
   
   \hsize=0pt Text: \unit{6.6743e-11 m3 kg-1 s-2}
   \stoptext
   
gives:

   Math:
   퐺=
   6.6743×
   10–11m3⋅kg–1⋅s–2
   Text:
   6.6743
   ×
   10−11 m3⋅kg−1⋅s−2
   
which isn't great. In my opinion, the \unit command should be typeset in an
\hbox (or similar) since I can't think of any circumstances where breaking
it would be reasonable.

Thanks,
-- Max
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit

2022-10-09 Thread Alan Braslau via ntg-context
On Sat, 8 Oct 2022 11:59:04 -0600
Gavin via ntg-context  wrote:

> I’m trying to fix four issues:
>   - No space between the number and the following units. Should be a
> thin space.
>   - No space between the units and the following symbol (+ and =
> above). Should be appropriate “bin" or “rel" space.
>   - Too much space around the \cdot in the units. Should be treated
> like an “ord" when used to separate units.
>   - Too much space around the \times in the scientific notation.
> Should be treated like an "ord" when used in scientific notation.
> (I'm not sure there is consensus on this.)

Gavin (and the mailing list),

I would very strongly argue that the space between the number and the
following units be UNBREAKABLE. Perhaps a thin space (preference), but
most certainly non-breakable.

Similarly around the times in scientific notation.

I further cannot imagine that a line break be acceptable around a \cdot
in composite units.

This can possibly lead to overfill and underfill, something that I find
*infinitely* more acceptable then breaking numbers and units.

I do not know or use the \units command. Maybe it uses unbreakable
spaces, maybe not. I would never use it unless it could be configured
to only use nonbreakable spaces. 

Perhaps others feel differently?

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Spacing in \unit

2022-10-08 Thread Gavin via ntg-context
Hi list,

I made a small example with all of the issues I am trying to fix for the \units 
command. The first formula below uses the \unit command, but produces strange 
spacing. The second formula produces the desired spacing, without using the 
\unit command.

\showmakeup[mathglue] %\mathspacingmode=1

\starttext
\startformula
 \unit{1.23e5 kg m^2/s^2} + \unit{8.64e5 W s} = \unit{9.87e5 newton m}
\stopformula
\startformula
 1.23\mathord\times10^5\,{\rm kg\mathord\cdot m^2/s^2} + 
8.64\mathord\times10^5\,{\rm W\mathord{\cdot}s} = 9.87\mathord\times10^5\,{\rm 
N\mathord{\cdot}m}
\stopformula
\stoptext

I’m trying to fix four issues:
  - No space between the number and the following units. Should be a thin space.
  - No space between the units and the following symbol (+ and = above). Should 
be appropriate “bin" or “rel" space.
  - Too much space around the \cdot in the units. Should be treated like an 
“ord" when used to separate units.
  - Too much space around the \times in the scientific notation. Should be 
treated like an "ord" when used in scientific notation. (I'm not sure there is 
consensus on this.)

Some of these seemed like things I could fix myself, so I dug into 
phys-dim.mkxl to see what I could do. The good news is that I didn’t break 
anything. The bad news is that nothing I did seemed to have any effect – 
including deleting phys-dim.mkxl entirely! I double checked that I was working 
on the same installation used for typesetting. Is the code used for \unit now 
somewhere else?

These issues only occur in math mode, and \unit handles comma separators 
correctly, unlike \digit.

I’d like to get some sort of temporary patch for at least some of these issues, 
even if I need to write it myself. I use \unit everywhere in physics problems 
sets for students and in keys that I share other teachers.

Any guidance is appreciated!

Gavin

P.S. I’m working on a more comprehensive test file, but its not ready yet.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit

2022-09-25 Thread Bruce Horrocks via ntg-context


> On 25 Sep 2022, at 14:30, Gavin via ntg-context  wrote:
> 
> Hello list,
> 
> I have a few questions about space produced by the unit command. Consider 
> this MWE
> 
> \starttext
> \unit{3.00e8 kg m/s}
> 
> $\unit{3.00e8 kg m/s}$
> \stoptext
> 
> The dot between “kg” and “m” has different spacing depending on whether the 
> \unit command is in text or math mode. I think that the tighter spacing in 
> the first one, in text, is correct.
> 
> I personally would also like less space around the \times. To me, the number 
> 3.00e8 should be typeset more like a single number, rather than like a 
> product of 3.00 and 10^8. I am probably in the minority here. If \unit and 
> \digit had an option for tighter spacing around the \times, I’d use it, but 
> the current output with more space is probably what most people expect and 
> want. Perhaps something like [scispace=tight].

I too would prefer less space around the times e.g. \starttext 3.00×10\high{8} 
\stoptext is fine (except for the 8 which is nicer in \unit).

—
Bruce Horrocks
Hampshire, UK

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit

2022-09-25 Thread Hans Hagen via ntg-context

On 9/25/2022 5:29 PM, Gavin via ntg-context wrote:

Hi Hans,

I also just noticed that the space between the number and the unit is missing 
when I typeset with ConTeXt ver: 2022.09.11 20:44 LMTX fmt: 2022.9.25. This 
space was present in with the ConTeXt version I was using earlier, from a 
couple months ago. Thanks for putting it on the math todo list!
i can probably clean up the code a bit in lmtx ... units are not that 
(rapidly) evolving and much is rather old code so best collect all 
issues and make a test file that mikael and i can use (as wer then do 
math and text at the same time)


maybe we also need to add units (are there new ones anyway?)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit

2022-09-25 Thread Gavin via ntg-context
Hi Hans,

I also just noticed that the space between the number and the unit is missing 
when I typeset with ConTeXt ver: 2022.09.11 20:44 LMTX fmt: 2022.9.25. This 
space was present in with the ConTeXt version I was using earlier, from a 
couple months ago. Thanks for putting it on the math todo list!

Gavin

(I sent the above message to Hans, but failed to cc the mailing list. Sorry if 
some of you get this twice.)

> On Sep 25, 2022, at 9:19 AM, Hans Hagen  wrote:
> 
> On 9/25/2022 3:30 PM, Gavin via ntg-context wrote:
>> Hello list,
>> I have a few questions about space produced by the unit command. Consider 
>> this MWE
>> \starttext
>> \unit{3.00e8 kg m/s}
>> $\unit{3.00e8 kg m/s}$
>> \stoptext
>> The dot between “kg” and “m” has different spacing depending on whether the 
>> \unit command is in text or math mode. I think that the tighter spacing in 
>> the first one, in text, is correct.
>> I personally would also like less space around the \times. To me, the number 
>> 3.00e8 should be typeset more like a single number, rather than like a 
>> product of 3.00 and 10^8. I am probably in the minority here. If \unit and 
>> \digit had an option for tighter spacing around the \times, I’d use it, but 
>> the current output with more space is probably what most people expect and 
>> want. Perhaps something like [scispace=tight].
> 
> that's for the math todo
> 
>> Finally, \unit does not play nicely with surrounding spaces. For example:
>> $2\pi\,\unit{3.00e8 kg m/s}$
>> causes a fatal error:
>> tex error   > tex error on line 9 in file ./Untitled.tex: Incompatible 
>> glue units (case 1)
> that's an interesting case for the engine (Mixing regular and mu skips and 
> so) ... we mighth finaly have a valid case for a primitive zero test
> 
> Hans
> 
> -
>  Hans Hagen | PRAGMA ADE
>  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Spacing in \unit

2022-09-25 Thread Hans Hagen via ntg-context

On 9/25/2022 3:30 PM, Gavin via ntg-context wrote:

Hello list,

I have a few questions about space produced by the unit command. Consider this 
MWE

\starttext
\unit{3.00e8 kg m/s}

$\unit{3.00e8 kg m/s}$
\stoptext

The dot between “kg” and “m” has different spacing depending on whether the 
\unit command is in text or math mode. I think that the tighter spacing in the 
first one, in text, is correct.

I personally would also like less space around the \times. To me, the number 
3.00e8 should be typeset more like a single number, rather than like a product 
of 3.00 and 10^8. I am probably in the minority here. If \unit and \digit had 
an option for tighter spacing around the \times, I’d use it, but the current 
output with more space is probably what most people expect and want. Perhaps 
something like [scispace=tight].


that's for the math todo


Finally, \unit does not play nicely with surrounding spaces. For example:

 $2\pi\,\unit{3.00e8 kg m/s}$

causes a fatal error:

tex error   > tex error on line 9 in file ./Untitled.tex: Incompatible glue 
units (case 1)
that's an interesting case for the engine (Mixing regular and mu skips 
and so) ... we mighth finaly have a valid case for a primitive zero test


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Spacing in \unit

2022-09-25 Thread Gavin via ntg-context
Hello list,

I have a few questions about space produced by the unit command. Consider this 
MWE

\starttext
\unit{3.00e8 kg m/s}

$\unit{3.00e8 kg m/s}$
\stoptext

The dot between “kg” and “m” has different spacing depending on whether the 
\unit command is in text or math mode. I think that the tighter spacing in the 
first one, in text, is correct.

I personally would also like less space around the \times. To me, the number 
3.00e8 should be typeset more like a single number, rather than like a product 
of 3.00 and 10^8. I am probably in the minority here. If \unit and \digit had 
an option for tighter spacing around the \times, I’d use it, but the current 
output with more space is probably what most people expect and want. Perhaps 
something like [scispace=tight].

Finally, \unit does not play nicely with surrounding spaces. For example:

$2\pi\,\unit{3.00e8 kg m/s}$

causes a fatal error:

tex error   > tex error on line 9 in file ./Untitled.tex: Incompatible glue 
units (case 1)

 \phys_units_direct 
#1->\begingroup \the \everyunits \ifdim \lastskip 
>\zeropoint \settrue \c_phys_units_dospace \removelastskip \fi 
\c_phys_digits_method \unitparameter \c!method \relax \ifmmode \else 
\dontleavehmode \fi \edef \currentunit {#1}\always\edef \unitlanguag
 
    $2\pi\,\unit
{3.00e8 kg m/s}$

Using \thinspace produces the same fatal error.

Putting the 2\pi after the \unit{…} can also cause surprises.

    $\unit{3.00e8 kg m/s}\times 2\pi$

produces a \times that is right up against the “s”.

I am very happy with all of the work done on spacing in math. I hope that my 
observations above are helpful in fine-tuning the excellent system.

Thanks!
Gavin

P.S. I am on as M1 Mac, using ConTeXt  ver: 2022.09.11 20:44 LMTX  fmt: 
2022.9.25  int: english/english.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] new upload: --secure and 'dk' unit

2021-09-26 Thread Hans Hagen via ntg-context

Hi,

I uploaded a new version. The lmtx installer should now accept --secure 
(but one has to update the installation script) in which case curl is 
used when available on the system.


There are no other chnages apart from the outrcome of an 'extension 
evening session' we had last week:


/*tex

We support the Knuthian Potrzebie cf.\ \url 
{https://en.wikipedia.org/wiki/Potrzebie} as |dk|
unit. It was added 2021-09-22 exactly when we crossed the season 
during a evening session at
the 15th \CONTEXT\ meeting in Bassenge (Boirs) Belgium. It took a 
few iterations to find the
best numerator and denominator, but Taco Hoekwater, Harald Koenig 
and Mikael Sundqvist figured
it out in this interactive session. The error messages have been 
adapted accordingly and the
scanner in the |tex| library also handle it. One |dk| is 6.43985pt. 
There is no need to make
\METAPOST\ aware of this unit because there it is just a numeric 
multiplier in a macro package.


From Wikipedia:

In issue 33, Mad published a partial table of the \quotation 
{Potrzebie System of Weights and
Measures}, developed by 19-year-old Donald E. Knuth, later a famed 
computer scientist. According
to Knuth, the basis of this new revolutionary system is the 
potrzebie, which equals the thickness

of Mad issue 26, or 2.2633484517438173216473 mm [...].

*/

This is a follow up of a suggestion by Hraban (on the meeting attendents 
list): a new unit. We have 'sp' for an unscaled unit (kind of the 
internal one, also used at the lua end), 'ex', 'em', 'px' as relative 
units (the handy ones), 'mu' for math (sort of relative and adaptive 
too), which leaves 'cm', 'mm' (popular and valid SI), 'pt' (natural to 
typesetting), 'bp' (related to postscript and pdf, the unit that 
competing-to-tex programs use), 'dd' and 'cc' (for Tomas Hala), 'in' 
(for stubborn non SI users) and now also 'dk' (for Don Knuth fans).


So, Hraban (who organizes next year meeting) can now do:

\setupbodyfont[dejavu,1dk]

\starttext

1dk = \the\dimexpr1dk = \the\dimexpr2.2633484mm

{\definedfont[Mono*none @ 6pt]test}
{\definedfont[Mono*none @ 1dk]test}

\stoptext

And in case one wonders: this few line addition doesn't harm performance.

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Problems with \unit

2020-12-26 Thread Jean-Philippe Rey
Dear list,

I have found two issues with the \unit command.

1) there is a typo in phys-dim.lua, Becquerel is written Bequerel (without the 
c)

2) tonne doesn't work anymore, I guess it interferes with the new "to" goodie

Here is a minimal example

=
\starttext
\unit{15 tonne} gives \quotation{15 -- nN} instead of \quotation{15 t}
\stoptext
=

Best regards,

-- 
Jean-Philippe Rey
jean-philippe@centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Use \unit for value and uncertainty

2020-05-09 Thread Otared Kavian
Hi Benjamin,

Thanks for sharing your nice code, which is very useful.
However I wanted to let you know that it seems it does not work correctly with 
LuaMetaTeX version 2020.04.30 11:10, even though it works fine with ConTeXt 
mkiv.

Best regards: Otared K.

> On 9 May 2020, at 12:39, Benjamin Buchmuller  
> wrote:
> 
> I know this is quite an old thread, but here is a minimal parser (\units with 
> an “s”) that wraps around \digits and \unit to produce an acceptable output. 
> 
> As I frequently need to write ranges (or measures of uncertainty), I find it 
> convenient to able to type
> 
> \units{4.0 to 5.0 centi meter} 
> 
> than 
> 
> \digits{4.0}\,to\,\unit{5.0 centi meter}.
> 
> Also, the parser will take care of exponents and bracket them accordingly. :D
> 
> ranges: keyword “to”: 4.0 – 5.0 cm
> SEM:keyword “se”: 4.5 ± 0.5 cm
> SD: keyword “sd”: 4.5 (0.5) cm
> 
> If no keyword is present, the default behaviour is \unit{…}.
> 
> The code is not perfect (and the level of abstraction potentially not yet 
> sufficient to make it part of the phys-dim.mkiv source), but maybe helpful.
> 
> \starttext
> 
> \startluacode
>   userdata = userdata or {}
>   
>   function userdata.units(input)
>   
>   tbl = string.explode(input)
>   
>   if tbl[2] == "to" then
>   context.digits(tbl[1])
>   context.phys_units_space()
>   context("--")
>   context.phys_units_space()
>   context.unit(table.concat(tbl, " ", 3))
>   elseif tbl[2] == "se" then
>   local sx1 = string.split(tbl[1], "e")
>   local sx2 = string.split(tbl[3], "e")
>   if (sx1[2] == sx2[2]) and not (sx1[2] == nil) then
>   context("(")
>   context.digits(sx1[1])
>   context.phys_units_space()
>   context("±")
>   context.phys_units_space()
>   context.digits(sx2[1])
>   context(")")
>   context.digits("e" .. sx1[2])
>   context.phys_units_space()
>   context.unit(table.concat(tbl, " ", 4))
>   else
>   context.digits(tbl[1])
>   context.phys_units_space()
>   context("±")
>   context.phys_units_space()
>   context.unit(table.concat(tbl, " ", 3))
>   end
>   elseif tbl[2] == "sd" then
>   local sx1 = string.split(tbl[1], "e")
>   local sx2 = string.split(tbl[3], "e")
>   if (sx1[2] == sx2[2]) and not (sx1[2] == nil) then
>   context.digits(sx1[1])
>   context.phys_units_space()
>   context("(")
>   context.digits(sx2[1])
>   context(")")
>   context.digits("e" .. sx1[2])
>   context.phys_units_space()
>   context.unit(table.concat(tbl, " ", 4))
>   else
>   context.digits(tbl[1])
>   context.phys_units_space()
>   context("(")
>   context.digits(tbl[3])
>   context(")")
>   context.unit(table.concat(tbl, " ", 4))
>   end
>   else
>   context.unit(table.concat(tbl, " "))
>   end
>   
>   end
> \stopluacode
> 
> \def\units#1{\ctxlua{userdata.units("#1")}}
> 
> Car 1 drives \units{4 to 5.2 kilo meter per hour}.
> 
> Car 2 drives \units{30.1 to 40.5 kilo meter per hour}.
> 
> Car 3 drives \units{40.= to 50.= kilo meter per hour}.
> 
> The average speed was \units{35,000 se 5000 meter per hour}.
> 
> The average speed was \units{35e3 se 0.5e3 meter per hour}.
> 
> The average speed was \units{35.2e3 se 5e2 meter per hour}.
> 
&g

Re: [NTG-context] Use \unit for value and uncertainty

2020-05-09 Thread Benjamin Buchmuller
I know this is quite an old thread, but here is a minimal parser (\units with 
an “s”) that wraps around \digits and \unit to produce an acceptable output. 

As I frequently need to write ranges (or measures of uncertainty), I find it 
convenient to able to type

\units{4.0 to 5.0 centi meter} 

than 

\digits{4.0}\,to\,\unit{5.0 centi meter}.

Also, the parser will take care of exponents and bracket them accordingly. :D

ranges: keyword “to”: 4.0 – 5.0 cm
SEM:keyword “se”: 4.5 ± 0.5 cm
SD: keyword “sd”: 4.5 (0.5) cm

If no keyword is present, the default behaviour is \unit{…}.

The code is not perfect (and the level of abstraction potentially not yet 
sufficient to make it part of the phys-dim.mkiv source), but maybe helpful.

\starttext

\startluacode
userdata = userdata or {}

function userdata.units(input)

tbl = string.explode(input)

if tbl[2] == "to" then
context.digits(tbl[1])
context.phys_units_space()
context("--")
context.phys_units_space()
context.unit(table.concat(tbl, " ", 3))
elseif tbl[2] == "se" then
local sx1 = string.split(tbl[1], "e")
local sx2 = string.split(tbl[3], "e")
if (sx1[2] == sx2[2]) and not (sx1[2] == nil) then
context("(")
context.digits(sx1[1])
context.phys_units_space()
context("±")
context.phys_units_space()
context.digits(sx2[1])
context(")")
context.digits("e" .. sx1[2])
context.phys_units_space()
context.unit(table.concat(tbl, " ", 4))
else
context.digits(tbl[1])
context.phys_units_space()
context("±")
context.phys_units_space()
context.unit(table.concat(tbl, " ", 3))
end
elseif tbl[2] == "sd" then
local sx1 = string.split(tbl[1], "e")
local sx2 = string.split(tbl[3], "e")
if (sx1[2] == sx2[2]) and not (sx1[2] == nil) then
context.digits(sx1[1])
context.phys_units_space()
context("(")
context.digits(sx2[1])
context(")")
context.digits("e" .. sx1[2])
context.phys_units_space()
context.unit(table.concat(tbl, " ", 4))
else
context.digits(tbl[1])
context.phys_units_space()
context("(")
context.digits(tbl[3])
context(")")
context.unit(table.concat(tbl, " ", 4))
end
else
context.unit(table.concat(tbl, " "))
end

end
\stopluacode

\def\units#1{\ctxlua{userdata.units("#1")}}

Car 1 drives \units{4 to 5.2 kilo meter per hour}.

Car 2 drives \units{30.1 to 40.5 kilo meter per hour}.

Car 3 drives \units{40.= to 50.= kilo meter per hour}.

The average speed was \units{35,000 se 5000 meter per hour}.

The average speed was \units{35e3 se 0.5e3 meter per hour}.

The average speed was \units{35.2e3 se 5e2 meter per hour}.

\stoptext

The average speed was \units{35.2 se 5e2 meter per hour}.

The average speed was \units{_3.2 sd 5 meter per hour}.
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Bad cooperation between \unit and TABLE

2019-11-03 Thread Tomas Hala
Hi all,

I came across the problem with bad aligment of cells in natural tables
(longer MWE below):

When I use \unit for better typesetting of units, lines 6, 6a, 8 and 9
are sloppy-aligned -- first, the alignmentcharacter is ignored,
secondly the very huge space appears between e.g. m and 2. It seems 
that it happens at any time when the exponent in any form is required.

Moreover, the line 11 is also sloppy-aligned as a consequence of the
use of \unit|\high commands because if the line 2a is active, the 
alignment position is computed properly and the line 11 is ok.

Is it a bug, or am I doing something wrong?

Best wishes,

Tomáš


\starttext
\setupTABLE[c][2][alignmentcharacter={text->,}, aligncharacter=yes, 
align={lohi,middle}]
\bTABLE
\bTR\bTD Line \#1 \eTD  \bTD39 \eTD \eTR
\bTR\bTD Line \#2 \eTD  \bTD 42,185 \eTD\eTR
%\bTR\bTD Line \#2a \eTD \bTD 55 550,21  \eTD\eTR
\bTR\bTD Line \#3 \eTD  \bTD 41,85\,\% \eTD \eTR
\bTR\bTD Line \#4 \eTD  \bTD 1125,80 centimeter \eTD\eTR
\bTR\bTD Line \#5\eTD   \bTD 1125,80 \unit{cm}  \eTD\eTR
\bTR\bTD Line \#6 \eTD  \bTD 129,30 \unit{square centimeter} \eTD\eTR
\bTR\bTD Line \#6a \eTD \bTD 129,30 \unit{m2} \eTD\eTR
\bTR\bTD Line \#7 \eTD  \bTD 129,30 \unit{m}\eTD\eTR
\bTR\bTD Line \#8 \eTD  \bTD 129,30 cm$^{\tfxx2}$\,\eTD\eTR
\bTR\bTD Line \#9 \eTD \bTD 0,21 m\high{2} \eTD\eTR
\bTR\bTD Line \#10 \eTD \bTD 41,85 \%   \eTD\eTR
\bTR\bTD Line \#11 \eTD \bTD 55 550,21  \eTD\eTR
\bTR\bTD Line \#12 \eTD \bTD 0,21   \eTD\eTR
\eTABLE
\stoptext


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Automatic thousands separation in \unit

2019-02-09 Thread Marco Patzer
On Tue, 5 Feb 2019 12:22:29 +0100
Marco Patzer  wrote:

> Is there a way to hook the \spaceddigits into \unit somehow?

I tried to add \spaceddigits to the \unit command, but it didn't
work. If someone has an idea how to do that, I'd greatly appreciate.

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Automatic thousands separation in \unit

2019-02-05 Thread Marco Patzer
On Thu, 31 Jan 2019 13:43:13 +0100
Otared Kavian  wrote:

Sorry for the late response.

> Can this give what you wish?
> 
> \define[2]\myunit{\spaceddigits{#1}\unit{#2}}
> \starttext 
> \myunit{123456789}{volt}
> \stoptext

That's a way to solve it, yes. But I'd prefer it to be integrated
into the \unit command. It looks cleaner and I don't have to modify
the sources to use a different command.

Is there a way to hook the \spaceddigits into \unit somehow?

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Automatic thousands separation in \unit

2019-02-02 Thread Axel Kielhorn

> Am 31.01.2019 um 15:00 schrieb Clyde Johnston :
> 
> Maybe this should be a language specific parameter.  How would you achieve a 
> similar result with the Indian numbering system, for instance?
>  
> Also, decimal and thousands separators vary from country to country.  In 
> France, for example, they use the comma for the decimal separator, and space 
> for the thousand separator.
>  
> Clyde

Shouldn’t \spaceddigits use the separator as defined by \setdigitmode and 
\setdigitorder?

Axel

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Hans Åberg

> On 31 Jan 2019, at 15:00, Clyde Johnston  wrote:
> 
> Maybe this should be a language specific parameter.  How would you achieve a 
> similar result with the Indian numbering system, for instance?

It is an additional feature that may or may not be linked to language. For 
example, in Swedish originally, the comma and stop are reversed relative 
English, but in modern times, a stop for decimal point might be used. To avoid 
confusion between commas and stops as decimal points there is an recommendation 
admitting both, using spaces as separators. And in India, they might prefer 
digit groups of two instead of three.

> Also, decimal and thousands separators vary from country to country.  In 
> France, for example, they use the comma for the decimal separator, and space 
> for the thousand separator. 


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Clyde Johnston
Maybe this should be a language specific parameter.  How would you achieve a
similar result with the Indian numbering system
<https://en.wikipedia.org/wiki/Indian_numbering_system> , for instance?

 

Also, decimal and thousands separators vary from country to country.  In
France, for example, they use the comma for the decimal separator, and space
for the thousand separator.

 

Clyde

 

 

From: ntg-context [mailto:ntg-context-boun...@ntg.nl] On Behalf Of Otared
Kavian
Sent: Thursday, January 31, 2019 2:43 PM
To: mailing list for ConTeXt users
Subject: Re: [NTG-context] Automatic thousands separation in \unit

 

Hi Marco,

 

Can this give what you wish?

 

\define[2]\myunit{\spaceddigits{#1}\unit{#2}}

\starttext 

\myunit{123456789}{volt}

\stoptext

 





On 31 Jan 2019, at 13:28, Marco Patzer  wrote:

 

Hi!

I'm wondering if there's a way to have automatic thousands separation in the
\unit command? \spaceddigits does that, but it doesn't work inside \unit.
And
using both would be quite verbose to write. Example:

\starttext
 %% no thousands separation
 \unit{123456789 volt}

 %% manual thousands separation works
 \unit{123,456,789 volt}

 %% automatic thousands separation, but not using \unit
 \let\spaceddigitsseparator,
 \spaceddigits{123456789}\,V

 %% fails, no output
 \unit{\spaceddigits{123456789} volt}
\stoptext

Marco

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net

___

 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Otared Kavian
Hi Marco,

Can this give what you wish?

\define[2]\myunit{\spaceddigits{#1}\unit{#2}}
\starttext 
\myunit{123456789}{volt}
\stoptext


> On 31 Jan 2019, at 13:28, Marco Patzer  wrote:
> 
> Hi!
> 
> I'm wondering if there's a way to have automatic thousands separation in the
> \unit command? \spaceddigits does that, but it doesn't work inside \unit. And
> using both would be quite verbose to write. Example:
> 
> \starttext
>  %% no thousands separation
>  \unit{123456789 volt}
> 
>  %% manual thousands separation works
>  \unit{123,456,789 volt}
> 
>  %% automatic thousands separation, but not using \unit
>  \let\spaceddigitsseparator,
>  \spaceddigits{123456789}\,V
> 
>  %% fails, no output
>  \unit{\spaceddigits{123456789} volt}
> \stoptext
> 
> Marco
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Marco Patzer
Hi!

I'm wondering if there's a way to have automatic thousands separation in the
\unit command? \spaceddigits does that, but it doesn't work inside \unit. And
using both would be quite verbose to write. Example:

\starttext
  %% no thousands separation
  \unit{123456789 volt}

  %% manual thousands separation works
  \unit{123,456,789 volt}

  %% automatic thousands separation, but not using \unit
  \let\spaceddigitsseparator,
  \spaceddigits{123456789}\,V

  %% fails, no output
  \unit{\spaceddigits{123456789} volt}
\stoptext

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Use \unit for value and uncertainty

2016-11-02 Thread Henri Menke
On 10/31/2016 05:30 PM, Florian Leupold wrote:
> Hello!
> 
> There does not seem to be a simple solution to using \unit with 
> uncertainties, see below.
> 
> Could someone maybe point me to the relevant source code for the parser for 
> \unit in MKIV? Then I would try to modify/improve the code myself.

phys-dim.mkiv
https://github.com/contextgarden/context-mirror/blob/beta/tex/context/base/mkiv/phys-dim.mkiv

phys-dim.lua
https://github.com/contextgarden/context-mirror/blob/beta/tex/context/base/mkiv/phys-dim.lua

> 
> Thanks a lot and best regards,
> Florian
> 
> 
>> On 25.09.16, at 20:11, Florian Leupold <fleup...@posteo.net> wrote:
>>
>> Dear list
>>
>> Is it possible to use the units module (in MKIV) for value plusminus 
>> uncertainty in a way similar to the \SI command in LaTeX, like
>>  \unit{(1.59\pm2)e-19 coulomb} or
>>  \unit{1.59(2)e-19 coulomb}?
>>
>> Thanks and best regards,
>> Florian
>> ___
>> 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
>> ___
> 
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> 

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Use \unit for value and uncertainty

2016-10-31 Thread Florian Leupold
Hello!

There does not seem to be a simple solution to using \unit with uncertainties, 
see below.

Could someone maybe point me to the relevant source code for the parser for 
\unit in MKIV? Then I would try to modify/improve the code myself.

Thanks a lot and best regards,
Florian


> On 25.09.16, at 20:11, Florian Leupold <fleup...@posteo.net> wrote:
> 
> Dear list
> 
> Is it possible to use the units module (in MKIV) for value plusminus 
> uncertainty in a way similar to the \SI command in LaTeX, like
>  \unit{(1.59\pm2)e-19 coulomb} or
>  \unit{1.59(2)e-19 coulomb}?
> 
> Thanks and best regards,
> Florian
> ___
> 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
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Use \unit for value and uncertainty

2016-09-25 Thread Florian Leupold
Dear list

Is it possible to use the units module (in MKIV) for value plusminus 
uncertainty in a way similar to the \SI command in LaTeX, like
  \unit{(1.59\pm2)e-19 coulomb} or
  \unit{1.59(2)e-19 coulomb}?

Thanks and best regards,
Florian


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
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] siunitx feature in unit module

2015-03-03 Thread Hans Hagen

On 3/3/2015 6:47 PM, Andrea De Michele wrote:

Romain Diss romain.d...@yahoo.fr writes:


Hi,


with siunitx LaTeX package its possible to obtain physics units like m/s
printed in different way changing one option:
e.g.
\si{\metre\per\second} produce ms^{-1}

\unit{10 meter inverse second}


Thank you.



\si[per-mode=symbol]{\metre\per\second} produce m/s

\unit{10 meter per second}


\si[per-mode=fraction]{\metre\per\second} produce \frac{m}{s}

I think it is not possible with \unit{}


Do you know if there is the project to implement this feature?


currently not on the agenda

-
  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] siunitx feature in unit module

2015-03-03 Thread Andrea De Michele
Romain Diss romain.d...@yahoo.fr writes:

 Hi,

 with siunitx LaTeX package its possible to obtain physics units like m/s
 printed in different way changing one option:
 e.g.
 \si{\metre\per\second} produce ms^{-1}
 \unit{10 meter inverse second}

Thank you.

 \si[per-mode=symbol]{\metre\per\second} produce m/s
 \unit{10 meter per second}

 \si[per-mode=fraction]{\metre\per\second} produce \frac{m}{s}
 I think it is not possible with \unit{}

Do you know if there is the project to implement this feature?

 All the best.

-- 
Andrea De Michele

___
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] siunitx feature in unit module

2015-03-01 Thread Romain Diss
Hi,

 with siunitx LaTeX package its possible to obtain physics units like m/s
 printed in different way changing one option:
 e.g.
 \si{\metre\per\second} produce ms^{-1}
\unit{10 meter inverse second}

 \si[per-mode=symbol]{\metre\per\second} produce m/s
\unit{10 meter per second}

 \si[per-mode=fraction]{\metre\per\second} produce \frac{m}{s}
I think it is not possible with \unit{}

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
___

[NTG-context] siunitx feature in unit module

2015-02-28 Thread Andrea De Michele
Hi,

with siunitx LaTeX package its possible to obtain physics units like m/s
printed in different way changing one option:
e.g.
\si{\metre\per\second} produce ms^{-1}
\si[per-mode=symbol]{\metre\per\second} produce m/s
\si[per-mode=fraction]{\metre\per\second} produce \frac{m}{s}

have the unit module the same feature? If yes how can obtain the effect
(I didn't find nothing on the manual)?

Thank you for help
-- 
Andrea De Michele

___
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] Problem with astronomicalunit in \unit

2014-06-01 Thread Romain Diss
Hi all,

It seems that the \unit parser doesn't recognize the 'astronomicalunit'.

Minimal exemple:
\starttext
\unit{100 astronomicalunit}
\stoptext
% Rendering gives 100 as.t
% One expect 100 au

Thanks for help.

--
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] Problem with astronomicalunit in \unit

2014-06-01 Thread Hans Hagen

On 6/1/2014 10:48 PM, Romain Diss wrote:

Hi all,

It seems that the \unit parser doesn't recognize the 'astronomicalunit'.

Minimal exemple:
\starttext
\unit{100 astronomicalunit}
\stoptext
% Rendering gives 100 as.t
% One expect 100 au


so what should be rendered?

-
  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] Problem with astronomicalunit in \unit

2014-06-01 Thread Hans Hagen

On 6/1/2014 10:48 PM, Romain Diss wrote:

Hi all,

It seems that the \unit parser doesn't recognize the 'astronomicalunit'.

Minimal exemple:
\starttext
\unit{100 astronomicalunit}


\unit { 100 astronomical unit}

works ok ... I'll add the nonspaced one


\stoptext
% Rendering gives 100 as.t
% One expect 100 au

Thanks for help.

--
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
___




--

-
  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] Add new unit to \unit comand

2013-10-06 Thread Wolfgang Schuster

Am 03.10.2013 um 14:19 schrieb Giuseppe Fierro giuse...@fierro.org:

 Hi,
 I'm a civil engineer and I like to use ConTeXt to write my report etc.
 As engineer i use a lot of units in my writing and the \unit command works 
 nice with this.
 
 What I need is a new unit, a quadratic unit like this:
 Area Moment of Inertia - Metric units mm4 cm4 m4
 
 This kind of units are quite common in civil engineer.
 
 This is an example of what i want in ConTeXt
 
 \starttext
  \unit{230.00 m^2}
 
  \unit{230.00 m^3}
 
  \unit{230.00 m^4}
 \stoptext

\starttext

\unit{230.00 square meter}

\unit{230.00 cubic meter}

\unit{230.00 quadratic meter}

\stoptext

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
___

[NTG-context] Add new unit to \unit comand

2013-10-04 Thread Giuseppe Fierro
Hi,
I'm a civil engineer and I like to use ConTeXt to write my report etc.
As engineer i use a lot of units in my writing and the \unit command works
nice with this.

What I need is a new unit, a quadratic unit like this:
Area Moment of Inertia - Metric units mm4 cm4 m4

This kind of units are quite common in civil engineer.

This is an example of what i want in ConTeXt

\starttext
 \unit{230.00 m^2}

 \unit{230.00 m^3}

 \unit{230.00 m^4}
\stoptext

Thank you
Giuseppe Fierro

-- 
This email and any attachments to it may be confidential and are intended
solely for the use of the individual to whom it is addressed. Any views or
opinions expressed are solely those of the author and do not necessarily
represent those of fierro.org.

If you are not the intended recipient of this email, you must neither take
any action based upon its contents, nor copy or show it to anyone.

Please contact the sender if you believe you have received this email in
error.
___
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] Add new unit to \unit comand

2013-10-04 Thread luigi scarso
On Thu, Oct 3, 2013 at 2:19 PM, Giuseppe Fierro giuse...@fierro.org wrote:

 Hi,
 I'm a civil engineer and I like to use ConTeXt to write my report etc.
 As engineer i use a lot of units in my writing and the \unit command works
 nice with this.

 What I need is a new unit, a quadratic unit like this:
 Area Moment of Inertia - Metric units mm4 cm4 m4

 This kind of units are quite common in civil engineer.

 This is an example of what i want in ConTeXt

 \starttext
  \unit{230.00 m^2}

  \unit{230.00 m^3}

  \unit{230.00 m^4}
 \stoptext

 Thank you
 Giuseppe Fierro


\usemodule[units]
\def\Quartic   {\dimensionpower{4}}

\starttext
Area Moment of Inertia is {10 \Quartic \Meter}  or

Area Moment of Inertia is {10 \Quartic \Deci\Meter}  or

Area Moment of Inertia is {10 \Quartic \Centi\Meter}  or

Area Moment of Inertia is {10 \Quartic \Milli\Meter}  or
%% watch the space !

Area Moment of Inertia is 10 \Quartic \Meter\  or

Area Moment of Inertia is 10 \Quartic \Meter  or

\stoptext



P.S:
http://www.guitex.org/home/en/meeting
I will be there.


-- 
luigi
___
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] Gray unit

2013-09-11 Thread Hans Hagen

On 9/10/2013 8:04 PM, Christian Prim wrote:

Hello

the physical unit Gray has Gy as symbol (see
http://en.wikipedia.org/wiki/Gray_(unit)  ).
Context returns Gr.

MWE:

\starttext
\unit{1 Gray}
\stoptext

Thanks for fixing this little bug.



patched

-
  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
___


[NTG-context] Gray unit

2013-09-10 Thread Christian Prim
Hello

the physical unit Gray has Gy as symbol (see
http://en.wikipedia.org/wiki/Gray_(unit)  ).
Context returns Gr.

MWE:

\starttext
\unit{1 Gray}
\stoptext

Thanks for fixing this little bug.

Christian
___
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] Some issues with \unit

2013-06-11 Thread Marco Patzer
Hi,

most of these issues already have been discussed last year¹, but
they don't seem to be solved, yet.

1) \unit{10^3} does display as 10✕10³. This is confusing and wrong.

2) Expressions like \unit{e3} result in ✕10³ instead of 10³. The
   multiplication sign should be dropped in this case.

3) The minus sign: \unit{e-3} It's too long. In math mode the
   correct character is used, but the spacing is messed up.

4) AFAIK there's not yet an interface to change the multiplication
   sign.

  \def\digitstimessymbol
{\kern.2\emwidth\cdot\kern.2\emwidth}

Full example:

\starttext
  \unit{10^3 second}   \crlf %% ⇒ 10✕10³ s
  \unit{10^{-3} second}\crlf %% wrong — sign, too long
  \math{\unit{10^{-3} second}} \crlf %% wrong spacing
  \unit{e3 second} \crlf %% ⇒ ✕10³ s
\stoptext


Marco

¹ http://www.ntg.nl/pipermail/ntg-context/2012/070057.html


signature.asc
Description: Digital signature
___
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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-17 Thread Hans Hagen

On 5/17/2013 1:07 AM, luigi scarso wrote:




On Fri, May 17, 2013 at 1:00 AM, Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl wrote:


(for the first time i'm seriously thinking of replacing acrobat
reader in my regular preview cycle, if only because there seems to
be no robust way to open/close docs i.e. pdfopen has to be adapted
each time)

mupdf uses SIGHUP under linux -- does windows offer a similar way ?


we only want to close a file, not the whole session


Perhaps CreateEvent ?


I don't know the details but there is some message api for acrobat i think

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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-17 Thread Alan BRASLAU
On Fri, 17 May 2013 09:53:48 +0200
Hans Hagen pra...@wxs.nl wrote:

  mupdf uses SIGHUP under linux -- does windows offer a similar way ?  
 
 we only want to close a file, not the whole session

Sending a SIGHUP signal to the mupdf process will also cause the viewed
file to be reloaded automatically, for use in e.g. build scripts.

Alan

(Also, zathura is another lightweight PDF viewer.)
___
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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-17 Thread luigi scarso
On Fri, May 17, 2013 at 11:18 AM, Alan BRASLAU alan.bras...@cea.fr wrote:

 On Fri, 17 May 2013 09:53:48 +0200
 Hans Hagen pra...@wxs.nl wrote:

   mupdf uses SIGHUP under linux -- does windows offer a similar way ?
 
  we only want to close a file, not the whole session

 Sending a SIGHUP signal to the mupdf process will also cause the viewed
 file to be reloaded automatically, for use in e.g. build scripts.

 Alan

maybe I'm wrong, but sumatrapdf already does it in windows.
Anyway, the problem is always the same: if acroreader is able to open the
file, then the file is ok, otherwise no.

-- 
luigi
___
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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-17 Thread Hans Hagen

On 5/17/2013 11:18 AM, Alan BRASLAU wrote:

On Fri, 17 May 2013 09:53:48 +0200
Hans Hagen pra...@wxs.nl wrote:


mupdf uses SIGHUP under linux -- does windows offer a similar way ?


we only want to close a file, not the whole session


Sending a SIGHUP signal to the mupdf process will also cause the viewed
file to be reloaded automatically, for use in e.g. build scripts.

Alan

(Also, zathura is another lightweight PDF viewer.)


sumatrapdf seems quite ok now, so i'll test that one for a while

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
___


[NTG-context] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-16 Thread Romain Diss
Hi all,

With this minimal example:
%%% start
\setupbodyfont[dejavu]
\starttext
  Temperature : \unit{100 celsius}.
\stoptext
%%% end

I get the °F symbol instead of °C. With lmodern or pagella (I did not try 
other fonts) the right symbol (°C) is printed.

Any idea of what goes wrong?

-- 
Romain Diss
romain.d...@yahoo.fr
___
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] Wrong °C symbol with \unit and dejavu font

2013-05-16 Thread Wolfgang Schuster

Am 16.05.2013 um 22:26 schrieb Romain Diss romain.d...@yahoo.fr:

 Hi all,
 
 With this minimal example:
 %%% start
 \setupbodyfont[dejavu]
 \starttext
  Temperature : \unit{100 celsius}.
 \stoptext
 %%% end
 
 I get the °F symbol instead of °C. With lmodern or pagella (I did not try 
 other fonts) the right symbol (°C) is printed.
 
 Any idea of what goes wrong?

It’s a typo in phys-dim.mkiv.

\unexpanded\def\checkedtextcelsius
  {\iffontchar\font2103\relax\iffontchar\font2109\relax
-℉\else\phys_units_text_celsius\fi\else\phys_units_text_celsius
+℃\else\phys_units_text_celsius\fi\else\phys_units_text_celsius
   \fi}

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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-16 Thread Hans Hagen

On 5/16/2013 10:26 PM, Romain Diss wrote:

Hi all,

With this minimal example:
%%% start
\setupbodyfont[dejavu]
\starttext
   Temperature : \unit{100 celsius}.
\stoptext
%%% end

I get the °F symbol instead of °C. With lmodern or pagella (I did not try
other fonts) the right symbol (°C) is printed.

Any idea of what goes wrong?


just a wrong reference .. fixed

btw, Does anyone know how i can get rid of this useless green signature 
fields detected bar that after the last acrobat reader update pops up 
every time i open a document typeset by context (no fun on an already 
not so high 1080 screen).


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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-16 Thread Peter Rolf
Am 16.05.2013 23:56, schrieb Hans Hagen:
 On 5/16/2013 10:26 PM, Romain Diss wrote:
 Hi all,

 With this minimal example:
 %%% start
 \setupbodyfont[dejavu]
 \starttext
Temperature : \unit{100 celsius}.
 \stoptext
 %%% end

 I get the °F symbol instead of °C. With lmodern or pagella (I did not try
 other fonts) the right symbol (°C) is printed.

 Any idea of what goes wrong?
 
 just a wrong reference .. fixed
 
 btw, Does anyone know how i can get rid of this useless green signature
 fields detected bar that after the last acrobat reader update pops up
 every time i open a document typeset by context (no fun on an already
 not so high 1080 screen).


You can try

EditPreferencesFormsAlways hide forms document message bar

That reminds me to test the pile example with the new Acroreader. I hope
Adobe has done a better job here. If it's not fixed (reported at the
beginning of the year), I will sell it as exploit ;-)


Peter

 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
 ___

___
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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-16 Thread Hans Hagen

On 5/17/2013 12:39 AM, Peter Rolf wrote:

Am 16.05.2013 23:56, schrieb Hans Hagen:

On 5/16/2013 10:26 PM, Romain Diss wrote:

Hi all,

With this minimal example:
%%% start
\setupbodyfont[dejavu]
\starttext
Temperature : \unit{100 celsius}.
\stoptext
%%% end

I get the °F symbol instead of °C. With lmodern or pagella (I did not try
other fonts) the right symbol (°C) is printed.

Any idea of what goes wrong?


just a wrong reference .. fixed

btw, Does anyone know how i can get rid of this useless green signature
fields detected bar that after the last acrobat reader update pops up
every time i open a document typeset by context (no fun on an already
not so high 1080 screen).



You can try

EditPreferencesFormsAlways hide forms document message bar


thanks, somehow i didn't relate that one to it when going through all 
these settings; it had taken me by surprise, this one; there was time 
when i had betas and could be prepared for it as well as check for 
potential issues with tex output


(for the first time i'm seriously thinking of replacing acrobat reader 
in my regular preview cycle, if only because there seems to be no robust 
way to open/close docs i.e. pdfopen has to be adapted each time)



That reminds me to test the pile example with the new Acroreader. I hope
Adobe has done a better job here. If it's not fixed (reported at the
beginning of the year), I will sell it as exploit ;-)


i used to have some similar buggy test files somewhere but probably lost 
them in the meantime


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] [***SPAM***] Wrong °C symbol with \unit and dejavu font

2013-05-16 Thread luigi scarso
On Fri, May 17, 2013 at 1:00 AM, Hans Hagen pra...@wxs.nl wrote:


 (for the first time i'm seriously thinking of replacing acrobat reader in
 my regular preview cycle, if only because there seems to be no robust way
 to open/close docs i.e. pdfopen has to be adapted each time)

mupdf uses SIGHUP under linux -- does windows offer a similar way ?

Perhaps CreateEvent ?


-- 
luigi
___
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] calculating with dimension unit

2013-04-23 Thread Jan Heinen

Ok, I now put the \ctxlua into an other chapter:

http://wiki.contextgarden.net/Calculating_with_dimension_units

Can you say something to the missing points there? Wich 
meethod?, \the and Expanding


If you don't know how to edit the context-wiki, please write 
your information here in the mailinglist - then I will put 
it into the wiki.


Regards
Jannis
___
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] calculating with dimension unit

2013-04-22 Thread Wolfgang Schuster

Am 22.04.2013 um 01:13 schrieb Jan Heinen jahei...@gmx.de:

 In a book I produced with ConTeXt last year, I did a lot of calculation to be 
 able to change the layout dynamicaly.
 
 With the actual version of ConTeXt I can't compile the book. I have tried a 
 lot of things today ... without success.
 I hope my minimal-example helps you to understand, what I want to do - and 
 what I am doing wrong:
 
 
 \starttext
 \setupexternalfigures[location={local,global,default}]
 
 \defineexpandable\ColumnA{30mm}
 \defineexpandable\ColumnB{40mm}
 \defineexpandable\ColumnABi{\dimexpr(\ColumnA + \ColumnB)}
 \defineexpandable\ColumnABii   {\ctxlua{context(\ColumnA + \ColumnB)}}
 \newdimen\ColumnABiii \ColumnABiii = \dimexpr(\ColumnA + \ColumnB)

\definemeasure[ColumnA][30mm]
\definemeasure[ColumnB][40mm]
\definemeasure[ColumnBi][\the\dimexpr(\measure{ColumnA}+\measure{ColumnB})]

 A  \ColumnA% ok
 
 B  \ColumnB% ok
 
 % I sadly get only errors when I delete the comments:
 %ColumnABi: \ColumnABi


A \measure{ColumnA}

B \measure{ColumnB}

C \measure{ColumnBi}

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] calculating with dimension unit

2013-04-22 Thread Hans Hagen

On 4/22/2013 8:48 AM, Wolfgang Schuster wrote:


Am 22.04.2013 um 01:13 schrieb Jan Heinen jahei...@gmx.de:


In a book I produced with ConTeXt last year, I did a lot of calculation to be 
able to change the layout dynamicaly.

With the actual version of ConTeXt I can't compile the book. I have tried a lot 
of things today ... without success.
I hope my minimal-example helps you to understand, what I want to do - and what 
I am doing wrong:


\starttext
\setupexternalfigures[location={local,global,default}]

\defineexpandable\ColumnA{30mm}
\defineexpandable\ColumnB{40mm}
\defineexpandable\ColumnABi{\dimexpr(\ColumnA + \ColumnB)}
\defineexpandable\ColumnABii   {\ctxlua{context(\ColumnA + \ColumnB)}}
\newdimen\ColumnABiii \ColumnABiii = \dimexpr(\ColumnA + \ColumnB)


\definemeasure[ColumnA][30mm]
\definemeasure[ColumnB][40mm]
\definemeasure[ColumnBi][\the\dimexpr(\measure{ColumnA}+\measure{ColumnB})]


FYI: \the\dimexpr... will look ahead till there's something 
nonexpandable, and contrary to what one expects


\dimexpr(...)

will not stop at the ) so, although with measures it normally goes okay, 
personally I always use \relax as terminator; the \relax will be eaten 
up so there is no interference but it guarantees to stop scanning.


(I've been wondering if we should make measured \the\dimexpr..\relax 
internally which can save dimexpr at the user end.)



A  \ColumnA% ok

B  \ColumnB% ok

% I sadly get only errors when I delete the comments:
%ColumnABi: \ColumnABi



A \measure{ColumnA}

B \measure{ColumnB}

C \measure{ColumnBi}

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
___




--

-
  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] calculating with dimension unit

2013-04-22 Thread Hans Hagen

On 4/22/2013 1:13 AM, Jan Heinen wrote:


%\externalfigure[cow][width=\ColumnABiii]


Already for quite a while some commands that take a dimension as well as 
a keyword need a verbose dimension (so \the\ColumnABiii in your case) 
because it's handled at the lua end (where at this moment we cannot deal 
with it otherwise).


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] calculating with dimension unit

2013-04-22 Thread Wolfgang Schuster

Am 22.04.2013 um 10:14 schrieb Hans Hagen pra...@wxs.nl:

 On 4/22/2013 8:48 AM, Wolfgang Schuster wrote:
 
 Am 22.04.2013 um 01:13 schrieb Jan Heinen jahei...@gmx.de:
 
 In a book I produced with ConTeXt last year, I did a lot of calculation to 
 be able to change the layout dynamicaly.
 
 With the actual version of ConTeXt I can't compile the book. I have tried a 
 lot of things today ... without success.
 I hope my minimal-example helps you to understand, what I want to do - and 
 what I am doing wrong:
 
 
 \starttext
 \setupexternalfigures[location={local,global,default}]
 
 \defineexpandable\ColumnA{30mm}
 \defineexpandable\ColumnB{40mm}
 \defineexpandable\ColumnABi{\dimexpr(\ColumnA + \ColumnB)}
 \defineexpandable\ColumnABii   {\ctxlua{context(\ColumnA + \ColumnB)}}
 \newdimen\ColumnABiii \ColumnABiii = \dimexpr(\ColumnA + \ColumnB)
 
 \definemeasure[ColumnA][30mm]
 \definemeasure[ColumnB][40mm]
 \definemeasure[ColumnBi][\the\dimexpr(\measure{ColumnA}+\measure{ColumnB})]
 
 FYI: \the\dimexpr... will look ahead till there's something nonexpandable, 
 and contrary to what one expects
 
 \dimexpr(...)
 
 will not stop at the ) so, although with measures it normally goes okay, 
 personally I always use \relax as terminator; the \relax will be eaten up so 
 there is no interference but it guarantees to stop scanning.

AFAIR the etex already mentions it.

 (I've been wondering if we should make measured \the\dimexpr..\relax 
 internally which can save dimexpr at the user end.)

+1

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] calculating with dimension unit

2013-04-22 Thread Jan Heinen

Hello,

thanks for the helpfull tipps. Only one wasn't working:

\defineexpandable\ColumnABii   {\ctxlua{context([==[\ColumnA 
+ \ColumnB]==])}}


ColumnABii: \ColumnABii

The result is:   ColumnABii: 30mm+ 40mm
And it should be ColumnABii: 70mm

And in the other cases I get back:  199.16928pt instead of 
70mm but this seems to be the same.


I think this calculating with dimension is not very well 
documented in the context-wiki.
Thus I would like to write a small article about 
Calculating with dimension units in the 
wiki.contextgarden.net to help others a bit.

Or is there already an article somewhere?

Regards
Jannis


___
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] calculating with dimension unit

2013-04-22 Thread Aditya Mahajan
 
 I think this calculating with dimension is not very well documented in the 
 context-wiki.
 Thus I would like to write a small article about Calculating with dimension 
 units in the wiki.contextgarden.net to help others a bit.
 Or is there already an article somewhere?

Such an article will be very useful. Currently the information is scattered in 
plain tex manuals, etex manual, context manuals, and context source code 
documentation. Having it in one place will make it more easily accessible. 
___
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] calculating with dimension unit

2013-04-22 Thread Aditya Mahajan


On 2013-04-22, at 6:43 AM, Wolfgang Schuster schuster.wolfg...@gmail.com 
wrote:
 
 (I've been wondering if we should make measured \the\dimexpr..\relax 
 internally which can save dimexpr at the user end.)
 
 +1

+1 from me as well. Having to use \dimexpr...\relax in definemeasure ISS bit 
awkward.  

Aditya
___
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] calculating with dimension unit

2013-04-22 Thread luigi scarso
On Mon, Apr 22, 2013 at 1:31 PM, Jan Heinen jahei...@gmx.de wrote:
 Hello,

 thanks for the helpfull tipps. Only one wasn't working:


 \defineexpandable\ColumnABii   {\ctxlua{context([==[\ColumnA +
 \ColumnB]==])}}

 ColumnABii: \ColumnABii

 The result is:   ColumnABii: 30mm+ 40mm
 And it should be ColumnABii: 70mm

ColumnABii: \the\dimexpr \ColumnABii\relax

 And in the other cases I get back:  199.16928pt instead of 70mm but this
 seems to be the same.
TeX internally uses scaled points (1pt = 2^16 scaled point)
and prints values in american point (1pt = 1/72.27 inch 1inch =2.54cm)


--
luigi
___
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] calculating with dimension unit

2013-04-22 Thread Jan Heinen

Thank you all!!

My book from last year (15.000 lines text + context-code and 
1.500 lines macro-code  now was compiled without no further 
problems!


I only had to change all
\define\variable ...

to
\defineexpandable\variable ...


I think, now I understand a little bit more about ConTeXt 
and try again to give a little bit back to the community.

I have started a new article on the context-wiki:

http://wiki.contextgarden.net/Calculating_with_dimension_units

Hopefully the more sophisticated ConTeXter help a little bit 
to improve the article. Please have a look what is wrong and 
what I have forgotten (or don't know).


Regards
Janis
___
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] calculating with dimension unit

2013-04-22 Thread Wolfgang Schuster

Am 22.04.2013 um 23:28 schrieb Jan Heinen jahei...@gmx.de:

 Thank you all!!
 
 My book from last year (15.000 lines text + context-code and 1.500 lines 
 macro-code  now was compiled without no further problems!
 
 I only had to change all
 \define\variable ...
 
 to
 \defineexpandable\variable ...
 
 
 I think, now I understand a little bit more about ConTeXt and try again to 
 give a little bit back to the community.
 I have started a new article on the context-wiki:
 
 http://wiki.contextgarden.net/Calculating_with_dimension_units
 
 Hopefully the more sophisticated ConTeXter help a little bit to improve the 
 article. Please have a look what is wrong and what I have forgotten (or don't 
 know).

The Lua version can be removed because the line

  \defineexpandable\ColumnABii   {\ctxlua{context([==[\ColumnA + \ColumnB]==])}}

is only a complicated form to write

  \defineexpandable\ColumnABii   {30mm + 40mm}

What does happen is that context replaces \ColumnA with 30mm and \ColumnB with 
40mm but nothing is calculate because the argument is a simple text string.

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
___


[NTG-context] calculating with dimension unit

2013-04-21 Thread Jan Heinen
In a book I produced with ConTeXt last year, I did a lot of 
calculation to be able to change the layout dynamicaly.


With the actual version of ConTeXt I can't compile the book. 
I have tried a lot of things today ... without success.
I hope my minimal-example helps you to understand, what I 
want to do - and what I am doing wrong:



\starttext
\setupexternalfigures[location={local,global,default}]

\defineexpandable\ColumnA{30mm}
\defineexpandable\ColumnB{40mm}
\defineexpandable\ColumnABi{\dimexpr(\ColumnA + \ColumnB)}
\defineexpandable\ColumnABii   {\ctxlua{context(\ColumnA + 
\ColumnB)}}
\newdimen\ColumnABiii \ColumnABiii = \dimexpr(\ColumnA + 
\ColumnB)


A  \ColumnA% ok

B  \ColumnB% ok

% I sadly get only errors when I delete the comments:
%ColumnABi: \ColumnABi

%ColumnABii: \ColumnABii

%ColumnABiii: \ColumnABiii

%\externalfigure[cow][width=\ColumnABiii]

~
\page
\stoptext



___
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] calculating with dimension unit

2013-04-21 Thread luigi scarso
\starttext
\setupexternalfigures[location={local,global,default}]
\defineexpandable\ColumnA{30mm}
\defineexpandable\ColumnB{40mm}
\defineexpandable\ColumnABi{\the\dimexpr(\ColumnA + \ColumnB)}
\defineexpandable\ColumnABii   {\ctxlua{context([==[\ColumnA + \ColumnB]==])}}
\newdimen\ColumnABiii \ColumnABiii=\dimexpr(\ColumnA + \ColumnB)

A  \ColumnA% ok

B  \ColumnB% ok

ColumnABi: \ColumnABi

ColumnABii: \ColumnABii

ColumnABiii: \the\ColumnABiii

\externalfigure[cow][width=\ColumnABiii]

~
\page
\stoptext
___
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 problem with powers of ten.

2012-11-24 Thread Hans Hagen

On 11/24/2012 1:48 AM, Sietse Brouwer wrote:

The '^' and 'e' all print a '10 ×' at the begining. It's what is expected
for
'e' but not for '^'. Did I miss something?



well, until now ^ and e were equivalent so if that has to change (say ^ no
10) then there need to be agreement about this as it's an incompatible
change


I, for one, would expect 2^3 to mean '2 cubed', not 2x10^3. So I'd be
in favour of this change. Then again, I have no code that depends on
the old meaning...


interesting so then we need a list of more ^2 ^3 ^4 ^5 ... and what 
about ^1.2


then, what will be the escape for the texlike 2^3? maybe $2^3$, so $ 
will leave scanning mode


the 2^3 is probably not used that much


--Sietse

P.s. Isn't MkIV known to be unstable? I thought the official advice
was If you want stability, use (a) MkII, or (b) a stable version of
MkIV, or (c) a dedicated standalone install that you do not update.


so you want instability to be a leading design principle ... i'll think 
about it


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 problem with powers of ten.

2012-11-24 Thread Romain Diss
Le samedi 24 novembre 2012, Hans Hagen a écrit :
 On 11/24/2012 1:48 AM, Sietse Brouwer wrote:
  The '^' and 'e' all print a '10 ×' at the begining. It's what is
  expected for
  'e' but not for '^'. Did I miss something?
  
  well, until now ^ and e were equivalent so if that has to change (say ^
  no 10) then there need to be agreement about this as it's an
  incompatible change
  
  I, for one, would expect 2^3 to mean '2 cubed', not 2x10^3. So I'd be
  in favour of this change. Then again, I have no code that depends on
  the old meaning...
 
 interesting so then we need a list of more ^2 ^3 ^4 ^5 ... and what
 about ^1.2
I don't know everyone's use of \units but for physicists I think that the only 
case where it should be usefull is for 10^something (like \unit{10^-12 second} 
;). Maybe the informaticians need 2^something… The other cases are probably 
marginals.

 then, what will be the escape for the texlike 2^3? maybe $2^3$, so $
 will leave scanning mode
That's already working and this should be the way when one need something 
unusual. Maybe a support for \m{} should be usefull for those who do not use 
$...$ anymore. For the moment nested curly brackets aren't supported inside a 
\m{} which himself is inside a \unit{}.

All the best.


-- 
Romain Diss
romain.d...@yahoo.fr
___
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 problem with powers of ten.

2012-11-23 Thread Sietse Brouwer
 needs testing as usual (and wiki adaption as well)

http://wiki.contextgarden.net/Command/unit

Wiki: adapted. (Page created, actually, as there was none.) Using the
fancy-schmancy {{since|2012|text=nov 2012}} template, which (1) marks
this as a recent feature, and as such not in the stable yet, and
(2) sticks it in the hidden categories [Since] and [Since 2012], so
that we may review (and remove) those tags when the new stable comes
out next year.

--Sietse

On Thu, Nov 22, 2012 at 7:09 PM, Hans Hagen pra...@wxs.nl wrote:
 On 11/19/2012 11:44 PM, Romain Diss wrote:

 Hi all,

 I got some problems to express powers of ten in the \unit command. See the
 strange behaviour with these two minimal examples.

 \starttext
 \unit{10^2 meter}\\
 \unit{10^{-12} second}
 \stoptext

 However, there is no problem with this one: \unit{1e-4 kilogram}.

 Is this a bug or are these expressions not supported?


 not supported .. i've added it to the upcoming beta:

 \starttext

 \startlines
 \unit{10^12 meter}
 \unit{10^{-12} second}
 \unit{10^{12} second}
 \unit{10e12 meter}
 \unit{10e{-12} second}
 \unit{10e{12} second}
 \stoplines

 \stoptext

 needs testing as usual (and wiki adaption as well)

 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
 ___
___
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 problem with powers of ten.

2012-11-23 Thread Romain Diss
Hi,

Le jeudi 22 novembre 2012, Hans Hagen a écrit :
 On 11/19/2012 11:44 PM, Romain Diss wrote:
  Hi all,
  
  I got some problems to express powers of ten in the \unit command. See
  the strange behaviour with these two minimal examples.
  
  \starttext
  \unit{10^2 meter}\\
  \unit{10^{-12} second}
  \stoptext
  Is this a bug or are these expressions not supported?
 
 not supported .. i've added it to the upcoming beta:
Thank you very much.

 needs testing as usual (and wiki adaption as well)
I have upgraded my context version few minutes ago:
$ context --version
mtx-context | ConTeXt Process Management 0.60
mtx-context | current version: 2012.11.23 17:35

but your following code doesn't work completely:

 \starttext
 
 \startlines
 \unit{10^12 meter}
 \unit{10^{-12} second}
 \unit{10^{12} second}
 \unit{10e12 meter}
 \unit{10e{-12} second}
 \unit{10e{12} second}
 \stoplines
 
 \stoptext

The '^' and 'e' all print a '10 ×' at the begining. It's what is expected for 
'e' but not for '^'. Did I miss something?

-- 
Romain Diss
romain.d...@yahoo.fr
___
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 problem with powers of ten.

2012-11-23 Thread Hans Hagen

On 11/23/2012 8:25 PM, Romain Diss wrote:

Hi,

Le jeudi 22 novembre 2012, Hans Hagen a écrit :

On 11/19/2012 11:44 PM, Romain Diss wrote:

Hi all,

I got some problems to express powers of ten in the \unit command. See
the strange behaviour with these two minimal examples.

\starttext
\unit{10^2 meter}\\
\unit{10^{-12} second}
\stoptext
Is this a bug or are these expressions not supported?


not supported .. i've added it to the upcoming beta:

Thank you very much.


needs testing as usual (and wiki adaption as well)

I have upgraded my context version few minutes ago:
$ context --version
mtx-context | ConTeXt Process Management 0.60
mtx-context | current version: 2012.11.23 17:35

but your following code doesn't work completely:


\starttext

\startlines
\unit{10^12 meter}
\unit{10^{-12} second}
\unit{10^{12} second}
\unit{10e12 meter}
\unit{10e{-12} second}
\unit{10e{12} second}
\stoplines

\stoptext


The '^' and 'e' all print a '10 ×' at the begining. It's what is expected for
'e' but not for '^'. Did I miss something?


well, until now ^ and e were equivalent so if that has to change (say ^ 
no 10) then there need to be agreement about this as it's an 
incompatible change


i only added support for {..}

-
  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
___


  1   2   3   >