units module has bug with markIV?
Hi all, "\Micro" in the "units" module failed, while "\Nano" and "\Milli" works fine. "$\mu$" works, so it doesn't look like a font problem. The following code works with pdftex/MarkII, but fails under Luatex 0.29beta/MarkIV. \usemodule[units] \starttext Hello world! $1\Micro\Meter$ $1\Micro\Second$ \stoptext Any hints? Thanks a lot! regards, shenchen
Hi all,
I wonder if anyone could help with this problem with Units in mkiv.
Thanks a lot.
regards,
shenchen
On Wed, Sep 3, 2008 at 9:36 AM, Chen Shen
Hi all, "\Micro" in the "units" module failed, while "\Nano" and "\Milli" works fine. "$\mu$" works, so it doesn't look like a font problem. The following code works with pdftex/MarkII, but fails under Luatex 0.29beta/MarkIV.
\usemodule[units] \starttext Hello world! $1\Micro\Meter$ $1\Micro\Second$ \stoptext
Any hints? Thanks a lot!
regards, shenchen
On Sat, 20 Sep 2008, Chen Shen wrote:
Hi all,
I wonder if anyone could help with this problem with Units in mkiv. Thanks a lot.
regards, shenchen
On Wed, Sep 3, 2008 at 9:36 AM, Chen Shen
wrote: Hi all, "\Micro" in the "units" module failed, while "\Nano" and "\Milli" works fine. "$\mu$" works, so it doesn't look like a font problem. The following code works with pdftex/MarkII, but fails under Luatex 0.29beta/MarkIV.
\usemodule[units] \starttext Hello world! $1\Micro\Meter$ $1\Micro\Second$ \stoptext
Any hints? Thanks a lot!
I am just writing to say that I looked at your original message, but could not figure out what is going wrong. \Micro is expanded to μ, but then something goes wrong. Hans, Taco, can you see what is happening here? Aditya
Aditya Mahajan wrote:
I am just writing to say that I looked at your original message, but could not figure out what is going wrong. \Micro is expanded to μ, but then something goes wrong.
Hans, Taco, can you see what is happening here?
That took some thinking. The error is caused by the \mathcode of µ, it is "7116, but it should be "0116. The '7' in the current definition makes it switch along with \fam. \dimensiontypeface expands to \tf, so \fam is set to 11, and that is \rm. So you end up with this minimal file: \starttext $\rm µ$ % that's U+03BC \stoptext The latin modern text (\rm) font does not have a greek alphabet. If it did, all would have worked ok. Since that cannot easily be fixed and I suspect most text fonts do not have greek, so changing the mathcode of the greek characters is probably the best solution (it affects normal math mode as well, as you can see) And as an aside, it would be nicer to use U+00B5 (mu latin) in the units module instead of U+03BC (mu greek). \def\Micro {\dimensionprefix{\iftextdimensions u\else\hbox{µ}\fi}} The \hbox is needed because \fam11 is using ec encoding, I think. (and that is problematic in its own way, but let's not go there) Best wishes, Taco
On Sat, Sep 20, 2008 at 6:28 PM, Taco Hoekwater
And as an aside, it would be nicer to use U+00B5 (mu latin) in the units module instead of U+03BC (mu greek).
\def\Micro {\dimensionprefix{\iftextdimensions u\else\hbox{µ}\fi}}
The \hbox is needed because \fam11 is using ec encoding, I think. (and that is problematic in its own way, but let's not go there)
Yes. This change to (mu latin) worked. Thank you so much for the detailed explanations. I think it is preferable to use upright greek letters in units. The shape of (mu latin) in the latin modern font isn't the prettiest design, but is still better than mixing italic mu with other upright letters in units. Besides, I guess, (mu latin) instead of u can be used in text-mode units? regards, shenchen
participants (3)
-
Aditya Mahajan
-
Chen Shen
-
Taco Hoekwater